From 9174c43eb0e07398e38710fa937adffbef33d3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 2 Apr 2009 19:14:48 +0000 Subject: [PATCH] Show notification when compositing is suspended via dbus. svn path=/trunk/KDE/kdebase/workspace/; revision=948322 --- composite.cpp | 22 +++++++++++++++++++++- workspace.h | 3 +-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/composite.cpp b/composite.cpp index c783003fa2..8d7aeadb0c 100644 --- a/composite.cpp +++ b/composite.cpp @@ -275,7 +275,27 @@ void Workspace::slotToggleCompositing() { suspendCompositing( !compositingSuspended ); } - + +// for the dbus call +void Workspace::toggleCompositing() + { + slotToggleCompositing(); + if( compositingSuspended ) + { + // when disabled show a shortcut how the user can get back compositing + QString shortcut, message; + if( KAction* action = qobject_cast( keys->action("Suspend Compositing"))) + shortcut = action->globalShortcut().primary().toString(QKeySequence::NativeText); + if( !shortcut.isEmpty() && options->useCompositing ) + { + // display notification only if there is the shortcut + message = i18n( "Compositing has been suspended by another application.
" + "You can resume using the '%1' shortcut.", shortcut ); + Notify::raise( Notify::CompositingSlow, message ); + } + } + } + void Workspace::suspendCompositing() { suspendCompositing( true ); diff --git a/workspace.h b/workspace.h index 877465c522..adc94ce127 100644 --- a/workspace.h +++ b/workspace.h @@ -328,8 +328,7 @@ class Workspace : public QObject, public KDecorationDefines // KDE4 remove me - And it's also in the DCOP interface :( void showWindowMenuAt( unsigned long id, int x, int y ); - void toggleCompositing() - { slotToggleCompositing(); } + void toggleCompositing(); void loadEffect( const QString& name ); void toggleEffect( const QString& name ); void reconfigureEffect( const QString& name );