52 const QString latchedTextColor = "qtc_hs_list_item_latched"; |
52 const QString latchedTextColor = "qtc_hs_list_item_latched"; |
53 // Preferences properties |
53 // Preferences properties |
54 const QString widgetPrefContactId = "contactId"; |
54 const QString widgetPrefContactId = "contactId"; |
55 // Docml file |
55 // Docml file |
56 const QString contactWidgetDocml = ":/commlauncherwidget.docml"; |
56 const QString contactWidgetDocml = ":/commlauncherwidget.docml"; |
|
57 |
|
58 |
|
59 // TODO: THESE STRINGS ARE IN W32 SDK. THESE DEFINITIONS CAN BE REMOVED |
|
60 // WHEN EVERYBODY ARE USING IT OR LATER VERSION |
|
61 #ifndef XQI_CONTACTS_FETCH |
|
62 #define XQI_CONTACTS_FETCH QLatin1String("com.nokia.symbian.IContactsFetch") |
|
63 #endif |
|
64 #ifndef XQOP_CONTACTS_FETCH_SINGLE |
|
65 #define XQOP_CONTACTS_FETCH_SINGLE QLatin1String("singleFetch(QString,QString)") |
|
66 #endif |
|
67 |
|
68 |
57 |
69 |
58 /*! |
70 /*! |
59 \class ContactWidgetHs |
71 \class ContactWidgetHs |
60 */ |
72 */ |
61 |
73 |
74 mContactHasAvatarDetail(false), |
86 mContactHasAvatarDetail(false), |
75 mContactManager(0), |
87 mContactManager(0), |
76 mAppManager(0), |
88 mAppManager(0), |
77 mContactSelectRequest(0), |
89 mContactSelectRequest(0), |
78 mMainWindow(0), |
90 mMainWindow(0), |
79 mThumbnailManager(0), |
91 mThumbnailManager(new ThumbnailManager(this)), |
80 mThumbnailPixmap(QPixmap()), |
92 mThumbnailPixmap(QPixmap()), |
81 mThumbnailInProgress(false), |
93 mThumbnailInProgress(false), |
82 mTranslator(0) |
94 mTranslator(new HbTranslator(translationsPath, translationsFile)), |
83 { |
95 mAvatarIcon(0), |
84 // Localization file loading |
96 mPendingExit(false) |
85 mTranslator = new HbTranslator(translationsPath, translationsFile); |
97 { |
|
98 // Localization file loading |
86 mTranslator->loadCommon(); |
99 mTranslator->loadCommon(); |
87 |
100 |
88 // UI creation done in onInitialize() |
101 // UI creation done in onInitialize() |
89 if (mainWindow()) { |
102 if (mainWindow()) { |
90 mMainWindow = mainWindow(); |
103 mMainWindow = mainWindow(); |
93 qDebug() << "mMainWindow(x,y): " << mMainWindow->width() << mMainWindow->height(); |
106 qDebug() << "mMainWindow(x,y): " << mMainWindow->width() << mMainWindow->height(); |
94 } |
107 } |
95 |
108 |
96 // avatar icon item has to be created without parent else the drawing goes wrong |
109 // avatar icon item has to be created without parent else the drawing goes wrong |
97 mAvatarIconItem = new HbIconItem(); |
110 mAvatarIconItem = new HbIconItem(); |
98 |
111 mCleanupHandler.add(mAvatarIconItem); |
99 //Create Communication launcher |
112 //Create Communication launchernew |
100 //Has to be created without parent, otherwise timout, dismissPolicy and modality have no effect |
113 //Has to be created without parent, otherwise timout, dismissPolicy and modality have no effect |
101 mLauncher = new CommLauncherWidget(); |
114 mLauncher = new CommLauncherWidget(); |
|
115 mCleanupHandler.add(mLauncher); |
102 mLauncher->setTimeout(0); |
116 mLauncher->setTimeout(0); |
103 mLauncher->setDismissPolicy(HbPopup::TapAnywhere); |
117 mLauncher->setDismissPolicy(HbPopup::TapAnywhere); |
104 mLauncher->setBackgroundFaded(false); |
118 mLauncher->setBackgroundFaded(false); |
105 mLauncher->setModal(false); |
119 mLauncher->setModal(false); |
106 mLauncher->hide(); |
120 mLauncher->hide(); |
107 // USE CONNECT WHEN THE LATCHED GRAPHICS IS IN THE PLATFORM |
121 // USE CONNECT WHEN THE LATCHED GRAPHICS IS IN THE PLATFORM |
108 //connect(mLauncher, SIGNAL(launcherClosed()), |
122 connect(mLauncher, SIGNAL(launcherClosed()), |
109 // this, SLOT(loadNormalLayout())); |
123 this, SLOT(loadNormalLayout())); |
110 |
124 connect(mLauncher, SIGNAL(requestCompleted()), |
111 mAppManager = new XQApplicationManager(); |
125 this, SLOT(onRequestComplete())); |
|
126 mAppManager = new XQApplicationManager(); |
112 ASSERT(mAppManager); |
127 ASSERT(mAppManager); |
|
128 mCleanupHandler.add(mAppManager); |
113 mLauncher->setApplicationManager(*mAppManager); |
129 mLauncher->setApplicationManager(*mAppManager); |
114 |
130 |
115 // Thumbnail manager so we can handle large size images as contact avatars |
131 // Thumbnail manager so we can handle large size images as contact avatars |
116 mThumbnailManager = new ThumbnailManager(this); |
|
117 mThumbnailManager->setMode(ThumbnailManager::Default); |
132 mThumbnailManager->setMode(ThumbnailManager::Default); |
118 mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForQuality); |
133 mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForQuality); |
119 mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailMedium ); |
134 mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailMedium ); |
120 |
135 |
121 connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)), |
136 connect(mThumbnailManager.data(), SIGNAL(thumbnailReady(QPixmap, void*, int, int)), |
122 this, SLOT(thumbnailReady(QPixmap, void*, int, int))); |
137 this, SLOT(thumbnailReady(QPixmap, void*, int, int))); |
123 |
138 |
124 mWidgetFrameDrawer = new HbFrameDrawer(normalFrameName, |
139 |
125 HbFrameDrawer::NinePieces); |
140 |
126 ASSERT(mWidgetFrameDrawer); |
|
127 |
|
128 mShareFrameDrawer = new HbFrameDrawer(normalFrameName, |
|
129 HbFrameDrawer::NinePieces); |
|
130 ASSERT(mShareFrameDrawer); |
|
131 } |
141 } |
132 |
142 |
133 /*! |
143 /*! |
134 Destructor |
144 Destructor |
135 */ |
145 */ |
136 ContactWidgetHs::~ContactWidgetHs() |
146 ContactWidgetHs::~ContactWidgetHs() |
137 { |
147 { |
138 if (mLauncher) |
148 |
139 { |
149 } |
140 delete mLauncher; |
150 |
141 } |
151 /*! |
142 if (mContactManager) |
152 Slot for handle request complete |
143 { |
153 if pending exit was set , do it. |
144 delete mContactManager; |
154 */ |
145 } |
155 void ContactWidgetHs::onRequestComplete() |
146 if (mAppManager) |
156 { |
147 { |
157 if (mPendingExit) |
148 delete mAppManager; |
158 emit finished(); |
149 } |
|
150 if (mAvatar) |
|
151 { |
|
152 delete mAvatar; |
|
153 } |
|
154 |
|
155 // Deleting request cancels all pending requests |
|
156 if (mContactSelectRequest) |
|
157 { |
|
158 delete mContactSelectRequest; |
|
159 } |
|
160 |
|
161 if (mThumbnailManager) |
|
162 { |
|
163 delete mThumbnailManager; |
|
164 } |
|
165 if (mTranslator) |
|
166 { |
|
167 delete mTranslator; |
|
168 } |
|
169 } |
159 } |
170 |
160 |
171 /*! |
161 /*! |
172 Updates the UI based on data from current contact |
162 Updates the UI based on data from current contact |
173 */ |
163 */ |
236 */ |
226 */ |
237 // THIS IS THE FIRST VERSION OF THUMBNAIL HANDLING, STILL IN PROGRESS 4.6.2010 |
227 // THIS IS THE FIRST VERSION OF THUMBNAIL HANDLING, STILL IN PROGRESS 4.6.2010 |
238 bool ContactWidgetHs::setContactImage(QPixmap& inputPixmap) |
228 bool ContactWidgetHs::setContactImage(QPixmap& inputPixmap) |
239 { |
229 { |
240 bool ret = false; |
230 bool ret = false; |
241 |
231 |
242 HbFrameDrawer *avatarDrawer = new HbFrameDrawer("qtg_fr_hsshortcut_normal", HbFrameDrawer::NinePieces); |
232 QScopedPointer<HbFrameDrawer> avatarDrawer( new HbFrameDrawer(defaultAvatar, |
243 ASSERT(avatarDrawer); |
233 HbFrameDrawer::NinePieces)); |
244 |
234 //TODO: do check other way |
245 // Try to load the image first, because setFrameGraphicsName() returns void. |
235 // This assert must be commented because QScopedPointer not support it this way |
246 //,,mContactImageFileName = imageFile; |
236 //ASSERT(avatarDrawer.isNull()); |
247 |
237 |
248 ret=true; |
238 ret=true; |
249 qDebug() << "setContactImage av 0, inputsize " << inputPixmap.width() << "x" << inputPixmap.height(); |
239 qDebug() << "setContactImage av 0, inputsize " << inputPixmap.width() << "x" << inputPixmap.height(); |
250 |
240 |
251 qreal unit = HbDeviceProfile::current().unitValue(); |
241 qreal unit = HbDeviceProfile::current().unitValue(); |
252 const int contactIconSize = 11 * unit; |
242 const int contactIconSize = 11 * unit; |
254 // Render frame drawer into pixmap |
244 // Render frame drawer into pixmap |
255 QPixmap avatarPixmap(contactIconSize, contactIconSize); |
245 QPixmap avatarPixmap(contactIconSize, contactIconSize); |
256 avatarPixmap.fill(QColor(0, 0, 0, 0)); //transparent background |
246 avatarPixmap.fill(QColor(0, 0, 0, 0)); //transparent background |
257 qDebug() << "setContactImage av 1"; //,, |
247 qDebug() << "setContactImage av 1"; //,, |
258 |
248 |
259 QPainter painter(&avatarPixmap); |
249 QPainter painter(&avatarPixmap); |
260 QStyleOptionGraphicsItem *item = new QStyleOptionGraphicsItem; |
|
261 avatarDrawer->paint(&painter, QRectF(0, 0, contactIconSize, contactIconSize)); |
250 avatarDrawer->paint(&painter, QRectF(0, 0, contactIconSize, contactIconSize)); |
262 painter.end(); |
251 painter.end(); |
263 qDebug() << "setContactImage av 2"; //,, |
252 qDebug() << "setContactImage av 2"; //,, |
264 |
253 |
265 int maxSize = (inputPixmap.width() > inputPixmap.height() ? inputPixmap.width():inputPixmap.height()); |
254 int maxSize = (inputPixmap.width() > inputPixmap.height() ? inputPixmap.width():inputPixmap.height()); |
287 qDebug() << "pm2 " << pm2.width() << " " << pm2.height(); |
276 qDebug() << "pm2 " << pm2.width() << " " << pm2.height(); |
288 avatarPixmap = pm2; // |
277 avatarPixmap = pm2; // |
289 } |
278 } |
290 } |
279 } |
291 |
280 |
292 HbIcon *avatarIcon = new HbIcon(QIcon(avatarPixmap)); |
281 |
293 |
282 mAvatarIcon.reset(new HbIcon(QIcon(avatarPixmap))); |
294 mAvatarIconItem->setIcon(*avatarIcon); |
283 |
|
284 mAvatarIconItem->setIcon(*mAvatarIcon.data()); |
295 mAvatarIconItem->setSize(QSize(contactIconSize, contactIconSize)); |
285 mAvatarIconItem->setSize(QSize(contactIconSize, contactIconSize)); |
296 mAvatarIconItem->setAspectRatioMode(Qt::KeepAspectRatio); |
286 mAvatarIconItem->setAspectRatioMode(Qt::KeepAspectRatio); |
297 |
287 |
298 // Then display the new image |
288 // Then display the new image |
299 update(); |
289 update(); |
300 qDebug() << "setContactImage av 3"; //,, |
290 qDebug() << "setContactImage av 3"; //,, |
301 |
291 |
302 return ret; |
292 return ret; |
303 } |
293 } |
304 |
294 |
305 /*! |
295 /*! |
306 Set contact avatar image used in Paint() |
296 Set contact avatar image used in Paint() |
307 */ |
297 */ |
308 bool ContactWidgetHs::setContactImage(const QString &imageFile) |
298 bool ContactWidgetHs::setContactImage(const QString &imageFile) |
309 { |
299 { |
310 bool ret = false; |
300 bool ret = false; |
311 |
301 QScopedPointer<HbFrameDrawer> avatarDrawer( new HbFrameDrawer(defaultAvatar, |
312 HbFrameDrawer *avatarDrawer = new HbFrameDrawer("qtg_fr_hsshortcut_normal", HbFrameDrawer::NinePieces); |
302 HbFrameDrawer::NinePieces)); |
313 ASSERT(avatarDrawer); |
303 //TODO: do check other way |
314 |
304 //This assert must be commented because QScopedPointer not support it this way |
|
305 //ASSERT(avatarDrawer.isNull()); |
|
306 |
315 // Try to load the image first, because setFrameGraphicsName() returns void. |
307 // Try to load the image first, because setFrameGraphicsName() returns void. |
316 mContactImageFileName = imageFile; |
308 mContactImageFileName = imageFile; |
317 qDebug() << "setContactImage ok " << imageFile; |
309 qDebug() << "setContactImage ok " << imageFile; |
318 if (imageFile == addContactAvatar) { |
310 if (imageFile == addContactAvatar) { |
319 avatarDrawer->setFrameGraphicsName(defaultAvatar); |
311 avatarDrawer->setFrameGraphicsName(defaultAvatar); |
329 // Render frame drawer into pixmap |
321 // Render frame drawer into pixmap |
330 QPixmap avatarPixmap(contactIconSize, contactIconSize); |
322 QPixmap avatarPixmap(contactIconSize, contactIconSize); |
331 avatarPixmap.fill(QColor(0, 0, 0, 0)); //transparent background |
323 avatarPixmap.fill(QColor(0, 0, 0, 0)); //transparent background |
332 |
324 |
333 QPainter painter(&avatarPixmap); |
325 QPainter painter(&avatarPixmap); |
334 QStyleOptionGraphicsItem *item = new QStyleOptionGraphicsItem; |
326 |
335 avatarDrawer->paint(&painter, QRectF(0, 0, contactIconSize, contactIconSize)); |
327 avatarDrawer->paint(&painter, QRectF(0, 0, contactIconSize, contactIconSize)); |
336 painter.end(); |
328 painter.end(); |
337 |
329 |
338 HbIcon *avatarIcon = new HbIcon(QIcon(avatarPixmap)); |
330 |
|
331 |
|
332 mAvatarIcon.reset(new HbIcon(QIcon(avatarPixmap))); |
339 |
333 |
340 // Add badge if needed |
334 // Add badge if needed |
341 if (imageFile == addContactAvatar) { |
335 if (imageFile == addContactAvatar) { |
342 HbIcon addIcon(addContactAvatar); |
336 HbIcon addIcon(addContactAvatar); |
343 QSizeF avatarSize = avatarIcon->size(); |
337 QSizeF avatarSize = mAvatarIcon->size(); |
344 addIcon.setSize(QSize(avatarSize.width()/2, avatarSize.height()/2)); |
338 addIcon.setSize(QSize(avatarSize.width()/2, avatarSize.height()/2)); |
345 avatarIcon->addBadge(Qt::AlignTop | Qt::AlignRight, addIcon, 1); |
339 mAvatarIcon->addBadge(Qt::AlignTop | Qt::AlignRight, addIcon, 1); |
346 } |
340 } |
347 |
341 |
348 mAvatarIconItem->setIcon(*avatarIcon); |
342 mAvatarIconItem->setIcon(*mAvatarIcon.data()); |
349 |
343 |
350 // Then display the new image |
344 // Then display the new image |
351 update(); |
345 update(); |
|
346 |
|
347 |
352 |
348 |
353 return ret; |
349 return ret; |
354 } |
350 } |
355 |
351 |
356 |
352 |
374 const int contactIconSize = 11 * unit; |
370 const int contactIconSize = 11 * unit; |
375 const int widgetMargin = 0.5 * unit; |
371 const int widgetMargin = 0.5 * unit; |
376 const int textRow = 2; |
372 const int textRow = 2; |
377 const int rows = 4; // 4 using 2 margins |
373 const int rows = 4; // 4 using 2 margins |
378 |
374 |
|
375 setContentsMargins(0, 0, 0, 0); |
|
376 |
379 QGraphicsGridLayout *layout = new QGraphicsGridLayout(this); |
377 QGraphicsGridLayout *layout = new QGraphicsGridLayout(this); |
380 |
378 |
|
379 mWidgetFrameDrawer = new HbFrameDrawer(normalFrameName, |
|
380 HbFrameDrawer::NinePieces); |
|
381 ASSERT(mWidgetFrameDrawer); |
|
382 |
|
383 mShareFrameDrawer = new HbFrameDrawer(normalFrameName, |
|
384 HbFrameDrawer::NinePieces); |
|
385 ASSERT(mShareFrameDrawer); |
|
386 |
|
387 |
|
388 |
381 // Widget frame |
389 // Widget frame |
382 qreal corner = 1.5 * unit; // from shortcut widget layout spec: 1.5un |
390 qreal corner = 1.5 * unit; // from shortcut widget layout spec: 1.5un |
383 mWidgetFrameDrawer->setBorderWidths(corner, corner); |
391 mWidgetFrameDrawer->setBorderWidths(corner, corner); |
384 HbFrameItem *widgetFrame = new HbFrameItem(mWidgetFrameDrawer); //drawer ownership transfered to item |
392 HbFrameItem *widgetFrame = new HbFrameItem(mWidgetFrameDrawer); //drawer ownership transfered to item |
385 layout->addItem(widgetFrame, 0, 0, rows, 3); |
393 layout->addItem(widgetFrame, 0, 0, rows, 3); |
424 layout->setRowFixedHeight(0, widgetMargin); |
432 layout->setRowFixedHeight(0, widgetMargin); |
425 layout->setRowFixedHeight(1, contactIconSize); |
433 layout->setRowFixedHeight(1, contactIconSize); |
426 layout->setRowFixedHeight(textRow, fontSpec.textHeight()); |
434 layout->setRowFixedHeight(textRow, fontSpec.textHeight()); |
427 layout->setRowFixedHeight(textRow+1, widgetMargin); |
435 layout->setRowFixedHeight(textRow+1, widgetMargin); |
428 |
436 |
|
437 layout->setHorizontalSpacing(0.5); |
|
438 layout->setVerticalSpacing(1.5); |
|
439 layout->setContentsMargins(0, 0, 0, 0); |
429 setLayout(layout); |
440 setLayout(layout); |
430 |
441 |
431 // Widget size |
442 // Widget size |
432 qreal sizeX = widgetMargin * 2 * unit; //margins from layout spec |
443 qreal sizeX = widgetMargin * 2; // margins from layout spec |
433 qreal sizeY = widgetMargin * 3 * unit; //margins from layout spec |
444 sizeX += contactIconSize; |
|
445 sizeX += 1; // 2*0.5 horizontal spacing |
|
446 qreal sizeY = widgetMargin * 2; // margins from layout spec |
|
447 sizeY += contactIconSize; |
434 sizeY += fontSpec.textHeight(); |
448 sizeY += fontSpec.textHeight(); |
435 sizeY += contactIconSize; |
449 sizeY += 5; // 3*0.5 vertical spacing, 5 because 4.5 broke snaping |
436 sizeX += contactIconSize; |
450 |
437 |
451 |
438 qDebug() << "widget sizex, sizey, unit, rows " << sizeX << sizeY << unit << rows; |
452 qDebug() << "widget sizex, sizey, unit, rows " << sizeX << sizeY << unit << rows; |
439 |
453 |
440 // Without preferredSize() moving widgets to another page doesn't work |
454 // Without preferredSize() moving widgets to another page doesn't work |
441 setPreferredSize( sizeX, sizeY ); |
455 setPreferredSize( sizeX, sizeY ); |
442 resize(preferredSize()); |
456 resize(preferredSize()); |
443 } |
457 } |
444 |
458 |
445 QString ContactWidgetHs::getContactDisplayName(QContact& contact) |
459 QString ContactWidgetHs::getContactDisplayName(QContact& contact) |
446 { |
460 { |
447 QString name = mContactManager->synthesizedDisplayLabel(contact); |
461 QString name = mContactManager->synthesizedContactDisplayLabel(contact); |
448 if (name.isEmpty()) { |
462 if (name.isEmpty()) |
449 name = hbTrId("txt_friend_widget_contact_unnamed"); |
463 { |
450 } |
464 name = hbTrId("txt_friend_widget_contact_unnamed"); |
|
465 } |
451 return name; |
466 return name; |
452 } |
467 } |
453 |
468 |
454 /*! |
469 /*! |
455 Implemented to receive mouse press events. |
470 Implemented to receive mouse press events. |
456 Otherwise these events will propagate to any topmost item beneath this item. |
471 Otherwise these events will propagate to any topmost item beneath this item. |
457 */ |
472 */ |
458 void ContactWidgetHs::mousePressEvent(QGraphicsSceneMouseEvent *event) |
473 void ContactWidgetHs::mousePressEvent(QGraphicsSceneMouseEvent *event) |
459 { |
474 { |
460 Q_UNUSED(event); |
475 Q_UNUSED(event); |
461 } |
476 } |
462 |
477 |
463 /*! |
478 /*! |
464 \fn void ContactWidgetHs::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) |
479 \fn void ContactWidgetHs::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) |
465 |
480 |
490 if (mb.exec() == mb.action(HbDeviceMessageBox::AcceptButtonRole)) { |
505 if (mb.exec() == mb.action(HbDeviceMessageBox::AcceptButtonRole)) { |
491 mLauncher->openPhonebookCreateNew(); |
506 mLauncher->openPhonebookCreateNew(); |
492 } |
507 } |
493 } |
508 } |
494 } else if (!mLauncher->isVisible()) { |
509 } else if (!mLauncher->isVisible()) { |
|
510 // Change the frame layout |
|
511 loadLayout(latchedFrameName, latchedTextColor); |
|
512 |
495 // create and show CommunicationsLauncher |
513 // create and show CommunicationsLauncher |
496 createLauncherWithPosition(); |
514 createLauncherWithPosition(); |
497 mLauncher->show(); |
515 mLauncher->show(); |
498 // USE LOADLAYOUT-FUNCTION WHEN THE LATCHED GRAPHICS IS IN THE PLATFORM |
|
499 //loadLayout(latchedFrameName, latchedTextColor); |
|
500 |
516 |
501 mLauncherRect = mLauncher->boundingRect(); |
517 mLauncherRect = mLauncher->boundingRect(); |
502 qDebug() << "after exec rect() " << mLauncherRect; |
518 qDebug() << "after exec rect() " << mLauncherRect; |
503 } |
519 } |
504 } |
520 } |
526 QString avatarFile; |
542 QString avatarFile; |
527 QList<QContactAvatar> details = mContact.details<QContactAvatar>(); |
543 QList<QContactAvatar> details = mContact.details<QContactAvatar>(); |
528 for (int i=0; i<details.count(); i++) |
544 for (int i=0; i<details.count(); i++) |
529 { |
545 { |
530 if (details.at(i).imageUrl().isValid()) |
546 if (details.at(i).imageUrl().isValid()) |
531 { |
547 { |
532 delete mAvatar; |
548 |
533 mAvatar = new QContactAvatar(details.at(i)); |
549 mAvatar.reset( new QContactAvatar(details.at(i))); |
|
550 //mCleanupHandler.add(mAvatar); |
534 avatarFile = mAvatar->imageUrl().toString(); //,,remove this once tn is working |
551 avatarFile = mAvatar->imageUrl().toString(); //,,remove this once tn is working |
535 |
552 |
536 mThumbnailInProgress = true; |
553 mThumbnailInProgress = true; |
537 qDebug() << "calling mThumbnailManager->getThumbnail"; |
554 qDebug() << "calling mThumbnailManager->getThumbnail"; |
538 mThumbnailManager->getThumbnail(mAvatar->imageUrl().toString()); |
555 mThumbnailManager->getThumbnail(mAvatar->imageUrl().toString()); |
574 if (mContactManager) { |
591 if (mContactManager) { |
575 delete mContactManager; |
592 delete mContactManager; |
576 } |
593 } |
577 qDebug() << "createContactManager() backend " << sBackend; |
594 qDebug() << "createContactManager() backend " << sBackend; |
578 mContactManager = new QContactManager(sBackend); |
595 mContactManager = new QContactManager(sBackend); |
|
596 mCleanupHandler.add(mContactManager); |
579 if (mContactManager->error()) { |
597 if (mContactManager->error()) { |
580 qDebug() << "cm can't connect to backend " << sBackend; |
598 qDebug() << "cm can't connect to backend " << sBackend; |
581 } else { // connect contact change observation |
599 } else { // connect contact change observation |
582 connect(mContactManager, SIGNAL(contactsChanged(QList<QContactLocalId>)), |
600 connect(mContactManager, SIGNAL(contactsChanged(QList<QContactLocalId>)), |
583 this, SLOT(onContactsChanged(QList<QContactLocalId>))); |
601 this, SLOT(onContactsChanged(QList<QContactLocalId>))); |
688 mContactSelectRequest = 0; |
706 mContactSelectRequest = 0; |
689 } |
707 } |
690 qDebug() << "- launchSingleContactSelecting() starts"; //,, |
708 qDebug() << "- launchSingleContactSelecting() starts"; //,, |
691 mContactLocalId = unUsedContactId; |
709 mContactLocalId = unUsedContactId; |
692 |
710 |
693 /* TODO! THIS SERVICE WILL BE RENAMED TO com.nokia.services.phonebook.Services */ |
711 mContactSelectRequest = mAppManager->create(XQI_CONTACTS_FETCH, |
694 mContactSelectRequest = mAppManager->create( |
712 XQOP_CONTACTS_FETCH_SINGLE, |
695 "com.nokia.services.phonebookservices", |
713 false); |
696 "Fetch", |
714 mCleanupHandler.add(mContactSelectRequest); |
697 "Dofetch(QString,QString,QString,QString)", |
|
698 false); |
|
699 connect(mContactSelectRequest, SIGNAL(requestOk(QVariant)), |
715 connect(mContactSelectRequest, SIGNAL(requestOk(QVariant)), |
700 this, SLOT(onContactSelectCompleted(QVariant))); |
716 this, SLOT(onContactSelectCompleted(QVariant))); |
701 QList<QVariant> args; |
717 QList<QVariant> args; |
702 args << hbTrId("txt_friend_widget_title_select_contact"); |
718 args << hbTrId("txt_friend_widget_title_select_contact"); |
703 args << KCntActionAll; |
719 args << KCntActionAll; |
704 args << KCntFilterDisplayAll; |
|
705 args << KCntSingleSelectionMode; |
|
706 mContactSelectRequest->setArguments(args); |
720 mContactSelectRequest->setArguments(args); |
707 |
721 |
708 qDebug() << "---- setArgs done ---------------------"; //,,28.5. |
722 qDebug() << "---- setArgs done ---------------------"; //,,28.5. |
709 |
723 |
710 result = mContactSelectRequest->send(); |
724 result = mContactSelectRequest->send(); |
860 Updates the layout with given frame and text color |
877 Updates the layout with given frame and text color |
861 */ |
878 */ |
862 void ContactWidgetHs::loadLayout(const QString frameName, const QString textColor) |
879 void ContactWidgetHs::loadLayout(const QString frameName, const QString textColor) |
863 { |
880 { |
864 mWidgetFrameDrawer->setFrameGraphicsName(frameName); |
881 mWidgetFrameDrawer->setFrameGraphicsName(frameName); |
865 mWidgetFrameDrawer->themeChanged(); |
882 // mWidgetFrameDrawer->themeChanged(); |
866 |
883 |
867 mShareFrameDrawer->setFrameGraphicsName(frameName); |
884 mShareFrameDrawer->setFrameGraphicsName(frameName); |
868 mShareFrameDrawer->themeChanged(); |
885 // mShareFrameDrawer->themeChanged(); |
869 |
886 |
870 QColor color = HbColorScheme::color(textColor); |
887 QColor color = HbColorScheme::color(textColor); |
871 mContactNameLabel->setTextColor(color); |
888 mContactNameLabel->setTextColor(color); |
872 |
889 |
873 update(); |
890 update(); |