[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:11:14 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=1a4084d

The following commit has been merged in the master branch:
commit 1a4084d29510c30d0fa79d4f3c7ab683d70a7f73
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Mon Aug 6 17:23:27 2012 +0200

    Don't remove and insert a temp presence, but only update it if it exists
    
    Inserting the temp presence first and then removing it afterwards causes indexes shift, which in turn can cause problems, like accidental "now playing..." presence being selected and activated and then being deactivated right away when the old temp presence was removed and indexes were shifted again.
    This is a clearer approach, which only updates the temp presence if it is already being used.
    
    Reviewed-by: David Edmundson
---
 global-presence-chooser.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/global-presence-chooser.cpp b/global-presence-chooser.cpp
index ec24bce..720f9c5 100644
--- a/global-presence-chooser.cpp
+++ b/global-presence-chooser.cpp
@@ -141,14 +141,20 @@ void PresenceModelExtended::sourceRowsRemoved(const QModelIndex &index, int star
 
 QModelIndex PresenceModelExtended::addTemporaryPresence(const KTp::Presence &presence)
 {
-    if (! presence.isValid()) {
-        removeTemporaryPresence();
+    int row = m_model->rowCount(QModelIndex());
+
+    //if the temp presence already exists, don't remove and readd it
+    //but simply replace it
+    if (m_temporaryPresence.isValid()) {
+        m_temporaryPresence = presence;
+        emit dataChanged(this->createIndex(row, 0), this->createIndex(row, 0));
+    } else {
+        kDebug() << "adding temp presence to the model";
+        beginInsertRows(QModelIndex(),row, row);
+        m_temporaryPresence = presence;
+        endInsertRows();
     }
 
-    int row = m_model->rowCount(QModelIndex());
-    beginInsertRows(QModelIndex(),row, row);
-    m_temporaryPresence = presence;
-    endInsertRows();
     return this->createIndex(row, 0);
 }
 

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list