summaryrefslogtreecommitdiffstats
path: root/kalarm/daemon.cpp
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 /kalarm/daemon.cpp
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 'kalarm/daemon.cpp')
-rw-r--r--kalarm/daemon.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/kalarm/daemon.cpp b/kalarm/daemon.cpp
index 22f1fb36d..d2d2b2343 100644
--- a/kalarm/daemon.cpp
+++ b/kalarm/daemon.cpp
@@ -20,8 +20,8 @@
#include "kalarm.h"
-#include <qtimer.h>
-#include <qiconset.h>
+#include <tqtimer.h>
+#include <tqiconset.h>
#include <kstandarddirs.h>
#include <kconfig.h>
@@ -44,7 +44,7 @@
static const int REGISTER_TIMEOUT = 20; // seconds to wait before assuming registration with daemon has failed
static const char* NOTIFY_DCOP_OBJECT = "notify"; // DCOP name of KAlarm's interface for notification by alarm daemon
-static QString expandURL(const QString& urlString);
+static TQString expandURL(const TQString& urlString);
/*=============================================================================
@@ -52,25 +52,25 @@ static QString expandURL(const QString& urlString);
= Handles the the alarm daemon's client notification DCOP interface.
=============================================================================*/
-class NotificationHandler : public QObject, virtual public AlarmGuiIface
+class NotificationHandler : public TQObject, virtual public AlarmGuiIface
{
public:
NotificationHandler();
private:
// DCOP interface
- void alarmDaemonUpdate(int calendarStatus, const QString& calendarURL);
- void handleEvent(const QString& calendarURL, const QString& eventID);
+ void alarmDaemonUpdate(int calendarStatus, const TQString& calendarURL);
+ void handleEvent(const TQString& calendarURL, const TQString& eventID);
void registered(bool reregister, int result, int version);
};
Daemon* Daemon::mInstance = 0;
NotificationHandler* Daemon::mDcopHandler = 0;
-QValueList<QString> Daemon::mQueuedEvents;
-QValueList<QString> Daemon::mSavingEvents;
-QTimer* Daemon::mStartTimer = 0;
-QTimer* Daemon::mRegisterTimer = 0;
-QTimer* Daemon::mStatusTimer = 0;
+TQValueList<TQString> Daemon::mQueuedEvents;
+TQValueList<TQString> Daemon::mSavingEvents;
+TQTimer* Daemon::mStartTimer = 0;
+TQTimer* Daemon::mRegisterTimer = 0;
+TQTimer* Daemon::mStatusTimer = 0;
int Daemon::mStatusTimerCount = 0;
int Daemon::mStatusTimerInterval;
int Daemon::mStartTimeout = 0;
@@ -95,7 +95,7 @@ void Daemon::initialise()
{
if (!mInstance)
mInstance = new Daemon();
- connect(AlarmCalendar::activeCalendar(), SIGNAL(calendarSaved(AlarmCalendar*)), mInstance, SLOT(slotCalendarSaved(AlarmCalendar*)));
+ connect(AlarmCalendar::activeCalendar(), TQT_SIGNAL(calendarSaved(AlarmCalendar*)), mInstance, TQT_SLOT(slotCalendarSaved(AlarmCalendar*)));
}
/******************************************************************************
@@ -111,10 +111,10 @@ void Daemon::createDcopHandler()
mRunning = isRunning(false);
mStatusTimerInterval = Preferences::daemonTrayCheckInterval();
- Preferences::connect(SIGNAL(preferencesChanged()), mInstance, SLOT(slotPreferencesChanged()));
+ Preferences::connect(TQT_SIGNAL(preferencesChanged()), mInstance, TQT_SLOT(slotPreferencesChanged()));
- mStatusTimer = new QTimer(mInstance);
- connect(mStatusTimer, SIGNAL(timeout()), mInstance, SLOT(timerCheckIfRunning()));
+ mStatusTimer = new TQTimer(mInstance);
+ connect(mStatusTimer, TQT_SIGNAL(timeout()), mInstance, TQT_SLOT(timerCheckIfRunning()));
mStatusTimer->start(mStatusTimerInterval * 1000); // check regularly if daemon is running
}
@@ -134,7 +134,7 @@ bool Daemon::start()
return true; // we're currently waiting for the daemon to start
// Start the alarm daemon. It is a KUniqueApplication, which means that
// there is automatically only one instance of the alarm daemon running.
- QString execStr = locate("exe", QString::fromLatin1(DAEMON_APP_NAME));
+ TQString execStr = locate("exe", TQString::fromLatin1(DAEMON_APP_NAME));
if (execStr.isEmpty())
{
KMessageBox::error(0, i18n("Alarm daemon not found."));
@@ -144,8 +144,8 @@ bool Daemon::start()
KApplication::kdeinitExec(execStr);
kdDebug(5950) << "Daemon::start(): Alarm daemon started" << endl;
mStartTimeout = 5000/startCheckInterval + 1; // check daemon status for 5 seconds before giving up
- mStartTimer = new QTimer(mInstance);
- connect(mStartTimer, SIGNAL(timeout()), mInstance, SLOT(checkIfStarted()));
+ mStartTimer = new TQTimer(mInstance);
+ connect(mStartTimer, TQT_SIGNAL(timeout()), mInstance, TQT_SLOT(checkIfStarted()));
mStartTimer->start(startCheckInterval);
mInstance->checkIfStarted();
return true;
@@ -188,20 +188,20 @@ bool Daemon::registerWith(bool reregister)
bool disabledIfStopped = theApp()->alarmsDisabledIfStopped();
kdDebug(5950) << (reregister ? "Daemon::reregisterWith(): " : "Daemon::registerWith(): ") << (disabledIfStopped ? "NO_START" : "COMMAND_LINE") << endl;
- QCString appname = kapp->aboutData()->appName();
+ TQCString appname = kapp->aboutData()->appName();
AlarmDaemonIface_stub s(DAEMON_APP_NAME, DAEMON_DCOP_OBJECT);
if (reregister)
s.registerChange(appname, !disabledIfStopped);
else
- s.registerApp(appname, kapp->aboutData()->programName(), QCString(NOTIFY_DCOP_OBJECT), AlarmCalendar::activeCalendar()->urlString(), !disabledIfStopped);
+ s.registerApp(appname, kapp->aboutData()->programName(), TQCString(NOTIFY_DCOP_OBJECT), AlarmCalendar::activeCalendar()->urlString(), !disabledIfStopped);
if (!s.ok())
{
kdError(5950) << "Daemon::registerWith(" << reregister << "): DCOP error" << endl;
registrationResult(reregister, KAlarmd::FAILURE);
return false;
}
- mRegisterTimer = new QTimer(mInstance);
- connect(mRegisterTimer, SIGNAL(timeout()), mInstance, SLOT(registerTimerExpired()));
+ mRegisterTimer = new TQTimer(mInstance);
+ connect(mRegisterTimer, TQT_SIGNAL(timeout()), mInstance, TQT_SLOT(registerTimerExpired()));
mRegisterTimer->start(REGISTER_TIMEOUT * 1000); // wait for the reply
return true;
}
@@ -215,13 +215,13 @@ void Daemon::registrationResult(bool reregister, int result, int version)
delete mRegisterTimer;
mRegisterTimer = 0;
bool failed = false;
- QString errmsg;
+ TQString errmsg;
if (version && version != DAEMON_VERSION_NUM)
{
failed = true;
kdError(5950) << "Daemon::registrationResult(" << reregister << "): kalarmd reports incompatible version " << version << endl;
errmsg = i18n("Cannot enable alarms.\nInstallation or configuration error: Alarm Daemon (%1) version is incompatible.")
- .arg(QString::fromLatin1(DAEMON_APP_NAME));
+ .arg(TQString::fromLatin1(DAEMON_APP_NAME));
}
else
{
@@ -236,7 +236,7 @@ void Daemon::registrationResult(bool reregister, int result, int version)
kdError(5950) << "Daemon::registrationResult(" << reregister << "): registerApp dcop call: " << kapp->aboutData()->appName() << " not found\n";
KMessageBox::error(0, i18n("Alarms will be disabled if you stop KAlarm.\n"
"(Installation or configuration error: %1 cannot locate %2 executable.)")
- .arg(QString::fromLatin1(DAEMON_APP_NAME))
+ .arg(TQString::fromLatin1(DAEMON_APP_NAME))
.arg(kapp->aboutData()->appName()));
break;
case KAlarmd::FAILURE:
@@ -248,7 +248,7 @@ void Daemon::registrationResult(bool reregister, int result, int version)
if (!reregister)
{
errmsg = i18n("Cannot enable alarms:\nFailed to register with Alarm Daemon (%1)")
- .arg(QString::fromLatin1(DAEMON_APP_NAME));
+ .arg(TQString::fromLatin1(DAEMON_APP_NAME));
}
break;
}
@@ -304,7 +304,7 @@ void Daemon::checkIfStarted()
if (err)
{
kdError(5950) << "Daemon::checkIfStarted(): failed to start daemon" << endl;
- KMessageBox::error(0, i18n("Cannot enable alarms:\nFailed to start Alarm Daemon (%1)").arg(QString::fromLatin1(DAEMON_APP_NAME)));
+ KMessageBox::error(0, i18n("Cannot enable alarms:\nFailed to start Alarm Daemon (%1)").arg(TQString::fromLatin1(DAEMON_APP_NAME)));
}
}
@@ -327,7 +327,7 @@ void Daemon::updateRegisteredStatus(bool timeout)
// The daemon has newly been detected as registered with DCOP.
// Wait for a short time to ensure that it is ready for DCOP calls.
mStatus = RUNNING;
- QTimer::singleShot(startCheckInterval, mInstance, SLOT(slotStarted()));
+ TQTimer::singleShot(startCheckInterval, mInstance, TQT_SLOT(slotStarted()));
break;
case RUNNING:
if (timeout)
@@ -374,7 +374,7 @@ bool Daemon::reset()
if (!kapp->dcopClient()->isApplicationRegistered(DAEMON_APP_NAME))
return false;
AlarmDaemonIface_stub s(DAEMON_APP_NAME, DAEMON_DCOP_OBJECT);
- s.resetCalendar(QCString(kapp->aboutData()->appName()), AlarmCalendar::activeCalendar()->urlString());
+ s.resetCalendar(TQCString(kapp->aboutData()->appName()), AlarmCalendar::activeCalendar()->urlString());
if (!s.ok())
kdError(5950) << "Daemon::reset(): resetCalendar dcop send failed" << endl;
return true;
@@ -387,7 +387,7 @@ void Daemon::reload()
{
kdDebug(5950) << "Daemon::reload()\n";
AlarmDaemonIface_stub s(DAEMON_APP_NAME, DAEMON_DCOP_OBJECT);
- s.reloadCalendar(QCString(kapp->aboutData()->appName()), AlarmCalendar::activeCalendar()->urlString());
+ s.reloadCalendar(TQCString(kapp->aboutData()->appName()), AlarmCalendar::activeCalendar()->urlString());
if (!s.ok())
kdError(5950) << "Daemon::reload(): reloadCalendar dcop send failed" << endl;
}
@@ -414,8 +414,8 @@ void Daemon::enableAutoStart(bool enable)
// The return status doesn't report failure even if the daemon isn't running,
// so in case of failure, rewrite the config file in any case.
KConfig adconfig(locate("config", DAEMON_APP_NAME"rc"));
- adconfig.setGroup(QString::fromLatin1(DAEMON_AUTOSTART_SECTION));
- adconfig.writeEntry(QString::fromLatin1(DAEMON_AUTOSTART_KEY), enable);
+ adconfig.setGroup(TQString::fromLatin1(DAEMON_AUTOSTART_SECTION));
+ adconfig.writeEntry(TQString::fromLatin1(DAEMON_AUTOSTART_KEY), enable);
adconfig.sync();
}
@@ -437,8 +437,8 @@ void Daemon::notifyTimeChanged()
bool Daemon::autoStart()
{
KConfig adconfig(locate("config", DAEMON_APP_NAME"rc"));
- adconfig.setGroup(QString::fromLatin1(DAEMON_AUTOSTART_SECTION));
- return adconfig.readBoolEntry(QString::fromLatin1(DAEMON_AUTOSTART_KEY), true);
+ adconfig.setGroup(TQString::fromLatin1(DAEMON_AUTOSTART_SECTION));
+ return adconfig.readBoolEntry(TQString::fromLatin1(DAEMON_AUTOSTART_KEY), true);
}
/******************************************************************************
@@ -569,8 +569,8 @@ void Daemon::slotPreferencesChanged()
AlarmEnableAction* Daemon::createAlarmEnableAction(KActionCollection* actions, const char* name)
{
AlarmEnableAction* a = new AlarmEnableAction(0, actions, name);
- connect(a, SIGNAL(userClicked(bool)), mInstance, SLOT(setAlarmsEnabled(bool)));
- connect(mInstance, SIGNAL(daemonRunning(bool)), a, SLOT(setCheckedActual(bool)));
+ connect(a, TQT_SIGNAL(userClicked(bool)), mInstance, TQT_SLOT(setAlarmsEnabled(bool)));
+ connect(mInstance, TQT_SIGNAL(daemonRunning(bool)), a, TQT_SLOT(setCheckedActual(bool)));
return a;
}
@@ -600,7 +600,7 @@ void Daemon::slotCalendarSaved(AlarmCalendar* cal)
/******************************************************************************
* Note an event ID which has been triggered by the alarm daemon.
*/
-void Daemon::queueEvent(const QString& eventId)
+void Daemon::queueEvent(const TQString& eventId)
{
mQueuedEvents += eventId;
}
@@ -609,7 +609,7 @@ void Daemon::queueEvent(const QString& eventId)
* Note an event ID which is currently being saved in the calendar file, if the
* event was originally triggered by the alarm daemon.
*/
-void Daemon::savingEvent(const QString& eventId)
+void Daemon::savingEvent(const TQString& eventId)
{
if (mQueuedEvents.remove(eventId) > 0)
mSavingEvents += eventId;
@@ -619,7 +619,7 @@ void Daemon::savingEvent(const QString& eventId)
* If the event ID has been triggered by the alarm daemon, tell the daemon that
* it has been processed, and whether to reload its calendar.
*/
-void Daemon::eventHandled(const QString& eventId, bool reloadCal)
+void Daemon::eventHandled(const TQString& eventId, bool reloadCal)
{
if (mQueuedEvents.remove(eventId) > 0)
notifyEventHandled(eventId, reloadCal); // it's a daemon event, so tell daemon that it's been handled
@@ -631,11 +631,11 @@ void Daemon::eventHandled(const QString& eventId, bool reloadCal)
* Tell the daemon that an event has been processed, and whether to reload its
* calendar.
*/
-void Daemon::notifyEventHandled(const QString& eventId, bool reloadCal)
+void Daemon::notifyEventHandled(const TQString& eventId, bool reloadCal)
{
kdDebug(5950) << "Daemon::notifyEventHandled(" << eventId << (reloadCal ? "): reload" : ")") << endl;
AlarmDaemonIface_stub s(DAEMON_APP_NAME, DAEMON_DCOP_OBJECT);
- s.eventHandled(QCString(kapp->aboutData()->appName()), AlarmCalendar::activeCalendar()->urlString(), eventId, reloadCal);
+ s.eventHandled(TQCString(kapp->aboutData()->appName()), AlarmCalendar::activeCalendar()->urlString(), eventId, reloadCal);
if (!s.ok())
kdError(5950) << "Daemon::notifyEventHandled(): eventHandled dcop send failed" << endl;
}
@@ -656,7 +656,7 @@ int Daemon::maxTimeSinceCheck()
NotificationHandler::NotificationHandler()
: DCOPObject(NOTIFY_DCOP_OBJECT),
- QObject()
+ TQObject()
{
kdDebug(5950) << "NotificationHandler::NotificationHandler()\n";
}
@@ -666,7 +666,7 @@ NotificationHandler::NotificationHandler()
* The daemon notifies calendar statuses when we first register as a GUI, and whenever
* a calendar status changes. So we don't need to read its config files.
*/
-void NotificationHandler::alarmDaemonUpdate(int calendarStatus, const QString& calendarURL)
+void NotificationHandler::alarmDaemonUpdate(int calendarStatus, const TQString& calendarURL)
{
kdDebug(5950) << "NotificationHandler::alarmDaemonUpdate(" << calendarStatus << ")\n";
KAlarmd::CalendarStatus status = KAlarmd::CalendarStatus(calendarStatus);
@@ -697,10 +697,10 @@ void NotificationHandler::alarmDaemonUpdate(int calendarStatus, const QString& c
/******************************************************************************
* DCOP call from the alarm daemon to notify that an alarm is due.
*/
-void NotificationHandler::handleEvent(const QString& url, const QString& eventId)
+void NotificationHandler::handleEvent(const TQString& url, const TQString& eventId)
{
- QString id = eventId;
- if (id.startsWith(QString::fromLatin1("ad:")))
+ TQString id = eventId;
+ if (id.startsWith(TQString::fromLatin1("ad:")))
{
// It's a notification from the alarm deamon
id = id.mid(3);
@@ -723,7 +723,7 @@ void NotificationHandler::registered(bool reregister, int result, int version)
= Class: AlarmEnableAction
=============================================================================*/
-AlarmEnableAction::AlarmEnableAction(int accel, QObject* parent, const char* name)
+AlarmEnableAction::AlarmEnableAction(int accel, TQObject* parent, const char* name)
: KToggleAction(i18n("Enable &Alarms"), accel, parent, name),
mInitialised(false)
{
@@ -766,9 +766,9 @@ void AlarmEnableAction::setChecked(bool check)
* (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 expandURL(const QString& urlString)
+TQString expandURL(const TQString& urlString)
{
if (urlString.isEmpty())
- return QString();
+ return TQString();
return KURL(urlString).url();
}