FEATURE: (contracted in prokde35)
[kdepim.git] / libkdepim / alarmclient.cpp
blobaebfb177020381702927d90d6f39afb45830e505
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 "alarmclient.h"
25 #include <kdebug.h>
26 #include <kstandarddirs.h>
28 #include <QtDBus/QDBusConnection>
29 #include <QtDBus/QDBusInterface>
30 #include <ktoolinvocation.h>
31 #include "korganizer_korgac_interface.h"
33 AlarmClient::AlarmClient()
35 kDebug(5850) << "AlarmClient::AlarmClient()" << endl;
38 void AlarmClient::startDaemon()
40 QDBusInterface iface( "org.kde.korgac", "/" );
41 if ( iface.isValid() ){
42 // Alarm daemon already runs
43 return;
46 KGlobal::dirs()->addResourceType("autostart", "share/autostart");
47 QString desktopFile = KStandardDirs::locate( "autostart", "korgac.desktop" );
48 if ( desktopFile.isEmpty() ) {
49 kWarning() << "Couldn't find autostart/korgac.desktop!" << endl;
51 else {
52 QString error;
53 if ( KToolInvocation::startServiceByDesktopPath( desktopFile, QStringList(), &error ) != 0 )
54 kWarning() << "Failure starting korgac:" << error << endl;
58 void AlarmClient::stopDaemon()
60 OrgKdeKorganizerKOrgacInterface interface("org.kde.korgac", "/ac", QDBusConnection::sessionBus());
61 interface.quit();