[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/network/kcall
From: George Kiagiadakis <gkiagiad () csd ! uoc ! gr>
Date: 2009-08-03 20:16:34
Message-ID: 1249330594.195735.20835.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1006493 by gkiagia:
Work a bit more on the behavior of the systray icon.
- When clicking on the icon and the window is shown, close it instead of hiding it.
- When minimizing a window (i.e. hiding it), do not make the systray icon active.
- When an approver request comes, save the icon status and restore it when the request has finished.
- While showing a notification for the request, do not change the icon status
if the main window closes, but update the status-to-be-restored instead.
M +22 -6 systrayicon.cpp
--- trunk/playground/network/kcall/systrayicon.cpp #1006492:1006493
@@ -44,6 +44,7 @@
QSet<ApproverRequest*> requests;
QPointer<ApproverRequest> currentRequest;
Experimental::KNotificationItem *notificationItem;
+ Experimental::KNotificationItem::ItemStatus restoreStatus;
};
SystrayIcon::SystrayIcon()
@@ -71,6 +72,10 @@
{
d->requests.insert(request);
d->currentRequest = request;
+ //if we are not already showing a notification, save the current icon status for restoring later
+ if ( d->notificationItem->status() != Experimental::KNotificationItem::NeedsAttention ) {
+ d->restoreStatus = d->notificationItem->status();
+ }
d->notificationItem->setStatus(Experimental::KNotificationItem::NeedsAttention);
}
@@ -79,7 +84,7 @@
d->requests.remove(request);
kDebug() << d->requests.size();
if ( d->requests.size() == 0 ) {
- d->notificationItem->setStatus(Experimental::KNotificationItem::Passive);
+ d->notificationItem->setStatus(d->restoreStatus);
}
}
@@ -100,7 +105,7 @@
mw->raise();
mw->activateWindow();
} else {
- mw->hide();
+ mw->close();
}
}
}
@@ -111,17 +116,28 @@
return AbstractClientApprover::eventFilter(watched, event);
}
+ Experimental::KNotificationItem::ItemStatus newStatus;
+
switch (event->type()) {
case QEvent::Show:
- d->notificationItem->setStatus(Experimental::KNotificationItem::Passive);
+ newStatus = Experimental::KNotificationItem::Passive;
break;
- case QEvent::Hide:
case QEvent::Close:
- d->notificationItem->setStatus(Experimental::KNotificationItem::Active);
+ newStatus = Experimental::KNotificationItem::Active;
break;
default:
- break;
+ return false;
}
+
+ if ( d->notificationItem->status() != Experimental::KNotificationItem::NeedsAttention ) {
+ //there is no request currently, so we should directly update the icon status
+ d->notificationItem->setStatus(newStatus);
+ } else {
+ //else we need to update the restoreStatus, so that the status
+ //is set to that when the request has finished
+ d->restoreStatus = newStatus;
+ }
+
return false;
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic