KDE/kdevplatform/plugins/subversion

Andreas Pakulat apaku at gmx.de
Fri Jun 13 23:49:53 UTC 2008


SVN commit 820370 by apaku:

Allow to use Ctrl+Enter to "ok" the commit dialog.

unfortunately I wasn't able to get this working with just a KAction, the shortcut I've set wasn't triggering (I've set the widget-with-childs context and added the action to the dialog). Anybody got a bright idea why?

CCMAIL:kdevelop-devel at kdevelop.org

 M  +17 -0     svncommitdialog.cpp  
 M  +1 -0      svncommitdialog.h  


--- trunk/KDE/kdevplatform/plugins/subversion/svncommitdialog.cpp #820369:820370
@@ -11,6 +11,8 @@
 #include "svncommitdialog.h"
 #include "kdevsvnplugin.h"
 
+#include <QKeyEvent>
+
 #include <ktextedit.h>
 #include <kcombobox.h>
 #include <klocale.h>
@@ -30,6 +32,7 @@
 
     ui.files->resizeColumnToContents(0);
     ui.files->resizeColumnToContents(1);
+    installEventFilter(this);
     connect(this, SIGNAL( okClicked() ), SLOT( ok() ) );
     connect(this, SIGNAL( cancelClicked() ), SLOT( cancel() ) );
 }
@@ -37,7 +40,21 @@
 SvnCommitDialog::~SvnCommitDialog()
 {}
 
+bool SvnCommitDialog::eventFilter( QObject* o, QEvent* e )
+{
+    if( e->type() == QEvent::KeyPress )
+    {
+        QKeyEvent* k = static_cast<QKeyEvent*>(e);
+        if( ( k->key() == Qt::Key_Return || k->key() == Qt::Key_Enter ) && (k->modifiers() & Qt::ControlModifier) == Qt::ControlModifier )
+        {
+            ok();
+            return true;
+        }
+    }
+    return false;
+}
 
+
 void SvnCommitDialog::setKeepLocks( bool keeplock )
 {
     ui.keepLocksChk->setChecked( keeplock );
--- trunk/KDE/kdevplatform/plugins/subversion/svncommitdialog.h #820369:820370
@@ -43,6 +43,7 @@
     void ok();
     void cancel();
 private:
+    bool eventFilter( QObject* o, QEvent* e );
 //     void insertRow( const KDevelop::VcsFileInfo &info );
     void insertRow( const QString& state, const KUrl& url );
 




More information about the KDevelop-devel mailing list