doc fixes found while translating
[kdepim.git] / libkdepimdbusinterfaces / reminderclient.cpp
blobad4204600367f536492b630f386b051483c4383d
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 "korgacinterface.h"
26 #include <KDebug>
27 #include <KStandardDirs>
28 #include <KToolInvocation>
30 #include <QtDBus/QDBusConnection>
31 #include <QtDBus/QDBusInterface>
33 using namespace KPIM;
35 void ReminderClient::startDaemon()
37 QDBusInterface iface( "org.kde.korgac", "/" );
38 if ( iface.isValid() ){
39 // Reminder daemon already runs
40 return;
43 const QString desktopFile = KStandardDirs::locate( "autostart", "korgac.desktop" );
44 if ( desktopFile.isEmpty() ) {
45 kWarning() << "Couldn't find autostart/korgac.desktop!";
46 } else {
47 QString error;
48 if ( KToolInvocation::startServiceByDesktopPath( desktopFile, QStringList(), &error ) != 0 ) {
49 kWarning() << "Failure starting korgac:" << error;
50 // try harder...
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() );
61 interface.quit();
64 void ReminderClient::hideDaemon()
66 OrgKdeKorganizerKOrgacInterface interface(
67 "org.kde.korgac", "/ac", QDBusConnection::sessionBus() );
68 interface.hide();
71 void ReminderClient::showDaemon()
73 OrgKdeKorganizerKOrgacInterface interface(
74 "org.kde.korgac", "/ac", QDBusConnection::sessionBus() );
75 interface.show();