1 /* This file is part of the KDE Project
2 Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #ifndef _SERVICE_CONTROLLER_H_
20 #define _SERVICE_CONTROLLER_H_
22 #include <QtCore/QObject>
26 class ServiceController
: public QObject
31 ServiceController( KService::Ptr service
, QObject
* parent
);
34 KService::Ptr
service() const;
37 * The name of the service. This equals
38 * service()->desktopEntryName().
43 * All the service's direct dependencies.
45 QStringList
dependencies() const;
47 bool autostart() const;
48 bool startOnDemand() const;
51 void setAutostart( bool enable
);
54 * Make sure the service is running. This will attach to an already running
55 * instance or simple return \p true in case the service has been started
61 bool isRunning() const;
62 bool isInitialized() const;
65 * Wait for the service to become initialized.
66 * Will return immeadetely if the service has
67 * not been started or is already initialized.
69 * A service is initialized once it is registered
72 bool waitForInitialized( int timeout
= 30000 );
76 * Emitted once the service has been initialized
77 * properly, i.e. once its D-Bus interface is active.
79 void serviceInitialized( ServiceController
* );
82 void slotProcessFinished( bool );
83 void slotServiceOwnerChanged( const QString
& serviceName
,
85 const QString
& newOwner
);
86 void slotServiceInitialized( bool success
);
89 void createServiceControlInterface();