[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeutils/kremotecontrol/kded
From: Michael Zanetti <michael_zanetti () gmx ! net>
Date: 2010-11-07 14:56:31
Message-ID: 20101107145631.5EBA1AC89B () svn ! kde ! org
[Download RAW message or body]
SVN commit 1193913 by mzanetti:
reuse existing notification for mode-switches. Should improve usability quite a \
lot...
M +13 -2 kremotecontroldaemon.cpp
M +5 -1 kremotecontroldaemon.h
--- trunk/KDE/kdeutils/kremotecontrol/kded/kremotecontroldaemon.cpp #1193912:1193913
@@ -79,6 +79,8 @@
connect(rc, SIGNAL(buttonPressed(const Solid::Control::RemoteControlButton \
&)),
this, SLOT(gotMessage(const Solid::Control::RemoteControlButton \
&))); }
+
+ m_modeSwitchTimer.setSingleShot(true);
}
KRemoteControlDaemon::~KRemoteControlDaemon() {
@@ -249,11 +251,20 @@
}
void KRemoteControlDaemon::notifyModeChanged(Remote* remote) {
- KNotification::event(QLatin1String( "mode_event" ),
+ if(m_notification) {
+ m_notification->setText(QLatin1String( "<b>" ) + remote->name() + \
QLatin1String( ":</b><br>" ) + i18n("Mode switched to %1" , \
remote->currentMode()->name())); + \
m_notification->setPixmap(DesktopIcon(remote->currentMode()->iconName().isEmpty() ? \
QLatin1String( "infrared-remote" ) : remote->currentMode()->iconName())); + \
m_notification->update(); + m_modeSwitchTimer.start(5000);
+ } else {
+ m_notification = KNotification::event(QLatin1String( "mode_event" ),
QLatin1String( "<b>" ) + remote->name() + QLatin1String( ":</b><br>" ) + \
i18n("Mode switched to %1" , remote->currentMode()->name()),
DesktopIcon(remote->currentMode()->iconName().isEmpty() ? QLatin1String( \
"infrared-remote" ) : remote->currentMode()->iconName())
- , 0, KNotification::CloseOnTimeout, m_applicationData);
+ , 0, KNotification::Persistent, m_applicationData);
+ m_modeSwitchTimer.start(5000);
+ connect(&m_modeSwitchTimer, SIGNAL(timeout()), m_notification, \
SLOT(close())); }
+}
QString KRemoteControlDaemon::currentMode(const QString& remoteName) {
Remote *remote = m_remoteList.remote(remoteName);
--- trunk/KDE/kdeutils/kremotecontrol/kded/kremotecontroldaemon.h #1193912:1193913
@@ -30,8 +30,11 @@
#include <KDEDModule>
#include <KComponentData>
+#include <KNotification>
#include <QtCore/QVariant>
+#include <QtCore/QPointer>
+#include <QtCore/QTimer>
class KRemoteControlDaemonPrivate;
@@ -47,8 +50,9 @@
RemoteList m_remoteList;
QStringList m_ignoreNextButtonList;
KComponentData m_applicationData;
+ QPointer<KNotification> m_notification;
+ QTimer m_modeSwitchTimer;
-
public:
KRemoteControlDaemon(QObject * parent, const QVariantList&);
virtual ~KRemoteControlDaemon();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic