aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGergely Risko <gergely+context@risko.hu>2009-11-04 15:56:56 +0200
committerGergely Risko <gergely+context@risko.hu>2009-11-04 15:56:56 +0200
commitcce01375517fa78683c09dd5a3c8b28412e3ee7a (patch)
tree1e403ccded2c95984a1eb35a3507be804419fd05
parentfcb0ccbd204f0e9eb034cdb17f95f0fbc96672f2 (diff)
contextprovide autostart fixes
-rw-r--r--libcontextprovider/context-provide/commandwatcher.cpp7
-rw-r--r--libcontextprovider/context-provide/commandwatcher.h2
-rw-r--r--libcontextprovider/context-provide/context-provide.cpp11
3 files changed, 6 insertions, 14 deletions
diff --git a/libcontextprovider/context-provide/commandwatcher.cpp b/libcontextprovider/context-provide/commandwatcher.cpp
index 9a44de1d..23320422 100644
--- a/libcontextprovider/context-provide/commandwatcher.cpp
+++ b/libcontextprovider/context-provide/commandwatcher.cpp
@@ -66,7 +66,6 @@ CommandWatcher::~CommandWatcher()
void CommandWatcher::onRegistryChanged()
{
- qDebug() << "registry changed";
foreach (PropertyProxy *p, proxies)
delete p;
proxies.clear();
@@ -205,8 +204,10 @@ void CommandWatcher::addCommand(const QStringList& args)
else
unsetCommand(QStringList(keyName));
- // if service is already started then it has to be restarted after a property is added
- if (started && busName != CommandWatcher::commanderBusName)
+ // If service is already started then it has to be restarted after
+ // a property is added. In commander mode if the property is
+ // already provided with a proxy, then no restart is necessary.
+ if (started && (busName != CommandWatcher::commanderBusName || !proxies.contains(keyName)))
startCommand();
}
diff --git a/libcontextprovider/context-provide/commandwatcher.h b/libcontextprovider/context-provide/commandwatcher.h
index 114fa65b..4d06fb61 100644
--- a/libcontextprovider/context-provide/commandwatcher.h
+++ b/libcontextprovider/context-provide/commandwatcher.h
@@ -43,6 +43,7 @@ public:
CommandWatcher(QString busName, QDBusConnection::BusType busType, int commandfd, QObject *parent = 0);
~CommandWatcher();
void addCommand(const QStringList& args);
+ void startCommand();
static const QString commanderBusName;
private:
@@ -56,7 +57,6 @@ private:
void delCommand(const QStringList& args);
void infoCommand(const QStringList& args);
void listCommand();
- void startCommand();
QString unquote(const QString& str);
int commandfd;
diff --git a/libcontextprovider/context-provide/context-provide.cpp b/libcontextprovider/context-provide/context-provide.cpp
index 551b5a4b..f67c10b5 100644
--- a/libcontextprovider/context-provide/context-provide.cpp
+++ b/libcontextprovider/context-provide/context-provide.cpp
@@ -107,16 +107,7 @@ int main(int argc, char **argv)
for (int i=2; i < args.count(); i+=3)
commandWatcher.addCommand(args.mid(i, 3));
- if (args.count() > 2) {
- qDebug() << "Autostarting the service, since you have had properties on the command line";
- if (!service.start()) {
- qDebug() << "Starting service failed";
- return 2;
- }
- } else {
- qDebug() << "SERVICE NOT STARTED, since you haven't had parameters on the command line";
- qDebug() << "Use the start command when you are ready to be registered on D-Bus";
- }
+ commandWatcher.startCommand();
return app.exec();
}