homescreenapp/hshomescreenclientplugin/src/hshomescreenclient.cpp
changeset 86 e4f038c420f7
parent 62 341166945d65
--- a/homescreenapp/hshomescreenclientplugin/src/hshomescreenclient.cpp	Wed Aug 18 10:33:57 2010 +0300
+++ b/homescreenapp/hshomescreenclientplugin/src/hshomescreenclient.cpp	Mon Sep 13 13:03:23 2010 +0300
@@ -84,6 +84,24 @@
    
     return mRequestResult;
 }
+
+/*!
+
+*/
+bool HsHomescreenClient::setWallpaper(const QString &portraitFileName, const QString &landscapeFileName)
+{
+    QEventLoop eventLoop;
+    connect(this, SIGNAL(requestFinished()), &eventLoop, SLOT(quit()));
+    QMetaObject::invokeMethod(
+            this, 
+            "doSetWallpaper2", 
+            Qt::QueuedConnection,
+            Q_ARG(QString,portraitFileName),
+            Q_ARG(QString,landscapeFileName));
+    eventLoop.exec();
+   
+    return mRequestResult;
+}
     
 /*!
    Called when request is completed.
@@ -158,6 +176,29 @@
     mRequestResult = false;
     if (!mAsyncRequest->send()) {
        emit requestFinished();
-    }
+    }    
+}
+
+void HsHomescreenClient::doSetWallpaper2(const QString &portraitFileName, const QString &landscapeFileName)
+{
+    delete mAsyncRequest;
+    mAsyncRequest = 0;
+    mAsyncRequest = new XQServiceRequest(INTERFACE_NAME,
+                        "setWallpaper(QString,QString)", false);
+    XQRequestInfo requestInfo = mAsyncRequest->info();
+    requestInfo.setBackground(true);
+    mAsyncRequest->setInfo(requestInfo);
     
+    *mAsyncRequest << portraitFileName;
+    *mAsyncRequest << landscapeFileName;
+    
+    connect(mAsyncRequest, SIGNAL(requestCompleted(QVariant)), 
+            SLOT(onRequestCompleted(QVariant)));
+    connect(mAsyncRequest, SIGNAL(requestError(int)),
+            SLOT(onRequestError(int)));
+       
+    mRequestResult = false;
+    if (!mAsyncRequest->send()) {
+       emit requestFinished();
+    }
 }