[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/applets/tasks
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2009-06-29 17:22:22
Message-ID: 1246296142.602755.397.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 989185 by aseigo:
be careful not to incur multiple signal/lot connections. please test to see if this \
solves the "creeping cpu usage problem" CCBUG:198315
M +21 -11 taskgroupitem.cpp
--- trunk/KDE/kdebase/workspace/plasma/applets/tasks/taskgroupitem.cpp #989184:989185
@@ -311,6 +311,11 @@
void TaskGroupItem::setGroup(TaskManager::GroupPtr group)
{
//kDebug();
+ if (m_group == group) {
+ kDebug() << "already have this group!";
+ return;
+ }
+
m_group = group;
m_abstractItem = qobject_cast<AbstractGroupableItem *>(group);
@@ -401,11 +406,6 @@
//kDebug() << "item to create" << groupableItem << endl;
AbstractTaskItem *item = 0;
- if (m_groupMembers.contains(groupableItem)) {
- //kDebug() << "existing item found";
- return m_groupMembers.value(groupableItem);
- }
-
if (groupableItem->isGroupItem()) {
TaskGroupItem *groupItem = new TaskGroupItem(this, m_applet, \
m_applet->showToolTip());
groupItem->setGroup(static_cast<TaskManager::TaskGroup*>(groupableItem));
@@ -437,9 +437,15 @@
}
//returns the corresponding item or creates a new one
- AbstractTaskItem *item = createAbstractItem(groupableItem);
+ bool isNew = false;
+ AbstractTaskItem *item = m_groupMembers.value(groupableItem);
if (!item) {
+ item = createAbstractItem(groupableItem);
+ isNew = true;
+ }
+
+ if (!item) {
kDebug() << "invalid Item";
return;
}
@@ -466,12 +472,14 @@
m_activeTaskIndex = 0;
}
- connect(item, SIGNAL(activated(AbstractTaskItem*)),
- this, SLOT(updateActive(AbstractTaskItem*)));
+ if (!isNew) {
+ connect(item, SIGNAL(activated(AbstractTaskItem*)),
+ this, SLOT(updateActive(AbstractTaskItem*)));
- TaskGroupItem *group = qobject_cast<TaskGroupItem*>(item);
- if (group) {
- connect(item, SIGNAL(changed()), this, SLOT(relayoutItems()));
+ TaskGroupItem *group = qobject_cast<TaskGroupItem*>(item);
+ if (group) {
+ connect(item, SIGNAL(changed()), this, SLOT(relayoutItems()));
+ }
}
}
@@ -684,6 +692,7 @@
m_mainLayout->addItem(tasksLayout());
+ disconnect(m_applet, SIGNAL(constraintsChanged(Plasma::Constraints)), this, \
SLOT(constraintsChanged(Plasma::Constraints)));
connect(m_applet, SIGNAL(constraintsChanged(Plasma::Constraints)), this, \
SLOT(constraintsChanged(Plasma::Constraints)));
//connect(m_tasksLayout, SIGNAL(sizeHintChanged(Qt::SizeHint)), this, \
SLOT(updatePreferredSize())); m_collapsed = false;
@@ -751,6 +760,7 @@
//kDebug();
//delete m_tasksLayout;
+ disconnect(m_applet, SIGNAL(constraintsChanged(Plasma::Constraints)), this, \
SLOT(constraintsChanged(Plasma::Constraints))); m_collapsed = true;
updatePreferredSize();
//kDebug();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic