summaryrefslogtreecommitdiffstats
path: root/libkholidays
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /libkholidays
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libkholidays')
-rw-r--r--libkholidays/kholidays.cpp44
-rw-r--r--libkholidays/kholidays.h38
-rw-r--r--libkholidays/lunarphase.cpp26
-rw-r--r--libkholidays/lunarphase.h14
4 files changed, 61 insertions, 61 deletions
diff --git a/libkholidays/kholidays.cpp b/libkholidays/kholidays.cpp
index 9bb5c1013..694a32dd5 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 <qfile.h>
+#include <tqfile.h>
#include <kapplication.h>
#include <kstandarddirs.h>
#include <kdebug.h>
@@ -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<KHoliday> lst = getHolidays( date );
+ TQValueList<KHoliday> 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 << ")"<<endl;
int lastYear = 0; //current year less 1900
@@ -107,29 +107,29 @@ bool KHolidays::parseFile( const QDate &date )
// kdDebug()<<kdBacktrace();
mYearLast = date.year();
lastYear = date.year() - 1900; // silly parse_year takes 2 digit year...
- parse_holidays( QFile::encodeName( mHolidayFile ), lastYear, 1 );
+ parse_holidays( TQFile::encodeName( mHolidayFile ), lastYear, 1 );
}
return true;
}
-QString KHolidays::getHoliday( const QDate &date )
+TQString KHolidays::getHoliday( const TQDate &date )
{
- QValueList<KHoliday> lst = getHolidays( date );
+ TQValueList<KHoliday> lst = getHolidays( date );
if ( !lst.isEmpty() )
return lst.first().text;
- else return QString::null;
+ else return TQString::null;
}
-QValueList<KHoliday> KHolidays::getHolidays( const QDate &date )
+TQValueList<KHoliday> KHolidays::getHolidays( const TQDate &date )
{
- QValueList<KHoliday> list;
+ TQValueList<KHoliday> 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<KHoliday> 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 2a5b9a8cd..f612f8389 100644
--- a/libkholidays/kholidays.h
+++ b/libkholidays/kholidays.h
@@ -20,16 +20,16 @@
#ifndef KHOLIDAYS_HOLIDAYS_H
#define KHOLIDAYS_HOLIDAYS_H
-#include <qstring.h>
-#include <qstringlist.h>
-#include <qdatetime.h>
-#include <qvaluelist.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
+#include <tqdatetime.h>
+#include <tqvaluelist.h>
#include <kdepimmacros.h>
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<KHoliday> getHolidays( const QDate& );
+ TQValueList<KHoliday> 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 56f5fbe51..3dace7bc1 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 9cae39ec3..98a94d751 100644
--- a/libkholidays/lunarphase.h
+++ b/libkholidays/lunarphase.h
@@ -57,8 +57,8 @@
Note that crescent and gibbous phases are not currently supported.
*/
-#include <qstring.h>
-#include <qdatetime.h>
+#include <tqstring.h>
+#include <tqdatetime.h>
#include <time.h>
@@ -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:
/**