add more spacing
[personal-kdebase.git] / runtime / nepomuk / server / servicecontroller.h
blob55e7bd0dc978a401d97f23a8e7125f1e00cd9151
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>
23 #include <KService>
25 namespace Nepomuk {
26 class ServiceController : public QObject
28 Q_OBJECT
30 public:
31 ServiceController( KService::Ptr service, QObject* parent );
32 ~ServiceController();
34 KService::Ptr service() const;
36 /**
37 * The name of the service. This equals
38 * service()->desktopEntryName().
40 QString name() const;
42 /**
43 * All the service's direct dependencies.
45 QStringList dependencies() const;
47 bool autostart() const;
48 bool startOnDemand() const;
49 bool runOnce() const;
51 void setAutostart( bool enable );
53 /**
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
56 * already.
58 bool start();
59 void stop();
61 bool isRunning() const;
62 bool isInitialized() const;
64 /**
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
70 * with D-Bus.
72 bool waitForInitialized( int timeout = 30000 );
74 Q_SIGNALS:
75 /**
76 * Emitted once the service has been initialized
77 * properly, i.e. once its D-Bus interface is active.
79 void serviceInitialized( ServiceController* );
81 private Q_SLOTS:
82 void slotProcessFinished( bool );
83 void slotServiceOwnerChanged( const QString& serviceName,
84 const QString&,
85 const QString& newOwner );
86 void slotServiceInitialized( bool success );
88 private:
89 void createServiceControlInterface();
91 class Private;
92 Private* const d;
96 #endif