[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5

Maximiliano Curia maxy at moszumanska.debian.org
Fri May 27 23:58:58 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=892e5ba

The following commit has been merged in the master branch:
commit 892e5ba518c8710fc8425cb7b761efe80e602b6c
Author: Dominik Schmidt <dev at dominik-schmidt.de>
Date:   Mon Jan 17 17:20:48 2011 +0100

    Only show real profiles and fake profiles for protocols, which do not have a real profile.
---
 src/KCMTelepathyAccounts/profile-list-model.cpp | 32 ++++++++++++++++++++++---
 src/KCMTelepathyAccounts/profile-list-model.h   |  2 ++
 2 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/src/KCMTelepathyAccounts/profile-list-model.cpp b/src/KCMTelepathyAccounts/profile-list-model.cpp
index eee1187..f0f46d4 100644
--- a/src/KCMTelepathyAccounts/profile-list-model.cpp
+++ b/src/KCMTelepathyAccounts/profile-list-model.cpp
@@ -83,10 +83,20 @@ void ProfileListModel::setProfileManager(Tp::ProfileManagerPtr profileManager)
         item = 0;
     }
 
-    beginInsertRows(QModelIndex(), 0, profileManager->profiles().size());
-    foreach(Tp::ProfilePtr ptr, profileManager->profiles()) {
-        m_profileItems.append(new ProfileItem(ptr, this));
+    QList<Tp::ProfilePtr> profiles = profileManager->profiles();
+
+    QList<ProfileItem*> insertItems;
+    foreach(const Tp::ProfilePtr &profile, profiles) {
+        if(profile->isFake()) {
+            if(hasNonFakeProfile(profile, profiles)) {
+                continue;
+            }
+        }
+        insertItems.append(new ProfileItem(profile, this));
     }
+
+    beginInsertRows(QModelIndex(), 0, insertItems.size()-1);
+    m_profileItems.append(insertItems);
     endInsertRows();
 }
 
@@ -95,6 +105,22 @@ ProfileItem *ProfileListModel::itemForIndex(const QModelIndex &index) const
     return m_profileItems.at(index.row());
 }
 
+bool ProfileListModel::hasNonFakeProfile(const Tp::ProfilePtr& profile, const QList<Tp::ProfilePtr> &profiles) const
+{
+    foreach(const Tp::ProfilePtr &otherProfile, profiles) {
+        if(profile->protocolName() == otherProfile->protocolName() && !otherProfile->isFake())
+        {
+            // check if this profile is for a special service or for this protocol in general
+            if(otherProfile->serviceName() == otherProfile->cmName().append("-").append(otherProfile->protocolName())
+            || otherProfile->serviceName() == otherProfile->protocolName()) {
+                return true;
+            }
+        }
+    }
+
+    return false;
+}
+
 
 #include "profile-list-model.moc"
 
diff --git a/src/KCMTelepathyAccounts/profile-list-model.h b/src/KCMTelepathyAccounts/profile-list-model.h
index 0025a95..8f95895 100644
--- a/src/KCMTelepathyAccounts/profile-list-model.h
+++ b/src/KCMTelepathyAccounts/profile-list-model.h
@@ -45,6 +45,8 @@ public:
     void setProfileManager(Tp::ProfileManagerPtr profileManager);
 
 private:
+    bool hasNonFakeProfile(const Tp::ProfilePtr &profile, const QList<Tp::ProfilePtr> &profiles) const;
+
     QList<ProfileItem*> m_profileItems;
 };
 

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list