From 49eb864b03b6370e403c6f048ab18d1478eab045 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Sat, 24 Jul 2010 16:37:07 +0000 Subject: [PATCH] Unify the search interface for non-indexed and indexed folders svn path=/trunk/KDE/kdebase/apps/; revision=1154073 --- src/CMakeLists.txt | 26 +- src/dolphinmainwindow.cpp | 66 +- src/dolphinmainwindow.h | 19 +- src/dolphinui.rc | 7 +- src/dolphinviewactionhandler.cpp | 12 - src/dolphinviewactionhandler.h | 5 - src/dolphinviewcontainer.cpp | 81 +- src/dolphinviewcontainer.h | 19 + src/draganddrophelper.cpp | 1 - src/filterbar.cpp | 43 +- src/filterbar.h | 4 - .../information/informationpanelcontent.cpp | 6 +- src/search/dolphin_searchsettings.kcfg | 8 +- src/search/dolphinsearchbox.cpp | 531 ++++---- src/search/dolphinsearchbox.h | 112 +- src/search/dolphinsearchcommands.desktop | 1073 ----------------- .../dolphinsearchoptionsconfigurator.cpp | 377 ------ src/search/dolphinsearchoptionsconfigurator.h | 121 -- src/search/filenamesearch.protocol | 17 + src/search/filenamesearchprotocol.cpp | 138 +++ src/search/filenamesearchprotocol.h | 55 + .../filters/abstractsearchfilterwidget.cpp | 66 + .../filters/abstractsearchfilterwidget.h | 67 + src/search/filters/datesearchfilterwidget.cpp | 113 ++ src/search/filters/datesearchfilterwidget.h | 53 + .../filters/ratingsearchfilterwidget.cpp | 108 ++ src/search/filters/ratingsearchfilterwidget.h | 44 + src/search/filters/tagsearchfilterwidget.cpp | 89 ++ .../tagsearchfilterwidget.h} | 52 +- src/search/searchcriteriondescription.h | 86 -- src/search/searchcriterionselector.cpp | 244 ---- src/search/searchcriterionselector.h | 90 -- src/search/searchcriterionvalue.cpp | 196 --- src/search/searchcriterionvalue.h | 132 -- src/search/searchoptiondialogbox.cpp | 71 -- src/search/searchoptiondialogbox.h | 42 - src/statusbar/dolphinstatusbar.h | 12 +- 37 files changed, 1288 insertions(+), 2898 deletions(-) delete mode 100644 src/search/dolphinsearchcommands.desktop delete mode 100644 src/search/dolphinsearchoptionsconfigurator.cpp delete mode 100644 src/search/dolphinsearchoptionsconfigurator.h create mode 100644 src/search/filenamesearch.protocol create mode 100644 src/search/filenamesearchprotocol.cpp create mode 100644 src/search/filenamesearchprotocol.h create mode 100644 src/search/filters/abstractsearchfilterwidget.cpp create mode 100644 src/search/filters/abstractsearchfilterwidget.h create mode 100644 src/search/filters/datesearchfilterwidget.cpp create mode 100644 src/search/filters/datesearchfilterwidget.h create mode 100644 src/search/filters/ratingsearchfilterwidget.cpp create mode 100644 src/search/filters/ratingsearchfilterwidget.h create mode 100644 src/search/filters/tagsearchfilterwidget.cpp rename src/search/{searchcriteriondescription.cpp => filters/tagsearchfilterwidget.h} (55%) delete mode 100644 src/search/searchcriteriondescription.h delete mode 100644 src/search/searchcriterionselector.cpp delete mode 100644 src/search/searchcriterionselector.h delete mode 100644 src/search/searchcriterionvalue.cpp delete mode 100644 src/search/searchcriterionvalue.h delete mode 100644 src/search/searchoptiondialogbox.cpp delete mode 100644 src/search/searchoptiondialogbox.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e266fd1cc..cdfd4d7d2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -114,7 +114,6 @@ set(dolphin_SRCS panels/folders/folderspanel.cpp panels/folders/paneltreeview.cpp search/dolphinsearchbox.cpp - search/searchoptiondialogbox.cpp settings/behaviorsettingspage.cpp settings/columnviewsettingspage.cpp settings/contextmenusettingspage.cpp @@ -149,14 +148,11 @@ kde4_add_kcfg_files(dolphin_SRCS if(Nepomuk_FOUND) set(dolphin_SRCS ${dolphin_SRCS} - search/dolphinsearchoptionsconfigurator.cpp - search/searchcriteriondescription.cpp - search/searchcriterionselector.cpp - search/searchcriterionvalue.cpp + search/filters/abstractsearchfilterwidget.cpp + search/filters/datesearchfilterwidget.cpp + search/filters/ratingsearchfilterwidget.cpp + search/filters/tagsearchfilterwidget.cpp ) -endif(Nepomuk_FOUND) - -if(Nepomuk_FOUND) include(SopranoAddOntology) soprano_add_ontology(dolphin_SRCS ${SHAREDDESKTOPONTOLOGIES_ROOT_DIR}/nie/nfo.trig "NFO" "Nepomuk::Vocabulary" "trig") soprano_add_ontology(dolphin_SRCS ${SHAREDDESKTOPONTOLOGIES_ROOT_DIR}/nie/nie.trig "NIE" "Nepomuk::Vocabulary" "trig") @@ -268,6 +264,14 @@ install(TARGETS kcm_dolphinnavigation DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kcm_dolphinservices DESTINATION ${PLUGIN_INSTALL_DIR} ) install(TARGETS kcm_dolphingeneral DESTINATION ${PLUGIN_INSTALL_DIR} ) +######################################### + +set(kio_search_PART_SRCS + search/filenamesearchprotocol.cpp) +kde4_add_plugin(kio_filenamesearch ${kio_search_PART_SRCS}) +target_link_libraries(kio_filenamesearch ${KDE4_KIO_LIBS}) +install(TARGETS kio_filenamesearch DESTINATION ${PLUGIN_INSTALL_DIR}) + ########### install files ############### install( FILES dolphin.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) @@ -279,11 +283,13 @@ install( FILES settings/dolphin_directoryviewpropertysettings.kcfg settings/dolphin_versioncontrolsettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) install( FILES dolphinui.rc DESTINATION ${DATA_INSTALL_DIR}/dolphin ) -install( FILES search/dolphinsearchcommands.desktop DESTINATION ${DATA_INSTALL_DIR}/dolphin ) -install( FILES kcm/kcmdolphinviewmodes.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) +install( FILES search/filenamesearch.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) +install( FILES kcm/kcmdolphinviewmodes.desktop DESTINATION +${SERVICES_INSTALL_DIR} ) install( FILES kcm/kcmdolphinnavigation.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES kcm/kcmdolphinservices.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES kcm/kcmdolphingeneral.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES khns/servicemenu.knsrc DESTINATION ${CONFIG_INSTALL_DIR} ) install( PROGRAMS khns/servicemenuinstallation DESTINATION ${BIN_INSTALL_DIR} ) install( PROGRAMS khns/servicemenudeinstallation DESTINATION ${BIN_INSTALL_DIR} ) + diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index f6f4e5eee..e5a9bd621 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -24,14 +24,10 @@ #include "dolphinremoteencoding.h" #include -#ifdef HAVE_NEPOMUK -#include "search/dolphinsearchoptionsconfigurator.h" -#endif #include "dolphinapplication.h" #include "dolphincontextmenu.h" #include "dolphinnewmenu.h" -#include "search/dolphinsearchbox.h" #include "settings/dolphinsettings.h" #include "settings/dolphinsettingsdialog.h" #include "dolphinviewcontainer.h" @@ -112,10 +108,6 @@ DolphinMainWindow::DolphinMainWindow(int id) : m_tabBar(0), m_activeViewContainer(0), m_centralWidgetLayout(0), - m_searchBox(0), -#ifdef HAVE_NEPOMUK - m_searchOptionsConfigurator(0), -#endif m_id(id), m_tabIndex(0), m_viewTab(), @@ -730,6 +722,11 @@ void DolphinMainWindow::paste() m_activeViewContainer->view()->paste(); } +void DolphinMainWindow::find() +{ + m_activeViewContainer->setSearchModeEnabled(true); +} + void DolphinMainWindow::updatePasteAction() { QAction* pasteAction = actionCollection()->action(KStandardAction::name(KStandardAction::Paste)); @@ -1130,21 +1127,6 @@ void DolphinMainWindow::slotTestCanDecode(const QDragMoveEvent* event, bool& can canDecode = KUrl::List::canDecode(event->mimeData()); } -void DolphinMainWindow::searchItems() -{ -#ifdef HAVE_NEPOMUK - const KUrl nepomukSearchUrl = m_searchOptionsConfigurator->nepomukSearchUrl(); - m_activeViewContainer->setUrl(nepomukSearchUrl); -#endif -} - -void DolphinMainWindow::showSearchOptions() -{ -#ifdef HAVE_NEPOMUK - m_searchOptionsConfigurator->show(); -#endif -} - void DolphinMainWindow::handleUrl(const KUrl& url) { delete m_lastHandleUrlStatJob; @@ -1246,14 +1228,6 @@ void DolphinMainWindow::init() connect(this, SIGNAL(urlChanged(const KUrl&)), m_remoteEncoding, SLOT(slotAboutToOpenUrl())); -#ifdef HAVE_NEPOMUK - m_searchOptionsConfigurator = new DolphinSearchOptionsConfigurator(this); - m_searchOptionsConfigurator->hide(); - connect(m_searchOptionsConfigurator, SIGNAL(searchOptionsChanged()), - this, SLOT(searchItems())); - connect(this, SIGNAL(urlChanged(KUrl)), m_searchOptionsConfigurator, SLOT(setDirectory(KUrl))); -#endif - m_tabBar = new KTabBar(this); m_tabBar->setMovable(true); m_tabBar->setTabsClosable(true); @@ -1282,9 +1256,6 @@ void DolphinMainWindow::init() m_centralWidgetLayout = new QVBoxLayout(centralWidget); m_centralWidgetLayout->setSpacing(0); m_centralWidgetLayout->setMargin(0); -#ifdef HAVE_NEPOMUK - m_centralWidgetLayout->addWidget(m_searchOptionsConfigurator); -#endif m_centralWidgetLayout->addWidget(m_tabBar); m_centralWidgetLayout->addWidget(m_viewTab[m_tabIndex].splitter, 1); @@ -1293,16 +1264,6 @@ void DolphinMainWindow::init() emit urlChanged(homeUrl); setupGUI(Keys | Save | Create | ToolBar); - - m_searchBox->setParent(toolBar("searchToolBar")); - m_searchBox->show(); - connect(m_searchBox, SIGNAL(requestSearchOptions()), - this, SLOT(showSearchOptions())); -#ifdef HAVE_NEPOMUK - connect(m_searchBox, SIGNAL(searchTextChanged(QString)), - m_searchOptionsConfigurator, SLOT(setCustomSearchQuery(QString))); -#endif - stateChanged("new_file"); QClipboard* clipboard = QApplication::clipboard(); @@ -1412,6 +1373,8 @@ void DolphinMainWindow::setupActions() // due to the long text, the text "Paste" is used: paste->setIconText(i18nc("@action:inmenu Edit", "Paste")); + KStandardAction::find(this, SLOT(find()), actionCollection()); + KAction* selectAll = actionCollection()->addAction("select_all"); selectAll->setText(i18nc("@action:inmenu Edit", "Select All")); selectAll->setShortcut(Qt::CTRL + Qt::Key_A); @@ -1481,11 +1444,6 @@ void DolphinMainWindow::setupActions() KStandardAction::home(this, SLOT(goHome()), actionCollection()); // setup 'Tools' menu - KToggleAction* showSearchBar = actionCollection()->add("show_search_bar"); - showSearchBar->setText(i18nc("@action:inmenu Tools", "Show Search Bar")); - showSearchBar->setShortcut(Qt::CTRL | Qt::Key_S); - connect(showSearchBar, SIGNAL(triggered(bool)), this, SLOT(toggleFilterBarVisibility(bool))); - KToggleAction* showFilterBar = actionCollection()->add("show_filter_bar"); showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar")); showFilterBar->setIcon(KIcon("view-filter")); @@ -1537,16 +1495,6 @@ void DolphinMainWindow::setupActions() openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window")); openInNewWindow->setIcon(KIcon("window-new")); connect(openInNewWindow, SIGNAL(triggered()), this, SLOT(openInNewWindow())); - - // 'Search' toolbar - m_searchBox = new DolphinSearchBox(this); - connect(m_searchBox, SIGNAL(search(QString)), this, SLOT(searchItems())); - - KAction* search = new KAction(this); - actionCollection()->addAction("search_bar", search); - search->setText(i18nc("@action:inmenu", "Search Bar")); - search->setDefaultWidget(m_searchBox); - search->setShortcutConfigurable(false); } void DolphinMainWindow::setupDockWidgets() diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 7479c05b1..dfc171cf9 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -40,8 +40,6 @@ typedef KIO::FileUndoManager::CommandType CommandType; class KAction; class DolphinViewActionHandler; class DolphinApplication; -class DolphinSearchBox; -class DolphinSearchOptionsConfigurator; class DolphinSettingsDialog; class DolphinViewContainer; class DolphinRemoteEncoding; @@ -216,6 +214,9 @@ private slots: /** Pastes the clipboard data to the active view. */ void paste(); + /** Replaces the URL navigator by a search box to find files. */ + void find(); + /** * Updates the text of the paste action dependent from * the number of items which are in the clipboard. @@ -405,18 +406,6 @@ private slots: */ void slotTestCanDecode(const QDragMoveEvent* event, bool& accept); - /** - * Is connected with the Dolphin search box and the search configurator - * and triggers a Nepomuk search. - */ - void searchItems(); - - /** - * Is connected to the searchbox signal 'requestSearchOptions' and - * takes care to show the search options. - */ - void showSearchOptions(); - /** * If the URL can be listed open it in the current view, otherwise * run it through KRun. @@ -540,8 +529,6 @@ private: KTabBar* m_tabBar; DolphinViewContainer* m_activeViewContainer; QVBoxLayout* m_centralWidgetLayout; - DolphinSearchBox* m_searchBox; - DolphinSearchOptionsConfigurator* m_searchOptionsConfigurator; int m_id; struct ViewTab diff --git a/src/dolphinui.rc b/src/dolphinui.rc index 3ec650daa..caa41ddf2 100644 --- a/src/dolphinui.rc +++ b/src/dolphinui.rc @@ -1,5 +1,5 @@ - + @@ -42,7 +42,6 @@ - @@ -97,8 +96,4 @@ - - Search Toolbar - - diff --git a/src/dolphinviewactionhandler.cpp b/src/dolphinviewactionhandler.cpp index ff3fafc42..8b1d35ac9 100644 --- a/src/dolphinviewactionhandler.cpp +++ b/src/dolphinviewactionhandler.cpp @@ -202,13 +202,6 @@ void DolphinViewActionHandler::createActions() KAction* adjustViewProps = m_actionCollection->addAction("view_properties"); adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties...")); connect(adjustViewProps, SIGNAL(triggered()), this, SLOT(slotAdjustViewProperties())); - - // Tools menu - KAction* findFile = m_actionCollection->addAction("find_file"); - findFile->setText(i18nc("@action:inmenu Tools", "Find File...")); - findFile->setShortcut(Qt::CTRL | Qt::Key_F); - findFile->setIcon(KIcon("edit-find")); - connect(findFile, SIGNAL(triggered()), this, SLOT(slotFindFile())); } QActionGroup* DolphinViewActionHandler::createAdditionalInformationActionGroup() @@ -507,11 +500,6 @@ void DolphinViewActionHandler::slotAdjustViewProperties() delete dialog; } -void DolphinViewActionHandler::slotFindFile() -{ - KRun::run("kfind %u", m_currentView->url(), m_currentView->window()); -} - void DolphinViewActionHandler::slotProperties() { KPropertiesDialog* dialog = 0; diff --git a/src/dolphinviewactionhandler.h b/src/dolphinviewactionhandler.h index 0bdb88764..dbe02a706 100644 --- a/src/dolphinviewactionhandler.h +++ b/src/dolphinviewactionhandler.h @@ -200,11 +200,6 @@ private Q_SLOTS: */ void slotAdjustViewProperties(); - /** - * Opens the Find File dialog for the currently shown directory. - */ - void slotFindFile(); - /** * Connected to the "properties" action. * Opens the properties dialog for the selected items of the diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 9d33329e5..d11a4a9be 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -58,6 +58,7 @@ #include "dolphiniconsview.h" #include "draganddrophelper.h" #include "filterbar.h" +#include "search/dolphinsearchbox.h" #include "settings/dolphinsettings.h" #include "statusbar/dolphinstatusbar.h" #include "viewmodecontroller.h" @@ -68,6 +69,7 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : m_isFolderWritable(false), m_topLayout(0), m_urlNavigator(0), + m_searchBox(0), m_view(0), m_filterBar(0), m_statusBar(0), @@ -96,6 +98,11 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : KUrlComboBox* editor = m_urlNavigator->editor(); editor->setCompletionMode(KGlobalSettings::Completion(settings->urlCompletionMode())); + m_searchBox = new DolphinSearchBox(this); + m_searchBox->hide(); + connect(m_searchBox, SIGNAL(closeRequest()), this, SLOT(closeSearchBox())); + connect(m_searchBox, SIGNAL(search(QString)), this, SLOT(startSearching(QString))); + m_dirLister = new DolphinDirLister(); m_dirLister->setAutoUpdate(true); m_dirLister->setMainWindow(window()); @@ -174,9 +181,12 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) : m_filterBar, SLOT(clear())); m_topLayout->addWidget(m_urlNavigator); + m_topLayout->addWidget(m_searchBox); m_topLayout->addWidget(m_view); m_topLayout->addWidget(m_filterBar); m_topLayout->addWidget(m_statusBar); + + setSearchModeEnabled(isSearchUrl(url)); } DolphinViewContainer::~DolphinViewContainer() @@ -221,6 +231,33 @@ bool DolphinViewContainer::isFilterBarVisible() const return m_filterBar->isVisible(); } +void DolphinViewContainer::setSearchModeEnabled(bool enabled) +{ + m_searchBox->setVisible(enabled); + m_urlNavigator->setVisible(!enabled); + + if (enabled) { + // Remember the current URL, so that it can be restored + // when switching back to the URL navigator + const KUrl url = m_urlNavigator->locationUrl(); + m_searchBox->setSearchPath(url); + } else { + // Restore the URL for the URL navigator. If Dolphin has been + // started with a search-URL, the home URL is used as fallback. + const KUrl url = m_searchBox->searchPath(); + if (url.isValid() && !url.isEmpty() && !isSearchUrl(url)) { + m_urlNavigator->setLocationUrl(url); + } else { + m_urlNavigator->goHome(); + } + } +} + +bool DolphinViewContainer::isSearchModeEnabled() const +{ + return m_searchBox->isVisible(); +} + void DolphinViewContainer::setUrl(const KUrl& newUrl) { if (newUrl != m_urlNavigator->locationUrl()) { @@ -278,9 +315,10 @@ void DolphinViewContainer::updateStatusBar() void DolphinViewContainer::initializeProgress() { - if (url().protocol() == "nepomuksearch") { - // The Nepomuk IO-slave does not provide progress information right away. Give + if (isSearchUrl(url())) { + // Search KIO-slaves usually don't provide any progress information. Give // an immediate hint to the user that a searching is done: + updateStatusBar(); m_statusBar->setProgressText(i18nc("@info", "Searching...")); m_statusBar->setProgress(-1); } @@ -301,7 +339,7 @@ void DolphinViewContainer::slotDirListerCompleted() m_statusBar->setProgress(100); } - if ((url().protocol() == "nepomuksearch") && (m_dirLister->items().count() == 0)) { + if (isSearchUrl(url()) && (m_dirLister->items().count() == 0)) { // The dir lister has been completed on a Nepomuk-URI and no items have been found. Instead // of showing the default status bar information ("0 items") a more helpful information is given: m_statusBar->setMessage(i18nc("@info:status", "No items found."), DolphinStatusBar::Information); @@ -385,15 +423,23 @@ void DolphinViewContainer::saveViewState() void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url) { if (KProtocolManager::supportsListing(url)) { + // Assure that the search box is shown instead of the URL navigator in case + // that the URL \p url is a search URL (e. g. nepomuksearch:// or filenamesearch://). + if (isSearchUrl(url)) { + if (!m_searchBox->isVisible()) { + m_searchBox->setVisible(true); + m_urlNavigator->setVisible(false); + } + } else if (!m_urlNavigator->isVisible()) { + m_urlNavigator->setVisible(true); + m_searchBox->setVisible(false); + } + m_view->setUrl(url); if (isActive()) { // When an URL has been entered, the view should get the focus. // The focus must be requested asynchronously, as changing the URL might create - // a new view widget. Using QTimer::singleShow() works reliable, however - // QMetaObject::invokeMethod() with a queued connection does not work, which might - // indicate that we should pass a hint to DolphinView::updateView() - // regarding the focus instead. To test: Enter an URL and press CTRL+Enter. - // Expected result: The view should get the focus. + // a new view widget. QTimer::singleShot(0, this, SLOT(requestFocus())); } } else if (KProtocolManager::isSourceProtocol(url)) { @@ -465,6 +511,25 @@ void DolphinViewContainer::slotHistoryChanged() } } +void DolphinViewContainer::startSearching(const QString &text) +{ + Q_UNUSED(text); + const KUrl url = m_searchBox->urlForSearching(); + if (url.isValid() && !url.isEmpty()) { + m_urlNavigator->setLocationUrl(url); + } +} + +void DolphinViewContainer::closeSearchBox() +{ + setSearchModeEnabled(false); +} + +bool DolphinViewContainer::isSearchUrl(const KUrl& url) const +{ + return url.protocol().contains("search"); +} + void DolphinViewContainer::slotItemTriggered(const KFileItem& item) { KUrl url = item.targetUrl(); diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h index 50d7c9461..c222e7a55 100644 --- a/src/dolphinviewcontainer.h +++ b/src/dolphinviewcontainer.h @@ -41,6 +41,7 @@ class KUrl; class DolphinModel; class KUrlNavigator; class DolphinDirLister; +class DolphinSearchBox; class DolphinSortFilterProxyModel; class DolphinStatusBar; @@ -94,6 +95,13 @@ public: /** Returns true, if the filter bar is visible. */ bool isFilterBarVisible() const; + /** + * Enables the search mode, if \p enabled is true. In the search mode the URL navigator + * will be hidden and replaced by a line editor that allows to enter a search term. + */ + void setSearchModeEnabled(bool enabled); + bool isSearchModeEnabled() const; + public slots: /** * Sets the current active URL, where all actions are applied. The @@ -227,11 +235,22 @@ private slots: void slotHistoryChanged(); + /** + * Gets the search URL from the searchbox and starts searching. + * @param text Text the user has entered into the searchbox. + */ + void startSearching(const QString& text); + void closeSearchBox(); + +private: + bool isSearchUrl(const KUrl& url) const; + private: bool m_isFolderWritable; QVBoxLayout* m_topLayout; KUrlNavigator* m_urlNavigator; + DolphinSearchBox* m_searchBox; DolphinView* m_view; diff --git a/src/draganddrophelper.cpp b/src/draganddrophelper.cpp index 136b770a7..88dca9b40 100644 --- a/src/draganddrophelper.cpp +++ b/src/draganddrophelper.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/src/filterbar.cpp b/src/filterbar.cpp index 7becada99..b108570ce 100644 --- a/src/filterbar.cpp +++ b/src/filterbar.cpp @@ -19,12 +19,12 @@ ***************************************************************************/ #include "filterbar.h" -#include -#include -#include -#include +#include +#include +#include +#include -#include +#include #include #include #include @@ -32,28 +32,31 @@ FilterBar::FilterBar(QWidget* parent) : QWidget(parent) { - QHBoxLayout* hLayout = new QHBoxLayout(this); - hLayout->setMargin(0); - - m_close = new QToolButton(this); - m_close->setAutoRaise(true); - m_close->setIcon(KIcon("dialog-close")); - m_close->setToolTip(i18nc("@info:tooltip", "Hide Filter Bar")); - hLayout->addWidget(m_close); - hLayout->addSpacing(KDialog::spacingHint()); + // Create close button + QToolButton *closeButton = new QToolButton(this); + closeButton->setAutoRaise(true); + closeButton->setIcon(KIcon("dialog-close")); + closeButton->setToolTip(i18nc("@info:tooltip", "Hide Filter Bar")); + connect(closeButton, SIGNAL(clicked()), this, SIGNAL(closeRequest())); - m_filter = new QLabel(i18nc("@label:textbox", "Filter:"), this); - hLayout->addWidget(m_filter); + // Create label + QLabel* filterLabel = new QLabel(i18nc("@label:textbox", "Filter:"), this); + // Create filter editor m_filterInput = new KLineEdit(this); m_filterInput->setLayoutDirection(Qt::LeftToRight); m_filterInput->setClearButtonShown(true); - m_filter->setBuddy(m_filterInput); - hLayout->addWidget(m_filterInput); - connect(m_filterInput, SIGNAL(textChanged(const QString&)), this, SIGNAL(filterChanged(const QString&))); - connect(m_close, SIGNAL(clicked()), this, SIGNAL(closeRequest())); + + // Apply layout + QHBoxLayout* hLayout = new QHBoxLayout(this); + hLayout->setMargin(0); + hLayout->addWidget(closeButton); + hLayout->addWidget(filterLabel); + hLayout->addWidget(m_filterInput); + + filterLabel->setBuddy(m_filterInput); } FilterBar::~FilterBar() diff --git a/src/filterbar.h b/src/filterbar.h index e7c244e8c..bf1bce684 100644 --- a/src/filterbar.h +++ b/src/filterbar.h @@ -22,8 +22,6 @@ #include -class QLabel; -class QToolButton; class KLineEdit; /** @@ -61,9 +59,7 @@ protected: virtual void keyReleaseEvent(QKeyEvent* event); private: - QLabel* m_filter; KLineEdit* m_filterInput; - QToolButton* m_close; }; #endif diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index b18e6b26e..31128bafe 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -148,11 +148,11 @@ void InformationPanelContent::showItem(const KFileItem& item) m_pendingPreview = false; const KUrl itemUrl = item.url(); - const bool isNepomukSearchUrl = itemUrl.protocol().startsWith("nepomuk") && item.nepomukUri().isEmpty(); + const bool isSearchUrl = itemUrl.protocol().contains("search") && item.nepomukUri().isEmpty(); if (!applyPlace(itemUrl)) { setNameLabelText(item.text()); - if (isNepomukSearchUrl) { - // in the case of a Nepomuk query-URL the URL is not readable for humans + if (isSearchUrl) { + // in the case of a search-URL the URL is not readable for humans // (at least not useful to show in the Information Panel) KIconLoader iconLoader; QPixmap icon = iconLoader.loadIcon("nepomuk", diff --git a/src/search/dolphin_searchsettings.kcfg b/src/search/dolphin_searchsettings.kcfg index 792a9e247..b5014bdb9 100644 --- a/src/search/dolphin_searchsettings.kcfg +++ b/src/search/dolphin_searchsettings.kcfg @@ -5,15 +5,11 @@ - Everywhere + FromHere - All - - - - + FileName diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index 05e62dab3..c2f2a0390 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -1,309 +1,380 @@ /*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * Copyright (C) 2009 by Matthias Fuchs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +* Copyright (C) 2010 by Peter Penz * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * +* **************************************************************************/ #include "dolphinsearchbox.h" -#include +#include "dolphin_searchsettings.h" -#include -#include -#include +#include #include #include -#include -#include +#include +#include +#include #include -#include +#include #include -#include -#include -#include +#include +#include +#include #include +#include +#include #ifdef HAVE_NEPOMUK -#include -#include + #define DISABLE_NEPOMUK_LEGACY + #include + #include + #include + #include + #include + #include + #include + #include "nfo.h" + + #include "filters/datesearchfilterwidget.h" + #include "filters/ratingsearchfilterwidget.h" + #include "filters/tagsearchfilterwidget.h" #endif -DolphinSearchCompleter::DolphinSearchCompleter(KLineEdit* linedit) : - QObject(0), - q(linedit), - m_completer(0), - m_completionModel(0), - m_wordStart(-1), - m_wordEnd(-1) +DolphinSearchBox::DolphinSearchBox(QWidget* parent) : + QWidget(parent), + m_startedSearching(false), + m_nepomukActivated(false), + m_topLayout(0), + m_searchInput(0), + m_fromHereButton(0), + m_everywhereButton(0), + m_fileNameButton(0), + m_contentButton(0), + m_filterButton(0), + m_filterWidgetsLayout(0), + m_filterWidgets(), + m_searchPath() { - m_completionModel = new QStandardItemModel(this); - -#ifdef HAVE_NEPOMUK - if (!Nepomuk::ResourceManager::instance()->init()) { - //read all currently set tags - //NOTE if the user changes tags elsewhere they won't get updated here - QList tags = Nepomuk::Tag::allTags(); - foreach (const Nepomuk::Tag& tag, tags) { - const QString tagText = tag.label(); - addCompletionItem(tagText, - "hasTag:\"" + tagText + '\"', - i18nc("Tag as in Nepomuk::Tag", "Tag"), // TODO: change to "hasTag" after msg freeze - QString(), - KIcon("mail-tagged")); - } - } -#endif //HAVE_NEPOMUK - - // load the completions stored in the desktop file - KDesktopFile file(KStandardDirs::locate("data", "dolphin/dolphinsearchcommands.desktop")); - foreach (const QString &group, file.groupList()) { - KConfigGroup cg(&file, group); - const QString displayed = cg.readEntry("Name", QString()); - const QString usedForCompletition = cg.readEntry("Completion", QString()); - const QString description = cg.readEntry("Comment", QString()); - const QString toolTip = cg.readEntry("GenericName", QString()); - const QString icon = cg.readEntry("Icon", QString()); - - if (icon.isEmpty()) { - addCompletionItem(displayed, usedForCompletition, description, toolTip); - } else { - addCompletionItem(displayed, usedForCompletition, description, toolTip, KIcon(icon)); - } - } - - m_completionModel->sort(0, Qt::AscendingOrder); - - m_completer = new QCompleter(m_completionModel, this); - m_completer->setWidget(q); - m_completer->setCaseSensitivity(Qt::CaseInsensitive); - QTreeView *view = new QTreeView; - m_completer->setPopup(view); - view->setRootIsDecorated(false); - view->setHeaderHidden(true); - - connect(q, SIGNAL(textEdited(QString)), this, SLOT(slotTextEdited(QString))); - connect(m_completer, SIGNAL(highlighted(QModelIndex)), this, SLOT(highlighted(QModelIndex))); } -void DolphinSearchCompleter::addCompletionItem(const QString& displayed, const QString& usedForCompletition, const QString& description, const QString& toolTip, const KIcon& icon) +DolphinSearchBox::~DolphinSearchBox() { - if (displayed.isEmpty() || usedForCompletition.isEmpty()) { - return; - } - - QList items; - QStandardItem *item = new QStandardItem(); - item->setData(QVariant(displayed), Qt::DisplayRole); - item->setData(QVariant(usedForCompletition), Qt::UserRole); - item->setData(QVariant(toolTip), Qt::ToolTipRole); - items << item; + saveSettings(); +} - item = new QStandardItem(description); - if (!icon.isNull()) { - item->setIcon(icon); - } - item->setData(QVariant(toolTip), Qt::ToolTipRole); - items << item; +QString DolphinSearchBox::text() const +{ + return m_searchInput->text(); +} - m_completionModel->insertRow(m_completionModel->rowCount(), items); +void DolphinSearchBox::setSearchPath(const KUrl& url) +{ + m_searchPath = url; + m_filterButton->setVisible(isSearchPathIndexed()); } -void DolphinSearchCompleter::findText(int* wordStart, int* wordEnd, QString* newWord, int cursorPos, const QString &input) +KUrl DolphinSearchBox::searchPath() const { - --cursorPos;//decrease to get a useful position (not the end of the word e.g.) + return m_searchPath; +} - if (!wordStart || !wordEnd) { - return; +KUrl DolphinSearchBox::urlForSearching() const +{ + KUrl url; + if (isSearchPathIndexed() && !m_fileNameButton->isChecked()) { + // TODO: Currently Nepomuk is not used for searching filenames. Nepomuk + // is capable to provide this, but further investigations are necessary to + // also support regular expressions. + url = nepomukUrlForSearching(); + } else { + url = m_searchPath; + url.setProtocol("filenamesearch"); + url.addQueryItem("search", m_searchInput->text()); + if (m_contentButton->isChecked()) { + url.addQueryItem("checkContent", "yes"); + } + if (m_everywhereButton->isChecked()) { + // It is very unlikely, that the majority of Dolphins target users + // mean "the whole harddisk" instead of "my home folder" when + // selecting the "Everywhere" button. + url.setPath(QDir::homePath()); + } } - *wordStart = -1; - *wordEnd = -1; - - // the word might contain "" and thus maybe spaces - if (input.contains('\"')) { - int tempStart = -1; - int tempEnd = -1; + return url; +} - do { - tempStart = input.indexOf('\"', tempEnd + 1); - tempEnd = input.indexOf('\"', tempStart + 1); - if ((cursorPos >= tempStart) && (cursorPos <= tempEnd)) { - *wordStart = tempStart; - *wordEnd = tempEnd; - break; - } else if ((tempEnd == -1) && (cursorPos >= tempStart)) { - //one " found, so probably the beginning of the new word - *wordStart = tempStart; - break; - } - } while ((tempStart != -1) && (tempEnd != -1)); +bool DolphinSearchBox::event(QEvent* event) +{ + if (event->type() == QEvent::Polish) { + init(); + } else if (event->type() == QEvent::KeyPress) { + if (static_cast(event)->key() == Qt::Key_Escape) { + m_searchInput->clear(); + } } + return QWidget::event(event); +} - if (*wordEnd > -1) { - *wordEnd = input.indexOf(' ', *wordEnd) - 1; - } else { - *wordEnd = input.indexOf(' ', cursorPos) - 1; - } - if (*wordEnd < 0) { - *wordEnd = input.length() - 1; - } +void DolphinSearchBox::showEvent(QShowEvent* event) +{ + if (!event->spontaneous()) { +#ifdef HAVE_NEPOMUK + m_nepomukActivated = (Nepomuk::ResourceManager::instance()->init() == 0); +#endif - if (*wordStart > -1) { - *wordStart = input.lastIndexOf(' ', *wordStart + 1) + 1; - } else { - *wordStart = input.lastIndexOf(' ', cursorPos) + 1; - } - if (*wordStart < 0) { - *wordStart = 0; + m_searchInput->clear(); + m_searchInput->setFocus(); + m_startedSearching = false; } +} - - QString word = input.mid(*wordStart, *wordEnd - *wordStart + 1); - - //remove opening braces or negations ('-' = not) at the beginning - while (word.count() && ((word[0] == '(') || (word[0] == '-'))) { - word.remove(0, 1); - ++(*wordStart); +void DolphinSearchBox::keyReleaseEvent(QKeyEvent* event) +{ + QWidget::keyReleaseEvent(event); + if ((event->key() == Qt::Key_Escape)) { + if (m_searchInput->text().isEmpty()) { + emit closeRequest(); + } else { + m_searchInput->clear(); + } } +} - //remove ending braces at the end - while (word.count() && (word[word.count() - 1] == ')')) { - word.remove(word.count() - 1, 1); - --(*wordEnd); - } +void DolphinSearchBox::emitSearchSignal() +{ + m_startedSearching = true; + emit search(m_searchInput->text()); +} - if (newWord) { - *newWord = word; +void DolphinSearchBox::slotConfigurationChanged() +{ + if (m_startedSearching) { + emitSearchSignal(); } } -void DolphinSearchCompleter::slotTextEdited(const QString& text) +void DolphinSearchBox::setFilterWidgetsVisible(bool visible) { - findText(&m_wordStart, &m_wordEnd, &m_userText, q->cursorPosition(), text); - - if (!m_userText.isEmpty()) { - const int role = m_completer->completionRole(); - - //change the role used for comparison depending on what the user entered - if (m_userText.contains(':') || m_userText.contains('\"')) { - //assume that m_userText contains searchinformation like 'tag:"..."' - if (role != Qt::UserRole) { - m_completer->setCompletionRole(Qt::UserRole); +#ifdef HAVE_NEPOMUK + if (visible) { + if (m_filterWidgetsLayout == 0) { + m_filterWidgetsLayout = new QFormLayout(this); + m_filterWidgetsLayout->setSpacing(0); + + m_filterWidgets.append(new DateSearchFilterWidget(this)); + m_filterWidgets.append(new RatingSearchFilterWidget(this)); + m_filterWidgets.append(new TagSearchFilterWidget(this)); + + foreach (AbstractSearchFilterWidget* filterWidget, m_filterWidgets) { + const QString labelText = filterWidget->filterLabel() + QLatin1Char(':'); + QLabel* label = new QLabel(labelText, this); + m_filterWidgetsLayout->addRow(label, filterWidget); + connect(filterWidget, SIGNAL(filterChanged()), this, SLOT(emitSearchSignal())); } - } else if (role != Qt::EditRole) { - m_completer->setCompletionRole(Qt::EditRole); } - - m_completer->setCompletionPrefix(m_userText); - m_completer->complete(); + m_topLayout->addLayout(m_filterWidgetsLayout); + } else { + m_topLayout->removeItem(m_filterWidgetsLayout); } +#else + Q_UNUSED(visible); +#endif } -void DolphinSearchCompleter::highlighted(const QModelIndex& index) +void DolphinSearchBox::initButton(QPushButton* button) { - QString text = q->text(); - int wordStart; - int wordEnd; + button->setAutoExclusive(true); + button->setFlat(true); + button->setCheckable(true); + connect(button, SIGNAL(toggled(bool)), this, SLOT(slotConfigurationChanged())); +} - findText(&wordStart, &wordEnd, 0, q->cursorPosition(), text); +void DolphinSearchBox::loadSettings() +{ + if (SearchSettings::location() == QLatin1String("Everywhere")) { + m_everywhereButton->setChecked(true); + } else { + m_fromHereButton->setChecked(true); + } - QString replace = index.sibling(index.row(), 0).data(Qt::UserRole).toString(); - //show the originally entered text - if (replace.isEmpty()) { - replace = m_userText; + if (SearchSettings::what() == QLatin1String("Content")) { + m_contentButton->setChecked(true); + } else { + m_fileNameButton->setChecked(true); } +} - text.replace(wordStart, wordEnd - wordStart + 1, replace); - q->setText(text); - q->setCursorPosition(wordStart + replace.length()); +void DolphinSearchBox::saveSettings() +{ + SearchSettings::setLocation(m_fromHereButton->isChecked() ? "FromHere" : "Everywhere"); + SearchSettings::setWhat(m_fileNameButton->isChecked() ? "FileName" : "Content"); + SearchSettings::self()->writeConfig(); } -DolphinSearchBox::DolphinSearchBox(QWidget* parent) : - QWidget(parent), - m_searchInput(0), - m_completer(0) +void DolphinSearchBox::init() { - QHBoxLayout* hLayout = new QHBoxLayout(this); - hLayout->setMargin(0); - hLayout->setSpacing(0); + // Create close button + QToolButton* closeButton = new QToolButton(this); + closeButton->setAutoRaise(true); + closeButton->setIcon(KIcon("dialog-close")); + closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching")); + connect(closeButton, SIGNAL(clicked()), SIGNAL(closeRequest())); + + // Create search label + QLabel* searchLabel = new QLabel(i18nc("@label:textbox", "Find:"), this); + // Create search box m_searchInput = new KLineEdit(this); m_searchInput->setClearButtonShown(true); - m_searchInput->setMinimumWidth(150); - m_searchInput->setClickMessage(i18nc("@label:textbox", "Search...")); - m_searchInput->installEventFilter(this); - hLayout->addWidget(m_searchInput); + m_searchInput->setFont(KGlobalSettings::generalFont()); connect(m_searchInput, SIGNAL(returnPressed()), this, SLOT(emitSearchSignal())); connect(m_searchInput, SIGNAL(textChanged(QString)), - this, SLOT(slotTextChanged(QString))); + this, SIGNAL(searchTextChanged(QString))); + + // Apply layout for the search input + QHBoxLayout* searchInputLayout = new QHBoxLayout(); + searchInputLayout->setMargin(0); + searchInputLayout->addWidget(closeButton); + searchInputLayout->addWidget(searchLabel); + searchInputLayout->addWidget(m_searchInput); + + // Create "From Here" and "Everywhere"button + m_fromHereButton = new QPushButton(); + m_fromHereButton->setText(i18nc("action:button", "From Here")); + initButton(m_fromHereButton); + + m_everywhereButton = new QPushButton(this); + m_everywhereButton->setText(i18nc("action:button", "Everywhere")); + initButton(m_everywhereButton); + + QButtonGroup* searchLocationGroup = new QButtonGroup(this); + searchLocationGroup->addButton(m_fromHereButton); + searchLocationGroup->addButton(m_everywhereButton); + + // Create "Filename" and "Content" button + m_fileNameButton = new QPushButton(this); + m_fileNameButton->setText(i18nc("action:button", "Filename")); + initButton(m_fileNameButton); + + m_contentButton = new QPushButton(); + m_contentButton->setText(i18nc("action:button", "Content")); + initButton(m_contentButton);; + + QButtonGroup* searchWhatGroup = new QButtonGroup(this); + searchWhatGroup->addButton(m_fileNameButton); + searchWhatGroup->addButton(m_contentButton); + + // Create "Filter" button + m_filterButton = new QToolButton(this); + m_filterButton->setIcon(KIcon("view-filter")); + m_filterButton->setAutoRaise(true); + m_filterButton->setCheckable(true); + m_filterButton->hide(); + connect(m_filterButton, SIGNAL(toggled(bool)), this, SLOT(setFilterWidgetsVisible(bool))); + + // Apply layout for the options + QHBoxLayout* optionsLayout = new QHBoxLayout(); + optionsLayout->setMargin(0); + optionsLayout->addWidget(m_fromHereButton); + optionsLayout->addWidget(m_everywhereButton); + optionsLayout->addWidget(new KSeparator(Qt::Vertical)); + optionsLayout->addWidget(m_fileNameButton); + optionsLayout->addWidget(m_contentButton); + optionsLayout->addStretch(1); + optionsLayout->addWidget(m_filterButton); + + m_topLayout = new QVBoxLayout(this); + m_topLayout->addLayout(searchInputLayout); + m_topLayout->addLayout(optionsLayout); + + searchLabel->setBuddy(m_searchInput); + loadSettings(); } -DolphinSearchBox::~DolphinSearchBox() +bool DolphinSearchBox::isSearchPathIndexed() const { -} +#ifdef HAVE_NEPOMUK + const QString path = m_searchPath.path(); -QString DolphinSearchBox::text() const -{ - return m_searchInput->text(); -} + const KConfig strigiConfig("nepomukstrigirc"); + const QStringList indexedFolders = strigiConfig.group("General").readPathEntry("folders", QStringList()); -bool DolphinSearchBox::event(QEvent* event) -{ - if (event->type() == QEvent::Polish) { - m_searchInput->setFont(KGlobalSettings::generalFont()); - } else if (event->type() == QEvent::KeyPress) { - if (static_cast(event)->key() == Qt::Key_Escape) { - m_searchInput->clear(); + // Check whether the current search path is part of an indexed folder + bool isIndexed = false; + foreach (const QString& indexedFolder, indexedFolders) { + if (path.startsWith(indexedFolder)) { + isIndexed = true; + break; } } - return QWidget::event(event); -} -bool DolphinSearchBox::eventFilter(QObject* watched, QEvent* event) -{ - if ((watched == m_searchInput) && (event->type() == QEvent::FocusIn)) { - // Postpone the creation of the search completer until - // the search box is used. This decreases the startup time - // of Dolphin. - if (m_completer == 0) { - m_completer = new DolphinSearchCompleter(m_searchInput); - } - if (m_searchInput->text().isEmpty()) { - emit requestSearchOptions(); + if (isIndexed) { + // The current search path is part of an indexed folder. Check whether no + // excluded folder is part of the search path. + const QStringList excludedFolders = strigiConfig.group("General").readPathEntry("exclude folders", QStringList()); + foreach (const QString& excludedFolder, excludedFolders) { + if (excludedFolder.startsWith(path)) { + isIndexed = false; + break; + } } } - return QWidget::eventFilter(watched, event); + return isIndexed; +#else + return false; +#endif } - -void DolphinSearchBox::emitSearchSignal() +KUrl DolphinSearchBox::nepomukUrlForSearching() const { - emit search(m_searchInput->text()); -} +#ifdef HAVE_NEPOMUK + Nepomuk::Query::AndTerm andTerm; -void DolphinSearchBox::slotTextChanged(const QString& text) -{ + // Add filter terms + foreach (const AbstractSearchFilterWidget* filterWidget, m_filterWidgets) { + const Nepomuk::Query::Term term = filterWidget->queryTerm(); + if (term.isValid()) { + andTerm.addSubTerm(term); + } + } + + // Add input from search filter + const QString text = m_searchInput->text(); if (!text.isEmpty()) { - emit requestSearchOptions(); + const Nepomuk::Query::Query customQuery = Nepomuk::Query::QueryParser::parseQuery(text); + if (customQuery.isValid()) { + andTerm.addSubTerm(customQuery.term()); + } } - emit searchTextChanged(text); + + Nepomuk::Query::FileQuery fileQuery; + fileQuery.setFileMode(Nepomuk::Query::FileQuery::QueryFiles); + fileQuery.setTerm(andTerm); + + if (fileQuery.isValid()) { + return fileQuery.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.", + "Query Results from '%1'", + text)); + } +#endif + return KUrl(); } #include "dolphinsearchbox.moc" diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h index 67895a5e9..f0ec73def 100644 --- a/src/search/dolphinsearchbox.h +++ b/src/search/dolphinsearchbox.h @@ -1,6 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * Copyright (C) 2009 by Matthias Fuchs * + * Copyright (C) 2010 by Peter Penz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -17,51 +16,32 @@ * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ + #ifndef DOLPHINSEARCHBOX_H #define DOLPHINSEARCHBOX_H +#include +#include #include -#include - +class AbstractSearchFilterWidget; class KLineEdit; -class QCompleter; -class QModelIndex; -class QStandardItemModel; - -/** - * @brief Helper class used for completition for the DolphinSearchBox. - */ -class DolphinSearchCompleter : public QObject -{ - Q_OBJECT - -public: - DolphinSearchCompleter(KLineEdit *linedit); - -public slots: - void highlighted(const QModelIndex& index); - void slotTextEdited(const QString &text); - -private: - void addCompletionItem(const QString& displayed, const QString& usedForCompletition, const QString& description = QString(), const QString& toolTip = QString(), const KIcon& icon = KIcon()); - - void findText(int* wordStart, int* wordEnd, QString* newWord, int cursorPos, const QString &input); - -private: - KLineEdit* q; - QCompleter* m_completer; - QStandardItemModel* m_completionModel; - QString m_userText; - int m_wordStart; - int m_wordEnd; -}; +class QFormLayout; +class QPushButton; +class QToolButton; +class QVBoxLayout; /** - * @brief Input box for searching files with Nepomuk. + * @brief Input box for searching files with or without Nepomuk. + * + * The widget allows to specify: + * - Where to search: Everywhere or below the current directory + * - What to search: Filenames or content + * + * If Nepomuk is available and the current folder is indexed, further + * options are offered. */ -class DolphinSearchBox : public QWidget -{ +class DolphinSearchBox : public QWidget { Q_OBJECT public: @@ -74,9 +54,20 @@ public: */ QString text() const; + /** + * Sets the current path that is used as root for + * searching files, if "From Here" has been selected. + */ + void setSearchPath(const KUrl& url); + KUrl searchPath() const; + + /** @return URL that will start the searching of files. */ + KUrl urlForSearching() const; + protected: virtual bool event(QEvent* event); - virtual bool eventFilter(QObject* watched, QEvent* event); + virtual void showEvent(QShowEvent* event); + virtual void keyReleaseEvent(QKeyEvent* event); signals: /** @@ -93,20 +84,49 @@ signals: void searchTextChanged(const QString& text); /** - * Is emitted if the search box gets the focus or the text - * has been changed. It requests the need for an UI that allows to - * adjust search options. It is up to the application to ignore - * this request. + * Emitted as soon as the search box should get closed. */ - void requestSearchOptions(); + void closeRequest(); private slots: void emitSearchSignal(); - void slotTextChanged(const QString& text); + void slotConfigurationChanged(); + void setFilterWidgetsVisible(bool visible); private: + void initButton(QPushButton* button); + void loadSettings(); + void saveSettings(); + void init(); + + /** + * @return True, if the complete directory tree specified by m_searchPath + * is indexed by Strigi. + */ + bool isSearchPathIndexed() const; + + /** + * @return URL that represents the Nepomuk query for starting the search. + */ + KUrl nepomukUrlForSearching() const; + +private: + bool m_startedSearching; + bool m_nepomukActivated; + + QVBoxLayout* m_topLayout; + KLineEdit* m_searchInput; - DolphinSearchCompleter* m_completer; + QPushButton* m_fromHereButton; + QPushButton* m_everywhereButton; + QPushButton* m_fileNameButton; + QPushButton* m_contentButton; + + QToolButton* m_filterButton; + QFormLayout* m_filterWidgetsLayout; + QList m_filterWidgets; + + KUrl m_searchPath; }; #endif diff --git a/src/search/dolphinsearchcommands.desktop b/src/search/dolphinsearchcommands.desktop deleted file mode 100644 index f32983402..000000000 --- a/src/search/dolphinsearchcommands.desktop +++ /dev/null @@ -1,1073 +0,0 @@ -# Name -- what is displayed in the first column -# Comment -- what is displayed in the second column -# Completion -- what is returned as completion item - -[dolphin and] -#ctx: and as in a logic operator to connect search terms -Name=and -Comment=logic operator and -Comment[bg]=логически оператор "и" -Comment[ca]=operador lògic i -Comment[ca@valencia]=operador lògic i -Comment[cs]=logický operátor and -Comment[csb]=logiczny òperatora ë -Comment[da]=den logiske operator og -Comment[de]=Logischer Und-Operator -Comment[el]=τελεστής λογικής και -Comment[en_GB]=logic operator and -Comment[eo]=logika operatoro "kaj" -Comment[es]=operador lógico y -Comment[et]=Loogiline JA -Comment[eu]=eta eragile logikoa -Comment[fi]=logiikkaoperaattori and -Comment[fr]=opérateur logique et -Comment[fy]=logyske operator -Comment[ga]=oibreoir loighciúil 'agus' -Comment[gl]=o operador lóxico «e» -Comment[gu]=તાર્કિક ઓપરેટર એન્ડ -Comment[he]=אופרטור לוגי וגם -Comment[hr]=logički operator i -Comment[hu]=logikai ÉS művelet -Comment[ia]=operator logic e -Comment[id]=operator logika dan -Comment[is]=rökaðgerðin og -Comment[it]=operatore logico «e» -Comment[ja]=論理演算子 AND -Comment[kk]=логикалық 'және' операторы -Comment[km]=សញ្ញា​ប្រមាណ​វិធី logic and -Comment[kn]=ತಾರ್ಕಿಕ(ಲಾಜಿಕ್) ನಿರ್ವಾಹಕ(ಆಪರೇಟರ್) ಹಾಗು (ಏಂಡ್) -Comment[ko]=논리 연산자 'and' -Comment[lt]=loginis operatorius „ir“ (and) -Comment[lv]=loģiskā operācija un -Comment[mk]=логичкиот оператор „и“ -Comment[ml]=ലോജിക്കല്‍ ഓപ്പറേറ്ററായ ആന്‍ഡ് -Comment[nb]=logisk og-operator -Comment[nds]=Logisch Operator »Un« -Comment[nl]=logische operator en -Comment[nn]=logisk operatør og -Comment[pa]=ਲਾਜ਼ੀਕਲ ਓਪਰੇਟਰ ਅਤੇ -Comment[pl]=operator logiczny "i" (and) -Comment[pt]=operador lógico 'e' -Comment[pt_BR]=operador lógico 'e' -Comment[ro]=operatorul logic și -Comment[ru]=логическая операция «И» -Comment[si]=and තර්‍ක ක්‍රියාව -Comment[sk]=logický operátor AND -Comment[sl]=logični operator in -Comment[sr]=Логички оператор И -Comment[sr@ijekavian]=Логички оператор И -Comment[sr@ijekavianlatin]=Logički operator I -Comment[sr@latin]=Logički operator I -Comment[sv]=logisk operator och -Comment[tg]=Оператори мантиқӣ ва -Comment[th]=ตัวดำเนินการทางตรรกะ 'และ' -Comment[tr]=mantıksal işleç olarak ve -Comment[uk]=булівська дія «ТА» -Comment[wa]=operateur lodjike eyet -Comment[x-test]=xxlogic operator andxx -Comment[zh_CN]=逻辑与操作符 -Comment[zh_TW]=邏輯運算上的「且」(and) -Completion=and - -[dolphin or] -#ctx: or as in a logic operator to connect search terms -Name=or -Comment=logic operator or -Comment[bg]=логически операгор "или" -Comment[ca]=operador lògic o -Comment[ca@valencia]=operador lògic o -Comment[cs]=logický operátor or -Comment[csb]=logiczny òperatora abò -Comment[da]=den logiske operator eller -Comment[de]=Logischer Oder-Operator -Comment[el]=τελεστής λογικής ή -Comment[en_GB]=logic operator or -Comment[eo]=logika operatoro "aŭ" -Comment[es]=operador lógico o -Comment[et]=Loogiline VÕI -Comment[eu]=edo eragile logikoa -Comment[fi]=loogiikkaoperaattori or -Comment[fr]=opérateur logique ou -Comment[fy]=logyske operator of -Comment[ga]=oibreoir loighciúil 'nó' -Comment[gl]=o operador lóxico «ou» -Comment[gu]=તાર્કિક ઓપરેટર ઓર -Comment[he]=אופרטור לוגי או -Comment[hr]=logički operator ili -Comment[hu]=logikai VAGY művelet -Comment[ia]=operator logic or -Comment[id]=operator logika dan -Comment[is]=rökaðgerðin eða -Comment[it]=operatore logico «o» -Comment[ja]=論理演算子 OR -Comment[kk]=логикалық 'немесе' операторы -Comment[km]=សញ្ញាប្រមាណវិធី​ឡូសីក or -Comment[kn]=ತಾರ್ಕಿಕ(ಲಾಜಿಕ್) ನಿರ್ವಾಹಕ(ಆಪರೇಟರ್) ಅಥವಾ (ಓರ್) -Comment[ko]=논리 연산자 'or' -Comment[lt]=loginis operatorius „arba“ (or) -Comment[lv]=loģiskā operācija vai -Comment[mk]=логичкиот оператор „или“ -Comment[ml]=ലോജിക്കല്‍ ഓപ്പറേറ്ററായ ഓര്‍ -Comment[nb]=logisk eller-operator -Comment[nds]=Logisch Operator »Oder« -Comment[nl]=logische operator of -Comment[nn]=logisk operatør eller -Comment[pa]=ਲਾਜ਼ੀਕਲ ਓਪਰੇਟਰ ਜਾਂ -Comment[pl]=operator logiczny "lub" (or) -Comment[pt]=operador lógico 'ou' -Comment[pt_BR]=operador lógico 'ou' -Comment[ro]=operatorul logic sau -Comment[ru]=логическая операция «ИЛИ» -Comment[si]=or තර්‍ක ක්‍රියාව -Comment[sk]=logický operátor OR -Comment[sl]=logični operator ali -Comment[sr]=Логички оператор ИЛИ -Comment[sr@ijekavian]=Логички оператор ИЛИ -Comment[sr@ijekavianlatin]=Logički operator ILI -Comment[sr@latin]=Logički operator ILI -Comment[sv]=logisk operator eller -Comment[tg]=Оператори мантиқӣ ё -Comment[th]=ตัวดำเนินการทางตรรกะ 'หรือ' -Comment[tr]=mantıksal işleç olarak veya -Comment[uk]=булівська дія «АБО» -Comment[wa]=operateur lodjike ou -Comment[x-test]=xxlogic operator orxx -Comment[zh_CN]=逻辑或操作符 -Comment[zh_TW]=邏輯運算上的「或」(or) -Completion=or - -[dolphin not] -#ctx: not as in a logic operator to connect search terms -Name=not -Comment=logic operator not -Comment[bg]=логически оператор "не" -Comment[ca]=operador lògic no -Comment[ca@valencia]=operador lògic no -Comment[cs]=logický operátor negace -Comment[csb]=logiczny òperatora nié -Comment[da]=den logiske operator ikke -Comment[de]=Logischer Nicht-Operator -Comment[el]=τελεστής λογικής δεν -Comment[en_GB]=logic operator not -Comment[eo]=logika operatoro "ne" -Comment[es]=operador lógico no -Comment[et]=Loogiline EI -Comment[eu]=ez eragile logikoa -Comment[fi]=logiikkaoperaattori not -Comment[fr]=opérateur logique non -Comment[fy]=logyske operator net -Comment[ga]=oibreoir loighciúil 'níl' -Comment[gl]=o operador lóxico «non» -Comment[gu]=તાર્કિક ઓપરેટર નોટ -Comment[he]=אופרטור לוגי שלילה -Comment[hr]=logički operator ne -Comment[hu]=logikai NEM művelet -Comment[ia]=operator logic not -Comment[id]=operator logika tidak -Comment[is]=rökaðgerðin ekki -Comment[it]=operatore logico «non» -Comment[ja]=論理演算子 NOT -Comment[kk]=логикалық 'теріс' операторы -Comment[km]=សញ្ញា​ប្រមាណវិធី logic not -Comment[kn]=ತಾರ್ಕಿಕ(ಲಾಜಿಕ್) ನಿರ್ವಾಹಕ(ಆಪರೇಟರ್) ಅಲ್ಲ (ನಾಟ್) -Comment[ko]=논리 연산자 'not' -Comment[lt]=loginis operatorius „ne“ (not) -Comment[lv]=loģiskā operācija ne -Comment[mk]=логичкиот оператор „не“ -Comment[ml]=ലോജിക്കല്‍ ഓപ്പറേറ്ററായ നോട്ട് -Comment[nb]=logisk ikke-operator -Comment[nds]=Logisch Operator »Nich« -Comment[nl]=logische operator niet -Comment[nn]=logisk operatør ikkje -Comment[pa]=ਲਾਜ਼ੀਕਲ ਓਪਰੇਟਰ ਨਹੀਂ -Comment[pl]=operator logiczny "nie" (not) -Comment[pt]=operador lógico 'não' -Comment[pt_BR]=operador lógico 'não' -Comment[ro]=operatorul logic nu -Comment[ru]=логическая операция «НЕ» -Comment[si]=not තර්‍ක ක්‍රියාව -Comment[sk]=logický operátor NOT -Comment[sl]=logični operator ne -Comment[sr]=Логички оператор НЕ -Comment[sr@ijekavian]=Логички оператор НЕ -Comment[sr@ijekavianlatin]=Logički operator NE -Comment[sr@latin]=Logički operator NE -Comment[sv]=logisk operator inte -Comment[tg]=Оператори мантиқӣ нест -Comment[th]=ตัวดำเนินการทางตรรกะ 'ไม่ใช่' -Comment[tr]=mantıksal işleç olarak değil -Comment[uk]=булівська дія «НЕ» -Comment[wa]=operateur lodjike n' est nén -Comment[x-test]=xxlogic operator notxx -Comment[zh_CN]=逻辑非操作符 -Comment[zh_TW]=邏輯運算上的「否」(not) -Completion=- - -[dolphin fileExtension] -Name=File extension -Name[bg]=Файлово разширение -Name[bn]=ফাইল এক্সটেনশন -Name[ca]=Extensió del fitxer -Name[ca@valencia]=Extensió del fitxer -Name[cs]=Přípona souboru -Name[csb]=Rozszérzenié lopka -Name[da]=Filendelse -Name[de]=Dateierweiterung -Name[el]=Κατάληξη αρχείου -Name[en_GB]=File extension -Name[eo]=Dosier-sufikso -Name[es]=Extensión de archivo -Name[et]=Faililaiend -Name[eu]=Fitxategi luzapena -Name[fi]=Tiedostotarkennin -Name[fr]=Extension de fichier -Name[fy]=Triem taheaksel -Name[ga]=Iarmhír chomhaid -Name[gl]=Extensión do ficheiro -Name[gu]=ફાઈલ એક્સટેન્શન -Name[he]=סיומת קובץ -Name[hr]=Nastavak datoteke -Name[hu]=Fájlkiterjesztés -Name[ia]=extension de file -Name[id]=Ekstensi berkas -Name[is]=Skráarending -Name[it]=Estensione di file -Name[ja]=ファイルの拡張子 -Name[kk]=Файл атау жұрнағы -Name[km]=ផ្នែកបន្ថែម​ឯកសារ -Name[kn]=ಕಡತ ವಿಸ್ತರಣೆ -Name[ko]=파일 확장자 -Name[lt]=Failo priesaga -Name[lv]=Faila paplašinājums -Name[mai]=फाइल विस्तार -Name[mk]=Наставка на датотека -Name[ml]=ഫയല്‍ എക്സ്റ്റെന്‍ഷന്‍ -Name[ms]=Sambungan fail -Name[nb]=Filetternavn -Name[nds]=Dateiverwiedern -Name[nl]=Bestandsextensie -Name[nn]=Filetternamn -Name[pa]=ਫਾਇਲ ਇਕਸਟੈਨਸ਼ਨ -Name[pl]=Rozszerzenie pliku -Name[pt]=Extensão do ficheiro -Name[pt_BR]=Extensão do arquivo -Name[ro]=Extensie fișier -Name[ru]=Расширение файла -Name[si]=ගොනු දිගුව -Name[sk]=Prípona súboru -Name[sl]=Končnica datoteke -Name[sr]=наставак фајла -Name[sr@ijekavian]=наставак фајла -Name[sr@ijekavianlatin]=nastavak fajla -Name[sr@latin]=nastavak fajla -Name[sv]=Filändelse -Name[tg]=Намуди файл -Name[th]=ส่วนขยายแฟ้ม -Name[tr]=Dosya uzantısı -Name[uk]=Суфікс назви файла -Name[wa]=Cawete do fitchî -Name[x-test]=xxFile extensionxx -Name[zh_CN]=文件扩展名 -Name[zh_TW]=副檔名 -Comment=for example txt -Comment[bg]=например txt -Comment[bn]=উদাহরণস্বরূপ txt -Comment[ca]=per exemple txt -Comment[ca@valencia]=per exemple txt -Comment[cs]=např. txt -Comment[csb]=na przëmiôr txt -Comment[da]=for eksempel txt -Comment[de]=zum Beispiel txt -Comment[el]=για παράδειγμα txt -Comment[en_GB]=for example txt -Comment[eo]=ekzemple "txt" -Comment[es]=por ejemplo txt -Comment[et]=näiteks txt -Comment[eu]=adibidez txt -Comment[fi]=esimerkiksi txt -Comment[fr]=par exemple txt -Comment[fy]=bygelyks txt -Comment[ga]=mar shampla .txt -Comment[gl]=por exemplo txt -Comment[gu]=દાખલા તરીકે txt -Comment[he]=לדוגמא txt -Comment[hr]=na primjer txt -Comment[hu]=például txt -Comment[ia]=pro exemplo txt -Comment[id]=sebagai contoh txt -Comment[is]=til dæmis txt -Comment[it]=per esempio «txt» -Comment[ja]=例えば txt -Comment[kk]=мысалы txt -Comment[km]=ឧទាហរណ៍ txt -Comment[kn]=ಉದಾಹರಣೆಗೆ txt -Comment[ko]=예를 들어 txt -Comment[lt]=pavyzdžiui, txt -Comment[lv]=piemēram, txt -Comment[mk]=на пример „txt“ -Comment[ml]=ഉദാഹരണമായി ടിഎക്സ്‌ടി ഫയലുകള്‍ -Comment[ms]=sebagai contoh txt -Comment[nb]=for eksempel txt -Comment[nds]=as Bispill »txt« -Comment[nl]=bijvoorbeeld txt -Comment[nn]=for eksempel txt -Comment[pa]=ਉਦਾਹਰਨ ਟੈਕਸਟ ਲਈ -Comment[pl]=na przykład "txt" -Comment[pt]=por exemplo 'txt' -Comment[pt_BR]=por exemplo, 'txt' -Comment[ro]=de exemplu txt -Comment[ru]=например, txt -Comment[si]=උදාහරණ පෙළ -Comment[sk]=napríklad txt -Comment[sl]=na primer odt -Comment[sr]=На пример txt -Comment[sr@ijekavian]=На примјер txt -Comment[sr@ijekavianlatin]=Na primjer txt -Comment[sr@latin]=Na primer txt -Comment[sv]=till exempel txt -Comment[tg]=масалан txt -Comment[th]=ตัวอย่างเช่น txt -Comment[tr]=örneğin txt -Comment[uk]=наприклад, txt -Comment[wa]=txt, metans -Comment[x-test]=xxfor example txtxx -Comment[zh_CN]=例如 txt -Comment[zh_TW]=例如 txt -Completion=fileExtension: -Icon=preferences-desktop-filetype-association - -[dolphin rating] -#ctx: rating of nepomuk resources -Name=Rating -#NOTE "=" does not work here, ":" does -Comment=1 to 10, for example >=7 -Comment[bg]=от 1 до 10, например >=7 -Comment[bn]=1 থেকে 10, যেমন >=7 -Comment[ca]=1 a 10, per exemple >=7 -Comment[ca@valencia]=1 a 10, per exemple >=7 -Comment[cs]=1 až 10, např. >=7 -Comment[csb]=1 do 10, na przëmiôr >=7 -Comment[da]=1 til 10, f.eks. >=7 -Comment[de]=1 bis 10, zum Beispiel >=7 -Comment[el]=1 ως 10, για παράδειγμα >=7 -Comment[en_GB]=1 to 10, for example >=7 -Comment[eo]=1 ĝis 10, ekzemple >=7 -Comment[es]=1 a 10, por ejemplo >=7 -Comment[et]=1 kuni 10, näiteks 7 -Comment[eu]=1etik 10ra, adibidez >=7 -Comment[fi]=1 ... 10, esimerkiksi >=7 -Comment[fr]=De 1 à 10, par exemple >=7 -Comment[fy]=1 oant 10, lykas bygelyks >=7 -Comment[ga]=1 go dtí 10, mar shampla >=7 -Comment[gl]=do 1 ao 10, por exemplo >=7 -Comment[gu]=1 થી 10, દાખલા તરીકે >=7 -Comment[he]=עד 10, לדוגמא >= 7 1 -Comment[hi]=1 से 10, जैसे >=7 -Comment[hr]=1 do 10, na primjer >=7 -Comment[hu]=1-től 10-ig terjedhet, például >=7 -Comment[ia]=1 a 10, pro exemplo >=7 -Comment[id]=1 sampai 10, misalnya >=7 -Comment[is]=1 til 10, til dæmis >=7 -Comment[it]=da 1 a 10, per esempio >=7 -Comment[ja]=1 から 10、例えば >=7 -Comment[kk]=1-ден 10 дейін, мысалы >=7 -Comment[km]=១ ដល់ ១០ ឧទាហរណ៍ >=7 -Comment[kn]=೧ ರಿಂದ ೧೦, ಉದಾಹರಣೆಗೆ >= ೭ -Comment[ko]=1에서 10 사이, 예를 들어 >=7 -Comment[lt]=Nuo 1 iki 10, pvz., >=7 -Comment[lv]=1 līdz 10, piemēram >=7 -Comment[mk]=1 до 10, на пример >=7 -Comment[ml]=1 മുതല്‍ 10 വരെ, ഉദാഹരണതിനു് >= 7 -Comment[nb]=1 til 10, for eksempel >=7 -Comment[nds]=1 to 10, as Bispill >=7 -Comment[nl]=1 tot 10, bijvoorbeeld >=7 -Comment[nn]=1 til 10 – for eksempel >=7 -Comment[pl]=1 do 10, na przykład >= 7 -Comment[pt]=1 a 10, por exemplo >=7 -Comment[pt_BR]=1 a 10, por exemplo, >=7 -Comment[ro]=de la 1 la 10, de exemplu >=7 -Comment[ru]=от 1 до 10, например, >=7 -Comment[si]=1 සිට 10, උදාහරණය >=7 -Comment[sk]=Od 1 do 10, napríklad >=7 -Comment[sl]=od 1 do 10, na primer >= 7 -Comment[sr]=1 до 10, на пример >=7 -Comment[sr@ijekavian]=1 до 10, на примјер >=7 -Comment[sr@ijekavianlatin]=1 do 10, na primjer >=7 -Comment[sr@latin]=1 do 10, na primer >=7 -Comment[sv]=1 till 10, till exempel: >=7 -Comment[tg]=Аз 1 то 10, масалан >=7 -Comment[th]=ค่า 1 ถึง 10, ตัวอย่างเช่น >=7 -Comment[tr]=1'den 10'a kadar, örnek >=7 -Comment[uk]=Від 1 до 10, наприклад, >=7 -Comment[wa]=1 a 10, >=7, metans -Comment[x-test]=xx1 to 10, for example >=7xx -Comment[zh_CN]=1 到 10,例如 >=7 -Comment[zh_TW]=1 到 10,例如 >=7 -GenericName=Use <, <=, :, >= and >. -GenericName[bg]=Използвайте <, <=, :, >= и >. -GenericName[bn]=<, <=, :, >= এবং > ব্যবহার করুন। -GenericName[ca]=Utilitzeu <, <=, :, >= i >. -GenericName[ca@valencia]=Utilitzeu <, <=, :, >= i >. -GenericName[cs]=Použijte <, <=, :, >= a >. -GenericName[csb]=Brëkùjë <, <=, :, >= ë >. -GenericName[da]=Brug <, <=, :, >= og >. -GenericName[de]=Verwenden Sie <, <=, :, >= und >. -GenericName[el]=Χρήση <, <=, :, >= και >. -GenericName[en_GB]=Use <, <=, :, >= and >. -GenericName[eo]=Uzu <, <=, :, >= kaj >. -GenericName[es]=Use <, <=, :, >= y >. -GenericName[et]=Kasuta <, <=, :, >= ja >. -GenericName[eu]=Erabili <, <=, :, >= eta >. -GenericName[fi]=Käytä <, <=, :, >= ja >. -GenericName[fr]=Utilisez <, <=, :, >= et >. -GenericName[fy]=Brûk <, <=, :, >= en >. -GenericName[ga]=Úsáid <, <=, :, >= agus >. -GenericName[gl]=Empregue <, <=, :, >= e >. -GenericName[gu]=<, <=, :, >= અને > વાપરો. -GenericName[he]=השתמש ב: <, <=, :, >= and >. -GenericName[hi]=प्रयोग करें <, <=, :, >= और >. -GenericName[hr]=Koristite <, <=, :, >= i >. -GenericName[hu]=<, <=, :, >= és > műveletei jelek használhatók -GenericName[ia]=Tu usa <,<=,:,>=and>. -GenericName[id]=Gunakan <, <=, :, >= dan >. -GenericName[is]=Notaðu <, <=, :, >= og >. -GenericName[it]=Usa <, <=, :, >= e >. -GenericName[ja]=<, <=, :, >=, > を使用 -GenericName[kk]= <, <=, :, >=, > дегенді пайдаланыңыз. -GenericName[km]=ប្រើ <, <=, :, >= និង >. -GenericName[kn]=<, <=, :, >= ಹಾಗು > ಗಳನ್ನು ಬಳಸಿ. -GenericName[ko]=사용 가능한 연산자: <, <=, :, >=, > -GenericName[lt]=Naudoti <, <=, :, >= ir >. -GenericName[lv]=Lietojiet <, <=, :, >= un >. -GenericName[mk]=Корисетет <, <=, :, >= и >. -GenericName[ml]=<, <=, :, >=, > ഉം ഉപയോഗിയ്ക്കുക -GenericName[ms]=Guna <, <=, :, >= dan >. -GenericName[nb]=Bruk <, <=, :, >= and >. -GenericName[nds]=<, <=, :, >= un > bruken -GenericName[nl]=Gebruik <, <=, :, >= en >. -GenericName[nn]=Bruk <, <=, :, >= og >. -GenericName[pa]=<, <=, :, >= ਤੇ > ਵਰਤੋਂ। -GenericName[pl]=Można używać <,<=,:,>= oraz >. -GenericName[pt]=Use o <, <=, :, >= e o >. -GenericName[pt_BR]=Use o <, <=, :, >= e o >. -GenericName[ro]=Utilizați <, <=, :, >= și >. -GenericName[ru]=Используйте <, <=, :, >= и >. -GenericName[si]= <, <=, :, >= හා > භාවිත කරන්න. -GenericName[sk]=Použite <, <=, :, >= a >. -GenericName[sl]=Uporabite <, <=, :, >= in >. -GenericName[sr]=једно од <, <=, :, >= и > -GenericName[sr@ijekavian]=једно од <, <=, :, >= и > -GenericName[sr@ijekavianlatin]=jedno od <, <=, :, >= i > -GenericName[sr@latin]=jedno od <, <=, :, >= i > -GenericName[sv]=Använd <, <=, :, >= och >. -GenericName[tg]=<, <=, :, >= ва > истифода баред. -GenericName[th]=ใช้เครื่องหมาย <, <=, :, >= และ > -GenericName[tr]=<, <=, :, >= ve > kullanın. -GenericName[uk]=Використовуйте <, <=, :, >= і >. -GenericName[wa]=Eployîz <, <=, :, >= eyet >. -GenericName[x-test]=xxUse <, <=, :, >= and >.xx -GenericName[zh_CN]=使用 <、<=、:、>= 以及 > 符号。 -GenericName[zh_TW]=請使用 <, <=, :, >= 與 >。 -Completion=rating -Icon=favorites - -[dolphin tag] -#ctx: Tag as in Nepomuk::Tag", "Tag" -Name=Tag -Comment=Tag -Comment[bg]=Етикет -Comment[bn]=ট্যাগ -Comment[ca]=Etiqueta -Comment[ca@valencia]=Etiqueta -Comment[cs]=Značka -Comment[csb]=Znakòwnik -Comment[da]=Mærke -Comment[de]=Stichwort -Comment[el]=Ετικέτα -Comment[en_GB]=Tag -Comment[eo]=Marko -Comment[es]=Etiqueta -Comment[et]=Silt -Comment[eu]=Etiketa -Comment[fi]=Tunniste -Comment[fr]=Étiquette -Comment[fy]=Lebel -Comment[ga]=Clib -Comment[gl]=Etiqueta -Comment[gu]=ટેગ -Comment[he]=תגית -Comment[hi]=टैग -Comment[hr]=Oznaka -Comment[hu]=Címke -Comment[ia]=Etiquetta -Comment[id]=Tag -Comment[is]=Merki -Comment[it]=Etichetta -Comment[ja]=タグ -Comment[kk]=Тег -Comment[km]=ស្លាក -Comment[kn]=ಟ್ಯಾಗ್ -Comment[ko]=태그 -Comment[lt]=Žyma -Comment[lv]=Tags -Comment[mai]=टैग -Comment[mk]=Ознака -Comment[ml]=മുദ്ര -Comment[ms]=Tag -Comment[nb]=Merke -Comment[nds]=Slötelwoort -Comment[nl]=Tag -Comment[nn]=Merkelapp -Comment[pa]=ਟੈਗ -Comment[pl]=Znacznik -Comment[pt]=Marca -Comment[pt_BR]=Etiqueta -Comment[ro]=Marcaj -Comment[ru]=Метка -Comment[si]=ටැග -Comment[sk]=Značka -Comment[sl]=Oznaka -Comment[sr]=Ознака -Comment[sr@ijekavian]=Ознака -Comment[sr@ijekavianlatin]=Oznaka -Comment[sr@latin]=Oznaka -Comment[sv]=Etikett -Comment[tg]=Барчасп -Comment[th]=ป้ายกำกับ -Comment[tr]=Etiket -Comment[uk]=Мітка -Comment[wa]=Etikete -Comment[x-test]=xxTagxx -Comment[zh_CN]=标签 -Comment[zh_TW]=標籤 -Completion=tag: -Icon=mail-tagged - -[dolphin title] -#ctx: The title of a song etc. -Name=Title -Completion=title: - -[dolphin filesize] -Name=File size -Name[bg]=Големина на файла -Name[bn]=ফাইল-এর মাপ -Name[ca]=Mida del fitxer -Name[ca@valencia]=Mida del fitxer -Name[cs]=Velikost souboru -Name[csb]=Miara lopka -Name[da]=Filstørrelse -Name[de]=Dateigröße -Name[el]=Μέγεθος αρχείου -Name[en_GB]=File size -Name[eo]=Dosiergrandeco -Name[es]=Tamaño de archivo -Name[et]=Faili suurus -Name[eu]=Fitxategi neurria -Name[fi]=Tiedostokoko -Name[fr]=Taille du fichier -Name[fy]=Triemgrutte: -Name[ga]=Méid an chomhaid -Name[gl]=Tamaño do ficheiro -Name[gu]=ફાઇલ કદ -Name[he]=גודל קובץ -Name[hi]=फ़ाईल आकार -Name[hr]=Veličina datoteke -Name[hu]=Fájlméret -Name[ia]=Dimension de file -Name[id]=Ukuran berkas -Name[is]=Skráarstærð -Name[it]=Dimensione dei file -Name[ja]=ファイルサイズ -Name[kk]=Файл өлшемі -Name[km]=ទំហំ​ឯកសារ -Name[kn]=ಕಡತದ ಗಾತ್ರ -Name[ko]=파일 크기 -Name[lt]=Failo dydis -Name[lv]=Faila nosaukums -Name[mai]=फाइल पूर्वावलोकन -Name[mk]=Големина на датотека -Name[ml]=ഫയലിന്റെ വലിപ്പം -Name[ms]=Saiz fail -Name[nb]=Filstørrelse -Name[nds]=Dateigrött -Name[nl]=Bestandsgrootte -Name[nn]=Filstorleik -Name[pa]=ਫਾਇਲ ਸਾਈਜ਼ -Name[pl]=Rozmiar pliku -Name[pt]=Tamanho do ficheiro -Name[pt_BR]=Tamanho do arquivo -Name[ro]=Dimensiune fișier -Name[ru]=Размер файла -Name[si]=ගොනු ප්‍රමාණය -Name[sk]=Veľkosť súboru -Name[sl]=Velikost datoteke -Name[sr]=величина фајла -Name[sr@ijekavian]=величина фајла -Name[sr@ijekavianlatin]=veličina fajla -Name[sr@latin]=veličina fajla -Name[sv]=Filstorlek -Name[tg]=Андозаи файл -Name[th]=ขนาดแฟ้ม -Name[tr]=Dosya boyutu -Name[uk]=Розмір файла -Name[wa]=Grandeu do fitchî -Name[x-test]=xxFile sizexx -Name[zh_CN]=文件大小 -Name[zh_TW]=檔案大小 -Comment=in bytes, for example >1000 -Comment[bg]=в байтове, например >1000 -Comment[bn]=বাইট-এ, যেমন >1000 -Comment[ca]=en bytes, per exemple >1000 -Comment[ca@valencia]=en bytes, per exemple >1000 -Comment[cs]=v bytech, například >1000 -Comment[csb]=w bajtach, na przëmiôr >1000 -Comment[da]=i bytes, f.eks. >1000 -Comment[de]=In Byte, zum Beispiel >1000 -Comment[el]=σε bytes, για παράδειγμα >1000 -Comment[en_GB]=in bytes, for example >1000 -Comment[eo]=bajte, ekz. >1000 -Comment[es]=en bytes, por ejemplo >1000 -Comment[et]=baitides, näiteks >1000 -Comment[eu]=bytetan, adibidez >1000 -Comment[fi]=tavuissa, esimerkiksi >1000 -Comment[fr]=en octets, par exemple >1000 -Comment[fy]=Yn bytes, lykas bygelyks > 1000 -Comment[ga]=bearta, mar shampla >1000 -Comment[gl]=en bytes, por exemplo >1000 -Comment[he]=בבתים, לדוגמא > 1000 -Comment[hr]=u bajtovima, na primjer >1000 -Comment[hu]=bájtban számolva, például >1000 -Comment[ia]=in bytes, pro exemplo > 1000 -Comment[id]=dalam bita, misalnya >1000 -Comment[is]=í bætum, til dæmis >1000 -Comment[it]=in byte, per esempio >1000 -Comment[ja]=バイト単位、例えば >1000 -Comment[kk]=байт, мысалы >1000 -Comment[km]=គិតជា​បៃ ឧទាហរណ៍ >1000 -Comment[kn]=ಬೈಟ್‌ಗಳಲ್ಲಿ, ಉದಾಹರಣೆಗೆ >೧೦೦೦ -Comment[ko]=바이트 단위, 예를 들어 >1000 -Comment[lt]=baitais, pvz., > 1000 -Comment[lv]=baitos, piemēram >1000 -Comment[mk]=во бајти, на пример >1000 -Comment[ml]=ബൈറ്റുകളില്‍, ഉദാഹരണത്തിനു് >1000 -Comment[nb]=i byte, for eksempel >1000 -Comment[nds]=in Bytes, as Bispill >1000 -Comment[nl]=in bytes, bijvoorbeeld >1000 -Comment[nn]=i byte – for eksempel >1000 -Comment[pl]=w bajtach, na przykład > 1000 -Comment[pt]=em 'bytes', por exemplo > 1000 -Comment[pt_BR]=em bytes, por exemplo, > 1000 -Comment[ro]=în octeți, de exemplu >1000 -Comment[ru]=в байтах, например, >1000 -Comment[si]=බයිට් මඟින්, උදා >1000 -Comment[sk]=v bajtoch, napríklad >1000 -Comment[sl]=v bajtih, na primer >1000 -Comment[sr]=У бајтовима, на пример >1000 -Comment[sr@ijekavian]=У бајтовима, на примјер >1000 -Comment[sr@ijekavianlatin]=U bajtovima, na primjer >1000 -Comment[sr@latin]=U bajtovima, na primer >1000 -Comment[sv]=i byte, till exempel > 1000 -Comment[tg]=дар байтҳо, масалан >1000 -Comment[th]=หน่วยเป็นไบต์ ตัวอย่างเช่น >1000 -Comment[tr]=bayt olarak, örnek >1000 -Comment[uk]=у байтах, наприклад, >1000 -Comment[wa]=e bites, >1000, metans -Comment[x-test]=xxin bytes, for example >1000xx -Comment[zh_CN]=单位为字节,例如 >1000 -Comment[zh_TW]=單位為位元,例如 >1000 -GenericName=Use <, <=, :, >= and >. -GenericName[bg]=Използвайте <, <=, :, >= и >. -GenericName[bn]=<, <=, :, >= এবং > ব্যবহার করুন। -GenericName[ca]=Utilitzeu <, <=, :, >= i >. -GenericName[ca@valencia]=Utilitzeu <, <=, :, >= i >. -GenericName[cs]=Použijte <, <=, :, >= a >. -GenericName[csb]=Brëkùjë <, <=, :, >= ë >. -GenericName[da]=Brug <, <=, :, >= og >. -GenericName[de]=Verwenden Sie <, <=, :, >= und >. -GenericName[el]=Χρήση <, <=, :, >= και >. -GenericName[en_GB]=Use <, <=, :, >= and >. -GenericName[eo]=Uzu <, <=, :, >= kaj >. -GenericName[es]=Use <, <=, :, >= y >. -GenericName[et]=Kasuta <, <=, :, >= ja >. -GenericName[eu]=Erabili <, <=, :, >= eta >. -GenericName[fi]=Käytä <, <=, :, >= ja >. -GenericName[fr]=Utilisez <, <=, :, >= et >. -GenericName[fy]=Brûk <, <=, :, >= en >. -GenericName[ga]=Úsáid <, <=, :, >= agus >. -GenericName[gl]=Empregue <, <=, :, >= e >. -GenericName[gu]=<, <=, :, >= અને > વાપરો. -GenericName[he]=השתמש ב: <, <=, :, >= and >. -GenericName[hi]=प्रयोग करें <, <=, :, >= और >. -GenericName[hr]=Koristite <, <=, :, >= i >. -GenericName[hu]=<, <=, :, >= és > műveletei jelek használhatók -GenericName[ia]=Tu usa <,<=,:,>=and>. -GenericName[id]=Gunakan <, <=, :, >= dan >. -GenericName[is]=Notaðu <, <=, :, >= og >. -GenericName[it]=Usa <, <=, :, >= e >. -GenericName[ja]=<, <=, :, >=, > を使用 -GenericName[kk]= <, <=, :, >=, > дегенді пайдаланыңыз. -GenericName[km]=ប្រើ <, <=, :, >= និង >. -GenericName[kn]=<, <=, :, >= ಹಾಗು > ಗಳನ್ನು ಬಳಸಿ. -GenericName[ko]=사용 가능한 연산자: <, <=, :, >=, > -GenericName[lt]=Naudoti <, <=, :, >= ir >. -GenericName[lv]=Lietojiet <, <=, :, >= un >. -GenericName[mk]=Корисетет <, <=, :, >= и >. -GenericName[ml]=<, <=, :, >=, > ഉം ഉപയോഗിയ്ക്കുക -GenericName[ms]=Guna <, <=, :, >= dan >. -GenericName[nb]=Bruk <, <=, :, >= and >. -GenericName[nds]=<, <=, :, >= un > bruken -GenericName[nl]=Gebruik <, <=, :, >= en >. -GenericName[nn]=Bruk <, <=, :, >= og >. -GenericName[pa]=<, <=, :, >= ਤੇ > ਵਰਤੋਂ। -GenericName[pl]=Można używać <,<=,:,>= oraz >. -GenericName[pt]=Use o <, <=, :, >= e o >. -GenericName[pt_BR]=Use o <, <=, :, >= e o >. -GenericName[ro]=Utilizați <, <=, :, >= și >. -GenericName[ru]=Используйте <, <=, :, >= и >. -GenericName[si]= <, <=, :, >= හා > භාවිත කරන්න. -GenericName[sk]=Použite <, <=, :, >= a >. -GenericName[sl]=Uporabite <, <=, :, >= in >. -GenericName[sr]=једно од <, <=, :, >= и > -GenericName[sr@ijekavian]=једно од <, <=, :, >= и > -GenericName[sr@ijekavianlatin]=jedno od <, <=, :, >= i > -GenericName[sr@latin]=jedno od <, <=, :, >= i > -GenericName[sv]=Använd <, <=, :, >= och >. -GenericName[tg]=<, <=, :, >= ва > истифода баред. -GenericName[th]=ใช้เครื่องหมาย <, <=, :, >= และ > -GenericName[tr]=<, <=, :, >= ve > kullanın. -GenericName[uk]=Використовуйте <, <=, :, >= і >. -GenericName[wa]=Eployîz <, <=, :, >= eyet >. -GenericName[x-test]=xxUse <, <=, :, >= and >.xx -GenericName[zh_CN]=使用 <、<=、:、>= 以及 > 符号。 -GenericName[zh_TW]=請使用 <, <=, :, >= 與 >。 -Completion=contentSize - -[dolphin contentsize] -Name=Content size -Name[bg]=Големина на съдържанието -Name[bn]=বিষয়বস্তুর মাপ -Name[ca]=Mida del contingut -Name[ca@valencia]=Mida del contingut -Name[cs]=Velikost obsahu -Name[csb]=Miara zamkłoscë -Name[da]=Indholdsstørrelse -Name[de]=Größe des Inhalts -Name[el]=Μέγεθος περιεχόμενου -Name[en_GB]=Content size -Name[eo]=Grandeco de la enhavo -Name[es]=Tamaño del contenido -Name[et]=Sisu suurus -Name[eu]=Edukiaren neurria -Name[fi]=Sisältökoko -Name[fr]=Taille du contenu -Name[fy]=Ynhâld grutte -Name[ga]=Méid an inneachair -Name[gl]=Tamaño do contido -Name[gu]=વિગત કદ -Name[he]=גודל התוכן -Name[hr]=Veličina sadržaja -Name[hu]=Tartalomméret -Name[ia]=Dimension de contento -Name[id]=Ukuran isi -Name[is]=Stærð innihalds -Name[it]=Dimensioni del contenuto -Name[ja]=コンテンツのサイズ -Name[kk]=Мазмұнның өлшемі -Name[km]=ទំហំ​មាតិកា -Name[kn]=ವಿಷಯದ ಗಾತ್ರ -Name[ko]=내용 크기 -Name[lt]=Turinio dydis -Name[lv]=Satura izmērs -Name[mk]=Големина на содржина -Name[ml]=ഉള്ളടക്കത്തിന്റെ വലിപ്പം -Name[ms]=Saiz isi -Name[nb]=Innholdsstørrelse -Name[nds]=Inholtgrött -Name[nl]=Grootte van de inhoud -Name[nn]=Innhaldsstorleik -Name[pa]=ਸਮੱਗਰੀ ਸਾਈਜ਼ -Name[pl]=Rozmiar treści -Name[pt]=Tamanho do conteúdo -Name[pt_BR]=Tamanho do conteúdo -Name[ro]=Dimensiune conținut -Name[ru]=Размер содержимого -Name[si]=අන්තර්ගත ප්‍රමාණය -Name[sk]=Veľkosť obsahu -Name[sl]=Velikost vsebine -Name[sr]=величина садржаја -Name[sr@ijekavian]=величина садржаја -Name[sr@ijekavianlatin]=veličina sadržaja -Name[sr@latin]=veličina sadržaja -Name[sv]=Innehållets storlek -Name[tg]=Андозаи мазмун -Name[th]=ขนาดเนื้อหา -Name[tr]=İçerik boyutu -Name[uk]=Розмір вмісту -Name[wa]=Grandeu di l' ådvins -Name[x-test]=xxContent sizexx -Name[zh_CN]=内容大小 -Name[zh_TW]=內容大小 -Comment=in bytes -Comment[bg]=в байтове -Comment[bn]=বাইট-এ -Comment[ca]=en bytes -Comment[ca@valencia]=en bytes -Comment[cs]=v bajtech -Comment[csb]=w bajtach -Comment[da]=i bytes -Comment[de]=in Byte -Comment[el]=σε bytes -Comment[en_GB]=in bytes -Comment[eo]=bitoke -Comment[es]=en bytes -Comment[et]=baitides -Comment[eu]=bytetan -Comment[fi]=tavuissa -Comment[fr]=en octets -Comment[fy]=yn bytes -Comment[ga]=bearta -Comment[gl]=en bytes -Comment[gu]=બાઈટ્સ માં -Comment[he]=בבתים -Comment[hi]=बायटों में -Comment[hr]=u bajtovima -Comment[hu]=bájtban -Comment[ia]=in bytes -Comment[id]=dalam bita -Comment[is]=í bætum -Comment[it]=in byte -Comment[ja]=バイト単位 -Comment[kk]=байт -Comment[km]=គិត​ជា​បៃ -Comment[kn]=ಬೈಟ್‌ಗಳಲ್ಲಿ -Comment[ko]=바이트 단위 -Comment[lt]=baitais -Comment[lv]=baitos -Comment[mk]=во бајти -Comment[ml]=ബൈറ്റുകളില്‍ -Comment[ms]=dalam bait -Comment[nb]=i byte -Comment[nds]=in Bytes -Comment[nl]=in bytes -Comment[nn]=i byte -Comment[pa]=ਬਾਈਟ ਵਿੱਚ -Comment[pl]=w bajtach -Comment[pt]=em 'bytes' -Comment[pt_BR]=em bytes -Comment[ro]=în octeți -Comment[ru]=в байтах -Comment[si]=බයිට් මගින් -Comment[sk]=v bajtoch -Comment[sl]=v bajtih -Comment[sr]=У бајтовима -Comment[sr@ijekavian]=У бајтовима -Comment[sr@ijekavianlatin]=U bajtovima -Comment[sr@latin]=U bajtovima -Comment[sv]=i byte -Comment[tg]=дар байтҳо -Comment[th]=หน่วยเป็นไบต์ -Comment[tr]=bayt olarak -Comment[uk]=у байтах -Comment[wa]=e bites -Comment[x-test]=xxin bytesxx -Comment[zh_CN]=单位为字节 -Comment[zh_TW]=單位為位元 -GenericName=Use <, <=, :, >= and >. -GenericName[bg]=Използвайте <, <=, :, >= и >. -GenericName[bn]=<, <=, :, >= এবং > ব্যবহার করুন। -GenericName[ca]=Utilitzeu <, <=, :, >= i >. -GenericName[ca@valencia]=Utilitzeu <, <=, :, >= i >. -GenericName[cs]=Použijte <, <=, :, >= a >. -GenericName[csb]=Brëkùjë <, <=, :, >= ë >. -GenericName[da]=Brug <, <=, :, >= og >. -GenericName[de]=Verwenden Sie <, <=, :, >= und >. -GenericName[el]=Χρήση <, <=, :, >= και >. -GenericName[en_GB]=Use <, <=, :, >= and >. -GenericName[eo]=Uzu <, <=, :, >= kaj >. -GenericName[es]=Use <, <=, :, >= y >. -GenericName[et]=Kasuta <, <=, :, >= ja >. -GenericName[eu]=Erabili <, <=, :, >= eta >. -GenericName[fi]=Käytä <, <=, :, >= ja >. -GenericName[fr]=Utilisez <, <=, :, >= et >. -GenericName[fy]=Brûk <, <=, :, >= en >. -GenericName[ga]=Úsáid <, <=, :, >= agus >. -GenericName[gl]=Empregue <, <=, :, >= e >. -GenericName[gu]=<, <=, :, >= અને > વાપરો. -GenericName[he]=השתמש ב: <, <=, :, >= and >. -GenericName[hi]=प्रयोग करें <, <=, :, >= और >. -GenericName[hr]=Koristite <, <=, :, >= i >. -GenericName[hu]=<, <=, :, >= és > műveletei jelek használhatók -GenericName[ia]=Tu usa <,<=,:,>=and>. -GenericName[id]=Gunakan <, <=, :, >= dan >. -GenericName[is]=Notaðu <, <=, :, >= og >. -GenericName[it]=Usa <, <=, :, >= e >. -GenericName[ja]=<, <=, :, >=, > を使用 -GenericName[kk]= <, <=, :, >=, > дегенді пайдаланыңыз. -GenericName[km]=ប្រើ <, <=, :, >= និង >. -GenericName[kn]=<, <=, :, >= ಹಾಗು > ಗಳನ್ನು ಬಳಸಿ. -GenericName[ko]=사용 가능한 연산자: <, <=, :, >=, > -GenericName[lt]=Naudoti <, <=, :, >= ir >. -GenericName[lv]=Lietojiet <, <=, :, >= un >. -GenericName[mk]=Корисетет <, <=, :, >= и >. -GenericName[ml]=<, <=, :, >=, > ഉം ഉപയോഗിയ്ക്കുക -GenericName[ms]=Guna <, <=, :, >= dan >. -GenericName[nb]=Bruk <, <=, :, >= and >. -GenericName[nds]=<, <=, :, >= un > bruken -GenericName[nl]=Gebruik <, <=, :, >= en >. -GenericName[nn]=Bruk <, <=, :, >= og >. -GenericName[pa]=<, <=, :, >= ਤੇ > ਵਰਤੋਂ। -GenericName[pl]=Można używać <,<=,:,>= oraz >. -GenericName[pt]=Use o <, <=, :, >= e o >. -GenericName[pt_BR]=Use o <, <=, :, >= e o >. -GenericName[ro]=Utilizați <, <=, :, >= și >. -GenericName[ru]=Используйте <, <=, :, >= и >. -GenericName[si]= <, <=, :, >= හා > භාවිත කරන්න. -GenericName[sk]=Použite <, <=, :, >= a >. -GenericName[sl]=Uporabite <, <=, :, >= in >. -GenericName[sr]=једно од <, <=, :, >= и > -GenericName[sr@ijekavian]=једно од <, <=, :, >= и > -GenericName[sr@ijekavianlatin]=jedno od <, <=, :, >= i > -GenericName[sr@latin]=jedno od <, <=, :, >= i > -GenericName[sv]=Använd <, <=, :, >= och >. -GenericName[tg]=<, <=, :, >= ва > истифода баред. -GenericName[th]=ใช้เครื่องหมาย <, <=, :, >= และ > -GenericName[tr]=<, <=, :, >= ve > kullanın. -GenericName[uk]=Використовуйте <, <=, :, >= і >. -GenericName[wa]=Eployîz <, <=, :, >= eyet >. -GenericName[x-test]=xxUse <, <=, :, >= and >.xx -GenericName[zh_CN]=使用 <、<=、:、>= 以及 > 符号。 -GenericName[zh_TW]=請使用 <, <=, :, >= 與 >。 -Completion=contentSize - -[dolphin lastmodified] -#ctx: When the resource was last modified -Name=Last modified -Comment=for example >1999-10-10 -Comment[bg]=например >1999-10-10 -Comment[bn]=যেমন >1999-10-10 -Comment[ca]=per exemple >1999-10-10 -Comment[ca@valencia]=per exemple >1999-10-10 -Comment[cs]=například >1999-10-10 -Comment[csb]=na przëmiôr >1999-10-10 -Comment[da]=for eksempel >1999-10-10 -Comment[de]=zum Beispiel >1999-10-10 -Comment[el]=για παράδειγμα >1999-10-10 -Comment[en_GB]=for example >1999-10-10 -Comment[eo]=Ekzemple >1999-10-10 -Comment[es]= por ejemplo >1999-10-10 -Comment[et]=näiteks >1999-10-10 -Comment[eu]=adibidez >1999-10-10 -Comment[fi]=esimerkiksi >1999-10-10 -Comment[fr]=par exemple >1999-10-10 -Comment[fy]=lykas bygelyks > 1999-10-10 -Comment[ga]=mar shampla >1999-10-10 -Comment[gl]=por exemplo >1999-10-10 -Comment[gu]=દાખલા તરીકે >1999-10-10 -Comment[he]=לדוגמא > 1999-10-10 -Comment[hr]=na primjer >1999-10-10 -Comment[hu]=például >1999-10-10 -Comment[ia]=pro exemplo > 1999-10-10 -Comment[id]=misalnya >1999-10-10 -Comment[is]=til dæmis >1999-10-10 -Comment[it]=per esempio >1999-10-10 -Comment[ja]=例えば >1999-10-10 -Comment[kk]=мысалы >1999-10-10 -Comment[km]=ឧទាហរណ៍ >1999-10-10 -Comment[kn]=ಉದಾಹರಣೆಗೆ >೧೯೯೯-೧೦-೧೦ -Comment[ko]=예를 들어 >1999-10-10 -Comment[lt]=pavyzdžiui >1999-10-10 -Comment[lv]=piemēram >1999-10-10 -Comment[mk]=на пример >1999-10-10 -Comment[ml]=ഉദാഹരണത്തിനു് >1990-10-10 -Comment[nb]=for eksempel >1999-10-10 -Comment[nds]=as Bispill >23.10.1999 -Comment[nl]=bijvoorbeeld >2009-10-10 -Comment[nn]=for eksempel >1999-10-10 -Comment[pl]=na przykład: > 1999-10-10 -Comment[pt]=por exemplo > 1999-10-10 -Comment[pt_BR]=por exemplo, > 1999-10-10 -Comment[ro]=de exemplu >1999-10-10 -Comment[ru]=например, > -Comment[si]=උදා >1999-10-10 -Comment[sk]=napríklad >1999-10-10 -Comment[sl]=na primer >1990-12-26 -Comment[sr]=На пример >1999-10-10 -Comment[sr@ijekavian]=На примјер >1999-10-10 -Comment[sr@ijekavianlatin]=Na primjer >1999-10-10 -Comment[sr@latin]=Na primer >1999-10-10 -Comment[sv]=till exempel > 1999-10-10 -Comment[tg]=масалан >1999-10-10 -Comment[th]=ตัวอย่างเช่น >1999-10-10 -Comment[tr]=örnek >1999-10-10 -Comment[uk]=наприклад, >1999-10-10 -Comment[wa]=>1999-10-10, metans -Comment[x-test]=xxfor example >1999-10-10xx -Comment[zh_CN]=例如 >1999-10-10 -Comment[zh_TW]=例如 >1999-10-10 -GenericName=Use <, <=, :, >= and >. -GenericName[bg]=Използвайте <, <=, :, >= и >. -GenericName[bn]=<, <=, :, >= এবং > ব্যবহার করুন। -GenericName[ca]=Utilitzeu <, <=, :, >= i >. -GenericName[ca@valencia]=Utilitzeu <, <=, :, >= i >. -GenericName[cs]=Použijte <, <=, :, >= a >. -GenericName[csb]=Brëkùjë <, <=, :, >= ë >. -GenericName[da]=Brug <, <=, :, >= og >. -GenericName[de]=Verwenden Sie <, <=, :, >= und >. -GenericName[el]=Χρήση <, <=, :, >= και >. -GenericName[en_GB]=Use <, <=, :, >= and >. -GenericName[eo]=Uzu <, <=, :, >= kaj >. -GenericName[es]=Use <, <=, :, >= y >. -GenericName[et]=Kasuta <, <=, :, >= ja >. -GenericName[eu]=Erabili <, <=, :, >= eta >. -GenericName[fi]=Käytä <, <=, :, >= ja >. -GenericName[fr]=Utilisez <, <=, :, >= et >. -GenericName[fy]=Brûk <, <=, :, >= en >. -GenericName[ga]=Úsáid <, <=, :, >= agus >. -GenericName[gl]=Empregue <, <=, :, >= e >. -GenericName[gu]=<, <=, :, >= અને > વાપરો. -GenericName[he]=השתמש ב: <, <=, :, >= and >. -GenericName[hi]=प्रयोग करें <, <=, :, >= और >. -GenericName[hr]=Koristite <, <=, :, >= i >. -GenericName[hu]=<, <=, :, >= és > műveletei jelek használhatók -GenericName[ia]=Tu usa <,<=,:,>=and>. -GenericName[id]=Gunakan <, <=, :, >= dan >. -GenericName[is]=Notaðu <, <=, :, >= og >. -GenericName[it]=Usa <, <=, :, >= e >. -GenericName[ja]=<, <=, :, >=, > を使用 -GenericName[kk]= <, <=, :, >=, > дегенді пайдаланыңыз. -GenericName[km]=ប្រើ <, <=, :, >= និង >. -GenericName[kn]=<, <=, :, >= ಹಾಗು > ಗಳನ್ನು ಬಳಸಿ. -GenericName[ko]=사용 가능한 연산자: <, <=, :, >=, > -GenericName[lt]=Naudoti <, <=, :, >= ir >. -GenericName[lv]=Lietojiet <, <=, :, >= un >. -GenericName[mk]=Корисетет <, <=, :, >= и >. -GenericName[ml]=<, <=, :, >=, > ഉം ഉപയോഗിയ്ക്കുക -GenericName[ms]=Guna <, <=, :, >= dan >. -GenericName[nb]=Bruk <, <=, :, >= and >. -GenericName[nds]=<, <=, :, >= un > bruken -GenericName[nl]=Gebruik <, <=, :, >= en >. -GenericName[nn]=Bruk <, <=, :, >= og >. -GenericName[pa]=<, <=, :, >= ਤੇ > ਵਰਤੋਂ। -GenericName[pl]=Można używać <,<=,:,>= oraz >. -GenericName[pt]=Use o <, <=, :, >= e o >. -GenericName[pt_BR]=Use o <, <=, :, >= e o >. -GenericName[ro]=Utilizați <, <=, :, >= și >. -GenericName[ru]=Используйте <, <=, :, >= и >. -GenericName[si]= <, <=, :, >= හා > භාවිත කරන්න. -GenericName[sk]=Použite <, <=, :, >= a >. -GenericName[sl]=Uporabite <, <=, :, >= in >. -GenericName[sr]=једно од <, <=, :, >= и > -GenericName[sr@ijekavian]=једно од <, <=, :, >= и > -GenericName[sr@ijekavianlatin]=jedno od <, <=, :, >= i > -GenericName[sr@latin]=jedno od <, <=, :, >= i > -GenericName[sv]=Använd <, <=, :, >= och >. -GenericName[tg]=<, <=, :, >= ва > истифода баред. -GenericName[th]=ใช้เครื่องหมาย <, <=, :, >= และ > -GenericName[tr]=<, <=, :, >= ve > kullanın. -GenericName[uk]=Використовуйте <, <=, :, >= і >. -GenericName[wa]=Eployîz <, <=, :, >= eyet >. -GenericName[x-test]=xxUse <, <=, :, >= and >.xx -GenericName[zh_CN]=使用 <、<=、:、>= 以及 > 符号。 -GenericName[zh_TW]=請使用 <, <=, :, >= 與 >。 -Completion=lastModified diff --git a/src/search/dolphinsearchoptionsconfigurator.cpp b/src/search/dolphinsearchoptionsconfigurator.cpp deleted file mode 100644 index e51ab8c64..000000000 --- a/src/search/dolphinsearchoptionsconfigurator.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "dolphinsearchoptionsconfigurator.h" - -#include "dolphin_searchsettings.h" -#include - -#define DISABLE_NEPOMUK_LEGACY -#include -#include -#include -#include -#include -#include - -#include "nfo.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "searchcriterionselector.h" -#include "searchoptiondialogbox.h" - -#include -#include -#include -#include -#include -#include - -struct SettingsItem -{ - const char* settingsName; - const char* text; -}; - -// Contains the settings names and translated texts -// for each item of the location-combo-box. -static const SettingsItem g_locationItems[] = { - {"Everywhere", I18N_NOOP2("@label", "Everywhere")}, - {"From Here", I18N_NOOP2("@label", "From Here")} -}; - -// Contains the settings names and translated texts -// for each item of the what-combobox. -static const SettingsItem g_whatItems[] = { - {"All", I18N_NOOP2("@label", "All")}, - {"Images", I18N_NOOP2("@label", "Images")}, - {"Text", I18N_NOOP2("@label", "Text")}, - {"Filenames", I18N_NOOP2("@label", "Filenames")} -}; - -struct CriterionItem -{ - const char* settingsName; - SearchCriterionSelector::Type type; -}; - -// Contains the settings names for type -// of availabe search criterion. -static const CriterionItem g_criterionItems[] = { - {"Date", SearchCriterionSelector::Date}, - {"Size", SearchCriterionSelector::Size}, - {"Tag", SearchCriterionSelector::Tag}, - {"Rating", SearchCriterionSelector::Rating} -}; - -DolphinSearchOptionsConfigurator::DolphinSearchOptionsConfigurator(QWidget* parent) : - QWidget(parent), - m_initialized(false), - m_directory(), - m_locationBox(0), - m_whatBox(0), - m_addSelectorButton(0), - m_searchButton(0), - m_saveButton(0), - m_vBoxLayout(0), - m_criteria(), - m_customSearchQuery() -{ - m_vBoxLayout = new QVBoxLayout(this); - - // add "search" configuration - QLabel* searchLabel = new QLabel(i18nc("@label", "Search:")); - - m_locationBox = new KComboBox(this); - for (unsigned int i = 0; i < sizeof(g_locationItems) / sizeof(SettingsItem); ++i) { - m_locationBox->addItem(i18nc("@label", g_locationItems[i].text)); - } - - // add "what" configuration - QLabel* whatLabel = new QLabel(i18nc("@label", "What:")); - - m_whatBox = new KComboBox(this); - for (unsigned int i = 0; i < sizeof(g_whatItems) / sizeof(SettingsItem); ++i) { - m_whatBox->addItem(i18nc("@label", g_whatItems[i].text)); - } - connect(m_whatBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateButtons())); - - // add "Add selector" button - m_addSelectorButton = new QPushButton(this); - m_addSelectorButton->setIcon(KIcon("list-add")); - m_addSelectorButton->setToolTip(i18nc("@info", "Add search option")); - m_addSelectorButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - connect(m_addSelectorButton, SIGNAL(clicked()), this, SLOT(slotAddSelectorButtonClicked())); - - // add button "Search" - m_searchButton = new QPushButton(this); - m_searchButton->setIcon(KIcon("edit-find")); - m_searchButton->setText(i18nc("@action:button", "Search")); - m_searchButton->setToolTip(i18nc("@info", "Start searching")); - m_searchButton->setEnabled(false); - connect(m_searchButton, SIGNAL(clicked()), this, SIGNAL(searchOptionsChanged())); - - // add button "Save" - m_saveButton = new QPushButton(this); - m_saveButton->setIcon(KIcon("document-save")); - m_saveButton->setText(i18nc("@action:button", "Save")); - m_saveButton->setToolTip(i18nc("@info", "Save search options")); - m_saveButton->setEnabled(false); - connect(m_saveButton, SIGNAL(clicked()), this, SLOT(saveQuery())); - - // add button "Close" - QPushButton* closeButton = new QPushButton(this); - closeButton->setIcon(KIcon("dialog-close")); - closeButton->setText(i18nc("@action:button", "Close")); - closeButton->setToolTip(i18nc("@info", "Close search options")); - connect(closeButton, SIGNAL(clicked()), this, SLOT(hide())); - - QHBoxLayout* topLineLayout = new QHBoxLayout(); - topLineLayout->addWidget(m_addSelectorButton); - topLineLayout->addWidget(searchLabel); - topLineLayout->addWidget(m_locationBox); - topLineLayout->addWidget(whatLabel); - topLineLayout->addWidget(m_whatBox); - topLineLayout->addWidget(new QWidget(this), 1); // filler - topLineLayout->addWidget(m_searchButton); - topLineLayout->addWidget(m_saveButton); - topLineLayout->addWidget(closeButton); - - m_vBoxLayout->addWidget(new KSeparator(this)); - m_vBoxLayout->addLayout(topLineLayout); - m_vBoxLayout->addWidget(new KSeparator(this)); -} - -DolphinSearchOptionsConfigurator::~DolphinSearchOptionsConfigurator() -{ - // store the UI configuration - const int locationIndex = m_locationBox->currentIndex(); - SearchSettings::setLocation(g_locationItems[locationIndex].settingsName); - - const int whatIndex = m_whatBox->currentIndex(); - SearchSettings::setWhat(g_whatItems[whatIndex].settingsName); - - QString criteriaString; - foreach(const SearchCriterionSelector* criterion, m_criteria) { - if (!criteriaString.isEmpty()) { - criteriaString += ','; - } - const int index = static_cast(criterion->type()); - criteriaString += g_criterionItems[index].settingsName; - } - SearchSettings::setCriteria(criteriaString); - - SearchSettings::self()->writeConfig(); -} - -QString DolphinSearchOptionsConfigurator::customSearchQuery() const -{ - return m_customSearchQuery; -} - - -KUrl DolphinSearchOptionsConfigurator::directory() const -{ - return m_directory; -} - -KUrl DolphinSearchOptionsConfigurator::nepomukSearchUrl() const -{ - const Nepomuk::Query::Query query = nepomukQuery(); - if ( query.isValid() ) { - return query.toSearchUrl( i18nc( "@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.", - "Query Results from '%1'", - customSearchQuery() ) ); - } - else { - return KUrl(); - } -} - -void DolphinSearchOptionsConfigurator::setCustomSearchQuery(const QString& searchQuery) -{ - m_customSearchQuery = searchQuery.simplified(); - updateButtons(); -} - -void DolphinSearchOptionsConfigurator::setDirectory(const KUrl& dir) -{ - if (dir.protocol() != QString::fromLatin1("nepomuksearch")) { - m_directory = dir; - } -} - -void DolphinSearchOptionsConfigurator::showEvent(QShowEvent* event) -{ - if (!event->spontaneous() && !m_initialized) { - // restore the UI layout of the last session - const QString location = SearchSettings::location(); - for (unsigned int i = 0; i < sizeof(g_locationItems) / sizeof(SettingsItem); ++i) { - if (g_locationItems[i].settingsName == location) { - m_locationBox->setCurrentIndex(i); - break; - } - } - - const QString what = SearchSettings::what(); - for (unsigned int i = 0; i < sizeof(g_whatItems) / sizeof(SettingsItem); ++i) { - if (g_whatItems[i].settingsName == what) { - m_whatBox->setCurrentIndex(i); - break; - } - } - - const QString criteria = SearchSettings::criteria(); - QStringList criteriaList = criteria.split(','); - foreach (const QString& criterionName, criteriaList) { - for (unsigned int i = 0; i < sizeof(g_criterionItems) / sizeof(CriterionItem); ++i) { - if (g_criterionItems[i].settingsName == criterionName) { - const SearchCriterionSelector::Type type = g_criterionItems[i].type; - addCriterion(new SearchCriterionSelector(type, this)); - break; - } - } - } - - m_initialized = true; - } - QWidget::showEvent(event); -} - -void DolphinSearchOptionsConfigurator::slotAddSelectorButtonClicked() -{ - SearchCriterionSelector* selector = new SearchCriterionSelector(SearchCriterionSelector::Date, this); - addCriterion(selector); -} - -void DolphinSearchOptionsConfigurator::removeCriterion() -{ - SearchCriterionSelector* criterion = qobject_cast(sender()); - Q_ASSERT(criterion != 0); - m_vBoxLayout->removeWidget(criterion); - - const int index = m_criteria.indexOf(criterion); - m_criteria.removeAt(index); - - criterion->deleteLater(); - - updateButtons(); -} - -void DolphinSearchOptionsConfigurator::saveQuery() -{ - QPointer dialog = new SearchOptionDialogBox( 0 ); - - if (dialog->exec() == QDialog::Accepted) { - KFilePlacesModel* model = DolphinSettings::instance().placesModel(); - model->addPlace(dialog->text(), nepomukSearchUrl()); - } - delete dialog; -} - -void DolphinSearchOptionsConfigurator::updateButtons() -{ - const bool enable = nepomukQuery().isValid(); - m_searchButton->setEnabled(enable); - m_saveButton->setEnabled(enable); - - const int selectors = m_vBoxLayout->count() - 1; - m_addSelectorButton->setEnabled(selectors < 10); -} - -void DolphinSearchOptionsConfigurator::addCriterion(SearchCriterionSelector* criterion) -{ - connect(criterion, SIGNAL(removeCriterion()), this, SLOT(removeCriterion())); - connect(criterion, SIGNAL(criterionChanged()), this, SLOT(updateButtons())); - - // insert the new selector before the KSeparator at the bottom - const int index = m_vBoxLayout->count() - 1; - m_vBoxLayout->insertWidget(index, criterion); - updateButtons(); - - m_criteria.append(criterion); -} - -Nepomuk::Query::Query DolphinSearchOptionsConfigurator::nepomukQuery() const -{ - Nepomuk::Query::AndTerm andTerm; - - // add search criterion terms - foreach (const SearchCriterionSelector* criterion, m_criteria) { - const Nepomuk::Query::Term term = criterion->queryTerm(); - andTerm.addSubTerm(term); - } - - bool addCustomQuery = true; - - // filter result by the "What" filter - switch (m_whatBox->currentIndex()) { - case 1: { - // Image - const Nepomuk::Query::ResourceTypeTerm image(Nepomuk::Vocabulary::NFO::Image()); - andTerm.addSubTerm(image); - break; - } - case 2: { - // Text - const Nepomuk::Query::ResourceTypeTerm textDocument(Nepomuk::Vocabulary::NFO::TextDocument()); - andTerm.addSubTerm(textDocument); - break; - } - case 3: { - // Filenames - // trueg: Restriction to filename differs a bit from restriction to a type of file since it does not add a condition - // on the query but influences the text edited in the search bar directly. - // This is a bit tricky as we need to use the search bar text as plain text value for filename searches - // We do it the ugly way assuming the user only entered a literal value. - Nepomuk::Query::ComparisonTerm filenameTerm(Nepomuk::Vocabulary::NFO::fileName(), Nepomuk::Query::LiteralTerm(m_customSearchQuery)); - andTerm.addSubTerm(filenameTerm); - addCustomQuery = false; - } - default: break; - } - - if (addCustomQuery) { - // add custom query term from the searchbar - const Nepomuk::Query::Query customQuery = Nepomuk::Query::QueryParser::parseQuery(m_customSearchQuery); - if (customQuery.isValid()) { - andTerm.addSubTerm(customQuery.term()); - } - } - - Nepomuk::Query::FileQuery fileQuery; - fileQuery.setFileMode( Nepomuk::Query::FileQuery::QueryFiles ); - fileQuery.setTerm(andTerm); - - if ((m_locationBox->currentIndex() == 1) && m_directory.isValid()) { - // "From Here" is selected as location filter - fileQuery.addIncludeFolder(m_directory); - } - - return fileQuery; -} - -#include "dolphinsearchoptionsconfigurator.moc" diff --git a/src/search/dolphinsearchoptionsconfigurator.h b/src/search/dolphinsearchoptionsconfigurator.h deleted file mode 100644 index e4f7718e2..000000000 --- a/src/search/dolphinsearchoptionsconfigurator.h +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef DOLPHINSEARCHOPTIONSCONFIGURATOR_H -#define DOLPHINSEARCHOPTIONSCONFIGURATOR_H - -#include -#define DISABLE_NEPOMUK_LEGACY -#include -#include -#include -#include - -class KComboBox; -class SearchCriterionSelector; -class QPushButton; -class QVBoxLayout; - -/** - * @brief Allows the user to configure a search query for Nepomuk. - */ -class DolphinSearchOptionsConfigurator : public QWidget -{ - Q_OBJECT - -public: - DolphinSearchOptionsConfigurator(QWidget* parent = 0); - virtual ~DolphinSearchOptionsConfigurator(); - - QString customSearchQuery() const; - KUrl directory() const; - - /** - * Returns the sum of the configured options and the - * custom search query as Nepomuk conform search URL. If the - * query is invalid, an empty URL is returned. - * @see DolphinSearchOptionsConfigurator::setCustomSearchQuery() - */ - KUrl nepomukSearchUrl() const; - -public slots: - /** - * Sets a custom search query that is added to the - * search query defined by the search options configurator. - * This is useful if a custom search user interface is - * offered outside the search options configurator. - */ - void setCustomSearchQuery(const QString& searchQuery); - - /** - * Sets the directory that is used when the - * "From Here"-location-filter is used. URLs that represent - * already a Nepomuk search URL will be ignored. - */ - void setDirectory(const KUrl& dir); - -signals: - void searchOptionsChanged(); - -protected: - virtual void showEvent(QShowEvent* event); - -private slots: - void slotAddSelectorButtonClicked(); - void removeCriterion(); - - /** - * Saves the current query by adding it as Places entry. - */ - void saveQuery(); - - /** - * Enables the enabled property of the search-, save-button and the - * add-selector button. - */ - void updateButtons(); - -private: - /** - * Adds the new search description selector to the bottom - * of the layout. - */ - void addCriterion(SearchCriterionSelector* selector); - - /** - * Returns the sum of the configured options and the - * custom search query as Nepomuk confrom query. - * @see DolphinSearchOptionsConfigurator::setCustomSearchQuery() - */ - Nepomuk::Query::Query nepomukQuery() const; - -private: - bool m_initialized; - KUrl m_directory; - KComboBox* m_locationBox; - KComboBox* m_whatBox; - QPushButton* m_addSelectorButton; - QPushButton* m_searchButton; - QPushButton* m_saveButton; - QVBoxLayout* m_vBoxLayout; - QList m_criteria; - QString m_customSearchQuery; -}; - -#endif diff --git a/src/search/filenamesearch.protocol b/src/search/filenamesearch.protocol new file mode 100644 index 000000000..65cc60b8e --- /dev/null +++ b/src/search/filenamesearch.protocol @@ -0,0 +1,17 @@ +[Protocol] +exec=kio_filenamesearch +protocol=filenamesearch +input=none +output=filesystem +reading=true +writing=false +deleting=true +linking=false +makedir=false +moving=false +listing=Name,Type,Size,Date,AccessDate,Access,Owner,Group,Link +source=false +Icon=find +Class=:local +determineMimetypeFromExtension=false +maxInstances=10 diff --git a/src/search/filenamesearchprotocol.cpp b/src/search/filenamesearchprotocol.cpp new file mode 100644 index 000000000..a08d883f3 --- /dev/null +++ b/src/search/filenamesearchprotocol.cpp @@ -0,0 +1,138 @@ +/*************************************************************************** + * Copyright (C) 2010 by Peter Penz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "filenamesearchprotocol.h" + +#include +#include +#include +#include + +#include +#include + +FileNameSearchProtocol::FileNameSearchProtocol( const QByteArray &pool, const QByteArray &app ) : + SlaveBase("search", pool, app), + m_checkContent(false), + m_searchPattern() +{ +} + +FileNameSearchProtocol::~FileNameSearchProtocol() +{ +} + +void FileNameSearchProtocol::listDir(const KUrl& url) +{ + const QStringList searchValues = url.allQueryItemValues("search"); + m_searchPattern.clear(); + if (!searchValues.isEmpty()) { + m_searchPattern = searchValues.first(); + } + + m_checkContent = false; + const QStringList checkContentValues = url.allQueryItemValues("checkContent"); + if (!checkContentValues.isEmpty() && (checkContentValues.first() == QLatin1String("yes"))) { + m_checkContent = true; + } + + KUrl directory = url; + directory.setProtocol("file"); + directory.setEncodedQuery(QByteArray()); + + searchDirectory(directory); + + finished(); +} + +void FileNameSearchProtocol::searchDirectory(const KUrl& directory) +{ + // Get all items of the directory + KDirLister *dirLister = new KDirLister(); + dirLister->setDelayedMimeTypes(false); + dirLister->setAutoErrorHandlingEnabled(false, 0); + dirLister->openUrl(directory); + + QEventLoop eventLoop; + QObject::connect(dirLister, SIGNAL(canceled()), &eventLoop, SLOT(quit())); + QObject::connect(dirLister, SIGNAL(completed()), &eventLoop, SLOT(quit())); + eventLoop.exec(); + + // Visualize all items that match the search pattern + QList pendingDirs; + const KFileItemList items = dirLister->items(); + foreach (const KFileItem& item, items) { + bool addItem = false; + if (m_searchPattern.isEmpty() || item.name().contains(m_searchPattern, Qt::CaseInsensitive)) { + addItem = true; + } else if (m_checkContent && item.mimetype().startsWith(QLatin1String("text/"))) { + addItem = containsPattern(item.url()); + } + + if (addItem) { + KIO::UDSEntry entry = item.entry(); + entry.insert(KIO::UDSEntry::UDS_URL, item.url().url() ); + listEntry(entry,false); + } + + if (item.isDir()) { + pendingDirs.append(item.url()); + } + } + listEntry(KIO::UDSEntry(), true); + + // Recursively iterate all sub directories + foreach (const KUrl& pendingDir, pendingDirs) { + searchDirectory(pendingDir); + } +} + +bool FileNameSearchProtocol::containsPattern(const KUrl& fileName) const +{ + QFile file(fileName.path()); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + return false; + } + + QTextStream in(&file); + while (!in.atEnd()) { + const QString line = in.readLine(); + if (line.contains(m_searchPattern)) { + return true; + } + } + + return false; +} + +extern "C" int KDE_EXPORT kdemain( int argc, char **argv ) +{ + KComponentData instance("kio_search"); + QCoreApplication app(argc, argv); + + if (argc != 4) { + fprintf(stderr, "Usage: kio_filenamesearch protocol domain-socket1 domain-socket2\n"); + exit(-1); + } + + FileNameSearchProtocol slave(argv[2], argv[3]); + slave.dispatchLoop(); + + return 0; +} diff --git a/src/search/filenamesearchprotocol.h b/src/search/filenamesearchprotocol.h new file mode 100644 index 000000000..70d3e631c --- /dev/null +++ b/src/search/filenamesearchprotocol.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2010 by Peter Penz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef FILENAMESEARCHPROTOCOL_H +#define FILENAMESEARCHPROTOCOL_H + +#include + +class KUrl; + +/** + * @brief Lists files where the filename matches do a given query. + * + * The query is defined as part of the "search" query item of the URL. + * Example: The URL filenamesearch:///home/peter?search=hello lists + * recursively all files inside the directory home/peter, that contain + * the "hello" as part of their filename. + */ +class FileNameSearchProtocol : public KIO::SlaveBase { +public: + FileNameSearchProtocol(const QByteArray& pool, const QByteArray& app); + virtual ~FileNameSearchProtocol(); + + virtual void listDir(const KUrl& url); + +private: + void searchDirectory(const KUrl& directory); + + /** + * @return True, if the pattern m_searchPattern is part of + * the file \a fileName. + */ + bool containsPattern(const KUrl& fileName) const; + + bool m_checkContent; + QString m_searchPattern; +}; + +#endif diff --git a/src/search/filters/abstractsearchfilterwidget.cpp b/src/search/filters/abstractsearchfilterwidget.cpp new file mode 100644 index 000000000..5b44f94b4 --- /dev/null +++ b/src/search/filters/abstractsearchfilterwidget.cpp @@ -0,0 +1,66 @@ +/*************************************************************************** +* Copyright (C) 2010 by Peter Penz * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * +* **************************************************************************/ + +#include "abstractsearchfilterwidget.h" + +#include + +class SearchFilterButton : public QPushButton +{ +public: + SearchFilterButton(QWidget* parent = 0); + virtual QSize sizeHint() const; +}; + +SearchFilterButton::SearchFilterButton(QWidget* parent) : + QPushButton(parent) +{ + setCheckable(true); +} + +QSize SearchFilterButton::sizeHint() const +{ + // Provide a larger preferred width, as this leads to a less + // cluttered layout for all search filters + const QSize defaultSize = QPushButton::sizeHint(); + QFontMetrics fontMetrics(font()); + const int minWidth = fontMetrics.height() * 8; + const int width = qMax(minWidth, defaultSize.width()); + return QSize(width, defaultSize.height()); +} + + + +AbstractSearchFilterWidget::AbstractSearchFilterWidget(QWidget* parent) : + QWidget(parent) +{ +} + +AbstractSearchFilterWidget::~AbstractSearchFilterWidget() +{ +} + +QPushButton* AbstractSearchFilterWidget::createButton() +{ + SearchFilterButton* button = new SearchFilterButton(this); + connect(button, SIGNAL(toggled(bool)), this, SIGNAL(filterChanged())); + return button; +} + +#include "abstractsearchfilterwidget.moc" diff --git a/src/search/filters/abstractsearchfilterwidget.h b/src/search/filters/abstractsearchfilterwidget.h new file mode 100644 index 000000000..95f288b08 --- /dev/null +++ b/src/search/filters/abstractsearchfilterwidget.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2010 by Peter Penz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef ABSTRACTSEARCHFILTERWIDGET_H +#define ABSTRACTSEARCHFILTERWIDGET_H + +#include +#include + +class QPushButton; + +/** + * @brief Base class for widgets that act as filter for searching. + * + * Derived classes need to implement the methods filterLabel() and + * queryTerm(). It is recommended to use createButton() for a filter-switch. + * The created button will automatically emit the signal filterChanged(). + */ +class AbstractSearchFilterWidget : public QWidget { + Q_OBJECT + +public: + AbstractSearchFilterWidget(QWidget* parent = 0); + virtual ~AbstractSearchFilterWidget(); + + /** + * @return Label that describes the kind of filter. + */ + virtual QString filterLabel() const = 0; + + /** + * @return Query-term for this filter, that respects the currently + * selected filter-switches. + */ + virtual Nepomuk::Query::Term queryTerm() const = 0; + +protected: + /** + * @return A checkable button, that automatically emits the signal + * filterChanged() when being pressed. + */ + QPushButton* createButton(); + +signals: + /** + * Is emitted, if a filter-switch has been changed by the user. + */ + void filterChanged(); +}; + +#endif diff --git a/src/search/filters/datesearchfilterwidget.cpp b/src/search/filters/datesearchfilterwidget.cpp new file mode 100644 index 000000000..0be95d09e --- /dev/null +++ b/src/search/filters/datesearchfilterwidget.cpp @@ -0,0 +1,113 @@ +/*************************************************************************** +* Copyright (C) 2010 by Peter Penz * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * +* **************************************************************************/ + +#include "datesearchfilterwidget.h" + +#define DISABLE_NEPOMUK_LEGACY + +#include +#include +#include +#include +#include +#include +#include "nie.h" +#include +#include +#include +#include +#include + +DateSearchFilterWidget::DateSearchFilterWidget(QWidget* parent) : + AbstractSearchFilterWidget(parent), + m_dateButtons() +{ + QHBoxLayout* layout = new QHBoxLayout(this); + layout->setSpacing(0); + + for (int i = Today; i <= ThisYear; ++i) { + QPushButton* button = createButton(); + switch (i) { + case Today: button->setText(i18nc("@action:button", "Today")); break; + case Yesterday: button->setText(i18nc("@action:button", "Yesterday")); break; + case ThisWeek: button->setText(i18nc("@action:button", "This Week")); break; + case ThisMonth: button->setText(i18nc("@action:button", "This Month")); break; + case ThisYear: button->setText(i18nc("@action:button", "This Year")); break; + default: Q_ASSERT(false); + } + + layout->addWidget(button); + m_dateButtons.append(button); + } + layout->addStretch(1); +} + +DateSearchFilterWidget::~DateSearchFilterWidget() +{ +} + + +QString DateSearchFilterWidget::filterLabel() const +{ + return i18nc("@title:group", "Date"); +} + +Nepomuk::Query::Term DateSearchFilterWidget::queryTerm() const +{ + Nepomuk::Query::OrTerm orTerm; + + int index = 0; + foreach (const QPushButton* button, m_dateButtons) { + if (button->isChecked()) { + QDate today = QDate::currentDate(); + QDate date; + switch (index) { + case Today: + // Current date is already set + break; + case Yesterday: + date.addDays(-1); + break; + case ThisWeek: + date.addDays(-today.dayOfWeek()); + break; + case ThisMonth: + date = QDate(today.year(), today.month(), 1); + break; + case ThisYear: + date = QDate(today.year(), 1, 1); + break; + default: + Q_ASSERT(false); + } + + const QDateTime dateTime(date); + const Nepomuk::Query::LiteralTerm term(dateTime); + const Nepomuk::Query::ComparisonTerm compTerm(Nepomuk::Vocabulary::NIE::lastModified(), + term, + Nepomuk::Query::ComparisonTerm::GreaterOrEqual); + orTerm.addSubTerm(compTerm); + } + ++index; + } + + return orTerm; +} + +#include "datesearchfilterwidget.moc" diff --git a/src/search/filters/datesearchfilterwidget.h b/src/search/filters/datesearchfilterwidget.h new file mode 100644 index 000000000..9099489ad --- /dev/null +++ b/src/search/filters/datesearchfilterwidget.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * Copyright (C) 2010 by Peter Penz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef DATESEARCHFILTERWIDGET_H +#define DATESEARCHFILTERWIDGET_H + +#include +#include + +class QPushButton; + +/** + * @brief Allows to filter the search by defined date values like + * today, yesterday, ... + */ +class DateSearchFilterWidget : public AbstractSearchFilterWidget { + Q_OBJECT + +public: + DateSearchFilterWidget(QWidget* parent = 0); + virtual ~DateSearchFilterWidget(); + virtual QString filterLabel() const; + virtual Nepomuk::Query::Term queryTerm() const; + +private: + enum DateFilterType { + Today, + Yesterday, + ThisWeek, + ThisMonth, + ThisYear + }; + + QList m_dateButtons; +}; + +#endif diff --git a/src/search/filters/ratingsearchfilterwidget.cpp b/src/search/filters/ratingsearchfilterwidget.cpp new file mode 100644 index 000000000..768764172 --- /dev/null +++ b/src/search/filters/ratingsearchfilterwidget.cpp @@ -0,0 +1,108 @@ +/*************************************************************************** +* Copyright (C) 2010 by Peter Penz * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * +* **************************************************************************/ + +#include "ratingsearchfilterwidget.h" + +#define DISABLE_NEPOMUK_LEGACY + +#include +#include +#include +#include +#include +#include +#include +#include "nie.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + // Only show the ratings 0, 2, 4, ... 10 + const int RatingInc = 2; +}; + +RatingSearchFilterWidget::RatingSearchFilterWidget(QWidget* parent) : + AbstractSearchFilterWidget(parent), + m_ratingButtons() +{ + QHBoxLayout* layout = new QHBoxLayout(this); + layout->setSpacing(0); + + QFontMetrics fontMetrics(font()); + const int iconHeight = fontMetrics.height(); + + KRatingPainter ratingPainter; + const int maxRating = ratingPainter.maxRating(); + const QSize iconSize(iconHeight * (maxRating / 2), iconHeight); + const QRect paintRect(QPoint(0, 0), iconSize); + + for (int rating = 0; rating <= ratingPainter.maxRating(); rating += RatingInc) { + // Create pixmap that represents the rating + QPixmap pixmap(iconSize); + pixmap.fill(Qt::transparent); + QPainter painter(&pixmap); + ratingPainter.paint(&painter, paintRect, rating); + + // Create button with the rating pixmap as icon + QPushButton* button = createButton(); + button->setIconSize(iconSize); + button->setIcon(QIcon(pixmap)); + + layout->addWidget(button); + m_ratingButtons.append(button); + } + + layout->addStretch(1); +} + +RatingSearchFilterWidget::~RatingSearchFilterWidget() +{ +} + +QString RatingSearchFilterWidget::filterLabel() const +{ + return i18nc("@title:group", "Rating"); +} + +Nepomuk::Query::Term RatingSearchFilterWidget::queryTerm() const +{ + Nepomuk::Query::OrTerm orTerm; + + int rating = 0; + foreach (const QPushButton* ratingButton, m_ratingButtons) { + if (ratingButton->isChecked()) { + const Nepomuk::Query::LiteralTerm term(rating); + const Nepomuk::Query::ComparisonTerm compTerm(Soprano::Vocabulary::NAO::numericRating(), + term, + Nepomuk::Query::ComparisonTerm::Equal); + orTerm.addSubTerm(compTerm); + } + rating += RatingInc; + } + + return orTerm; +} + +#include "ratingsearchfilterwidget.moc" diff --git a/src/search/filters/ratingsearchfilterwidget.h b/src/search/filters/ratingsearchfilterwidget.h new file mode 100644 index 000000000..05de1adec --- /dev/null +++ b/src/search/filters/ratingsearchfilterwidget.h @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (C) 2010 by Peter Penz * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef RATINGSEARCHFILTERWIDGET_H +#define RATINGSEARCHFILTERWIDGET_H + +#include +#include + +class QPushButton; + +/** + * @brief Allows to filter the search by rating. + */ +class RatingSearchFilterWidget : public AbstractSearchFilterWidget { + Q_OBJECT + +public: + RatingSearchFilterWidget(QWidget* parent = 0); + virtual ~RatingSearchFilterWidget(); + virtual QString filterLabel() const; + virtual Nepomuk::Query::Term queryTerm() const; + +private: + QList m_ratingButtons; +}; + +#endif diff --git a/src/search/filters/tagsearchfilterwidget.cpp b/src/search/filters/tagsearchfilterwidget.cpp new file mode 100644 index 000000000..cb2d20dcc --- /dev/null +++ b/src/search/filters/tagsearchfilterwidget.cpp @@ -0,0 +1,89 @@ +/*************************************************************************** +* Copyright (C) 2010 by Peter Penz * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU General Public License for more details. * +* * +* You should have received a copy of the GNU General Public License * +* along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * +* **************************************************************************/ + +#include "tagsearchfilterwidget.h" + +#define DISABLE_NEPOMUK_LEGACY +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static bool tagLabelLessThan(const Nepomuk::Tag& t1, const Nepomuk::Tag& t2) +{ + return t1.genericLabel() < t2.genericLabel(); +} + +TagSearchFilterWidget::TagSearchFilterWidget(QWidget* parent) : + AbstractSearchFilterWidget(parent), + m_tagButtons() +{ + QHBoxLayout* layout = new QHBoxLayout(this); + layout->setSpacing(0); + + QList tags = Nepomuk::Tag::allTags(); + qSort(tags.begin(), tags.end(), tagLabelLessThan); + + // TODO: handle case if no tag is available + foreach (const Nepomuk::Tag& tag, tags) { + QPushButton* button = createButton(); + button->setText(tag.genericLabel()); + + layout->addWidget(button); + m_tagButtons.append(button); + } + + layout->addStretch(1); +} + +TagSearchFilterWidget::~TagSearchFilterWidget() +{ +} + +QString TagSearchFilterWidget::filterLabel() const +{ + return i18nc("@title:group", "Tag"); +} + +Nepomuk::Query::Term TagSearchFilterWidget::queryTerm() const +{ + Nepomuk::Query::OrTerm orTerm; + + foreach (const QPushButton* tagButton, m_tagButtons) { + if (tagButton->isChecked()) { + const Nepomuk::Query::LiteralTerm term(tagButton->text()); + const Nepomuk::Query::ComparisonTerm compTerm(Soprano::Vocabulary::NAO::hasTag(), + term, + Nepomuk::Query::ComparisonTerm::Equal); + orTerm.addSubTerm(compTerm); + } + } + + return orTerm; +} + +#include "tagsearchfilterwidget.moc" diff --git a/src/search/searchcriteriondescription.cpp b/src/search/filters/tagsearchfilterwidget.h similarity index 55% rename from src/search/searchcriteriondescription.cpp rename to src/search/filters/tagsearchfilterwidget.h index 25639df0c..9897e408b 100644 --- a/src/search/searchcriteriondescription.cpp +++ b/src/search/filters/tagsearchfilterwidget.h @@ -1,6 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 by Adam Kidder * - * Copyright (C) 2009 by Peter Penz * + * Copyright (C) 2010 by Peter Penz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -18,39 +17,28 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ -#include "searchcriteriondescription.h" +#ifndef TAGSEARCHFILTERWIDGET_H +#define TAGSEARCHFILTERWIDGET_H -SearchCriterionDescription::SearchCriterionDescription(const QString& name, - const QUrl& identifier, - const QList& comparators, - SearchCriterionValue* valueWidget) : - m_name(name), - m_identifier(identifier), - m_comparators(comparators), - m_valueWidget(valueWidget) -{ -} +#include +#include -SearchCriterionDescription::~SearchCriterionDescription() -{ -} +class QPushButton; -QString SearchCriterionDescription::name() const -{ - return m_name; -} +/** + * @brief Allows to filter the search by tags. + */ +class TagSearchFilterWidget : public AbstractSearchFilterWidget { + Q_OBJECT -QUrl SearchCriterionDescription::identifier() const -{ - return m_identifier; -} +public: + TagSearchFilterWidget(QWidget* parent = 0); + virtual ~TagSearchFilterWidget(); + virtual QString filterLabel() const; + virtual Nepomuk::Query::Term queryTerm() const; -const QList& SearchCriterionDescription::comparators() const -{ - return m_comparators; -} +private: + QList m_tagButtons; +}; -SearchCriterionValue* SearchCriterionDescription::valueWidget() const -{ - return m_valueWidget; -} +#endif diff --git a/src/search/searchcriteriondescription.h b/src/search/searchcriteriondescription.h deleted file mode 100644 index 62c4bd7eb..000000000 --- a/src/search/searchcriteriondescription.h +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Adam Kidder * - * Copyright (C) 2009 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef SEARCHCRITERIONDESCRIPTION_H -#define SEARCHCRITERIONDESCRIPTION_H - -#define DISABLE_NEPOMUK_LEGACY -#include - -#include -#include -#include - -class SearchCriterionValue; - -/** - * @brief Helper class for SearchCriterionSelector. - * - * Describes a search criterion including the used - * widget for editing. - */ -class SearchCriterionDescription -{ -public: - struct Comparator - { - Comparator(const QString& n) : - name(n), - isActive(false), - value(Nepomuk::Query::ComparisonTerm::Smaller), - autoValueType() - { - } - - Comparator(const QString& n, Nepomuk::Query::ComparisonTerm::Comparator c, - const QString& a = QString()) : - name(n), - isActive(true), - value(c), - autoValueType(a) - { - } - - QString name; // user visible and translated name - bool isActive; - Nepomuk::Query::ComparisonTerm::Comparator value; - QString autoValueType; // type for an automatically calculated value of the value widget - }; - - SearchCriterionDescription(const QString& name, - const QUrl& identifier, - const QList& comparators, - SearchCriterionValue* valueWidget); - - virtual ~SearchCriterionDescription(); - - QString name() const; - QUrl identifier() const; - const QList& comparators() const; - SearchCriterionValue* valueWidget() const; - -private: - QString m_name; // user visible name that gets translated - QUrl m_identifier; // internal Nepomuk identifier URL - QList m_comparators; - SearchCriterionValue* m_valueWidget; -}; - -#endif // SEARCHCRITERIONDESCRIPTION_H diff --git a/src/search/searchcriterionselector.cpp b/src/search/searchcriterionselector.cpp deleted file mode 100644 index b62008029..000000000 --- a/src/search/searchcriterionselector.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Adam Kidder * - * Copyright (C) 2009 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "searchcriterionselector.h" - -#define DISABLE_NEPOMUK_LEGACY -#include -#include -#include - -#include "nie.h" -#include "searchcriterionvalue.h" - -#include -#include - -#include -#include -#include -#include - -#include -#include - -SearchCriterionSelector::SearchCriterionSelector(Type type, QWidget* parent) : - QWidget(parent), - m_layout(0), - m_descriptionsBox(0), - m_comparatorBox(0), - m_valueWidget(0), - m_removeButton(0), - m_descriptions() -{ - m_descriptionsBox = new QComboBox(this); - - m_comparatorBox = new QComboBox(this); - m_comparatorBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); - - createDescriptions(); - const int index = static_cast(type); - m_descriptionsBox->setCurrentIndex(index); - - QWidget* filler = new QWidget(this); - filler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - m_removeButton = new QPushButton(this); - m_removeButton->setIcon(KIcon("list-remove")); - m_removeButton->setToolTip(i18nc("@info", "Remove search option")); - m_removeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - connect(m_removeButton, SIGNAL(clicked()), this, SIGNAL(removeCriterion())); - - m_layout = new QHBoxLayout(this); - m_layout->setMargin(0); - m_layout->addWidget(m_removeButton); - m_layout->addWidget(m_descriptionsBox); - m_layout->addWidget(m_comparatorBox); - m_layout->addWidget(filler); - - setLayout(m_layout); - - slotDescriptionChanged(index); - connect(m_descriptionsBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotDescriptionChanged(int))); -} - -SearchCriterionSelector::~SearchCriterionSelector() -{ -} - -Nepomuk::Query::Term SearchCriterionSelector::queryTerm() const -{ - if (m_valueWidget == 0) { - return Nepomuk::Query::Term(); - } - - const int descIndex = m_descriptionsBox->currentIndex(); - const SearchCriterionDescription& descr = m_descriptions[descIndex]; - - const int compIndex = m_comparatorBox->currentIndex(); - const SearchCriterionDescription::Comparator& comp = descr.comparators()[compIndex]; - if (!comp.isActive) { - return Nepomuk::Query::Term(); - } - - const Nepomuk::Query::ComparisonTerm term(descr.identifier(), - m_valueWidget->value(), - comp.value); - return term; -} - -SearchCriterionSelector::Type SearchCriterionSelector::type() const -{ - return static_cast(m_descriptionsBox->currentIndex()); -} - -void SearchCriterionSelector::slotDescriptionChanged(int index) -{ - if (m_valueWidget != 0) { - m_valueWidget->hide(); - m_layout->removeWidget(m_valueWidget); - m_valueWidget = 0; - // the value widget is obtained by the Search Criterion - // Selector instance and may not get deleted - } - - // add comparator items - disconnect(m_comparatorBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotComparatorChanged(int))); - m_comparatorBox->clear(); - - const SearchCriterionDescription& description = m_descriptions[index]; - foreach (const SearchCriterionDescription::Comparator& comp, description.comparators()) { - m_comparatorBox->addItem(comp.name); - } - - // add value widget - m_valueWidget = description.valueWidget(); - m_layout->insertWidget(3, m_valueWidget); - - m_comparatorBox->setCurrentIndex(0); - slotComparatorChanged(0); - connect(m_comparatorBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotComparatorChanged(int))); -} - -void SearchCriterionSelector::slotComparatorChanged(int index) -{ - Q_ASSERT(index >= 0); - - // only show the value widget if an operation is defined by the comparator - const int descIndex = m_descriptionsBox->currentIndex(); - const SearchCriterionDescription& descr = m_descriptions[descIndex]; - const SearchCriterionDescription::Comparator& comp = descr.comparators()[index]; - - m_valueWidget->initializeValue(comp.autoValueType); - // only show the value widget, if an operation is defined - // and no automatic calculation is provided - m_valueWidget->setVisible(comp.isActive && comp.autoValueType.isEmpty()); - - emit criterionChanged(); -} - -void SearchCriterionSelector::createDescriptions() -{ - Q_ASSERT(m_descriptionsBox != 0); - Q_ASSERT(m_comparatorBox != 0); - - // TODO: maybe this creation should be forwarded to a factory if - // the number of items increases in future - QList defaultComps; - defaultComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Greater Than"), Nepomuk::Query::ComparisonTerm::Greater)); - defaultComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Greater Than or Equal to"), Nepomuk::Query::ComparisonTerm::GreaterOrEqual)); - defaultComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Less Than"), Nepomuk::Query::ComparisonTerm::Smaller)); - defaultComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Less Than or Equal to"), Nepomuk::Query::ComparisonTerm::SmallerOrEqual)); - - // add "Date" description - QList dateComps; - dateComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Anytime"))); - dateComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Today"), Nepomuk::Query::ComparisonTerm::GreaterOrEqual, "today")); - dateComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "This Week"), Nepomuk::Query::ComparisonTerm::GreaterOrEqual, "thisWeek")); - dateComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "This Month"), Nepomuk::Query::ComparisonTerm::GreaterOrEqual, "thisMonth")); - dateComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "This Year"), Nepomuk::Query::ComparisonTerm::GreaterOrEqual, "thisYear")); - foreach (const SearchCriterionDescription::Comparator& comp, defaultComps) { - dateComps.append(comp); - } - - DateValue* dateValue = new DateValue(this); - dateValue->hide(); - SearchCriterionDescription date(i18nc("@label", "Date:"), - Nepomuk::Vocabulary::NIE::lastModified(), - dateComps, - dateValue); - Q_ASSERT(static_cast(SearchCriterionSelector::Date) == 0); - m_descriptions.append(date); - - // add "Size" description - QList sizeComps = defaultComps; - sizeComps.insert(0, SearchCriterionDescription::Comparator(i18nc("@label Any (file size)", "Any"))); - - SizeValue* sizeValue = new SizeValue(this); - sizeValue->hide(); - SearchCriterionDescription size(i18nc("@label", "Size:"), - Soprano::Vocabulary::NAO::lastModified(), // TODO - sizeComps, - sizeValue); - Q_ASSERT(static_cast(SearchCriterionSelector::Size) == 1); - m_descriptions.append(size); - - // add "Tag" description - QList tagComps; - tagComps.append(SearchCriterionDescription::Comparator(i18nc("@label All (tags)", "All"))); - tagComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Equal to"), Nepomuk::Query::ComparisonTerm::Equal)); - // It is unclear yet how to express != for tags with the new Nepomuk query API. Disable it for KDE 4.4, - // but leave the translation string there to be able to enable this functionality for KDE 4.4.x: - const QString dummy = i18nc("@label", "Not Equal to"); - Q_UNUSED(dummy); - //tagComps.append(SearchCriterionDescription::Comparator(i18nc("@label", "Not Equal to"), Nepomuk::Query::ComparisonTerm::Equal)); // TODO - - TagValue* tagValue = new TagValue(this); - tagValue->hide(); - SearchCriterionDescription tag(i18nc("@label", "Tag:"), - Soprano::Vocabulary::NAO::hasTag(), - tagComps, - tagValue); - Q_ASSERT(static_cast(SearchCriterionSelector::Tag) == 2); - m_descriptions.append(tag); - - // add "Rating" description - QList ratingComps = defaultComps; - ratingComps.insert(0, SearchCriterionDescription::Comparator(i18nc("@label Any (rating)", "Any"))); - - RatingValue* ratingValue = new RatingValue(this); - ratingValue->hide(); - SearchCriterionDescription rating(i18nc("@label", "Rating:"), - Soprano::Vocabulary::NAO::numericRating(), - ratingComps, - ratingValue); - Q_ASSERT(static_cast(SearchCriterionSelector::Rating) == 3); - m_descriptions.append(rating); - - // add all descriptions to the combo box and connect the value widgets - int i = 0; - foreach (const SearchCriterionDescription& desc, m_descriptions) { - m_descriptionsBox->addItem(desc.name(), i); - connect(desc.valueWidget(), SIGNAL(valueChanged(Nepomuk::Query::LiteralTerm)), this, SIGNAL(criterionChanged())); - ++i; - } -} - -#include "searchcriterionselector.moc" diff --git a/src/search/searchcriterionselector.h b/src/search/searchcriterionselector.h deleted file mode 100644 index e9f26dd80..000000000 --- a/src/search/searchcriterionselector.h +++ /dev/null @@ -1,90 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Adam Kidder * - * Copyright (C) 2009 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef SEARCHCRITERIONSELECTOR_H -#define SEARCHCRITERIONSELECTOR_H - -#include -#include -#include - -#define DISABLE_NEPOMUK_LEGACY -#include -#include - -class SearchCriterionValue; -class QComboBox; -class QHBoxLayout; -class QPushButton; - -/** - * @brief Allows the user to select a search criterion. - * The widget represents one row of the DolphinSearchOptionsConfigurator. - * Example: [File Size] [greater than] [10] [Byte] - * - * @see DolphinSearchOptionsConfigurator. - */ -class SearchCriterionSelector : public QWidget -{ - Q_OBJECT - -public: - enum Type { Date, Size, Tag, Rating }; - - SearchCriterionSelector(Type type, QWidget* parent = 0); - virtual ~SearchCriterionSelector(); - - /** Returns the query-term for the criterion. */ - Nepomuk::Query::Term queryTerm() const; - - Type type() const; - -signals: - /** - * Is emitted if the criterion selector should be removed - * because the user clicked the "Remove" button. - */ - void removeCriterion(); - - /** Is emitted if the user has changed the search criterion. */ - void criterionChanged(); - -private slots: - void slotDescriptionChanged(int index); - void slotComparatorChanged(int index); - -private: - /** - * Creates all available search criterion descriptions m_descriptions - * and adds them into the combobox m_descriptionsBox. - */ - void createDescriptions(); - -private: - QHBoxLayout* m_layout; - QComboBox* m_descriptionsBox; // has items like "File Size", "Date Modified", ... - QComboBox* m_comparatorBox; // has items like "greater than", "less than", ... - SearchCriterionValue* m_valueWidget; // contains the value of a file size or a date - QPushButton* m_removeButton; // requests a removing of the search criterion instance - - QList m_descriptions; -}; - -#endif // SEARCHCRITERIONSELECTOR_H diff --git a/src/search/searchcriterionvalue.cpp b/src/search/searchcriterionvalue.cpp deleted file mode 100644 index 065100e4e..000000000 --- a/src/search/searchcriterionvalue.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Adam Kidder * - * Copyright (C) 2009 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#include "searchcriterionvalue.h" - -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -SearchCriterionValue::SearchCriterionValue(QWidget* parent) : - QWidget(parent) -{ -} - -SearchCriterionValue::~SearchCriterionValue() -{ -} - -void SearchCriterionValue::initializeValue(const QString& valueType) -{ - Q_UNUSED(valueType); -} - -// ------------------------------------------------------------------------- - -DateValue::DateValue(QWidget* parent) : - SearchCriterionValue(parent), - m_dateWidget(0) -{ - m_dateWidget = new KDateWidget(QDate::currentDate(), this); - - QHBoxLayout* layout = new QHBoxLayout(this); - layout->setMargin(0); - layout->addWidget(m_dateWidget); -} - -DateValue::~DateValue() -{ -} - -Nepomuk::Query::LiteralTerm DateValue::value() const -{ - const QDateTime dateTime(m_dateWidget->date()); - return Nepomuk::Query::LiteralTerm(dateTime); -} - -void DateValue::initializeValue(const QString& valueType) -{ - QDate date; - if (valueType.isEmpty() || (valueType == "today")) { - date = QDate::currentDate(); - } else if (valueType == "thisWeek") { - const QDate today = QDate::currentDate(); - const int dayOfWeek = today.dayOfWeek(); - date = today.addDays(-dayOfWeek); - } else if (valueType == "thisMonth") { - const QDate today = QDate::currentDate(); - date = QDate(today.year(), today.month(), 1); - } else if (valueType == "thisYear") { - date = QDate(QDate::currentDate().year(), 1, 1); - } else { - // unknown value-type - Q_ASSERT(false); - } - m_dateWidget->setDate(date); -} - -// ------------------------------------------------------------------------- - -TagValue::TagValue(QWidget* parent) : - SearchCriterionValue(parent), - m_tags(0) -{ - m_tags = new QComboBox(this); - m_tags->setInsertPolicy(QComboBox::InsertAlphabetically); - - QHBoxLayout* layout = new QHBoxLayout(this); - layout->setMargin(0); - layout->addWidget(m_tags); - - connect(m_tags, SIGNAL(activated(QString)), - this, SIGNAL(valueChanged(QString))); -} - -TagValue::~TagValue() -{ -} - -Nepomuk::Query::LiteralTerm TagValue::value() const -{ - return Nepomuk::Query::LiteralTerm(m_tags->currentText()); -} - -void TagValue::showEvent(QShowEvent* event) -{ - if (!event->spontaneous() && (m_tags->count() == 0)) { - const QList tags = Nepomuk::Tag::allTags(); - foreach (const Nepomuk::Tag& tag, tags) { - m_tags->addItem(tag.label()); - } - - if (tags.count() == 0) { - m_tags->addItem(i18nc("@label", "No Tags Available")); - } - } - SearchCriterionValue::showEvent(event); -} - -// ------------------------------------------------------------------------- - -SizeValue::SizeValue(QWidget* parent) : - SearchCriterionValue(parent), - m_lineEdit(0), - m_units(0) -{ - m_lineEdit = new KLineEdit(this); - m_lineEdit->setClearButtonShown(true); - m_lineEdit->setValidator(new QIntValidator(this)); - m_lineEdit->setAlignment(Qt::AlignRight); - - m_units = new QComboBox(this); - // TODO: check the KByte vs. KiByte dilemma :-/ - m_units->addItem(i18nc("@label", "Byte")); - m_units->addItem(i18nc("@label", "KByte")); - m_units->addItem(i18nc("@label", "MByte")); - m_units->addItem(i18nc("@label", "GByte")); - - // set 1 MByte as default - m_lineEdit->setText("1"); - m_units->setCurrentIndex(2); - - QHBoxLayout* layout = new QHBoxLayout(this); - layout->setMargin(0); - layout->addWidget(m_lineEdit); - layout->addWidget(m_units); -} - -SizeValue::~SizeValue() -{ -} - -Nepomuk::Query::LiteralTerm SizeValue::value() const -{ - return Nepomuk::Query::LiteralTerm(); // TODO -} - -// ------------------------------------------------------------------------- - -RatingValue::RatingValue(QWidget* parent) : - SearchCriterionValue(parent), - m_ratingWidget(0) -{ - m_ratingWidget = new KRatingWidget(this); - - QHBoxLayout* layout = new QHBoxLayout(this); - layout->setMargin(0); - layout->addWidget(m_ratingWidget); -} - -RatingValue::~RatingValue() -{ -} - -Nepomuk::Query::LiteralTerm RatingValue::value() const -{ - return Nepomuk::Query::LiteralTerm(m_ratingWidget->rating()); -} - -#include "searchcriterionvalue.moc" diff --git a/src/search/searchcriterionvalue.h b/src/search/searchcriterionvalue.h deleted file mode 100644 index f3dc19e6f..000000000 --- a/src/search/searchcriterionvalue.h +++ /dev/null @@ -1,132 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 by Adam Kidder * - * Copyright (C) 2009 by Peter Penz * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - -#ifndef SEARCHCRITERIONVALUE_H -#define SEARCHCRITERIONVALUE_H - -#define DISABLE_NEPOMUK_LEGACY -#include - -#include - -class QComboBox; -class KDateWidget; -class KRatingWidget; -class KLineEdit; - -/** - * @brief Helper class for SearchCriterionSelector. - * Represents an input widget for the value of a search criterion. - */ -class SearchCriterionValue : public QWidget -{ - Q_OBJECT - -public: - SearchCriterionValue(QWidget* parent = 0); - virtual ~SearchCriterionValue(); - - /** - * Must be overwritten by derived classes and returns - * the literal term of the search criterion value. - */ - virtual Nepomuk::Query::LiteralTerm value() const = 0; - - /** - * Initializes the widget on the base of the given value-type. - * It is in the hand of the derived classes to interprete - * the value-type string and create a corresponding value for - * the widget (@see SearchCriterionSelector::Comparator). - * The default implementation is empty. - */ - virtual void initializeValue(const QString& valueType); - -signals: - void valueChanged(const Nepomuk::Query::LiteralTerm& value); -}; - - - -/** @brief Allows to input a date value as search criterion. */ -class DateValue : public SearchCriterionValue -{ - Q_OBJECT - -public: - DateValue(QWidget* parent = 0); - virtual ~DateValue(); - virtual Nepomuk::Query::LiteralTerm value() const; - virtual void initializeValue(const QString& valueType); - -private: - KDateWidget* m_dateWidget; -}; - - - -/** @brief Allows to input a tag as search criterion. */ -class TagValue : public SearchCriterionValue -{ - Q_OBJECT - -public: - TagValue(QWidget* parent = 0); - virtual ~TagValue(); - virtual Nepomuk::Query::LiteralTerm value() const; - -protected: - virtual void showEvent(QShowEvent* event); - -private: - QComboBox* m_tags; -}; - - - -/** @brief Allows to input a file size value as search criterion. */ -class SizeValue : public SearchCriterionValue -{ - Q_OBJECT - -public: - SizeValue(QWidget* parent = 0); - virtual ~SizeValue(); - virtual Nepomuk::Query::LiteralTerm value() const; - - private: - KLineEdit* m_lineEdit; - QComboBox* m_units; -}; - -/** @brief Allows to input a rating value as search criterion. */ -class RatingValue : public SearchCriterionValue -{ - Q_OBJECT - -public: - RatingValue(QWidget* parent = 0); - virtual ~RatingValue(); - virtual Nepomuk::Query::LiteralTerm value() const; - - private: - KRatingWidget* m_ratingWidget; -}; - -#endif // SEARCHCRITERIONVALUE_H diff --git a/src/search/searchoptiondialogbox.cpp b/src/search/searchoptiondialogbox.cpp deleted file mode 100644 index ea59c2343..000000000 --- a/src/search/searchoptiondialogbox.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2010 by Laurent Montel * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License version 2 as published by the Free Software Foundation. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public License * - * along with this library; see the file COPYING.LIB. If not, write to * - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301, USA. * - *****************************************************************************/ - -#include "searchoptiondialogbox.h" - -#include -#include -#include -#include -#include - -SearchOptionDialogBox::SearchOptionDialogBox(QWidget* parent) : - KDialog(parent, Qt::Dialog) -{ - QWidget* container = new QWidget(this); - - QLabel* label = new QLabel(i18nc("@label", "Name:"), container); - m_lineEdit = new KLineEdit(container); - m_lineEdit->setMinimumWidth(250); - m_lineEdit->setClearButtonShown(true); - - connect(m_lineEdit, SIGNAL(textChanged(const QString&)), SLOT(slotTextChanged(const QString&))); - QHBoxLayout* layout = new QHBoxLayout(container); - layout->addWidget(label, Qt::AlignRight); - layout->addWidget(m_lineEdit); - - setMainWidget(container); - setCaption(i18nc("@title:window", "Save Search Options")); - setButtons(KDialog::Ok | KDialog::Cancel); - setDefaultButton(KDialog::Ok); - setButtonText(KDialog::Ok, i18nc("@action:button", "Save")); - - KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), - "SaveSearchOptionsDialog"); - restoreDialogSize(dialogConfig); - enableButtonOk(false); -} - -SearchOptionDialogBox::~SearchOptionDialogBox() -{ - KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), - "SaveSearchOptionsDialog"); - saveDialogSize(dialogConfig); -} - -QString SearchOptionDialogBox::text() const -{ - return m_lineEdit->text(); -} - -void SearchOptionDialogBox::slotTextChanged(const QString& text) -{ - enableButtonOk(!text.isEmpty()); -} - -#include "searchoptiondialogbox.moc" diff --git a/src/search/searchoptiondialogbox.h b/src/search/searchoptiondialogbox.h deleted file mode 100644 index 2d570c31e..000000000 --- a/src/search/searchoptiondialogbox.h +++ /dev/null @@ -1,42 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2010 by Laurent Montel * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License version 2 as published by the Free Software Foundation. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public License * - * along with this library; see the file COPYING.LIB. If not, write to * - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301, USA. * - *****************************************************************************/ - -#ifndef SEARCH_OPTIONDIALOGBOX -#define SEARCH_OPTIONDIALOGBOX - -#include - -class KLineEdit; - -class SearchOptionDialogBox : public KDialog -{ - Q_OBJECT - -public: - SearchOptionDialogBox(QWidget* parent); - virtual ~SearchOptionDialogBox(); - - QString text() const; - -protected slots: - void slotTextChanged(const QString& text); - -private: - KLineEdit* m_lineEdit; -}; -#endif diff --git a/src/statusbar/dolphinstatusbar.h b/src/statusbar/dolphinstatusbar.h index 6f5844270..5c626cf4b 100644 --- a/src/statusbar/dolphinstatusbar.h +++ b/src/statusbar/dolphinstatusbar.h @@ -78,12 +78,8 @@ public: /** * Sets the text for the progress information. - * The text is shown with a delay of 300 milliseconds: - * if the progress set by DolphinStatusBar::setProgress() - * does reach 100 % within 300 milliseconds, - * the progress text is not shown at all. This assures that - * no flickering occurs for showing a progress of fast - * operations. + * DolphinStatusBar::setProgress() should be invoked + * afterwards each time the progress changes. */ void setProgressText(const QString& text); QString progressText() const; @@ -137,7 +133,7 @@ private slots: void setZoomLevel(int zoomLevel); void zoomOut(); - void zoomIn(); + void zoomIn(); void showZoomSliderToolTip(int zoomLevel); private: @@ -146,7 +142,7 @@ private: /** * Makes the space information widget and zoom slider widget * visible, if \a visible is true and the settings allow to show - * the widgets. If \a visible is false, it is assured that both + * the widgets. showUnknownProgressIf \a visible is false, it is assured that both * widgets are hidden. */ void setExtensionsVisible(bool visible); -- 2.47.3