# HG changeset patch # User hgs # Date 1279700509 -10800 # Node ID 77bc263e1626c4eb640ae1120a790c60499ec72b # Parent 74b30151afd65489b7b5107f9c821b267c468c22 201027 diff -r 74b30151afd6 -r 77bc263e1626 contacts_plat/contacts_services_api/inc/cntservicescontact.h --- a/contacts_plat/contacts_services_api/inc/cntservicescontact.h Wed Jul 21 11:09:07 2010 +0300 +++ b/contacts_plat/contacts_services_api/inc/cntservicescontact.h Wed Jul 21 11:21:49 2010 +0300 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: Data container & constants for "phonebookservices" Qt Highway services. * */ @@ -22,21 +22,27 @@ #include #include -/*Supported actions*/ +//Action filter definitions: + +/// Action filter that DOES NOT filter away based on supported action. const QString KCntActionAll("all"); +/// Action filter for showing only contacts that support calling. const QString KCntActionCall("call"); +/// Action filter for showing only contacts that suppport SMS sending. const QString KCntActionSms("sms"); +// Action filter for showing only contacts that support emailing. const QString KCntActionEmail("email"); -/*Supported filters*/ -const QString KCntFilterDisplayAll("all"); -const QString KCntFilterDisplayFavorites("favorites"); -/*Supported Fetch Selection Modes*/ -const QString KCntNoSelectionMode("No Selection"); -const QString KCntSingleSelectionMode("SingleSelect"); -const QString KCntMultiSelectionMode("MultiSelect"); +/// Return values from editing service +const int KCntServicesReturnValueContactSaved = 1; +const int KCntServicesReturnValueContactDeleted = -1; +const int KCntServicesReturnValueContactNotModified = 0; + +/** + * A data container class to be used with "phonebookservices" Qt Highway services. + */ class CntServicesContact { public: @@ -70,6 +76,23 @@ typedef QList CntServicesContactList; +//------------------------------------------------------------------- +// These are DEPRECATED and will be removed soon: + +/// @deprecated +const QString KCntFilterDisplayAll("all"); +/// @deprecated +const QString KCntFilterDisplayFavorites("favorites"); + +/// @deprecated +const QString KCntNoSelectionMode("No Selection"); +/// @deprecated +const QString KCntSingleSelectionMode("SingleSelect"); +/// @deprecated +const QString KCntMultiSelectionMode("MultiSelect"); + +//------------------------------------------------------------------- + Q_DECLARE_USER_METATYPE(CntServicesContact) Q_DECLARE_USER_METATYPE_NO_OPERATORS(CntServicesContactList) diff -r 74b30151afd6 -r 77bc263e1626 contacts_plat/contacts_ui_api/inc/cntviewparams.h --- a/contacts_plat/contacts_ui_api/inc/cntviewparams.h Wed Jul 21 11:09:07 2010 +0300 +++ b/contacts_plat/contacts_ui_api/inc/cntviewparams.h Wed Jul 21 11:21:49 2010 +0300 @@ -38,6 +38,7 @@ ESelectedDetail, ESelectionMode, EMyCard, + EFinder, ECustomParam = 100 }; diff -r 74b30151afd6 -r 77bc263e1626 contacts_plat/contacts_ui_extensions_api/inc/cntuigroupsupplier.h --- a/contacts_plat/contacts_ui_extensions_api/inc/cntuigroupsupplier.h Wed Jul 21 11:09:07 2010 +0300 +++ b/contacts_plat/contacts_ui_extensions_api/inc/cntuigroupsupplier.h Wed Jul 21 11:21:49 2010 +0300 @@ -24,9 +24,18 @@ /** * UI extension class that supplies groups to phonebook groups UI. */ -class CntUiGroupSupplier +class CntUiGroupSupplier : public QObject { - public: +public: + CntUiGroupSupplier() {} + + /** + * Returns true if this supplier should be handled asynchronously and + * false otherwise. + * + * @return bool, asynchronity + */ + virtual bool isAsynch() const = 0; /** * Returns number of groups provided by the extension. @@ -49,6 +58,14 @@ { return NULL; } + +signals: + /** + * Asynchronous suppliers should re-implement this signal and emit it + * once group loading is ready. + */ + void groupsReady(); + protected: // prevent deleting by client virtual ~CntUiGroupSupplier() {} diff -r 74b30151afd6 -r 77bc263e1626 contacts_plat/qt_mobility_contacts_api/qt_mobility_contacts_api.metaxml --- a/contacts_plat/qt_mobility_contacts_api/qt_mobility_contacts_api.metaxml Wed Jul 21 11:09:07 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ - - - Qt Mobility Contacts API - Qt Mobility Contacts API for managing contacts data. - c++ - phonebookengines - - - - - - no - no - - diff -r 74b30151afd6 -r 77bc263e1626 inc/cntdebug.h --- a/inc/cntdebug.h Wed Jul 21 11:09:07 2010 +0300 +++ b/inc/cntdebug.h Wed Jul 21 11:21:49 2010 +0300 @@ -23,6 +23,7 @@ #include // qDebug() // #define TRACK_MEMORY_LEAKS +// #define CNT_TRACE2FILE /*! \def CNT_UNUSED(name) @@ -349,8 +350,7 @@ by the streaming operator <<. */ - -#ifdef _DEBUG +#if defined (_DEBUG) || defined (CNT_TRACE2FILE) #define CNT_UNUSED(name) #define CNT_STATIC_ENTRY qDebug() << __PRETTY_FUNCTION__ << "entry"; #define CNT_STATIC_ENTRY_ARGS(args) qDebug() << __PRETTY_FUNCTION__ << "entry," << args; @@ -360,6 +360,9 @@ #define CNT_EXIT_ARGS(args) qDebug() << __PRETTY_FUNCTION__ << "exit," << args; #define CNT_LOG qDebug() << __PRETTY_FUNCTION__ << "this" << (void *)this; #define CNT_LOG_ARGS(args) qDebug() << __PRETTY_FUNCTION__ << args; + #define CNT_WARNING(args) qWarning() << __PRETTY_FUNCTION__ << args; + #define CNT_CRITICAL(args) qCritical() << __PRETTY_FUNCTION__ << args; + #define CNT_FATAL(args) qFatal() << __PRETTY_FUNCTION__ << args; #else #define CNT_UNUSED(name) Q_UNUSED(name) #define CNT_STATIC_ENTRY @@ -370,8 +373,11 @@ #define CNT_EXIT_ARGS(args) #define CNT_LOG #define CNT_LOG_ARGS(args) -#endif // _DEBUG - + #define CNT_WARNING(args) + #define CNT_CRITICAL(args) + #define CNT_FATAL(args) +#endif // _DEBUG || CNT_TRACE2FILE + // for tracing memory leaks #ifdef TRACK_MEMORY_LEAKS #include @@ -406,4 +412,68 @@ #define CNT_TRACK_QOBJECTLIVES(obj) #endif +// filter phonebook app traces +#ifdef CNT_TRACE2FILE + #include + #include + static void cntCustomLog2File(QtMsgType type, const char *msg) + { + QFile logFile("c:/cnt_logs.log"); + if (!logFile.open(QIODevice::Append | QIODevice::Text)) + { + qFatal("error opening c:/cnt_logs.log file"); + return; + } + + QTextStream out(&logFile); + switch (type) + { + case QtDebugMsg: + out << "[CNT] Debug: " << msg; + break; + case QtWarningMsg: + out << "[CNT] Warning: " << msg; + break; + case QtCriticalMsg: + out << "[CNT] Critical: " << msg; + break; + case QtFatalMsg: + out << "[CNT] Fatal: " << msg; + abort(); + break; + default: + out << "[CNT] No Log Selection Type: " << msg; + break; + } + } + #define MSG_HANDLER cntCustomLog2File +#else + #ifdef Q_OS_SYMBIAN + #include + static void cntCustomLog(QtMsgType type, const char *msg) + { + switch (type) { + case QtDebugMsg: + RDebug::Printf("[CNT] Debug: %s\n", msg); + break; + case QtWarningMsg: + RDebug::Printf("[CNT] Warning: %s\n", msg); + break; + case QtCriticalMsg: + RDebug::Printf("[CNT] Critical: %s\n", msg); + break; + case QtFatalMsg: + RDebug::Printf("[CNT] Fatal: %s\n", msg); + abort(); + break; + default: + break; + } + } + #define MSG_HANDLER cntCustomLog + #else + #define MSG_HANDLER 0 + #endif // Q_OS_SYMBIAN +#endif // CNT_TRACE2FILE + #endif // CNTDEBUG_H diff -r 74b30151afd6 -r 77bc263e1626 phonebookengines/cntactions/inc/cntaction.h --- a/phonebookengines/cntactions/inc/cntaction.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookengines/cntactions/inc/cntaction.h Wed Jul 21 11:21:49 2010 +0300 @@ -79,6 +79,7 @@ QVariantMap m_result; //result returned to client QContact m_contact; //contact passed to invokeAction QContactDetail m_detail; //detail passed to invokeAction + QVariantMap m_data; //data passed to invokeAction QContactAction::State m_state; XQAiwRequest* m_request; XQApplicationManager m_AppManager; diff -r 74b30151afd6 -r 77bc263e1626 phonebookengines/cntactions/inc/cntemailaction.h --- a/phonebookengines/cntactions/inc/cntemailaction.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookengines/cntactions/inc/cntemailaction.h Wed Jul 21 11:21:49 2010 +0300 @@ -35,8 +35,6 @@ QList supportedDetails(const QContact& contact) const; CntEmailAction* clone() const; void performAction(); -private: - XQAiwRequest *mRequest; }; #endif diff -r 74b30151afd6 -r 77bc263e1626 phonebookengines/cntactions/src/cntaction.cpp --- a/phonebookengines/cntactions/src/cntaction.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookengines/cntactions/src/cntaction.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -116,10 +116,11 @@ } -bool CntAction::invokeAction(const QContact& contact, const QContactDetail& detail, const QVariantMap& /*parameters*/) +bool CntAction::invokeAction(const QContact& contact, const QContactDetail& detail, const QVariantMap& data) { m_contact = contact; m_detail = detail; + m_data = data; QTimer::singleShot(1, this, SLOT(performAction())); m_state = QContactAction::ActiveState; @@ -159,28 +160,38 @@ //common code to perform a call, videocall and message action void CntAction::performNumberAction(const QString &interface, const QString &operation) { - XQApplicationManager appMng; QVariantList args; QVariant retValue; // TODO: Using XQApplicationManager is not working with calls // The factory method cannot create a request. Find out why - bool isCallAction = m_actionName == "call"; + bool isCallAction = (m_actionName == "call" || m_actionName == "videocall"); XQServiceRequest snd(interface, operation, false); delete m_request; m_request = NULL; - m_request = appMng.create(interface, operation, false); // not embedded + m_request = m_AppManager.create(interface, operation, false); // not embedded + if (!isCallAction) { if (!m_request) { emitResult(GeneralError, retValue); return; } } - + + //QContactType == TypeGroup + if (QContactType::TypeGroup == m_contact.type()) { + QContactPhoneNumber conferenceCall = m_contact.detail(); + args << conferenceCall.number() << m_contact.localId() << m_contact.displayLabel(); + + // TODO remove once call action works + snd << conferenceCall.number() << m_contact.localId() << m_contact.displayLabel(); + snd.send(retValue); + emitResult(snd.latestError(), retValue); + } + //QContactType == TypeContact //detail exist use it - if (m_detail.definitionName() == QContactPhoneNumber::DefinitionName) - { + else if (m_detail.definitionName() == QContactPhoneNumber::DefinitionName) { const QContactPhoneNumber &phoneNumber = static_cast(m_detail); args << phoneNumber.number() << m_contact.localId() << m_contact.displayLabel(); @@ -188,29 +199,29 @@ // TODO remove once call action works if (isCallAction) { snd << phoneNumber.number() << m_contact.localId() << m_contact.displayLabel(); - emitResult(snd.send(retValue), retValue); - } else { + snd.send(retValue); + emitResult(snd.latestError(), retValue); + } + else { m_request->setArguments(args); - m_request->setSynchronous(true); - emitResult(m_request->send(retValue), retValue); + m_request->send(retValue); + emitResult(m_request->lastError(), retValue); } } - - //if no detail, pick preferred - else if(m_detail.isEmpty()) + //QContactType == TypeContact + //if no detail, pick preferred + else if (m_detail.isEmpty()) { QContactDetail detail = m_contact.preferredDetail(m_actionName); QContactPhoneNumber phoneNumber; //if preferred is empty pick first phonenumber - if(detail.isEmpty()) - { + if (detail.isEmpty()) { phoneNumber = m_contact.detail(); } //if not empty, cast detail to phonenumber - else - { + else { phoneNumber = static_cast(detail); } @@ -219,17 +230,17 @@ // TODO remove once call action works if (isCallAction) { snd << phoneNumber.number() << m_contact.localId() << m_contact.displayLabel(); - emitResult(snd.send(retValue), retValue); - } else { + snd.send(retValue); + emitResult(snd.latestError(), retValue); + } + else { m_request->setArguments(args); - m_request->setSynchronous(true); - emitResult(m_request->send(retValue), retValue); + m_request->send(retValue); + emitResult(m_request->lastError(), retValue); } } - //else return an error - else - { + else { emitResult(GeneralError, retValue); } } @@ -244,11 +255,11 @@ m_result.insert("XQAiwRequest Error", m_request->lastError()); } - if (errorCode == 0){ + if (errorCode == 0) { m_state = QContactAction::FinishedState; } - else{ + else { m_state = QContactAction::FinishedWithErrorState; } diff -r 74b30151afd6 -r 77bc263e1626 phonebookengines/cntactions/src/cntemailaction.cpp --- a/phonebookengines/cntactions/src/cntemailaction.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookengines/cntactions/src/cntemailaction.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -29,12 +29,10 @@ CntEmailAction::CntEmailAction() : CntAction("email") { - mRequest = m_AppManager.create(XQI_EMAIL_MESSAGE_SEND, "send(QVariant)", true); } CntEmailAction::~CntEmailAction() { - delete mRequest; } QContactFilter CntEmailAction::contactFilter(const QVariant& value) const @@ -65,61 +63,81 @@ void CntEmailAction::performAction() { QVariant retValue; - - if (mRequest) - { + delete m_request; + m_request = NULL; + m_request = m_AppManager.create(XQI_EMAIL_MESSAGE_SEND, "send(QVariant)", true); + + if (m_request) { QMap map; QStringList recipients; QList data; + //QContactType == TypeGroup + if (QContactType::TypeGroup == m_contact.type()) { + QStringList emails; + QVariant value = m_data.value("email"); + if (value.canConvert()) { + emails = value.toStringList(); + } + + if (!emails.isEmpty()) { + for (int i=0;isetArguments(data); + m_request->send(retValue); + emitResult(m_request->lastError(), retValue); + } + else { + emitResult(GeneralError, retValue); + } + } + //QContactType == TypeContact // If detail exists use it. - if (m_detail.definitionName() == QContactEmailAddress::DefinitionName) - { + else if (m_detail.definitionName() == QContactEmailAddress::DefinitionName) { const QContactEmailAddress &email = static_cast(m_detail); recipients.append(email.emailAddress()); map.insert(EMAIL_SEND_TO_KEY, recipients); data.append(map); - mRequest->setArguments(data); - mRequest->send(retValue); - emitResult(mRequest->lastError(), retValue); + m_request->setArguments(data); + m_request->send(retValue); + emitResult(m_request->lastError(), retValue); } // If no detail, pick preferred. // Todo : Temporary fix. Remove setting preferred when selection popup feature available. - else if (m_detail.isEmpty()) - { + else if (m_detail.isEmpty()) { QContactDetail detail = m_contact.preferredDetail(m_actionName); QContactEmailAddress email; // If preferred is empty pick first email. - if(detail.isEmpty()) - { + if (detail.isEmpty()) { email = m_contact.detail(); } - else - { + else { email = static_cast(detail); } recipients.append(email.emailAddress()); map.insert(EMAIL_SEND_TO_KEY, recipients); - data.append(map); + data.append(map); - mRequest->setArguments(data); - mRequest->send(retValue); - emitResult(mRequest->lastError(), retValue); + m_request->setArguments(data); + m_request->send(retValue); + emitResult(m_request->lastError(), retValue); } - else - { + else { emitResult(GeneralError, retValue); } } // Service not found. - else - { + else { emitResult(GeneralError, retValue); } } diff -r 74b30151afd6 -r 77bc263e1626 phonebookengines/cntfindplugin/group/cntfindplugin.mmp --- a/phonebookengines/cntfindplugin/group/cntfindplugin.mmp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookengines/cntfindplugin/group/cntfindplugin.mmp Wed Jul 21 11:21:49 2010 +0300 @@ -33,8 +33,6 @@ USERINCLUDE ../group APP_LAYER_SYSTEMINCLUDE -// Symbian uses #include in cntviewfindconfig.h -SYSTEMINCLUDE /epoc32/include/ecom START RESOURCE 101f85f4.rss TARGET cntfindplugin diff -r 74b30151afd6 -r 77bc263e1626 phonebookengines/cntlistmodel/src/cntcache.cpp --- a/phonebookengines/cntlistmodel/src/cntcache.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookengines/cntlistmodel/src/cntcache.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -439,9 +439,9 @@ bool foundContact = false; QContactFetchHint nameOnlyFetchHint; - QStringList details; + /*QStringList details; details << QContactDisplayLabel::DefinitionName; - nameOnlyFetchHint.setDetailDefinitionsHint(details); + nameOnlyFetchHint.setDetailDefinitionsHint(details);*/ nameOnlyFetchHint.setOptimizationHints(QContactFetchHint::NoRelationships); QContact contact = mContactManager->contact(contactId, nameOnlyFetchHint); @@ -648,7 +648,7 @@ { CNT_ENTRY - delete this; + deleteLater(); CNT_EXIT } diff -r 74b30151afd6 -r 77bc263e1626 phonebookengines/cntmaptileservice/tsrc/ut_cntmaptileservice/ut_cntmaptileservice.pro --- a/phonebookengines/cntmaptileservice/tsrc/ut_cntmaptileservice/ut_cntmaptileservice.pro Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookengines/cntmaptileservice/tsrc/ut_cntmaptileservice/ut_cntmaptileservice.pro Wed Jul 21 11:21:49 2010 +0300 @@ -40,7 +40,6 @@ :BLD_INF_RULES.prj_exports += "data/preferredaddressmap.png /epoc32/winscw/c/maptiletest/preferredaddressmap.png" :BLD_INF_RULES.prj_exports += "data/workaddressmap.png /epoc32/winscw/c/maptiletest/workaddressmap.png" :BLD_INF_RULES.prj_exports += "data/homeaddressmap.png /epoc32/winscw/c/maptiletest/homeaddressmap.png" - SYSTEMINCLUDEPATH += \epoc32\include\stdapis } SOURCES += src/testrunner.cpp diff -r 74b30151afd6 -r 77bc263e1626 phonebookengines/cntsortplugin/group/cntsortplugin.mmp --- a/phonebookengines/cntsortplugin/group/cntsortplugin.mmp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookengines/cntsortplugin/group/cntsortplugin.mmp Wed Jul 21 11:21:49 2010 +0300 @@ -34,8 +34,6 @@ USERINCLUDE ../group APP_LAYER_SYSTEMINCLUDE -// Symbian uses #include in cntviewsortplugin.h -SYSTEMINCLUDE /epoc32/include/ecom START RESOURCE 101f85a9.rss TARGET cntsortplugin diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntactionlauncher.h --- a/phonebookui/pbkcommonui/inc/cntactionlauncher.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntactionlauncher.h Wed Jul 21 11:21:49 2010 +0300 @@ -34,6 +34,7 @@ public: bool execute( QContact aContact, QContactDetail aDetail ); + bool execute( QContact aContact, QContactDetail aDetail, QVariantMap aParameters ); bool execute( QContact aContact, QContactDetail aDetail, QContactActionDescriptor aActionDescriptor ); signals: diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntcollectionlistmodel.h --- a/phonebookui/pbkcommonui/inc/cntcollectionlistmodel.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntcollectionlistmodel.h Wed Jul 21 11:21:49 2010 +0300 @@ -46,17 +46,25 @@ CntCollectionListModel(QContactManager *manager, CntExtensionManager &extensionManager, QObject *parent = 0); ~CntCollectionListModel(); -public: // from QAbstractItemModel +public: + // from QAbstractItemModel QVariant data(const QModelIndex& index, int role) const; int rowCount(const QModelIndex& parent = QModelIndex()) const; bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); + bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); public: + // removing and adding groups void removeGroup(int localId); + void addGroup(int localId); + + // extension (plugin) group handling bool isExtensionGroup(const QModelIndex &index); CntViewParameters extensionGroupActivated(int row); void extensionGroupLongPressed(int row, const QPointF& coords, CntExtensionGroupCallback* interface); + QModelIndex indexOfGroup(int localId); + private: void doConstruct(); void initializeStaticGroups(); @@ -69,8 +77,9 @@ bool validateRowIndex(const int index) const; private slots: - void informationUpdated(int row, const QString& secondRowText, int memberCount); + void informationUpdated(int id, const QString& secondRowText, int memberCount); void onIconReady(const QPixmap& pixmap, void *data, int id, int error); + void extensionGroupsReady(); private: QSharedDataPointer d; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntcollectionlistmodelworker.h --- a/phonebookui/pbkcommonui/inc/cntcollectionlistmodelworker.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntcollectionlistmodelworker.h Wed Jul 21 11:21:49 2010 +0300 @@ -33,6 +33,7 @@ class CntCollectionListModelWorker : public QThread { Q_OBJECT + friend class TestCntCollectionListModelWorker; public: CntCollectionListModelWorker(QString unnamed, QString noFavs, QString noMembers, int sortOrder); @@ -41,14 +42,14 @@ void run(); bool event(QEvent *event); - void scheduleJob(int row, int id); + void scheduleJob(int id); private: void processJobs(); - void fetchInformation(int row, int id); + void fetchInformation(int id); signals: - void fetchDone(int row, const QString& secondRowText, int memberCount); + void fetchDone(int id, const QString& secondRowText, int memberCount); private: bool mStarted; @@ -56,7 +57,7 @@ bool mStopped; QMutex mMutex; - QList< QPair > mJobs; + QList mJobs; QContactManager *mManager; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntcollectionview.h --- a/phonebookui/pbkcommonui/inc/cntcollectionview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntcollectionview.h Wed Jul 21 11:21:49 2010 +0300 @@ -58,6 +58,7 @@ private slots: void showPreviousView(); + void showNamesViewWithFinder(); void openGroup(const QModelIndex &index); void showContextMenu(HbAbstractViewItem *item, const QPointF &coords); @@ -70,7 +71,7 @@ void refreshDataModel(); void deleteGroup(QContact group); - void handleDeleteGroup(HbAction* action); + void handleDeleteGroup(int action); void deleteGroups(); void handleDeleteGroups(HbAction* action); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntcontactcardview_p.h --- a/phonebookui/pbkcommonui/inc/cntcontactcardview_p.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntcontactcardview_p.h Wed Jul 21 11:21:49 2010 +0300 @@ -98,7 +98,7 @@ void sendBusinessCard(); void addToGroup(); void deleteContact(); - void handleDeleteContact(HbAction *action); + void handleDeleteContact(int action); void setAsFavorite(); void removeFromFavorite(); void actionExecuted(CntActionLauncher* aAction); @@ -123,7 +123,9 @@ void setMaptileLabel( HbLabel*& mapLabel, const HbIcon& icon ); void updateMaptileImage(); HbLabel* loadMaptileLabel( int addressType ); - + + // Presence related function + void updateItemPresence(const QString& accountUri, bool online); public: CntContactCardView* q_ptr; @@ -166,6 +168,8 @@ QContactAvatar *mAvatar; bool mIsHandlingMenu; QMap mPreferredItems; + /// maps a QContactOnlineAccount (for example "sip:sip@sip.com") to a detail item + QMap mPresenceItems; int mFavoriteGroupId; CntDocumentLoader *mLoader; QContactAction *mContactAction; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntdetaileditor.h --- a/phonebookui/pbkcommonui/inc/cntdetaileditor.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntdetaileditor.h Wed Jul 21 11:21:49 2010 +0300 @@ -31,6 +31,7 @@ class HbView; class HbAction; class CntEditorFactory; +class CntSaveManager; class CntDetailEditor : public QObject, public CntAbstractView @@ -47,6 +48,8 @@ void insertField(); void handleItemShown(const QModelIndex& aIndex ); + void saveContact(); + public: void setViewId( int aId ); void setHeader( QString aHeader ); @@ -79,6 +82,7 @@ HbAction *mSoftkey; HbAction *mCancel; CntViewParameters mArgs; + CntSaveManager *mSaveManager; // own friend class TestCntDetailEditor; }; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cnteditview_p.h --- a/phonebookui/pbkcommonui/inc/cnteditview_p.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cnteditview_p.h Wed Jul 21 11:21:49 2010 +0300 @@ -43,6 +43,7 @@ class QAction; class HbMenu; class XQAiwRequest; +class CntSaveManager; QTM_BEGIN_NAMESPACE class QContact; @@ -76,7 +77,7 @@ void addDetailItem(); void handleAddDetailItem(HbAction *aAction); void deleteContact(); - void handleDeleteContact(HbAction *action); + void handleDeleteContact(int action); void discardChanges(); void saveChanges(); @@ -89,7 +90,6 @@ void ringToneFetchHandleError(int errorCode, const QString& errorMessage); void ringToneFetchHandleOk(const QVariant &result); - private: void loadAvatar(); HbMenu* createPopup( const QModelIndex aIndex, CntEditViewItem* aDetail ); @@ -97,7 +97,6 @@ void editDetail( CntEditViewItem* aDetail ); void removeDetail( CntEditViewItem* aDetail, const QModelIndex& aIndex ); void setSelectedContact( QContact aContact ); - void setPreferredDetails( QContact* aContact ); void fetchTone(); void changeEditorView(); @@ -128,6 +127,7 @@ XQAiwRequest* mReq; XQApplicationManager mAppMgr; HbMenu *mMenu; + CntSaveManager* mSaveManager; // own }; #endif /* CNTEDITVIEW_P_H_ */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cnteditviewheadingitem.h --- a/phonebookui/pbkcommonui/inc/cnteditviewheadingitem.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cnteditviewheadingitem.h Wed Jul 21 11:21:49 2010 +0300 @@ -76,6 +76,7 @@ HbTextItem *mLabel; HbTextItem *mSecondLabel; HbFrameItem *mFrameItem; + HbFrameItem *mFocusItem; HbTouchArea *mIconTouchArea; bool mIconFocused; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntgroupactionsview.h --- a/phonebookui/pbkcommonui/inc/cntgroupactionsview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntgroupactionsview.h Wed Jul 21 11:21:49 2010 +0300 @@ -30,6 +30,7 @@ class HbAbstractViewItem; class QModelIndex; class QStandardItemModel; +class CntActionLauncher; QTM_BEGIN_NAMESPACE @@ -61,13 +62,17 @@ void showPreviousView(); void editGroup(); + void listItemSelected(const QModelIndex &index); + void executeAction(QContact&, QContactDetail, QString); + void actionExecuted(CntActionLauncher* aAction); + void actionCancelled(); #ifdef PBK_UNIT_TEST public: #else private: #endif - void populatelist(QString label,HbIcon icon, QString secondaryText); + void populatelist(QString label,HbIcon icon, QString secondaryText, QString action); #ifdef PBK_UNIT_TEST public: @@ -84,7 +89,8 @@ HbAction* mSoftkey; // owned by view HbListView* mListView; // owned by layout - + int mPopupCount; + QStringList mActionParams; }; #endif // CNTGROUPACTIONSVIEW_H diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntgroupmemberview.h --- a/phonebookui/pbkcommonui/inc/cntgroupmemberview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntgroupmemberview.h Wed Jul 21 11:21:49 2010 +0300 @@ -70,7 +70,7 @@ void handleManageMembers(); void editGroup(); void deleteGroup(); - void handleDeleteGroup(HbAction *action); + void handleDeleteGroup(int action); void showContextMenu(HbAbstractViewItem *item, const QPointF &coords); void handleMenu(HbAction* action); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cnthistoryview.h --- a/phonebookui/pbkcommonui/inc/cnthistoryview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cnthistoryview.h Wed Jul 21 11:21:49 2010 +0300 @@ -51,7 +51,7 @@ public slots: void updateScrollingPosition(); void clearHistory(); - void handleClearHistory(HbAction *action); + void handleClearHistory(int action); void itemActivated(const QModelIndex &index); void showPreviousView(); void showClearHistoryMenu(); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cnthistoryviewitem.h --- a/phonebookui/pbkcommonui/inc/cnthistoryviewitem.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cnthistoryviewitem.h Wed Jul 21 11:21:49 2010 +0300 @@ -50,6 +50,7 @@ * Overriden method to draw the custom item in the list view */ void updateChildItems(); + bool event(QEvent* e); bool getIncoming() const { return mIncoming; } bool isNewMessage() const { return mNewMessage; } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntimageeditorview.h --- a/phonebookui/pbkcommonui/inc/cntimageeditorview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntimageeditorview.h Wed Jul 21 11:21:49 2010 +0300 @@ -31,6 +31,7 @@ class HbAction; class QStandardItemModel; class QModelIndex; +class CntSaveManager; QTM_BEGIN_NAMESPACE class QContact; @@ -75,6 +76,7 @@ void setOrientation(Qt::Orientation orientation); void listViewActivated(const QModelIndex &index); void handleError(int errorCode, const QString& errorMessage); + void saveContact(); #ifdef PBK_UNIT_TEST @@ -95,6 +97,7 @@ HbDocumentLoader mDocumentLoader; HbListView *mListView; // owned by layout QStandardItemModel *mModel; // own + CntSaveManager *mSaveManager; // own CntViewParameters mArgs; }; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntnamesview_p.h --- a/phonebookui/pbkcommonui/inc/cntnamesview_p.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntnamesview_p.h Wed Jul 21 11:21:49 2010 +0300 @@ -70,9 +70,9 @@ void showContextMenu(HbAbstractViewItem* aItem, QPointF aPoint); void showSettings(); - void executeAction( QContact& aContact, QContactDetail aDetail, QString aAction ); + void executeAction( QContact& aContact, QContactDetail aDetail, QString aAction ); void actionExecuted( CntActionLauncher* aAction ); - void handleDeleteContact( HbAction* aAction ); + void handleDeleteContact( int aAction ); void importSim(); void handleContactAddition(const QList & aAddedList); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntpresencelistener.h --- a/phonebookui/pbkcommonui/inc/cntpresencelistener.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/inc/cntpresencelistener.h Wed Jul 21 11:21:49 2010 +0300 @@ -31,6 +31,11 @@ QTM_USE_NAMESPACE +/** + Presence listener for contact card. It provides aggregated + presence information for a contact and separately for each + valid QContactOnlineAccount. +*/ class CntPresenceListener : public QObject { friend class TestCntPresenceListener; @@ -50,7 +55,9 @@ bool parsePresence(QList buddyList); signals: - void accountPresenceUpdated(QString accountUri, bool online); + /// account-specific presence status + void accountPresenceUpdated(const QString& accountUri, bool online); + /// aggregated presence status for this contact void fullPresenceUpdated(bool online); private: diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/inc/cntsavemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/pbkcommonui/inc/cntsavemanager.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CNTSAVEMANAGER_H +#define CNTSAVEMANAGER_H + +#include +#include + +QTM_BEGIN_NAMESPACE +class QContact; +class QContactAvatar; +QTM_END_NAMESPACE + +QTM_USE_NAMESPACE + +/*! + Contact saving helper class. Used mainly in edit view for contact saving, + but should also be used in other (special) cases a contact needs to be saved. + For example "forcing" phonebook to shut down (end key, from task swapper etc..) + in detail editors. +*/ +class CntSaveManager : public QObject +{ + friend class TestCntSaveManager; + Q_OBJECT + +public: + enum CntSaveResult + { + ESaved = 0, + EUpdated, + EDeleted, + EFailed, + ENothingDone + }; + + enum CntContactType + { + EContact = 0, + EMyCard, + EGroup + }; + +public: + CntSaveManager(CntContactType type = EContact, QObject* parent = NULL); + ~CntSaveManager(); + + CntSaveResult saveContact(QContact* aContact, QContactManager* aManager); + +private: + void setPreferredDetails(QContact* aContact); + +private: + CntContactType mContactType; + +}; + +#endif // CNTIMAGEEDITORVIEW_H diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/pbkcommonui.pro --- a/phonebookui/pbkcommonui/pbkcommonui.pro Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/pbkcommonui.pro Wed Jul 21 11:21:49 2010 +0300 @@ -137,8 +137,8 @@ inc/cntcommondetailviewitem.h \ ../../inc/cntdebug.h \ inc/cntactionpopup_p.h \ - inc/cntactionpopup.h - + inc/cntactionpopup.h \ + inc/cntsavemanager.h SOURCES += \ @@ -211,7 +211,8 @@ src/cntsettingsmodel.cpp \ src/cntcommondetailviewitem.cpp \ src/cntactionpopup_p.cpp \ - src/cntactionpopup.cpp + src/cntactionpopup.cpp \ + src/cntsavemanager.cpp RESOURCES += resources\pbkcommonui.qrc diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/resources/contacts_groupmembers.docml --- a/phonebookui/pbkcommonui/resources/contacts_groupmembers.docml Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/resources/contacts_groupmembers.docml Wed Jul 21 11:21:49 2010 +0300 @@ -30,7 +30,7 @@ - + diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/resources/style/cntcontactcardheadingitem.widgetml --- a/phonebookui/pbkcommonui/resources/style/cntcontactcardheadingitem.widgetml Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/resources/style/cntcontactcardheadingitem.widgetml Wed Jul 21 11:21:49 2010 +0300 @@ -5,9 +5,9 @@ - - - + + + @@ -19,14 +19,14 @@ - + - - + + @@ -34,7 +34,7 @@ - + diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/resources/style/cnteditviewheadingitem.css --- a/phonebookui/pbkcommonui/resources/style/cnteditviewheadingitem.css Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/resources/style/cnteditviewheadingitem.css Wed Jul 21 11:21:49 2010 +0300 @@ -46,6 +46,13 @@ bottom:0.0un; } +CntEditViewHeadingItem::highlight{ + left:0.0un; + right:0.0un; + top:0.0un; + bottom:0.0un; +} + CntEditViewHeadingItem::iconArea{ left:0.0un; right:0.0un; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/resources/style/cnteditviewheadingitem.widgetml --- a/phonebookui/pbkcommonui/resources/style/cnteditviewheadingitem.widgetml Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/resources/style/cnteditviewheadingitem.widgetml Wed Jul 21 11:21:49 2010 +0300 @@ -22,6 +22,11 @@ + + + + + @@ -42,6 +47,11 @@ + + + + + @@ -62,6 +72,11 @@ + + + + + @@ -78,6 +93,11 @@ + + + + + @@ -90,6 +110,11 @@ + + + + + @@ -102,6 +127,11 @@ + + + + + diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/resources/style/cnteditviewheadingitem_color.css --- a/phonebookui/pbkcommonui/resources/style/cnteditviewheadingitem_color.css Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/resources/style/cnteditviewheadingitem_color.css Wed Jul 21 11:21:49 2010 +0300 @@ -1,8 +1,16 @@ -CntEditViewHeadingItem::text{ +CntEditViewHeadingItem[state = "normal"]::text{ + color: var(qtc_groupbox_normal); +} + +CntEditViewHeadingItem[state = "normal"]::second_text{ color: var(qtc_groupbox_normal); } -CntEditViewHeadingItem::second_text{ - color: var(qtc_groupbox_normal); +CntEditViewHeadingItem[state = "pressed"]::text{ + color: var(qtc_groupbox_pressed); } +CntEditViewHeadingItem[state = "pressed"]::second_text{ + color: var(qtc_groupbox_pressed); +} + diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/resources/style/cnthistoryviewitem.widgetml --- a/phonebookui/pbkcommonui/resources/style/cnthistoryviewitem.widgetml Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/resources/style/cnthistoryviewitem.widgetml Wed Jul 21 11:21:49 2010 +0300 @@ -11,6 +11,7 @@ + @@ -38,6 +39,7 @@ + diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntactionlauncher.cpp --- a/phonebookui/pbkcommonui/src/cntactionlauncher.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntactionlauncher.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -52,6 +52,28 @@ return executed; } + +bool CntActionLauncher::execute( QContact aContact, QContactDetail aDetail, QVariantMap aParameters ) + { + bool executed = false; + QList all = QContactAction::actionDescriptors(mAction, "symbian"); + mContactAction = QContactAction::action( all.first() ); + if ( mContactAction ) + { + if (aContact.preferredDetail(mAction).isEmpty() && (mAction == "call" || mAction == "message" || mAction == "email")) + { + aContact.setPreferredDetail(mAction, aDetail); + //return value will be ignored because we cannot do anything if it fails. + mContactManager->saveContact(&aContact); + } + + connect(mContactAction, SIGNAL(stateChanged(QContactAction::State)), + this, SLOT(progress(QContactAction::State))); + executed = mContactAction->invokeAction( aContact, aDetail, aParameters ); + } + + return executed; + } /*! Launch dynamic action diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntactionpopup_p.cpp --- a/phonebookui/pbkcommonui/src/cntactionpopup_p.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntactionpopup_p.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -40,6 +40,7 @@ mListView = new HbListView(this); mListModel = new QStandardItemModel(this); setAttribute(Qt::WA_DeleteOnClose, true); + mDataItemList.clear(); } CntActionPopupPrivate::~CntActionPopupPrivate() @@ -169,12 +170,13 @@ { buildEmailActionPopup(); } - else + + if(mDataItemList.count()) { - return false; + showPopup(); + return true; } - showPopup(); - return true; + return false; } @@ -194,6 +196,10 @@ mListView->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Maximum ); QString contactName = mContact->displayLabel(); + if (contactName.isEmpty()) + { + contactName = hbTrId("txt_phob_list_unnamed"); + } HbLabel *label = new HbLabel(); label->setPlainText(contactName); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntcollectionlistmodel.cpp --- a/phonebookui/pbkcommonui/src/cntcollectionlistmodel.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntcollectionlistmodel.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -108,7 +108,7 @@ if (!p->fetched) { - mThread->scheduleJob(row, p->id); + mThread->scheduleJob(p->id); p->fetched = true; } @@ -163,6 +163,32 @@ } /*! + Adds a row to the model. This is called from addGroup(int localId), so no + real logic in here. + + \param row the first row which is added + \param count amount of rows to be added (not supported) + \param parent not used as all items share the same parent + \return success of the operation +*/ +bool CntCollectionListModel::insertRows(int row, int count, const QModelIndex &parent) +{ + Q_UNUSED(count); + Q_UNUSED(parent); + + if ( !validateRowIndex(row) ) + { + return false; + } + + beginInsertRows(parent, row, row); + + endInsertRows(); + + return true; +} + +/*! Remove given group from the model. Ignore plugin groups. \param localId QContactLocalId of the group that should be removed @@ -184,6 +210,87 @@ } /*! + Add a new group to the model. This also takes care of putting it in the + correct row. + + \param localId QContactLocalId of the group that should be added +*/ +void CntCollectionListModel::addGroup(int localId) +{ + CNT_ENTRY + + QContactDetailFilter groupFilter; + groupFilter.setDetailDefinitionName(QContactType::DefinitionName, QContactType::FieldType); + groupFilter.setValue(QString(QLatin1String(QContactType::TypeGroup))); + + QContactSortOrder sortOrderGroupName; + sortOrderGroupName.setDetailDefinitionName(QContactName::DefinitionName, + QContactName::FieldCustomLabel); + sortOrderGroupName.setCaseSensitivity(Qt::CaseInsensitive); + + QList groupsOrder; + groupsOrder.append(sortOrderGroupName); + + QList groupContactIds = d->mContactManager->contactIds(groupFilter, groupsOrder); + + int row = 1; + + for (int i = 0;i < groupContactIds.count();i++) + { + if (groupContactIds.at(i) == localId) + { + row += d->mExtensions.count(); + + CollectionItemPointer item(new CntCollectionItem()); + + QContactFetchHint noRelationshipsFetchHint; + noRelationshipsFetchHint.setOptimizationHints(QContactFetchHint::NoRelationships); + + QContact contact = d->mContactManager->contact(groupContactIds.at(i), noRelationshipsFetchHint); + QContactName contactName = contact.detail(); + QString groupName = contactName.customLabel(); + + if (groupName.isNull()) + { + item->groupName = hbTrId("txt_phob_dblist_unnamed"); + } + else + { + item->groupName = groupName; + } + + item->icon = HbIcon("qtg_large_custom"); + + QList details = contact.details(); + for (int k = 0;k < details.count();k++) + { + if (details.at(k).imageUrl().isValid()) + { + int id = d->mThumbnailManager->getThumbnail(details.at(k).imageUrl().toString()); + d->mIconRequests.insert(id, groupContactIds.at(i)); + break; + } + } + + // contact Id for identification + item->id = groupContactIds.at(i); + item->secondLineText = " "; + item->memberCount = -1; + + d->mList.insert(row, item); + insertRow(row); + break; + } + else if (groupContactIds.at(i) != d->mFavoriteGroupId) + { + row++; + } + } + + CNT_EXIT +} + +/*! Check if list item at given index is coming from an extension plugin or not. \param index the QModelIndex of the list item @@ -247,6 +354,25 @@ } /*! + Get the index for a given group id. + + \param localId the id of the group + \return QModelIndex of the group +*/ +QModelIndex CntCollectionListModel::indexOfGroup(int localId) +{ + for (int i = 0;i < d->mList.count();i++) + { + if (d->mList.at(i)->id == localId && !d->mList.at(i)->isPlugin) + { + return index(i); + } + } + + return QModelIndex(); +} + +/*! Initialize different groups. */ void CntCollectionListModel::doConstruct() @@ -295,24 +421,31 @@ CntUiGroupSupplier* groupSupplier = d->mExtensionManager.pluginAt(i)->groupSupplier(); if (groupSupplier) { - for(int j = 0;j < groupSupplier->groupCount();j++) + if (groupSupplier->isAsynch()) + { + connect(groupSupplier, SIGNAL(groupsReady()), this, SLOT(extensionGroupsReady())); + } + else { - const CntUiExtensionGroup& group = groupSupplier->groupAt(j); - - CollectionItemPointer item(new CntCollectionItem()); - - item->groupName = group.name(); - item->secondLineText = group.extraText(); - item->memberCount = group.memberCount(); - item->icon = HbIcon(group.groupIcon()); - item->secondaryIcon = HbIcon(group.extraIcon()); - - item->id = group.serviceId(); - item->isPlugin = true; - item->fetched = true; - - d->mExtensions.insert(rowCount(), groupSupplier); - d->mList.append(item); + for (int j = 0;j < groupSupplier->groupCount();j++) + { + const CntUiExtensionGroup& group = groupSupplier->groupAt(j); + + CollectionItemPointer item(new CntCollectionItem()); + + item->groupName = group.name(); + item->secondLineText = group.extraText(); + item->memberCount = group.memberCount(); + item->icon = HbIcon(group.groupIcon()); + item->secondaryIcon = HbIcon(group.extraIcon()); + + item->id = group.serviceId(); + item->isPlugin = true; + item->fetched = true; + + d->mExtensions.insert(rowCount(), groupSupplier); + d->mList.append(item); + } } } } @@ -371,7 +504,7 @@ if (details.at(k).imageUrl().isValid()) { int id = d->mThumbnailManager->getThumbnail(details.at(k).imageUrl().toString()); - d->mIconRequests.insert(id, rowCount()); + d->mIconRequests.insert(id, groupContactIds.at(i)); break; } } @@ -450,17 +583,25 @@ \param secondRowText text to be shown in the second row \param memberCount the amount of members the group has (shown in text-3 in HbListViewItem) */ -void CntCollectionListModel::informationUpdated(int row, const QString& secondRowText, int memberCount) +void CntCollectionListModel::informationUpdated(int id, const QString& secondRowText, int memberCount) { CNT_ENTRY - CollectionItemPointer item = d->mList.at(row); - - item->secondLineText = secondRowText; - item->memberCount = memberCount; - - int idx = d->mList.indexOf(item); - emit dataChanged(index(idx, 0), index(idx, 0)); + for (int i = 0;i < d->mList.count();i++) + { + if (d->mList.at(i)->id == id && !d->mList.at(i)->isPlugin) + { + CollectionItemPointer item = d->mList.at(i); + + item->secondLineText = secondRowText; + item->memberCount = memberCount; + + int idx = d->mList.indexOf(item); + emit dataChanged(index(idx, 0), index(idx, 0)); + + break; + } + } CNT_EXIT } @@ -482,15 +623,77 @@ if (error == 0) { - int row = d->mIconRequests.take(id); - - CollectionItemPointer item = d->mList.at(row); + int localId = d->mIconRequests.take(id); - item->icon = HbIcon(pixmap); - - int idx = d->mList.indexOf(item); - emit dataChanged(index(idx, 0), index(idx, 0)); + for (int i = 0;i < d->mList.count();i++) + { + if (d->mList.at(i)->id == localId && !d->mList.at(i)->isPlugin) + { + CollectionItemPointer item = d->mList.at(i); + + item->icon = HbIcon(pixmap); + + int idx = d->mList.indexOf(item); + emit dataChanged(index(idx, 0), index(idx, 0)); + + break; + } + } } CNT_EXIT } + +/*! + Slot to handle asynchronously initiated extension groups. As + these are added right after the static favorites group, this takes + also care of updating the mapping between row and CntUiGroupSuppliers + in case there was already some synchronously loaded extension groups. +*/ +void CntCollectionListModel::extensionGroupsReady() +{ + CntUiGroupSupplier* groupSupplier = static_cast(sender()); + + int addedCount = groupSupplier->groupCount(); + + if (addedCount > 0) + { + QList rowList = d->mExtensions.keys(); + QList supplierList = d->mExtensions.values(); + + d->mExtensions.clear(); + + for (int i = 0;i < rowList.count();i++) + { + int row = rowList.at(i) + addedCount; + CntUiGroupSupplier* supplier = supplierList.at(i); + + d->mExtensions.insert(row, supplier); + } + + + beginInsertRows(QModelIndex(), 1, groupSupplier->groupCount()); + + for (int j = 0;j < groupSupplier->groupCount();j++) + { + const CntUiExtensionGroup& group = groupSupplier->groupAt(j); + + CollectionItemPointer item(new CntCollectionItem()); + + item->groupName = group.name(); + item->secondLineText = group.extraText(); + item->memberCount = group.memberCount(); + item->icon = HbIcon(group.groupIcon()); + item->secondaryIcon = HbIcon(group.extraIcon()); + + item->id = group.serviceId(); + item->isPlugin = true; + item->fetched = true; + + d->mExtensions.insert(1 + j, groupSupplier); + d->mList.insert(1 + j, item); + } + + endInsertRows(); + } +} diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntcollectionlistmodelworker.cpp --- a/phonebookui/pbkcommonui/src/cntcollectionlistmodelworker.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntcollectionlistmodelworker.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -109,12 +109,11 @@ } /*! - Schedule an asynch job for the given row (model) and contact id. + Schedule an asynch job for the given contact id. - \param row the row in the model - \param id the QContactLocalId of the group in the given row + \param id the QContactLocalId of the group */ -void CntCollectionListModelWorker::scheduleJob(int row, int id) +void CntCollectionListModelWorker::scheduleJob(int id) { CNT_ENTRY @@ -134,7 +133,7 @@ HbApplication::instance()->postEvent(this, new QEvent(QEvent::User)); } - mJobs.append(QPair(row, id)); + mJobs.append(id); mMutex.unlock(); @@ -163,12 +162,10 @@ else { // get next job - QPair pair = mJobs.takeFirst(); - int row = pair.first; - int id = pair.second; + int id = mJobs.takeFirst(); mMutex.unlock(); - fetchInformation(row, id); + fetchInformation(id); } HbApplication::processEvents(); @@ -182,10 +179,9 @@ and the amount of contacts in the group. Emits the result as a signal for CntCollectionListModel to handle. - \param row the row in the model \param id the QContactLocalId of the group in the given row */ -void CntCollectionListModelWorker::fetchInformation(int row, int id) +void CntCollectionListModelWorker::fetchInformation(int id) { CNT_ENTRY @@ -238,9 +234,9 @@ for(int i = 0;i < groupMemberIds.count();i++) { QContactFetchHint nameOnlyFetchHint; - QStringList details; + /*QStringList details; details << QContactDisplayLabel::DefinitionName; - nameOnlyFetchHint.setDetailDefinitionsHint(details); + nameOnlyFetchHint.setDetailDefinitionsHint(details);*/ nameOnlyFetchHint.setOptimizationHints(QContactFetchHint::NoRelationships); QContact contact = mManager->contact(groupMemberIds.at(i), nameOnlyFetchHint); @@ -275,7 +271,7 @@ } } - emit fetchDone(row, secondLineText, memberCount); + emit fetchDone(id, secondLineText, memberCount); CNT_EXIT } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntcollectionview.cpp --- a/phonebookui/pbkcommonui/src/cntcollectionview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntcollectionview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -98,7 +98,7 @@ groups->setChecked(true); mFindAction = static_cast(mDocumentLoader.findObject("cnt:find")); - mFindAction->setEnabled(false); + connect(mFindAction, SIGNAL(triggered()), this, SLOT(showNamesViewWithFinder())); mExtensionAction = static_cast (mDocumentLoader.findObject("cnt:activity")); } @@ -159,9 +159,6 @@ mModel = new CntCollectionListModel(getContactManager(), mExtensionManager, this); mListView->setModel(mModel); - mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND )); - connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleNewGroupMembers())); - CNT_EXIT } @@ -188,6 +185,16 @@ } /*! +Go back to previous view +*/ +void CntCollectionView::showNamesViewWithFinder() +{ + CntViewParameters viewParameters; + viewParameters.insert(EFinder, "show"); + mViewManager->back(viewParameters); +} + +/*! Called after user clicked on the listview. */ void CntCollectionView::openGroup(const QModelIndex &index) @@ -257,7 +264,7 @@ else { int id = item->modelIndex().data(Qt::UserRole).toInt(); - QVariant data( item->modelIndex().row() ); + QVariant data( id ); int favoriteGrpId = CntFavourite::favouriteGroupId(mViewManager->contactManager(SYMBIAN_BACKEND)); @@ -280,22 +287,20 @@ void CntCollectionView::handleMenu(HbAction* action) { - int row = action->data().toInt(); HbMenu *menuItem = static_cast(sender()); - QModelIndex index = mModel->index(row, 0); - - int id = index.data(Qt::UserRole).toInt(); if ( action == menuItem->actions().first() ) - { + { + int id = action->data().toInt(); + QModelIndex index = mModel->indexOfGroup(id); openGroup(index); - } + } else if (action == menuItem->actions().at(1)) - { - + { + int id = action->data().toInt(); QContact groupContact = getContactManager()->contact(id); deleteGroup(groupContact); - } + } } @@ -343,7 +348,17 @@ QSet contactsSet = contactsList.toSet(); // Select some contact(s) to add to the group - QString groupNameCreated(mHandledContact->displayLabel()); + QString groupNameCreated = mHandledContact->displayLabel(); + if (groupNameCreated.isEmpty()) + { + groupNameCreated = hbTrId("txt_phob_list_unnamed"); + } + + if (!mFetchView) + { + mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND )); + connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleNewGroupMembers())); + } mFetchView->setDetails(HbParameterLengthLimiter(hbTrId("txt_phob_title_members_of_1_group")).arg(groupNameCreated), hbTrId("txt_common_button_save")); mFetchView->displayContacts(HbAbstractItemView::MultiSelection, contactsSet); @@ -353,8 +368,12 @@ void CntCollectionView::handleNewGroupMembers() { mSelectedContactsSet = mFetchView->getSelectedContacts(); + if ( !mFetchView->wasCanceled() && mSelectedContactsSet.size() ) { saveNewGroup(mHandledContact); + + delete mFetchView; + mFetchView = NULL; CntViewParameters viewParameters; viewParameters.insert(EViewId, groupMemberView); @@ -363,14 +382,23 @@ viewParameters.insert(ESelectedGroupContact, var); mViewManager->changeView(viewParameters); } + else + { + // Add the new group + mModel->addGroup(mHandledContact->localId()); + mDeleteGroupsAction->setEnabled(true); + + delete mFetchView; + mFetchView = NULL; + } - QString groupNameCreated(mHandledContact->displayLabel()); + QString groupNameCreated = mHandledContact->displayLabel(); + if (groupNameCreated.isEmpty()) + { + groupNameCreated = hbTrId("txt_phob_list_unnamed"); + } HbNotificationDialog::launchDialog(HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_new_group_1_created")).arg(groupNameCreated)); - // Refresh the page - refreshDataModel(); - mDeleteGroupsAction->setEnabled(true); - delete mHandledContact; mHandledContact = NULL; } @@ -388,20 +416,22 @@ { mHandledContact = new QContact(group); QString name = mHandledContact->displayLabel(); + if (name.isEmpty()) + { + name = hbTrId("txt_phob_list_unnamed"); + } HbLabel *headingLabel = new HbLabel(); headingLabel->setPlainText(HbParameterLengthLimiter(hbTrId("txt_phob_dialog_delete_1_group")).arg(name)); HbMessageBox::question(hbTrId("txt_phob_dialog_only_group_will_be_removed_contac") - , this, SLOT(handleDeleteGroup(HbAction*)), - hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel"), headingLabel); + , this, SLOT(handleDeleteGroup(int)), HbMessageBox::Delete | HbMessageBox::Cancel, + headingLabel); } -void CntCollectionView::handleDeleteGroup(HbAction* action) +void CntCollectionView::handleDeleteGroup(int action) { - HbMessageBox *note = static_cast(sender()); - - if (note && action == note->actions().first()) + if (action == HbMessageBox::Delete) { getContactManager()->removeContact(mHandledContact->localId()); mModel->removeGroup(mHandledContact->localId()); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntcontactcardheadingitem.cpp --- a/phonebookui/pbkcommonui/src/cntcontactcardheadingitem.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntcontactcardheadingitem.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -16,6 +16,7 @@ */ #include "cntcontactcardheadingitem.h" +#include "cntdebug.h" #include #include @@ -30,6 +31,8 @@ #include #include #include +#include +#include #include #include #include @@ -48,6 +51,7 @@ mIsFavorite(false), mIsOnline(false) { + HbEffect::add("icon", "groupbox_icon_click", "iconclick"); } CntContactCardHeadingItem::~CntContactCardHeadingItem() @@ -198,7 +202,7 @@ if (!mFrameItem) { mFrameItem = new HbFrameItem(this); - mFrameItem->frameDrawer().setFrameGraphicsName("qtg_fr_groupbox"); + mFrameItem->frameDrawer().setFrameGraphicsName("qtg_fr_groupbox_normal"); mFrameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); mFrameItem->setZValue(-2); style()->setItemName(mFrameItem, "background"); @@ -214,6 +218,10 @@ { initGesture(); } + else + { + ungrabGesture(Qt::TapGesture); + } } void CntContactCardHeadingItem::setIcon(const HbIcon newIcon) @@ -354,16 +362,18 @@ int setting = settingsMng.readItemValue(nameOrderKey, XQSettingsManager::TypeInt).toInt(); QStringList nameList; - QString last; + QString last_first; switch( setting ) { case CntOrderLastFirst: nameList << name.prefix() << name.lastName() << name.firstName() << name.middleName() << name.suffix(); break; case CntOrderLastCommaFirst: - if (!name.lastName().isEmpty()) - last = name.lastName() + ","; - nameList << name.prefix() << last << name.firstName() << name.middleName() << name.suffix(); + if (!name.firstName().isEmpty() && !name.lastName().isEmpty()) + last_first = name.lastName() + ", " + name.firstName(); + else + last_first = !name.firstName().isEmpty() ? name.firstName() : name.lastName(); + nameList << name.prefix() << last_first << name.middleName() << name.suffix(); break; default: // Default to first name last name nameList << name.prefix() << name.firstName() << name.middleName() << name.lastName() << name.suffix(); @@ -432,9 +442,17 @@ case Qt::GestureUpdated: if (tap->tapStyleHint() == HbTapGesture::TapAndHold && mIcon->rect().contains(mapFromScene(tap->position()))) { + HbEffect::cancel(mIcon, QString("iconclick")); processLongPress(tap->position()); } break; + case Qt::GestureStarted: + if (tap->tapStyleHint() == HbTapGesture::Tap && mIcon->rect().contains(mapFromScene(tap->position()))) + { + HbInstantFeedback::play(HbFeedback::Basic); + HbEffect::start(mIcon, QString("icon"), QString("iconclick")); + } + default: break; } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntcontactcardview_p.cpp --- a/phonebookui/pbkcommonui/src/cntcontactcardview_p.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntcontactcardview_p.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -247,8 +247,10 @@ // presence listener mPresenceListener = new CntPresenceListener(*mContact); connect(mPresenceListener, SIGNAL(fullPresenceUpdated(bool)), mHeadingItem, SLOT(setOnlineStatus(bool))); + connect(mPresenceListener, SIGNAL(accountPresenceUpdated(const QString&, bool)), + this, SLOT(updateItemPresence(const QString&, bool))); bool online; - mPresenceListener->initialPresences(online); + QMap presences = mPresenceListener->initialPresences(online); mHeadingItem->setOnlineStatus(online); mImageLabel = static_cast(document()->findWidget("cnt_contactcard_image")); @@ -302,6 +304,25 @@ dataItem->setSecondaryIcon(HbIcon("qtg_mono_favourites")); mPreferredItems.insert(dataItem->action(), item); } + + if (dataItem->detail().definitionName() == QContactOnlineAccount::DefinitionName) + { + for (int i = 0;i < presences.keys().count();i++) + { + QString fullAccount = presences.keys().at(i); + QContactOnlineAccount account = dataItem->detail(); + QString currentFullAccount = account.serviceProvider() + ':' + account.accountUri(); + if (fullAccount == currentFullAccount) + { + if (presences.values().at(i)) + { + dataItem->setSecondaryIcon(HbIcon("qtg_small_online")); + } + mPresenceItems.insert(fullAccount, item); + break; + } + } + } item->setDetails(dataItem); mContainerLayout->addItem(item); @@ -644,6 +665,27 @@ return maptileLabel; } +/* +* Update the presence status icon of action item with the given accountUri +*/ +void CntContactCardViewPrivate::updateItemPresence(const QString& accountUri, bool online) +{ + CntContactCardDetailItem* item = mPresenceItems.value(accountUri); + + if (item) + { + if (online) + { + mDataContainer->dataItem(item->index())->setSecondaryIcon(HbIcon("qtg_small_online")); + } + else + { + mDataContainer->dataItem(item->index())->setSecondaryIcon(HbIcon()); + } + item->setDetails(mDataContainer->dataItem(item->index())); + } +} + void CntContactCardViewPrivate::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error) { CNT_ENTRY @@ -670,7 +712,7 @@ QVariantHash preferences; preferences["contactId"] = mContact->id().localId(); - XQServiceRequest snd("com.nokia.services.hsapplication.IHomeScreenClient", + XQServiceRequest snd("com.nokia.symbian.IHomeScreenClient", "addWidget(QString,QVariantHash)" ,false); snd << QString("contactwidgethsplugin"); @@ -722,21 +764,24 @@ void CntContactCardViewPrivate::deleteContact() { QString name = contactManager()->synthesizedDisplayLabel(*mContact); + if (name.isEmpty()) + { + name = hbTrId("txt_phob_list_unnamed"); + } - HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(HbAction*)), - hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel")); + HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(int)), + HbMessageBox::Delete | HbMessageBox::Cancel); } /*! Handle action for deleting a contact */ -void CntContactCardViewPrivate::handleDeleteContact(HbAction *action) +void CntContactCardViewPrivate::handleDeleteContact(int action) { - HbMessageBox *note = static_cast(sender()); - - if (note && action == note->actions().first()) + if (action == HbMessageBox::Delete) { - contactManager()->removeContact(mContact->localId()); + contactManager()->removeContact(mContact->localId()); + emit backPressed(); mViewManager->back( mArgs ); } } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntdefaultviewmanager.cpp --- a/phonebookui/pbkcommonui/src/cntdefaultviewmanager.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntdefaultviewmanager.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -209,24 +209,19 @@ if (mOldView) { mOldView->deactivate(); - - // Due to something strange in wk16, this check will fail occationally and cause - // a memory leak... most likely when opening edit view for the first time - if (mCurrent == NULL || !mOldView->view()->isVisible()) + + mMainWindow->removeView(mOldView->view()); + + if (!mOldView->isDefault()) { - mMainWindow->removeView(mOldView->view()); - - if (!mOldView->isDefault()) - { - delete mOldView; - mOldView = NULL; - } - // If view id is not in defaults list, it means that view has changed - // its opinnion about preserving state to true. - else if ( !mDefaults.contains(mOldView->viewId()) ) - { - mDefaults.insert( mOldView->viewId(), mOldView ); - } + delete mOldView; + mOldView = NULL; + } + // If view id is not in defaults list, it means that view has changed + // its opinnion about preserving state to true. + else if ( !mDefaults.contains(mOldView->viewId()) ) + { + mDefaults.insert( mOldView->viewId(), mOldView ); } } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntdetaileditor.cpp --- a/phonebookui/pbkcommonui/src/cntdetaileditor.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntdetaileditor.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -17,7 +17,9 @@ #include "cntdetaileditor.h" #include "cnteditorfactory.h" #include "cntgroupeditormodel.h" +#include "cntsavemanager.h" #include "cntglobal.h" + #include #include #include @@ -29,6 +31,12 @@ #include #include #include +#include +#include +#include +#include + +#include const char *CNT_DETAILEDITOR_XML = ":/xml/contacts_detail_editor.docml"; @@ -41,7 +49,8 @@ mLoader(NULL), mViewManager(NULL), mEditorFactory(NULL), - mCancel(NULL) + mCancel(NULL), + mSaveManager(NULL) { bool ok; document()->load(CNT_DETAILEDITOR_XML, &ok); @@ -57,16 +66,27 @@ mSoftkey = new HbAction(Hb::BackNaviAction, mView); connect( mSoftkey, SIGNAL(triggered()), this, SLOT(saveChanges()) ); + + // closing the application from task swapper or end key will cause the contact to be saved + connect( qApp, SIGNAL(aboutToQuit()), this, SLOT(saveContact())); } CntDetailEditor::~CntDetailEditor() { mView->deleteLater(); + delete mDataForm; + mDataForm = NULL; delete mDataFormModel; + mDataFormModel = NULL; delete mHeader; + mHeader = NULL; delete mLoader; + mLoader = NULL; delete mEditorFactory; + mEditorFactory = NULL; + delete mSaveManager; + mSaveManager = NULL; } void CntDetailEditor::setViewId( int aId ) @@ -108,6 +128,24 @@ } mEditorFactory->setupEditorView(*this, selectedContact); + QString myCard = mArgs.value( EMyCard ).toString(); + QContactLocalId localId = selectedContact.localId(); + QContactLocalId selfContactId = mViewManager->contactManager(SYMBIAN_BACKEND)->selfContactId(); + bool isMyCard = ( localId == selfContactId && localId != 0 ) || !myCard.isEmpty(); + + if (isMyCard) + { + mSaveManager = new CntSaveManager(CntSaveManager::EMyCard); + } + else if ( mId == groupEditorView ) + { + mSaveManager = new CntSaveManager(CntSaveManager::EGroup); + } + else + { + mSaveManager = new CntSaveManager(); + } + mDataForm->setItemRecycling(true); // add new field if required @@ -115,6 +153,9 @@ { mDataFormModel->insertDetailField(); } + mDataForm->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded); + mDataForm->setScrollingStyle(HbScrollArea::PanWithFollowOn); + mDataForm->verticalScrollBar()->setInteractive(true); } void CntDetailEditor::deactivate() @@ -160,6 +201,12 @@ HbLineEdit* edit = static_cast( viewItem->dataItemContentWidget() ); edit->setInputMethodHints( Qt::ImhDialableCharactersOnly ); } + else + { + HbDataFormViewItem* viewItem = static_cast(mDataForm->itemByIndex( aIndex )); + HbLineEdit* edit = static_cast( viewItem->dataItemContentWidget() ); + edit->setInputMethodHints( Qt::ImhNoPredictiveText ); + } } else { @@ -184,6 +231,10 @@ mViewManager->back( mArgs ); } +/*! + Saves all changes made to details (type of details depends on + in which editor we are) of a contact. Doesn't save the contact. +*/ void CntDetailEditor::saveChanges() { mDataFormModel->saveContactDetails(); @@ -208,6 +259,46 @@ mViewManager->back( mArgs ); } +/*! + First saves all changes made to details (type of details depends on + in which editor we are) of a contact and then saves the contact. This + is only called when phonebook is being closed either from task swapper + or by end key. +*/ +void CntDetailEditor::saveContact() +{ + mDataFormModel->saveContactDetails(); + + QString name = mViewManager->contactManager(SYMBIAN_BACKEND)->synthesizedDisplayLabel(*mDataFormModel->contact()); + + if (name.isEmpty()) + { + name = hbTrId("txt_phob_list_unnamed"); + } + + CntSaveManager::CntSaveResult result = mSaveManager->saveContact(mDataFormModel->contact(), mViewManager->contactManager(SYMBIAN_BACKEND)); + + if (mId != groupEditorView) + { + switch (result) + { + case CntSaveManager::ESaved: + HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contact_1_saved")).arg(name)); + break; + case CntSaveManager::EUpdated: + HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contacts_1_updated")).arg(name)); + break; + case CntSaveManager::EFailed: + HbDeviceNotificationDialog::notification(QString(),hbTrId("SAVING FAILED!")); + break; + case CntSaveManager::EDeleted: + case CntSaveManager::ENothingDone: + default: + break; + } + } +} + void CntDetailEditor::setHeader(QString aHeader) { if (!mHeader) { diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cnteditview_p.cpp --- a/phonebookui/pbkcommonui/src/cnteditview_p.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cnteditview_p.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -21,6 +21,7 @@ #include "cntdetailpopup.h" #include "cnteditviewheadingitem.h" #include "cntimagelabel.h" +#include "cntsavemanager.h" #include "cntglobal.h" #include @@ -39,17 +40,21 @@ #include #include #include -#include +#include + +#include +#include const char *CNT_EDIT_XML = ":/xml/contacts_ev.docml"; CntEditViewPrivate::CntEditViewPrivate() : -mModel( NULL ), -mImageLabel( NULL ), -mThumbnailManager( NULL ), -mContact( NULL ), -mReq(0), -mMenu(NULL) + mModel( NULL ), + mImageLabel( NULL ), + mThumbnailManager( NULL ), + mContact( NULL ), + mReq(0), + mMenu(NULL), + mSaveManager(NULL) { mDocument = new CntDocumentLoader; @@ -93,19 +98,30 @@ connect( mHeading, SIGNAL(iconClicked()), this, SLOT(openImageEditor()) ); connect( mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(activated(const QModelIndex&)) ); connect( mListView, SIGNAL(longPressed(HbAbstractViewItem*,const QPointF&)), this, SLOT(longPressed(HbAbstractViewItem*,const QPointF&)) ); + + // closing the application from task swapper or end key will cause the contact to be saved + connect( qApp, SIGNAL(aboutToQuit()), this, SLOT(saveChanges())); } CntEditViewPrivate::~CntEditViewPrivate() { mView->deleteLater(); + delete mDocument; + mDocument = NULL; delete mModel; + mModel = NULL; delete mContact; + mContact = NULL; if (mMenu) { delete mMenu; + mMenu = NULL; } delete mThumbnailManager; + mThumbnailManager = NULL; + delete mSaveManager; + mSaveManager = NULL; } void CntEditViewPrivate::setOrientation(Qt::Orientation orientation) @@ -150,7 +166,16 @@ QContactLocalId localId = mContact->localId(); QContactManager* cm = mMgr->contactManager(SYMBIAN_BACKEND); QContactLocalId selfContactId = cm->selfContactId(); - mIsMyCard = ( localId == selfContactId && localId != 0 ) || myCard == "myCard"; + mIsMyCard = ( localId == selfContactId && localId != 0 ) || !myCard.isEmpty(); + + if (mIsMyCard) + { + mSaveManager = new CntSaveManager(CntSaveManager::EMyCard); + } + else + { + mSaveManager = new CntSaveManager(); + } if ( mHeading ) mHeading->setDetails( mContact, mIsMyCard ); @@ -423,25 +448,28 @@ if ( mIsMyCard ) { HbMessageBox::question(hbTrId("txt_phob_dialog_remove_all_personal_data_from_my_c"), this, - SLOT(handleDeleteContact(HbAction*)), - hbTrId("txt_common_button_yes"), - hbTrId("txt_common_button_no")); + SLOT(handleDeleteContact(int)), + HbMessageBox::Yes | HbMessageBox::No); } else { QContactManager* cm = mMgr->contactManager( SYMBIAN_BACKEND ); QString name = cm->synthesizedDisplayLabel( *mContact ); - HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(HbAction*)), - hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel")); + if (name.isEmpty()) + { + name = hbTrId("txt_phob_list_unnamed"); + } + + HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(int)), + HbMessageBox::Delete | HbMessageBox::Cancel); } } -void CntEditViewPrivate::handleDeleteContact(HbAction *action) +void CntEditViewPrivate::handleDeleteContact(int action) { Q_Q(CntEditView); - - HbMessageBox *dlg = static_cast(sender()); - if(dlg && action == dlg->actions().first()) + + if(action == HbMessageBox::Yes || action == HbMessageBox::Delete) { QContactManager* cm = mMgr->contactManager( SYMBIAN_BACKEND ); @@ -473,141 +501,50 @@ void CntEditViewPrivate::saveChanges() { Q_Q(CntEditView); - - QContactManager* mgr = mMgr->contactManager( SYMBIAN_BACKEND ); - bool isSavedContact = mContact->localId() > 0; + + QString name = mMgr->contactManager(SYMBIAN_BACKEND)->synthesizedDisplayLabel(*mContact); - // if the contact is really changed or a new one - if ( (*mContact) != mgr->contact(mContact->localId()) || !isSavedContact ) + if (name.isEmpty()) + { + name = hbTrId("txt_phob_list_unnamed"); + } + + CntSaveManager::CntSaveResult result = mSaveManager->saveContact(mContact, mMgr->contactManager(SYMBIAN_BACKEND)); + + QVariant var; + + switch (result) { - int detailCount = mContact->details().count(); - - setPreferredDetails( mContact ); - - // If its a new contact - if ( !isSavedContact ) - { - if ( detailCount > 2 ) - { - bool success = mgr->saveContact( mContact ); - if ( success && mIsMyCard ) - { - mgr->setSelfContactId( mContact->localId() ); - } - - QString name = mgr->synthesizedDisplayLabel( *mContact ); - if (name.isEmpty()) - { - name = hbTrId("txt_phob_dblist_unnamed"); - } - - if ( success ) - { - emit q->contactUpdated(1); - HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contact_1_saved")).arg(name)); - } - else - { - emit q->contactUpdated(0); - //TODO: localization is missing - HbDeviceNotificationDialog::notification(QString(),qtTrId("SAVING FAILED!")); - } - - QVariant var; - var.setValue(*mContact); - mArgs.insert(ESelectedContact, var); - mArgs.insert(ESelectedAction, CNT_CREATE_ACTION); - } - else - { - // nothing happened to the contact. Flags should be used - emit q->contactUpdated(-2); - } - } - else - { - // contact details has been cleared out. - if ( detailCount <= 4 ) - { - // get the contact from database, it should have the name still in it, - // and show the delete notification to user - QContact c = mgr->contact( mContact->localId() ); - - bool success = mgr->removeContact( mContact->localId() ); - emit q->contactRemoved(success); - } - else - { - bool success = mgr->saveContact(mContact); - - QString name = mgr->synthesizedDisplayLabel( *mContact ); - if (name.isEmpty()) - { - name = hbTrId("txt_phob_dblist_unnamed"); - } - - if ( success ) - { - emit q->contactUpdated(1); - HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contacts_1_updated")).arg(name)); - mArgs.insert(ESelectedAction, CNT_EDIT_ACTION); - } - else - { - emit q->contactUpdated(0); - //TODO: localization is missing - HbDeviceNotificationDialog::notification(QString(),qtTrId("SAVING FAILED!")); - } - - QVariant var; - var.setValue(*mContact); - mArgs.insert(ESelectedContact, var); - } - } - } - else - { - emit q->changesDiscarded(); + case CntSaveManager::ESaved: + emit q->contactUpdated(KCntServicesReturnValueContactSaved); + HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contact_1_saved")).arg(name)); + var.setValue(*mContact); + mArgs.insert(ESelectedContact, var); + mArgs.insert(ESelectedAction, CNT_CREATE_ACTION); + break; + case CntSaveManager::EUpdated: + emit q->contactUpdated(KCntServicesReturnValueContactSaved); + HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contacts_1_updated")).arg(name)); + var.setValue(*mContact); + mArgs.insert(ESelectedContact, var); + mArgs.insert(ESelectedAction, CNT_EDIT_ACTION); + break; + case CntSaveManager::EFailed: + emit q->contactUpdated(KCntServicesReturnValueContactNotModified); + HbDeviceNotificationDialog::notification(QString(),hbTrId("SAVING FAILED!")); + break; + case CntSaveManager::EDeleted: + emit q->contactUpdated(KCntServicesReturnValueContactDeleted); + break; + case CntSaveManager::ENothingDone: + default: + emit q->contactUpdated(KCntServicesReturnValueContactNotModified); + break; } mMgr->back( mArgs ); } -void CntEditViewPrivate::setPreferredDetails( QContact* aContact ) -{ - QList numberList( aContact->details() ); - //set preferred number for call if there is only one phone number - if ( aContact->preferredDetail("call").isEmpty() && numberList.count() == 1 ) - { - aContact->setPreferredDetail( "call", numberList.first() ); - } - //set preferred number for message if there is only one mobile phone number - if ( aContact->preferredDetail("message").isEmpty() && numberList.count() >= 1 ) - { - int mobileNumbers = 0; - int mobileNumberIndex = -1; - for (int i = 0; i < numberList.count(); i++) - { - if (numberList.at(i).subTypes().count() && numberList.at(i).subTypes().first() == QContactPhoneNumber::SubTypeMobile) - { - mobileNumbers++; - mobileNumberIndex = i; - } - } - if ( mobileNumbers == 1 ) - { - aContact->setPreferredDetail( "message", numberList.at(mobileNumberIndex) ); - } - } - QList emailList( aContact->details() ); - //set preferred number for email if there is only one email address - if ( aContact->preferredDetail("email").isEmpty() && emailList.count() == 1 ) - { - aContact->setPreferredDetail( "email", emailList.first() ); - } -} - - void CntEditViewPrivate::openNameEditor() { QVariant var; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cnteditviewheadingitem.cpp --- a/phonebookui/pbkcommonui/src/cnteditviewheadingitem.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cnteditviewheadingitem.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -38,11 +39,13 @@ mLabel(NULL), mSecondLabel(NULL), mFrameItem(NULL), + mFocusItem(NULL), mIconTouchArea(NULL), mIconFocused(false), mTextFocused(false) { - + HbEffect::add("icon", "groupbox_icon_click", "iconclick"); + setProperty("state", "normal"); } CntEditViewHeadingItem::~CntEditViewHeadingItem() @@ -113,12 +116,22 @@ if (!mFrameItem) { mFrameItem = new HbFrameItem(this); - mFrameItem->frameDrawer().setFrameGraphicsName("qtg_fr_groupbox"); + mFrameItem->frameDrawer().setFrameGraphicsName("qtg_fr_groupbox_normal"); mFrameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); mFrameItem->setZValue(-2); style()->setItemName(mFrameItem, "background"); } + if (!mFocusItem) + { + mFocusItem = new HbFrameItem(this); + mFocusItem->frameDrawer().setFrameGraphicsName("qtg_fr_groupbox_pressed"); + mFocusItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); + mFocusItem->setZValue(-1); + mFocusItem->setVisible(false); + style()->setItemName(mFocusItem, "highlight"); + } + if (!mIconTouchArea) { mIconTouchArea = new HbTouchArea(this); @@ -152,6 +165,20 @@ void CntEditViewHeadingItem::updatePrimitives() { HbWidget::updatePrimitives(); + if (mTextFocused) + { + mFocusItem->setVisible(true); + setProperty("state", "pressed"); + } + else if (mIconFocused) + { + HbEffect::start(mIcon, QString("icon"), QString("iconclick")); + } + else + { + mFocusItem->setVisible(false); + setProperty("state", "normal"); + } } void CntEditViewHeadingItem::setDetails(const QContact* contact, bool myCard) @@ -171,16 +198,18 @@ KCntNameOrdering); int setting = settingsMng.readItemValue(nameOrderKey, XQSettingsManager::TypeInt).toInt(); QStringList nameList = QStringList(); - QString last; + QString last_first; switch( setting ) { case CntOrderLastFirst: nameList << name.prefix() << name.lastName() << name.firstName() << name.middleName() << name.suffix(); break; case CntOrderLastCommaFirst: - if (!name.lastName().isEmpty()) - last = name.lastName() + ","; - nameList << name.prefix() << last << name.firstName() << name.middleName() << name.suffix(); + if (!name.firstName().isEmpty() && !name.lastName().isEmpty()) + last_first = name.lastName() + ", " + name.firstName(); + else + last_first = !name.firstName().isEmpty() ? name.firstName() : name.lastName(); + nameList << name.prefix() << last_first << name.middleName() << name.suffix(); break; default: // Default to first name last name nameList << name.prefix() << name.firstName() << name.middleName() << name.lastName() << name.suffix(); @@ -231,10 +260,12 @@ if (mIconTouchArea->rect().contains(event->pos())) { mIconFocused = true; + updatePrimitives(); } else if (rect().contains(event->pos())) { mTextFocused = true; + updatePrimitives(); } event->accept(); @@ -249,6 +280,7 @@ else if ((!rect().contains(event->pos()) || mIconTouchArea->rect().contains(event->pos())) && mTextFocused) { mTextFocused = false; + updatePrimitives(); } event->accept(); } @@ -259,11 +291,13 @@ if (mIconTouchArea->rect().contains(event->pos()) && mIconFocused) { mIconFocused = false; + updatePrimitives(); emit iconClicked(); } else if (rect().contains(event->pos()) && !mIconTouchArea->rect().contains(event->pos()) && mTextFocused) { mTextFocused = false; + updatePrimitives(); emit textClicked(); } event->accept(); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntfetchcontactsview.cpp --- a/phonebookui/pbkcommonui/src/cntfetchcontactsview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntfetchcontactsview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -15,6 +15,13 @@ * */ +#include "cntfetchcontactsview.h" + +#include + +#include + +#include #include #include #include @@ -27,29 +34,25 @@ #include #include #include -#include -#include -#include -#include "cntfetchcontactsview.h" /*! Given a contact manager, CntFetchContacts is responsible for retrieving a set of contacts, if any were chosen by the user. */ CntFetchContacts::CntFetchContacts(QContactManager &aManager) : -QObject(), -mPopup(NULL), -mCntModel(NULL), -mListView(NULL), -mEmptyListLabel(NULL), -mSelectionMode(HbAbstractItemView::MultiSelection), -mManager(&aManager), -mWasCanceled(false), -mLabel(NULL), -mVirtualKeyboard(NULL), -mPrimaryAction(NULL), -mSecondaryAction(NULL), -mIndexFeedback(NULL) + QObject(), + mPopup(NULL), + mCntModel(NULL), + mListView(NULL), + mEmptyListLabel(NULL), + mSelectionMode(HbAbstractItemView::MultiSelection), + mManager(&aManager), + mWasCanceled(false), + mLabel(NULL), + mVirtualKeyboard(NULL), + mPrimaryAction(NULL), + mSecondaryAction(NULL), + mIndexFeedback(NULL) { mSearchPanel = new HbSearchPanel(); mSearchPanel->setVisible(false); @@ -68,12 +71,6 @@ { delete mCntModel; mCntModel = NULL; - - delete mVirtualKeyboard; - mVirtualKeyboard = NULL; - - delete mIndexFeedback; - mIndexFeedback = NULL; } /*! @@ -92,6 +89,9 @@ if (!mLabel) { mLabel = new HbLabel(aTitle); } + else { + mLabel->setPlainText(aTitle); + } } /*! @@ -130,7 +130,7 @@ if (mEmptyListLabel) { qreal searchHeight = mSearchPanel->size().height(); HbLabel* heading = static_cast(mPopup->headingWidget()); - qreal heightToSet = mPopup->size().height() - mVirtualKeyboard->keyboardArea().height() - searchHeight - heading->size().height(); + qreal heightToSet = mPopup->size().height() - mVirtualKeyboard->keyboardArea().height() - searchHeight; mEmptyListLabel->setMaximumHeight(heightToSet); mEmptyListLabel->setVisible(true); mLayout->insertItem(0, mEmptyListLabel); @@ -153,10 +153,10 @@ { qreal searchHeight = mSearchPanel->size().height(); HbLabel* heading = static_cast(mPopup->headingWidget()); - qreal heightToSet = mPopup->size().height() - mVirtualKeyboard->keyboardArea().height() - searchHeight - heading->size().height(); + qreal heightToSet = mPopup->size().height() - mVirtualKeyboard->keyboardArea().height() - searchHeight; if (mEmptyListLabel) { - mEmptyListLabel->setMaximumHeight( heightToSet - mEmptyListLabel->size().height() ); + mEmptyListLabel->setMaximumHeight(heightToSet); } mListView->setMaximumHeight(heightToSet); @@ -217,6 +217,8 @@ // Check for the case where there is a cancel button only. If so, // after selecting any contact, should dismiss the dialog immediately. if (mButtonText.isEmpty() && mSelectionMode == HbAbstractItemView::SingleSelection) { + disconnect(mVirtualKeyboard, SIGNAL(keypadOpened()), this, SLOT(handleKeypadOpen())); + disconnect(mVirtualKeyboard, SIGNAL(keypadClosed()), this, SLOT(handleKeypadClose())); mPopup->close(); } } @@ -229,6 +231,7 @@ if (!mPopup) { mPopup = new HbDialog; + mPopup->setAttribute(Qt::WA_DeleteOnClose, true); } QContactDetailFilter contactsFilter; @@ -311,12 +314,12 @@ mPopup->setHeadingWidget(mLabel); if (!mButtonText.isEmpty() && !mPrimaryAction) { - mPrimaryAction = new HbAction(hbTrId(mButtonText.toAscii())); + mPrimaryAction = new HbAction(mButtonText, mPopup); mPopup->addAction(mPrimaryAction); } if (!mSecondaryAction) { - mSecondaryAction = new HbAction(hbTrId("txt_common_button_cancel")); + mSecondaryAction = new HbAction(hbTrId("txt_common_button_cancel"), mPopup); mPopup->addAction(mSecondaryAction); } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntgroupactionsview.cpp --- a/phonebookui/pbkcommonui/src/cntgroupactionsview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntgroupactionsview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -16,6 +16,10 @@ */ #include "cntgroupactionsview.h" +#include "cntactionlauncher.h" +#include "cntglobal.h" + +#include #include #include @@ -39,7 +43,8 @@ mGroupContact(NULL), mModel(NULL), mViewManager(NULL), -mListView(NULL) +mListView(NULL), +mPopupCount(0) { bool ok = false; mDocumentLoader.load(CNT_GROUPACTIONSVIEW_XML, &ok); @@ -120,9 +125,11 @@ mGroupContact = new QContact(aArgs.value(ESelectedGroupContact).value()); mViewManager = aMgr; - QContactName groupContactName = mGroupContact->detail( QContactName::DefinitionName ); - QString groupName(groupContactName.value( QContactName::FieldCustomLabel )); - + QString groupName = mGroupContact->displayLabel(); + if (groupName.isEmpty()) + { + groupName = hbTrId("txt_phob_list_unnamed"); + } //group box HbGroupBox* groupBox = static_cast(mDocumentLoader.findWidget(QString("groupBox"))); @@ -145,24 +152,27 @@ QContactPhoneNumber confCallNumber = mGroupContact->detail(); if(!confCallNumber.number().isEmpty()) - { + { /* * Internationalization support, activate the following code * when support available from Orbit */ //populatelist(hbTrId("txt_phob_dblist_conference_call"), HbIcon("qtg_large_call_group"),HbNumberGrouping::formatPhoneNumber(confCallNumber.number())); - populatelist(hbTrId("txt_phob_dblist_conference_call"), HbIcon("qtg_large_call_group"),confCallNumber.number()); - } + populatelist(hbTrId("txt_phob_dblist_conference_call"), HbIcon("qtg_large_call_group"),confCallNumber.number(),"call"); + } - populatelist(hbTrId("txt_phob_dblist_send_message"),HbIcon("qtg_large_message_group"),hbTrId("txt_phob_dblist_send_message_val_members")); - populatelist(hbTrId("txt_phob_dblist_email"),HbIcon("qtg_large_email_group"),hbTrId("txt_phob_dblist_send_message_val_members")); + populatelist(hbTrId("txt_phob_dblist_send_message"),HbIcon("qtg_large_message_group"),hbTrId("txt_phob_dblist_send_message_val_members"),"message"); + populatelist(hbTrId("txt_phob_dblist_email"),HbIcon("qtg_large_email_group"),hbTrId("txt_phob_dblist_send_message_val_members"),"email"); mListView->setModel(mModel); mListView->setSelectionMode(HbAbstractItemView::NoSelection); + connect(mListView, SIGNAL(activated(const QModelIndex&)), + this, SLOT(listItemSelected(const QModelIndex&))); + } -void CntGroupActionsView:: populatelist(QString primaryText,HbIcon icon,QString secondaryText) +void CntGroupActionsView::populatelist(QString primaryText,HbIcon icon,QString secondaryText,QString action) { QList items; QStandardItem *labelItem = new QStandardItem(); @@ -173,7 +183,115 @@ labelItem->setData(textList, Qt::DisplayRole); labelItem->setData(icon, Qt::DecorationRole); + labelItem->setData(action, Qt::UserRole+1); items << labelItem ; mModel->appendRow(items); } + +void CntGroupActionsView::listItemSelected(const QModelIndex &index) +{ + if (index.isValid()) { + //reset flags + mPopupCount=0; + mActionParams.clear(); + + QString action = mModel->item(index.row())->data(Qt::UserRole+1).toString(); + + //conference call + if (action.compare("call", Qt::CaseInsensitive) == 0 ) { + CntActionLauncher* other = new CntActionLauncher(*mViewManager->contactManager(SYMBIAN_BACKEND), action); + connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); + other->execute(*mGroupContact, QContactDetail()); + } + //group email, message + else { + QContactRelationshipFilter relationshipFilter; + relationshipFilter.setRelationshipType(QContactRelationship::HasMember); + relationshipFilter.setRelatedContactRole(QContactRelationship::First); + relationshipFilter.setRelatedContactId(mGroupContact->id()); + QList groupMembers = mViewManager->contactManager(SYMBIAN_BACKEND)->contactIds(relationshipFilter); + + for (int i = 0;icontactManager(SYMBIAN_BACKEND)->contact(groupMembers.at(i)); + QContactDetail preferredDetail = contact.preferredDetail(action); + //use preferred detail if exits + if (!preferredDetail.isEmpty()) { + if(action.compare("message", Qt::CaseInsensitive) == 0) { + QContactPhoneNumber phoneNumber = contact.detail(); + mActionParams.append(phoneNumber.number()); + } + else { + QContactEmailAddress email = contact.detail(); + mActionParams.append(email.emailAddress()); + } + } + else { + CntActionPopup *actionPopup = new CntActionPopup(&contact); + if(actionPopup->showActionPopup(action)) { + //increment actionpopup counter + mPopupCount++; + + connect( actionPopup, SIGNAL(executeContactAction(QContact&, QContactDetail, QString)), this, + SLOT(executeAction(QContact&, QContactDetail, QString))); + connect(actionPopup, SIGNAL(actionPopupCancelPressed()), this, SLOT(actionCancelled())); + } + else { + delete actionPopup; + } + } + } + //no popup dialog, execute action + if (mPopupCount==0) { + QVariantMap map; + QVariant params; + params.setValue(mActionParams); + map.insert(action,params); + CntActionLauncher* other = new CntActionLauncher(*mViewManager->contactManager(SYMBIAN_BACKEND), action); + connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); + other->execute(*mGroupContact, QContactDetail(), map); + } + } + } +} + +void CntGroupActionsView::executeAction(QContact& contact, QContactDetail detail, QString action) +{ + Q_UNUSED(contact); + + if (action.compare("message", Qt::CaseInsensitive) == 0) { + QContactPhoneNumber phoneNumber = static_cast(detail); + mActionParams.append(phoneNumber.number()); + } + else if (action.compare("email", Qt::CaseInsensitive) == 0) { + QContactEmailAddress email = static_cast(detail); + mActionParams.append(email.emailAddress()); + } + + //actionpopup executed, decrement counter + mPopupCount--; + if (mPopupCount==0) { + QVariantMap map; + QVariant params; + params.setValue(mActionParams); + map.insert(action,params); + + CntActionLauncher* other = new CntActionLauncher(*mViewManager->contactManager(SYMBIAN_BACKEND), action); + connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); + other->execute(*mGroupContact, QContactDetail(), map); + } +} + +void CntGroupActionsView::actionCancelled() +{ + //actionpopup cancelled, decrement counter + mPopupCount--; +} + + +void CntGroupActionsView::actionExecuted(CntActionLauncher* aAction) +{ + //cleanup + aAction->deleteLater(); +} + diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntgroupeditormodel.cpp --- a/phonebookui/pbkcommonui/src/cntgroupeditormodel.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntgroupeditormodel.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -31,7 +31,7 @@ nameDetails.append(emptyName); } - QList numberDetails = CntDetailOrderingHelper::getOrderedSupportedPhoneNumbers(*mContact); + QList numberDetails = mContact->details(); if (numberDetails.isEmpty()) { QContactPhoneNumber emptyNumber; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntgroupmemberview.cpp --- a/phonebookui/pbkcommonui/src/cntgroupmemberview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntgroupmemberview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -206,9 +206,6 @@ QString name = getContactManager()->synthesizedDisplayLabel(*mGroupContact); HbNotificationDialog::launchDialog(HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_new_group_1_created").arg(name))); } - - mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND )); - connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleManageMembers())); } void CntGroupMemberView::deactivate() @@ -246,8 +243,12 @@ mOriginalGroupMembers = getContactManager()->contactIds(membersFilter); QSet contactsSet = mOriginalGroupMembers.toSet(); - QContactName groupContactName = mGroupContact->detail( QContactName::DefinitionName ); - QString groupName(groupContactName.value( QContactName::FieldCustomLabel )); + + QString groupName = mGroupContact->displayLabel(); + if (groupName.isEmpty()) + { + groupName = hbTrId("txt_phob_list_unnamed"); + } if (!mFetchView) { mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND )); @@ -286,6 +287,9 @@ if (!removedMemberships.isEmpty()) { getContactManager()->removeRelationships(removedMemberships, &errors); } + + delete mFetchView; + mFetchView = 0; } void CntGroupMemberView::createModel() @@ -311,18 +315,21 @@ void CntGroupMemberView::deleteGroup() { QString groupName = mGroupContact->displayLabel(); + if (groupName.isNull()) + { + groupName = hbTrId("txt_phob_list_unnamed"); + } + HbLabel *headingLabel = new HbLabel(); headingLabel->setPlainText(HbParameterLengthLimiter(hbTrId("txt_phob_dialog_delete_1_group")).arg(groupName)); - HbMessageBox::question(hbTrId("txt_phob_dialog_only_group_will_be_removed_contac"), this, SLOT(handleDeleteGroup(HbAction*)), - hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel"), headingLabel); + HbMessageBox::question(hbTrId("txt_phob_dialog_only_group_will_be_removed_contac"), this, SLOT(handleDeleteGroup(int)), + HbMessageBox::Delete | HbMessageBox::Cancel, headingLabel); } -void CntGroupMemberView::handleDeleteGroup(HbAction *action) +void CntGroupMemberView::handleDeleteGroup(int action) { - HbDialog *popup = static_cast(sender()); - - if (popup && action == popup->actions().first()) + if (action == HbMessageBox::Delete) { getContactManager()->removeContact(mGroupContact->localId()); showPreviousView(); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cnthistoryview.cpp --- a/phonebookui/pbkcommonui/src/cnthistoryview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cnthistoryview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -112,7 +112,12 @@ // Set history view heading HbGroupBox* groupBox = static_cast(docLoader()->findWidget(QString("groupBox"))); - groupBox->setHeading(hbTrId("txt_phob_subtitle_history_with_1").arg(mContact->displayLabel())); + QString name = mContact->displayLabel(); + if (name.isEmpty()) + { + name = hbTrId("txt_phob_list_unnamed"); + } + groupBox->setHeading(hbTrId("txt_phob_subtitle_history_with_1").arg(name)); //construct listview mHistoryListView = static_cast(docLoader()->findWidget(QString("listView"))); @@ -171,19 +176,21 @@ { // Ask the use if they want to clear the history QString name = mContact->displayLabel(); + if (name.isEmpty()) + { + name = hbTrId("txt_phob_list_unnamed"); + } HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_clear_communications_history_with_1")).arg(name), this, - SLOT(handleClearHistory(HbAction*)), hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel")); + SLOT(handleClearHistory(int)), HbMessageBox::Delete | HbMessageBox::Cancel); } /* Handle the selected action for clearing history */ -void CntHistoryView::handleClearHistory(HbAction *action) +void CntHistoryView::handleClearHistory(int action) { - HbMessageBox *note = static_cast(sender()); - - if (note && action == note->actions().first()) + if (action == HbMessageBox::Delete) { mHistoryModel->clearHistory(); } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cnthistoryviewitem.cpp --- a/phonebookui/pbkcommonui/src/cnthistoryviewitem.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cnthistoryviewitem.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -20,6 +20,7 @@ #include #include #include +#include #define NEW_EVENT_FRAME "qtg_fr_list_new_item" #define INCOMING_FOCUS_FRAME "qtg_fr_convlist_received_pressed" @@ -117,4 +118,26 @@ } } } + +bool CntHistoryViewItem::event(QEvent* e) +{ + bool result; + if (e->type() == QEvent::GraphicsSceneResize) + { + // HbAbstractItemView has a performance improvement when drawing backrounds but seems + // to screw the layout of history view items. This workaround fixes the issue. There should + // be minimal performance drawbacks since GraphicsSceneResize events are quite few. + // TODO: Remove this once Orbit changes their implementation. Not known when + QGraphicsWidget *frame = static_cast(primitive("frame")); + QRectF frameGeometry = frame->geometry(); + result = HbListViewItem::event(e); + frame->setGeometry(frameGeometry); + } + else + { + result = HbListViewItem::event(e); + } + return result; +} + // EOF diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntimageeditorview.cpp --- a/phonebookui/pbkcommonui/src/cntimageeditorview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntimageeditorview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -17,12 +17,14 @@ #include "cntimageeditorview.h" #include "cntimageutility.h" +#include "cntsavemanager.h" #include #include #include #include "cntdebug.h" +#include "cntglobal.h" #include #include @@ -31,8 +33,11 @@ #include #include #include +#include +#include #include +#include const char *CNT_IMAGE_XML = ":/xml/contacts_if.docml"; @@ -40,13 +45,14 @@ Constructor */ CntImageEditorView::CntImageEditorView() : - mContact(NULL), - mAvatar(NULL), - mImageLabel(NULL), - mRequest(NULL), - mViewManager(NULL), - mListView(NULL), - mModel(NULL) + mContact(NULL), + mAvatar(NULL), + mImageLabel(NULL), + mRequest(NULL), + mViewManager(NULL), + mListView(NULL), + mModel(NULL), + mSaveManager(NULL) { bool ok = false; mDocumentLoader.load(CNT_IMAGE_XML, &ok); @@ -76,6 +82,9 @@ connect( mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)), this, SLOT(thumbnailReady(QPixmap, void*, int, int)) ); + + // closing the application from task swapper or end key will cause the contact to be saved + connect( qApp, SIGNAL(aboutToQuit()), this, SLOT(saveContact())); } /*! @@ -88,15 +97,17 @@ mView->deleteLater(); delete mAvatar; - mAvatar = 0; + mAvatar = NULL; delete mContact; - mContact = 0; + mContact = NULL; delete mRequest; - mRequest = 0; + mRequest = NULL; delete mRemoveImage; - mRemoveImage = 0; + mRemoveImage = NULL; delete mModel; - mModel = 0; + mModel = NULL; + delete mSaveManager; + mSaveManager = NULL; CNT_EXIT } @@ -121,6 +132,24 @@ mContact = new QContact(mArgs.value(ESelectedContact).value()); + QString myCard = mArgs.value( EMyCard ).toString(); + QContactLocalId localId = mContact->localId(); + QContactLocalId selfContactId = mViewManager->contactManager(SYMBIAN_BACKEND)->selfContactId(); + bool isMyCard = ( localId == selfContactId && localId != 0 ) || !myCard.isEmpty(); + + if (isMyCard) + { + mSaveManager = new CntSaveManager(CntSaveManager::EMyCard); + } + else if (mContact->type() == QContactType::TypeGroup) + { + mSaveManager = new CntSaveManager(CntSaveManager::EGroup); + } + else + { + mSaveManager = new CntSaveManager(); + } + // set the correct image if the contact already has an image set mImageLabel = static_cast(mDocumentLoader.findWidget(QString("cnt_image_label"))); QList details = mContact->details(); @@ -196,7 +225,7 @@ mRequest = 0; } - mRequest = mAppManager.create(XQI_CAMERA_CAPTURE, "capture(int,QVariantMap)", false); + mRequest = mAppManager.create(XQI_CAMERA_CAPTURE, XQOP_CAMERA_CAPTURE, false); if ( mRequest ) { int mode = 0; //image mode @@ -385,6 +414,47 @@ void CntImageEditorView::handleError(int errorCode, const QString& errorMessage) { + Q_UNUSED(errorCode); + Q_UNUSED(errorMessage); CNT_LOG_ARGS("error code = " << errorCode << "errorMessage=" << errorMessage) } +void CntImageEditorView::saveContact() +{ + mContact->saveDetail(mAvatar); + + if ( mAvatar->imageUrl().isEmpty()) + { + mContact->removeDetail(mAvatar); + } + + QString name = mViewManager->contactManager(SYMBIAN_BACKEND)->synthesizedDisplayLabel(*mContact); + + if (name.isEmpty()) + { + name = hbTrId("txt_phob_list_unnamed"); + } + + CntSaveManager::CntSaveResult result = mSaveManager->saveContact(mContact, mViewManager->contactManager(SYMBIAN_BACKEND)); + + if (mContact->type() != QContactType::TypeGroup) + { + switch (result) + { + case CntSaveManager::ESaved: + HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contact_1_saved")).arg(name)); + break; + case CntSaveManager::EUpdated: + HbDeviceNotificationDialog::notification(QString(),HbParameterLengthLimiter(hbTrId("txt_phob_dpophead_contacts_1_updated")).arg(name)); + break; + case CntSaveManager::EFailed: + HbDeviceNotificationDialog::notification(QString(),hbTrId("SAVING FAILED!")); + break; + case CntSaveManager::EDeleted: + case CntSaveManager::ENothingDone: + default: + break; + } + } +} + diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntimagelabel.cpp --- a/phonebookui/pbkcommonui/src/cntimagelabel.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntimagelabel.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -19,12 +19,14 @@ #include #include +#include #include CntImageLabel::CntImageLabel(QGraphicsItem *parent) : HbLabel(parent) { grabGesture(Qt::TapGesture); + HbEffect::add(this, "groupbox_icon_click", "iconclick"); } CntImageLabel::~CntImageLabel() @@ -38,6 +40,9 @@ { switch (tap->state()) { + case Qt::GestureStarted: + HbEffect::start(this, QString("iconclick")); + break; case Qt::GestureFinished: if (tap->tapStyleHint() == HbTapGesture::Tap) { @@ -48,8 +53,9 @@ case Qt::GestureUpdated: if (tap->tapStyleHint() == HbTapGesture::TapAndHold) { + HbEffect::cancel(this, QString("iconclick")); emit iconLongPressed(tap->scenePosition()); - } + } break; default: break; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntimportsview.cpp --- a/phonebookui/pbkcommonui/src/cntimportsview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntimportsview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -168,7 +168,7 @@ mAdnStorePresent = true; mAdnEntriesPresent = true; mWaitingForAdnCache = true; - connect(mAdnSimUtility, SIGNAL(adnCacheStatusReady(SimUtility::CacheStatus&, int)), this, SLOT(adnCacheStatusReady(SimUtility::CacheStatus&, int))); + connect(mAdnSimUtility, SIGNAL(adnCacheStatusReady(CntSimUtility::CacheStatus&, int)), this, SLOT(adnCacheStatusReady(CntSimUtility::CacheStatus&, int))); if (!mAdnSimUtility->notifyAdnCacheStatus()) { mAdnStorePresent = false; mAdnEntriesPresent = false; @@ -322,6 +322,7 @@ bool CntImportsView::startSimImport() { + bool started = false; delete mFetchRequestADN; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntmycardview.cpp --- a/phonebookui/pbkcommonui/src/cntmycardview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntmycardview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -98,11 +98,6 @@ { chooseButton->setEnabled(false); } - - if (!mFetchView) { - mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND )); - connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleMultiCardSelection())); - } } void CntMyCardView::deactivate() @@ -144,6 +139,10 @@ void CntMyCardView::openMyCardSelectionView() { // Display a list of contacts to choose a mycard from. + if (!mFetchView) { + mFetchView = new CntFetchContacts(*mViewManager->contactManager( SYMBIAN_BACKEND )); + connect(mFetchView, SIGNAL(clicked()), this, SLOT(handleMultiCardSelection())); + } mFetchView->setDetails(hbTrId("txt_phob_title_select_contact"), ""); QSet emptyContactsSet; mFetchView->displayContacts(HbAbstractItemView::SingleSelection, emptyContactsSet); @@ -163,6 +162,10 @@ manager->setSelfContactId( contact.localId() ); showPreviousView(); } + else { + delete mFetchView; + mFetchView = NULL; + } } void CntMyCardView::removeFromGroup(const QContact* aContact) diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntnamesview_p.cpp --- a/phonebookui/pbkcommonui/src/cntnamesview_p.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntnamesview_p.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -144,6 +144,9 @@ { CNT_ENTRY + delete mFetchView; + mFetchView = NULL; + delete mListModel; mListModel = NULL; @@ -212,6 +215,11 @@ setScrollPosition(aArgs.value(ESelectedContact).value().localId()); } + if ( aArgs.value( EFinder ).toString() == "show" ) + { + showFinder(); + } + CNT_EXIT } @@ -219,9 +227,13 @@ { CNT_ENTRY - if (!(mView->visibleItems() & Hb::AllItems)) + // in UTs there is no mainwindow and therefore calling HbView::visibleItems() would cause a crash + if (mView->mainWindow() != NULL) { - hideFinder(); + if (!(mView->visibleItems() & Hb::AllItems)) + { + hideFinder(); + } } delete mMenuBuilder; @@ -398,11 +410,15 @@ QContactManager* manager = mViewManager->contactManager( SYMBIAN_BACKEND ); QString name = manager->synthesizedDisplayLabel(aContact); + if (name.isEmpty()) + { + name = hbTrId("txt_phob_list_unnamed"); + } mHandledContactId = aContact.localId(); - HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(HbAction*)), - hbTrId("txt_common_button_delete"), hbTrId("txt_common_button_cancel")); + HbMessageBox::question(HbParameterLengthLimiter(hbTrId("txt_phob_info_delete_1")).arg(name), this, SLOT(handleDeleteContact(int)), + HbMessageBox::Delete | HbMessageBox::Cancel); CNT_EXIT } @@ -514,13 +530,11 @@ CNT_EXIT } -void CntNamesViewPrivate::handleDeleteContact( HbAction* aAction ) +void CntNamesViewPrivate::handleDeleteContact( int aAction ) { CNT_ENTRY - HbMessageBox *note = static_cast(sender()); - - if (note && aAction == note->actions().first()) + if (aAction == HbMessageBox::Delete) { mViewManager->contactManager( SYMBIAN_BACKEND )->removeContact(mHandledContactId); } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntpresencelistener.cpp --- a/phonebookui/pbkcommonui/src/cntpresencelistener.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/pbkcommonui/src/cntpresencelistener.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -20,6 +20,11 @@ #include #include +/*! + Presence listener for contact card. It provides aggregated + presence information for a contact and separately for each + valid QContactOnlineAccount. +*/ CntPresenceListener::CntPresenceListener(const QContact& contact, QObject* parent) : QObject(parent), mReader(NULL), @@ -30,12 +35,22 @@ this, SLOT(handlePresenceUpdate(bool, PrcPresenceBuddyInfoQt*))); } +/*! + Destructor +*/ CntPresenceListener::~CntPresenceListener() { delete mReader; mReader = NULL; } +/*! + Subscribes all valid QContactOnlineAccounts to receive status updates from presence cache and + returns initial presence statuses for each of the accounts. + + \param combinedOnlineStatus aggregated online status + \return QMap with account specific (for example "sip:sip@sip.com") online information +*/ QMap CntPresenceListener::initialPresences(bool &combinedOnlineStatus) { QMap initialMap; @@ -67,7 +82,14 @@ return initialMap; } + +/*! + Private slot that handles emitting changes for separate accounts along + with the aggregated information. + \param aSuccess information if the request/update was succesful + \param aPresenceBuddyInfo the account that got updated +*/ void CntPresenceListener::handlePresenceUpdate(bool aSuccess, PrcPresenceBuddyInfoQt* aPresenceBuddyInfo) { if (aSuccess && aPresenceBuddyInfo != NULL) @@ -90,14 +112,20 @@ } } - // emit the combined presence status + // emit the aggregated presence status emit fullPresenceUpdated(parsePresence(buddies)); qDeleteAll(buddies); } } } - + +/*! + Returns the aggregated online status. + + \param buddyList list of accounts to parse the aggregated status from + \return bool true if any of the accounts is online +*/ bool CntPresenceListener::parsePresence(QList buddyList) { foreach (PrcPresenceBuddyInfoQt* buddy, buddyList) diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/pbkcommonui/src/cntsavemanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/pbkcommonui/src/cntsavemanager.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,154 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "cntsavemanager.h" +#include "cntdebug.h" + +/*! + Contact saving helper class. Used mainly in edit view for contact saving, + but should also be used in other (special) cases a contact needs to be saved. + For example "forcing" phonebook to shut down (end key, from task swapper etc..) + in detail editors. +*/ +CntSaveManager::CntSaveManager(CntContactType type, QObject* parent) : + QObject(parent), + mContactType(type) +{ + CNT_ENTRY + + CNT_EXIT +} + +/*! + Destructor +*/ +CntSaveManager::~CntSaveManager() +{ + CNT_ENTRY + + CNT_EXIT +} + +/*! + Saves the given QContact to the given QContactManager. Also takes care of checking + if the contact is MyCard or a group and behaves different accordingly. + + \param aContact the contact to be saved, ownership not taken + \param aManager the QContactManager which should be used for saving the contact, ownership not taken + \return CntSaveResult enum to describe what was done to the contact (saved, updated etc...) +*/ +CntSaveManager::CntSaveResult CntSaveManager::saveContact(QContact* aContact, QContactManager* aManager) +{ + CNT_ENTRY + + CntSaveResult result = ENothingDone; + bool isSavedContact = aContact->localId() > 0; + + // if the contact is really changed or a new one + if ( (*aContact) != aManager->contact(aContact->localId()) || !isSavedContact ) + { + int detailCount = aContact->details().count(); + + // Don't set preferred details for a group + if (mContactType != EGroup) + { + setPreferredDetails( aContact ); + } + + // If its a new contact + if ( !isSavedContact ) + { + // if a new contact has 2 or less details, it's still considered empty + if ( detailCount > 2 ) + { + bool success = aManager->saveContact( aContact ); + if ( success && mContactType == EMyCard ) + { + aManager->setSelfContactId( aContact->localId() ); + } + + result = success ? ESaved : EFailed; + } + } + else + { + // Contact details has been cleared out, a symbian QContact with + // 4 or less details is in reality empty. + if ( detailCount <= 4 ) + { + bool success = aManager->removeContact( aContact->localId() ); + + result = success ? EDeleted : EFailed; + } + else + { + bool success = aManager->saveContact(aContact); + + result = success ? EUpdated : EFailed; + } + } + } + + CNT_EXIT_ARGS(result) + + return result; +} + +/*! + Set the preferred call, sms and email details for a contact if possible + and needed. + + \param aContact the contact being handled +*/ +void CntSaveManager::setPreferredDetails( QContact* aContact ) +{ + CNT_ENTRY + + QList numberList( aContact->details() ); + //set preferred number for call if there is only one phone number + if ( aContact->preferredDetail("call").isEmpty() && numberList.count() == 1 ) + { + aContact->setPreferredDetail( "call", numberList.first() ); + } + //set preferred number for message if there is only one mobile phone number + if ( aContact->preferredDetail("message").isEmpty() && numberList.count() >= 1 ) + { + int mobileNumbers = 0; + int mobileNumberIndex = -1; + for (int i = 0; i < numberList.count(); i++) + { + QStringList subTypes = numberList.at(i).subTypes(); + if (subTypes.count() && subTypes.first() == QContactPhoneNumber::SubTypeMobile) + { + mobileNumbers++; + mobileNumberIndex = i; + } + } + if ( mobileNumbers == 1 ) + { + aContact->setPreferredDetail( "message", numberList.at(mobileNumberIndex) ); + } + } + QList emailList( aContact->details() ); + //set preferred number for email if there is only one email address + if ( aContact->preferredDetail("email").isEmpty() && emailList.count() == 1 ) + { + aContact->setPreferredDetail( "email", emailList.first() ); + } + + CNT_EXIT +} diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookapp/src/main.cpp --- a/phonebookui/phonebookapp/src/main.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookapp/src/main.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -21,9 +21,11 @@ #include "cntmainwindow.h" #include "cntappservicehandler.h" #include "cntglobal.h" +#include "cntdebug.h" int main(int argc, char **argv) { + qInstallMsgHandler(MSG_HANDLER); HbApplication a( argc, argv ); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntabstractserviceprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/inc/cntabstractserviceprovider.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Abstract interface for highway providers used in phonebookservices. + * + */ + +#ifndef CNTABSTRACTSERVICEPROVIDER_H +#define CNTABSTRACTSERVICEPROVIDER_H + + +QTM_USE_NAMESPACE + +/*! + * Abstract interface for highway providers used in phonebookservices. + */ +class CntAbstractServiceProvider +{ +public: + + /*! + Complete the Qt Highway service (through a QqServiceProvider instance). + Closes the app after the completing is done (message sending to client is done). + */ + virtual void CompleteServiceAndCloseApp(const QVariant& retValue) = 0; + +}; + +#endif /* CNTABSTRACTSERVICEPROVIDER_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceassigncontactcardview.h --- a/phonebookui/phonebookservices/inc/cntserviceassigncontactcardview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/inc/cntserviceassigncontactcardview.h Wed Jul 21 11:21:49 2010 +0300 @@ -25,6 +25,7 @@ class CntServiceHandler; class CntAbstractViewManager; +class CntAbstractServiceProvider; QTM_BEGIN_NAMESPACE class QContact; @@ -47,13 +48,13 @@ void doViewActivated(CntAbstractViewManager* aMgr, const CntViewParameters aArgs); public: - CntServiceAssignContactCardView(CntServiceHandler *aServiceHandler); + CntServiceAssignContactCardView( CntAbstractServiceProvider& aServiceController ); ~CntServiceAssignContactCardView(); int viewId() const { return serviceAssignContactCardView; } private: - CntServiceHandler *mServiceHandler; + CntAbstractServiceProvider& mProvider; CntAbstractViewManager *mViewManager; QContact mContact; QContactDetail mDetail; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntservicecontactcardview.h --- a/phonebookui/phonebookservices/inc/cntservicecontactcardview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/inc/cntservicecontactcardview.h Wed Jul 21 11:21:49 2010 +0300 @@ -22,23 +22,23 @@ #include "cntcontactcardview.h" class CntServiceHandler; +class CntAbstractServiceProvider; class CntServiceContactCardView : public CntContactCardView { Q_OBJECT -private slots: - - void doShowPreviousView(); - public: - CntServiceContactCardView(CntServiceHandler *aServiceHandler); + CntServiceContactCardView( CntAbstractServiceProvider& aServiceProvider ); ~CntServiceContactCardView(); int viewId() const { return serviceContactCardView; } +private slots: + void closeContactCard(); + private: - CntServiceHandler *mServiceHandler; + CntAbstractServiceProvider& mProvider; }; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntservicecontactfetchview.h --- a/phonebookui/phonebookservices/inc/cntservicecontactfetchview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/inc/cntservicecontactfetchview.h Wed Jul 21 11:21:49 2010 +0300 @@ -21,26 +21,26 @@ #include #include "cntbaseselectionview.h" +#include "cntabstractserviceprovider.h" -class CntServiceHandler; class CntServiceContactFetchView : public CntBaseSelectionView { Q_OBJECT public: - CntServiceContactFetchView( CntServiceHandler *aServiceHandler ); + CntServiceContactFetchView( CntAbstractServiceProvider& aServiceProvider ); ~CntServiceContactFetchView(); int viewId() const { return serviceContactFetchView; } public slots: void aboutToOpenView(CntAbstractViewManager* aMgr, const CntViewParameters viewParameters); - void aboutToCloseView(); + void closeFetchView(); void cancelFetch(); private: - CntServiceHandler *mServiceHandler; + CntAbstractServiceProvider& mProvider; }; #endif /* CNTSERVICECONTACTFETCHVIEW_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntservicecontactselectionview.h --- a/phonebookui/phonebookservices/inc/cntservicecontactselectionview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/inc/cntservicecontactselectionview.h Wed Jul 21 11:21:49 2010 +0300 @@ -21,6 +21,7 @@ #include #include "cntbaseselectionview.h" +#include "cntabstractserviceprovider.h" class QModelIndex; class CntServiceHandler; @@ -30,7 +31,7 @@ Q_OBJECT public: - CntServiceContactSelectionView(CntServiceHandler *aServiceHandler); + CntServiceContactSelectionView( CntAbstractServiceProvider& aServiceProvider ); ~CntServiceContactSelectionView(); int viewId() const { return serviceContactSelectionView; } @@ -41,7 +42,7 @@ void aboutToCloseView(); private: - CntServiceHandler *mServiceHandler; + CntAbstractServiceProvider& mProvider; QContactDetail mDetail; }; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceeditview.h --- a/phonebookui/phonebookservices/inc/cntserviceeditview.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/inc/cntserviceeditview.h Wed Jul 21 11:21:49 2010 +0300 @@ -20,6 +20,7 @@ #include #include "cnteditview.h" +#include "cntabstractserviceprovider.h" class CntServiceHandler; @@ -30,7 +31,7 @@ public: - CntServiceEditView(CntServiceHandler *aServiceHandler ); + CntServiceEditView( CntAbstractServiceProvider& aServiceProvider ); ~CntServiceEditView(); int viewId() const { return serviceEditView; } @@ -41,7 +42,7 @@ void doChangesDiscarded(); private: - CntServiceHandler *mServiceHandler; + CntAbstractServiceProvider& mProvider; }; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntservicehandler.h --- a/phonebookui/phonebookservices/inc/cntservicehandler.h Wed Jul 21 11:09:07 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#ifndef CNTSERVICEHANDLER_H -#define CNTSERVICEHANDLER_H - -#include -#include -#include -#include - -QTM_USE_NAMESPACE - -class CntServiceHandler : public XQServiceProvider -{ - Q_OBJECT -public: - CntServiceHandler(QObject *parent = 0); - ~CntServiceHandler(); - - enum CntServiceViewParams - { - ETitle = ECustomParam, - EFilter, - EAction - }; - -public: - void completeFetch(const CntServicesContactList &contactList); - void completeEdit(int result); - -public slots: - // Services offered to clients - void fetch(const QString &title, - const QString &action, - const QString &filter); - - void Dofetch(const QString &title, - const QString &action, - const QString &filter, - const QString &mode = KCntNoSelectionMode); - - void editCreateNew(const QString &definitionName, const QString &value); - void editCreateNew(const QString &vCardFile); - void editUpdateExisting(const QString &definitionName, const QString &value); - void open(int contactId); - void open(const QString &definitionName, const QString &value); - -signals: - void launchFetch(const QString &title, - const QString &action, - const QString &filter); - - void launchFetchVerified(const QString &title, - const QString &action, - const QString &filter, - const QString &mode); - - void launchEditor(QContact contact); - void launchContactSelection(QContactDetail detail); - void launchContactCard(QContact contact); - void launchAssignContactCard(QContact contact, QContactDetail detail); - -private: - void removeNotSupportedFields(QContact& contact); - void removeNotSupportedDetails(QContact& contact); - -private: - int mCurrentRequestIndex; - QStringList m_definitionNames; -}; - -#endif /* CNTSERVICEHANDLER_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntservicemainwindow.h --- a/phonebookui/phonebookservices/inc/cntservicemainwindow.h Wed Jul 21 11:09:07 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef CNTSERVICEMAINWINDOW_H -#define CNTSERVICEMAINWINDOW_H - -#include -#include "cntmainwindow.h" - -class CntServiceHandler; -class CntServiceViewManager; - -class CntServiceMainWindow : public CntMainWindow -{ - Q_OBJECT - -public: - CntServiceMainWindow(CntServiceHandler *handler, QWidget *parent=0); - ~CntServiceMainWindow(); - -private: - CntServiceHandler *mServiceHandler; - CntServiceViewManager *mServiceViewManager; -}; - -#endif // CNTSERVICEMAINWINDOW_H diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceprovideredit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/inc/cntserviceprovideredit.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This class offers contact editing UI services. + * + */ + +#ifndef CNTSERVICEPROVIDEREDIT_H +#define CNTSERVICEPROVIDEREDIT_H + +#include +#include +#include +#include + +#include "cntabstractserviceprovider.h" + +class CntServices; + +QTM_USE_NAMESPACE + +/*! + This class offers contact editing UI services. +*/ +class CntServiceProviderEdit : public XQServiceProvider, public CntAbstractServiceProvider +{ + Q_OBJECT +public: + CntServiceProviderEdit(CntServices& aServices, QObject *parent = 0); + ~CntServiceProviderEdit(); + +public slots: // operations offered to clients + + /** + * Launch editor for creating a new contact with a given detail. + * @param definitionName The field type + * @param value The value for the field. + */ + void editCreateNew(const QString& definitionName, const QString& value); + + /** + * Launch editor for creating a new contact based on vCard file indicated in arg. + * @param vCardFile The vCard file name and path. + */ + void editCreateNewFromVCard(const QString &vCardFile); + + /** + * Open the editor for an existing contact.' + * @param contactId + */ + void editExisting(int contactId); + + /** + * User can first choose a contact, and then an editor is opened. + * A new detail is provided by caller and it will be prefilled in the editor. + * @param definitionName The field type + * @param value The value for the field. + */ + void editUpdateExisting(const QString &definitionName, const QString &value); + +private: // from CntAbstractServiceProvider + void CompleteServiceAndCloseApp(const QVariant& retValue); + +private: + CntServices& mServices; + int mCurrentRequestIndex; +}; + +#endif /* CNTSERVICEPROVIDEREDIT_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceproviderfetch.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/inc/cntserviceproviderfetch.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CNTSERVICEPROVIDERFETCH_H +#define CNTSERVICEPROVIDERFETCH_H + +#include +#include +#include +#include + +#include "cntabstractserviceprovider.h" + +class CntServices; + +QTM_USE_NAMESPACE + +/*! + This class offers services through the old interface name & old signatures. +*/ +class CntServiceProviderFetch : public XQServiceProvider, public CntAbstractServiceProvider +{ + Q_OBJECT +public: + CntServiceProviderFetch(CntServices& aServices, QObject *parent = 0); + ~CntServiceProviderFetch(); + +public slots: // operations offered to clients + + /** + * Opens contact selection view where multiple contacts can be selected. + * @param title The view title + * @param action Filter definition for filtering contacts based on supported action. Can be left empty. + */ + void multiFetch(const QString &title, + const QString &action ); + + /** + * Opens contact selection view where multiple contacts can be selected. + * @param title The view title + * @param action Filter definition for filtering contacts based on supported action. Can be left empty. + */ + void singleFetch(const QString &title, + const QString &action ); + +private: // from CntAbstractServiceProvider + void CompleteServiceAndCloseApp(const QVariant& retValue); + +private: + CntServices& mServices; + int mCurrentRequestIndex; +}; + +#endif /* CNTSERVICEPROVIDERFETCH_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceproviderold.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/inc/cntserviceproviderold.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CNTSERVICEPROVIDEROLD_H +#define CNTSERVICEPROVIDEROLD_H + +#include +#include +#include +#include + +#include "cntabstractserviceprovider.h" + +class CntServices; + +QTM_USE_NAMESPACE + +/*! + This class offers services through the old interface name & old signatures. +*/ +class CntServiceProviderOld : public XQServiceProvider, public CntAbstractServiceProvider +{ + Q_OBJECT +public: + CntServiceProviderOld(CntServices& aServices, QObject *parent = 0); + ~CntServiceProviderOld(); + +public slots: // operations offered to clients + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * multiFetch(QString, QString, QString) + * com.nokia.symbian.IContactFetch. + */ + void fetch(const QString &title, + const QString &action, + const QString &filter); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * singleFetch(QString, QString, QString) + * com.nokia.symbian.IContactFetch. + */ + void Dofetch(const QString &title, + const QString &action, + const QString &filter, + const QString &mode = KCntNoSelectionMode); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * editCreateNew(QString, QString) + * com.nokia.symbian.IContactEdit + */ + void editCreateNew(const QString& definitionName, const QString& value); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * editCreateNewFromVCard(QString) + * com.nokia.symbian.IContactEdit + */ + void editCreateNew(const QString& vCardFile); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * editUpdateExisting(QString, QString) + * com.nokia.symbian.IContactEdit + */ + void editUpdateExisting(const QString& definitionName, const QString& value); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * openContactCard(int contactId) + * com.nokia.symbian.IContactView + */ + void open(int contactId); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * openContactCard(QString, QString) + * com.nokia.symbian.IContactView + */ + void open(const QString& definitionName, const QString& value); + +private: // from CntAbstractServiceProvider + void CompleteServiceAndCloseApp(const QVariant& retValue); + +private: + CntServices& mServices; + int mCurrentRequestIndex; +}; + +#endif /* CNTSERVICEPROVIDEROLD_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceproviderold2.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/inc/cntserviceproviderold2.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CNTSERVICEPROVIDEROLD2_H +#define CNTSERVICEPROVIDEROLD2_H + +#include +#include +#include +#include + +#include "cntabstractserviceprovider.h" + +class CntServices; + +QTM_USE_NAMESPACE + +/*! + This class offers services through the old interface name & old signatures. +*/ +class CntServiceProviderOld2 : public XQServiceProvider, public CntAbstractServiceProvider +{ + Q_OBJECT +public: + CntServiceProviderOld2(CntServices& aServices, QObject *parent = 0); + ~CntServiceProviderOld2(); + +public slots: // operations offered to clients + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * multiFetch(QString, QString, QString) + * com.nokia.symbian.IContactFetch. + */ + void fetch(const QString &title, + const QString &action, + const QString &filter); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * singleFetch(QString, QString, QString) + * com.nokia.symbian.IContactFetch. + */ + void Dofetch(const QString &title, + const QString &action, + const QString &filter, + const QString &mode = KCntNoSelectionMode); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * editCreateNew(QString, QString) + * com.nokia.symbian.IContactEdit + */ + void editCreateNew(const QString& definitionName, const QString& value); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * editCreateNewFromVCard(QString) + * com.nokia.symbian.IContactEdit + */ + void editCreateNew(const QString& vCardFile); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * editUpdateExisting(QString, QString) + * com.nokia.symbian.IContactEdit + */ + void editUpdateExisting(const QString& definitionName, const QString& value); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * openContactCard(int contactId) + * com.nokia.symbian.IContactView + */ + void open(int contactId); + + /** + * Interface name has changed (see other impl. class) + * @deprecated + * Replaced with: + * openContactCard(QString, QString) + * com.nokia.symbian.IContactView + */ + void open(const QString& definitionName, const QString& value); + +private: // from CntAbstractServiceProvider + void CompleteServiceAndCloseApp(const QVariant& retValue); + +private: + CntServices& mServices; + int mCurrentRequestIndex; +}; + +#endif /* CNTSERVICEPROVIDEROLD2_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceproviderviewing.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/inc/cntserviceproviderviewing.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This class offers contact viewing UI services. + * + */ + +#ifndef CNTSERVICEPROVIDERVIEW_H +#define CNTSERVICEPROVIDERVIEW_H + +#include +#include +#include +#include + +#include "cntabstractserviceprovider.h" + +class CntServices; + +QTM_USE_NAMESPACE + +/*! + This class offers contact viewing UI services. +*/ +class CntServiceProviderViewing : public XQServiceProvider, public CntAbstractServiceProvider +{ + Q_OBJECT +public: + CntServiceProviderViewing(CntServices& aServices, QObject *parent = 0); + ~CntServiceProviderViewing(); + +public slots: // operations offered to clients + + /** + * Opens Contact Card. + * @param aContactId + */ + void openContactCard( int aContactId ); + + /** + * Opens Contact Card for non-saved contact which is not saved yet. + * @param aFieldName + * @param aValue The value for the field. + */ + void openTemporaryContactCard( QString aFieldName, QString aFieldValue ); + +private: // from CntAbstractServiceProvider + void CompleteServiceAndCloseApp(const QVariant& retValue); + +private: + CntServices& mServices; + int mCurrentRequestIndex; +}; + +#endif /* CNTSERVICEPROVIDERVIEW_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntservices.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/inc/cntservices.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#ifndef CNTSERVICES_H +#define CNTSERVICES_H + +#include +#include + +#include "cntabstractserviceprovider.h" + +class CntAbstractViewManager; +class XQServiceProvider; + +QTM_USE_NAMESPACE + +class CntServices : public QObject, public CntAbstractServiceProvider +{ + Q_OBJECT + +public: + CntServices(); + ~CntServices(); + +public: + + void setViewManager( CntAbstractViewManager& aViewManager ); + + /** + * Opens contact selection view where multiple contacts can be selected. + * @param title The view title + * @param action Filter definition for filtering contacts based on supported action. Can be left empty. + * @param aServiceProvider The service provider + */ + void singleFetch(const QString &title, + const QString &action, + CntAbstractServiceProvider& aServiceProvider ); + + /** + * Opens contact selection view where multiple contacts can be selected. + * @param title The view title + * @param action Filter definition for filtering contacts based on supported action. Can be left empty. + * @param aServiceProvider The service provider + */ + void multiFetch(const QString &title, + const QString &action, + CntAbstractServiceProvider& aServiceProvider ); + + /** + * Launch editor for creating a new contact with a given detail. + * @param definitionName The field type + * @param value The value for the field. + * @param aServiceProvider The service provider + */ + void editCreateNew(const QString &definitionName, const QString &value, + CntAbstractServiceProvider& aServiceProvider ); + + /** + * Launch editor for creating a new contact based on vCard file indicated in arg. + * @param vCardFile The vCard file name and path. + * @param aServiceProvider The service provider + */ + void editCreateNewFromVCard(const QString &vCardFile, + CntAbstractServiceProvider& aServiceProvider ); + + /** + * User can first choose a contact, and then an editor is opened. + * A new detail is provided by caller and it will be prefilled in the editor. + * @param definitionName The field type + * @param value The value for the field. + * @param aServiceProvider The service provider + */ + void editUpdateExisting(const QString &definitionName, const QString &value, + CntAbstractServiceProvider& aServiceProvider ); + + /** + * Open the editor for an existing contact.' + * @param contactId + * @param aServiceProvider The service provider + */ + void editExisting(int contactId, + CntAbstractServiceProvider& aServiceProvider); + + /** + * Opens Contact Card. + * @param contactId The contact ID + * @param aServiceProvider The service provider + */ + void launchContactCard(int contactId, + CntAbstractServiceProvider& aServiceProvider ); + + /** + * Opens Contact Card for non-saved contact. + * @param definitionName Field name. + * @param value The field value. + * @param aServiceProvider The service provider + */ + void launchTemporaryContactCard(const QString &definitionName, const QString &value, + CntAbstractServiceProvider& aServiceProvider ); + + /** + * Set the flag that allows quiting the application explicitly + * using the quitApp slot. By default the value is always true. + */ + void setQuitable(bool quitable); + +public slots: + /** + * Quit the application + */ + void quitApp(); + +private: + void removeNotSupportedFields(QContact& contact); + void removeNotSupportedDetails(QContact& contact); + +private: // from CntAbstractServiceProvider + void CompleteServiceAndCloseApp(const QVariant& retValue); +private: + CntAbstractViewManager* mViewManager; // not owned + QStringList m_definitionNames; + CntAbstractServiceProvider* mCurrentProvider; // not owned + bool mIsQuitable; +}; + +#endif /* CNTSERVICES_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntservicestrings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/inc/cntservicestrings.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Contacts highway service interface strings. + * + */ + +#ifndef CNTSERVICESTRINGS_H +#define CNTSERVICESTRINGS_H + +// Full interface names. The beginning part "phonebookservices" is the service name. +#define KCntServiceInterfaceView "phonebookservices.com.nokia.symbian.IContactsView" +#define KCntServiceInterfaceFetch "phonebookservices.com.nokia.symbian.IContactsFetch" +#define KCntServiceInterfaceEdit "phonebookservices.com.nokia.symbian.IContactsEdit" + + +#endif /* CNTSERVICESTRINGS_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntservicesubeditview.h --- a/phonebookui/phonebookservices/inc/cntservicesubeditview.h Wed Jul 21 11:09:07 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef CNTSERVICESUBEDITVIEW_H -#define CNTSERVICESUBEDITVIEW_H - -#include -#include "cnteditview.h" - -class CntServiceHandler; - -class CntServiceSubEditView : public CntEditView -{ - -Q_OBJECT - -public: - - CntServiceSubEditView( CntServiceHandler *aServiceHandler ); - ~CntServiceSubEditView(); - - int viewId() const { return serviceSubEditView; } - -//public slots: -// void aboutToCloseView(); -// int handleExecutedCommand(QString aCommand, const QContact &aContact); -// void discardAllChanges(); - -private: - CntServiceHandler *mServiceHandler; - -}; - -#endif //CNTSERVICESUBEDITVIEW_H -// EOF diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceviewfactory.h --- a/phonebookui/phonebookservices/inc/cntserviceviewfactory.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/inc/cntserviceviewfactory.h Wed Jul 21 11:21:49 2010 +0300 @@ -21,18 +21,18 @@ #include "cntabstractviewfactory.h" class CntAbstractView; -class CntServiceHandler; +class CntAbstractServiceProvider; class CntServiceViewFactory : public CntDefaultViewFactory { public: - CntServiceViewFactory( CntServiceHandler* aService ); + CntServiceViewFactory( CntAbstractServiceProvider& aServiceProvider ); ~CntServiceViewFactory(); public: CntAbstractView* createView( int aViewId ); private: - CntServiceHandler* mService; + CntAbstractServiceProvider& mProvider; }; #endif /* CNTSERVICEVIEWFACTORY_H_ */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceviewmanager.h --- a/phonebookui/phonebookservices/inc/cntserviceviewmanager.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/inc/cntserviceviewmanager.h Wed Jul 21 11:21:49 2010 +0300 @@ -26,28 +26,17 @@ class CntBaseView; class CntServiceHandler; +class CntAbstractServiceProvider; class CntServiceViewManager : public CntDefaultViewManager { Q_OBJECT public: - CntServiceViewManager(HbMainWindow *mainWindow, CntServiceHandler *aHandler); + CntServiceViewManager(HbMainWindow *mainWindow, CntAbstractServiceProvider& aProvider ); ~CntServiceViewManager(); - -public slots: - void handleFetch(const QString &title, const QString &action, const QString &filter); - void launchFetch(const QString &title, const QString &action, const QString &filter, const QString &mode = KCntMultiSelectionMode); - void launchEditor(QContact contact); - void launchContactSelection(QContactDetail detail); - void launchContactCard(QContact contact); - void launchAssignContactCard(QContact contact, QContactDetail detail); - protected slots: virtual void closeApp(); - -private: - CntServiceHandler *mServiceHandler; }; #endif // CNTSERVICEVIEWMANAGER_H diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/inc/cntserviceviewparams.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/inc/cntserviceviewparams.h Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: View parameter constants used internally in phonebookservices. + * + */ + +#ifndef CNTSERVICEVIEWPARAMS_H +#define CNTSERVICEVIEWPARAMS_H + + +#include + +/// View parameters used inside phonebookservices. +enum CntServiceViewParams + { + /// Specifies the title string for a service view + KCntServiceViewParamTitle = ECustomParam + }; + + +#endif /* CNTSERVICEVIEWPARAMS_H */ diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/phonebookservices.pro --- a/phonebookui/phonebookservices/phonebookservices.pro Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/phonebookservices.pro Wed Jul 21 11:21:49 2010 +0300 @@ -23,35 +23,44 @@ INCLUDEPATH += ../../phonebookengines/cntimageutility/inc INCLUDEPATH += . \ - inc + inc \ + ../../inc INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE MOC_DIR = moc # Input -HEADERS += inc/cntservicemainwindow.h \ - inc/cntserviceviewmanager.h \ - inc/cntservicehandler.h \ +HEADERS += inc/cntserviceviewmanager.h \ + inc/cntserviceproviderold.h \ + inc/cntserviceproviderold2.h \ inc/cntservicecontactfetchview.h \ inc/cntservicecontactselectionview.h \ inc/cntserviceeditview.h \ inc/cntservicecontactcardview.h \ - inc/cntservicesubeditview.h \ inc/cntserviceassigncontactcardview.h \ - inc/cntserviceviewfactory.h + inc/cntserviceviewfactory.h \ + inc/cntservices.h \ + inc/cntabstractserviceprovider.h \ + inc/cntserviceproviderfetch.h \ + inc/cntserviceproviderviewing.h \ + inc/cntserviceprovideredit.h \ + inc/cntserviceviewparams.h SOURCES += src/main.cpp \ - src/cntservicemainwindow.cpp \ src/cntserviceviewmanager.cpp \ - src/cntservicehandler.cpp \ + src/cntserviceproviderold.cpp \ + src/cntserviceproviderold2.cpp \ src/cntservicecontactfetchview.cpp \ src/cntservicecontactselectionview.cpp \ src/cntserviceeditview.cpp \ src/cntservicecontactcardview.cpp \ - src/cntservicesubeditview.cpp \ src/cntserviceassigncontactcardview.cpp \ - src/cntserviceviewfactory.cpp + src/cntserviceviewfactory.cpp \ + src/cntservices.cpp \ + src/cntserviceproviderfetch.cpp \ + src/cntserviceproviderviewing.cpp \ + src/cntserviceprovideredit.cpp # capability TARGET.CAPABILITY = CAP_APPLICATION diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/service_conf.xml --- a/phonebookui/phonebookservices/service_conf.xml Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/service_conf.xml Wed Jul 21 11:21:49 2010 +0300 @@ -1,7 +1,32 @@ - - Phonebook service - + + phonebookservices + No path + xPhonebook services + + com.nokia.symbian.IContactsFetch + 1.0 + Fetch interface + + + phonebookservices.Fetch + 1.0 Fetch interface + + Fetch + 1.0 + Fetch interface + com.nokia.services.phonebookservices + + + com.nokia.symbian.IContactsView + 1.0 + Contact viewing interface + + + com.nokia.symbian.IContactsEdit + 1.0 + Contact editing interface + \ No newline at end of file diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntserviceassigncontactcardview.cpp --- a/phonebookui/phonebookservices/src/cntserviceassigncontactcardview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/src/cntserviceassigncontactcardview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -16,7 +16,8 @@ */ #include "cntserviceassigncontactcardview.h" -#include "cntservicehandler.h" +#include "cntabstractserviceprovider.h" +#include "cntdebug.h" #include #include @@ -32,14 +33,16 @@ Constructor, initialize member variables. \a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0) */ -CntServiceAssignContactCardView::CntServiceAssignContactCardView(CntServiceHandler *aServiceHandler) : +CntServiceAssignContactCardView::CntServiceAssignContactCardView( CntAbstractServiceProvider& aServiceProvider ) : CntContactCardView(), - mServiceHandler(aServiceHandler) +mProvider( aServiceProvider ) { + CNT_ENTRY connect(this, SIGNAL(backPressed()), this, SLOT(doCloseView())); connect(this, SIGNAL(viewActivated(CntAbstractViewManager*, QContactDetail)), this, SLOT(doViewActivated(CntAbstractViewManager*,QContactDetail))); addActionsToToolBar(); + CNT_EXIT } /*! @@ -47,7 +50,8 @@ */ CntServiceAssignContactCardView::~CntServiceAssignContactCardView() { - + CNT_ENTRY + CNT_EXIT } /*! @@ -55,9 +59,11 @@ */ void CntServiceAssignContactCardView::addActionsToToolBar() { + CNT_ENTRY view()->toolBar()->clearActions(); HbAction* addToContact = view()->toolBar()->addAction("txt_phob_button_add_to_contacts"); connect(addToContact, SIGNAL(triggered()), this, SLOT(addToContacts())); + CNT_EXIT } /*! @@ -65,6 +71,7 @@ */ void CntServiceAssignContactCardView::addToContacts() { + CNT_ENTRY HbDialog *popup = new HbDialog(); popup->setDismissPolicy(HbDialog::NoDismiss); popup->setHeadingWidget(new HbLabel(hbTrId("txt_phob_title_add_to_contacts"), popup)); @@ -82,6 +89,7 @@ popup->setContentWidget(buttonWidget); popup->setSecondaryAction(new HbAction(hbTrId("txt_common_button_cancel"), popup)); + CNT_EXIT } /*! @@ -89,12 +97,14 @@ */ void CntServiceAssignContactCardView::saveNew() { + CNT_ENTRY CntViewParameters viewParameters; viewParameters.insert(EViewId, serviceEditView); QVariant var; var.setValue(mContact); viewParameters.insert(ESelectedContact, var); mViewManager->changeView(viewParameters); + CNT_EXIT } /*! @@ -102,12 +112,14 @@ */ void CntServiceAssignContactCardView::updateExisting() { + CNT_ENTRY CntViewParameters viewParameters; viewParameters.insert(EViewId, serviceContactSelectionView); QVariant var; var.setValue(mDetail); viewParameters.insert(ESelectedDetail, var); mViewManager->changeView(viewParameters); + CNT_EXIT } /*! @@ -115,9 +127,11 @@ */ void CntServiceAssignContactCardView::doViewActivated(CntAbstractViewManager* aMgr, const CntViewParameters aArgs) { + CNT_ENTRY mViewManager = aMgr; mContact = aArgs.value(ESelectedContact).value(); mDetail = aArgs.value(ESelectedDetail).value(); + CNT_EXIT } /*! @@ -125,7 +139,9 @@ */ void CntServiceAssignContactCardView::doCloseView() { + CNT_ENTRY qApp->quit(); + CNT_EXIT } // end of file diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntservicecontactcardview.cpp --- a/phonebookui/phonebookservices/src/cntservicecontactcardview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/src/cntservicecontactcardview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -16,18 +16,20 @@ */ #include "cntservicecontactcardview.h" -#include "cntservicehandler.h" -#include +#include "cntabstractserviceprovider.h" +#include "cntdebug.h" /*! Constructor, initialize member variables. \a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0) */ -CntServiceContactCardView::CntServiceContactCardView(CntServiceHandler *aServiceHandler) : +CntServiceContactCardView::CntServiceContactCardView( CntAbstractServiceProvider& aServiceProvider ) : CntContactCardView(), - mServiceHandler(aServiceHandler) + mProvider( aServiceProvider ) { - connect(this, SIGNAL(backPressed()), this, SLOT(doShowPreviousView())); + CNT_ENTRY + connect(this, SIGNAL(backPressed()), this, SLOT(closeContactCard())); + CNT_EXIT } /*! @@ -35,17 +37,21 @@ */ CntServiceContactCardView::~CntServiceContactCardView() { - + CNT_ENTRY + CNT_EXIT } /*! Close the view (quits the service as well) */ -void CntServiceContactCardView::doShowPreviousView() +void CntServiceContactCardView::closeContactCard() { - int result = -2; - connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); - mServiceHandler->completeEdit(result); + CNT_ENTRY + int retValue = -2; // Dummy return value. Not relevant. + QVariant variant; + variant.setValue(retValue); + mProvider.CompleteServiceAndCloseApp(variant); + CNT_EXIT } // end of file diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntservicecontactfetchview.cpp --- a/phonebookui/phonebookservices/src/cntservicecontactfetchview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/src/cntservicecontactfetchview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -19,7 +19,7 @@ #include #include -#include "cntservicehandler.h" +#include "cntserviceviewparams.h" #include #include @@ -29,15 +29,15 @@ #include -CntServiceContactFetchView::CntServiceContactFetchView(CntServiceHandler *aServiceHandler): +CntServiceContactFetchView::CntServiceContactFetchView( CntAbstractServiceProvider& aServiceProvider ): CntBaseSelectionView(), -mServiceHandler(aServiceHandler) -{ +mProvider( aServiceProvider ) + { HbAction* cancel = static_cast( mDocument->findObject( "cnt:cancel" ) ); mView->menu()->addAction( cancel ); connect(cancel, SIGNAL(triggered()), this, SLOT(cancelFetch()) ); - connect( this, SIGNAL(viewClosed()), this, SLOT(aboutToCloseView()) ); + connect( this, SIGNAL(viewClosed()), this, SLOT(closeFetchView()) ); connect( this, SIGNAL(viewOpened(CntAbstractViewManager*, const CntViewParameters)), this, SLOT(aboutToOpenView(CntAbstractViewManager*, const CntViewParameters)) ); } @@ -47,13 +47,16 @@ void CntServiceContactFetchView::cancelFetch() -{ - connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + { CntServicesContactList serviceList; - mServiceHandler->completeFetch(serviceList); -} + QVariant variant; + variant.setValue(serviceList); + mProvider.CompleteServiceAndCloseApp(variant); + } -void CntServiceContactFetchView::aboutToCloseView() + + +void CntServiceContactFetchView::closeFetchView() { CntServicesContactList serviceList; QContactManager* mgr = mMgr->contactManager(SYMBIAN_BACKEND); @@ -90,8 +93,9 @@ serviceList.append(servicesContact); } - connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); - mServiceHandler->completeFetch(serviceList); + QVariant variant; + variant.setValue(serviceList); + mProvider.CompleteServiceAndCloseApp(variant); } void CntServiceContactFetchView::aboutToOpenView(CntAbstractViewManager* aMgr, const CntViewParameters aArgs) @@ -99,12 +103,17 @@ mMgr = aMgr; // Set title of the view. - QString title = aArgs.value(CntServiceHandler::ETitle).toString(); + QString title = aArgs.value(KCntServiceViewParamTitle).toString(); mView->setTitle(title); // Set action filter - QString filter = aArgs.value(CntServiceHandler::EFilter).toString(); - QString action = aArgs.value(CntServiceHandler::EAction).toString(); + QString action = aArgs.value(ESelectedAction).toString(); + // ESelectedAction is defined in cntviewparams.h + + // Has never been implemented. + //QString filterStr = aArgs.value(KCntServiceViewParamFilter).toString(); + // KCntServiceViewParamFilter is defined in cntserviceviewparams.h + if (action == KCntActionSms) { QContactActionFilter actionFilter; diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntservicecontactselectionview.cpp --- a/phonebookui/phonebookservices/src/cntservicecontactselectionview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/src/cntservicecontactselectionview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -17,15 +17,15 @@ #include "cntservicecontactselectionview.h" +#include #include #include -#include "cntservicehandler.h" #include #include -CntServiceContactSelectionView::CntServiceContactSelectionView(CntServiceHandler *aServiceHandler): +CntServiceContactSelectionView::CntServiceContactSelectionView( CntAbstractServiceProvider& aServiceProvider ): CntBaseSelectionView(), -mServiceHandler(aServiceHandler) +mProvider( aServiceProvider ) { connect(mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(onListViewActivated(const QModelIndex&))); connect( this, SIGNAL(viewClosed()), this, SLOT(aboutToCloseView()) ); @@ -37,6 +37,7 @@ } +// An item in the selection list has been clicked void CntServiceContactSelectionView::onListViewActivated(const QModelIndex &aIndex) { QContact contact = mListModel->contact(aIndex); @@ -52,8 +53,9 @@ void CntServiceContactSelectionView::aboutToCloseView() { - connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); - mServiceHandler->completeEdit(0); + QVariant variant; + variant.setValue(KCntServicesReturnValueContactNotModified); + mProvider.CompleteServiceAndCloseApp(variant); } void CntServiceContactSelectionView::aboutToOpenView(CntAbstractViewManager* aMgr, const CntViewParameters viewParameters) diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntserviceeditview.cpp --- a/phonebookui/phonebookservices/src/cntserviceeditview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/src/cntserviceeditview.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -16,11 +16,13 @@ */ #include "cntserviceeditview.h" -#include "cntservicehandler.h" +#include #include -CntServiceEditView::CntServiceEditView(CntServiceHandler *aServiceHandler ) : CntEditView(), -mServiceHandler(aServiceHandler) + +CntServiceEditView::CntServiceEditView( CntAbstractServiceProvider& aServiceProvider ) +: CntEditView(), +mProvider( aServiceProvider ) { connect( this, SIGNAL(contactUpdated(int)), this, SLOT(doContactUpdated(int)) ); connect( this, SIGNAL(contactRemoved(bool)), this, SLOT(doContactRemoved(bool)) ); @@ -33,67 +35,25 @@ void CntServiceEditView::doContactUpdated(int aSuccess) { - connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); - mServiceHandler->completeEdit(aSuccess); + int retValue = aSuccess ? KCntServicesReturnValueContactSaved : KCntServicesReturnValueContactNotModified; + QVariant variant; + variant.setValue(retValue); + mProvider.CompleteServiceAndCloseApp(variant); } void CntServiceEditView::doContactRemoved(bool aSuccess) { - connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); - int retValue = aSuccess ? -1 : 0; - mServiceHandler->completeEdit(retValue); + int retValue = aSuccess ? KCntServicesReturnValueContactDeleted : KCntServicesReturnValueContactNotModified; + QVariant variant; + variant.setValue(retValue); + mProvider.CompleteServiceAndCloseApp(variant); } void CntServiceEditView::doChangesDiscarded() { - connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); - mServiceHandler->completeEdit(0); + QVariant variant; + variant.setValue(KCntServicesReturnValueContactNotModified); + mProvider.CompleteServiceAndCloseApp(variant); } -// -///*! -//Saves the contact -//*/ -//void CntServiceEditView::aboutToCloseView() -//{ -// int result = 0; -// // save contact if there is one -// if (contact() && !contact()->isEmpty()) -// { -// bool isSaved = contactManager()->saveContact(contact()); -// if (isSaved) -// { -// result = 1; -// } -// } -// -// connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); -// mServiceHandler->completeEdit(result); -//} -// -///*! -//Cancel all changes made and return to the application editor was opened from -//*/ -//void CntServiceEditView::discardAllChanges() -//{ -// connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); -// mServiceHandler->completeEdit(0); -//} -// -///* -//Handle signals emitted from CntCommands, only used for delete command for now. -//*/ -//int CntServiceEditView::handleExecutedCommand(QString aCommand, const QContact &aContact) -//{ -// Q_UNUSED(aContact); -// int result=-1; -// if (aCommand == "delete") -// { -// connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); -// mServiceHandler->completeEdit(result); -// result = 0; -// } -// return result; -//} - // EOF diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntservicehandler.cpp --- a/phonebookui/phonebookservices/src/cntservicehandler.cpp Wed Jul 21 11:09:07 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,351 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ - -#include "cntservicehandler.h" -#include "cntimageutility.h" - -#include -#include -#include - -#include -#include -#include - -/* NOTE! THIS SERVICE WILL BE RENAMED TO com.nokia.services.phonebook.Services */ -CntServiceHandler::CntServiceHandler(QObject *parent): - XQServiceProvider(QLatin1String("com.nokia.services.phonebookservices.Fetch"), parent), - mCurrentRequestIndex(0) -{ - publishAll(); - - // Definition names supported in symbian back-end - m_definitionNames << QContactName::DefinitionName; - m_definitionNames << QContactNickname::DefinitionName; - m_definitionNames << QContactPhoneNumber::DefinitionName; - m_definitionNames << QContactEmailAddress::DefinitionName; - m_definitionNames << QContactAddress::DefinitionName; - m_definitionNames << QContactUrl::DefinitionName; - m_definitionNames << QContactBirthday::DefinitionName; - m_definitionNames << QContactOrganization::DefinitionName; - m_definitionNames << QContactSyncTarget::DefinitionName; - m_definitionNames << QContactNote::DefinitionName; - m_definitionNames << QContactFamily::DefinitionName; - m_definitionNames << QContactAvatar::DefinitionName; - m_definitionNames << QContactAnniversary::DefinitionName; - m_definitionNames << QContactGeoLocation::DefinitionName; - m_definitionNames << QContactGender::DefinitionName; - m_definitionNames << QContactOnlineAccount::DefinitionName; -} - -CntServiceHandler::~CntServiceHandler() -{ -} - -/* -Complete the fetch and return the list selected contacts -*/ -void CntServiceHandler::completeFetch( const CntServicesContactList &contactList ) -{ - QVariant retValue; - retValue.setValue(contactList); - completeRequest(mCurrentRequestIndex, retValue); - mCurrentRequestIndex = 0; -} - -/* -Complete edit and return if contact wasn't modified (-2), was deleted (-1), saved (1) or if saving failed (0) -*/ -void CntServiceHandler::completeEdit(int result) -{ - QVariant retValue(result); - completeRequest(mCurrentRequestIndex, retValue); - mCurrentRequestIndex = 0; -} - -/* -Launch fetch service with given parameters -*/ -void CntServiceHandler::fetch(const QString &title, const QString &action, const QString &filter) -{ - emit launchFetch(title, action, filter); - mCurrentRequestIndex = setCurrentRequestAsync(); -} - -/* -Launch fetch service with given parameters. Fetching mode is No-select by default. -*/ -void CntServiceHandler::Dofetch(const QString &title, const QString &action, const QString &filter, const QString &mode) -{ - emit launchFetchVerified(title, action, filter, mode); - mCurrentRequestIndex = setCurrentRequestAsync(); -} - -/* -Launch new contact editor with a given detail -*/ -void CntServiceHandler::editCreateNew(const QString &definitionName, const QString &value) -{ - QContact contact; - - if (definitionName == QContactPhoneNumber::DefinitionName) - { - QContactPhoneNumber phoneNumber; - phoneNumber.setNumber(value); - phoneNumber.setSubTypes(QContactPhoneNumber::SubTypeMobile); - contact.saveDetail(&phoneNumber); - } - else if (definitionName == QContactEmailAddress::DefinitionName) - { - QContactEmailAddress email; - email.setEmailAddress(value); - contact.saveDetail(&email); - } - else if (definitionName == QContactOnlineAccount::DefinitionName) - { - QContactOnlineAccount account; - account.setAccountUri(value); - account.setSubTypes(QContactOnlineAccount::SubTypeSipVoip); - contact.saveDetail(&account); - } - - emit launchEditor(contact); - - mCurrentRequestIndex = setCurrentRequestAsync(); -} - -/* -Launch new contact editor with a given vCard filename -*/ -void CntServiceHandler::editCreateNew(const QString &vCardFile) -{ - CntImageUtility imageUtility; - QContact contact; - QVersitReader reader; - QFile file(vCardFile); - - if (!file.open(QIODevice::ReadOnly)) - return; - reader.setDevice(&file); - reader.startReading(); - reader.waitForFinished(); - - // Use the resulting document(s)... - QVersitContactImporter importer; - QList versitDocuments = reader.results(); - if (versitDocuments.count() > 0 - && importer.importDocuments(versitDocuments)) - { - QList contacts = importer.contacts(); - if (contacts.count() > 0) - contact = contacts.first(); - } - file.close(); - - // Save thumbnail images - QList details = contact.details(); - for (int i = 0;i < details.count();i++) - { - if (!details.at(i).thumbnail().isNull()) - { - QString imagepath; - QPixmap pixmap = QPixmap::fromImage(details.at(i).thumbnail()); - if (imageUtility.createImage(pixmap,imagepath)) - { - // Update contact detail - QContactAvatar detail=details.at(i); - detail.setImageUrl(imagepath); - contact.saveDetail(&detail); - } - } - } - - removeNotSupportedDetails(contact); - removeNotSupportedFields(contact); - emit launchEditor(contact); - - mCurrentRequestIndex = setCurrentRequestAsync(); -} - -/* -* Remove details not supported in symbian back-end. -*/ -void CntServiceHandler::removeNotSupportedDetails(QContact& contact) -{ - // Check definition map, remove details not supported - for (int i=0; i < contact.details().count(); i++) - { - if (!m_definitionNames.contains(contact.details().at(i).definitionName())) - { - QContactDetail detail= contact.details().at(i); - contact.removeDetail(&detail); - } - } -} -/* -* Remove fields not supported in symbian back-end. -*/ -void CntServiceHandler::removeNotSupportedFields(QContact& contact) -{ - QContactManager cm("symbian"); - - // Not all fields are supported in symbian back-end - // Remove not supported fields - for (int i=0; i < contact.details().count(); i++) - { - QContactDetail detail = contact.details().at(i); - if (detail.definitionName() == QContactAddress::DefinitionName) - { - QContactAddress addrDetail = static_cast(detail); - - // Sub-types not supported - if (detail.removeValue(QContactAddress::FieldSubTypes)) - contact.saveDetail(&detail); - } - else if (detail.definitionName() == QContactAnniversary::DefinitionName) - { - QContactAnniversary annivDetail = static_cast(detail); - - // Sub-types not supported - if (detail.removeValue(QContactAnniversary::FieldSubType)) - contact.saveDetail(&detail); - - // Context not supported - if (detail.removeValue(QContactDetail::FieldContext)) - contact.saveDetail(&detail); - } - else if (detail.definitionName() == QContactPhoneNumber::DefinitionName) - { - QContactPhoneNumber phoneDetail = static_cast(detail); - - if (phoneDetail.subTypes().size() == 0) - { - // No Sub-type found, set as SubTypeMobile - phoneDetail.setSubTypes(QContactPhoneNumber::SubTypeMobile); - contact.saveDetail(&phoneDetail); - } - else if (phoneDetail.subTypes().size() > 0 ) - { - // Sub-types not supported - if (phoneDetail.subTypes().contains(QContactPhoneNumber::SubTypeVoice) - || phoneDetail.subTypes().contains(QContactPhoneNumber::SubTypeMessagingCapable) - || phoneDetail.subTypes().contains(QContactPhoneNumber::SubTypeVideo)) - { - // Replace as SubTypeMobile - phoneDetail.setSubTypes(QContactPhoneNumber::SubTypeMobile); - contact.saveDetail(&phoneDetail); - } - } - } - else if (detail.definitionName() == QContactUrl::DefinitionName) - { - QContactUrl urlDetail = static_cast(detail); - - QString stype=QContactUrl::SubTypeHomePage; - if (urlDetail.subType().compare(stype) != 0) - { - detail.removeValue(QContactUrl::FieldSubType); - contact.saveDetail(&detail); - } - } - } -} -/* -Launch contact selection view with a given detail (selecting detail there opens the editor and adds the new detail) -*/ -void CntServiceHandler::editUpdateExisting(const QString &definitionName, const QString &value) -{ - QContactDetail detail; - - if (definitionName == QContactPhoneNumber::DefinitionName) - { - QContactPhoneNumber phoneNumber; - phoneNumber.setNumber(value); - phoneNumber.setSubTypes(QContactPhoneNumber::SubTypeMobile); - detail = phoneNumber; - } - else if (definitionName == QContactEmailAddress::DefinitionName) - { - QContactEmailAddress email; - email.setEmailAddress(value); - detail = email; - } - else if (definitionName == QContactOnlineAccount::DefinitionName) - { - QContactOnlineAccount account; - account.setAccountUri(value); - account.setSubTypes(QContactOnlineAccount::SubTypeSipVoip); - detail = account; - } - - emit launchContactSelection(detail); - - mCurrentRequestIndex = setCurrentRequestAsync(); -} - -/* -Launch communication launcher view for the contact with the given ID (QContactLocalId -> int) -*/ -void CntServiceHandler::open(int contactId) -{ - QContactManager manager("symbian"); - QContact contact = manager.contact(contactId); - - emit launchContactCard(contact); - - mCurrentRequestIndex = setCurrentRequestAsync(); -} - -/* -Launch temporary communication launcher view with the given detail -*/ -void CntServiceHandler::open(const QString &definitionName, const QString &value) -{ - QContact contact; - QContactDetail detail; - - if (definitionName == QContactPhoneNumber::DefinitionName) - { - QContactPhoneNumber phoneNumber; - phoneNumber.setNumber(value); - phoneNumber.setSubTypes(QContactPhoneNumber::SubTypeMobile); - contact.saveDetail(&phoneNumber); - detail = phoneNumber; - } - else if (definitionName == QContactEmailAddress::DefinitionName) - { - QContactEmailAddress email; - email.setEmailAddress(value); - contact.saveDetail(&email); - detail = email; - } - else if (definitionName == QContactOnlineAccount::DefinitionName) - { - QContactOnlineAccount account; - account.setAccountUri(value); - account.setSubTypes(QContactOnlineAccount::SubTypeSipVoip); - contact.saveDetail(&account); - detail = account; - } - - emit launchAssignContactCard(contact, detail); - - mCurrentRequestIndex = setCurrentRequestAsync(); -} - -Q_IMPLEMENT_USER_METATYPE(CntServicesContact) -Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList) diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntservicemainwindow.cpp --- a/phonebookui/phonebookservices/src/cntservicemainwindow.cpp Wed Jul 21 11:09:07 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "cntservicemainwindow.h" -#include "cntservicehandler.h" -#include "cntserviceviewmanager.h" -#include "cntviewnavigator.h" - -CntServiceMainWindow::CntServiceMainWindow(CntServiceHandler *handler, QWidget *parent): - CntMainWindow(parent, noView), - mServiceHandler(handler), - mServiceViewManager(0) -{ - CntViewNavigator* navigator = new CntViewNavigator( this ); - navigator->addException( serviceEditView, noView ); - - mServiceViewManager = new CntServiceViewManager(this, mServiceHandler); - mServiceViewManager->setViewNavigator( navigator ); -} - -CntServiceMainWindow::~CntServiceMainWindow() -{ - delete mServiceViewManager; - mServiceViewManager = 0; - delete mServiceHandler; - mServiceHandler = 0; -} - -// end of file diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntserviceprovideredit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/src/cntserviceprovideredit.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This class offers contact viewing UI services. + * + */ + +#include "cntserviceprovideredit.h" +#include "cntservices.h" +#include "cntservicestrings.h" +#include "cntdebug.h" + +#include +#include +#include +#include + +CntServiceProviderEdit::CntServiceProviderEdit(CntServices& aServices, QObject *parent): + XQServiceProvider(QLatin1String(KCntServiceInterfaceEdit), parent), + mServices(aServices), + mCurrentRequestIndex(0) +{ + CNT_ENTRY + publishAll(); + connect(this, SIGNAL(clientDisconnected()), &mServices, SLOT(quitApp())); + CNT_EXIT +} + +CntServiceProviderEdit::~CntServiceProviderEdit() +{ + CNT_ENTRY + CNT_EXIT +} + +void CntServiceProviderEdit::editCreateNew(const QString& definitionName, const QString& value) + { + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editCreateNew( definitionName, value, *this ); + CNT_EXIT + } + +void CntServiceProviderEdit::editCreateNewFromVCard(const QString &vCardFile) + { + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editCreateNewFromVCard( vCardFile, *this ); + CNT_EXIT + } + +void CntServiceProviderEdit::editExisting(int contactId) + { + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editExisting( contactId, *this ); + CNT_EXIT + } + +void CntServiceProviderEdit::editUpdateExisting(const QString &definitionName, const QString &value) + { + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editUpdateExisting( definitionName, value, *this ); + CNT_EXIT + } + + +void CntServiceProviderEdit::CompleteServiceAndCloseApp(const QVariant& retValue) + { + CNT_ENTRY + connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + if ( mCurrentRequestIndex != 0 ) + { + const bool success = completeRequest(mCurrentRequestIndex, retValue); + if ( !success ) + { + CNT_LOG_ARGS("Failed to complete highway request."); + } + mCurrentRequestIndex = 0; + } + CNT_EXIT + } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntserviceproviderfetch.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/src/cntserviceproviderfetch.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cntserviceproviderfetch.h" +#include "cntservices.h" +#include "cntservicestrings.h" +#include "cntdebug.h" + +#include +#include +#include +#include + +CntServiceProviderFetch::CntServiceProviderFetch(CntServices& aServices, QObject *parent): + XQServiceProvider(QLatin1String(KCntServiceInterfaceFetch), parent), + mServices(aServices), + mCurrentRequestIndex(0) +{ + CNT_ENTRY + publishAll(); + connect(this, SIGNAL(clientDisconnected()), &mServices, SLOT(quitApp())); + CNT_EXIT +} + +CntServiceProviderFetch::~CntServiceProviderFetch() +{ + CNT_ENTRY + CNT_EXIT +} + +void CntServiceProviderFetch::multiFetch(const QString &title, const QString &action ) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.multiFetch( title, action, *this ); + CNT_EXIT +} + +void CntServiceProviderFetch::singleFetch(const QString &title, const QString &action ) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.singleFetch( title, action, *this ); + CNT_EXIT +} + +void CntServiceProviderFetch::CompleteServiceAndCloseApp(const QVariant& retValue) +{ + CNT_ENTRY + connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + if ( mCurrentRequestIndex != 0 ) + { + const bool success = completeRequest(mCurrentRequestIndex, retValue); + if ( !success ) + { + CNT_LOG_ARGS("Failed to complete highway request."); + } + mCurrentRequestIndex = 0; + } + CNT_EXIT +} + diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntserviceproviderold.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/src/cntserviceproviderold.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cntserviceproviderold.h" +#include "cntservices.h" +#include "cntdebug.h" + +#include +#include +#include +#include + +CntServiceProviderOld::CntServiceProviderOld(CntServices& aServices, QObject *parent): + XQServiceProvider(QLatin1String("com.nokia.services.phonebookservices.Fetch"), parent), + mServices(aServices), + mCurrentRequestIndex(0) +{ + CNT_ENTRY + publishAll(); + connect(this, SIGNAL(clientDisconnected()), &mServices, SLOT(quitApp())); + CNT_EXIT +} + +CntServiceProviderOld::~CntServiceProviderOld() +{ + CNT_ENTRY + CNT_EXIT +} + +/*! +Launch fetch service with given parameters. OLD INTERFACE. +*/ +void CntServiceProviderOld::fetch(const QString &title, const QString &action, const QString& /*filter*/) +{ + CNT_ENTRY + // Ignore the filter parameter + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.multiFetch( title, action, *this ); + CNT_EXIT +} + + +/* +Launch fetch service with given parameters. Fetching mode is No-select by default. OLD INTERFACE. +*/ +void CntServiceProviderOld::Dofetch(const QString &title, const QString &action, const QString& /*filter*/, const QString& /*mode*/) +{ + CNT_ENTRY + // Ignore the filter parameter + // Ignoring fourth argument, because it's not needed. DoFetch() by old contract is only for single-fetching. + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.singleFetch( title, action, *this ); + CNT_EXIT +} + + +/* +Launch new contact editor with a given detail +*/ +void CntServiceProviderOld::editCreateNew(const QString& definitionName, const QString& value) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editCreateNew( definitionName, value, *this ); + CNT_EXIT +} + +void CntServiceProviderOld::editCreateNew(const QString &vCardFile) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editCreateNewFromVCard( vCardFile, *this ); + CNT_EXIT +} + + +/*! +Launch contact selection view with a given detail (selecting detail there opens the editor and adds the new detail) +*/ +void CntServiceProviderOld::editUpdateExisting(const QString &definitionName, const QString &value) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editUpdateExisting( definitionName, value, *this ); + CNT_EXIT +} + + +/*! +Launch communication launcher view for the contact with the given ID (QContactLocalId -> int) +*/ +void CntServiceProviderOld::open(int contactId) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.launchContactCard( contactId, *this ); + CNT_EXIT +} + +/*! + Launch temporary communication launcher view with the given detail. +*/ +void CntServiceProviderOld::open(const QString &definitionName, const QString &value) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.launchTemporaryContactCard( definitionName, value, *this ); // definitionName = field type value = actual field value for prefilling editor + CNT_EXIT +} + + +void CntServiceProviderOld::CompleteServiceAndCloseApp(const QVariant& retValue) +{ + CNT_ENTRY + connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + if ( mCurrentRequestIndex != 0 ) + { + const bool success = completeRequest(mCurrentRequestIndex, retValue); + if ( !success ) + { + CNT_LOG_ARGS("Failed to complete highway request."); + } + mCurrentRequestIndex = 0; + } + CNT_EXIT +} + +// end of file diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntserviceproviderold2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/src/cntserviceproviderold2.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cntserviceproviderold2.h" +#include "cntservices.h" +#include "cntdebug.h" + +#include +#include +#include +#include + +CntServiceProviderOld2::CntServiceProviderOld2(CntServices& aServices, QObject *parent): + XQServiceProvider(QLatin1String("phonebookservices.Fetch"), parent), + mServices(aServices), + mCurrentRequestIndex(0) +{ + CNT_ENTRY + publishAll(); + connect(this, SIGNAL(clientDisconnected()), &mServices, SLOT(quitApp())); + CNT_EXIT +} + +CntServiceProviderOld2::~CntServiceProviderOld2() +{ + CNT_ENTRY + CNT_EXIT +} + +/*! +Launch fetch service with given parameters. OLD INTERFACE. +*/ +void CntServiceProviderOld2::fetch(const QString &title, const QString &action, const QString& /*filter*/) +{ + CNT_ENTRY + // Ignore the filter parameter + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.multiFetch( title, action, *this ); + CNT_EXIT +} + + +/* +Launch fetch service with given parameters. Fetching mode is No-select by default. OLD INTERFACE. +*/ +void CntServiceProviderOld2::Dofetch(const QString &title, const QString &action, const QString& /*filter*/, const QString& /*mode*/) +{ + CNT_ENTRY + // Ignore the filter parameter + // Ignoring fourth argument, because it's not needed. DoFetch() by old contract is only for single-fetching. + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.singleFetch( title, action, *this ); + CNT_EXIT +} + + +/* +Launch new contact editor with a given detail +*/ +void CntServiceProviderOld2::editCreateNew(const QString& definitionName, const QString& value) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editCreateNew( definitionName, value, *this ); +} + +void CntServiceProviderOld2::editCreateNew(const QString &vCardFile) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editCreateNewFromVCard( vCardFile, *this ); + CNT_EXIT +} + + +/*! +Launch contact selection view with a given detail (selecting detail there opens the editor and adds the new detail) +*/ +void CntServiceProviderOld2::editUpdateExisting(const QString &definitionName, const QString &value) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.editUpdateExisting( definitionName, value, *this ); + CNT_EXIT +} + + +/*! +Launch communication launcher view for the contact with the given ID (QContactLocalId -> int) +*/ +void CntServiceProviderOld2::open(int contactId) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.launchContactCard( contactId, *this ); + CNT_EXIT +} + +/*! + Launch temporary communication launcher view with the given detail. +*/ +void CntServiceProviderOld2::open(const QString &definitionName, const QString &value) +{ + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.launchTemporaryContactCard( definitionName, value, *this ); // definitionName = field type value = actual field value for prefilling editor + CNT_EXIT +} + + +void CntServiceProviderOld2::CompleteServiceAndCloseApp(const QVariant& retValue) +{ + CNT_ENTRY + connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + if ( mCurrentRequestIndex != 0 ) + { + CNT_LOG_ARGS("next, completing request.") + const bool success = completeRequest(mCurrentRequestIndex, retValue); + if ( !success ) + { + CNT_LOG_ARGS("Failed to complete highway request."); + } + mCurrentRequestIndex = 0; + } + CNT_EXIT +} + + +// end of file diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntserviceproviderviewing.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/src/cntserviceproviderviewing.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: This class offers contact viewing UI services. + * + */ + +#include "cntserviceproviderviewing.h" +#include "cntservices.h" +#include "cntservicestrings.h" +#include "cntdebug.h" + +#include +#include +#include +#include + +CntServiceProviderViewing::CntServiceProviderViewing(CntServices& aServices, QObject *parent): + XQServiceProvider(QLatin1String(KCntServiceInterfaceView), parent), + mServices(aServices), + mCurrentRequestIndex(0) +{ + CNT_ENTRY + publishAll(); + connect(this, SIGNAL(clientDisconnected()), &mServices, SLOT(quitApp())); + CNT_EXIT +} + +CntServiceProviderViewing::~CntServiceProviderViewing() +{ + CNT_ENTRY + CNT_EXIT +} + +void CntServiceProviderViewing::openContactCard( int aContactId ) + { + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.launchContactCard( aContactId, *this ); + CNT_EXIT + } + +void CntServiceProviderViewing::openTemporaryContactCard( QString aFieldName, QString aFieldValue ) + { + CNT_ENTRY + mCurrentRequestIndex = setCurrentRequestAsync(); + mServices.setQuitable(requestInfo().isEmbedded()); + mServices.launchTemporaryContactCard( aFieldName, aFieldValue, *this ); + CNT_EXIT + } + +void CntServiceProviderViewing::CompleteServiceAndCloseApp(const QVariant& retValue) + { + CNT_ENTRY + connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); + if ( mCurrentRequestIndex != 0 ) + { + const bool success = completeRequest(mCurrentRequestIndex, retValue); + if ( !success ) + { + CNT_LOG_ARGS("Failed to complete highway request."); + } + mCurrentRequestIndex = 0; + } + CNT_EXIT + } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntservices.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/phonebookservices/src/cntservices.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -0,0 +1,451 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: + * + */ + +#include "cntservices.h" +#include "cntglobal.h" +#include "cntdebug.h" +#include +#include "cntimageutility.h" +#include "cntserviceviewparams.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +CntServices::CntServices() : +mViewManager(NULL), +mCurrentProvider(NULL), +mIsQuitable(true) +{ + CNT_ENTRY + + // Definition names supported in symbian back-end + m_definitionNames << QContactName::DefinitionName; + m_definitionNames << QContactNickname::DefinitionName; + m_definitionNames << QContactPhoneNumber::DefinitionName; + m_definitionNames << QContactEmailAddress::DefinitionName; + m_definitionNames << QContactAddress::DefinitionName; + m_definitionNames << QContactUrl::DefinitionName; + m_definitionNames << QContactBirthday::DefinitionName; + m_definitionNames << QContactOrganization::DefinitionName; + m_definitionNames << QContactSyncTarget::DefinitionName; + m_definitionNames << QContactNote::DefinitionName; + m_definitionNames << QContactFamily::DefinitionName; + m_definitionNames << QContactAvatar::DefinitionName; + m_definitionNames << QContactAnniversary::DefinitionName; + m_definitionNames << QContactGeoLocation::DefinitionName; + m_definitionNames << QContactGender::DefinitionName; + m_definitionNames << QContactOnlineAccount::DefinitionName; + + CNT_EXIT +} + + +CntServices::~CntServices() +{ + CNT_LOG +} + + +void CntServices::setViewManager( CntAbstractViewManager& aViewManager ) +{ + CNT_LOG + mViewManager = &aViewManager; +} + + +void CntServices::singleFetch( + const QString &title, const QString &action, + CntAbstractServiceProvider& aServiceProvider ) +{ + CNT_ENTRY + mCurrentProvider = &aServiceProvider; + + CntViewParameters params; + params.insert(EViewId, serviceContactFetchView); + params.insert(ESelectedAction, action); + params.insert(KCntServiceViewParamTitle, title); + // SINGLE fetch + params.insert(ESelectionMode, HbAbstractItemView::SingleSelection); + + mViewManager->changeView(params); + CNT_EXIT +} + + +void CntServices::multiFetch( + const QString &title, const QString &action, + CntAbstractServiceProvider& aServiceProvider ) +{ + CNT_ENTRY + mCurrentProvider = &aServiceProvider; + + CntViewParameters params; + params.insert(EViewId, serviceContactFetchView); + params.insert(ESelectedAction, action); + params.insert(KCntServiceViewParamTitle, title); + // MULTI fetch + params.insert(ESelectionMode, HbAbstractItemView::MultiSelection); + mViewManager->changeView(params); + CNT_EXIT +} + + +void CntServices::editCreateNew(const QString &definitionName, const QString &value, + CntAbstractServiceProvider& aServiceProvider) +{ + CNT_ENTRY + mCurrentProvider = &aServiceProvider; + + QContact contact; + + if (definitionName == QContactPhoneNumber::DefinitionName) + { + QContactPhoneNumber phoneNumber; + phoneNumber.setNumber(value); + phoneNumber.setSubTypes(QContactPhoneNumber::SubTypeMobile); + contact.saveDetail(&phoneNumber); + } + else if (definitionName == QContactEmailAddress::DefinitionName) + { + QContactEmailAddress email; + email.setEmailAddress(value); + contact.saveDetail(&email); + } + else if (definitionName == QContactOnlineAccount::DefinitionName) + { + QContactOnlineAccount account; + account.setAccountUri(value); + account.setSubTypes(QContactOnlineAccount::SubTypeSipVoip); + contact.saveDetail(&account); + } + + // Launch editor now + CntViewParameters params; + params.insert(EViewId, serviceEditView); + QVariant var; + var.setValue(contact); + params.insert(ESelectedContact, var); + mViewManager->changeView(params); + CNT_EXIT +} + + +void CntServices::editCreateNewFromVCard(const QString &vCardFile, + CntAbstractServiceProvider& aServiceProvider ) +{ + CNT_ENTRY + mCurrentProvider = &aServiceProvider; + + CntImageUtility imageUtility; + QContact contact; + QVersitReader reader; + QFile file(vCardFile); + if (!file.open(QIODevice::ReadOnly)) + return; + reader.setDevice(&file); + + reader.startReading(); + reader.waitForFinished(); + // Use the resulting document(s)... + QVersitContactImporter importer; + QList versitDocuments = reader.results(); + if(versitDocuments.count() > 0 + && importer.importDocuments(versitDocuments)) + { + QList contacts = importer.contacts(); + if(contacts.count() > 0) + contact = contacts.first(); + } + file.close(); + + // Save thumbnail images + QList details = contact.details(); + for (int i = 0;i < details.count();i++) + { + if (!details.at(i).thumbnail().isNull()) + { + QString imagepath; + QPixmap pixmap = QPixmap::fromImage(details.at(i).thumbnail()); + if(imageUtility.createImage(pixmap,imagepath)) + { + // Update contact detail + QContactAvatar detail=details.at(i); + detail.setImageUrl(imagepath); + contact.saveDetail(&detail); + } + } + } + + removeNotSupportedDetails(contact); + removeNotSupportedFields(contact); + + // Launch editor now + CntViewParameters params; + params.insert(EViewId, serviceEditView); + QVariant var; + var.setValue(contact); + params.insert(ESelectedContact, var); + mViewManager->changeView(params); + CNT_EXIT +} + + +void CntServices::editUpdateExisting(const QString &definitionName, const QString &value, + CntAbstractServiceProvider& aServiceProvider ) +{ + CNT_ENTRY + mCurrentProvider = &aServiceProvider; + + QContactDetail detail; + + if (definitionName == QContactPhoneNumber::DefinitionName) + { + QContactPhoneNumber phoneNumber; + phoneNumber.setNumber(value); + phoneNumber.setSubTypes(QContactPhoneNumber::SubTypeMobile); + detail = phoneNumber; + } + else if (definitionName == QContactEmailAddress::DefinitionName) + { + QContactEmailAddress email; + email.setEmailAddress(value); + detail = email; + } + else if (definitionName == QContactOnlineAccount::DefinitionName) + { + QContactOnlineAccount account; + account.setAccountUri(value); + account.setSubTypes(QContactOnlineAccount::SubTypeSipVoip); + detail = account; + } + + CntViewParameters params; + params.insert(EViewId, serviceContactSelectionView); + QVariant var; + var.setValue(detail); + params.insert(ESelectedDetail, var); + mViewManager->changeView(params); + CNT_EXIT +} + +void CntServices::editExisting(int contactId, +CntAbstractServiceProvider& aServiceProvider) +{ + CNT_ENTRY + mCurrentProvider = &aServiceProvider; + + // Give parameters for launching editor. + CntViewParameters params; + params.insert(EViewId, serviceEditView); + + QContact contact = mViewManager->contactManager(SYMBIAN_BACKEND)->contact(contactId); + QVariant varContact; + varContact.setValue(contact); + params.insert(ESelectedContact, varContact); + mViewManager->changeView(params); + CNT_EXIT +} + + +void CntServices::launchContactCard(int aContactId, + CntAbstractServiceProvider& aServiceProvider ) +{ + CNT_ENTRY + mCurrentProvider = &aServiceProvider; + + QContactManager manager("symbian"); + QContact contact = manager.contact(aContactId); + + // Launch Contact Card view + CntViewParameters params; + params.insert(EViewId, serviceContactCardView); + QVariant var; + var.setValue(contact); + params.insert(ESelectedContact, var); + mViewManager->changeView( params ); + CNT_EXIT +} + + +void CntServices::launchTemporaryContactCard(const QString &definitionName, const QString &value, + CntAbstractServiceProvider& aServiceProvider ) +{ + CNT_ENTRY + mCurrentProvider = &aServiceProvider; + + QContact contact; + QContactDetail detail; + + if (definitionName == QContactPhoneNumber::DefinitionName) + { + QContactPhoneNumber phoneNumber; + phoneNumber.setNumber(value); + phoneNumber.setSubTypes(QContactPhoneNumber::SubTypeMobile); + contact.saveDetail(&phoneNumber); + detail = phoneNumber; + } + else if (definitionName == QContactEmailAddress::DefinitionName) + { + QContactEmailAddress email; + email.setEmailAddress(value); + contact.saveDetail(&email); + detail = email; + } + else if (definitionName == QContactOnlineAccount::DefinitionName) + { + QContactOnlineAccount account; + account.setAccountUri(value); + account.setSubTypes(QContactOnlineAccount::SubTypeSipVoip); + contact.saveDetail(&account); + detail = account; + } + + // Launch the view + CntViewParameters params; + params.insert(EViewId, serviceAssignContactCardView); + QVariant var; + var.setValue(contact); + params.insert(ESelectedContact, var); + QVariant varDetail; + varDetail.setValue(detail); + params.insert(ESelectedDetail, varDetail); + mViewManager->changeView(params); + CNT_EXIT +} + + +void CntServices::removeNotSupportedDetails(QContact& contact) +{ + CNT_ENTRY + // Check definition map, remove details not supported + for (int i=0; i < contact.details().count(); i++) + { + if (!m_definitionNames.contains(contact.details().at(i).definitionName())) + { + QContactDetail detail= contact.details().at(i); + contact.removeDetail(&detail); + } + } + CNT_EXIT +} + + + +void CntServices::removeNotSupportedFields(QContact& contact) +{ + CNT_ENTRY + QContactManager cm("symbian"); + QList removeList; + + // Not all fields are supported in symbian back-end + // Remove not supported fields + for (int i=0; i < contact.details().count(); i++) + { + QContactDetail detail = contact.details().at(i); + if(detail.definitionName() == QContactAddress::DefinitionName) + { + QContactAddress addrDetail = static_cast(detail); + + // Sub-types not supported + if(detail.removeValue(QContactAddress::FieldSubTypes)) + contact.saveDetail(&detail); + } + else if(detail.definitionName() == QContactAnniversary::DefinitionName) + { + QContactAnniversary annivDetail = static_cast(detail); + + // Sub-types not supported + if(detail.removeValue(QContactAnniversary::FieldSubType)) + contact.saveDetail(&detail); + + // Context not supported + if(detail.removeValue(QContactDetail::FieldContext)) + contact.saveDetail(&detail); + } + else if(detail.definitionName() == QContactPhoneNumber::DefinitionName) + { + QContactPhoneNumber phoneDetail = static_cast(detail); + + if(phoneDetail.subTypes().size() > 0 ) + { + // Sub-types not supported + if(phoneDetail.subTypes().contains(QContactPhoneNumber::SubTypeVoice) + || phoneDetail.subTypes().contains(QContactPhoneNumber::SubTypeMessagingCapable)) + { + detail.removeValue(QContactPhoneNumber::FieldSubTypes); + contact.saveDetail(&detail); + } + } + } + else if(detail.definitionName() == QContactUrl::DefinitionName) + { + QContactUrl urlDetail = static_cast(detail); + + QString stype=QContactUrl::SubTypeHomePage; + if(urlDetail.subType().compare(stype) != 0) + { + detail.removeValue(QContactUrl::FieldSubType); + contact.saveDetail(&detail); + } + } + } + CNT_EXIT +} + +// This method is inherited from CntAbstractServiceProvider +void CntServices::CompleteServiceAndCloseApp(const QVariant& retValue) +{ + CNT_ENTRY + if ( mCurrentProvider ) + { + mCurrentProvider->CompleteServiceAndCloseApp( retValue ); + } + CNT_EXIT +} + +void CntServices::setQuitable(bool quitable) +{ + mIsQuitable = quitable; +} + +void CntServices::quitApp() +{ + CNT_ENTRY + + // Only embedded applications should be exited once a client + // disconnects. At the moments QtHighWay has unresolved issues + // when closing non-embedded applications. Error ou1cimx1#472852 + // has more info + if ( mIsQuitable ) + { + qApp->quit(); + } + + CNT_EXIT +} + +Q_IMPLEMENT_USER_METATYPE(CntServicesContact) +Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList) diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntservicesubeditview.cpp --- a/phonebookui/phonebookservices/src/cntservicesubeditview.cpp Wed Jul 21 11:09:07 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ - /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "cntservicesubeditview.h" -#include "cntservicehandler.h" - -CntServiceSubEditView::CntServiceSubEditView(CntServiceHandler *aServiceHandler) : CntEditView(), -mServiceHandler(aServiceHandler) -{ - -} - -CntServiceSubEditView::~CntServiceSubEditView() -{ - -} - -///*! -//Saves the contact -//*/ -//void CntServiceSubEditView::aboutToCloseView() -//{ -// // save contact if there is one -// if (contact()) -// { -// contactManager()->saveContact(contact()); -// } -// -// CntViewParameters viewParameters; -// QVariant var; -// var.setValue(*contact()); -// viewParameters.insert(ESelectedContact, var); -// viewManager()->back(viewParameters); -//} -// -///*! -//Cancel all changes made and return to comm launcher view -//*/ -//void CntServiceSubEditView::discardAllChanges() -//{ -// QContact oldContact = contactManager()->contact(contact()->localId()); -// -// CntViewParameters viewParameters; -// QVariant var; -// var.setValue(oldContact); -// viewParameters.insert(ESelectedContact, var); -// viewManager()->back(viewParameters); -//} -// -///* -//Handle signals emitted from CntCommands, only used for delete command for now. -//*/ -//int CntServiceSubEditView::handleExecutedCommand(QString aCommand, const QContact &aContact) -//{ -// Q_UNUSED(aContact); -// int result = -1; -// if (aCommand == "delete") -// { -// connect(mServiceHandler, SIGNAL(returnValueDelivered()), qApp, SLOT(quit())); -// mServiceHandler->completeEdit(result); -// result = 0; -// } -// return result; -//} - -// EOF diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntserviceviewfactory.cpp --- a/phonebookui/phonebookservices/src/cntserviceviewfactory.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/src/cntserviceviewfactory.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -17,16 +17,19 @@ #include "cntserviceviewfactory.h" #include "cntabstractview.h" + + #include "cntserviceeditview.h" -#include "cntservicesubeditview.h" +#include "cntservicecontactselectionview.h" + +#include "cntservicecontactcardview.h" #include "cntservicecontactfetchview.h" -#include "cntservicecontactselectionview.h" -#include "cntservicecontactcardview.h" #include "cntserviceassigncontactcardview.h" -CntServiceViewFactory::CntServiceViewFactory(CntServiceHandler* aHandler) : + +CntServiceViewFactory::CntServiceViewFactory( CntAbstractServiceProvider& aServiceProvider ) : CntDefaultViewFactory(), -mService( aHandler ) +mProvider( aServiceProvider ) { } @@ -38,26 +41,23 @@ { switch ( aViewId ) { - // contact fetch service view (fetching contacts from for example messaging) + // contact fetch service view (for eg. requested by messaging) case serviceContactFetchView: - return new CntServiceContactFetchView( mService ); - + return new CntServiceContactFetchView( mProvider ); + // contact selection service view (selecting contact to edit when updating existing contact) case serviceContactSelectionView: - return new CntServiceContactSelectionView( mService ); + return new CntServiceContactSelectionView( mProvider ); case serviceEditView: - return new CntServiceEditView( mService ); - - case serviceSubEditView: - return new CntServiceSubEditView( mService ); - + return new CntServiceEditView( mProvider ); + case serviceContactCardView: - return new CntServiceContactCardView( mService ); + return new CntServiceContactCardView( mProvider ); case serviceAssignContactCardView: - return new CntServiceAssignContactCardView( mService ); - + return new CntServiceAssignContactCardView( mProvider ); + default: return CntDefaultViewFactory::createView( aViewId ); } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/cntserviceviewmanager.cpp --- a/phonebookui/phonebookservices/src/cntserviceviewmanager.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/src/cntserviceviewmanager.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -16,40 +16,18 @@ */ #include "cntserviceviewmanager.h" - -#include "cntservicehandler.h" - -#include "cntservicecontactfetchview.h" -#include "cntservicecontactselectionview.h" -#include "cntserviceeditview.h" -#include "cntservicecontactcardview.h" -#include "cntservicesubeditview.h" -#include "cntserviceassigncontactcardview.h" #include "cntserviceviewfactory.h" -#include /*! Constructor */ -CntServiceViewManager::CntServiceViewManager(HbMainWindow *mainWindow, CntServiceHandler *aHandler): - CntDefaultViewManager(mainWindow), - mServiceHandler(aHandler) -{ - - setViewFactory( new CntServiceViewFactory(mServiceHandler) ); - connect(mServiceHandler, SIGNAL(launchFetch(const QString&, const QString&, const QString&)), - this, SLOT(handleFetch(const QString&, const QString&, const QString&))); - - // Handles signal with mode selected. - connect(mServiceHandler, SIGNAL(launchFetchVerified(const QString&, const QString&, const QString&, const QString&)), - this, SLOT(launchFetch(const QString&, const QString&, const QString&, const QString&))); - - connect(mServiceHandler, SIGNAL(launchEditor(QContact)), this, SLOT(launchEditor(QContact))); - connect(mServiceHandler, SIGNAL(launchContactSelection(QContactDetail)), this, SLOT(launchContactSelection(QContactDetail))); - connect(mServiceHandler, SIGNAL(launchContactCard(QContact)), this, SLOT(launchContactCard(QContact))); - connect(mServiceHandler, SIGNAL(launchAssignContactCard(QContact, QContactDetail)), this, - SLOT(launchAssignContactCard(QContact, QContactDetail))); -} +CntServiceViewManager::CntServiceViewManager( HbMainWindow *mainWindow, + CntAbstractServiceProvider& aProvider ): + CntDefaultViewManager(mainWindow) + { + // ownership of the factory is given to the base class. + setViewFactory( new CntServiceViewFactory( aProvider ) ); + } /*! Destructor @@ -65,87 +43,4 @@ // from service handler, see constructor. } -/*! -Launch fetch service view. -*/ -void CntServiceViewManager::handleFetch(const QString &title, const QString &action, const QString &filter) -{ - launchFetch(title,action,filter); -} - -/*! -Launch fetch service view. Uses a mode to determine fetching type. -*/ -void CntServiceViewManager::launchFetch(const QString &title, const QString &action, const QString &filter, const QString &mode) -{ - CntViewParameters params; - params.insert(EViewId, serviceContactFetchView); - params.insert(CntServiceHandler::EAction, action); - params.insert(CntServiceHandler::EFilter, filter); - params.insert(CntServiceHandler::ETitle, title); - - if (!mode.compare(KCntSingleSelectionMode, Qt::CaseSensitive)) { - params.insert(ESelectionMode, HbAbstractItemView::SingleSelection); - } - else { - params.insert(ESelectionMode, HbAbstractItemView::MultiSelection); - } - changeView(params); -} - -/*! -Launch editor service view -*/ -void CntServiceViewManager::launchEditor(QContact contact) -{ - CntViewParameters params; - params.insert(EViewId, serviceEditView); - QVariant var; - var.setValue(contact); - params.insert(ESelectedContact, var); - changeView(params); -} - -/*! -Launch contact selection service view (update existing contact with detail) -*/ -void CntServiceViewManager::launchContactSelection(QContactDetail detail) -{ - CntViewParameters params; - params.insert(EViewId, serviceContactSelectionView); - QVariant var; - var.setValue(detail); - params.insert(ESelectedDetail, var); - changeView(params); -} - -/*! -Launch contact card service view -*/ -void CntServiceViewManager::launchContactCard(QContact contact) -{ - CntViewParameters params; - params.insert(EViewId, serviceContactCardView); - QVariant var; - var.setValue(contact); - params.insert(ESelectedContact, var); - changeView(params); -} - -/*! -Launch assign (temporary) contact card service view -*/ -void CntServiceViewManager::launchAssignContactCard(QContact contact, QContactDetail detail) -{ - CntViewParameters params; - params.insert(EViewId, serviceAssignContactCardView); - QVariant var; - var.setValue(contact); - params.insert(ESelectedContact, var); - QVariant varDetail; - varDetail.setValue(detail); - params.insert(ESelectedDetail, varDetail); - changeView(params); -} - // end of file diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/src/main.cpp --- a/phonebookui/phonebookservices/src/main.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/src/main.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -18,8 +18,17 @@ #include #include #include -#include "cntservicemainwindow.h" -#include "cntservicehandler.h" +#include "cntmainwindow.h" +#include "cntserviceproviderold.h" +#include "cntserviceproviderold2.h" +#include "cntserviceproviderfetch.h" +#include "cntserviceproviderold2.h" +#include "cntserviceproviderviewing.h" +#include "cntserviceprovideredit.h" +#include "cntservices.h" +#include "cntserviceviewmanager.h" +#include "cntviewnavigator.h" +#include int main(int argc, char **argv) { @@ -30,9 +39,29 @@ QString path = "z:/resource/qt/translations/"; translator.load(path + "contacts_" + lang); a.installTranslator(&translator); - - CntServiceHandler *handler = new CntServiceHandler(); - CntServiceMainWindow mainWindow(handler); + + CntMainWindow mainWindow(NULL, noView); // no parent & "noView" as default view + + CntViewNavigator* navigator = new CntViewNavigator( &mainWindow ); + navigator->addException( serviceEditView, noView ); + + // This object actually executes the services + CntServices* services = new CntServices(); + services->setParent( &mainWindow ); // for ownership + + CntServiceViewManager* viewManager = new CntServiceViewManager( + &mainWindow, + *services ); // as CntAbstractServiceProvider + viewManager->setViewNavigator( navigator ); + + services->setViewManager( *viewManager ); + + // These objects talk with QT Highway (send/receive) + CntServiceProviderOld* serviceProviderOld = new CntServiceProviderOld( *services, &mainWindow ); // com.nokia.services.phonebookservices.Fetch + CntServiceProviderOld2* serviceProviderOld2 = new CntServiceProviderOld2( *services, &mainWindow ); // phonebookservices.Fetch + CntServiceProviderFetch* serviceProviderFetch = new CntServiceProviderFetch( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactFetch + CntServiceProviderViewing* serviceProviderViewing = new CntServiceProviderViewing( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactView + CntServiceProviderEdit* serviceProviderEdit = new CntServiceProviderEdit( *services, &mainWindow ); // phonebookservices.com.nokia.symbian.IContactEdit mainWindow.show(); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/main.cpp --- a/phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/main.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/main.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -88,6 +88,14 @@ mainLayout->addItem(button, row, 1); row++; + button = new HbPushButton("Edit create new - number with subtype"); + QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_numberWithSubtype())); + mainLayout->addItem(button, row, 0); + button = new HbPushButton("old"); + QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_numberWithSubtype_old())); + mainLayout->addItem(button, row, 1); + row++; + button = new HbPushButton("Edit create new - email"); QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_email())); mainLayout->addItem(button, row, 0); @@ -104,6 +112,14 @@ mainLayout->addItem(button, row, 1); row++; + button = new HbPushButton("Edit create new - onlineAccount with subtype"); + bool res = QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_onlineAccountWithSubtype())); + mainLayout->addItem(button, row, 0); + button = new HbPushButton("old"); + res = QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditCreateNew_onlineAccountWithSubtype_old())); + mainLayout->addItem(button, row, 1); + row++; + button = new HbPushButton("Launch editor with vCard"); QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditorVCard())); mainLayout->addItem(button, row, 0); @@ -121,6 +137,14 @@ QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_number_old())); mainLayout->addItem(button, row, 1); row++; + + button = new HbPushButton("Edit/update existing - number with subtype"); + QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_numberWithSubtype())); + mainLayout->addItem(button, row, 0); + button = new HbPushButton("old"); + QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_numberWithSubtype_old())); + mainLayout->addItem(button, row, 1); + row++; button = new HbPushButton("Edit/update existing - email"); QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_email())); @@ -138,6 +162,14 @@ mainLayout->addItem(button, row, 1); row++; + button = new HbPushButton("Edit/update existing - onlineAccount with subtype"); + QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_onlineAccountWithSubtype())); + mainLayout->addItem(button, row, 0); + button = new HbPushButton("old"); + QObject::connect(button, SIGNAL(pressed()), service, SLOT(launchEditUpdateExisting_onlineAccountWithSubtype_old())); + mainLayout->addItem(button, row, 1); + row++; + // CONTACT CARD ========================================================== button = new HbPushButton("Launch contact card"); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/testpbkservices.cpp --- a/phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/testpbkservices.cpp Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/testpbkservices.cpp Wed Jul 21 11:21:49 2010 +0300 @@ -138,6 +138,28 @@ CNT_EXIT } +void testPbkServices::launchEditCreateNew_numberWithSubtype() +{ + CNT_ENTRY + launchEditCreateNew( + true, // aNewInterface + QContactPhoneNumber::DefinitionName, // aDetailType + "1234567", // aFieldContent + QContactPhoneNumber::SubTypeLandline); //aDetailSubtype + CNT_EXIT +} + +void testPbkServices::launchEditCreateNew_numberWithSubtype_old() +{ + CNT_ENTRY + launchEditCreateNew( + false, // aNewInterface + QContactPhoneNumber::DefinitionName, // aDetailType + "1234567", // aFieldContent + QContactPhoneNumber::SubTypeLandline); //aDetailSubtype + CNT_EXIT +} + void testPbkServices::launchEditCreateNew_email() { CNT_ENTRY @@ -178,6 +200,28 @@ CNT_EXIT } +void testPbkServices::launchEditCreateNew_onlineAccountWithSubtype() +{ + CNT_ENTRY + launchEditCreateNew( + true, // aNewInterface + QContactOnlineAccount::DefinitionName, // aDetailType + "provider:account@provider.com", // aFieldContent + QContactOnlineAccount::SubTypeImpp); // aDetailSubtype + CNT_EXIT +} + +void testPbkServices::launchEditCreateNew_onlineAccountWithSubtype_old() +{ + CNT_ENTRY + launchEditCreateNew( + false, // aNewInterface + QContactOnlineAccount::DefinitionName, // aDetailType + "provider:account@provider.com", // aFieldContent + QContactOnlineAccount::SubTypeImpp); // aDetailSubtype + CNT_EXIT +} + void testPbkServices::launchEditorVCard() { CNT_ENTRY @@ -214,6 +258,28 @@ CNT_EXIT } +void testPbkServices::launchEditUpdateExisting_numberWithSubtype() +{ + CNT_ENTRY + launchEditUpdateExisting( + true, // aNewInterface + QContactPhoneNumber::DefinitionName, // aDetailType + "1234567", // aDetailValue + QContactPhoneNumber::SubTypeLandline);// aDetailSubtype + CNT_EXIT +} + +void testPbkServices::launchEditUpdateExisting_numberWithSubtype_old() +{ + CNT_ENTRY + launchEditUpdateExisting( + false, // aNewInterface + QContactPhoneNumber::DefinitionName, // aDetailType + "1234567", // aDetailValue + QContactPhoneNumber::SubTypeLandline);// aDetailSubtype + CNT_EXIT +} + void testPbkServices::launchEditUpdateExisting_email() { CNT_ENTRY @@ -254,6 +320,28 @@ CNT_EXIT } +void testPbkServices::launchEditUpdateExisting_onlineAccountWithSubtype() +{ + CNT_ENTRY + launchEditUpdateExisting( + true, // aNewInterface + QContactOnlineAccount::DefinitionName, // aDetailType + "provider:account@provider.com", // aDetailValue + QContactOnlineAccount::SubTypeImpp); // aDetailSubtype + CNT_EXIT +} + +void testPbkServices::launchEditUpdateExisting_onlineAccountWithSubtype_old() +{ + CNT_ENTRY + launchEditUpdateExisting( + false, // aNewInterface + QContactOnlineAccount::DefinitionName, // aDetailType + "provider:account@provider.com", // aDetailValue + QContactOnlineAccount::SubTypeImpp); // aDetailSubtype + CNT_EXIT +} + void testPbkServices::launchContactCard() { CNT_ENTRY @@ -431,8 +519,8 @@ XQApplicationManager appMng; if ( aNewInterface ) { - QString interface("com.nokia.symbian.IContactFetch"); - QString operation("multiFetch(QString,QString,QString)"); + QString interface("com.nokia.symbian.IContactsFetch"); + QString operation("multiFetch(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. @@ -477,8 +565,8 @@ XQApplicationManager appMng; if ( aNewInterface ) { - QString interface("com.nokia.symbian.IContactFetch"); - QString operation("singleFetch(QString,QString,QString)"); + QString interface("com.nokia.symbian.IContactsFetch"); + QString operation("singleFetch(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. @@ -517,7 +605,7 @@ CNT_EXIT } -void testPbkServices::launchEditCreateNew( bool aNewInterface, QString aDetailType, QString aFieldContent ) +void testPbkServices::launchEditCreateNew( bool aNewInterface, QString aDetailType, QString aFieldContent, QString aDetailSubtype ) { CNT_ENTRY delete mRequest; @@ -526,9 +614,14 @@ QVariantList args; XQApplicationManager appMng; QString operation("editCreateNew(QString,QString)"); + if ( !aDetailSubtype.isEmpty() ) + { + operation = "editCreateNew(QString,QString,QString)"; + } + if ( aNewInterface ) { - QString interface("com.nokia.symbian.IContactFetch"); + QString interface("com.nokia.symbian.IContactsFetch"); // service name is not needed mRequest = appMng.create( interface, operation, true); // embedded } @@ -548,6 +641,10 @@ args << aDetailType; args << aFieldContent; + if ( !aDetailSubtype.isEmpty() ) + { + args << aDetailSubtype; + } mRequest->setArguments(args); mRequest->send(); @@ -570,7 +667,7 @@ XQApplicationManager appMng; if ( aNewInterface ) { - QString interface("com.nokia.symbian.IContactEdit"); + QString interface("com.nokia.symbian.IContactsEdit"); QString operation("editCreateNewFromVCard(QString)"); // service name is not needed mRequest = appMng.create( interface, operation, true); // embedded @@ -603,7 +700,7 @@ CNT_EXIT } -void testPbkServices::launchEditUpdateExisting( bool aNewInterface, QString aDetailType, QString aDetailValue ) +void testPbkServices::launchEditUpdateExisting( bool aNewInterface, QString aDetailType, QString aDetailValue, QString aDetailSubtype ) { CNT_ENTRY delete mRequest; @@ -612,9 +709,14 @@ QVariantList args; XQApplicationManager appMng; QString operation("editUpdateExisting(QString,QString)"); + if ( !aDetailSubtype.isEmpty() ) + { + operation = "editUpdateExisting(QString,QString,QString)"; + } + if ( aNewInterface ) { - QString interface("com.nokia.symbian.IContactEdit"); + QString interface("com.nokia.symbian.IContactsEdit"); // service name is not needed mRequest = appMng.create(interface, operation, true); // embedded } @@ -633,6 +735,10 @@ args << aDetailType; args << aDetailValue; + if ( !aDetailSubtype.isEmpty() ) + { + args << aDetailSubtype; + } mRequest->setArguments(args); mRequest->send(); @@ -670,7 +776,7 @@ XQApplicationManager appMng; if ( aNewInterface ) { - QString interface("com.nokia.symbian.IContactView"); + QString interface("com.nokia.symbian.IContactsView"); QString operation("openContactCard(int)"); // interface name is not needed mRequest = appMng.create( interface, operation, true); // embedded @@ -711,8 +817,8 @@ XQApplicationManager appMng; if ( aNewInterface ) { - QString interface("com.nokia.symbian.IContactView"); - QString operation("openContactCard(QString,QString)"); + QString interface("com.nokia.symbian.IContactsView"); + QString operation("openTemporaryContactCard(QString,QString)"); // service name is not needed mRequest = appMng.create(interface, operation, true); // embedded } diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/testpbkservices.h --- a/phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/testpbkservices.h Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/phonebookservices/tsrc/qtpbkservicestestapp/testpbkservices.h Wed Jul 21 11:21:49 2010 +0300 @@ -47,20 +47,28 @@ // EDIT - create new void launchEditCreateNew_number(); void launchEditCreateNew_number_old(); + void launchEditCreateNew_numberWithSubtype(); + void launchEditCreateNew_numberWithSubtype_old(); void launchEditCreateNew_email(); void launchEditCreateNew_email_old(); void launchEditCreateNew_onlineAccount(); void launchEditCreateNew_onlineAccount_old(); + void launchEditCreateNew_onlineAccountWithSubtype(); + void launchEditCreateNew_onlineAccountWithSubtype_old(); void launchEditorVCard(); void launchEditorVCard_old(); // EDIT - update existing void launchEditUpdateExisting_number(); void launchEditUpdateExisting_number_old(); + void launchEditUpdateExisting_numberWithSubtype(); + void launchEditUpdateExisting_numberWithSubtype_old(); void launchEditUpdateExisting_email(); void launchEditUpdateExisting_email_old(); void launchEditUpdateExisting_onlineAccount(); void launchEditUpdateExisting_onlineAccount_old(); + void launchEditUpdateExisting_onlineAccountWithSubtype(); + void launchEditUpdateExisting_onlineAccountWithSubtype_old(); // CONTACT CARD void launchContactCard(); @@ -82,9 +90,9 @@ private: void launchMultiFetch( bool aNewInterface, QString aAction ); void launchSingleFetch( bool aNewInterface, QString aAction ); - void launchEditCreateNew( bool aNewInterface, QString aDetailType, QString aFieldContent ); + void launchEditCreateNew( bool aNewInterface, QString aDetailType, QString aFieldContent, QString aDetailSubtype = QString() ); void launchEditorVCard( bool aNewInterface ); - void launchEditUpdateExisting( bool aNewInterface, QString aDetailType, QString aDetailValue ); + void launchEditUpdateExisting( bool aNewInterface, QString aDetailType, QString aDetailValue, QString aDetailSubtype = QString()); void launchContactCard( bool aNewInterface ); void launchContactCard( bool aNewInterface, QString aDetailType, QString aDetailValue ); diff -r 74b30151afd6 -r 77bc263e1626 phonebookui/rom/phonebook.iby --- a/phonebookui/rom/phonebook.iby Wed Jul 21 11:09:07 2010 +0300 +++ b/phonebookui/rom/phonebook.iby Wed Jul 21 11:21:49 2010 +0300 @@ -30,7 +30,6 @@ file=ABI_DIR\BUILD_DIR\cntmaptileservice.dll SHARED_LIB_DIR\cntmaptileservice.dll UNPAGED file=ABI_DIR\BUILD_DIR\cntsimutility.dll SHARED_LIB_DIR\cntsimutility.dll UNPAGED file=ABI_DIR\BUILD_DIR\cntimageutility.dll SHARED_LIB_DIR\cntimageutility.dll UNPAGED -file=ABI_DIR\BUILD_DIR\cntsettingsutility.dll SHARED_LIB_DIR\cntsettingsutility.dll UNPAGED // UI file=ABI_DIR\BUILD_DIR\pbkcommonui.dll SHARED_LIB_DIR\pbkcommonui.dll UNPAGED diff -r 74b30151afd6 -r 77bc263e1626 pimprotocols/pbap/group/bld.inf --- a/pimprotocols/pbap/group/bld.inf Wed Jul 21 11:09:07 2010 +0300 +++ b/pimprotocols/pbap/group/bld.inf Wed Jul 21 11:21:49 2010 +0300 @@ -14,7 +14,7 @@ // PRJ_EXPORTS -../client/pbapcli.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(pbapcli.h) +../client/pbapcli.h APP_LAYER_PLATFORM_EXPORT_PATH(pbapcli.h) pbap.iby /epoc32/rom/include/pbap.iby diff -r 74b30151afd6 -r 77bc263e1626 pimprotocols/phonebooksync/group/bld.inf --- a/pimprotocols/phonebooksync/group/bld.inf Wed Jul 21 11:09:07 2010 +0300 +++ b/pimprotocols/phonebooksync/group/bld.inf Wed Jul 21 11:21:49 2010 +0300 @@ -17,7 +17,7 @@ PRJ_EXPORTS ../group/phbksync.iby /epoc32/rom/include/phbksync.iby -../Client/phbksync.h SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(phbksync.h) +../Client/phbksync.h APP_LAYER_PUBLIC_EXPORT_PATH(phbksync.h) PRJ_TESTEXPORTS