/****************************************************************************** * Send a DCOP message to to the client which owns the specified calendar, * notifying it of a change in calendar status. */ void AlarmDaemon::notifyCalStatus(const ADCalendar *cal) { ClientInfo *client = ClientInfo::get(cal); if(!client) return; QCString 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) : KAlarmd::CALENDAR_UNAVAILABLE; kdDebug(5900) << "AlarmDaemon::notifyCalStatus() sending:" << appname << " -> " << change << endl; AlarmGuiIface_stub stub(appname, client->dcopObject()); stub.alarmDaemonUpdate(change, cal->urlString()); if(!stub.ok()) kdError(5900) << "AlarmDaemon::notifyCalStatus(): dcop send failed:" << appname << endl; } }
/****************************************************************************** * DCOP call to change whether KAlarm should be started when an event needs to * be notified to it. * N.B. This method must not return a bool because DCOPClient::call() can cause * 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) { kdDebug(5900) << "AlarmDaemon::registerChange(" << appName << ", " << startClient << ")" << endl; KAlarmd::RegisterResult result; ClientInfo *client = ClientInfo::get(appName); if(!client) return; // can't access client to tell it the result if(startClient && KStandardDirs::findExe(appName).isNull()) { kdError() << "AlarmDaemon::registerChange(): app not found" << endl; result = KAlarmd::NOT_FOUND; } else { client->setStartClient(startClient); ADConfigData::writeClient(appName, client); result = KAlarmd::SUCCESS; } // Notify the client of whether the call succeeded. AlarmGuiIface_stub stub(appName, client->dcopObject()); stub.registered(true, result, DAEMON_VERSION_NUM); kdDebug(5900) << "AlarmDaemon::registerChange() -> " << result << endl; }