Example #1
0
/******************************************************************************
* 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;
    }
}