Version: (using KDE Devel) Installed from: Compiled sources Follows a patch to implement search in KIconDialog. This helps to find useful icons. Patch is agains kdelibs/kio/kfile/kicondialog.{cpp,h}. (1.41 and 1.26).
Created attachment 7016 [details] Implement search in KIconDialog It may apply and compile. Maybe you should change the Whatsthis string.
Just noticed: you need to delete the items in hiddem_items in KIconCanvas destructor. I'll do another patch.
Created attachment 7053 [details] Improved search in KIconDialog This version now works properly. Changes from the patch before: - Delete items from hidden_items when loadFiles() is called - Delete items from hidden_items when destructor is called - Delayed search. Now use queueSearch() and activateSearch() to avoid flicker and waste of CPU with useless premature searches. - Use KLineEdit instead of QLineEdit - Clear searchLine when loadFiles() is called. Hope this get accepted.
Created attachment 7066 [details] Improved search in KIconDialog + Fix to QTimer delay This is the same patch as the above, but fix the lack of update in the window when you activate slotLoadFiles(). With QTimer::start( 0, true ) the timer expires now, and the window is not updated. You see just garbage in the dialog while the progress bar updates. This is because you use setUpdatesEnabled( false ) while loading files. Changing from 0 to 10ms I give it time to update the dialog and it looks a lot better. Hope this get in 3.3 :)
Created attachment 7067 [details] Fix QTimer delay This is just the QTimer thing from the above patch, as requested in IRC.
Created attachment 7071 [details] New KIconDialog, now using QIconViewSearchLine As requested in IRC, de-coupled it in a QIconViewSearchLine, similar to KListViewSearchLine (from kdeui/, used in kkeysdialog). It makes possible to reuse this componet later. PS: this patch is to be applied AFTER 7067 (Fix QTimer delay).
Ok, 3.3 released, could someone commit the patches?
On Wednesday 11 August 2004 07:44, Gustavo Sverzut Barbieri wrote: > New KIconDialog, now using QIconViewSearchLine Hello, thanks for the patches! One problem: the class name uses a Q prefix, which is supposed to be reserved to Qt classes. Please name it KIconViewSearchLine. Similarly QIconViewItemList should be KIconViewItemList... Hmm, that's not really good either, since it's not a list of kiconviewitems. In fact the typedef doesn't seem to be used at all in the .h file, so it should be moved to the .cpp file (in which case the name matters much less). The qDebug should be turned into kdDebug - which is automatically disabled in final binary packages, unlike qDebug. + if ( d != NULL ) delete d; can simply be "delete d". Deleting 0 is a valid operation in C++, and does nothing. It works with other icon views, right? In that case we could even put it in kdeui, it could be useful to other applications. Can you do that? (Otherwise I'll try to have a look at it tomorrow...) Thanks!
--- David Faure <faure@kde.org> escreveu: > On Wednesday 11 August 2004 07:44, Gustavo Sverzut Barbieri wrote: > > New KIconDialog, now using QIconViewSearchLine > > Hello, thanks for the patches! :) > One problem: the class name uses a Q prefix, which is supposed to be > reserved to Qt classes. Please name it KIconViewSearchLine. > Similarly QIconViewItemList should be KIconViewItemList... Hmm, > that's > not really good either, since it's not a list of kiconviewitems. In > fact the typedef > doesn't seem to be used at all in the .h file, so it should be moved > to the .cpp > file (in which case the name matters much less). Yes, it could be move to .cpp > The qDebug should be turned into kdDebug - which is automatically > disabled in final binary packages, unlike qDebug. I'll remember later. > + if ( d != NULL ) delete d; > can simply be "delete d". Deleting 0 is a valid operation in C++, and > does nothing. Really? Anyway, I like to keep my C++ code as close as C as I can (but with OO), that way I avoid mistakes when changing between languages. > It works with other icon views, right? In that case we could even put > it > in kdeui, it could be useful to other applications. Can you do that? > (Otherwise I'll try to have a look at it tomorrow...) I'm not sure how to do this kind of change. Could you do that? Also, you need the patches to fix the things you mentioned above or you do it yourself? Thanks, Gustavo __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
On Wednesday 25 August 2004 16:00, Gustavo Sverzut Barbieri wrote: > Also, you need the patches to fix the things you mentioned above or you > do it yourself? It saves me time if you send me an updated patch. After that, ok, I'll move the class to libkdeui.
Created attachment 7285 [details] qiconviewsearchline This patch is to be applied after 7067 (Fix QTimer delay). It implement the suggested changes.
David, any news on this?
I haven't forgotten this patch - I'm just overloaded. I tried testing the timer thingie but on a fast computer it's hard to really find a difference - especially with the filesystem caching from kernel 2.6.x, only the very first listing isn't blazingly fast. So I guess I'm going to trust you on that one :) (It seems that it takes a little bit more time, while it does repaint itself a bit more indeed... difficult tradeoff) I'll have a look at this as soon as I'm done with someone's patch...
CVS commit by faure: Applied patch by Gustavo Sverzut Barbieri <gsbarbieri@yahoo.com.br>, which implements a quick-search lineedit for QIconView, and uses it in the icon selector dialog. Quite handy indeed! Many thanks for the patch. CCMAIL: 86680-done@bugs.kde.org A kdeui/kiconviewsearchline.cpp 1.1 [LGPL] A kdeui/kiconviewsearchline.h 1.1 [LGPL] M +3 -2 kdeui/Makefile.am 1.333 M +53 -19 kio/kfile/kicondialog.cpp 1.42 M +3 -0 kio/kfile/kicondialog.h 1.27 --- kdelibs/kdeui/Makefile.am #1.332:1.333 @@ -70,5 +70,6 @@ ktabbar.h ktabwidget.h ksplashscreen.h kconfigdialog.h \ kactionselector.h klanguagebutton.h klistviewsearchline.h \ - kpixmapregionselectorwidget.h kpixmapregionselectordialog.h + kpixmapregionselectorwidget.h kpixmapregionselectordialog.h \ + kiconviewsearchline.h # the order of the sources isn't randomly (at least not completely). @@ -119,5 +120,5 @@ kactionselector.cpp klanguagebutton.cpp klistviewsearchline.cpp \ kpixmapregionselectorwidget.cpp kpixmapregionselectordialog.cpp \ - kwhatsthismanager.cpp + kwhatsthismanager.cpp kiconviewsearchline.cpp noinst_HEADERS = kdockwidget_private.h kdockwidget_p.h klistviewlineedit.h \ --- kdelibs/kio/kfile/kicondialog.cpp #1.41:1.42 @@ -12,4 +12,20 @@ */ +#include "kicondialog.h" + +#include <config.h> + +#include <kiconviewsearchline.h> + +#include <kapplication.h> +#include <klocale.h> +#include <kglobal.h> +#include <kstandarddirs.h> +#include <kiconloader.h> +#include <kprogress.h> +#include <kiconview.h> +#include <kfiledialog.h> +#include <kimagefilepreview.h> + #include <qlayout.h> #include <qstring.h> @@ -24,16 +40,7 @@ #include <qradiobutton.h> #include <qfileinfo.h> +#include <qtoolbutton.h> +#include <qwhatsthis.h> -#include <kapplication.h> -#include <klocale.h> -#include <kglobal.h> -#include <kstandarddirs.h> -#include <kiconloader.h> -#include <kprogress.h> -#include <kiconview.h> -#include <kfiledialog.h> -#include <kimagefilepreview.h> - -#include <config.h> #ifdef HAVE_LIBART #include <svgicons/ksvgiconengine.h> @@ -41,6 +48,4 @@ #endif -#include "kicondialog.h" - class KIconCanvas::KIconCanvasPrivate { @@ -107,5 +112,5 @@ void KIconCanvas::loadFiles(const QStrin mFiles = files; emit startLoading(mFiles.count()); - mpTimer->start(0, true); + mpTimer->start(10, true); // #86680 d->m_bLoading = false; } @@ -274,8 +279,36 @@ void KIconDialog::init() grid->addWidget(mpBrowseBut, 2, 1); + // + // ADD SEARCHLINE + // + QHBoxLayout *searchLayout = new QHBoxLayout(0, 0, KDialog::spacingHint()); + top->addLayout(searchLayout); + + QToolButton *clearSearch = new QToolButton(main); + clearSearch->setTextLabel(i18n("Clear Search"), true); + clearSearch->setIconSet(SmallIconSet("locationbar_erase")); + searchLayout->addWidget(clearSearch); + + QLabel *searchLabel = new QLabel(i18n("&Search:"), main); + searchLayout->addWidget(searchLabel); + + searchLine = new KIconViewSearchLine(main, "searchLine"); + searchLayout->addWidget(searchLine); + searchLabel->setBuddy(searchLine); + + + // signals and slots connections + connect(clearSearch, SIGNAL(clicked()), searchLine, SLOT(clear())); + + QString wtstr = i18n("Search interactively for icon names (e.g. folder)."); + QWhatsThis::add(searchLabel, wtstr); + QWhatsThis::add(searchLine, wtstr); + + mpCanvas = new KIconCanvas(main); connect(mpCanvas, SIGNAL(executed(QIconViewItem *)), SLOT(slotAcceptIcons())); mpCanvas->setMinimumSize(400, 125); top->addWidget(mpCanvas); + searchLine->setIconView(mpCanvas); mpProgress = new KProgress(main); @@ -339,4 +372,5 @@ void KIconDialog::showIcons() filelist.append(*ip); + searchLine->clear(); mpCanvas->loadFiles(filelist); } --- kdelibs/kio/kfile/kicondialog.h #1.26:1.27 @@ -29,4 +29,5 @@ class QRadioButton; class KProgress; class KIconLoader; +class KIconViewSearchLine; @@ -235,4 +236,6 @@ private: KIconLoader *mpLoader; KIconCanvas *mpCanvas; + KIconViewSearchLine *searchLine; + protected: virtual void virtual_hook( int id, void* data );