summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorAndrew Stanley-Jones <andrew.stanley-jones@nokia.com>2011-08-05 15:39:12 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-05 07:47:43 +0200
commit783b41ce95ac71e6d554752cf63ed52981b32b40 (patch)
treeaf9493dcb8b66311f93bdc37af8f429ab51c4d0c /src/tools
parentde1836d8051937a16ed3ba883f344cb00065c9b7 (diff)
Add setDefault to servicefw
Change-Id: I0e8c432a9148a590c06ca17236421b13a01373a9 Reviewed-on: http://codereview.qt.nokia.com/2661 Reviewed-by: Andrew Stanley-Jones <andrew.stanley-jones@nokia.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/servicefw/servicefw.cpp47
1 files changed, 34 insertions, 13 deletions
diff --git a/src/tools/servicefw/servicefw.cpp b/src/tools/servicefw/servicefw.cpp
index 34321324..0c50bab5 100644
--- a/src/tools/servicefw/servicefw.cpp
+++ b/src/tools/servicefw/servicefw.cpp
@@ -50,6 +50,20 @@
QT_BEGIN_NAMESPACE
+static const char * const errorTable[] = {
+ "No error", //0
+ "Storage read error",
+ "Invalid service location",
+ "Invalid service xml",
+ "Invalid service interface descriptor",
+ "Service already exists",
+ "Interface implementation already exists",
+ "Loading of plug-in failed",
+ "Service or interface not found",
+ "Insufficient capabilities to access service",
+ "Unknown error",
+};
+
class CommandProcessor : public QObject
{
Q_OBJECT
@@ -69,6 +83,7 @@ public slots:
void add(const QStringList &args);
void remove(const QStringList &args);
void dbusservice(const QStringList &args);
+ void setdefault(const QStringList &args);
private:
bool setOptions(const QStringList &options);
@@ -147,6 +162,25 @@ void CommandProcessor::browse(const QStringList &args)
showAllEntries();
}
+void CommandProcessor::setdefault(const QStringList &args)
+{
+ if (args.isEmpty() || args.count() < 2) {
+ *stdoutStream << "Usage:\n\tsetdefault <interface> <service>\n\n"
+ "Examples:\n"
+ "\tsetdefault com.nokia.SomeInterface foo";
+ return;
+ }
+
+
+ const QString &interface = args[0];
+ const QString &service = args[1];
+ bool res = serviceManager->setInterfaceDefault(service, interface);
+ if(!res) {
+ *stdoutStream << "Failed to set interface default"
+ << errorTable[serviceManager->error()];
+ }
+}
+
void CommandProcessor::search(const QStringList &args)
{
if (args.isEmpty()) {
@@ -181,19 +215,6 @@ void CommandProcessor::search(const QStringList &args)
}
}
-static const char * const errorTable[] = {
- "No error", //0
- "Storage read error",
- "Invalid service location",
- "Invalid service xml",
- "Invalid service interface descriptor",
- "Service already exists",
- "Interface implementation already exists",
- "Loading of plug-in failed",
- "Service or interface not found",
- "Insufficient capabilities to access service",
- "Unknown error",
-};
void CommandProcessor::add(const QStringList &args)
{