From f754cdf2ece4516930c2f4ceb20b6ddd6fdd3e10 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Aug 07 2009 21:35:59 +0000 Subject: Backport fix for lancelot kde#196809 --- diff --git a/kdeplasma-addons-4.3.0-lancelot-kde#196809.patch b/kdeplasma-addons-4.3.0-lancelot-kde#196809.patch new file mode 100644 index 0000000..55eedb4 --- /dev/null +++ b/kdeplasma-addons-4.3.0-lancelot-kde#196809.patch @@ -0,0 +1,185 @@ +Index: applets/lancelot/app/src/models/ContactsKopete.h +=================================================================== +--- applets/lancelot/app/src/models/ContactsKopete.h (revision 1008266) ++++ applets/lancelot/app/src/models/ContactsKopete.h (revision 1008267) +@@ -31,19 +31,21 @@ + ContactsKopete(); + ~ContactsKopete(); + +- void timerEvent(QTimerEvent * event); +- + protected: + void activate(int index); + void load(); ++ void load(bool forceReload); + void updateContactData(const QString & contactId); ++ void timerEvent(QTimerEvent * event); + + protected Q_SLOTS: + void contactChanged(const QString & contactId); + + private: + org::kde::Kopete * m_interface; +- QBasicTimer m_timer; ++ QBasicTimer m_delayTimer; ++ QBasicTimer m_checkRunningTimer; ++ QStringList m_contactsToUpdate; + QString m_kopeteAvatarsDir; + bool m_kopeteRunning : 1; + bool m_noOnlineContacts : 1; +Index: applets/lancelot/app/src/models/ContactsKopete.cpp +=================================================================== +--- applets/lancelot/app/src/models/ContactsKopete.cpp (revision 1008266) ++++ applets/lancelot/app/src/models/ContactsKopete.cpp (revision 1008267) +@@ -25,11 +25,12 @@ + + // #define UPDATE_INTERVAL 15000 + #define CHECK_RUNNING_INTERVAL 5000 ++#define DELAY_INTERVAL 500 + + namespace Models { + + ContactsKopete::ContactsKopete() +- : m_interface(NULL), m_kopeteRunning(true) ++ : m_interface(NULL), m_kopeteRunning(false) + { + setSelfTitle(i18n("Contacts")); + setSelfIcon(KIcon("kopete")); +@@ -40,14 +41,27 @@ + m_kopeteAvatarsDir = KStandardDirs::locate( + "data", "kopete/avatars/Contacts/"); + +- m_timer.start(CHECK_RUNNING_INTERVAL, this); ++ m_checkRunningTimer.start(CHECK_RUNNING_INTERVAL, this); + load(); + } + + void ContactsKopete::timerEvent(QTimerEvent * event) + { +- if (event->timerId() == m_timer.timerId()) { ++ if (event->timerId() == m_checkRunningTimer.timerId()) { + load(); ++ } else if (event->timerId() == m_delayTimer.timerId()) { ++ qDebug() << "ContactsKopete::contactChanged [delayed]:" ++ << m_contactsToUpdate.size(); ++ m_delayTimer.stop(); ++ // checking whether we have a large update ++ if (m_contactsToUpdate.size() > 5) { ++ load(true); ++ } else { ++ foreach(QString contact, m_contactsToUpdate) { ++ updateContactData(contact); ++ } ++ } ++ m_contactsToUpdate.clear(); + } + } + +@@ -70,42 +84,65 @@ + + void ContactsKopete::load() + { ++ load(false); ++} ++ ++void ContactsKopete::load(bool forceReload) ++{ + setEmitInhibited(true); +- clear(); ++ bool statusChanged = false; ++ // clear(); + + if (!m_interface->isValid()) { +- m_kopeteRunning = false; +- m_timer.start(CHECK_RUNNING_INTERVAL, this); ++ if (m_kopeteRunning) { ++ qDebug() << "ContactsKopete::disconnecting D-Bus"; ++ disconnect(m_interface, SIGNAL(contactChanged(const QString &)), ++ this, SLOT(contactChanged(const QString &))); ++ statusChanged = true; ++ } + +- if (addService("kopete")) { +- Item * item = const_cast < Item * > (& itemAt(0)); +- item->title = i18n("Messaging client"); +- item->description = i18n("Messaging client is not running"); +- } else { +- add(i18n("Unable to find Kopete"), "", +- KIcon("application-x-executable"), QVariant("http://kopete.kde.org")); ++ if (forceReload || statusChanged) { ++ clear(); ++ m_kopeteRunning = false; ++ m_checkRunningTimer.start(CHECK_RUNNING_INTERVAL, this); ++ ++ if (addService("kopete")) { ++ Item * item = const_cast < Item * > (& itemAt(0)); ++ item->title = i18n("Messaging client"); ++ item->description = i18n("Messaging client is not running"); ++ } else { ++ add(i18n("Unable to find Kopete"), "", ++ KIcon("application-x-executable"), QVariant("http://kopete.kde.org")); ++ } + } + } else { +- connect(m_interface, SIGNAL(contactChanged(const QString &)), +- this, SLOT(contactChanged(const QString &))); ++ if (!m_kopeteRunning) { ++ qDebug() << "ContactsKopete::connecting D-Bus"; ++ connect(m_interface, SIGNAL(contactChanged(const QString &)), ++ this, SLOT(contactChanged(const QString &))); ++ statusChanged = true; ++ } + +- m_kopeteRunning = true; +- m_noOnlineContacts = false; +- // m_timer.start(UPDATE_INTERVAL, this); ++ if (forceReload || statusChanged) { ++ qDebug() << "ContactsKopete::load: full"; ++ clear(); ++ m_kopeteRunning = true; ++ m_noOnlineContacts = false; + +- QDBusReply < QStringList > contacts = m_interface->contactsByFilter("online"); +- if (!contacts.isValid()) { +- m_kopeteRunning = false; +- return; +- } ++ QDBusReply < QStringList > contacts = m_interface->contactsByFilter("online"); ++ if (!contacts.isValid()) { ++ m_kopeteRunning = false; ++ return; ++ } + +- foreach (const QString& contact, contacts.value()) { +- updateContactData(contact); +- } ++ foreach (const QString& contact, contacts.value()) { ++ updateContactData(contact); ++ } + +- if (size() == 0) { +- add(i18n("No online contacts"), "", KIcon("user-offline"), QVariant()); +- m_noOnlineContacts = true; ++ if (size() == 0) { ++ add(i18n("No online contacts"), "", KIcon("user-offline"), QVariant()); ++ m_noOnlineContacts = true; ++ } + } + } + setEmitInhibited(false); +@@ -177,8 +214,13 @@ + + void ContactsKopete::contactChanged(const QString & contactId) + { +- qDebug() << "ContactsKopete::contactChanged:" << contactId; +- updateContactData(contactId); ++ // qDebug() << "ContactsKopete::contactChanged:" << contactId; ++ // updateContactData(contactId); ++ // delaying the update ++ if (!m_contactsToUpdate.contains(contactId)) { ++ m_contactsToUpdate << contactId; ++ } ++ m_delayTimer.start(DELAY_INTERVAL, this); + } + + } // namespace Models diff --git a/kdeplasma-addons.spec b/kdeplasma-addons.spec index c5f10a7..98d893c 100644 --- a/kdeplasma-addons.spec +++ b/kdeplasma-addons.spec @@ -1,6 +1,6 @@ Name: kdeplasma-addons Version: 4.3.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Additional plasmoids for KDE Group: User Interface/Desktops @@ -15,6 +15,8 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Patch51: kdeplasma-addons-4.2.2-krunner_contacts_not_enabledbydefault.patch ## upstream patches +## backports +Patch201: kdeplasma-addons-4.3.0-lancelot-kde#196809.patch BuildRequires: boost-devel BuildRequires: eigen2-devel @@ -71,6 +73,7 @@ Requires: kdelibs4%{?_isa} >= %{version} %setup -q -n kdeplasma-addons-%{version} %patch51 -p1 -b .krunner_contacts_not_enabledbydefault +%patch201 -p0 %build @@ -156,6 +159,9 @@ rm -rf %{buildroot} %changelog +* Fri Aug 07 2009 Ben Boeckel - 4.3.0-6 +- Add patch to fix kde#196809 + * Tue Aug 04 2009 Than Ngo - 4.3.0-5 - respin