libtdepim

alarmclient.cpp
1/*
2 This file is part of KOrganizer.
3
4 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
5 Copyright (c) 2005 David Faure <faure@kde.org>
6
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.
11
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.
16
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.
21*/
22
23#include "alarmclient.h"
24
25#include <tdeapplication.h>
26#include <kdebug.h>
27#include <tdestandarddirs.h>
28
29#include <dcopclient.h>
30#include <dcopref.h>
31
32AlarmClient::AlarmClient()
33{
34 kdDebug(5850) << "AlarmClient::AlarmClient()" << endl;
35}
36
37AlarmClient::~AlarmClient()
38{
39}
40
42{
43 if ( tdeApp->dcopClient()->isApplicationRegistered( "korgac" ) ) {
44 // Alarm daemon already runs
45 return;
46 }
47
48 TDEGlobal::dirs()->addResourceType("autostart", "share/autostart");
49 TQString desktopFile = locate( "autostart", "korgac.desktop" );
50 if ( desktopFile.isEmpty() ) {
51 kdWarning() << "Couldn't find autostart/korgac.desktop!" << endl;
52 }
53 else {
54 TQString error;
55 if ( tdeApp->startServiceByDesktopPath( desktopFile, TQStringList(), &error ) != 0 )
56 kdWarning() << "Failure starting korgac:" << error << endl;
57 }
58}
59
61{
62 DCOPRef ref( "korgac", "ac" );
63 ref.send( "quit" );
64}
virtual void stopDaemon()
Stop alarm daemon.
Definition: alarmclient.cpp:60
virtual void startDaemon()
Start alarm daemon.
Definition: alarmclient.cpp:41