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

List:       kde-commits
Subject:    [kdepim/frameworks] /: port to KGlobalAccel::setGlobalShortcut
From:       Montel Laurent <montel () kde ! org>
Date:       2014-07-10 11:39:34
Message-ID: E1X5ChK-0006yT-EW () scm ! kde ! org
[Download RAW message or body]

Git commit c168ffba02bdad4c35c92a6754f7e7276b2ddaf8 by Montel Laurent.
Committed on 10/07/2014 at 11:39.
Pushed by mlaurent into branch 'frameworks'.

port to KGlobalAccel::setGlobalShortcut

M  +1    -0    CMakeLists.txt
M  +1    -0    knotes/CMakeLists.txt
M  +5    -4    knotes/apps/knotesapp.cpp

http://commits.kde.org/kdepim/c168ffba02bdad4c35c92a6754f7e7276b2ddaf8

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80f15b6..32944b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -92,6 +92,7 @@ find_package(Phonon4Qt5 CONFIG REQUIRED)
 find_package(KF5DNSSD ${KF5_VERSION} CONFIG REQUIRED)
 find_package(KF5TextEditor ${KF5_VERSION} CONFIG REQUIRED)
 find_package(KF5Sonnet ${KF5_VERSION} CONFIG REQUIRED)
+find_package(KF5GlobalAccel ${KF5_VERSION} CONFIG REQUIRED)
 
 # Find KdepimLibs Package
 find_package(KF5Akonadi CONFIG REQUIRED)
diff --git a/knotes/CMakeLists.txt b/knotes/CMakeLists.txt
index d2bb937..cd6f71c 100644
--- a/knotes/CMakeLists.txt
+++ b/knotes/CMakeLists.txt
@@ -81,6 +81,7 @@ target_link_libraries(knotes knotesprivate pimcommon kdepim \
                KF5::KIOCore
                              KF5::KCMUtils KF5::KontactInterface noteshared
   KF5::AkonadiCore
   KF5::Mime
+  KF5::GlobalAccel
   akonadi_next
   )
 if (Qt5X11Extras_FOUND)
diff --git a/knotes/apps/knotesapp.cpp b/knotes/apps/knotesapp.cpp
index f2ddc58..68c44ce 100644
--- a/knotes/apps/knotesapp.cpp
+++ b/knotes/apps/knotesapp.cpp
@@ -87,6 +87,7 @@
 #include <kiconloader.h>
 #include <KShortcut>
 #include <KGlobal>
+#include <KGlobalAccel>
 
 #include <QPixmap>
 #include <QClipboard>
@@ -120,13 +121,13 @@ KNotesApp::KNotesApp()
     QAction *action  = new QAction( QIcon::fromTheme( QLatin1String("document-new") \
),  i18n( "New Note" ), this );
     actionCollection()->addAction( QLatin1String("new_note"), action );
-    //QT5 action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_N ));
+    KGlobalAccel::setGlobalShortcut(action, QKeySequence(Qt::ALT + Qt::SHIFT + \
Qt::Key_N ));  connect( action, SIGNAL(triggered()), SLOT(newNote()) );
 
     action  = new QAction( QIcon::fromTheme( QLatin1String("edit-paste") ),
                            i18n( "New Note From Clipboard" ), this );
     actionCollection()->addAction( QLatin1String("new_note_clipboard"), action );
-    //QT5 action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_C ));
+    KGlobalAccel::setGlobalShortcut(action, QKeySequence(Qt::ALT + Qt::SHIFT + \
Qt::Key_C ));  connect( action, SIGNAL(triggered()), SLOT(newNoteFromClipboard()) );
 
     action  = new QAction( QIcon::fromTheme( QLatin1String("document-open") ),
@@ -137,13 +138,13 @@ KNotesApp::KNotesApp()
 
     action  = new QAction( QIcon::fromTheme(QLatin1String( "knotes") ), i18n( "Show \
                All Notes" ), this );
     actionCollection()->addAction( QLatin1String("show_all_notes"), action );
-    //QT5 action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_S ));
+    KGlobalAccel::setGlobalShortcut(action, QKeySequence( Qt::ALT + Qt::SHIFT + \
Qt::Key_S ));  connect( action, SIGNAL(triggered()), SLOT(showAllNotes()) );
 
     action  = new QAction( QIcon::fromTheme( QLatin1String("window-close") ),
                            i18n( "Hide All Notes" ), this );
     actionCollection()->addAction( QLatin1String("hide_all_notes"), action );
-    //QT5 action->setGlobalShortcut( KShortcut( Qt::ALT + Qt::SHIFT + Qt::Key_H ));
+    KGlobalAccel::setGlobalShortcut(action, QKeySequence( Qt::ALT + Qt::SHIFT + \
Qt::Key_H ));  connect( action, SIGNAL(triggered()), SLOT(hideAllNotes()) );
 
     action = new QAction( QIcon::fromTheme( QLatin1String("document-print") ),


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

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