patch for double clicking to bring up key-capture dialog

Zac Hansen xaxxon at chopper.slackworks.com
Tue Mar 11 04:47:37 GMT 2003


This is my first attempt at coding on KDE.

This patch is against KDE CVS.

This patch makes it so when the keyboard shortcut dialog comes up, you can 
double click the command to bring up the key-capture dialog.  Right now 
you have to select it, then click the button at the bottom.

I also plan at looking at letting a shortcut steal a sequence from another 
command.  I'm not sure how hard this would be, but I was planning to add 
an option to the dialog that currently informs you that your shortcut is 
already in use to "steal" the shortcut from the other command.  If anyone 
has any feedback about this feature, please let me know.

<Patch attached>

--Zac
xaxxon at slackworks.com
-------------- next part --------------
--- kkeydialog.cpp      2003-02-27 22:35:05.000000000 +0000
+++ /home/kdedevel/kde-cvs/kdelibs/kdeui/kkeydialog.cpp 2003-03-10 18:56:12.000000000 +0000
@@ -319,6 +319,10 @@

   connect( d->pList, SIGNAL(currentChanged(QListViewItem*)),
            SLOT(slotListItemSelected(QListViewItem*)) );
+
+  // handle double clicking an item
+  connect ( d->pList, SIGNAL ( doubleClicked ( QListViewItem *, const QPoint &, int ) ),
+                       SLOT ( slotListItemDoubleClicked ( QListViewItem *, const QPoint &, int ) ) );

   //
   // CREATE CHOOSE KEY GROUP
@@ -571,6 +575,13 @@
        updateButtons();
 }

+void KKeyChooser::slotListItemDoubleClicked ( QListViewItem * ipoQListViewItem, const QPoint & iroQPoint, int inColumn )
+{
+
+  d->pbtnShortcut->captureShortcut ( );
+
+}
+
 void KKeyChooser::setPreferFourModifierKeys( bool bPreferFourModifierKeys )
 {
        d->bPreferFourModifierKeys = bPreferFourModifierKeys;
--- kkeydialog.h        2002-10-31 08:45:19.000000000 +0000
+++ /home/kdedevel/kde-cvs/kdelibs/kdeui/kkeydialog.h   2003-03-10 17:23:59.000000000 +0000
@@ -149,7 +149,9 @@
        void slotCustomKey();
        void slotListItemSelected( QListViewItem *item );
        void capturedShortcut( const KShortcut& cut );
-        void slotSettingsChanged( int );
+       void slotSettingsChanged( int );
+       void slotListItemDoubleClicked ( QListViewItem * ipoQListViewItem, const QPoint & ipoQPoint, int c );
+

  protected:
        ActionType m_type;


More information about the kde-core-devel mailing list