homescreenapp/hshomescreenclientplugin/src/hshomescreenclient.cpp
changeset 92 6727c5d0afc7
parent 60 30f14686fb04
equal deleted inserted replaced
85:35368b604b28 92:6727c5d0afc7
    82             Q_ARG(QString,fileName));
    82             Q_ARG(QString,fileName));
    83     eventLoop.exec();
    83     eventLoop.exec();
    84    
    84    
    85     return mRequestResult;
    85     return mRequestResult;
    86 }
    86 }
       
    87 
       
    88 /*!
       
    89 
       
    90 */
       
    91 bool HsHomescreenClient::setWallpaper(const QString &portraitFileName, const QString &landscapeFileName)
       
    92 {
       
    93     QEventLoop eventLoop;
       
    94     connect(this, SIGNAL(requestFinished()), &eventLoop, SLOT(quit()));
       
    95     QMetaObject::invokeMethod(
       
    96             this, 
       
    97             "doSetWallpaper2", 
       
    98             Qt::QueuedConnection,
       
    99             Q_ARG(QString,portraitFileName),
       
   100             Q_ARG(QString,landscapeFileName));
       
   101     eventLoop.exec();
       
   102    
       
   103     return mRequestResult;
       
   104 }
    87     
   105     
    88 /*!
   106 /*!
    89    Called when request is completed.
   107    Called when request is completed.
    90  */
   108  */
    91 void HsHomescreenClient::onRequestCompleted(const QVariant &result)
   109 void HsHomescreenClient::onRequestCompleted(const QVariant &result)
   156             SLOT(onRequestError(int)));
   174             SLOT(onRequestError(int)));
   157        
   175        
   158     mRequestResult = false;
   176     mRequestResult = false;
   159     if (!mAsyncRequest->send()) {
   177     if (!mAsyncRequest->send()) {
   160        emit requestFinished();
   178        emit requestFinished();
       
   179     }    
       
   180 }
       
   181 
       
   182 void HsHomescreenClient::doSetWallpaper2(const QString &portraitFileName, const QString &landscapeFileName)
       
   183 {
       
   184     delete mAsyncRequest;
       
   185     mAsyncRequest = 0;
       
   186     mAsyncRequest = new XQServiceRequest(INTERFACE_NAME,
       
   187                         "setWallpaper(QString,QString)", false);
       
   188     XQRequestInfo requestInfo = mAsyncRequest->info();
       
   189     requestInfo.setBackground(true);
       
   190     mAsyncRequest->setInfo(requestInfo);
       
   191     
       
   192     *mAsyncRequest << portraitFileName;
       
   193     *mAsyncRequest << landscapeFileName;
       
   194     
       
   195     connect(mAsyncRequest, SIGNAL(requestCompleted(QVariant)), 
       
   196             SLOT(onRequestCompleted(QVariant)));
       
   197     connect(mAsyncRequest, SIGNAL(requestError(int)),
       
   198             SLOT(onRequestError(int)));
       
   199        
       
   200     mRequestResult = false;
       
   201     if (!mAsyncRequest->send()) {
       
   202        emit requestFinished();
   161     }
   203     }
   162     
   204 }
   163 }