44 #include <thumbnailmanager_qt.h> |
44 #include <thumbnailmanager_qt.h> |
45 #include <cntmaptileservice.h> //For maptile processing |
45 #include <cntmaptileservice.h> //For maptile processing |
46 #include <qversitcontactexporter.h> |
46 #include <qversitcontactexporter.h> |
47 #include <qversitwriter.h> |
47 #include <qversitwriter.h> |
48 #include <xqservicerequest.h> |
48 #include <xqservicerequest.h> |
|
49 #include <xqaiwrequest.h> |
|
50 #include <xqaiwdecl.h> |
49 #include <QTimer> //Progress indication icon |
51 #include <QTimer> //Progress indication icon |
|
52 #include <logsservices.h> |
50 |
53 |
51 #include <cntdebug.h> |
54 #include <cntdebug.h> |
52 #include "cntcontactcarddatacontainer.h" |
55 #include "cntcontactcarddatacontainer.h" |
53 #include "cntcontactcarddetailitem.h" |
56 #include "cntcontactcarddetailitem.h" |
54 #include "cntcontactcardheadingitem.h" |
57 #include "cntcontactcardheadingitem.h" |
72 const char *CNT_MAPTILE_SEARCH_STOP_ICON = "qtg_mono_search_stop"; |
75 const char *CNT_MAPTILE_SEARCH_STOP_ICON = "qtg_mono_search_stop"; |
73 /*! |
76 /*! |
74 Constructor, initialize member variables. |
77 Constructor, initialize member variables. |
75 \a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0) |
78 \a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0) |
76 */ |
79 */ |
77 CntContactCardViewPrivate::CntContactCardViewPrivate() : |
80 CntContactCardViewPrivate::CntContactCardViewPrivate(bool isTemporary) : |
78 QObject(), |
81 QObject(), |
79 mScrollArea(NULL), |
82 mScrollArea(NULL), |
80 mContainerWidget(NULL), |
83 mContainerWidget(NULL), |
81 mContainerLayout(NULL), |
84 mContainerLayout(NULL), |
82 mContact(NULL), |
85 mContact(NULL), |
117 |
123 |
118 //back button |
124 //back button |
119 mBackKey = new HbAction(Hb::BackNaviAction, mView); |
125 mBackKey = new HbAction(Hb::BackNaviAction, mView); |
120 mView->setNavigationAction(mBackKey); |
126 mView->setNavigationAction(mBackKey); |
121 connect(mBackKey, SIGNAL(triggered()), this, SLOT(showPreviousView())); |
127 connect(mBackKey, SIGNAL(triggered()), this, SLOT(showPreviousView())); |
122 |
128 |
123 mProgressTimer = new QTimer(this); |
129 mProgressTimer = new QTimer(this); |
124 mProgressTimer->setSingleShot(true); |
130 mProgressTimer->setSingleShot(true); |
125 connect(mProgressTimer, SIGNAL(timeout()),this, SLOT(updateSpinningIndicator())); |
131 connect(mProgressTimer, SIGNAL(timeout()),this, SLOT(updateSpinningIndicator())); |
126 |
132 |
127 mMaptile = new CntMapTileService; |
133 mMaptile = new CntMapTileService; |
193 { |
203 { |
194 emit backPressed(); |
204 emit backPressed(); |
195 |
205 |
196 //save the contact if avatar has been changed. |
206 //save the contact if avatar has been changed. |
197 QContact contact = contactManager()->contact(mContact->localId()); |
207 QContact contact = contactManager()->contact(mContact->localId()); |
198 if ( contact != *mContact ) |
208 if ( contact != *mContact && contactManager()->error() == QContactManager::NoError) |
199 { |
209 { |
200 contactManager()->saveContact(mContact); |
210 contactManager()->saveContact(mContact); |
201 } |
211 } |
202 |
212 |
203 mViewManager->back( mArgs ); |
213 mViewManager->back( mArgs ); |
|
214 } |
|
215 |
|
216 /*! |
|
217 Activates the root view |
|
218 */ |
|
219 void CntContactCardViewPrivate::showRootView() |
|
220 { |
|
221 mViewManager->back( mArgs, true ); |
204 } |
222 } |
205 |
223 |
206 /* |
224 /* |
207 Activates a default view and setup name label texts |
225 Activates a default view and setup name label texts |
208 */ |
226 */ |
232 } |
248 } |
233 else |
249 else |
234 { |
250 { |
235 mView->toolBar()->removeAction(static_cast<HbAction*>(document()->findObject(QString("cnt:sendMyCard")))); |
251 mView->toolBar()->removeAction(static_cast<HbAction*>(document()->findObject(QString("cnt:sendMyCard")))); |
236 } |
252 } |
|
253 if (mIsTemporary) |
|
254 { |
|
255 mView->menu()->clearActions(); |
|
256 mView->toolBar()->clearActions(); |
|
257 mView->toolBar()->addAction(static_cast<HbAction*>(document()->findObject(QString("cnt:addtocontact")))); |
|
258 } |
237 |
259 |
238 // add heading widget to the content |
260 // add heading widget to the content |
239 QGraphicsWidget *c = document()->findWidget(QString("content")); |
261 QGraphicsWidget *c = document()->findWidget(QString("content")); |
240 QGraphicsLinearLayout* l = static_cast<QGraphicsLinearLayout*>(c->layout()); |
262 QGraphicsLinearLayout* l = static_cast<QGraphicsLinearLayout*>(c->layout()); |
241 |
263 |
242 mHeadingItem = static_cast<CntContactCardHeadingItem*>(document()->findWidget(QString("cnt_contactcard_heading"))); |
264 mHeadingItem = static_cast<CntContactCardHeadingItem*>(document()->findWidget(QString("cnt_contactcard_heading"))); |
243 mHeadingItem->setDetails(mContact); |
265 mHeadingItem->setDetails(mContact); |
244 connect(mHeadingItem, SIGNAL(passLongPressed(const QPointF&)), this, SLOT(drawMenu(const QPointF&))); |
266 |
245 connect(mHeadingItem, SIGNAL(passShortPressed(const QPointF&)), this, SLOT(doChangeImage())); |
267 mImageLabel = static_cast<CntImageLabel*>(document()->findWidget("cnt_contactcard_image")); |
|
268 |
|
269 if (!mIsTemporary) |
|
270 { |
|
271 connect(mHeadingItem, SIGNAL(passLongPressed(const QPointF&)), this, SLOT(drawMenu(const QPointF&))); |
|
272 connect(mHeadingItem, SIGNAL(passShortPressed(const QPointF&)), this, SLOT(doChangeImage())); |
|
273 connect(mImageLabel, SIGNAL(iconClicked()), this, SLOT(doChangeImage())); |
|
274 connect(mImageLabel, SIGNAL(iconLongPressed(const QPointF&)), this, SLOT(drawMenu(const QPointF&))); |
|
275 } |
|
276 else |
|
277 { |
|
278 mHeadingItem->ungrabGesture(Qt::TapGesture); |
|
279 mImageLabel->ungrabGesture(Qt::TapGesture); |
|
280 } |
246 |
281 |
247 // presence listener |
282 // presence listener |
248 mPresenceListener = new CntPresenceListener(*mContact); |
283 mPresenceListener = new CntPresenceListener(*mContact); |
249 connect(mPresenceListener, SIGNAL(fullPresenceUpdated(bool)), mHeadingItem, SLOT(setOnlineStatus(bool))); |
284 connect(mPresenceListener, SIGNAL(fullPresenceUpdated(bool)), mHeadingItem, SLOT(setOnlineStatus(bool))); |
250 connect(mPresenceListener, SIGNAL(accountPresenceUpdated(const QString&, bool)), |
285 connect(mPresenceListener, SIGNAL(accountPresenceUpdated(const QString&, bool)), |
251 this, SLOT(updateItemPresence(const QString&, bool))); |
286 this, SLOT(updateItemPresence(const QString&, bool))); |
252 bool online; |
287 bool online; |
253 QMap<QString, bool> presences = mPresenceListener->initialPresences(online); |
288 QMap<QString, bool> presences = mPresenceListener->initialPresences(online); |
254 mHeadingItem->setOnlineStatus(online); |
289 mHeadingItem->setOnlineStatus(online); |
255 |
290 |
256 mImageLabel = static_cast<CntImageLabel*>(document()->findWidget("cnt_contactcard_image")); |
291 |
257 connect(mImageLabel, SIGNAL(iconClicked()), this, SLOT(doChangeImage())); |
|
258 connect(mImageLabel, SIGNAL(iconLongPressed(const QPointF&)), this, SLOT(drawMenu(const QPointF&))); |
|
259 |
292 |
260 // avatar |
293 // avatar |
261 QList<QContactAvatar> details = mContact->details<QContactAvatar>(); |
294 QList<QContactAvatar> details = mContact->details<QContactAvatar>(); |
262 for (int i = 0;i < details.count();i++) |
295 for (int i = 0;i < details.count();i++) |
263 { |
296 { |
295 if (pos < CntContactCardDataItem::ESeparator && dataItem->isFocusable()) |
328 if (pos < CntContactCardDataItem::ESeparator && dataItem->isFocusable()) |
296 { |
329 { |
297 CntContactCardDetailItem* item = new CntContactCardDetailItem(index, mContainerWidget); |
330 CntContactCardDetailItem* item = new CntContactCardDetailItem(index, mContainerWidget); |
298 |
331 |
299 connect(item, SIGNAL(clicked()), this, SLOT(onItemActivated())); |
332 connect(item, SIGNAL(clicked()), this, SLOT(onItemActivated())); |
300 connect(item, SIGNAL(longPressed(const QPointF&)), this, SLOT(onLongPressed(const QPointF&))); |
333 |
301 |
334 if (!mIsTemporary) |
|
335 { |
|
336 connect(item, SIGNAL(longPressed(const QPointF&)), this, SLOT(onLongPressed(const QPointF&))); |
|
337 } |
|
338 |
302 if (mContact->isPreferredDetail(dataItem->action(), dataItem->detail())) |
339 if (mContact->isPreferredDetail(dataItem->action(), dataItem->detail())) |
303 { |
340 { |
304 dataItem->setSecondaryIcon(HbIcon("qtg_mono_favourites")); |
341 dataItem->setSecondaryIcon(HbIcon("qtg_mono_favourites")); |
305 mPreferredItems.insert(dataItem->action(), item); |
342 mPreferredItems.insert(dataItem->action(), item); |
306 } |
343 } |
414 if( favouriteGroupId != 0 ) |
451 if( favouriteGroupId != 0 ) |
415 { |
452 { |
416 setAsFavorite = CntFavourite::isMemberOfFavouriteGroup( contactManager(), mContact ); |
453 setAsFavorite = CntFavourite::isMemberOfFavouriteGroup( contactManager(), mContact ); |
417 mHeadingItem->setFavoriteStatus( setAsFavorite ); // if contact is part of favourites group |
454 mHeadingItem->setFavoriteStatus( setAsFavorite ); // if contact is part of favourites group |
418 } |
455 } |
419 qobject_cast<HbAction *>(document()->findObject("cnt:setasfavorite"))->setVisible( !setAsFavorite ); |
456 static_cast<HbAction *>(document()->findObject("cnt:setasfavorite"))->setVisible( !setAsFavorite ); |
420 qobject_cast<HbAction *>(document()->findObject("cnt:removefromfavorite"))->setVisible( setAsFavorite ); |
457 static_cast<HbAction *>(document()->findObject("cnt:removefromfavorite"))->setVisible( setAsFavorite ); |
421 } |
458 } |
422 document()->findWidget("viewToolbar")->setParent(mView); |
459 document()->findWidget("viewToolbar")->setParent(mView); |
423 document()->findWidget("viewMenu")->setParent(mView); |
460 document()->findWidget("viewMenu")->setParent(mView); |
424 |
461 |
425 // Menu items |
462 // Menu items |
429 connectAction("cnt:removefromfavorite", SLOT(removeFromFavorite())); |
466 connectAction("cnt:removefromfavorite", SLOT(removeFromFavorite())); |
430 connectAction("cnt:placecontacttohs", SLOT(sendToHs())); |
467 connectAction("cnt:placecontacttohs", SLOT(sendToHs())); |
431 connectAction("cnt:edit", SLOT(editContact())); |
468 connectAction("cnt:edit", SLOT(editContact())); |
432 connectAction("cnt:history", SLOT(viewHistory())); |
469 connectAction("cnt:history", SLOT(viewHistory())); |
433 connectAction("cnt:sendMyCard", SLOT(sendBusinessCard())); |
470 connectAction("cnt:sendMyCard", SLOT(sendBusinessCard())); |
|
471 connectAction("cnt:addtocontact", SLOT(onAddedToContacts())); |
434 connectAction("cnt:activityStream", NULL); // placeholder until this action is implemented (needed to avoid memory leak) |
472 connectAction("cnt:activityStream", NULL); // placeholder until this action is implemented (needed to avoid memory leak) |
|
473 |
|
474 // disabled until this action is implemented |
|
475 static_cast<HbAction *>(document()->findObject("cnt:activityStream"))->setEnabled(false); |
|
476 |
|
477 connect(contactManager(), SIGNAL(contactsRemoved(const QList<QContactLocalId>&)), |
|
478 this, SLOT(contactDeletedFromOtherSource(const QList<QContactLocalId>&))); |
435 |
479 |
436 emit viewActivated( mViewManager, aArgs ); |
480 emit viewActivated( mViewManager, aArgs ); |
437 |
481 |
438 CNT_EXIT |
482 CNT_EXIT |
439 } |
483 } |
477 { |
521 { |
478 //Maptile status received. Show the maptile image if available |
522 //Maptile status received. Show the maptile image if available |
479 CntMapTileService::ContactAddressType sourceAddressType = |
523 CntMapTileService::ContactAddressType sourceAddressType = |
480 static_cast <CntMapTileService::ContactAddressType>( mAddressList[index]->mAddressType ); |
524 static_cast <CntMapTileService::ContactAddressType>( mAddressList[index]->mAddressType ); |
481 |
525 |
482 QContactLocalId contactId = mContact->id().localId(); |
526 QContactLocalId contactId = mContact->localId(); |
483 |
527 |
484 if( mAddressList[index]->mDetailItem != NULL ) |
528 if( mAddressList[index]->mDetailItem != NULL ) |
485 { |
529 { |
486 if( mAddressList[index]->maptileStatus == CntMapTileService::MapTileFetchingCompleted ) |
530 if( mAddressList[index]->maptileStatus == CntMapTileService::MapTileFetchingCompleted ) |
487 { |
531 { |
576 void CntContactCardViewPrivate::updateMaptileImage() |
620 void CntContactCardViewPrivate::updateMaptileImage() |
577 { |
621 { |
578 //If there is no maptile displayed, return immediately |
622 //If there is no maptile displayed, return immediately |
579 if( mMaptileLabelList.count() > 0 ) |
623 if( mMaptileLabelList.count() > 0 ) |
580 { |
624 { |
581 QContactLocalId contactId = mContact->id().localId(); |
625 QContactLocalId contactId = mContact->localId(); |
582 |
626 |
583 QList<QContactAddress> addressDetails = mContact->details<QContactAddress>(); |
627 QList<QContactAddress> addressDetails = mContact->details<QContactAddress>(); |
584 |
628 |
585 //address |
629 //address |
586 QString contextHome(QContactAddress::ContextHome.operator QString()); |
630 QString contextHome(QContactAddress::ContextHome.operator QString()); |
708 Place contact to homescreen as widget |
752 Place contact to homescreen as widget |
709 */ |
753 */ |
710 void CntContactCardViewPrivate::sendToHs() |
754 void CntContactCardViewPrivate::sendToHs() |
711 { |
755 { |
712 QVariantHash preferences; |
756 QVariantHash preferences; |
713 preferences["contactId"] = mContact->id().localId(); |
757 preferences["contactId"] = mContact->localId(); |
714 |
758 |
715 XQServiceRequest snd("com.nokia.symbian.IHomeScreenClient", |
759 XQServiceRequest snd("com.nokia.symbian.IHomeScreenClient", |
716 "addWidget(QString,QVariantHash)" |
760 "addWidget(QString,QVariantHash)" |
717 ,false); |
761 ,false); |
718 snd << QString("contactwidgethsplugin"); |
762 snd << QString("contactwidgethsplugin"); |
719 snd << preferences; |
763 snd << preferences; |
720 snd.send(); |
764 snd.send(); |
|
765 |
|
766 /* |
|
767 if (mRequest) |
|
768 { |
|
769 delete mRequest; |
|
770 mRequest = 0; |
|
771 } |
|
772 |
|
773 mRequest = mAppManager.create("com.nokia.symbian.IHomeScreenClient", "addWidget(QString,QVariantHash)", false); |
|
774 |
|
775 if (mRequest) |
|
776 { |
|
777 QList<QVariant> args; |
|
778 QVariantHash preferences; |
|
779 preferences["contactId"] = mContact->localId(); |
|
780 args << preferences; |
|
781 args << QString("contactwidgethsplugin"); |
|
782 mRequest->setArguments(args); |
|
783 mRequest->send(); |
|
784 } |
|
785 */ |
721 } |
786 } |
722 |
787 |
723 /*! |
788 /*! |
724 Launch contact editor |
789 Launch contact editor |
725 */ |
790 */ |
802 /*! |
870 /*! |
803 Deactivate the view |
871 Deactivate the view |
804 */ |
872 */ |
805 void CntContactCardViewPrivate::deactivate() |
873 void CntContactCardViewPrivate::deactivate() |
806 { |
874 { |
807 mView->removeEventFilter(this); |
875 |
808 } |
876 } |
809 |
877 |
810 /*! |
878 /*! |
811 Send the business card / my card |
879 Send the business card / my card |
812 */ |
880 */ |
813 void CntContactCardViewPrivate::sendBusinessCard() |
881 void CntContactCardViewPrivate::sendBusinessCard() |
814 { |
882 { |
815 qDebug() << "CntContactCardViewPrivate::sendBusinessCard - IN"; |
883 CNT_ENTRY |
|
884 |
816 // Check if the contact has an image. |
885 // Check if the contact has an image. |
817 QList<QContactAvatar> avatars = mContact->details<QContactAvatar>(); |
886 QList<QContactAvatar> avatars = mContact->details<QContactAvatar>(); |
818 bool imageExists( false ); |
887 bool imageExists( false ); |
819 /*foreach(QContactAvatar a, mContact->details<QContactAvatar>()) |
888 /*foreach(QContactAvatar a, mContact->details<QContactAvatar>()) |
820 { |
889 { |
895 /*! |
965 /*! |
896 Execute the call / message / email action |
966 Execute the call / message / email action |
897 */ |
967 */ |
898 void CntContactCardViewPrivate::executeAction(QContact& aContact, const QContactDetail& aDetail, const QString& aAction, CntContactCardDetailItem* aItem) |
968 void CntContactCardViewPrivate::executeAction(QContact& aContact, const QContactDetail& aDetail, const QString& aAction, CntContactCardDetailItem* aItem) |
899 { |
969 { |
|
970 if (mIsExecutingAction) |
|
971 { |
|
972 return; |
|
973 } |
|
974 else |
|
975 { |
|
976 mIsExecutingAction = true; |
|
977 } |
|
978 |
900 CntActionLauncher* other = new CntActionLauncher(*contactManager(), aAction); |
979 CntActionLauncher* other = new CntActionLauncher(*contactManager(), aAction); |
901 connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); |
980 connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); |
902 if (aItem && aContact.preferredDetail(aAction).isEmpty()) |
981 if (aItem && aContact.preferredDetail(aAction).isEmpty()) |
903 { |
982 { |
904 setPreferredAction(aAction, aDetail, aItem); |
983 setPreferredAction(aAction, aDetail, aItem); |
919 QContactDetail detail = mDataContainer->dataItem(index)->detail(); |
998 QContactDetail detail = mDataContainer->dataItem(index)->detail(); |
920 QString action = mDataContainer->dataItem(index)->action(); |
999 QString action = mDataContainer->dataItem(index)->action(); |
921 if (detail == aDetail && action == aAction) |
1000 if (detail == aDetail && action == aAction) |
922 { |
1001 { |
923 detailItem = static_cast<CntContactCardDetailItem*>(mContainerLayout->itemAt(index)); |
1002 detailItem = static_cast<CntContactCardDetailItem*>(mContainerLayout->itemAt(index)); |
|
1003 break; |
924 } |
1004 } |
925 } |
1005 } |
926 executeAction(aContact, aDetail, aAction, detailItem); |
1006 executeAction(aContact, aDetail, aAction, detailItem); |
927 mAcceptSendKey=true; |
1007 mAcceptSendKey=true; |
928 } |
1008 } |
930 /*! |
1010 /*! |
931 Execute dynamic action |
1011 Execute dynamic action |
932 */ |
1012 */ |
933 void CntContactCardViewPrivate::executeDynamicAction(QContact& aContact, QContactDetail aDetail, QContactActionDescriptor aActionDescriptor) |
1013 void CntContactCardViewPrivate::executeDynamicAction(QContact& aContact, QContactDetail aDetail, QContactActionDescriptor aActionDescriptor) |
934 { |
1014 { |
|
1015 if (mIsExecutingAction) |
|
1016 { |
|
1017 return; |
|
1018 } |
|
1019 else |
|
1020 { |
|
1021 mIsExecutingAction = true; |
|
1022 } |
|
1023 |
935 CntActionLauncher* other = new CntActionLauncher(*contactManager()); |
1024 CntActionLauncher* other = new CntActionLauncher(*contactManager()); |
936 connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); |
1025 connect(other, SIGNAL(actionExecuted(CntActionLauncher*)), this, SLOT(actionExecuted(CntActionLauncher*))); |
937 other->execute(aContact, aDetail, aActionDescriptor); |
1026 other->execute(aContact, aDetail, aActionDescriptor); |
938 } |
1027 } |
939 |
1028 |
940 void CntContactCardViewPrivate::actionExecuted(CntActionLauncher* aAction) |
1029 void CntContactCardViewPrivate::actionExecuted(CntActionLauncher* aAction) |
941 { |
1030 { |
942 aAction->deleteLater(); |
1031 aAction->deleteLater(); |
|
1032 mIsExecutingAction = false; |
943 } |
1033 } |
944 |
1034 |
945 /*! |
1035 /*! |
946 Item specific menu |
1036 Item specific menu |
947 */ |
1037 */ |
1163 |
1254 |
1164 QVersitContactExporter exporter; |
1255 QVersitContactExporter exporter; |
1165 // The vCard version needs to be 2.1 due to backward compatiblity when sending |
1256 // The vCard version needs to be 2.1 due to backward compatiblity when sending |
1166 if (exporter.exportContacts(list, QVersitDocument::VCard21Type)) |
1257 if (exporter.exportContacts(list, QVersitDocument::VCard21Type)) |
1167 { |
1258 { |
1168 qDebug() << "CntContactCardViewPrivate::handleSendBusinessCard, VCard21Type"; |
1259 CNT_LOG_ARGS("VCard21Type"); |
1169 QList<QVersitDocument> docs = exporter.documents(); |
1260 QList<QVersitDocument> docs = exporter.documents(); |
1170 QFile f(vCardPath); |
1261 QFile f(vCardPath); |
1171 if ( f.open(QIODevice::WriteOnly) ) |
1262 if ( f.open(QIODevice::WriteOnly) ) |
1172 { |
1263 { |
1173 qDebug() << "CntContactCardViewPrivate::handleSendBusinessCard write VCard"; |
1264 CNT_LOG_ARGS("write VCard"); |
1174 // Start creating the vCard |
1265 // Start creating the vCard |
1175 QVersitWriter writer; |
1266 QVersitWriter writer; |
1176 writer.setDevice(&f); |
1267 writer.setDevice(&f); |
1177 |
1268 |
1178 bool ret = writer.startWriting(docs); |
1269 bool ret = writer.startWriting(docs); |
1293 count++; |
1385 count++; |
1294 } |
1386 } |
1295 } |
1387 } |
1296 if (!count) |
1388 if (!count) |
1297 { |
1389 { |
1298 XQServiceRequest snd("com.nokia.services.logsservices.starter", "start(int,bool)", false); |
1390 if (mRequest) |
1299 snd << 0; // all calls |
1391 { |
1300 snd << true; // show dialpad |
1392 delete mRequest; |
1301 snd.send(); |
1393 mRequest = 0; |
|
1394 } |
|
1395 |
|
1396 mRequest = mAppManager.create("com.nokia.symbian.ILogsView", "show(QVariantMap)", false); |
|
1397 |
|
1398 if (mRequest) |
|
1399 { |
|
1400 QList<QVariant> args; |
|
1401 QVariantMap map; |
|
1402 map.insert("view_index", QVariant(int(LogsServices::ViewAll))); |
|
1403 map.insert("show_dialpad", QVariant(true)); |
|
1404 map.insert("dialpad_text", QVariant(QString())); |
|
1405 args.append(QVariant(map)); |
|
1406 mRequest->setArguments(args); |
|
1407 mRequest->send(); |
|
1408 } |
1302 } |
1409 } |
1303 else |
1410 else |
1304 { |
1411 { |
1305 QContactDetail preferredDetail = mContact->preferredDetail("call"); |
1412 QContactDetail preferredDetail = mContact->preferredDetail("call"); |
1306 if (!preferredDetail.isEmpty()) |
1413 if (!preferredDetail.isEmpty()) |
1307 { |
1414 { |
1308 executeAction(*mContact, preferredDetail, "call", NULL); |
1415 executeAction(*mContact, preferredDetail, "call"); |
1309 } |
1416 } |
1310 else if (count == 1 ) |
1417 else if (count == 1 ) |
1311 { |
1418 { |
1312 mContact->setPreferredDetail("call", mContact->details<QContactPhoneNumber>().first()); |
1419 executeAction( *mContact, mContact->details<QContactPhoneNumber>().first(), "call"); |
1313 executeAction( *mContact, mContact->details<QContactPhoneNumber>().first(), "call", NULL); |
|
1314 } |
1420 } |
1315 else if(count >= 2 && mAcceptSendKey) |
1421 else if(count >= 2 && mAcceptSendKey) |
1316 { |
1422 { |
1317 mAcceptSendKey = false; |
1423 mAcceptSendKey = false; |
1318 CntActionPopup *actionPopup = new CntActionPopup(mContact); |
1424 CntActionPopup *actionPopup = new CntActionPopup(mContact); |
1319 actionPopup->showActionPopup("call"); |
1425 actionPopup->showActionPopup("call"); |
1320 connect( actionPopup, SIGNAL(executeContactAction(QContact&, QContactDetail, QString)), this, |
1426 connect( actionPopup, SIGNAL(executeContactAction(QContact&, QContactDetail, QString)), this, |
1321 SLOT(executeAction(QContact&, QContactDetail, QString))); |
1427 SLOT(executeAction(QContact&, QContactDetail, QString))); |
1322 connect( actionPopup, SIGNAL(actionPopupCancelPressed()), this, |
1428 connect( actionPopup, SIGNAL(actionPopupCancelPressed()), this, |
1323 SLOT(sendKeyCancelSlot())); |
1429 SLOT(sendKeyCancelSlot())); |
1324 |
1430 } |
|
1431 else |
|
1432 { |
|
1433 //ignore |
1325 } |
1434 } |
1326 } |
1435 } |
1327 } |
1436 } |
1328 |
1437 |
1329 void CntContactCardViewPrivate::sendKeyCancelSlot() |
1438 void CntContactCardViewPrivate::sendKeyCancelSlot() |
1330 { |
1439 { |
1331 mAcceptSendKey = true; |
1440 mAcceptSendKey = true; |
1332 } |
1441 } |
|
1442 |
|
1443 void CntContactCardViewPrivate::onAddedToContacts() |
|
1444 { |
|
1445 emit addToContacts(); |
|
1446 } |
|
1447 |
|
1448 void CntContactCardViewPrivate::contactDeletedFromOtherSource(const QList<QContactLocalId>& contactIds) |
|
1449 { |
|
1450 if ( contactIds.contains(mContact->localId()) ) |
|
1451 { |
|
1452 // Do not switch to the previous view immediately. List views are |
|
1453 // not updated properly if this is not done in the event loop |
|
1454 QTimer::singleShot(0, this, SLOT(showRootView())); |
|
1455 } |
|
1456 } |
|
1457 |
1333 // end of file |
1458 // end of file |