[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.4/kdebase/workspace/plasma/generic/applets/systemtray/ui
From:       Roman Shtylman <shtylman () gmail ! com>
Date:       2010-02-12 5:50:53
Message-ID: 1265953853.285004.27528.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1089001 by shtylman:

fixed hide icon behavior when coming out of 'sleep'

backported from trunk

The hide icon would appear when resuming because some of the
systemtray icons have autohidden themselves and then add themselves
in an unhidden state at the end. This was not handled properly by
the existing hidden icon toggle code.

 M  +19 -3     taskarea.cpp  


--- branches/KDE/4.4/kdebase/workspace/plasma/generic/applets/systemtray/ui/taskarea.cpp \
#1089000:1089001 @@ -68,6 +68,7 @@
 
     QSet<QString> hiddenTypes;
     QSet<QString> alwaysShownTypes;
+    QSet<SystemTray::Task*> hiddenTasks;
     bool showingHidden : 1;
     bool hasHiddenTasks : 1;
     bool hasTasksThatCanHide : 1;
@@ -199,9 +200,20 @@
         }
         return;
     }
-
-    d->hasTasksThatCanHide = d->hasTasksThatCanHide || (task->hidden() != \
                Task::NotHidden);
-
+    
+    // keep track of the hidden tasks
+    // needs to be done because if a tasks is added multiple times (like when coming \
out of sleep) +    // it may be autohidden for a while until the final one which will \
not be hidden +    // therefore we need a way to track the hidden tasks
+    // if the task appears in the hidden list, then we know there are hidden tasks
+    if (task->hidden() != Task::NotHidden) {
+        d->hiddenTasks << task;
+    } else {
+        d->hiddenTasks.remove(task);
+    }
+    
+    d->hasTasksThatCanHide = !d->hiddenTasks.isEmpty();
+    
     if (!d->showingHidden && task->hidden() != Task::NotHidden && \
!d->alwaysShownTypes.contains(task->typeId())) {  kDebug() << "is a hidden type";
         d->hasHiddenTasks = true;
@@ -248,6 +260,9 @@
 
 void TaskArea::removeTask(Task *task)
 {
+    d->hiddenTasks.remove(task);
+    d->hasTasksThatCanHide = !d->hiddenTasks.isEmpty();
+    
     QGraphicsWidget *widget = task->widget(d->host, false);
 
     if (widget) {
@@ -257,6 +272,7 @@
         d->lastTasksLayout->removeItem(widget);
         relayout();
     } else {
+        //this is not a typo
         relayout();relayout();
         QTimer::singleShot(200, this, SLOT(relayout()));
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic