Fix typo found by Yuri Chornoivan
[kdepim.git] / libkdepim / reminderclient.cpp
blob2c6b948858b705e1be11b010f861d0d0ec0129d0
1 /*
2 This file is part of KOrganizer.
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (c) 2005 David Faure <faure@kde.org>
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
23 #include "reminderclient.h"
24 #include "korganizer_korgac_interface.h"
26 #include <KDebug>
27 #include <KStandardDirs>
28 #include <KToolInvocation>
30 #include <QtDBus/QDBusConnection>
31 #include <QtDBus/QDBusInterface>
33 using namespace KPIM;
35 ReminderClient::ReminderClient()
37 kDebug(5850) << "ReminderClient::ReminderClient()";
40 void ReminderClient::startDaemon()
42 QDBusInterface iface( "org.kde.korgac", "/" );
43 if ( iface.isValid() ){
44 // Reminder daemon already runs
45 return;
48 KGlobal::dirs()->addResourceType( "autostart", 0, "share/autostart" );
49 QString desktopFile = KStandardDirs::locate( "autostart", "korgac.desktop" );
50 if ( desktopFile.isEmpty() ) {
51 kWarning() << "Couldn't find autostart/korgac.desktop!";
52 } else {
53 QString error;
54 if ( KToolInvocation::startServiceByDesktopPath( desktopFile, QStringList(), &error ) != 0 ) {
55 kWarning() << "Failure starting korgac:" << error;
60 void ReminderClient::stopDaemon()
62 OrgKdeKorganizerKOrgacInterface interface(
63 "org.kde.korgac", "/ac", QDBusConnection::sessionBus() );
64 interface.quit();
67 void ReminderClient::hideDaemon()
69 OrgKdeKorganizerKOrgacInterface interface(
70 "org.kde.korgac", "/ac", QDBusConnection::sessionBus() );
71 interface.hide();
74 void ReminderClient::showDaemon()
76 OrgKdeKorganizerKOrgacInterface interface(
77 "org.kde.korgac", "/ac", QDBusConnection::sessionBus() );
78 interface.show();