[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:19:08 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=2b2b505

The following commit has been merged in the master branch:
commit 2b2b50566ca640fa5211d3f763b345be96ca6450
Author: Alexandr Akulich <akulichalexander at gmail.com>
Date:   Mon Nov 25 16:14:12 2013 +0100

    Refactor of Contact plasmoid
    
    TelepathyContact:
        Removed qmlObject related stuff.
        m_contact renamed to m_contactWrapper as it should be.
        Setup context property before loading qml file.
    
    ContactWrapper:
        Properties placed there them should be.
        Added property isContactOnline;
        Added notifier-signals information for properties.
        Property canStartVideo renamed to canStartVideoCall
          (like canStartAudioCall).
    
        undoAccountConnects() reimplemented to don't break
          connections possible maked outside.
        Same about undoContactConnects().
    
        Methods reordered in cpp file to group simular methods together.
        Implemented updateProperties(). In future it's possible
          to implement granulated properties updating.
        Added checks for isAccountOnline in presenceStatus().
        Fixed coding-style.
    
    QML part:
        Get rid a lot of functions, that anyway doesn't work properly.
        Get rid a lot of useless properties.
        Don't check avatarPresenceStatus for empty string and don't replace
          it with default one, because it's already done in c++ part.
        Get rid a lot of "anchors.fill: parent" and such, because it's
          bad practice to let children position itself on parent.
        Comminication buttons reordered like in KDE IM Contacts application.
    
    Side effects:
        Fixed losted after few went offline/online presenceStatus.
        Fixed communication buttons remaining available after account becomes offline.
    
    REVIEW: 113824
---
 contact/src/contact-wrapper.cpp                    | 105 +++++++++++++--------
 contact/src/contact-wrapper.h                      |  51 ++++++----
 contact/src/declarative/contents/ui/Avatar.qml     |  62 ++----------
 contact/src/declarative/contents/ui/Contact.qml    |  41 +-------
 .../src/declarative/contents/ui/DropDownMenu.qml   |  65 ++++++-------
 contact/src/declarative/contents/ui/main.qml       |  17 +---
 contact/src/telepathy-contact.cpp                  |  40 +++-----
 contact/src/telepathy-contact.h                    |   3 +-
 8 files changed, 152 insertions(+), 232 deletions(-)

diff --git a/contact/src/contact-wrapper.cpp b/contact/src/contact-wrapper.cpp
index 5ef5919..db05f3b 100644
--- a/contact/src/contact-wrapper.cpp
+++ b/contact/src/contact-wrapper.cpp
@@ -84,7 +84,7 @@ bool ContactWrapper::canStartAudioCall() const
     }
 }
 
