--- a/contactwidgethsplugin/contactwidgeths/src/contactwidgeths.cpp Fri Sep 03 14:32:33 2010 +0300
+++ b/contactwidgethsplugin/contactwidgeths/src/contactwidgeths.cpp Thu Sep 09 16:37:32 2010 +0300
@@ -92,7 +92,6 @@
mThumbnailPixmap(QPixmap()),
mThumbnailInProgress(false),
mTranslator(new HbTranslator(translationsPath, translationsFile)),
- mAvatarIcon(0),
mPendingExit(false)
{
// Localization file loading
@@ -601,6 +600,12 @@
this, SLOT(onContactsChanged(QList<QContactLocalId>)));
connect(mContactManager, SIGNAL(contactsRemoved(QList<QContactLocalId>)),
this, SLOT(onContactsRemoved(QList<QContactLocalId>)));
+ connect(mContactManager,
+ SIGNAL(selfContactIdChanged(const QContactLocalId &,
+ const QContactLocalId &)),
+ this,
+ SLOT(onSelfContactIdChanged(const QContactLocalId &,
+ const QContactLocalId &)));
}
}
@@ -811,21 +816,7 @@
for(i=0; i<contactIds.count(); i++) {
if (contactIds.at(i) == mContactLocalId) {
qDebug() << "-deleting widget with removed contact " << mContactLocalId;
-
- mAvatarIconItem->deleteLater();
- mContactNameLabel->deleteLater();
-
- mContactLocalId = unUsedContactId;
-
- mContactHasAvatarDetail = false;
-
-
- if (!mLauncher->isPendingRequest()){
- emit finished();
- }
- else {
- mPendingExit = true;
- }
+ finishWidget();
break;
}
}
@@ -890,5 +881,26 @@
update();
}
+void ContactWidgetHs::onSelfContactIdChanged(const QContactLocalId &theOldId,
+ const QContactLocalId &theNewId) {
+ if (0 != theNewId && mContactLocalId == theNewId) {
+ qDebug() << "-deleting widget after selfcontact change"
+ << mContactLocalId;
+ finishWidget();
+ }
+}
+
+void ContactWidgetHs::finishWidget() {
+ mAvatarIconItem->deleteLater();
+ mContactNameLabel->deleteLater();
+ mContactLocalId = unUsedContactId;
+ mContactHasAvatarDetail = false;
+
+ if (!mLauncher->isPendingRequest()) {
+ emit finished();
+ } else {
+ mPendingExit = true;
+ }
+}
Q_IMPLEMENT_USER_METATYPE(CntServicesContact)
Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList)