qthighway/examples/appmgrclient/src/appmgrclient.cpp
changeset 11 06b8e2af4411
parent 8 71781823f776
child 15 1f895d8a5b2b
equal deleted inserted replaced
8:71781823f776 11:06b8e2af4411
   143     mGenericSend = new QCheckBox("Use generic send()");
   143     mGenericSend = new QCheckBox("Use generic send()");
   144     mCheckEmbedded->setCheckState(Qt::Checked);
   144     mCheckEmbedded->setCheckState(Qt::Checked);
   145     mSynchronous->setCheckState(Qt::Checked);
   145     mSynchronous->setCheckState(Qt::Checked);
   146     mGenericSend->setCheckState(Qt::Checked);  // Apply one send() for both embedded/non-embedded
   146     mGenericSend->setCheckState(Qt::Checked);  // Apply one send() for both embedded/non-embedded
   147     
   147     
   148     mReqArg = new QLineEdit("0");
   148     mReqArg = new QLineEdit("?");
   149     
   149     
   150     mTextRetValue = new QLineEdit("no ret value set");
   150     mTextRetValue = new QLineEdit("no ret value set");
   151 
   151 
   152     QFileInfo appinfo (qApp->applicationFilePath());
   152     QFileInfo appinfo (qApp->applicationFilePath());
   153     mAppName = appinfo.baseName();
   153     mAppName = appinfo.baseName();
   406     test(&req1, IDIAL, OPERATION1);
   406     test(&req1, IDIAL, OPERATION1);
   407     qDebug() << mAppName << " test1 END";
   407     qDebug() << mAppName << " test1 END";
   408 
   408 
   409     qDebug("%s::isRunning=%d", qPrintable(mAppName), testRunning("com.nokia.services.serviceapp", IDIAL));
   409     qDebug("%s::isRunning=%d", qPrintable(mAppName), testRunning("com.nokia.services.serviceapp", IDIAL));
   410     
   410     
   411     
       
   412     /*
       
   413     mReqArg->setText("77777"); 
       
   414     qDebug() << mAppName <<  " test1 second call";
       
   415     test(&req1, IDIAL, OPERATION1);
       
   416     */
       
   417 }
   411 }
   418 
   412 
   419 
   413 
   420 void AppMgrClient::test2()
   414 void AppMgrClient::test2()
   421 {
   415 {
   473 void AppMgrClient::test3()
   467 void AppMgrClient::test3()
   474 {
   468 {
   475     qDebug() << mAppName << " test3 START";
   469     qDebug() << mAppName << " test3 START";
   476     
   470     
   477     test(&req3,IDIAL,ERR_OPERATION1);
   471     test(&req3,IDIAL,ERR_OPERATION1);
   478     test(&req3,ERR_IDIAL,ERR_OPERATION1);
   472     // test(&req3,ERR_IDIAL,ERR_OPERATION1);
   479     test(&req3,ERR_IDIAL,ERR_OPERATION1);
   473     // test(&req3,ERR_IDIAL,ERR_OPERATION1);
   480     
   474     
   481     qDebug() << mAppName << " test3 END";
   475     qDebug() << mAppName << " test3 END";
   482     
   476     
   483 }
   477 }
   484 
   478 
   593 
   587 
   594 void AppMgrClient::test6()
   588 void AppMgrClient::test6()
   595 {
   589 {
   596     qDebug() << mAppName << " test6 START";
   590     qDebug() << mAppName << " test6 START";
   597 
   591 
   598     QUrl uri("testto://authority?param1=value1&param1=value2"); 
   592     QUrl uri("test2to://authority?param1=value1&param1=value2"); 
       
   593     // QUrl uri(mReqArg->text()); 
   599     qDebug() << mAppName << " Uri=" << uri.toString();
   594     qDebug() << mAppName << " Uri=" << uri.toString();
   600     qDebug() << mAppName << " isValid=" << uri.isValid();
   595     qDebug() << mAppName << " isValid=" << uri.isValid();
   601     qDebug() << mAppName << " Uri authority=" << uri.authority();
   596     qDebug() << mAppName << " Uri authority=" << uri.authority();
       
   597     
       
   598     if (!uri.isValid())
       
   599     {
       
   600         qDebug() << mAppName << " Invalid URI " << mReqArg->text();
       
   601         return;
       
   602     }
   602 
   603 
   603     QList<XQAiwInterfaceDescriptor> uriHandlers = appmgr.list(uri);
   604     QList<XQAiwInterfaceDescriptor> uriHandlers = appmgr.list(uri);
   604     // Note : Only services supporting custom property are returned
   605     // Note : Only services supporting custom property are returned
   605     foreach (XQAiwInterfaceDescriptor d, uriHandlers)
   606     foreach (XQAiwInterfaceDescriptor d, uriHandlers)
   606     {
   607     {
   611     }
   612     }
   612 
   613 
   613     if (!req6)
   614     if (!req6)
   614     {
   615     {
   615         req6 = appmgr.create(uri);
   616         req6 = appmgr.create(uri);
   616         connectSignals(req6); 
   617         connectSignals(req6);
   617     }
   618     }
   618 
   619 
   619     test(&req6, uri.toString());
   620     test(&req6, uri.toString());
   620 
   621 
   621     qDebug() << mAppName << " test6 END";
   622     qDebug() << mAppName << " test6 END";
   628     
   629     
   629     // Should launch viewer for text/plain MimeTestApp.
   630     // Should launch viewer for text/plain MimeTestApp.
   630     // Create test file
   631     // Create test file
   631     createTestFile("C:/data/Others", "test.txt");
   632     createTestFile("C:/data/Others", "test.txt");
   632 
   633 
   633     
   634     // Copy files from DrmTestFiles.zip into correct location
   634     QFile file("C:/data/Others/test.txt");
   635     QFile file("C:/data/Others/one.jpg");
   635     qDebug() << mAppName << " File=" << file.fileName();
   636     qDebug() << mAppName << " File=" << file.fileName();
   636     qDebug() << mAppName << " exists=" << file.exists();
   637     qDebug() << mAppName << " exists=" << file.exists();
   637 
   638 
   638     QList<XQAiwInterfaceDescriptor> fileHandlers = appmgr.list(file);
   639     QList<XQAiwInterfaceDescriptor> fileHandlers = appmgr.list(file);
   639     foreach (XQAiwInterfaceDescriptor d, fileHandlers)
   640     foreach (XQAiwInterfaceDescriptor d, fileHandlers)
   658 void AppMgrClient::test8()
   659 void AppMgrClient::test8()
   659 {
   660 {
   660     qDebug() << mAppName << " test8 START";
   661     qDebug() << mAppName << " test8 START";
   661 
   662 
   662     // E0022E73 == ServiceApp
   663     // E0022E73 == ServiceApp
   663     QUrl uri("http://www.nokia.com"); 
   664     QUrl uri("http://www.nokia.com");
       
   665     
       
   666     // Copy files from DrmTestFiles.zip into correct location
       
   667     // Uncomment for "file" scheme testing
       
   668     // QUrl uri("file:///C:/data/Others/one.jpg");
       
   669     
   664     qDebug() << mAppName << " Uri=" << uri.toString();
   670     qDebug() << mAppName << " Uri=" << uri.toString();
   665     qDebug() << mAppName << " isValid=" << uri.isValid();
   671     qDebug() << mAppName << " isValid=" << uri.isValid();
   666     qDebug() << mAppName << " Uri authority=" << uri.authority();
   672     qDebug() << mAppName << " Uri authority=" << uri.authority();
   667 
   673 
   668     if (!req8)
   674     if (!req8)