phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/testpbkservices.cpp
changeset 50 77bc263e1626
parent 46 efe85016a067
child 53 e6aff7b69165
equal deleted inserted replaced
49:74b30151afd6 50:77bc263e1626
   136         QContactPhoneNumber::DefinitionName, // aDetailType
   136         QContactPhoneNumber::DefinitionName, // aDetailType
   137         "1234567");                          // aFieldContent
   137         "1234567");                          // aFieldContent
   138     CNT_EXIT
   138     CNT_EXIT
   139 }
   139 }
   140 
   140 
       
   141 void testPbkServices::launchEditCreateNew_numberWithSubtype()
       
   142 {
       
   143     CNT_ENTRY
       
   144     launchEditCreateNew(
       
   145         true,                                // aNewInterface
       
   146         QContactPhoneNumber::DefinitionName, // aDetailType
       
   147         "1234567",                           // aFieldContent
       
   148         QContactPhoneNumber::SubTypeLandline); //aDetailSubtype
       
   149     CNT_EXIT
       
   150 }
       
   151 
       
   152 void testPbkServices::launchEditCreateNew_numberWithSubtype_old()
       
   153 {
       
   154     CNT_ENTRY
       
   155     launchEditCreateNew(
       
   156         false,                               // aNewInterface
       
   157         QContactPhoneNumber::DefinitionName, // aDetailType
       
   158         "1234567",                          // aFieldContent
       
   159         QContactPhoneNumber::SubTypeLandline); //aDetailSubtype
       
   160     CNT_EXIT
       
   161 }
       
   162 
   141 void testPbkServices::launchEditCreateNew_email()
   163 void testPbkServices::launchEditCreateNew_email()
   142 {
   164 {
   143     CNT_ENTRY
   165     CNT_ENTRY
   144     launchEditCreateNew(
   166     launchEditCreateNew(
   145         true,                                 // aNewInterface
   167         true,                                 // aNewInterface
   176         QContactOnlineAccount::DefinitionName, // aDetailType
   198         QContactOnlineAccount::DefinitionName, // aDetailType
   177         "account@provider.com");            // aFieldContent
   199         "account@provider.com");            // aFieldContent
   178     CNT_EXIT
   200     CNT_EXIT
   179 }
   201 }
   180 
   202 
       
   203 void testPbkServices::launchEditCreateNew_onlineAccountWithSubtype()
       
   204 {
       
   205     CNT_ENTRY
       
   206     launchEditCreateNew(
       
   207         true,                                  // aNewInterface
       
   208         QContactOnlineAccount::DefinitionName, // aDetailType
       
   209         "provider:account@provider.com",                // aFieldContent
       
   210         QContactOnlineAccount::SubTypeImpp); // aDetailSubtype
       
   211     CNT_EXIT
       
   212 }
       
   213 
       
   214 void testPbkServices::launchEditCreateNew_onlineAccountWithSubtype_old()
       
   215 {
       
   216     CNT_ENTRY
       
   217     launchEditCreateNew(
       
   218         false,                                  // aNewInterface
       
   219         QContactOnlineAccount::DefinitionName, // aDetailType
       
   220         "provider:account@provider.com",                // aFieldContent
       
   221         QContactOnlineAccount::SubTypeImpp); // aDetailSubtype
       
   222     CNT_EXIT
       
   223 }
       
   224 
   181 void testPbkServices::launchEditorVCard()
   225 void testPbkServices::launchEditorVCard()
   182 {
   226 {
   183     CNT_ENTRY
   227     CNT_ENTRY
   184     launchEditorVCard(
   228     launchEditorVCard(
   185         true); // aNewInterface
   229         true); // aNewInterface
   209     CNT_ENTRY
   253     CNT_ENTRY
   210     launchEditUpdateExisting(
   254     launchEditUpdateExisting(
   211         false,                               // aNewInterface
   255         false,                               // aNewInterface
   212         QContactPhoneNumber::DefinitionName, // aDetailType
   256         QContactPhoneNumber::DefinitionName, // aDetailType
   213         "1234567");                          // aDetailValue
   257         "1234567");                          // aDetailValue
       
   258     CNT_EXIT
       
   259 }
       
   260 
       
   261 void testPbkServices::launchEditUpdateExisting_numberWithSubtype()
       
   262 {
       
   263     CNT_ENTRY
       
   264     launchEditUpdateExisting(
       
   265         true,                                // aNewInterface
       
   266         QContactPhoneNumber::DefinitionName, // aDetailType
       
   267         "1234567",                           // aDetailValue
       
   268         QContactPhoneNumber::SubTypeLandline);// aDetailSubtype 
       
   269     CNT_EXIT
       
   270 }
       
   271 
       
   272 void testPbkServices::launchEditUpdateExisting_numberWithSubtype_old()
       
   273 {
       
   274     CNT_ENTRY
       
   275     launchEditUpdateExisting(
       
   276         false,                               // aNewInterface
       
   277         QContactPhoneNumber::DefinitionName, // aDetailType
       
   278         "1234567",                           // aDetailValue
       
   279         QContactPhoneNumber::SubTypeLandline);// aDetailSubtype    
   214     CNT_EXIT
   280     CNT_EXIT
   215 }
   281 }
   216 
   282 
   217 void testPbkServices::launchEditUpdateExisting_email()
   283 void testPbkServices::launchEditUpdateExisting_email()
   218 {
   284 {
   249     CNT_ENTRY
   315     CNT_ENTRY
   250     launchEditUpdateExisting(
   316     launchEditUpdateExisting(
   251         false,                                 // aNewInterface
   317         false,                                 // aNewInterface
   252         QContactOnlineAccount::DefinitionName, // aDetailType
   318         QContactOnlineAccount::DefinitionName, // aDetailType
   253         "account@provider.com");               // aDetailValue
   319         "account@provider.com");               // aDetailValue
       
   320     CNT_EXIT
       
   321 }
       
   322 
       
   323 void testPbkServices::launchEditUpdateExisting_onlineAccountWithSubtype()
       
   324 {
       
   325     CNT_ENTRY
       
   326     launchEditUpdateExisting(
       
   327         true,                                  // aNewInterface
       
   328         QContactOnlineAccount::DefinitionName, // aDetailType
       
   329         "provider:account@provider.com",       // aDetailValue
       
   330         QContactOnlineAccount::SubTypeImpp); // aDetailSubtype              
       
   331     CNT_EXIT
       
   332 }
       
   333 
       
   334 void testPbkServices::launchEditUpdateExisting_onlineAccountWithSubtype_old()
       
   335 {
       
   336     CNT_ENTRY
       
   337     launchEditUpdateExisting(
       
   338         false,                                 // aNewInterface
       
   339         QContactOnlineAccount::DefinitionName, // aDetailType
       
   340         "provider:account@provider.com",       // aDetailValue
       
   341         QContactOnlineAccount::SubTypeImpp); // aDetailSubtype    
   254     CNT_EXIT
   342     CNT_EXIT
   255 }
   343 }
   256 
   344 
   257 void testPbkServices::launchContactCard()
   345 void testPbkServices::launchContactCard()
   258 {
   346 {
   429     QVariantList args; 
   517     QVariantList args; 
   430 
   518 
   431     XQApplicationManager appMng;
   519     XQApplicationManager appMng;
   432     if ( aNewInterface )
   520     if ( aNewInterface )
   433     {
   521     {
   434         QString interface("com.nokia.symbian.IContactFetch"); 
   522         QString interface("com.nokia.symbian.IContactsFetch"); 
   435         QString operation("multiFetch(QString,QString,QString)");
   523         QString operation("multiFetch(QString,QString)");
   436         // There are two kinds of create() methods in XQApplicationManager. The one with four arguments
   524         // There are two kinds of create() methods in XQApplicationManager. The one with four arguments
   437         // takes the service name also. The one with three arguments (used below) does not take the service name.
   525         // takes the service name also. The one with three arguments (used below) does not take the service name.
   438         // The interface name is enough for finding the correct provider at run time.
   526         // The interface name is enough for finding the correct provider at run time.
   439         mRequest = appMng.create(interface, operation, true); // embedded
   527         mRequest = appMng.create(interface, operation, true); // embedded
   440     }
   528     }
   475 
   563 
   476     QVariantList args; 
   564     QVariantList args; 
   477     XQApplicationManager appMng;
   565     XQApplicationManager appMng;
   478     if ( aNewInterface )
   566     if ( aNewInterface )
   479     {
   567     {
   480         QString interface("com.nokia.symbian.IContactFetch"); 
   568         QString interface("com.nokia.symbian.IContactsFetch"); 
   481         QString operation("singleFetch(QString,QString,QString)");
   569         QString operation("singleFetch(QString,QString)");
   482         // There are two kinds of create() methods in XQApplicationManager. The one with four arguments
   570         // There are two kinds of create() methods in XQApplicationManager. The one with four arguments
   483         // takes the service name also. The one with three arguments (used below) does not take the service name.
   571         // takes the service name also. The one with three arguments (used below) does not take the service name.
   484         // The interface name is enough for finding the correct provider at run time.
   572         // The interface name is enough for finding the correct provider at run time.
   485         mRequest = appMng.create(interface, operation, true); // embedded
   573         mRequest = appMng.create(interface, operation, true); // embedded
   486     }
   574     }
   515         CNT_LOG_ARGS("Failed to create request.")
   603         CNT_LOG_ARGS("Failed to create request.")
   516     }
   604     }
   517     CNT_EXIT
   605     CNT_EXIT
   518 }
   606 }
   519 
   607 
   520 void testPbkServices::launchEditCreateNew( bool aNewInterface, QString aDetailType, QString aFieldContent )
   608 void testPbkServices::launchEditCreateNew( bool aNewInterface, QString aDetailType, QString aFieldContent, QString aDetailSubtype )
   521 {
   609 {
   522     CNT_ENTRY
   610     CNT_ENTRY
   523     delete mRequest;
   611     delete mRequest;
   524     mRequest=0;
   612     mRequest=0;
   525 
   613 
   526     QVariantList args; 
   614     QVariantList args; 
   527     XQApplicationManager appMng;
   615     XQApplicationManager appMng;
   528     QString operation("editCreateNew(QString,QString)");
   616     QString operation("editCreateNew(QString,QString)");
       
   617     if ( !aDetailSubtype.isEmpty() )
       
   618     {
       
   619         operation = "editCreateNew(QString,QString,QString)";
       
   620     }
       
   621     
   529     if ( aNewInterface )
   622     if ( aNewInterface )
   530     {
   623     {
   531         QString interface("com.nokia.symbian.IContactFetch"); 
   624         QString interface("com.nokia.symbian.IContactsFetch"); 
   532         // service name is not needed
   625         // service name is not needed
   533         mRequest = appMng.create( interface, operation, true); // embedded
   626         mRequest = appMng.create( interface, operation, true); // embedded
   534     }
   627     }
   535     else
   628     else
   536     {
   629     {
   546         // Result handlers 
   639         // Result handlers 
   547         connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
   640         connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
   548         
   641         
   549         args << aDetailType;
   642         args << aDetailType;
   550         args << aFieldContent;
   643         args << aFieldContent;
       
   644         if ( !aDetailSubtype.isEmpty() )
       
   645         {
       
   646             args << aDetailSubtype;
       
   647         }
   551         
   648         
   552         mRequest->setArguments(args); 
   649         mRequest->setArguments(args); 
   553         mRequest->send();
   650         mRequest->send();
   554         CNT_LOG_ARGS("Sent request.")
   651         CNT_LOG_ARGS("Sent request.")
   555     }
   652     }
   568 
   665 
   569     QVariantList args; 
   666     QVariantList args; 
   570     XQApplicationManager appMng;
   667     XQApplicationManager appMng;
   571     if ( aNewInterface )
   668     if ( aNewInterface )
   572     {
   669     {
   573         QString interface("com.nokia.symbian.IContactEdit"); 
   670         QString interface("com.nokia.symbian.IContactsEdit"); 
   574         QString operation("editCreateNewFromVCard(QString)");
   671         QString operation("editCreateNewFromVCard(QString)");
   575         // service name is not needed
   672         // service name is not needed
   576         mRequest = appMng.create( interface, operation, true); // embedded 
   673         mRequest = appMng.create( interface, operation, true); // embedded 
   577     }
   674     }
   578     else
   675     else
   601         CNT_LOG_ARGS("Failed to create request.")
   698         CNT_LOG_ARGS("Failed to create request.")
   602     }
   699     }
   603     CNT_EXIT
   700     CNT_EXIT
   604 }
   701 }
   605 
   702 
   606 void testPbkServices::launchEditUpdateExisting( bool aNewInterface, QString aDetailType, QString aDetailValue )
   703 void testPbkServices::launchEditUpdateExisting( bool aNewInterface, QString aDetailType, QString aDetailValue, QString aDetailSubtype )
   607 {
   704 {
   608     CNT_ENTRY
   705     CNT_ENTRY
   609     delete mRequest;
   706     delete mRequest;
   610     mRequest=0;
   707     mRequest=0;
   611 
   708 
   612     QVariantList args; 
   709     QVariantList args; 
   613     XQApplicationManager appMng;
   710     XQApplicationManager appMng;
   614     QString operation("editUpdateExisting(QString,QString)");
   711     QString operation("editUpdateExisting(QString,QString)");
       
   712     if ( !aDetailSubtype.isEmpty() )
       
   713     {
       
   714         operation = "editUpdateExisting(QString,QString,QString)";
       
   715     }
       
   716         
   615     if ( aNewInterface )
   717     if ( aNewInterface )
   616     {
   718     {
   617         QString interface("com.nokia.symbian.IContactEdit");
   719         QString interface("com.nokia.symbian.IContactsEdit");
   618         // service name is not needed
   720         // service name is not needed
   619         mRequest = appMng.create(interface, operation, true); // embedded 
   721         mRequest = appMng.create(interface, operation, true); // embedded 
   620     }
   722     }
   621     else
   723     else
   622     {
   724     {
   631         // Result handlers 
   733         // Result handlers 
   632         connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
   734         connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
   633         
   735         
   634         args << aDetailType;
   736         args << aDetailType;
   635         args << aDetailValue;
   737         args << aDetailValue;
       
   738         if ( !aDetailSubtype.isEmpty() )
       
   739         {
       
   740             args << aDetailSubtype;
       
   741         }
   636         
   742         
   637         mRequest->setArguments(args); 
   743         mRequest->setArguments(args); 
   638         mRequest->send();
   744         mRequest->send();
   639         CNT_LOG_ARGS("Sent request.")
   745         CNT_LOG_ARGS("Sent request.")
   640     }
   746     }
   668         
   774         
   669     QVariantList args; 
   775     QVariantList args; 
   670     XQApplicationManager appMng;
   776     XQApplicationManager appMng;
   671     if ( aNewInterface )
   777     if ( aNewInterface )
   672     {
   778     {
   673         QString interface("com.nokia.symbian.IContactView");
   779         QString interface("com.nokia.symbian.IContactsView");
   674         QString operation("openContactCard(int)");
   780         QString operation("openContactCard(int)");
   675         // interface name is not needed
   781         // interface name is not needed
   676         mRequest = appMng.create( interface, operation, true); // embedded 
   782         mRequest = appMng.create( interface, operation, true); // embedded 
   677     }
   783     }
   678     else
   784     else
   709         
   815         
   710     QVariantList args; 
   816     QVariantList args; 
   711     XQApplicationManager appMng;
   817     XQApplicationManager appMng;
   712     if ( aNewInterface )
   818     if ( aNewInterface )
   713     {
   819     {
   714         QString interface("com.nokia.symbian.IContactView");
   820         QString interface("com.nokia.symbian.IContactsView");
   715         QString operation("openContactCard(QString,QString)");
   821         QString operation("openTemporaryContactCard(QString,QString)");
   716         // service name is not needed
   822         // service name is not needed
   717         mRequest = appMng.create(interface, operation, true); // embedded 
   823         mRequest = appMng.create(interface, operation, true); // embedded 
   718     }
   824     }
   719     else
   825     else
   720     {
   826     {