-bool ContactWrapper::canStartVideo() const
+bool ContactWrapper::canStartVideoCall() const
 {
     if (m_contact && m_account) {
         return (m_contact->capabilities().streamedMediaVideoCalls() && m_account->capabilities().streamedMediaVideoCalls());
@@ -125,10 +125,13 @@ void ContactWrapper::genericOperationFinished(Tp::PendingOperation* op)
 
 bool ContactWrapper::isAccountOnline() const
 {
-    if (m_account) {
-        if (m_account->currentPresence().type() != Tp::Presence::offline().type()) {
-            return true;
-        }
+    return m_account && m_account->currentPresence().type() != Tp::Presence::offline().type();
+}
+
+bool ContactWrapper::isContactOnline() const
+{
+    if (m_contact && isAccountOnline()) {
+        return m_contact->presence().type() != Tp::Presence::offline().type();
     }
 
     return false;
@@ -156,45 +159,67 @@ void ContactWrapper::onContactManagerStateChanged(Tp::ContactListState newState)
     }
 }
 
+void ContactWrapper::updateProperties()
+{
+    emit accountOnlineChanged();
+
+    emit presenceStatusChanged();
+    emit contactOnlineChanged();
+
+    emit avatarChanged();
+
+    emit canSendFileChanged();
+    emit canStartAudioCallChanged();
+    emit canStartVideoCallChanged();
+
+    emit displayNameChanged();
+}
+
 QString ContactWrapper::presenceStatus() const
 {
-    if (m_contact) {
+    if (m_contact && isAccountOnline()) {
         return m_contact->presence().status();
     } else {
         return QString();
     }
 }
 
-void ContactWrapper::setupAccountConnects()
+void ContactWrapper::connectAccountSignals()
 {
     // keep track of presence (online/offline is all we need)
     connect(m_account.data(), SIGNAL(connectionChanged(Tp::ConnectionPtr)), this, SLOT(onConnectionChanged(Tp::ConnectionPtr)));
-    connect(m_account.data(), SIGNAL(currentPresenceChanged(Tp::Presence)), this, SIGNAL(accountPresenceChanged()));
+    connect(m_account.data(), SIGNAL(currentPresenceChanged(Tp::Presence)), this, SLOT(updateProperties()));
 }
 
-void ContactWrapper::setupContactConnects()
+void ContactWrapper::connectContactSignals()
 {
     connect(m_contact.data(), SIGNAL(avatarDataChanged(Tp::AvatarData)), this, SIGNAL(avatarChanged()));
-    connect(m_contact.data(), SIGNAL(presenceChanged(Tp::Presence)), this, SIGNAL(presenceChanged()));
+    connect(m_contact.data(), SIGNAL(presenceChanged(Tp::Presence)), this, SLOT(updateProperties()));
 }
 
-void ContactWrapper::sendMail()
+void ContactWrapper::disconnectAccountSignals()
 {
-    if (!m_account || !m_contact) {
-        return;
+    if (m_account) {
+        disconnect(m_account.data(), SIGNAL(connectionChanged(Tp::ConnectionPtr)), this, SLOT(onConnectionChanged(Tp::ConnectionPtr)));
+        disconnect(m_account.data(), SIGNAL(currentPresenceChanged(Tp::Presence)), this, SLOT(updateProperties()));
     }
-
-    KToolInvocation::invokeMailer(KUrl(m_contact->id()));
 }
 
-void ContactWrapper::startAudioCall()
+void ContactWrapper::disconnectContactSignals()
 {
-    kDebug();
+    if (m_contact) {
+        disconnect(m_contact.data(), SIGNAL(avatarDataChanged(Tp::AvatarData)), this, SIGNAL(avatarChanged()));
+        disconnect(m_contact.data(), SIGNAL(presenceChanged(Tp::Presence)), this, SLOT(updateProperties()));
+    }
 }
 
-void ContactWrapper::startFileTransfer()
+void ContactWrapper::sendMail()
 {
-    kDebug();
+    if (!m_account || !m_contact) {
+        return;
+    }
+
+    KToolInvocation::invokeMailer(KUrl(m_contact->id()));
 }
 
 void ContactWrapper::startTextChat()
@@ -203,21 +228,32 @@ void ContactWrapper::startTextChat()
         return;
     }
 
-    Tp::PendingChannelRequest* channelRequest = KTp::Actions::startChat(m_account, m_contact);
+    Tp::PendingChannelRequest *channelRequest = KTp::Actions::startChat(m_account, m_contact);
     connect(channelRequest, SIGNAL(finished(Tp::PendingOperation*)), this, SLOT(genericOperationFinished(Tp::PendingOperation*)));
 }
 
+void ContactWrapper::startAudioCall()
+{
+    kDebug();
+}
+
 void ContactWrapper::startVideoCall()
 {
     kDebug();
 }
 
+void ContactWrapper::startFileTransfer()
+{
+    kDebug();
+}
+
 void ContactWrapper::setAccount(const Tp::AccountPtr& relatedAccount)
 {
-    kDebug() << "setting account to: " << relatedAccount->displayName();
-    undoAccountConnects();
+    disconnectAccountSignals();
     m_account = relatedAccount;
-    setupAccountConnects();
+    connectAccountSignals();
+
+    updateProperties();
 }
 
 void ContactWrapper::setContact(const Tp::ContactPtr& newContact)
@@ -225,14 +261,16 @@ void ContactWrapper::setContact(const Tp::ContactPtr& newContact)
     kDebug() << "setting new contact to: " << newContact->id();
 
     // disconnect signals
-    undoContactConnects();
+    disconnectContactSignals();
     m_contact = newContact;
 
     // establish new signals
-    setupContactConnects();
+    connectContactSignals();
 
     // tell QML we have a new contact
-    emit(newContactSet());
+    emit contactChanged();
+
+    updateProperties();
 }
 
 void ContactWrapper::setTempAvatar(const QString& path)
@@ -247,18 +285,3 @@ void ContactWrapper::setTempContactId(const QString& tempId)
 {
     m_tempContactId = tempId;
 }
-
-void ContactWrapper::undoAccountConnects()
-{
-    if (m_account) {
-        disconnect(m_account.data(), 0, 0, 0);
-    }
-}
-
-void ContactWrapper::undoContactConnects()
-{
-    if (m_contact) {
-        disconnect(m_contact.data(), 0, 0, 0);
-    }
-}
-
diff --git a/contact/src/contact-wrapper.h b/contact/src/contact-wrapper.h
index 7b37907..778a7a0 100644
--- a/contact/src/contact-wrapper.h
+++ b/contact/src/contact-wrapper.h
@@ -28,18 +28,21 @@
 class ContactWrapper : public QObject
 {
     Q_OBJECT
+    Q_PROPERTY(bool isAccountOnline READ isAccountOnline NOTIFY accountOnlineChanged)
+    Q_PROPERTY(bool isContactOnline READ isContactOnline NOTIFY contactOnlineChanged)
+    Q_PROPERTY(QString avatar READ avatar NOTIFY avatarChanged)
+
+    Q_PROPERTY(bool canSendFile READ canSendFile NOTIFY canSendFileChanged)
+    Q_PROPERTY(bool canStartAudioCall READ canStartAudioCall NOTIFY canStartAudioCallChanged)
+    Q_PROPERTY(bool canStartVideoCall READ canStartVideoCall NOTIFY canStartVideoCallChanged)
+
+    Q_PROPERTY(QString displayName READ displayName NOTIFY displayNameChanged)
+    Q_PROPERTY(QString presenceStatus READ presenceStatus NOTIFY presenceStatusChanged)
+
 public:
     ContactWrapper(QObject *parent = 0);
     virtual ~ContactWrapper();
 
-    Q_PROPERTY(bool accountOnline READ isAccountOnline);
-    Q_PROPERTY(QString avatar READ avatar);
-    Q_PROPERTY(bool canSendFile READ canSendFile);
-    Q_PROPERTY(bool canStartAudioCall READ canStartAudioCall);
-    Q_PROPERTY(bool canStartVideo READ canStartVideo);
-    Q_PROPERTY(QString displayName READ displayName);
-    Q_PROPERTY(QString presenceStatus READ presenceStatus);
-
     /** returns the account id related to the contact chosen */
     QString accountId() const;
 
@@ -53,7 +56,7 @@ public:
     bool canStartAudioCall() const;
 
     /** returns whether the contact can start/receive video */
-    bool canStartVideo() const;
+    bool canStartVideoCall() const;
 
     /** returns current contact being represented */
     Tp::ContactPtr contact() const;
@@ -64,6 +67,9 @@ public:
     /** returns whether the account is online/offline */
     bool isAccountOnline() const;
 
+    /** returns whether the contact is online/offline */
+    bool isContactOnline() const;
+
     /** returns the contact presence status (online, offlince ... ) */
     QString presenceStatus() const;
 
@@ -87,27 +93,36 @@ public:
 
 public slots:
     void sendMail();
-    void startAudioCall();
-    void startFileTransfer();
     void startTextChat();
+    void startAudioCall();
     void startVideoCall();
+    void startFileTransfer();
 
 signals:
-    void accountPresenceChanged();
+    void accountOnlineChanged();
     void avatarChanged();
-    void newContactSet();
-    void presenceChanged();
+
+    void canSendFileChanged();
+    void canStartAudioCallChanged();
+    void canStartVideoCallChanged();
+
+    void displayNameChanged();
+    void presenceStatusChanged();
+    void contactOnlineChanged();
+
+    void contactChanged();
 
 private slots:
     void genericOperationFinished(Tp::PendingOperation *op);
     void onConnectionChanged(const Tp::ConnectionPtr &newConn);
     void onContactManagerStateChanged(Tp::ContactListState state);
+    void updateProperties();
 
 private:
-    void setupAccountConnects();
-    void setupContactConnects();
-    void undoAccountConnects();
-    void undoContactConnects();
+    void connectAccountSignals();
+    void connectContactSignals();
+    void disconnectAccountSignals();
+    void disconnectContactSignals();
 
     Tp::AccountPtr m_account;
     Tp::ContactPtr m_contact;
diff --git a/contact/src/declarative/contents/ui/Avatar.qml b/contact/src/declarative/contents/ui/Avatar.qml
index 6133563..4bdeb11 100644
--- a/contact/src/declarative/contents/ui/Avatar.qml
+++ b/contact/src/declarative/contents/ui/Avatar.qml
@@ -23,86 +23,40 @@ import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
 Item {
     id: container;
 
-    // eliminate once finished. This is only a test image
-    property string avatarPath: "";
-    property string avatarPresenceStatus;
-
     signal clicked();
 
-    anchors.fill: parent;
-
-    Component.onCompleted: {
-        setAvatarPresenceStatus(avatarPresenceStatus);
-    }
-
     // TODO: use image instead of iconwidget?
     PlasmaWidgets.IconWidget {
         id: avatar;
         anchors.fill: parent;
         anchors.margins: 10;
+        icon: QIcon(TelepathyContact.avatar);
 
         onClicked: {
             // toggleMenu
             container.clicked();
         }
-
-        Component.onCompleted: {
-            if (avatarPath == "") {
-                avatar.icon = QIcon("im-user");
-            } else {
-                avatar.icon = QIcon(avatarPath);
-            }
-        }
     }
 
     BorderImage {
         id: avatarFrame;
         width: 128;
         height: 128;
+        source: getFrameForAvatarPresence(TelepathyContact.presenceStatus)
     }
 
-    // show drop-down action menu
-    function showMenu()
-    {
-        console.log("SHOW MENU");
-    }
-
-    function setAvatarPresenceStatus(presenceStatus)
+    function getFrameForAvatarPresence(presenceStatus)
     {
         switch (presenceStatus) {
             case "available":
-                avatarFrame.source = "../frames/online.png";
-                break;
+                return "../frames/online.png";
             case "dnd":
-                avatarFrame.source = "../frames/busy.png";
-                break;
+                return "../frames/busy.png";
             case "away":
-                avatarFrame.source = "../frames/away.png";
-                break;
-            case "offline":
-                avatarFrame.source = "../frames/offline.png";
-                break;
+                return "../frames/away.png";
             default:
-                avatarFrame.source = "../frames/offline.png";
-                break;
-        }
-    }
-
-    // updates avatar info with info from contact currently set
-    function update()
-    {
-        avatar.icon = QIcon(TelepathyContact.avatar);
-    }
-
-    function accountPresenceChanged()
-    {
-        // check if user account is online
-        if (!TelepathyContact.accountOnline && avatar.enabled) {
-            setAvatarPresenceStatus("offline");
-        } else if (TelepathyContact.accountOnline && !avatar.enabled) {
-            // set back to normal
-            avatarPresenceStatus = TelepathyContact.presenceStatus;
-            setAvatarPresenceStatus(avatarPresenceStatus);
+            case "offline":
+                return "../frames/offline.png";
         }
     }
 }
diff --git a/contact/src/declarative/contents/ui/Contact.qml b/contact/src/declarative/contents/ui/Contact.qml
index ab434c8..c14671c 100644
--- a/contact/src/declarative/contents/ui/Contact.qml
+++ b/contact/src/declarative/contents/ui/Contact.qml
@@ -22,20 +22,9 @@ import QtQuick 1.1
 Item {
     id: wrapper;
 
-    // contact/person presence status
-    property string status: "offline";
-
-    anchors.fill: parent;
-
     Avatar {
         id: avatar;
-        avatarPresenceStatus: wrapper.status;
-
-        anchors {
-            top: parent.top;
-            left: parent.left;
-            right: parent.right;
-        }
+        anchors.fill: parent
 
         onClicked: {
             dropDownMenu.toggleMenu();
@@ -44,31 +33,7 @@ Item {
 
     DropDownMenu {
         id: dropDownMenu;
-        width: wrapper.width;
-
-        presenceStatus: wrapper.status;
-
-        anchors {
-            top: avatar.bottom;
-            left: avatar.left;
-            right: avatar.right;
-        }
-    }
-
-    function update()
-    {
-        if (wrapper.status != TelepathyContact.presenceStatus) {
-            wrapper.status = TelepathyContact.presenceStatus;
-            avatar.setAvatarPresenceStatus(wrapper.status);
-        }
-
-        // update avatar
-        avatar.update();
-        dropDownMenu.update();
-    }
-
-    function accountPresenceChanged()
-    {
-        avatar.accountPresenceChanged();
+        width: avatar.width
+        anchors.top: parent.bottom
     }
 }
diff --git a/contact/src/declarative/contents/ui/DropDownMenu.qml b/contact/src/declarative/contents/ui/DropDownMenu.qml
index 7177c70..234d6b9 100644
--- a/contact/src/declarative/contents/ui/DropDownMenu.qml
+++ b/contact/src/declarative/contents/ui/DropDownMenu.qml
@@ -24,79 +24,78 @@ Item {
     id: container;
     state: "hidden";
 
-    property string presenceStatus;
-
     Row {
         spacing: 2;
         anchors.centerIn: parent;
 
         PlasmaWidgets.IconWidget {
-            id: callButton;
-            icon: QIcon("audio-headset");
+            id: chatButton;
+            icon: QIcon("text-x-generic");
             width: 22;
-            height: 22
+            height: 22;
 
-            enabled: presenceStatus != "offline";
+            enabled: TelepathyContact.isContactOnline && TelepathyContact.presenceStatus !== "offline";
 
             onClicked: {
-                TelepathyContact.startAudioCall();
-                toggleMenu();
+                TelepathyContact.startTextChat();
+                state = "hidden";
             }
         }
 
         PlasmaWidgets.IconWidget {
-            id: mailButton;
-            icon: QIcon("mail-message-new");
+            id: callButton;
+            icon: QIcon("audio-headset");
             width: 22;
             height: 22
 
-            // mail button should be enabled even when the contact is offline
+            enabled: TelepathyContact.isContactOnline && TelepathyContact.canStartAudioCall && TelepathyContact.presenceStatus !== "offline";
 
             onClicked: {
-                TelepathyContact.sendMail();
-                toggleMenu();
+                TelepathyContact.startAudioCall();
+                state = "hidden";
             }
         }
 
         PlasmaWidgets.IconWidget {
-            id: chatButton;
-            icon: QIcon("text-x-generic");
+            id: videoButton;
+            icon: QIcon("camera-web");
             width: 22;
             height: 22;
 
-            enabled: presenceStatus != "offline";
+            enabled: TelepathyContact.isContactOnline && TelepathyContact.canStartVideoCall;
 
             onClicked: {
-                TelepathyContact.startTextChat();
-                toggleMenu();
+                TelepathyContact.startVideoCall();
+                state = "hidden";
             }
         }
 
         PlasmaWidgets.IconWidget {
-            id: videoButton;
-            icon: QIcon("camera-web");
+            id: fileTransferButton;
+            icon: QIcon("mail-attachment");
             width: 22;
             height: 22;
 
-            enabled: presenceStatus != "offline";
+            enabled: TelepathyContact.isContactOnline && TelepathyContact.canSendFile;
 
             onClicked: {
-                TelepathyContact.startVideoCall();
-                toggleMenu();
+                TelepathyContact.startFileTransfer();
+                state = "hidden";
             }
         }
 
         PlasmaWidgets.IconWidget {
-            id: fileTransferButton;
-            icon: QIcon("mail-attachment");
+            id: mailButton;
+            icon: QIcon("mail-message-new");
             width: 22;
-            height: 22;
+            height: 22
 
-            enabled: presenceStatus != "offline";
+            // mail button should be enabled even when the contact is offline
+            enabled: TelepathyContact.isContactOnline;
 
             onClicked: {
-                TelepathyContact.startFileTransfer();
-                toggleMenu();
+                TelepathyContact.sendMail();
+                state = "hidden";
             }
         }
     }
@@ -136,12 +135,4 @@ Item {
             state = "hidden";
         }
     }
-
-    function update()
-    {
-        // update icon "enables"
-        callButton.enabled = TelepathyContact.canStartAudioCall;
-        videoButton.enabled = TelepathyContact.canStartVideo;
-        fileTransferButton.enabled = TelepathyContact.canSendFile;
-    }
 }
diff --git a/contact/src/declarative/contents/ui/main.qml b/contact/src/declarative/contents/ui/main.qml
index debb0ed..346a747 100644
--- a/contact/src/declarative/contents/ui/main.qml
+++ b/contact/src/declarative/contents/ui/main.qml
@@ -28,21 +28,6 @@ Item {
 
     Contact {
         id: contact;
-        anchors.centerIn: parent;
-    }
-
-    function updateContact()
-    {
-        contact.update();
-    }
-
-    function toggleDropDownMenu()
-    {
-        contact.toggleMenu();
-    }
-
-    function accountPresenceChanged()
-    {
-        contact.accountPresenceChanged();
+        anchors.fill: parent
     }
 }
diff --git a/contact/src/telepathy-contact.cpp b/contact/src/telepathy-contact.cpp
index 67c8a32..a768d6f 100644
--- a/contact/src/telepathy-contact.cpp
+++ b/contact/src/telepathy-contact.cpp
@@ -23,7 +23,6 @@
 #include <KConfig>
 #include <KStandardDirs>
 
-#include <QObject>
 #include <QDeclarativeEngine>
 #include <QDeclarativeContext>
 
@@ -42,8 +41,7 @@
 TelepathyContact::TelepathyContact(QObject* parent, const QVariantList& args)
     : Plasma::Applet(parent, args)
     , m_declarative(new Plasma::DeclarativeWidget(this))
-    , m_contact(new ContactWrapper(parent))
-    , m_qmlObject(0)
+    , m_contactWrapper(new ContactWrapper(parent))
 {
     // setup plasmoid
     resize(128, 128);
@@ -58,7 +56,6 @@ TelepathyContact::TelepathyContact(QObject* parent, const QVariantList& args)
     if (args.length() == 1) {
         m_fileToLoad = args.first().toString();
     }
-
 }
 
 TelepathyContact::~TelepathyContact()
@@ -77,17 +74,8 @@ void TelepathyContact::init()
     if (m_declarative) {
         QString qmlFile = KGlobal::dirs()->findResource("data", "plasma/plasmoids/org.kde.ktp-contact/contents/ui/main.qml");
         kDebug() << "LOADING: " << qmlFile;
+        m_declarative->engine()->rootContext()->setContextProperty("TelepathyContact", m_contactWrapper);
         m_declarative->setQmlPath(qmlFile);
-        m_declarative->engine()->rootContext()->setContextProperty("TelepathyContact", m_contact);
-
-        // setup qml object so that we can talk to the declarative part
-        m_qmlObject = dynamic_cast<QObject*>(m_declarative->rootObject());
-
-        // connect the qml object to receive signals from C++ end
-        connect(m_contact, SIGNAL(newContactSet()), m_qmlObject, SLOT(updateContact()));
-        connect(m_contact, SIGNAL(avatarChanged()), m_qmlObject, SLOT(updateContact()));
-        connect(m_contact, SIGNAL(presenceChanged()), m_qmlObject, SLOT(updateContact()));
-        connect(m_contact, SIGNAL(accountPresenceChanged()), m_qmlObject, SLOT(accountPresenceChanged()));
     }
 }
 
@@ -110,7 +98,7 @@ void TelepathyContact::loadConfig()
         if (file.open(QFile::ReadOnly)) {
             QDataStream ds(&file);
             ds >> contactId;
-            ds >> relatedAcc ;
+            ds >> relatedAcc;
             file.close();
         }
     }
@@ -132,18 +120,18 @@ void TelepathyContact::loadConfig()
             for (int i = 0; i < contactList.count(); ++i) {
                 if (contactList.at(i)->id() == contactId) {
                     contact = contactList.at(i);
-                    m_contact->setContact(contact);
-                    m_contact->setAccount(account);
+                    m_contactWrapper->setContact(contact);
+                    m_contactWrapper->setAccount(account);
                 }
             }
         } else {
             // just load cached avatar image
-            m_contact->setTempAvatar(tempAvatar);
-            m_contact->setTempContactId(contactId);
+            m_contactWrapper->setTempAvatar(tempAvatar);
+            m_contactWrapper->setTempContactId(contactId);
 
             // just set account. When this will go online it will automatically load the contact pointer
             // shown in the plasmoid
-            m_contact->setAccount(account);
+            m_contactWrapper->setAccount(account);
         }
     }
 }
