diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /kalarm/alarmcalendar.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-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 'kalarm/alarmcalendar.cpp')
-rw-r--r-- | kalarm/alarmcalendar.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/kalarm/alarmcalendar.cpp b/kalarm/alarmcalendar.cpp index 85c4f7bcf..4b03f3050 100644 --- a/kalarm/alarmcalendar.cpp +++ b/kalarm/alarmcalendar.cpp @@ -22,10 +22,10 @@ #include <unistd.h> #include <time.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qregexp.h> -#include <qtimer.h> +#include <tqfile.h> +#include <tqtextstream.h> +#include <tqregexp.h> +#include <tqtimer.h> #include <klocale.h> #include <kmessagebox.h> @@ -59,19 +59,19 @@ extern "C" { using namespace KCal; -QString AlarmCalendar::icalProductId() +TQString AlarmCalendar::icalProductId() { - return QString::fromLatin1("-//K Desktop Environment//NONSGML " KALARM_NAME " %1//EN").arg(KAlarm::currentCalendarVersionString()); + return TQString::fromLatin1("-//K Desktop Environment//NONSGML " KALARM_NAME " %1//EN").arg(KAlarm::currentCalendarVersionString()); } static const KAEvent::Status eventTypes[AlarmCalendar::NCALS] = { KAEvent::ACTIVE, KAEvent::EXPIRED, KAEvent::DISPLAYING, KAEvent::TEMPLATE }; -static const QString calendarNames[AlarmCalendar::NCALS] = { - QString::fromLatin1("calendar.ics"), - QString::fromLatin1("expired.ics"), - QString::fromLatin1("displaying.ics"), - QString::fromLatin1("template.ics") +static const TQString calendarNames[AlarmCalendar::NCALS] = { + TQString::fromLatin1("calendar.ics"), + TQString::fromLatin1("expired.ics"), + TQString::fromLatin1("displaying.ics"), + TQString::fromLatin1("template.ics") }; static KStaticDeleter<AlarmCalendar> calendarDeleter[AlarmCalendar::NCALS]; // ensure that the calendar destructors are called @@ -91,17 +91,17 @@ AlarmCalendar* AlarmCalendar::mCalendars[NCALS] = { 0, 0, 0, 0 }; bool AlarmCalendar::initialiseCalendars() { KConfig* config = kapp->config(); - config->setGroup(QString::fromLatin1("General")); - QString activeKey = QString::fromLatin1("Calendar"); - QString expiredKey = QString::fromLatin1("ExpiredCalendar"); - QString templateKey = QString::fromLatin1("TemplateCalendar"); - QString displayCal, activeCal, expiredCal, templateCal; + config->setGroup(TQString::fromLatin1("General")); + TQString activeKey = TQString::fromLatin1("Calendar"); + TQString expiredKey = TQString::fromLatin1("ExpiredCalendar"); + TQString templateKey = TQString::fromLatin1("TemplateCalendar"); + TQString displayCal, activeCal, expiredCal, templateCal; calendarDeleter[ACTIVE].setObject(mCalendars[ACTIVE], createCalendar(ACTIVE, config, activeCal, activeKey)); calendarDeleter[EXPIRED].setObject(mCalendars[EXPIRED], createCalendar(EXPIRED, config, expiredCal, expiredKey)); calendarDeleter[DISPLAY].setObject(mCalendars[DISPLAY], createCalendar(DISPLAY, config, displayCal)); calendarDeleter[TEMPLATE].setObject(mCalendars[TEMPLATE], createCalendar(TEMPLATE, config, templateCal, templateKey)); - QString errorKey1, errorKey2; + TQString errorKey1, errorKey2; if (activeCal == displayCal) errorKey1 = activeKey; else if (expiredCal == displayCal) @@ -111,7 +111,7 @@ bool AlarmCalendar::initialiseCalendars() if (!errorKey1.isNull()) { kdError(5950) << "AlarmCalendar::initialiseCalendars(): '" << errorKey1 << "' calendar name = display calendar name\n"; - QString file = config->readPathEntry(errorKey1); + TQString file = config->readPathEntry(errorKey1); KAlarmApp::displayFatalError(i18n("%1: file name not permitted: %2").arg(errorKey1).arg(file)); return false; } @@ -138,7 +138,7 @@ bool AlarmCalendar::initialiseCalendars() } if (!mCalendars[ACTIVE]->valid()) { - QString path = mCalendars[ACTIVE]->path(); + TQString path = mCalendars[ACTIVE]->path(); kdError(5950) << "AlarmCalendar::initialiseCalendars(): invalid name: " << path << endl; KAlarmApp::displayFatalError(i18n("Invalid calendar file name: %1").arg(path)); return false; @@ -150,10 +150,10 @@ bool AlarmCalendar::initialiseCalendars() * Create an alarm calendar instance. * If 'configKey' is non-null, the calendar will be converted to ICal format. */ -AlarmCalendar* AlarmCalendar::createCalendar(CalID type, KConfig* config, QString& writePath, const QString& configKey) +AlarmCalendar* AlarmCalendar::createCalendar(CalID type, KConfig* config, TQString& writePath, const TQString& configKey) { - static QRegExp vcsRegExp(QString::fromLatin1("\\.vcs$")); - static QString ical = QString::fromLatin1(".ics"); + static TQRegExp vcsRegExp(TQString::fromLatin1("\\.vcs$")); + static TQString ical = TQString::fromLatin1(".ics"); if (configKey.isNull()) { @@ -162,7 +162,7 @@ AlarmCalendar* AlarmCalendar::createCalendar(CalID type, KConfig* config, QStrin } else { - QString readPath = config->readPathEntry(configKey, locateLocal("appdata", calendarNames[type])); + TQString readPath = config->readPathEntry(configKey, locateLocal("appdata", calendarNames[type])); writePath = readPath; writePath.replace(vcsRegExp, ical); return new AlarmCalendar(readPath, type, writePath, configKey); @@ -201,7 +201,7 @@ AlarmCalendar* AlarmCalendar::calendarOpen(CalID id) * Find and return the event with the specified ID. * The calendar searched is determined by the calendar identifier in the ID. */ -const KCal::Event* AlarmCalendar::getEvent(const QString& uniqueID) +const KCal::Event* AlarmCalendar::getEvent(const TQString& uniqueID) { if (uniqueID.isEmpty()) return 0; @@ -228,10 +228,10 @@ const KCal::Event* AlarmCalendar::getEvent(const QString& uniqueID) * If 'configKey' is also non-null, that config file entry will be updated when * the file is saved in ICal format. */ -AlarmCalendar::AlarmCalendar(const QString& path, CalID type, const QString& icalPath, - const QString& configKey) +AlarmCalendar::AlarmCalendar(const TQString& path, CalID type, const TQString& icalPath, + const TQString& configKey) : mCalendar(0), - mConfigKey(icalPath.isNull() ? QString::null : configKey), + mConfigKey(icalPath.isNull() ? TQString::null : configKey), mType(eventTypes[type]), mPurgeDays(-1), // default to not purging mOpen(false), @@ -261,7 +261,7 @@ bool AlarmCalendar::open() kdDebug(5950) << "AlarmCalendar::open(" << mUrl.prettyURL() << ")\n"; if (!mCalendar) - mCalendar = new CalendarLocal(QString::fromLatin1("UTC")); + mCalendar = new CalendarLocal(TQString::fromLatin1("UTC")); mCalendar->setLocalTime(); // write out using local time (i.e. no time zone) // Check for file's existence, assuming that it does exist when uncertain, @@ -317,7 +317,7 @@ int AlarmCalendar::load() return -2; kdDebug(5950) << "AlarmCalendar::load(): " << mUrl.prettyURL() << endl; - QString tmpFile; + TQString tmpFile; if (!KIO::NetAccess::download(mUrl, tmpFile, MainWindow::mainMainWindow())) { kdError(5950) << "AlarmCalendar::load(): Load failure" << endl; @@ -325,7 +325,7 @@ int AlarmCalendar::load() return -1; } kdDebug(5950) << "AlarmCalendar::load(): --- Downloaded to " << tmpFile << endl; - mCalendar->setTimeZoneId(QString::null); // default to the local time zone for reading + mCalendar->setTimeZoneId(TQString::null); // default to the local time zone for reading bool loaded = mCalendar->load(tmpFile); mCalendar->setLocalTime(); // write using local time (i.e. no time zone) if (!loaded) @@ -371,13 +371,13 @@ bool AlarmCalendar::reload() * Save the calendar from memory to file. * If a filename is specified, create a new calendar file. */ -bool AlarmCalendar::saveCal(const QString& newFile) +bool AlarmCalendar::saveCal(const TQString& newFile) { if (!mCalendar || !mOpen && newFile.isNull()) return false; kdDebug(5950) << "AlarmCalendar::saveCal(\"" << newFile << "\", " << mType << ")\n"; - QString saveFilename = newFile.isNull() ? mLocalFile : newFile; + TQString saveFilename = newFile.isNull() ? mLocalFile : newFile; if (mVCal && newFile.isNull() && mUrl.isLocalFile()) saveFilename = mICalUrl.path(); if (!mCalendar->save(saveFilename, new ICalFormat)) @@ -404,7 +404,7 @@ bool AlarmCalendar::saveCal(const QString& newFile) if (!mConfigKey.isNull()) { KConfig* config = kapp->config(); - config->setGroup(QString::fromLatin1("General")); + config->setGroup(TQString::fromLatin1("General")); config->writePathEntry(mConfigKey, mICalUrl.path()); config->sync(); } @@ -443,10 +443,10 @@ void AlarmCalendar::close() * Reply = true if all alarms in the calendar were successfully imported * = false if any alarms failed to be imported. */ -bool AlarmCalendar::importAlarms(QWidget* parent) +bool AlarmCalendar::importAlarms(TQWidget* parent) { - KURL url = KFileDialog::getOpenURL(QString::fromLatin1(":importalarms"), - QString::fromLatin1("*.vcs *.ics|%1").arg(i18n("Calendar Files")), parent); + KURL url = KFileDialog::getOpenURL(TQString::fromLatin1(":importalarms"), + TQString::fromLatin1("*.vcs *.ics|%1").arg(i18n("Calendar Files")), parent); if (url.isEmpty()) { kdError(5950) << "AlarmCalendar::importAlarms(): Empty URL" << endl; @@ -460,7 +460,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent) kdDebug(5950) << "AlarmCalendar::importAlarms(" << url.prettyURL() << ")" << endl; bool success = true; - QString filename; + TQString filename; bool local = url.isLocalFile(); if (local) { @@ -484,7 +484,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent) } // Read the calendar and add its alarms to the current calendars - CalendarLocal cal(QString::fromLatin1("UTC")); + CalendarLocal cal(TQString::fromLatin1("UTC")); cal.setLocalTime(); // write out using local time (i.e. no time zone) success = cal.load(filename); if (!success) @@ -544,7 +544,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent) if (alarm->type() == Alarm::Display && alarm->text().isEmpty()) alarm->setText(newev->summary()); } - newev->setSummary(QString::null); // KAlarm only uses summary for template names + newev->setSummary(TQString::null); // KAlarm only uses summary for template names } // Give the event a new ID and add it to the calendar newev->setUid(KAEvent::uid(CalFormat::createUniqueId(), type)); @@ -616,7 +616,7 @@ void AlarmCalendar::convertToICal() if (!mConfigKey.isNull()) { KConfig* config = kapp->config(); - config->setGroup(QString::fromLatin1("General")); + config->setGroup(TQString::fromLatin1("General")); config->writePathEntry(mConfigKey, mICalUrl.path()); config->sync(); } @@ -688,7 +688,7 @@ void AlarmCalendar::purgeIfQueued() { kdDebug(5950) << "AlarmCalendar::purgeIfQueued(" << mPurgeDaysQueued << ")\n"; bool changed = false; - QDate cutoff = QDate::currentDate().addDays(-mPurgeDaysQueued); + TQDate cutoff = TQDate::currentDate().addDays(-mPurgeDaysQueued); Event::List events = mCalendar->rawEvents(); for (Event::List::ConstIterator it = events.begin(); it != events.end(); ++it) { @@ -717,7 +717,7 @@ void AlarmCalendar::purgeIfQueued() void AlarmCalendar::startPurgeTimer() { if (mPurgeDays > 0) - StartOfDayTimer::connect(this, SLOT(slotPurge())); + StartOfDayTimer::connect(this, TQT_SLOT(slotPurge())); } /****************************************************************************** @@ -731,7 +731,7 @@ Event* AlarmCalendar::addEvent(KAEvent& event, bool useEventID) { if (!mOpen) return 0; - QString id = event.id(); + TQString id = event.id(); Event* kcalEvent = new Event; if (mType == KAEvent::ACTIVE) { @@ -784,7 +784,7 @@ void AlarmCalendar::updateEvent(const KAEvent& evnt) * Delete the specified event from the calendar, if it exists. * The calendar is then optionally saved. */ -bool AlarmCalendar::deleteEvent(const QString& eventID, bool saveit) +bool AlarmCalendar::deleteEvent(const TQString& eventID, bool saveit) { if (mOpen) { @@ -815,7 +815,7 @@ void AlarmCalendar::emitEmptyStatus() /****************************************************************************** * Return the event with the specified ID. */ -KCal::Event* AlarmCalendar::event(const QString& uniqueID) +KCal::Event* AlarmCalendar::event(const TQString& uniqueID) { return mCalendar ? mCalendar->event(uniqueID) : 0; } @@ -843,11 +843,11 @@ KCal::Event::List AlarmCalendar::events() /****************************************************************************** * Return all events which have alarms falling within the specified time range. */ -Event::List AlarmCalendar::eventsWithAlarms(const QDateTime& from, const QDateTime& to) +Event::List AlarmCalendar::eventsWithAlarms(const TQDateTime& from, const TQDateTime& to) { kdDebug(5950) << "AlarmCalendar::eventsWithAlarms(" << from.toString() << " - " << to.toString() << ")\n"; Event::List evnts; - QDateTime dt; + TQDateTime dt; Event::List allEvents = events(); // ignore events without usable alarms for (Event::List::ConstIterator it = allEvents.begin(); it != allEvents.end(); ++it) { @@ -883,7 +883,7 @@ Event::List AlarmCalendar::eventsWithAlarms(const QDateTime& from, const QDateTi offset = alarm->endOffset().asSeconds() + endOffset; } // Adjust the 'from' date/time and find the next recurrence at or after it - QDateTime pre = from.addSecs(-offset - 1); + TQDateTime pre = from.addSecs(-offset - 1); if (e->doesFloat() && pre.time() < Preferences::startOfDay()) pre = pre.addDays(-1); // today's recurrence (if today recurs) is still to come dt = e->recurrence()->getNextDateTime(pre); |