--- a/phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/testpbkservices.cpp Fri Jun 11 13:29:23 2010 +0300
+++ b/phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/testpbkservices.cpp Wed Jun 23 18:02:44 2010 +0300
@@ -29,6 +29,8 @@
#include <QGraphicsLinearLayout>
#include <QDebug>
+#include "cntdebug.h"
+
testPbkServices::testPbkServices(HbMainWindow *aParent)
{
@@ -40,300 +42,317 @@
testPbkServices::~testPbkServices()
{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
+ delete mRequest;
+ mRequest=0;
+}
+
+void testPbkServices::launchMultiFetch()
+{
+ CNT_ENTRY
+ launchMultiFetch(
+ true, // aNewInterface = true
+ KCntActionAll); // aAction (all actions in this case)
+ CNT_EXIT
+}
+
+void testPbkServices::launchMultiFetch_old()
+{
+ CNT_ENTRY
+ launchMultiFetch(
+ false, // aNewInterface = false
+ KCntActionAll); // aAction (all actions in this case)
+ CNT_EXIT
+}
+
+void testPbkServices::launchMultiFetch_sms()
+{
+ CNT_ENTRY
+ launchMultiFetch(
+ true, // aNewInterface = false
+ KCntActionSms); // aAction
+ CNT_EXIT
}
-void testPbkServices::launchEditorNumber()
+void testPbkServices::launchMultiFetch_sms_old()
{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
+ CNT_ENTRY
+ launchMultiFetch(
+ false, // aNewInterface
+ KCntActionSms); // aAction
+ CNT_EXIT
+}
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("editCreateNew(QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
-
- args << QContactPhoneNumber::DefinitionName.operator QVariant();
- args << "1234567";
-
- mRequest->setArguments(args);
- mRequest->send();
+void testPbkServices::launchMultiFetch_email()
+{
+ CNT_ENTRY
+ launchMultiFetch(
+ true, // aNewInterface
+ KCntActionEmail); // aAction
+ CNT_EXIT
+}
+
+void testPbkServices::launchMultiFetch_email_old()
+{
+ CNT_ENTRY
+ launchMultiFetch(
+ false, // aNewInterface
+ KCntActionEmail); // aAction
+ CNT_EXIT
+}
+
+void testPbkServices::launchSingleFetch()
+{
+ CNT_ENTRY
+ launchSingleFetch(
+ true, // aNewInterface
+ KCntActionAll ); // aAction
+ CNT_EXIT
}
-void testPbkServices::launchEditorEmail()
+void testPbkServices::launchSingleFetch_old()
{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
+ CNT_ENTRY
+ launchSingleFetch(
+ false, // aNewInterface
+ KCntActionAll ); // aAction
+ CNT_EXIT
+}
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("editCreateNew(QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
-
- args << QContactEmailAddress::DefinitionName.operator QVariant();
- args << "email@mailprovider.com";
-
- mRequest->setArguments(args);
- mRequest->send();
+void testPbkServices::launchEditCreateNew_number()
+{
+ CNT_ENTRY
+ launchEditCreateNew(
+ true, // aNewInterface
+ QContactPhoneNumber::DefinitionName, // aDetailType
+ "1234567"); // aFieldContent
+ CNT_EXIT
+}
+
+void testPbkServices::launchEditCreateNew_number_old()
+{
+ CNT_ENTRY
+ launchEditCreateNew(
+ false, // aNewInterface
+ QContactPhoneNumber::DefinitionName, // aDetailType
+ "1234567"); // aFieldContent
+ CNT_EXIT
}
-void testPbkServices::launchEditorOnlineAccount()
+void testPbkServices::launchEditCreateNew_email()
{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
+ CNT_ENTRY
+ launchEditCreateNew(
+ true, // aNewInterface
+ QContactEmailAddress::DefinitionName, // aDetailType
+ "email@mailprovider.com"); // aFieldContent
+ CNT_EXIT
+}
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("editCreateNew(QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
-
- args << QContactOnlineAccount::DefinitionName.operator QVariant();
- args << "account@provider.com";
-
- mRequest->setArguments(args);
- mRequest->send();
+void testPbkServices::launchEditCreateNew_email_old()
+{
+ CNT_ENTRY
+ launchEditCreateNew(
+ false, // aNewInterface
+ QContactEmailAddress::DefinitionName, // aDetailType
+ "email@mailprovider.com"); // aFieldContent
+ CNT_EXIT
+}
+
+void testPbkServices::launchEditCreateNew_onlineAccount()
+{
+ CNT_ENTRY
+ launchEditCreateNew(
+ true, // aNewInterface
+ QContactOnlineAccount::DefinitionName, // aDetailType
+ "account@provider.com"); // aFieldContent
+ CNT_EXIT
+}
+
+void testPbkServices::launchEditCreateNew_onlineAccount_old()
+{
+ CNT_ENTRY
+ launchEditCreateNew(
+ false, // aNewInterface
+ QContactOnlineAccount::DefinitionName, // aDetailType
+ "account@provider.com"); // aFieldContent
+ CNT_EXIT
}
void testPbkServices::launchEditorVCard()
{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
+ CNT_ENTRY
+ launchEditorVCard(
+ true); // aNewInterface
+ CNT_EXIT
+}
+
+void testPbkServices::launchEditorVCard_old()
+{
+ CNT_ENTRY
+ launchEditorVCard(
+ false); // aNewInterface
+ CNT_EXIT
+}
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("editCreateNew(QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
-
- args << "C:\\data\\Others\\testvcard.vcf";
-
- mRequest->setArguments(args);
- mRequest->send();
+void testPbkServices::launchEditUpdateExisting_number()
+{
+ CNT_ENTRY
+ launchEditUpdateExisting(
+ true, // aNewInterface
+ QContactPhoneNumber::DefinitionName, // aDetailType
+ "1234567"); // aDetailValue
+ CNT_EXIT
+}
+
+void testPbkServices::launchEditUpdateExisting_number_old()
+{
+ CNT_ENTRY
+ launchEditUpdateExisting(
+ false, // aNewInterface
+ QContactPhoneNumber::DefinitionName, // aDetailType
+ "1234567"); // aDetailValue
+ CNT_EXIT
}
-void testPbkServices::launchUpdateEditorNumber()
+void testPbkServices::launchEditUpdateExisting_email()
{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
+ CNT_ENTRY
+ launchEditUpdateExisting(
+ true, // aNewInterface
+ QContactEmailAddress::DefinitionName, // aDetailType
+ "email@mailprovider.com"); // aDetailValue
+ CNT_EXIT
+}
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("editUpdateExisting(QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
-
- args << QContactPhoneNumber::DefinitionName.operator QVariant();
- args << "1234567";
-
- mRequest->setArguments(args);
- mRequest->send();
+void testPbkServices::launchEditUpdateExisting_email_old()
+{
+ CNT_ENTRY
+ launchEditUpdateExisting(
+ false, // aNewInterface
+ QContactEmailAddress::DefinitionName, // aDetailType
+ "email@mailprovider.com"); // aDetailValue
+ CNT_EXIT
+}
+
+void testPbkServices::launchEditUpdateExisting_onlineAccount()
+{
+ CNT_ENTRY
+ launchEditUpdateExisting(
+ true, // aNewInterface
+ QContactOnlineAccount::DefinitionName, // aDetailType
+ "account@provider.com"); // aDetailValue
+ CNT_EXIT
+}
+
+void testPbkServices::launchEditUpdateExisting_onlineAccount_old()
+{
+ CNT_ENTRY
+ launchEditUpdateExisting(
+ false, // aNewInterface
+ QContactOnlineAccount::DefinitionName, // aDetailType
+ "account@provider.com"); // aDetailValue
+ CNT_EXIT
}
-void testPbkServices::launchUpdateEditorEmail()
+void testPbkServices::launchContactCard()
{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
+ CNT_ENTRY
+ launchContactCard(
+ true ); // aNewInterface
+ CNT_EXIT
+}
+
+void testPbkServices::launchContactCard_old()
+{
+ CNT_ENTRY
+ launchContactCard(
+ false ); // aNewInterface
+ CNT_EXIT
+}
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("editUpdateExisting(QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
-
- args << QContactEmailAddress::DefinitionName.operator QVariant();
- args << "email@mailprovider.com";
-
- mRequest->setArguments(args);
- mRequest->send();
+void testPbkServices::launchContactCardNumber()
+{
+ CNT_ENTRY
+ launchContactCard(
+ true, // aNewInterface
+ QContactPhoneNumber::DefinitionName, // aDetailType
+ "777555669" ); // aDetailValue
+ CNT_EXIT
+}
+
+void testPbkServices::launchContactCardNumber_old()
+{
+ CNT_ENTRY
+ launchContactCard(
+ false, // aNewInterface
+ QContactPhoneNumber::DefinitionName, // aDetailType
+ "777555669" ); // aDetailValue
+ CNT_EXIT
}
-void testPbkServices::launchUpdateEditorOnlineAccount()
+void testPbkServices::launchContactCardEmail()
{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
+ CNT_ENTRY
+ launchContactCard(
+ true, // aNewInterface
+ QContactEmailAddress::DefinitionName, // aDetailType
+ "aa.jj@aajj.com" ); // aDetailValue
+ CNT_EXIT
+}
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("editUpdateExisting(QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
-
- args << QContactOnlineAccount::DefinitionName.operator QVariant();
- args << "account@provider.com";
-
- mRequest->setArguments(args);
- mRequest->send();
+void testPbkServices::launchContactCardEmail_old()
+{
+ CNT_ENTRY
+ launchContactCard(
+ false, // aNewInterface
+ QContactEmailAddress::DefinitionName, // aDetailType
+ "aa.jj@aajj.com" ); // aDetailValue
+ CNT_EXIT
+ CNT_EXIT
+}
+
+void testPbkServices::launchContactCardOnlineAccount()
+{
+ CNT_ENTRY
+ launchContactCard(
+ true, // aNewInterface
+ QContactOnlineAccount::DefinitionName, // aDetailType
+ "account@provider.com" ); // aDetailValue
+ CNT_EXIT
+}
+
+void testPbkServices::launchContactCardOnlineAccount_old()
+{
+ CNT_ENTRY
+ launchContactCard(
+ true, // aNewInterface
+ QContactOnlineAccount::DefinitionName, // aDetailType
+ "account@provider.com" ); // aDetailValue
+ CNT_EXIT
}
void testPbkServices::onEditCompleted(const QVariant& value)
{
+ CNT_ENTRY
mMainWindow->activateWindow();
if (value.toInt() == 1)
{
HbMessageBox::information("Contact saved");
+ CNT_LOG_ARGS("test: Contact saved")
}
else
{
HbMessageBox::information("Contact saving failed");
- }
-}
-
-void testPbkServices::launchFetch()
-{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
-
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("fetch(QString,QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&)));
-
- args << "Non-filtered multi-fetch";
- args << KCntActionAll;
- args << KCntFilterDisplayAll;
-
- mRequest->setArguments(args);
- mRequest->send();
-}
-
-void testPbkServices::launchSingleFetch()
-{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
+ CNT_LOG_ARGS("test: Contact saving failed")
}
-
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("Dofetch(QString,QString,QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&)));
-
- args << "Single-fetching";
- args << KCntActionAll;
- args << KCntFilterDisplayAll;
- args << KCntSingleSelectionMode;
-
- mRequest->setArguments(args);
- mRequest->send();
+ CNT_EXIT
}
-void testPbkServices::launchSmsFilteredFetch()
-{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
-
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("fetch(QString,QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&)));
-
- args << "Filtered multi-fetch";
- args << KCntActionSms;
- args << KCntFilterDisplayAll;
-
- mRequest->setArguments(args);
- mRequest->send();
-}
-
-void testPbkServices::launchEmailFilteredFetch()
-{
- if (mRequest)
- {
- delete mRequest;
- mRequest=0;
- }
-
- QVariantList args;
- QString serviceName("com.nokia.services.phonebookservices");
- QString operation("fetch(QString,QString,QString)");
- XQApplicationManager appMng;
- mRequest = appMng.create(serviceName, "Fetch", operation, true); // embedded
-
- // Result handlers
- connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&)));
-
- args << "Filtered multi-fetch";
- args << KCntActionEmail;
- args << KCntFilterDisplayAll;
-
- mRequest->setArguments(args);
- mRequest->send();
-}
-
-
void testPbkServices::onRequestCompleted(const QVariant& value)
{
-
+ CNT_ENTRY
mMainWindow->activateWindow();
CntServicesContactList retValue;
@@ -342,7 +361,8 @@
if (retValue.count() == 0)
{
- HbMessageBox::information("Nothing returned");
+ HbMessageBox::information("test: Nothing returned");
+ CNT_LOG_ARGS("No data returned.")
}
else
@@ -353,12 +373,14 @@
QString name = retValue[i].mDisplayName;
listWidget->addItem("name:" );
listWidget->addItem(name);
+ CNT_LOG_ARGS("Returned name: " << name)
QString number = retValue[i].mPhoneNumber;
if (number!="")
{
listWidget->addItem("number:");
listWidget->addItem(number);
+ CNT_LOG_ARGS("Returned number: " << number)
}
QString emailAddress = retValue[i].mEmailAddress;
@@ -366,6 +388,7 @@
{
listWidget->addItem("emailAddress:");
listWidget->addItem(emailAddress);
+ CNT_LOG_ARGS("Returned email: " << emailAddress)
}
@@ -394,9 +417,330 @@
popup->setTimeout(15000);
popup->open();
}
+ CNT_EXIT
+}
+void testPbkServices::launchMultiFetch( bool aNewInterface, QString aAction )
+{
+ CNT_ENTRY
+ delete mRequest;
+ mRequest=0;
+
+ QVariantList args;
+
+ XQApplicationManager appMng;
+ if ( aNewInterface )
+ {
+ QString interface("com.nokia.symbian.IContactFetch");
+ QString operation("multiFetch(QString,QString,QString)");
+ // There are two kinds of create() methods in XQApplicationManager. The one with four arguments
+ // takes the service name also. The one with three arguments (used below) does not take the service name.
+ // The interface name is enough for finding the correct provider at run time.
+ mRequest = appMng.create(interface, operation, true); // embedded
+ }
+ else
+ {
+ mRequest = appMng.create(
+ "com.nokia.services.phonebookservices",// service
+ "Fetch", // interface
+ "fetch(QString,QString,QString)", // operation
+ true); // embedded
+ }
+
+ if (mRequest)
+ {
+ CNT_LOG_ARGS("Created request.")
+ // Result handlers
+ connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&)));
+
+ args << "My own title"; // This is the title for the view
+ args << aAction;
+ args << KCntFilterDisplayAll;
+
+ mRequest->setArguments(args);
+ mRequest->send();
+ }
+ else
+ {
+ CNT_LOG_ARGS("Failed to create request.")
+ }
+ CNT_EXIT
+}
+
+void testPbkServices::launchSingleFetch( bool aNewInterface, QString aAction )
+{
+ CNT_ENTRY
+ delete mRequest;
+ mRequest=0;
+
+ QVariantList args;
+ XQApplicationManager appMng;
+ if ( aNewInterface )
+ {
+ QString interface("com.nokia.symbian.IContactFetch");
+ QString operation("singleFetch(QString,QString,QString)");
+ // There are two kinds of create() methods in XQApplicationManager. The one with four arguments
+ // takes the service name also. The one with three arguments (used below) does not take the service name.
+ // The interface name is enough for finding the correct provider at run time.
+ mRequest = appMng.create(interface, operation, true); // embedded
+ }
+ else
+ {
+ QString serviceName("com.nokia.services.phonebookservices");
+ QString interface("Fetch");
+ QString operation("Dofetch(QString,QString,QString,QString)");
+ mRequest = appMng.create(serviceName, interface, operation, true); // embedded
+ }
+
+ if ( mRequest )
+ {
+ CNT_LOG_ARGS("Created request.")
+ // Result handlers
+ connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&)));
+
+ args << "Single-fetching";
+ args << aAction;
+ args << KCntFilterDisplayAll;
+ if ( !aNewInterface )
+ {
+ // Only the old interface takes this useless argument.
+ args << KCntSingleSelectionMode;
+ }
+
+ mRequest->setArguments(args);
+ mRequest->send();
+ }
+ else
+ {
+ CNT_LOG_ARGS("Failed to create request.")
+ }
+ CNT_EXIT
+}
+
+void testPbkServices::launchEditCreateNew( bool aNewInterface, QString aDetailType, QString aFieldContent )
+{
+ CNT_ENTRY
+ delete mRequest;
+ mRequest=0;
+
+ QVariantList args;
+ XQApplicationManager appMng;
+ QString operation("editCreateNew(QString,QString)");
+ if ( aNewInterface )
+ {
+ QString interface("com.nokia.symbian.IContactFetch");
+ // service name is not needed
+ mRequest = appMng.create( interface, operation, true); // embedded
+ }
+ else
+ {
+ QString interface("Fetch");
+ QString serviceName("com.nokia.services.phonebookservices");
+ mRequest = appMng.create(serviceName, interface, operation, true); // embedded
+ }
+
+ if ( mRequest )
+ {
+ CNT_LOG_ARGS("Created request.")
+
+ // Result handlers
+ connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
+
+ args << aDetailType;
+ args << aFieldContent;
+
+ mRequest->setArguments(args);
+ mRequest->send();
+ CNT_LOG_ARGS("Sent request.")
+ }
+ else
+ {
+ CNT_LOG_ARGS("Failed to create request.")
+ }
+ CNT_EXIT
}
+void testPbkServices::launchEditorVCard( bool aNewInterface )
+{
+ CNT_ENTRY
+ delete mRequest;
+ mRequest=0;
+
+ QVariantList args;
+ XQApplicationManager appMng;
+ if ( aNewInterface )
+ {
+ QString interface("com.nokia.symbian.IContactEdit");
+ QString operation("editCreateNewFromVCard(QString)");
+ // service name is not needed
+ mRequest = appMng.create( interface, operation, true); // embedded
+ }
+ else
+ {
+ QString interface("Fetch");
+ QString operation("editCreateNew(QString)");
+ QString serviceName("com.nokia.services.phonebookservices");
+ mRequest = appMng.create(serviceName, interface, operation, true); // embedded
+ }
+
+ if ( mRequest )
+ {
+ CNT_LOG_ARGS("Created request.")
+
+ // Result handlers
+ connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
+
+ args << "C:\\data\\Others\\testvcard.vcf";
+
+ mRequest->setArguments(args);
+ mRequest->send();
+ CNT_LOG_ARGS("Sent request.")
+ }
+ else
+ {
+ CNT_LOG_ARGS("Failed to create request.")
+ }
+ CNT_EXIT
+}
+
+void testPbkServices::launchEditUpdateExisting( bool aNewInterface, QString aDetailType, QString aDetailValue )
+{
+ CNT_ENTRY
+ delete mRequest;
+ mRequest=0;
+
+ QVariantList args;
+ XQApplicationManager appMng;
+ QString operation("editUpdateExisting(QString,QString)");
+ if ( aNewInterface )
+ {
+ QString interface("com.nokia.symbian.IContactEdit");
+ // service name is not needed
+ mRequest = appMng.create(interface, operation, true); // embedded
+ }
+ else
+ {
+ QString interface("Fetch");
+ QString serviceName("com.nokia.services.phonebookservices");
+ mRequest = appMng.create(serviceName, interface, operation, true); // embedded
+ }
+ if ( mRequest )
+ {
+ CNT_LOG_ARGS("Created request.")
+
+ // Result handlers
+ connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onEditCompleted(const QVariant&)));
+
+ args << aDetailType;
+ args << aDetailValue;
+
+ mRequest->setArguments(args);
+ mRequest->send();
+ CNT_LOG_ARGS("Sent request.")
+ }
+ else
+ {
+ CNT_LOG_ARGS("Failed to create request.")
+ }
+ CNT_EXIT
+}
+
+void testPbkServices::launchContactCard( bool aNewInterface )
+{
+ CNT_ENTRY
+ delete mRequest;
+ mRequest=0;
+
+ // save test contact
+ QContact contact;
+ QContactName name;
+ QContactPhoneNumber number;
+ QContactManager mgr("symbian");
+
+ name.setFirstName("Test launchContactCard");
+ number.setNumber("0202221111");
+ contact.saveDetail(&name);
+ contact.saveDetail(&number);
+ mgr.saveContact(&contact);
+
+ // get contact id
+ int id = contact.id().localId();
+
+ QVariantList args;
+ XQApplicationManager appMng;
+ if ( aNewInterface )
+ {
+ QString interface("com.nokia.symbian.IContactView");
+ QString operation("openContactCard(int)");
+ // interface name is not needed
+ mRequest = appMng.create( interface, operation, true); // embedded
+ }
+ else
+ {
+ QString interface("Fetch");
+ QString operation("open(int)");
+ QString serviceName("com.nokia.services.phonebookservices");
+ mRequest = appMng.create(serviceName, interface, operation, true); // embedded
+ }
+ if ( mRequest )
+ {
+ CNT_LOG_ARGS("Request created.")
+ // Result handlers
+ connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&)));
+
+ args << id;
+
+ mRequest->setArguments(args);
+ mRequest->send();
+ CNT_LOG_ARGS("Request sent.")
+ }
+ else
+ {
+ CNT_LOG_ARGS("Failed to create request")
+ }
+ CNT_EXIT
+}
+
+void testPbkServices::launchContactCard( bool aNewInterface, QString aDetailType, QString aDetailValue )
+{
+ CNT_ENTRY
+ delete mRequest;
+ mRequest=0;
+
+ QVariantList args;
+ XQApplicationManager appMng;
+ if ( aNewInterface )
+ {
+ QString interface("com.nokia.symbian.IContactView");
+ QString operation("openContactCard(QString,QString)");
+ // service name is not needed
+ mRequest = appMng.create(interface, operation, true); // embedded
+ }
+ else
+ {
+ QString interface("Fetch");
+ QString operation("open(QString,QString)");
+ QString serviceName("com.nokia.services.phonebookservices");
+ mRequest = appMng.create(serviceName, interface, operation, true); // embedded
+ }
+ if ( mRequest )
+ {
+ CNT_LOG_ARGS("Request created.")
+ // Result handlers
+ connect (mRequest, SIGNAL(requestOk(const QVariant&)), this, SLOT(onRequestCompleted(const QVariant&)));
+
+ args << aDetailType;
+ args << aDetailValue;
+
+ mRequest->setArguments(args);
+ mRequest->send();
+ }
+ else
+ {
+ CNT_LOG_ARGS("Failed to create request")
+ }
+ CNT_EXIT
+}
Q_IMPLEMENT_USER_METATYPE(CntServicesContact)
Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList)