29 #include "alarmresources.h"
47 #include <kalarmcal/identities.h>
48 #include <kalarmcal/kaevent.h>
51 #include <kcalcore/event.h>
52 #include <kcalcore/icalformat.h>
53 #include <kcalcore/person.h>
54 #include <kcalcore/duration.h>
55 using namespace KCalCore;
57 #include <kcal/event.h>
58 #include <kcal/icalformat.h>
59 #include <kcal/person.h>
60 #include <kcal/duration.h>
63 #include <kpimidentities/identitymanager.h>
64 #include <kpimidentities/identity.h>
65 #include <kholidays/holidays.h>
67 #include <kconfiggroup.h>
69 #include <ktoggleaction.h>
70 #include <kactioncollection.h>
71 #include <kdbusservicestarter.h>
74 #include <kstandarddirs.h>
76 #include <ksystemtimezone.h>
77 #include <kstandardguiitem.h>
78 #include <kstandardshortcut.h>
79 #include <kfiledialog.h>
81 #include <kio/netaccess.h>
82 #include <kfileitem.h>
84 #include <ktoolinvocation.h>
87 #include <kwindowsystem.h>
88 #include <kxmessages.h>
89 #include <kstartupinfo.h>
96 #include <QDesktopWidget>
97 #include <QtDBus/QtDBus>
102 using namespace Akonadi;
108 bool refreshAlarmsQueued =
false;
109 QDBusInterface* korgInterface = 0;
111 const QLatin1String KMAIL_DBUS_SERVICE(
"org.kde.kmail");
114 const QLatin1String KORG_DBUS_SERVICE(
"org.kde.korganizer");
115 const QLatin1String KORG_DBUS_IFACE(
"org.kde.korganizer.Korganizer");
117 #define KORG_DBUS_PATH "/Korganizer"
118 #define KORG_DBUS_LOAD_PATH "/korganizer_PimApplication"
121 const QLatin1String KORG_MIME_TYPE(
"application/x-vnd.akonadi.calendar.event");
123 const QLatin1String KORGANIZER_UID(
"-korg");
125 const QLatin1String ALARM_OPTS_FILE(
"alarmopts");
126 const char* DONT_SHOW_ERRORS_GROUP =
"DontShowErrors";
129 KAlarm::UpdateStatus sendToKOrganizer(
const KAEvent&);
130 KAlarm::UpdateStatus deleteFromKOrganizer(
const QString& eventID);
131 KAlarm::UpdateStatus runKOrganizer();
132 QString uidKOrganizer(
const QString& eventID);
139 Private* Private::mInstance = 0;
145 MainWindow* displayMainWindowSelected(Akonadi::Item::Id eventId)
147 MainWindow* displayMainWindowSelected(
const QString& eventId)
153 if (
theApp()->checkCalendar())
163 win->setWindowState(win->windowState() & ~Qt::WindowMinimized);
166 win->activateWindow();
169 if (win && eventId >= 0)
172 if (win && !eventId.isEmpty())
181 KToggleAction* createAlarmEnableAction(
QObject* parent)
183 KToggleAction* action =
new KToggleAction(i18nc(
"@action",
"Enable &Alarms"), parent);
184 action->setChecked(
theApp()->alarmsEnabled());
185 QObject::connect(action, SIGNAL(toggled(
bool)),
theApp(), SLOT(setAlarmsEnabled(
bool)));
187 QObject::connect(
theApp(), SIGNAL(alarmEnabledToggled(
bool)), action, SLOT(setChecked(
bool)));
194 KAction* createStopPlayAction(
QObject* parent)
196 KAction* action =
new KAction(KIcon(QLatin1String(
"media-playback-stop")), i18nc(
"@action",
"Stop Play"), parent);
198 QObject::connect(action, SIGNAL(triggered(
bool)),
theApp(), SLOT(stopAudio()));
200 QObject::connect(
theApp(), SIGNAL(audioPlaying(
bool)), action, SLOT(setEnabled(
bool)));
207 KToggleAction* createSpreadWindowsAction(
QObject* parent)
209 KToggleAction* action =
new KToggleAction(i18nc(
"@action",
"Spread Windows"), parent);
210 QObject::connect(action, SIGNAL(triggered(
bool)),
theApp(), SLOT(spreadWindows(
bool)));
212 QObject::connect(
theApp(), SIGNAL(spreadWindowsToggled(
bool)), action, SLOT(setChecked(
bool)));
224 UpdateStatus addEvent(KAEvent& event, Collection* calendar,
QWidget* msgParent,
int options,
bool showKOrgErr)
226 UpdateStatus addEvent(KAEvent& event, AlarmResource* calendar,
QWidget* msgParent,
int options,
bool showKOrgErr)
229 kDebug() <<
event.id();
230 bool cancelled =
false;
231 UpdateStatus status = UPDATE_OK;
232 if (!
theApp()->checkCalendar())
233 status = UPDATE_FAILED;
240 if (!cal->
addEvent(event, msgParent, (options & USE_EVENT_ID), calendar, (options & NO_RESOURCE_PROMPT), &cancelled))
242 KAEvent* newev =
new KAEvent(event);
243 if (!cal->
addEvent(newev, msgParent, (options & USE_EVENT_ID), calendar, (options & NO_RESOURCE_PROMPT), &cancelled))
249 status = UPDATE_FAILED;
257 status = SAVE_FAILED;
259 if (status == UPDATE_OK)
261 if ((options & ALLOW_KORG_UPDATE) &&
event.copyToKOrganizer())
263 UpdateStatus st = sendToKOrganizer(event);
275 if (status != UPDATE_OK && !cancelled && msgParent)
276 displayUpdateError(msgParent, status, ERR_ADD, 1, 1, showKOrgErr);
285 UpdateStatus addEvents(QVector<KAEvent>& events,
QWidget* msgParent,
bool allowKOrgUpdate,
bool showKOrgErr)
287 kDebug() << events.count();
288 if (events.isEmpty())
292 UpdateStatus status = UPDATE_OK;
294 Collection collection;
296 AlarmResource* resource;
299 status = UPDATE_FAILED;
304 if (!collection.isValid())
306 resource = AlarmResources::instance()->destination(CalEvent::ACTIVE, msgParent);
310 kDebug() <<
"No calendar";
311 status = UPDATE_FAILED;
314 if (status == UPDATE_OK)
318 for (
int i = 0, end = events.count(); i < end; ++i)
322 if (!cal->
addEvent(events[i], msgParent,
false, &collection))
324 KAEvent* newev =
new KAEvent(events[i]);
325 if (!cal->
addEvent(newev, msgParent,
false, resource))
331 status = UPDATE_ERROR;
338 if (allowKOrgUpdate && events[i].copyToKOrganizer())
340 UpdateStatus st = sendToKOrganizer(events[i]);
355 if (warnErr == events.count())
356 status = UPDATE_FAILED;
357 else if (!cal->
save())
359 status = SAVE_FAILED;
364 if (status != UPDATE_OK && msgParent)
365 displayUpdateError(msgParent, status, ERR_ADD, (warnErr ? warnErr : events.count()), warnKOrg, showKOrgErr);
374 bool addArchivedEvent(KAEvent& event, Collection* collection)
376 bool addArchivedEvent(KAEvent& event, AlarmResource* resource)
379 kDebug() <<
event.id();
380 QString oldid =
event.id();
381 bool archiving = (
event.category() == CalEvent::ACTIVE);
386 KAEvent newevent(event);
387 newevent.setItemId(-1);
388 KAEvent*
const newev = &newevent;
390 KAEvent* newev =
new KAEvent(event);
394 newev->setCategory(CalEvent::ARCHIVED);
395 newev->setCreatedDateTime(KDateTime::currentUtcDateTime());
399 if (!cal->
addEvent(newevent, 0,
false, collection))
402 if (!cal->
addEvent(newev, 0,
false, resource))
429 UpdateStatus addTemplate(KAEvent& event, Collection* collection,
QWidget* msgParent)
431 UpdateStatus addTemplate(KAEvent& event, AlarmResource* resource,
QWidget* msgParent)
434 kDebug() <<
event.id();
435 UpdateStatus status = UPDATE_OK;
440 KAEvent newev(event);
441 if (!cal->
addEvent(newev, msgParent,
false, collection))
442 status = UPDATE_FAILED;
444 KAEvent* newev =
new KAEvent(event);
445 if (!cal->
addEvent(newev, msgParent,
false, resource))
448 status = UPDATE_FAILED;
459 status = SAVE_FAILED;
471 displayUpdateError(msgParent, status, ERR_TEMPLATE, 1);
480 UpdateStatus modifyEvent(KAEvent& oldEvent, KAEvent& newEvent,
QWidget* msgParent,
bool showKOrgErr)
482 kDebug() << oldEvent.id();
484 UpdateStatus status = UPDATE_OK;
485 if (!newEvent.isValid())
487 deleteEvent(oldEvent,
true);
488 status = UPDATE_FAILED;
495 QString oldId = oldEvent.id();
497 if (oldEvent.copyToKOrganizer())
503 deleteFromKOrganizer(oldId.eventId());
505 deleteFromKOrganizer(oldId);
512 status = UPDATE_FAILED;
519 KAEvent* newev =
new KAEvent(newEvent);
524 status = UPDATE_FAILED;
533 status = SAVE_FAILED;
534 if (status == UPDATE_OK)
536 if (newEvent.copyToKOrganizer())
538 UpdateStatus st = sendToKOrganizer(newEvent);
544 setDontShowErrors(oldId);
554 if (status != UPDATE_OK && msgParent)
555 displayUpdateError(msgParent, status, ERR_MODIFY, 1, 1, showKOrgErr);
566 UpdateStatus updateEvent(KAEvent& event,
QWidget* msgParent,
bool archiveOnDelete)
568 kDebug() <<
event.id();
570 if (!event.isValid())
571 deleteEvent(event, archiveOnDelete);
584 displayUpdateError(msgParent, SAVE_FAILED, ERR_ADD, 1);
601 UpdateStatus updateTemplate(KAEvent& event,
QWidget* msgParent)
605 UpdateStatus status = UPDATE_OK;
607 status = UPDATE_FAILED;
608 else if (!cal->
save())
609 status = SAVE_FAILED;
610 if (status != UPDATE_OK)
613 displayUpdateError(msgParent, SAVE_FAILED, ERR_TEMPLATE, 1);
627 UpdateStatus deleteEvent(KAEvent& event,
bool archive,
QWidget* msgParent,
bool showKOrgErr)
630 QVector<KAEvent> events(1, event);
632 KAEvent::List events;
635 return deleteEvents(events, archive, msgParent, showKOrgErr);
639 UpdateStatus deleteEvents(QVector<KAEvent>& events,
bool archive,
QWidget* msgParent,
bool showKOrgErr)
641 UpdateStatus deleteEvents(KAEvent::List& events,
bool archive,
QWidget* msgParent,
bool showKOrgErr)
644 kDebug() << events.count();
645 if (events.isEmpty())
649 UpdateStatus status = UPDATE_OK;
651 bool deleteWakeFromSuspendAlarm =
false;
652 QString wakeFromSuspendId = checkRtcWakeConfig().value(0);
653 for (
int i = 0, end = events.count(); i < end; ++i)
657 KAEvent*
event = &events[i];
659 KAEvent*
event = events[i];
661 QString
id =
event->id();
666 event->setCommandError(KAEvent::CMD_NO_ERROR);
670 if (event->category() != CalEvent::ARCHIVED)
672 if (event->copyToKOrganizer())
677 UpdateStatus st = deleteFromKOrganizer(
id);
685 if (archive && event->toBeArchived())
688 addArchivedEvent(ev);
697 status = UPDATE_ERROR;
701 if (
id == wakeFromSuspendId)
702 deleteWakeFromSuspendAlarm =
true;
706 setDontShowErrors(
EventId(*event));
708 setDontShowErrors(
id);
712 if (warnErr == events.count())
713 status = UPDATE_FAILED;
714 else if (!cal->
save())
716 status = SAVE_FAILED;
717 warnErr = events.count();
719 if (status != UPDATE_OK && msgParent)
720 displayUpdateError(msgParent, status, ERR_DELETE, warnErr, warnKOrg, showKOrgErr);
723 if (deleteWakeFromSuspendAlarm && !wakeFromSuspendId.isEmpty())
724 cancelRtcWake(msgParent, wakeFromSuspendId);
733 UpdateStatus deleteTemplates(
const KAEvent::List& events,
QWidget* msgParent)
735 UpdateStatus deleteTemplates(
const QStringList& eventIDs,
QWidget* msgParent)
739 int count = events.count();
741 int count = eventIDs.count();
747 UpdateStatus status = UPDATE_OK;
749 for (
int i = 0, end = count; i < end; ++i)
753 QString
id = eventIDs[i];
765 status = UPDATE_ERROR;
770 if (warnErr == count)
771 status = UPDATE_FAILED;
772 else if (!cal->
save())
774 status = SAVE_FAILED;
777 if (status != UPDATE_OK && msgParent)
778 displayUpdateError(msgParent, status, ERR_TEMPLATE, warnErr);
785 void deleteDisplayEvent(
const QString& eventID)
791 cal->deleteDisplayEvent(eventID,
true);
803 UpdateStatus reactivateEvent(KAEvent& event, Collection* calendar,
QWidget* msgParent,
bool showKOrgErr)
805 UpdateStatus reactivateEvent(KAEvent& event, AlarmResource* calendar,
QWidget* msgParent,
bool showKOrgErr)
809 QVector<EventId> ids;
810 QVector<KAEvent> events(1, event);
813 KAEvent::List events;
816 return reactivateEvents(events, ids, calendar, msgParent, showKOrgErr);
820 UpdateStatus reactivateEvents(QVector<KAEvent>& events, QVector<EventId>& ineligibleIDs, Collection* col,
QWidget* msgParent,
bool showKOrgErr)
822 UpdateStatus reactivateEvents(KAEvent::List& events, QStringList& ineligibleIDs, AlarmResource* resource,
QWidget* msgParent,
bool showKOrgErr)
825 kDebug() << events.count();
826 ineligibleIDs.clear();
827 if (events.isEmpty())
831 UpdateStatus status = UPDATE_OK;
833 Collection collection;
836 if (!collection.isValid())
838 if (!collection.isValid())
841 resource = AlarmResources::instance()->destination(CalEvent::ACTIVE, msgParent);
845 kDebug() <<
"No calendar";
846 status = UPDATE_FAILED;
847 warnErr = events.count();
854 KDateTime now = KDateTime::currentUtcDateTime();
855 for (
int i = 0, end = events.count(); i < end; ++i)
859 KAEvent*
event = &events[i];
861 KAEvent*
event = events[i];
863 if (event->category() != CalEvent::ARCHIVED
864 || !
event->occursAfter(now,
true))
867 ineligibleIDs +=
EventId(*event);
869 ineligibleIDs +=
event->id();
876 KAEvent newevent(*event);
877 KAEvent*
const newev = &newevent;
879 KAEvent* newev =
new KAEvent(*event);
880 QString oldid =
event->id();
882 newev->setCategory(CalEvent::ACTIVE);
883 if (newev->recurs() || newev->repetition())
884 newev->setNextOccurrence(now);
890 if (!cal->
addEvent(newevent, msgParent,
true, &collection))
892 if (!cal->
addEvent(newev, msgParent,
true, resource))
898 status = UPDATE_ERROR;
902 if (newev->copyToKOrganizer())
904 UpdateStatus st = sendToKOrganizer(*newev);
923 if (cal->
event(oldid)
927 status = UPDATE_ERROR;
931 events[i] = newevent;
937 if (warnErr == count)
938 status = UPDATE_FAILED;
940 if (!cal->
save() && status != UPDATE_FAILED)
942 status = SAVE_FAILED;
946 if (status != UPDATE_OK && msgParent)
947 displayUpdateError(msgParent, status, ERR_REACTIVATE, warnErr, warnKOrg, showKOrgErr);
956 UpdateStatus enableEvents(QVector<KAEvent>& events,
bool enable,
QWidget* msgParent)
958 UpdateStatus enableEvents(KAEvent::List& events,
bool enable,
QWidget* msgParent)
961 kDebug() << events.count();
962 if (events.isEmpty())
964 UpdateStatus status = UPDATE_OK;
966 bool deleteWakeFromSuspendAlarm =
false;
967 QString wakeFromSuspendId = checkRtcWakeConfig().value(0);
968 for (
int i = 0, end = events.count(); i < end; ++i)
971 KAEvent*
event = &events[i];
973 KAEvent*
event = events[i];
975 if (event->category() == CalEvent::ACTIVE
976 && enable !=
event->enabled())
978 event->setEnabled(enable);
980 if (!enable && event->id() == wakeFromSuspendId)
981 deleteWakeFromSuspendAlarm =
true;
986 kError() <<
"Error updating event in calendar:" <<
event->id();
992 if (!enable && (event->actionTypes() & KAEvent::ACT_DISPLAY))
1011 status = SAVE_FAILED;
1012 if (status != UPDATE_OK && msgParent)
1013 displayUpdateError(msgParent, status, ERR_ADD, events.count(), 0);
1016 if (deleteWakeFromSuspendAlarm && !wakeFromSuspendId.isEmpty())
1017 cancelRtcWake(msgParent, wakeFromSuspendId);
1030 void purgeArchive(
int purgeDays)
1034 kDebug() << purgeDays;
1035 QDate cutoff = KDateTime::currentLocalDate().addDays(-purgeDays);
1038 if (!collection.isValid())
1041 for (
int i = 0; i < events.count(); )
1043 if (purgeDays && events[i]->createdDateTime().date() >= cutoff)
1049 AlarmResource* resource = AlarmResources::instance()->getStandardResource(CalEvent::ARCHIVED);
1053 for (
int i = 0; i < events.count(); )
1055 KAEvent*
event = events[i];
1056 Incidence* kcalIncidence = resource->incidence(event->id());
1057 if (purgeDays && kcalIncidence && kcalIncidence->created().date() >= cutoff)
1063 if (!events.isEmpty())
1081 (*model)->setEventTypeFilter(CalEvent::ACTIVE);
1084 QVector<KAEvent> result;
1085 for (
int i = 0, count = (*model)->rowCount(); i < count; ++i)
1087 KAEvent
event = (*model)->event(i);
1088 if (event.enabled() && !
event.expired())
1097 KAEvent::List getSortedActiveEvents(
const KDateTime& startTime,
const KDateTime& endTime)
1099 KAEvent::List events;
1100 if (endTime.isValid())
1104 KAEvent::List result;
1105 for (
int i = 0, count = events.count(); i < count; ++i)
1107 KAEvent*
event = events[i];
1108 if (event->enabled() && !
event->expired())
1118 void displayUpdateError(
QWidget* parent, UpdateStatus status, UpdateError code,
int nAlarms,
int nKOrgAlarms,
bool showKOrgError)
1121 if (status > UPDATE_KORG_ERR)
1127 errmsg = (nAlarms > 1) ? i18nc(
"@info",
"Error saving alarms")
1128 : i18nc(
"@info",
"Error saving alarm");
1131 errmsg = (nAlarms > 1) ? i18nc(
"@info",
"Error deleting alarms")
1132 : i18nc(
"@info",
"Error deleting alarm");
1134 case ERR_REACTIVATE:
1135 errmsg = (nAlarms > 1) ? i18nc(
"@info",
"Error saving reactivated alarms")
1136 : i18nc(
"@info",
"Error saving reactivated alarm");
1139 errmsg = (nAlarms > 1) ? i18nc(
"@info",
"Error saving alarm templates")
1140 : i18nc(
"@info",
"Error saving alarm template");
1145 else if (showKOrgError)
1146 displayKOrgUpdateError(parent, code, status, nKOrgAlarms);
1152 void displayKOrgUpdateError(
QWidget* parent, UpdateError code, UpdateStatus korgError,
int nAlarms)
1158 case ERR_REACTIVATE:
1159 errmsg = (nAlarms > 1) ? i18nc(
"@info",
"Unable to show alarms in KOrganizer")
1160 : i18nc(
"@info",
"Unable to show alarm in KOrganizer");
1163 errmsg = i18nc(
"@info",
"Unable to update alarm in KOrganizer");
1166 errmsg = (nAlarms > 1) ? i18nc(
"@info",
"Unable to delete alarms from KOrganizer")
1167 : i18nc(
"@info",
"Unable to delete alarm from KOrganizer");
1173 if (korgError == UPDATE_KORG_ERRSTART)
1174 msg = i18nc(
"@info",
"<para>%1</para><para>(KOrganizer not fully started)</para>", errmsg);
1175 else if (korgError == UPDATE_KORG_ERR)
1176 msg = i18nc(
"@info",
"<para>%1</para><para>(Error communicating with KOrganizer)</para>", errmsg);
1193 void editNewAlarm(KAEvent::SubAction action,
QWidget* parent,
const AlarmText*
text)
1195 bool setAction =
false;
1199 case KAEvent::MESSAGE:
1204 case KAEvent::COMMAND:
1207 case KAEvent::EMAIL:
1210 case KAEvent::AUDIO:
1217 if (setAction || text)
1219 execNewAlarmDlg(editDlg);
1226 void editNewAlarm(
const KAEvent* preset,
QWidget* parent)
1238 new PrivateNewAlarmDlg(editDlg);
1241 editDlg->activateWindow();
1247 connect(dlg, SIGNAL(accepted()), SLOT(okClicked()));
1248 connect(dlg, SIGNAL(rejected()), SLOT(cancelClicked()));
1255 void PrivateNewAlarmDlg::okClicked()
1257 accept(static_cast<EditAlarmDlg*>(parent()));
1267 Collection calendar;
1269 AlarmResource* calendar;
1271 editDlg->
getEvent(event, calendar);
1275 UpdateStatus status = addEvent(event, &calendar, editDlg);
1277 UpdateStatus status = addEvent(event, calendar, editDlg);
1283 case UPDATE_KORG_ERR:
1284 case UPDATE_KORG_ERRSTART:
1285 case UPDATE_KORG_FUNCERR:
1286 displayKOrgUpdateError(editDlg, ERR_ADD, status, 1);
1293 outputAlarmWarnings(editDlg, &event);
1295 editDlg->deleteLater();
1301 void PrivateNewAlarmDlg::cancelClicked()
1309 bool editNewAlarm(
const QString& templateName,
QWidget* parent)
1311 if (!templateName.isEmpty())
1314 if (templateEvent->isValid())
1316 editNewAlarm(templateEvent, parent);
1319 kWarning() << templateName <<
": template not found";
1329 ::editNewTemplate(type, 0, parent);
1335 void editNewTemplate(
const KAEvent* preset,
QWidget* parent)
1350 QStringList checkRtcWakeConfig(
bool checkEventExists)
1352 KConfigGroup config(KGlobal::config(),
"General");
1353 QStringList params = config.readEntry(
"RtcWake", QStringList());
1355 if (params.count() == 3 && params[2].toUInt() > KDateTime::currentUtcDateTime().toTime_t())
1357 if (params.count() == 2 && params[1].toUInt() > KDateTime::currentUtcDateTime().toTime_t())
1365 return QStringList();
1368 if (!params.isEmpty())
1370 config.deleteEntry(
"RtcWake");
1373 return QStringList();
1379 void deleteRtcWakeConfig()
1381 KConfigGroup config(KGlobal::config(),
"General");
1382 config.deleteEntry(
"RtcWake");
1389 void cancelRtcWake(
QWidget* msgParent,
const QString& eventId)
1391 QStringList wakeup = checkRtcWakeConfig();
1392 if (!wakeup.isEmpty() && (eventId.isEmpty() || wakeup[0] == eventId))
1406 deleteRtcWakeConfig();
1415 bool setRtcWakeTime(
unsigned triggerTime,
QWidget* parent)
1418 args[QLatin1String(
"time")] = triggerTime;
1419 KAuth::Action action(QLatin1String(
"org.kde.kalarmrtcwake.settimer"));
1420 action.setHelperID(QLatin1String(
"org.kde.kalarmrtcwake"));
1421 action.setParentWidget(parent);
1422 action.setArguments(args);
1423 KAuth::ActionReply reply = action.execute();
1426 QString errmsg = reply.errorDescription();
1427 kDebug() <<
"Error code=" << reply.errorCode() << errmsg;
1428 if (errmsg.isEmpty())
1430 int errcode = reply.errorCode();
1431 switch (reply.type())
1433 case KAuth::ActionReply::KAuthError:
1434 kDebug() <<
"Authorisation error:" << errcode;
1437 case KAuth::ActionReply::AuthorizationDenied:
1438 case KAuth::ActionReply::UserCancelled:
1444 case KAuth::ActionReply::HelperError:
1445 kDebug() <<
"Helper error:" << errcode;
1451 errmsg = i18nc(
"@info",
"Error obtaining authorization (%1)", errcode);
1473 if (!AlarmResources::instance()->activeCount(CalEvent::TEMPLATE,
true))
1476 KAMessageBox::sorry(parent, i18nc(
"@info",
"You must enable a template calendar to save the template in"));
1487 if (editDlg->exec() == QDialog::Accepted)
1491 Akonadi::Collection calendar;
1493 AlarmResource* calendar;
1495 editDlg->getEvent(event, calendar);
1499 KAlarm::addTemplate(event, &calendar, editDlg);
1501 KAlarm::addTemplate(event, calendar, editDlg);
1515 void editAlarm(KAEvent* event,
QWidget* parent)
1523 viewAlarm(event, parent);
1529 QString
id =
event->id();
1535 if (editDlg->exec() == QDialog::Accepted)
1541 PrivateNewAlarmDlg().accept(editDlg);
1546 Collection calendar;
1548 AlarmResource* calendar;
1550 bool changeDeferral = !editDlg->getEvent(newEvent, calendar);
1557 if (updateEvent(newEvent, editDlg,
true) != UPDATE_OK)
1562 UpdateStatus status = modifyEvent(*event, newEvent, editDlg);
1563 if (status != UPDATE_OK && status <= UPDATE_KORG_ERR)
1564 displayKOrgUpdateError(editDlg, ERR_MODIFY, status, 1);
1568 outputAlarmWarnings(editDlg, &newEvent);
1580 bool editAlarmById(
const QString& eventID,
QWidget* parent)
1584 const QString eventID(
id.eventId());
1588 if (
id.collectionId() != -1)
1589 kWarning() <<
"Event ID not found, or duplicated:" << eventID;
1591 kWarning() <<
"Event ID not found:" << eventID;
1599 kError() << eventID <<
": event ID not found";
1605 kError() << eventID <<
": read-only";
1608 switch (event->category())
1610 case CalEvent::ACTIVE:
1611 case CalEvent::TEMPLATE:
1614 kError() << eventID <<
": event not active or template";
1617 editAlarm(event, parent);
1625 void editTemplate(KAEvent* event,
QWidget* parent)
1645 if (editDlg->exec() == QDialog::Accepted)
1649 Akonadi::Collection calendar;
1651 AlarmResource* calendar;
1653 editDlg->getEvent(newEvent, calendar);
1654 QString
id =
event->id();
1655 newEvent.setEventId(
id);
1657 newEvent.setCollectionId(event->collectionId());
1658 newEvent.setItemId(event->itemId());
1663 updateTemplate(newEvent, editDlg);
1671 void viewAlarm(
const KAEvent* event,
QWidget* parent)
1686 void updateEditedAlarm(
EditAlarmDlg* editDlg, KAEvent& event, Collection& calendar)
1688 void updateEditedAlarm(
EditAlarmDlg* editDlg, KAEvent& event, AlarmResource* calendar)
1694 Akonadi::Collection cal;
1701 UpdateStatus status;
1710 status = modifyEvent(event, newEvent, editDlg);
1717 status = addEvent(newEvent, &calendar, editDlg);
1719 status = addEvent(newEvent, calendar, editDlg);
1724 if (status != UPDATE_OK && status <= UPDATE_KORG_ERR)
1725 displayKOrgUpdateError(editDlg, ERR_MODIFY, status, 1);
1726 outputAlarmWarnings(editDlg, &newEvent);
1735 KAEvent::List templateList()
1737 KAEvent::List templates;
1740 for (
int i = 0, end = events.count(); i < end; ++i)
1742 KAEvent*
event = events[i];
1743 if (includeCmdAlarms || !(event->actionTypes() & KAEvent::ACT_COMMAND))
1744 templates.append(event);
1754 void outputAlarmWarnings(
QWidget* parent,
const KAEvent* event)
1756 if (event && event->actionTypes() == KAEvent::ACT_EMAIL
1763 if (
KAMessageBox::warningYesNo(parent, i18nc(
"@info",
"<para>Alarms are currently disabled.</para><para>Do you want to enable alarms now?</para>"),
1764 QString(), KGuiItem(i18nc(
"@action:button",
"Enable")), KGuiItem(i18nc(
"@action:button",
"Keep Disabled")),
1765 QLatin1String(
"EditEnableAlarms"))
1766 == KMessageBox::Yes)
1774 void refreshAlarms()
1777 if (!refreshAlarmsQueued)
1779 refreshAlarmsQueued =
true;
1790 void refreshAlarmsIfQueued()
1792 if (refreshAlarmsQueued)
1799 for (
int i = 0, end = events.count(); i < end; ++i)
1801 KAEvent*
event = events[i];
1802 if (!event->enabled() && (
event->actionTypes() & KAEvent::ACT_DISPLAY))
1814 refreshAlarmsQueued =
false;
1823 QString runKMail(
bool minimise)
1825 QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered(KMAIL_DBUS_SERVICE);
1826 if (!reply.isValid() || !reply.value())
1832 if (KToolInvocation::startServiceByDesktopName(QLatin1String(
"kmail"), QString(), &errmsg))
1834 kError() <<
"Couldn't start KMail (" << errmsg <<
")";
1835 return i18nc(
"@info",
"Unable to start <application>KMail</application><nl/>(<message>%1</message>)", errmsg);
1848 NETRootInfo i(QX11Info::display(), NET::Supported);
1849 if (i.isSupported(NET::WM2KDETemporaryRules))
1851 kDebug() <<
"using rules";
1853 QString message = QLatin1String(
"wmclass=kmail\nwmclassmatch=1\n"
1854 "wmclasscomplete=false\n"
1855 "minimize=true\nminimizerule=3\n"
1856 "type=") + QString().setNum(NET::Normal) + QLatin1String(
"\ntyperule=2");
1857 msg.broadcastMessage(
"_KDE_NET_WM_TEMPORARY_RULES", message, -1,
false);
1863 kDebug() <<
"connecting to window add";
1868 KStartupInfoId
id = KStartupInfo::currentStartupIdEnv();
1870 (*proc) << QLatin1String(
"kmail");
1871 int pid = proc->startDetached();
1874 KStartupInfo::sendFinish(
id);
1877 KStartupInfoData data;
1879 data.setName(QLatin1String(
"kmail"));
1880 data.setBin(QLatin1String(
"kmail"));
1881 KStartupInfo::sendChange(
id, data);
1895 static const int SUPPORTED_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask
1896 | NET::ToolbarMask | NET::MenuMask | NET::DialogMask
1897 | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask;
1898 KWindowInfo kwinfo = KWindowSystem::windowInfo(w, NET::WMWindowType | NET::WMName);
1899 if (kwinfo.windowType(SUPPORTED_TYPES) == NET::TopMenu
1900 || kwinfo.windowType(SUPPORTED_TYPES) == NET::Toolbar
1901 || kwinfo.windowType(SUPPORTED_TYPES) == NET::Desktop)
1905 XWithdrawWindow(QX11Info::display(), w, qxinfo.screen());
1906 QApplication::flush();
1908 NETWinInfo info(QX11Info::display(), w, QX11Info::appRootWindow(), NET::WMState);
1909 XWMHints* hints = XGetWMHints(QX11Info::display(), w);
1912 hints->flags |= StateHint;
1913 hints->initial_state = IconicState;
1914 XSetWMHints(QX11Info::display(), w, hints);
1917 info.setWindowType(NET::Normal);
1919 XSync(QX11Info::display(), False);
1920 XMapWindow(QX11Info::display(), w);
1921 XSync(QX11Info::display(), False);
1922 QApplication::flush();
1937 QStringList dontShowErrors(
const EventId& eventId)
1939 QStringList dontShowErrors(
const QString& eventId)
1942 if (eventId.isEmpty())
1943 return QStringList();
1944 KConfig config(KStandardDirs::locateLocal(
"appdata", ALARM_OPTS_FILE));
1945 KConfigGroup group(&config, DONT_SHOW_ERRORS_GROUP);
1947 const QString
id = QString::fromLatin1(
"%1:%2").arg(eventId.collectionId()).arg(eventId.eventId());
1949 const QString id(eventId);
1951 return group.readEntry(
id, QStringList());
1959 bool dontShowErrors(
const EventId& eventId,
const QString& tag)
1961 bool dontShowErrors(
const QString& eventId,
const QString& tag)
1966 QStringList tags = dontShowErrors(eventId);
1967 return tags.indexOf(tag) >= 0;
1975 void setDontShowErrors(
const EventId& eventId,
const QStringList& tags)
1977 void setDontShowErrors(
const QString& eventId,
const QStringList& tags)
1980 if (eventId.isEmpty())
1982 KConfig config(KStandardDirs::locateLocal(
"appdata", ALARM_OPTS_FILE));
1983 KConfigGroup group(&config, DONT_SHOW_ERRORS_GROUP);
1985 const QString
id = QString::fromLatin1(
"%1:%2").arg(eventId.collectionId()).arg(eventId.eventId());
1987 const QString id(eventId);
1990 group.deleteEntry(
id);
1992 group.writeEntry(
id, tags);
2001 void setDontShowErrors(
const EventId& eventId,
const QString& tag)
2003 void setDontShowErrors(
const QString& eventId,
const QString& tag)
2006 if (eventId.isEmpty() || tag.isEmpty())
2008 KConfig config(KStandardDirs::locateLocal(
"appdata", ALARM_OPTS_FILE));
2009 KConfigGroup group(&config, DONT_SHOW_ERRORS_GROUP);
2011 const QString
id = QString::fromLatin1(
"%1:%2").arg(eventId.collectionId()).arg(eventId.eventId());
2013 const QString id(eventId);
2015 QStringList tags = group.readEntry(
id, QStringList());
2016 if (tags.indexOf(tag) < 0)
2019 group.writeEntry(
id, tags);
2030 bool readConfigWindowSize(
const char* window, QSize& result,
int* splitterWidth)
2032 KConfigGroup config(KGlobal::config(), window);
2033 QWidget* desktop = KApplication::desktop();
2034 QSize s = QSize(config.readEntry(QString::fromLatin1(
"Width %1").arg(desktop->width()), (
int)0),
2035 config.readEntry(QString::fromLatin1(
"Height %1").arg(desktop->height()), (
int)0));
2040 *splitterWidth = config.readEntry(QString::fromLatin1(
"Splitter %1").arg(desktop->width()), -1);
2048 void writeConfigWindowSize(
const char* window,
const QSize& size,
int splitterWidth)
2050 KConfigGroup config(KGlobal::config(), window);
2051 QWidget* desktop = KApplication::desktop();
2052 config.writeEntry(QString::fromLatin1(
"Width %1").arg(desktop->width()), size.width());
2053 config.writeEntry(QString::fromLatin1(
"Height %1").arg(desktop->height()), size.height());
2054 if (splitterWidth >= 0)
2055 config.writeEntry(QString::fromLatin1(
"Splitter %1").arg(desktop->width()), splitterWidth);
2064 FileType fileType(
const KMimeType::Ptr& mimetype)
2066 if (mimetype->is(QLatin1String(
"text/html")))
2067 return TextFormatted;
2068 if (mimetype->is(QLatin1String(
"application/x-executable")))
2069 return TextApplication;
2070 if (mimetype->is(QLatin1String(
"text/plain")))
2072 if (mimetype->name().startsWith(QLatin1String(
"image/")))
2082 FileErr checkFileExists(QString& filename, KUrl& url)
2085 FileErr err = FileErr_None;
2086 QString file = filename;
2087 QRegExp f(QLatin1String(
"^file:/+"));
2088 if (f.indexIn(file) >= 0)
2089 file = file.mid(f.matchedLength() - 1);
2092 int i = file.indexOf(QLatin1Char(
'/'));
2093 if (i > 0 && file[i - 1] == QLatin1Char(
':'))
2097 filename = url.prettyUrl();
2100 err = FileErr_Nonexistent;
2103 KFileItem fi(uds, url);
2104 if (fi.isDir()) err = FileErr_Directory;
2105 else if (!fi.isReadable()) err = FileErr_Unreadable;
2108 else if (file.isEmpty())
2109 err = FileErr_Blank;
2113 QFileInfo info(file);
2114 QDir::setCurrent(QDir::homePath());
2115 filename = info.absoluteFilePath();
2116 url.setPath(filename);
2117 if (info.isDir()) err = FileErr_Directory;
2118 else if (!info.exists()) err = FileErr_Nonexistent;
2119 else if (!info.isReadable()) err = FileErr_Unreadable;
2129 bool showFileErrMessage(
const QString& filename, FileErr err, FileErr blankError,
QWidget* errmsgParent)
2131 if (err != FileErr_None)
2134 QString file = filename;
2135 QRegExp f(QLatin1String(
"^file:/+"));
2136 if (f.indexIn(file) >= 0)
2137 file = file.mid(f.matchedLength() - 1);
2143 if (blankError == FileErr_BlankDisplay)
2144 errmsg = i18nc(
"@info",
"Please select a file to display");
2145 else if (blankError == FileErr_BlankPlay)
2146 errmsg = i18nc(
"@info",
"Please select a file to play");
2148 kFatal() <<
"Program error";
2151 case FileErr_Directory:
2152 KAMessageBox::sorry(errmsgParent, i18nc(
"@info",
"<filename>%1</filename> is a folder", file));
2154 case FileErr_Nonexistent: errmsg = i18nc(
"@info",
"<filename>%1</filename> not found", file);
break;
2155 case FileErr_Unreadable: errmsg = i18nc(
"@info",
"<filename>%1</filename> is not readable", file);
break;
2156 case FileErr_NotTextImage: errmsg = i18nc(
"@info",
"<filename>%1</filename> appears not to be a text or image file", file);
break;
2161 == KMessageBox::Cancel)
2170 QString pathOrUrl(
const QString& url)
2172 static const QRegExp localfile(QLatin1String(
"^file:/+"));
2173 return (localfile.indexIn(url) >= 0) ? url.mid(localfile.matchedLength() - 1) : url;
2189 QString browseFile(
const QString& caption, QString& defaultDir,
const QString& initialFile,
2190 const QString& filter, KFile::Modes mode,
QWidget* parent)
2192 QString initialDir = !initialFile.isEmpty() ? QString(initialFile).remove(QRegExp(QLatin1String(
"/[^/]*$")))
2193 : !defaultDir.isEmpty() ? defaultDir
2199 fileDlg->setOperationMode(mode & KFile::ExistingOnly ? KFileDialog::Opening : KFileDialog::Saving);
2200 fileDlg->setMode(KFile::File | mode);
2201 fileDlg->setCaption(caption);
2202 if (!initialFile.isEmpty())
2203 fileDlg->setSelection(initialFile);
2204 if (fileDlg->exec() != QDialog::Accepted)
2205 return fileDlg ? QLatin1String(
"") : QString();
2206 KUrl url = fileDlg->selectedUrl();
2208 return QLatin1String(
"");
2209 defaultDir = url.isLocalFile() ? url.upUrl().toLocalFile() : url.directory();
2210 return (mode & KFile::LocalOnly) ? url.pathOrUrl() : url.prettyUrl();
2222 QString conversionPrompt(
const QString& calendarName,
const QString& calendarVersion,
bool whole)
2225 ? i18nc(
"@info",
"Calendar <resource>%1</resource> is in an old format (<application>KAlarm</application> version %2), "
2226 "and will be read-only unless you choose to update it to the current format.",
2227 calendarName, calendarVersion)
2228 : i18nc(
"@info",
"Some or all of the alarms in calendar <resource>%1</resource> are in an old <application>KAlarm</application> format, "
2229 "and will be read-only unless you choose to update them to the current format.",
2231 return i18nc(
"@info",
"<para>%1</para><para>"
2232 "<warning>Do not update the calendar if it is also used with an older version of <application>KAlarm</application> "
2233 "(e.g. on another computer). If you do so, the calendar may become unusable there.</warning></para>"
2234 "<para>Do you wish to update the calendar?</para>", msg);
2242 void setTestModeConditions()
2244 const QByteArray newTime = qgetenv(
"KALARM_TIME");
2245 if (!newTime.isEmpty())
2249 setSimulatedSystemTime(dt);
2256 void setSimulatedSystemTime(
const KDateTime& dt)
2258 KDateTime::setSimulatedSystemTime(dt);
2259 kDebug() <<
"New time =" << qPrintable(KDateTime::currentLocalDateTime().toString(QLatin1String(
"%Y-%m-%d %H:%M %:Z")));
2272 KAlarm::UpdateStatus sendToKOrganizer(
const KAEvent& event)
2275 Event::Ptr kcalEvent(
new KCalCore::Event);
2276 event.updateKCalEvent(kcalEvent, KAEvent::UID_IGNORE);
2281 QString uid = uidKOrganizer(event.id());
2282 kcalEvent->setUid(uid);
2283 kcalEvent->clearAlarms();
2285 switch (event.actionTypes())
2287 case KAEvent::ACT_DISPLAY:
2288 case KAEvent::ACT_COMMAND:
2289 case KAEvent::ACT_DISPLAY_COMMAND:
2290 kcalEvent->setSummary(event.cleanText());
2293 case KAEvent::ACT_EMAIL:
2295 QString
from =
event.emailFromId()
2296 ? Identities::identityManager()->identityForUoid(event.emailFromId()).fullEmailAddr()
2299 atext.setEmail(event.emailAddresses(QLatin1String(
", ")),
from, QString(), QString(),
event.emailSubject(), QString());
2300 kcalEvent->setSummary(atext.displayText());
2304 case KAEvent::ACT_AUDIO:
2305 kcalEvent->setSummary(event.audioFile());
2311 Person::Ptr person(
new Person(QString(), userEmail));
2312 kcalEvent->setOrganizer(person);
2314 kcalEvent->setOrganizer(KCal::Person(QString(), userEmail));
2321 QString iCal = format.toICalString(kcalEvent);
2327 KAlarm::UpdateStatus st = runKOrganizer();
2328 if (st != KAlarm::UPDATE_OK)
2332 QDBusReply<bool> reply = korgInterface->callWithArgumentList(QDBus::Block, QLatin1String(
"addIncidence"), args);
2333 if (!reply.isValid())
2335 if (reply.error().type() == QDBusError::UnknownObject)
2337 kError()<<
"addIncidence() D-Bus error: still starting";
2338 return KAlarm::UPDATE_KORG_ERRSTART;
2340 kError() <<
"addIncidence(" << uid <<
") D-Bus call failed:" << reply.error().message();
2341 return KAlarm::UPDATE_KORG_ERR;
2345 kDebug() <<
"addIncidence(" << uid <<
") D-Bus call returned false";
2346 return KAlarm::UPDATE_KORG_FUNCERR;
2348 kDebug() << uid <<
": success";
2349 return KAlarm::UPDATE_OK;
2355 KAlarm::UpdateStatus deleteFromKOrganizer(
const QString& eventID)
2357 const QString newID = uidKOrganizer(eventID);
2358 #if defined(USE_AKONADI) && KDE_IS_VERSION(4,12,4) // kdepimlibs/kdepim-runtime 4.12.4 are required
2359 new CollectionSearch(KORG_MIME_TYPE, newID,
true);
2362 KAlarm::UpdateStatus st = runKOrganizer();
2363 if (st != KAlarm::UPDATE_OK)
2366 args << newID <<
true;
2367 QDBusReply<bool> reply = korgInterface->callWithArgumentList(QDBus::Block, QLatin1String(
"deleteIncidence"), args);
2368 if (!reply.isValid())
2370 if (reply.error().type() == QDBusError::UnknownObject)
2372 kError()<<
"deleteIncidence() D-Bus error: still starting";
2373 return KAlarm::UPDATE_KORG_ERRSTART;
2375 kError() <<
"deleteIncidence(" << newID <<
") D-Bus call failed:" << reply.error().message();
2376 return KAlarm::UPDATE_KORG_ERR;
2380 kDebug() <<
"deleteIncidence(" << newID <<
") D-Bus call returned false";
2381 return KAlarm::UPDATE_KORG_FUNCERR;
2383 kDebug() << newID <<
": success";
2385 return KAlarm::UPDATE_OK;
2391 KAlarm::UpdateStatus runKOrganizer()
2393 QString error, dbusService;
2394 int result = KDBusServiceStarter::self()->findServiceFor(QLatin1String(
"DBUS/Organizer"), QString(), &error, &dbusService);
2397 kWarning() <<
"Unable to start DBUS/Organizer:" << dbusService << error;
2398 return KAlarm::UPDATE_KORG_ERR;
2403 QDBusInterface iface(KORG_DBUS_SERVICE, QLatin1String(
KORG_DBUS_LOAD_PATH), QLatin1String(
"org.kde.KUniqueApplication"));
2404 if (!iface.isValid())
2406 kWarning() <<
"Unable to access "KORG_DBUS_LOAD_PATH" D-Bus interface:" << iface.lastError().message();
2407 return KAlarm::UPDATE_KORG_ERR;
2409 QDBusReply<bool> reply = iface.call(QLatin1String(
"load"));
2410 if ((!reply.isValid() || !reply.value())
2411 && iface.lastError().type() != QDBusError::UnknownMethod)
2413 kWarning() <<
"Loading KOrganizer failed:" << iface.lastError().message();
2414 return KAlarm::UPDATE_KORG_ERR;
2419 if (!korgInterface || !korgInterface->isValid())
2421 delete korgInterface;
2422 korgInterface =
new QDBusInterface(KORG_DBUS_SERVICE, QLatin1String(
KORG_DBUS_PATH), KORG_DBUS_IFACE);
2423 if (!korgInterface->isValid())
2425 kWarning() <<
"Unable to access "KORG_DBUS_PATH" D-Bus interface:" << korgInterface->lastError().message();
2426 delete korgInterface;
2428 return KAlarm::UPDATE_KORG_ERRSTART;
2431 return KAlarm::UPDATE_OK;
2437 QString uidKOrganizer(
const QString&
id)
2439 QString result = id;
2440 int i = result.lastIndexOf(QLatin1Char(
'-'));
2442 i = result.length();
2443 return result.insert(i, KORGANIZER_UID);
2453 return s1.toLower() < s2.toLower();
static Akonadi::Collection getStandard(CalEvent::Type, bool useDefault=false)
Return the standard collection for a specified mime type.
void setAlarmsEnabled(bool)
bool deleteEvent(const QString &eventID, bool save=false)
static EventListModel * alarms()
void disabledChanged(const KAEvent *)
bool alarmsEnabled() const
static Private * instance()
static bool isAudioPlaying()
bool eventReadOnly(const QString &uniqueID) const
virtual QByteArray text(quint32 serialNumber) const =0
bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
KAEvent * updateEvent(const KAEvent &)
static AlarmCalendar * resources()
static void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Options(Notify|WindowModal))
bool addEvent(KAEvent *, QWidget *promptParent=0, bool useEventID=false, AlarmResource *=0, bool noPrompt=false, bool *cancelled=0)
static void saveEdit(const Event &oldEvent, const KAEvent &newEvent)
static int kOrgEventDuration()
Get KOrganizer event duration.
void removeEvent(const KAEvent *event)
static MainWindow * firstWindow()
KAEvent * templateEvent(const QString &templateName)
static int archivedKeepDays()
Get Days to keep expired alarms.
static bool startKMailMinimised()
static KAEvent * getEvent(const QString &uniqueId)
the KAlarm application object
static bool convertTimeString(const QByteArray &timeString, KDateTime &dateTime, const KDateTime &defaultDt=KDateTime(), bool allowTZ=true)
MessageWin: A window to display an alarm or error message.
bool modifyEvent(const QString &oldEventId, KAEvent *newEvent)
static CollectionControlModel * instance()
void purgeEvents(const KAEvent::List &)
static KTimeZone timeZone(bool reload=false)
static Akonadi::Collection destination(CalEvent::Type, QWidget *promptParent=0, bool noPrompt=false, bool *cancelled=0)
Find the collection to be used to store an event of a given type.
void selectEvent(const QString &eventID)
virtual void setAction(KAEvent::SubAction, const AlarmText &=AlarmText())=0
displays an alarm message
static EditAlarmDlg * create(bool Template, Type, QWidget *parent=0, GetResourceType=RES_PROMPT)
bool getEvent(KAEvent &, AlarmResource *&)
static QString i18n_NeedFromEmailAddress()
static MainWindow * create(bool restored=false)
static MessageWin * findEvent(const QString &eventId)
KCal::Event * createKCalEvent(const KAEvent *e) const
static Akonadi::Collection::List enabledCollections(CalEvent::Type, bool writable)
Return the enabled collections which contain a specified mime type.
static EventListModel * templates()
bool updateEvent(KAEvent *event)
void accept(EditAlarmDlg *)
static void saveAdd(const KAEvent &, AlarmResource *, const QString &name=QString())
Unique event identifier for Akonadi.
static int warningContinueCancel(QWidget *parent, ButtonCode defaultButton, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const QString &dontAskAgainName=QString())
static int warningYesNo(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Options(Notify|Dangerous|WindowModal))
static void sorry(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Options(Notify|WindowModal))
#define KORG_DBUS_LOAD_PATH
static QString emailAddress()
Provides read and write access to calendar files and resources.
static AlarmCalendar * displayCalendarOpen()
KAEvent::List events(CalEvent::Types s=CalEvent::EMPTY) const
KAEvent * event(const QString &uniqueId)
static MainWindow * mainMainWindow()
static void information(QWidget *parent, const QString &text, const QString &caption=QString(), const QString &dontShowAgainName=QString(), Options options=Options(Notify|WindowModal))