homescreenapp/examples/contentpublishclient/src/contentpublishclient.cpp
changeset 86 e4f038c420f7
parent 62 341166945d65
equal deleted inserted replaced
81:7dd137878ff8 86:e4f038c420f7
   152     QString wallpaper = "c:/data/images/testwallpaper2.jpg";
   152     QString wallpaper = "c:/data/images/testwallpaper2.jpg";
   153     setWallpaper(wallpaper);
   153     setWallpaper(wallpaper);
   154 }
   154 }
   155 
   155 
   156 /*!
   156 /*!
       
   157 
       
   158 */
       
   159 void ContentPublishClient::setWallpaper3()
       
   160 {
       
   161     QString portraitWallpaper = "c:/data/images/testwallpaper_p.png";
       
   162     QString landscapeWallpaper = "c:/data/images/testwallpaper_l.png";
       
   163     setWallpaper(portraitWallpaper, landscapeWallpaper);
       
   164 }
       
   165 
       
   166 /*!
   157     Changes home screen wallpaper to \a wallpaper image.
   167     Changes home screen wallpaper to \a wallpaper image.
   158     Note. load function needs to be called before this, it creates mService object.
   168     Note. load function needs to be called before this, it creates mService object.
   159     
   169     
   160 */
   170 */
   161 // Start of snippet 2
   171 // Start of snippet 2
   184     }
   194     }
   185     return true;
   195     return true;
   186 }
   196 }
   187 
   197 
   188 // End of snippet 2
   198 // End of snippet 2
       
   199 
       
   200 bool ContentPublishClient::setWallpaper(const QString &portraitFileName, const QString &landscapeFileName)
       
   201 {   
       
   202     QByteArray signature = QMetaObject::normalizedSignature("setWallpaper(QString,QString)");
       
   203     int methodIndex = mService->metaObject()->indexOfMethod(signature);   
       
   204     if (methodIndex<0) {
       
   205         return false;
       
   206     }
       
   207     QMetaMethod method = mService->metaObject()->method(methodIndex);
       
   208     bool retVal(false);
       
   209 
       
   210     bool ret = method.invoke( mService,
       
   211                               Qt::DirectConnection,
       
   212                               Q_RETURN_ARG(bool, retVal),
       
   213                               Q_ARG(QString,portraitFileName),
       
   214                               Q_ARG(QString,landscapeFileName));
       
   215                     
       
   216     if(!ret){
       
   217         // invokeMethod returned error
       
   218         return false;
       
   219     }
       
   220     if(!retVal){
       
   221         // setWallpaper returned error
       
   222         return false;
       
   223     }
       
   224     return true;
       
   225 }