tsrc/mpfetchertestapp/src/mpfetchertestappview.cpp
changeset 36 a0afa279b8fe
parent 35 fdb31ab341af
child 38 b93f525c9244
equal deleted inserted replaced
35:fdb31ab341af 36:a0afa279b8fe
   130             if (viewButton)
   130             if (viewButton)
   131             {
   131             {
   132                 connect(viewButton, SIGNAL(clicked()), SLOT(viewSongCaged()));
   132                 connect(viewButton, SIGNAL(clicked()), SLOT(viewSongCaged()));
   133                 bottomLayout->addItem(viewButton);
   133                 bottomLayout->addItem(viewButton);
   134             }
   134             }
       
   135                         
       
   136             HbPushButton* homeScreenButton = new HbPushButton("HS Widget MainView");
       
   137             if (homeScreenButton)
       
   138             {
       
   139                 connect(homeScreenButton, SIGNAL(clicked()), SLOT(launchHomeScreen()));
       
   140                 bottomLayout->addItem(homeScreenButton);
       
   141             }
       
   142                      
       
   143             HbPushButton* homeScreenButtonNPV = new HbPushButton("HS Widget NowPlayingView");
       
   144             if (homeScreenButtonNPV)
       
   145             {
       
   146                 connect(homeScreenButtonNPV, SIGNAL(clicked()), SLOT(launchHomeScreenNowPlaying()));
       
   147                 bottomLayout->addItem(homeScreenButtonNPV);
       
   148             }
       
   149             
       
   150             HbPushButton* homeScreenButtonNPVS = new HbPushButton("HS Widget NPV Shuffle");
       
   151             if (homeScreenButtonNPVS)
       
   152             {
       
   153                 connect(homeScreenButtonNPVS, SIGNAL(clicked()), SLOT(launchHomeScreenNPShuffle()));
       
   154                 bottomLayout->addItem(homeScreenButtonNPVS);
       
   155             }
   135             layout->addItem(bottomLayout);
   156             layout->addItem(bottomLayout);
   136         }
   157         }
   137 
   158 
   138         setLayout(layout); // Takes ownership of layout
   159         setLayout(layout); // Takes ownership of layout
   139     }
   160     }
   324    // If making multiple requests to same service, you can save the mReq as member variable
   345    // If making multiple requests to same service, you can save the mReq as member variable
   325    // In this example all done.
   346    // In this example all done.
   326 
   347 
   327 
   348 
   328 }
   349 }
       
   350 
       
   351 void MpFetcherTestAppView::launchHomeScreen()
       
   352 {
       
   353     QUrl url;
       
   354     
       
   355     url.setUrl("appto://10207C62?activityname=MusicMainView&launchtype=standalone");
       
   356     if(mReq){
       
   357         delete mReq;
       
   358         mReq = 0;
       
   359     }
       
   360     mReq = mAppMgr.create(url);    
       
   361     if (mReq == NULL)
       
   362     {
       
   363         // No handlers for the URI
       
   364         return;
       
   365     }
       
   366     
       
   367     mReq->setBackground(false);
       
   368 
       
   369     // Send the request
       
   370    bool res = mReq->send();
       
   371    if  (!res) 
       
   372    {
       
   373        // Request failed. 
       
   374       int error = mReq->lastError();
       
   375 
       
   376       // Handle error
       
   377    }
       
   378  
       
   379 }
       
   380 
       
   381 void MpFetcherTestAppView::launchHomeScreenNowPlaying()
       
   382 {
       
   383     QUrl url;
       
   384     
       
   385     url.setUrl("appto://10207C62?activityname=MusicNowPlayingView&launchtype=standalone");
       
   386     if(mReq){
       
   387         delete mReq;
       
   388         mReq = 0;
       
   389     }
       
   390     mReq = mAppMgr.create(url);    
       
   391     if (mReq == NULL)
       
   392     {
       
   393         // No handlers for the URI
       
   394         return;
       
   395     }
       
   396     
       
   397     mReq->setBackground(false);
       
   398 
       
   399     // Send the request
       
   400    bool res = mReq->send();
       
   401    if  (!res) 
       
   402    {
       
   403        // Request failed. 
       
   404       int error = mReq->lastError();
       
   405 
       
   406       // Handle error
       
   407    }
       
   408  
       
   409 }
       
   410 
       
   411 void MpFetcherTestAppView::launchHomeScreenNPShuffle()
       
   412 {
       
   413     QUrl url;
       
   414 
       
   415     url.setUrl("appto://10207C62?activityname=MusicNowPlayingView&launchtype=standalone&shuffle=yes");
       
   416     if(mReq){
       
   417         delete mReq;
       
   418         mReq = 0;
       
   419     }
       
   420     mReq = mAppMgr.create(url);    
       
   421     if (mReq == NULL)
       
   422     {
       
   423         // No handlers for the URI
       
   424         return;
       
   425     }
       
   426     
       
   427     mReq->setBackground(false);
       
   428 
       
   429     // Send the request
       
   430    bool res = mReq->send();
       
   431    if  (!res) 
       
   432    {
       
   433        // Request failed. 
       
   434       int error = mReq->lastError();
       
   435 
       
   436       // Handle error
       
   437    }
       
   438  
       
   439 }