@@ -167,13 +155,13 @@ void TelepathyContact::paintInterface(QPainter* p, const QStyleOptionGraphicsIte
 void TelepathyContact::saveConfig()
 {
     KConfigGroup group = Plasma::Applet::config();
-    group.writeEntry("id", m_contact->contact()->id());
-    group.writeEntry("tempAvatar", m_contact->contact()->avatarData().fileName);
+    group.writeEntry("id", m_contactWrapper->contact()->id());
+    group.writeEntry("tempAvatar", m_contactWrapper->contact()->avatarData().fileName);
     group.writeEntry("relatedAccount", m_accountPath);
     group.sync();
 
     // update contactWrapper temp id
-    m_contact->setTempContactId(m_contact->contact()->id());
+    m_contactWrapper->setTempContactId(m_contactWrapper->contact()->id());
 
     // tell plasmoid to save config
     configNeedsSaving();
@@ -215,9 +203,9 @@ void TelepathyContact::setContact(const Tp::ContactPtr& newContact, const Tp::Ac
     Q_ASSERT(newContact);
     Q_ASSERT(relatedAccount);
 
-    if (!m_contact->contact() || m_contact->contact()->id() != newContact->id()) {
-        m_contact->setContact(newContact);
-        m_contact->setAccount(relatedAccount);
+    if (!m_contactWrapper->contact() || m_contactWrapper->contact()->id() != newContact->id()) {
+        m_contactWrapper->setContact(newContact);
+        m_contactWrapper->setAccount(relatedAccount);
         m_accountPath = relatedAccount->objectPath();
     }
 
diff --git a/contact/src/telepathy-contact.h b/contact/src/telepathy-contact.h
index fe95c83..8227cbd 100644
--- a/contact/src/telepathy-contact.h
+++ b/contact/src/telepathy-contact.h
@@ -63,8 +63,7 @@ private:
     QString m_fileToLoad;
     QString m_accountPath;
     Plasma::DeclarativeWidget *m_declarative;
-    ContactWrapper *m_contact;
-    QObject *m_qmlObject;
+    ContactWrapper *m_contactWrapper;
     Tp::AccountManagerPtr m_accountManager;
 };
 

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list