Patch: KIconDialog: Make the Enter key works!

Sébastien Laoût slaout at linux62.org
Sun Sep 18 15:06:45 BST 2005


Hello,

The Enter key does not work when choosing an icon in the KIconDialog.
We are obliged to put the mouse on hand and click the button Ok, or press 
Alt+O.
That annoyed me for a long time, so I decided to look at the code and fix that 
bug.

I'm sorry, I don't have KDE source libs installed and am not able to test if 
that work, but I've done similar code for another project, so it should be 
OK.

In /kio/kfile/kicondialog.cpp arround line 313:
 mpCanvas = new KIconCanvas(main);
 connect(mpCanvas,SIGNAL(executed(QIconViewItem*)),SLOT(slotAcceptIcons()));
+connect(mpCanvas,SIGNAL(returnPressed(QIconViewItem*)),SLOT(slotAcceptIcons()));
 mpCanvas->setMinimumSize(400, 125);

In /kio/kfile/kicondialog.cpp arround line 346:
 void KIconDialog::slotAcceptIcons()
 {
   d->custom=QString::null;
+  actionButton(KDialogBase::Ok)->animateClick();
   slotOk();
 }

It connect the signal QDialog::returnPressed().
And it generate an animated click on the Ok button (like any Enter keypress on 
any normal dialog).
The animated click will also be played when clicking an icon.
If that's not good, then slotAcceptIcons() need to be duplicated to only 
animate when returnPressed() is emitted, and not executed().

Can anyone commit this change?

Thanks,
Sébastien Laoût.




More information about the kde-core-devel mailing list