From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libkholidays/kholidays.cpp | 44 ++++++++++++++++++++++---------------------- libkholidays/kholidays.h | 38 +++++++++++++++++++------------------- libkholidays/lunarphase.cpp | 26 +++++++++++++------------- libkholidays/lunarphase.h | 14 +++++++------- 4 files changed, 61 insertions(+), 61 deletions(-) (limited to 'libkholidays') diff --git a/libkholidays/kholidays.cpp b/libkholidays/kholidays.cpp index 9bb5c101..694a32dd 100644 --- a/libkholidays/kholidays.cpp +++ b/libkholidays/kholidays.cpp @@ -18,7 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include #include #include #include @@ -38,31 +38,31 @@ extern "C" { extern struct holiday holidays[366]; } -QStringList KHolidays::locations() +TQStringList KHolidays::locations() { - QStringList files = + TQStringList files = KGlobal::dirs()->findAllResources( "data", "libkholidays/" + generateFileName( "*" ), false, true ); - QStringList locs; + TQStringList locs; - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for ( it = files.begin(); it != files.end(); ++it ) locs.append( (*it).mid((*it).findRev('_') + 1) ); return locs; } -QString KHolidays::fileForLocation( const QString &location ) +TQString KHolidays::fileForLocation( const TQString &location ) { return locate( "data", "libkholidays/" + generateFileName( location ) ); } -QString KHolidays::userPath( bool create ) +TQString KHolidays::userPath( bool create ) { return KGlobal::dirs()->saveLocation( "data", "libkholidays/", create ); } -QString KHolidays::generateFileName( const QString &location ) +TQString KHolidays::generateFileName( const TQString &location ) { return "holiday_" + location; } @@ -70,7 +70,7 @@ QString KHolidays::generateFileName( const QString &location ) -KHolidays::KHolidays( const QString& location ) +KHolidays::KHolidays( const TQString& location ) : mLocation( location ) { mHolidayFile = fileForLocation( location ); @@ -82,20 +82,20 @@ KHolidays::~KHolidays() { } -QString KHolidays::location() const +TQString KHolidays::location() const { return mLocation; } -QString KHolidays::shortText( const QDate &date ) +TQString KHolidays::shortText( const TQDate &date ) { - QValueList lst = getHolidays( date ); + TQValueList lst = getHolidays( date ); if ( !lst.isEmpty() ) return lst.first().text; - else return QString::null; + else return TQString::null; } -bool KHolidays::parseFile( const QDate &date ) +bool KHolidays::parseFile( const TQDate &date ) { // kdDebug()<<"KHolidays::parseFile( date=" << date << ")"< lst = getHolidays( date ); + TQValueList lst = getHolidays( date ); if ( !lst.isEmpty() ) return lst.first().text; - else return QString::null; + else return TQString::null; } -QValueList KHolidays::getHolidays( const QDate &date ) +TQValueList KHolidays::getHolidays( const TQDate &date ) { - QValueList list; + TQValueList list; if ( !parseFile( date ) ) return list; struct holiday *hd = &holidays[date.dayOfYear()-1]; while ( hd ) { if ( hd->string ) { KHoliday holiday; - holiday.text = QString::fromUtf8( hd->string ); + holiday.text = TQString::fromUtf8( hd->string ); holiday.shortText = holiday.text; holiday.Category = (hd->color == 2/*red*/) || (hd->color == 9/*weekend*/) ? HOLIDAY : WORKDAY; list.append( holiday ); @@ -139,7 +139,7 @@ QValueList KHolidays::getHolidays( const QDate &date ) return list; } -int KHolidays::category( const QDate &date ) +int KHolidays::category( const TQDate &date ) { if ( !parseFile(date) ) return WORKDAY; diff --git a/libkholidays/kholidays.h b/libkholidays/kholidays.h index 2a5b9a8c..f612f838 100644 --- a/libkholidays/kholidays.h +++ b/libkholidays/kholidays.h @@ -20,16 +20,16 @@ #ifndef KHOLIDAYS_HOLIDAYS_H #define KHOLIDAYS_HOLIDAYS_H -#include -#include -#include -#include +#include +#include +#include +#include #include struct KHoliday { - QString text; - QString shortText; + TQString text; + TQString shortText; int Category; }; @@ -40,40 +40,40 @@ class KDE_EXPORT KHolidays { One of these can then be passed to the constructor for a new KHolidays object. */ - static QStringList locations(); + static TQStringList locations(); /** Return the file name for the holiday file of the given location. */ - static QString fileForLocation( const QString &location ); + static TQString fileForLocation( const TQString &location ); /** Return the directory for user-specific holiday files (i.e. somewhere below $KDEDIR/share/apps/). Don't automatically create that path by default. */ - static QString userPath( bool create = false ); + static TQString userPath( bool create = false ); /** Generate the filename (without the path) for a given region. */ - static QString generateFileName( const QString &location ); + static TQString generateFileName( const TQString &location ); - KHolidays( const QString& location ); + KHolidays( const TQString& location ); ~KHolidays(); /// return the location with which this object was constructed - QString location() const; + TQString location() const; - QValueList getHolidays( const QDate& ); + TQValueList getHolidays( const TQDate& ); - KDE_DEPRECATED QString shortText( const QDate& ); - KDE_DEPRECATED QString getHoliday( const QDate& ); + KDE_DEPRECATED TQString shortText( const TQDate& ); + KDE_DEPRECATED TQString getHoliday( const TQDate& ); enum { WORKDAY, HOLIDAY }; - KDE_DEPRECATED int category( const QDate& ); + KDE_DEPRECATED int category( const TQDate& ); private: - bool parseFile( const QDate& ); + bool parseFile( const TQDate& ); - QString mLocation; // location string used to determine holidays file - QString mHolidayFile; // name of file containing holiday data + TQString mLocation; // location string used to determine holidays file + TQString mHolidayFile; // name of file containing holiday data int mYearLast; // save off the last year we have seen }; diff --git a/libkholidays/lunarphase.cpp b/libkholidays/lunarphase.cpp index 56f5fbe5..3dace7bc 100644 --- a/libkholidays/lunarphase.cpp +++ b/libkholidays/lunarphase.cpp @@ -58,12 +58,12 @@ LunarPhase::Hemisphere LunarPhase::hemisphere() const return( mHemisphere ); } -QString LunarPhase::hemisphereStr() const +TQString LunarPhase::hemisphereStr() const { return hemisphereName( mHemisphere ); } -QString LunarPhase::hemisphereName( LunarPhase::Hemisphere hemisphere ) +TQString LunarPhase::hemisphereName( LunarPhase::Hemisphere hemisphere ) { switch( hemisphere ) { case Northern: @@ -76,12 +76,12 @@ QString LunarPhase::hemisphereName( LunarPhase::Hemisphere hemisphere ) } } -QString LunarPhase::phaseStr( const QDate &date ) const +TQString LunarPhase::phaseStr( const TQDate &date ) const { return phaseName( phase( date ) ); } -QString LunarPhase::phaseName( LunarPhase::Phase phase ) +TQString LunarPhase::phaseName( LunarPhase::Phase phase ) { switch ( phase ) { case New: @@ -98,20 +98,20 @@ QString LunarPhase::phaseName( LunarPhase::Phase phase ) break; default: case None: - return( QString::null ); + return( TQString::null ); break; } } -LunarPhase::Phase LunarPhase::phase( const QDate &date ) const +LunarPhase::Phase LunarPhase::phase( const TQDate &date ) const { Phase retPhase = None; // compute percent-full for the middle of today and yesterday. - QTime noontime( 12, 0, 0 ); - QDateTime today( date, noontime ); + TQTime noontime( 12, 0, 0 ); + TQDateTime today( date, noontime ); double todayPer = percentFull( today.toTime_t() ); - QDateTime yesterday( date.addDays(-1), noontime ); + TQDateTime yesterday( date.addDays(-1), noontime ); double yesterdayPer = percentFull( yesterday.toTime_t() ); if ( ( todayPer < 0.50 ) && ( yesterdayPer > 0.50 ) ) { @@ -120,12 +120,12 @@ LunarPhase::Phase LunarPhase::phase( const QDate &date ) const retPhase = Full; } else { // compute percent-full for the start of today. - QTime sqt( 0, 0, 0 ); - QDateTime start( date, sqt ); + TQTime sqt( 0, 0, 0 ); + TQDateTime start( date, sqt ); double startPer = percentFull( start.toTime_t() ); // compute percent-full for the end of today. - QTime eqt( 23, 59, 59 ); - QDateTime end( date, eqt ); + TQTime eqt( 23, 59, 59 ); + TQDateTime end( date, eqt ); double endPer = percentFull( end.toTime_t() ); if ( ( startPer <= 50 ) && ( endPer > 50 ) ) { diff --git a/libkholidays/lunarphase.h b/libkholidays/lunarphase.h index 9cae39ec..98a94d75 100644 --- a/libkholidays/lunarphase.h +++ b/libkholidays/lunarphase.h @@ -57,8 +57,8 @@ Note that crescent and gibbous phases are not currently supported. */ -#include -#include +#include +#include #include @@ -78,7 +78,7 @@ class LunarPhase @param date compute the lunar phase for the specified Gregorian date. */ - Phase phase( const QDate &date ) const; + Phase phase( const TQDate &date ) const; /** Return the lunar phase as a text string for the specified date. @@ -87,7 +87,7 @@ class LunarPhase @param date compute the lunar phase for the specified Gregorian date. */ - QString phaseStr( const QDate &date ) const; + TQString phaseStr( const TQDate &date ) const; /** Set the hemisphere. @@ -104,19 +104,19 @@ class LunarPhase /** Return hemisphere as a clear text string. */ - QString hemisphereStr() const; + TQString hemisphereStr() const; /** Return the string representation of hemisphere. */ - static QString hemisphereName( Hemisphere hemisphere ); + static TQString hemisphereName( Hemisphere hemisphere ); /** Return the string representation of phase. @param phase the lunar phase. */ - static QString phaseName( Phase phase ); + static TQString phaseName( Phase phase ); private: /** -- cgit v1.2.3