summaryrefslogtreecommitdiffstats
path: root/kalarm/kalarmd/alarmdaemon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kalarm/kalarmd/alarmdaemon.cpp')
-rw-r--r--kalarm/kalarmd/alarmdaemon.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/kalarm/kalarmd/alarmdaemon.cpp b/kalarm/kalarmd/alarmdaemon.cpp
index 576678574..d8bcf83a2 100644
--- a/kalarm/kalarmd/alarmdaemon.cpp
+++ b/kalarm/kalarmd/alarmdaemon.cpp
@@ -24,9 +24,9 @@
#include <unistd.h>
#include <stdlib.h>
-#include <qtimer.h>
-#include <qfile.h>
-#include <qdatetime.h>
+#include <tqtimer.h>
+#include <tqfile.h>
+#include <tqdatetime.h>
#include <kapplication.h>
#include <kstandarddirs.h>
@@ -54,13 +54,13 @@ static const int KALARM_AUTOSTART_TIMEOUT = 30;
static const int SECS_PER_DAY = 3600 * 24;
// KAlarm config file keys
-static const QString START_OF_DAY(QString::fromLatin1("StartOfDay"));
-static const QString AUTOSTART_TRAY(QString::fromLatin1("AutostartTray"));
+static const TQString START_OF_DAY(TQString::fromLatin1("StartOfDay"));
+static const TQString AUTOSTART_TRAY(TQString::fromLatin1("AutostartTray"));
-AlarmDaemon::AlarmDaemon(bool autostart, QObject *parent, const char *name)
+AlarmDaemon::AlarmDaemon(bool autostart, TQObject *parent, const char *name)
: DCOPObject(name),
- QObject(parent, name),
+ TQObject(parent, name),
mAlarmTimer(0)
{
kdDebug(5900) << "AlarmDaemon::AlarmDaemon()" << endl;
@@ -84,12 +84,12 @@ AlarmDaemon::AlarmDaemon(bool autostart, QObject *parent, const char *name)
* itself and instead will simply open a new window.
*/
KConfig kaconfig(locate("config", "kalarmrc"));
- kaconfig.setGroup(QString::fromLatin1("General"));
+ kaconfig.setGroup(TQString::fromLatin1("General"));
autostart = kaconfig.readBoolEntry(AUTOSTART_TRAY, false);
if (autostart)
{
kdDebug(5900) << "AlarmDaemon::AlarmDaemon(): wait to autostart KAlarm\n";
- QTimer::singleShot(KALARM_AUTOSTART_TIMEOUT * 1000, this, SLOT(autostartKAlarm()));
+ TQTimer::singleShot(KALARM_AUTOSTART_TIMEOUT * 1000, this, TQT_SLOT(autostartKAlarm()));
}
}
if (!autostart)
@@ -118,9 +118,9 @@ void AlarmDaemon::autostartKAlarm()
return; // KAlarm has already registered with us
}
kdDebug(5900) << "AlarmDaemon::autostartKAlarm(): starting KAlarm\n";
- QStringList args;
- args << QString::fromLatin1("--tray");
- int ret = KApplication::kdeinitExec(QString::fromLatin1("kalarm"), args);
+ TQStringList args;
+ args << TQString::fromLatin1("--tray");
+ int ret = KApplication::kdeinitExec(TQString::fromLatin1("kalarm"), args);
if (ret)
kdError(5900) << "AlarmDaemon::autostartKAlarm(): error=" << ret << endl;
else
@@ -136,8 +136,8 @@ void AlarmDaemon::autostartKAlarm()
void AlarmDaemon::startMonitoring()
{
// Set up the alarm timer
- mAlarmTimer = new QTimer(this);
- connect(mAlarmTimer, SIGNAL(timeout()), SLOT(checkAlarmsSlot()));
+ mAlarmTimer = new TQTimer(this);
+ connect(mAlarmTimer, TQT_SIGNAL(timeout()), TQT_SLOT(checkAlarmsSlot()));
setTimerStatus();
// Start monitoring calendar files.
@@ -149,7 +149,7 @@ void AlarmDaemon::startMonitoring()
/******************************************************************************
* DCOP call to enable or disable monitoring of a calendar.
*/
-void AlarmDaemon::enableCal(const QString& urlString, bool enable)
+void AlarmDaemon::enableCal(const TQString& urlString, bool enable)
{
kdDebug(5900) << "AlarmDaemon::enableCal(" << urlString << ")" << endl;
ADCalendar* cal = ADCalendar::getCalendar(urlString);
@@ -163,7 +163,7 @@ void AlarmDaemon::enableCal(const QString& urlString, bool enable)
/******************************************************************************
* DCOP call to reload, and optionally reset, the specified calendar.
*/
-void AlarmDaemon::reloadCal(const QCString& appname, const QString& urlString, bool reset)
+void AlarmDaemon::reloadCal(const TQCString& appname, const TQString& urlString, bool reset)
{
kdDebug(5900) << "AlarmDaemon::reloadCal(" << urlString << ")" << endl;
ADCalendar* cal = ADCalendar::getCalendar(urlString);
@@ -185,7 +185,7 @@ void AlarmDaemon::reloadCal(ADCalendar* cal, bool reset)
{
cal->close();
if (!cal->setLoadedConnected())
- connect(cal, SIGNAL(loaded(ADCalendar*, bool)), SLOT(calendarLoaded(ADCalendar*, bool)));
+ connect(cal, TQT_SIGNAL(loaded(ADCalendar*, bool)), TQT_SLOT(calendarLoaded(ADCalendar*, bool)));
cal->loadFile(reset);
}
else if (reset)
@@ -205,9 +205,9 @@ void AlarmDaemon::calendarLoaded(ADCalendar* cal, bool success)
* DCOP call to notify the daemon that an event has been handled, and optionally
* to tell it to reload the calendar.
*/
-void AlarmDaemon::eventHandled(const QCString& appname, const QString& calendarUrl, const QString& eventID, bool reload)
+void AlarmDaemon::eventHandled(const TQCString& appname, const TQString& calendarUrl, const TQString& eventID, bool reload)
{
- QString urlString = expandURL(calendarUrl);
+ TQString urlString = expandURL(calendarUrl);
kdDebug(5900) << "AlarmDaemon::eventHandled(" << urlString << (reload ? "): reload" : ")") << endl;
ADCalendar* cal = ADCalendar::getCalendar(urlString);
if (!cal || cal->appName() != appname)
@@ -224,8 +224,8 @@ void AlarmDaemon::eventHandled(const QCString& appname, const QString& calendarU
* a hang if the daemon happens to send a notification to KAlarm at the
* same time as KAlarm calls this DCCOP method.
*/
-void AlarmDaemon::registerApp(const QCString& appName, const QString& appTitle,
- const QCString& dcopObject, const QString& calendarUrl,
+void AlarmDaemon::registerApp(const TQCString& appName, const TQString& appTitle,
+ const TQCString& dcopObject, const TQString& calendarUrl,
bool startClient)
{
kdDebug(5900) << "AlarmDaemon::registerApp(" << appName << ", " << appTitle << ", "
@@ -280,7 +280,7 @@ void AlarmDaemon::registerApp(const QCString& appName, const QString& appTitle,
* a hang if the daemon happens to send a notification to KAlarm at the
* same time as KAlarm calls this DCCOP method.
*/
-void AlarmDaemon::registerChange(const QCString& appName, bool startClient)
+void AlarmDaemon::registerChange(const TQCString& appName, bool startClient)
{
kdDebug(5900) << "AlarmDaemon::registerChange(" << appName << ", " << startClient << ")" << endl;
KAlarmd::RegisterResult result;
@@ -330,7 +330,7 @@ void AlarmDaemon::checkAlarmsSlot()
}
else if (--mAlarmTimerSyncCount <= 0)
{
- int interval = DAEMON_CHECK_INTERVAL + 1 - QTime::currentTime().second();
+ int interval = DAEMON_CHECK_INTERVAL + 1 - TQTime::currentTime().second();
if (interval < DAEMON_CHECK_INTERVAL - 1)
{
// Need to re-synch to 1 second past the minute
@@ -365,59 +365,59 @@ void AlarmDaemon::checkAlarms(ADCalendar* cal)
if (!cal->loaded() || !cal->enabled())
return;
- QDateTime now = QDateTime::currentDateTime();
+ TQDateTime now = TQDateTime::currentDateTime();
kdDebug(5901) << " To: " << now.toString() << endl;
- QValueList<KCal::Alarm*> alarms = cal->alarmsTo(now);
+ TQValueList<KCal::Alarm*> alarms = cal->alarmsTo(now);
if (!alarms.count())
return;
- QValueList<KCal::Event*> eventsDone;
- for (QValueList<KCal::Alarm*>::ConstIterator it = alarms.begin(); it != alarms.end(); ++it)
+ TQValueList<KCal::Event*> eventsDone;
+ for (TQValueList<KCal::Alarm*>::ConstIterator it = alarms.begin(); it != alarms.end(); ++it)
{
KCal::Event* event = dynamic_cast<KCal::Event*>((*it)->parent());
if (!event || eventsDone.find(event) != eventsDone.end())
continue; // either not an event, or the event has already been processed
eventsDone += event;
- const QString& eventID = event->uid();
+ const TQString& eventID = event->uid();
kdDebug(5901) << "AlarmDaemon::checkAlarms(): event " << eventID << endl;
// Check which of the alarms for this event are due.
// The times in 'alarmtimes' corresponding to due alarms are set.
// The times for non-due alarms are set invalid in 'alarmtimes'.
bool recurs = event->doesRecur();
- const QStringList cats = event->categories();
- bool floats = (cats.find(QString::fromLatin1("DATE")) != cats.end());
- QDateTime nextDateTime = event->dtStart();
+ const TQStringList cats = event->categories();
+ bool floats = (cats.find(TQString::fromLatin1("DATE")) != cats.end());
+ TQDateTime nextDateTime = event->dtStart();
if (recurs)
{
- QString prop = event->customProperty("KALARM", "NEXTRECUR");
+ TQString prop = event->customProperty("KALARM", "NEXTRECUR");
if (prop.length() >= 8)
{
// The next due recurrence time is specified
- QDate d(prop.left(4).toInt(), prop.mid(4,2).toInt(), prop.mid(6,2).toInt());
+ TQDate d(prop.left(4).toInt(), prop.mid(4,2).toInt(), prop.mid(6,2).toInt());
if (d.isValid())
{
if (floats && prop.length() == 8)
nextDateTime = d;
- else if (!floats && prop.length() == 15 && prop[8] == QChar('T'))
+ else if (!floats && prop.length() == 15 && prop[8] == TQChar('T'))
{
- QTime t(prop.mid(9,2).toInt(), prop.mid(11,2).toInt(), prop.mid(13,2).toInt());
+ TQTime t(prop.mid(9,2).toInt(), prop.mid(11,2).toInt(), prop.mid(13,2).toInt());
if (t.isValid())
- nextDateTime = QDateTime(d, t);
+ nextDateTime = TQDateTime(d, t);
}
}
}
}
if (floats)
nextDateTime.setTime(mStartOfDay);
- QValueList<QDateTime> alarmtimes;
+ TQValueList<TQDateTime> alarmtimes;
KCal::Alarm::List alarms = event->alarms();
for (KCal::Alarm::List::ConstIterator al = alarms.begin(); al != alarms.end(); ++al)
{
KCal::Alarm* alarm = *al;
- QDateTime dt;
+ TQDateTime dt;
if (alarm->enabled())
{
- QDateTime dt1;
+ TQDateTime dt1;
if (!alarm->hasTime())
{
// Find the latest recurrence for the alarm.
@@ -429,7 +429,7 @@ void AlarmDaemon::checkAlarms(ADCalendar* cal)
{
dt1 = nextDateTime.addSecs(floats ? (offset/SECS_PER_DAY)*SECS_PER_DAY : offset);
if (dt1 > now)
- dt1 = QDateTime();
+ dt1 = TQDateTime();
}
}
// Get latest due repetition, or the recurrence time if none
@@ -438,7 +438,7 @@ void AlarmDaemon::checkAlarms(ADCalendar* cal)
{
int snoozeSecs = alarm->snoozeTime() * 60;
int offset = alarm->repeatCount() * snoozeSecs;
- QDateTime lastRepetition = nextDateTime.addSecs(floats ? (offset/SECS_PER_DAY)*SECS_PER_DAY : offset);
+ TQDateTime lastRepetition = nextDateTime.addSecs(floats ? (offset/SECS_PER_DAY)*SECS_PER_DAY : offset);
if (lastRepetition <= now)
dt = lastRepetition;
else
@@ -466,11 +466,11 @@ void AlarmDaemon::checkAlarms(ADCalendar* cal)
* Send a DCOP message to KAlarm telling it that an alarm should now be handled.
* Reply = false if the event should be held pending until KAlarm can be started.
*/
-bool AlarmDaemon::notifyEvent(ADCalendar* calendar, const QString& eventID)
+bool AlarmDaemon::notifyEvent(ADCalendar* calendar, const TQString& eventID)
{
if (!calendar)
return true;
- QCString appname = calendar->appName();
+ TQCString appname = calendar->appName();
const ClientInfo* client = ClientInfo::get(appname);
if (!client)
{
@@ -478,7 +478,7 @@ bool AlarmDaemon::notifyEvent(ADCalendar* calendar, const QString& eventID)
return false;
}
kdDebug(5900) << "AlarmDaemon::notifyEvent(" << appname << ", " << eventID << "): notification type=" << client->startClient() << endl;
- QString id = QString::fromLatin1("ad:") + eventID; // prefix to indicate that the notification if from the daemon
+ TQString id = TQString::fromLatin1("ad:") + eventID; // prefix to indicate that the notification if from the daemon
// Check if the client application is running and ready to receive notification
bool registered = kapp->dcopClient()->isApplicationRegistered(static_cast<const char*>(appname));
@@ -504,7 +504,7 @@ bool AlarmDaemon::notifyEvent(ADCalendar* calendar, const QString& eventID)
// Start KAlarm, using the command line to specify the alarm
KProcess p;
- QString cmd = locate("exe", appname);
+ TQString cmd = locate("exe", appname);
if (cmd.isEmpty())
{
kdDebug(5900) << "AlarmDaemon::notifyEvent(): '" << appname << "' not found" << endl;
@@ -553,7 +553,7 @@ void AlarmDaemon::setTimerStatus()
{
// Timeout every minute.
// But first synchronise to one second after the minute boundary.
- int firstInterval = DAEMON_CHECK_INTERVAL + 1 - QTime::currentTime().second();
+ int firstInterval = DAEMON_CHECK_INTERVAL + 1 - TQTime::currentTime().second();
mAlarmTimer->start(1000 * firstInterval);
mAlarmTimerSyncing = (firstInterval != DAEMON_CHECK_INTERVAL);
kdDebug(5900) << "Started alarm timer" << endl;
@@ -574,7 +574,7 @@ void AlarmDaemon::notifyCalStatus(const ADCalendar* cal)
ClientInfo* client = ClientInfo::get(cal);
if (!client)
return;
- QCString appname = client->appName();
+ TQCString appname = client->appName();
if (kapp->dcopClient()->isApplicationRegistered(static_cast<const char*>(appname)))
{
KAlarmd::CalendarStatus change = cal->available() ? (cal->enabled() ? KAlarmd::CALENDAR_ENABLED : KAlarmd::CALENDAR_DISABLED)
@@ -595,8 +595,8 @@ void AlarmDaemon::notifyCalStatus(const ADCalendar* cal)
void AlarmDaemon::readKAlarmConfig()
{
KConfig config(locate("config", "kalarmrc"));
- config.setGroup(QString::fromLatin1("General"));
- QDateTime defTime(QDate(1900,1,1), QTime());
+ config.setGroup(TQString::fromLatin1("General"));
+ TQDateTime defTime(TQDate(1900,1,1), TQTime());
mStartOfDay = config.readDateTimeEntry(START_OF_DAY, &defTime).time();
kdDebug(5900) << "AlarmDaemon::readKAlarmConfig()" << endl;
}
@@ -606,9 +606,9 @@ void AlarmDaemon::readKAlarmConfig()
* (We must store full URLs in the calendar data since otherwise later calls to
* reload or remove calendars won't necessarily find a match.)
*/
-QString AlarmDaemon::expandURL(const QString& urlString)
+TQString AlarmDaemon::expandURL(const TQString& urlString)
{
if (urlString.isEmpty())
- return QString();
+ return TQString();
return KURL(urlString).url();
}