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 "korgacinterface.h"
27 #include <KStandardDirs>
28 #include <KToolInvocation>
30 #include <QtDBus/QDBusConnection>
31 #include <QtDBus/QDBusInterface>
35 void ReminderClient::startDaemon()
37 QDBusInterface
iface( "org.kde.korgac", "/" );
38 if ( iface
.isValid() ){
39 // Reminder daemon already runs
43 const QString desktopFile
= KStandardDirs::locate( "autostart", "korgac.desktop" );
44 if ( desktopFile
.isEmpty() ) {
45 kWarning() << "Couldn't find autostart/korgac.desktop!";
48 if ( KToolInvocation::startServiceByDesktopPath( desktopFile
, QStringList(), &error
) != 0 ) {
49 kWarning() << "Failure starting korgac:" << error
;
51 const QString korgacExe
= KStandardDirs::findExe( QLatin1String( "korgac" ) );
52 QProcess::startDetached( korgacExe
);
57 void ReminderClient::stopDaemon()
59 OrgKdeKorganizerKOrgacInterface
interface(
60 "org.kde.korgac", "/ac", QDBusConnection::sessionBus() );
64 void ReminderClient::hideDaemon()
66 OrgKdeKorganizerKOrgacInterface
interface(
67 "org.kde.korgac", "/ac", QDBusConnection::sessionBus() );
71 void ReminderClient::showDaemon()
73 OrgKdeKorganizerKOrgacInterface
interface(
74 "org.kde.korgac", "/ac", QDBusConnection::sessionBus() );