diff --git a/krusader/Dialogs/kurllistrequester.h b/krusader/Dialogs/kurllistrequester.h --- a/krusader/Dialogs/kurllistrequester.h +++ b/krusader/Dialogs/kurllistrequester.h @@ -32,6 +32,9 @@ #include "../GUI/krlistwidget.h" +/** + * Widget for letting the user define a list of URLs. + */ class KURLListRequester : public QWidget { Q_OBJECT @@ -41,39 +44,33 @@ explicit KURLListRequester(Mode requestMode, QWidget *parent = 0); - QList urlList(); - void setUrlList(QList); + QList urlList(); + void setUrlList(const QList &); - KLineEdit *lineEdit() { - return urlLineEdit; - } - KrListWidget *listBox() { - return urlListBox; - } + KLineEdit *lineEdit() { return urlLineEdit; } + KrListWidget *listBox() { return urlListBox; } - void setCompletionDir(const QUrl &dir) { - completion.setDir(dir); - } + void setCompletionDir(const QUrl &dir) { completion.setDir(dir); } signals: - void checkValidity(QString &text, QString &error); - void changed(); + void checkValidity(QString &text, QString &error); + void changed(); protected slots: - void slotAdd(); - void slotBrowse(); - void slotRightClicked(QListWidgetItem *, const QPoint &); + void slotAdd(); + void slotBrowse(); + void slotRightClicked(QListWidgetItem *, const QPoint &); protected: virtual void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE; - void deleteSelectedItems(); + void deleteSelectedItems(); - Mode mode; + Mode mode; - KLineEdit *urlLineEdit; + KLineEdit *urlLineEdit; KrListWidget *urlListBox; - QToolButton *urlAddBtn; - QToolButton *urlBrowseBtn; + QToolButton *urlAddBtn; + QToolButton *urlBrowseBtn; KUrlCompletion completion; }; diff --git a/krusader/Dialogs/kurllistrequester.cpp b/krusader/Dialogs/kurllistrequester.cpp --- a/krusader/Dialogs/kurllistrequester.cpp +++ b/krusader/Dialogs/kurllistrequester.cpp @@ -49,10 +49,6 @@ urlLineEdit = new KLineEdit(this); urlListRequesterGrid->addWidget(urlLineEdit, 0, 0); - urlListBox = new KrListWidget(this); - urlListBox->setSelectionMode(QAbstractItemView::ExtendedSelection); - urlListRequesterGrid->addWidget(urlListBox, 1, 0, 1, 3); - urlAddBtn = new QToolButton(this); urlAddBtn->setText(""); urlAddBtn->setIcon(Icon("arrow-down")); @@ -63,19 +59,22 @@ urlBrowseBtn->setIcon(Icon("folder")); urlListRequesterGrid->addWidget(urlBrowseBtn, 0, 2); + urlListBox = new KrListWidget(this); + urlListBox->setSelectionMode(QAbstractItemView::ExtendedSelection); + urlListRequesterGrid->addWidget(urlListBox, 1, 0, 1, 3); + // add shell completion completion.setMode(KUrlCompletion::FileCompletion); urlLineEdit->setCompletionObject(&completion); // connection table - connect(urlAddBtn, SIGNAL(clicked()), this, SLOT(slotAdd())); - connect(urlBrowseBtn, SIGNAL(clicked()), this, SLOT(slotBrowse())); - connect(urlLineEdit, SIGNAL(returnPressed(QString)), this, SLOT(slotAdd())); - connect(urlListBox, SIGNAL(itemRightClicked(QListWidgetItem*,QPoint)), this, - SLOT(slotRightClicked(QListWidgetItem*,QPoint))); - connect(urlLineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed())); + connect(urlAddBtn, &QToolButton::clicked, this, &KURLListRequester::slotAdd); + connect(urlBrowseBtn, &QToolButton::clicked, this, &KURLListRequester::slotBrowse); + connect(urlLineEdit, &KLineEdit::returnPressed, this, &KURLListRequester::slotAdd); + connect(urlListBox, &KrListWidget::itemRightClicked, this, &KURLListRequester::slotRightClicked); + connect(urlLineEdit, &KLineEdit::textChanged, this, &KURLListRequester::changed); } void KURLListRequester::slotAdd() @@ -125,9 +124,9 @@ void KURLListRequester::deleteSelectedItems() { - QList delList = urlListBox->selectedItems(); - for (int i = 0; i != delList.count(); i++) - delete delList[ i ]; + QList selectedItems = urlListBox->selectedItems(); + for (QListWidgetItem *item : selectedItems) + delete item; emit changed(); } @@ -151,21 +150,20 @@ QList KURLListRequester::urlList() { - QList urls; + QStringList lines; - QString text = urlLineEdit->text().simplified(); - if (!text.isEmpty()) { - QString error; - emit checkValidity(text, error); - if (error.isNull()) - urls.append(QUrl::fromUserInput(text, QString(), QUrl::AssumeLocalFile)); + const QString lineEditText = urlLineEdit->text().simplified(); + if (!lineEditText.isEmpty()) { + lines.append(lineEditText); } for (int i = 0; i != urlListBox->count(); i++) { QListWidgetItem *item = urlListBox->item(i); + lines.append(item->text().simplified()); + } - QString text = item->text().simplified(); - + QList urls; + for (QString text : lines) { QString error; emit checkValidity(text, error); if (error.isNull()) @@ -175,15 +173,14 @@ return urls; } -void KURLListRequester::setUrlList(QList urlList) +void KURLListRequester::setUrlList(const QList &urlList) { urlLineEdit->clear(); urlListBox->clear(); - QList::iterator it; - - for (it = urlList.begin(); it != urlList.end(); ++it) - urlListBox->addItem(it->toDisplayString(QUrl::PreferLocalFile)); + for (const QUrl url : urlList) { + urlListBox->addItem(url.toDisplayString(QUrl::PreferLocalFile)); + } emit changed(); } diff --git a/krusader/Filter/generalfilter.h b/krusader/Filter/generalfilter.h --- a/krusader/Filter/generalfilter.h +++ b/krusader/Filter/generalfilter.h @@ -83,7 +83,7 @@ KURLListRequester *searchIn; KURLListRequester *dontSearchIn; - QHBoxLayout *middleLayout; + QLayout *middleLayout; KHistoryComboBox* searchFor; KHistoryComboBox* containsText; @@ -110,6 +110,9 @@ FilterTabs *fltTabs; +private: + QCheckBox *createExcludeCheckBox(const KConfigGroup &group); + KHistoryComboBox *createExcludeComboBox(const KConfigGroup &group); }; #endif /* GENERALFILTER_H */ diff --git a/krusader/Filter/generalfilter.cpp b/krusader/Filter/generalfilter.cpp --- a/krusader/Filter/generalfilter.cpp +++ b/krusader/Filter/generalfilter.cpp @@ -124,7 +124,29 @@ searchForLabel->setBuddy(searchFor); nameGroupLayout->addWidget(searchFor, 0, 1, 1, 2); - QString s = "

" + i18n("

The filename filtering criteria is defined here.

You can make use of wildcards. Multiple patterns are separated by space (means logical OR) and patterns are excluded from the search using the pipe symbol.

If the pattern is ended with a slash (*pattern*/), that means that pattern relates to recursive search of folders.

  • pattern - means to search those files/folders that name is pattern, recursive search goes through all subfolders independently of the value of pattern
  • pattern/ - means to search all files/folders, but recursive search goes through/excludes the folders that name is pattern

It is allowed to use quotation marks for names that contain space. Filter \"Program Files\" searches out those files/folders that name is Program Files.

Examples:

  • *.o
  • *.h *.c\?\?
  • *.cpp *.h | *.moc.cpp
  • * | .svn/ .git/

Note: the search term 'text' is equivalent to '*text*'.

"); + const QString s = "

" + + i18n("

The filename filtering criteria is defined here.

" + "

You can make use of wildcards. Multiple patterns are separated by " + "space (means logical OR) and patterns are excluded from the search " + "using the pipe symbol.

" + "

If the pattern is ended with a slash (*pattern*/), " + "that means that pattern relates to recursive search of folders." + "

  • pattern - means to search those files/folders " + "that name is pattern, recursive search goes through all " + "subfolders independently of the value of pattern
  • " + "
  • pattern/ - means to search all files/folders, but " + "recursive search goes through/excludes the folders that name is " + "pattern

" + "

It is allowed to use quotation marks for names that contain space." + " Filter \"Program Files\" searches out those " + "files/folders that name is Program Files.

" + "

Examples:

    " + "
  • *.o
  • " + "
  • *.h *.c\?\?
  • " + "
  • *.cpp *.h | *.moc.cpp
  • " + "
  • * | .svn/ .git/

" + "Note: the search term 'text' is equivalent to " + "'*text*'.

"); searchFor->setWhatsThis(s); searchForLabel->setWhatsThis(s); @@ -154,8 +176,6 @@ middleLayout = new QHBoxLayout(); middleLayout->setSpacing(6); middleLayout->setContentsMargins(0, 0, 0, 0); - QSpacerItem* middleSpacer = new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Fixed); - middleLayout->addItem(middleSpacer); if (properties & FilterTabs::HasProfileHandler) { // The profile handler @@ -198,64 +218,47 @@ if (properties & FilterTabs::HasSearchIn) { // Options for search in + QGroupBox *searchGroupBox = new QGroupBox(i18n("Searc&h in"), this); + QGridLayout *searchLayout = new QGridLayout(searchGroupBox); + searchLayout->setAlignment(Qt::AlignTop); + searchLayout->setSpacing(6); + searchLayout->setContentsMargins(11, 11, 11, 11); - QGroupBox *searchInGroup = new QGroupBox(this); - searchInGroup->setTitle(i18n("Searc&h in")); - QGridLayout *searchInLayout = new QGridLayout(searchInGroup); - searchInLayout->setAlignment(Qt::AlignTop); - searchInLayout->setSpacing(6); - searchInLayout->setContentsMargins(11, 11, 11, 11); + searchIn = new KURLListRequester(KURLListRequester::RequestDirs, searchGroupBox); + searchLayout->addWidget(searchIn, 0, 0); + connect(searchIn, &KURLListRequester::changed, this, &GeneralFilter::slotDisable); - searchIn = new KURLListRequester(KURLListRequester::RequestDirs, searchInGroup); - searchInLayout->addWidget(searchIn, 0, 0); - connect(searchIn, SIGNAL(changed()), this, SLOT(slotDisable())); - - middleLayout->addWidget(searchInGroup); + middleLayout->addWidget(searchGroupBox); } if (properties & FilterTabs::HasDontSearchIn) { // Options for don't search in + QGroupBox *searchGroupBox = new QGroupBox(i18n("&Do not search in"), this); + QGridLayout *searchLayout = new QGridLayout(searchGroupBox); + searchLayout->setAlignment(Qt::AlignTop); + searchLayout->setSpacing(6); + searchLayout->setContentsMargins(11, 11, 11, 11); - QGroupBox *dontSearchInGroup = new QGroupBox(this); - dontSearchInGroup->setTitle(i18n("&Do not search in")); - QGridLayout *dontSearchInLayout = new QGridLayout(dontSearchInGroup); - dontSearchInLayout->setAlignment(Qt::AlignTop); - dontSearchInLayout->setSpacing(6); - dontSearchInLayout->setContentsMargins(11, 11, 11, 11); - - dontSearchIn = new KURLListRequester(KURLListRequester::RequestDirs, dontSearchInGroup); - dontSearchInLayout->addWidget(dontSearchIn, 0, 0, 1, 2); + dontSearchIn = new KURLListRequester(KURLListRequester::RequestDirs, searchGroupBox); + searchLayout->addWidget(dontSearchIn, 0, 0, 1, 2); if (properties & FilterTabs::HasRecurseOptions) { KConfigGroup group(krConfig, "Search"); - useExcludeFolderNames = new QCheckBox(this); - useExcludeFolderNames->setText(i18n("Exclude Folder Names")); - useExcludeFolderNames->setToolTip(i18n("Filters out specified directory names from the results.")); - useExcludeFolderNames->setChecked(static_cast(group.readEntry("ExcludeFolderNamesUse", 0))); - dontSearchInLayout->addWidget(useExcludeFolderNames, 1, 0, 1, 1); - - excludeFolderNames = new KHistoryComboBox(false, dontSearchInGroup); - QSizePolicy excludeFolderNamesPolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - excludeFolderNamesPolicy.setHeightForWidth(excludeFolderNames->sizePolicy().hasHeightForWidth()); - excludeFolderNames->setSizePolicy(excludeFolderNamesPolicy); - excludeFolderNames->setEditable(true); - excludeFolderNames->setDuplicatesEnabled(false); - excludeFolderNames->setMaxCount(25); - excludeFolderNames->setMinimumContentsLength(10); - excludeFolderNames->lineEdit()->setPlaceholderText(i18n("Enter space-separated folder names")); - excludeFolderNames->lineEdit()->setWhatsThis(i18n("You can insert names with escaped spaces or quoted.\nExample: .git \"target build\" build\\ krusader")); - dontSearchInLayout->addWidget(excludeFolderNames, 1, 1, 1, 1); - excludeFolderNames->setHistoryItems(group.readEntry("ExcludeFolderNamesHistory", QStringList())); - excludeFolderNames->setEditText(group.readEntry("ExcludeFolderNames", "")); + useExcludeFolderNames = createExcludeCheckBox(group); + searchLayout->addWidget(useExcludeFolderNames, 1, 0, 1, 1); + + excludeFolderNames = createExcludeComboBox(group); + searchLayout->addWidget(excludeFolderNames, 1, 1, 1, 1); + if (!useExcludeFolderNames->isChecked()) { excludeFolderNames->setDisabled(true); } connect(useExcludeFolderNames, &QCheckBox::toggled, excludeFolderNames, &KHistoryComboBox::setEnabled); } - middleLayout->addWidget(dontSearchInGroup); + middleLayout->addWidget(searchGroupBox); } filterLayout->addLayout(middleLayout, 1, 0); @@ -300,8 +303,8 @@ patterns->addAction(new RegExpAction(patterns, i18n(items[i].description), items[i].regExp, items[i].cursorAdjustment)); } - connect(containsRegExp, SIGNAL(toggled(bool)), this, SLOT(slotDisable())); - connect(containsRegExp, SIGNAL(triggered(QAction*)), this, SLOT(slotRegExpTriggered(QAction*))); + connect(containsRegExp, &QToolButton::toggled, this, &GeneralFilter::slotDisable); + connect(containsRegExp, &QToolButton::triggered, this, &GeneralFilter::slotRegExpTriggered); containsRegExp->setMenu(patterns); patterns->setEnabled(false); @@ -378,13 +381,13 @@ // Connection table if (properties & FilterTabs::HasProfileHandler) { - connect(profileAddBtn, SIGNAL(clicked()) , this, SLOT(slotAddBtnClicked())); - connect(profileLoadBtn, SIGNAL(clicked()) , this, SLOT(slotLoadBtnClicked())); - connect(profileOverwriteBtn, SIGNAL(clicked()) , this, SLOT(slotOverwriteBtnClicked())); - connect(profileRemoveBtn, SIGNAL(clicked()) , this, SLOT(slotRemoveBtnClicked())); - connect(profileListBox, SIGNAL(itemDoubleClicked(QListWidgetItem*)) , this, SLOT(slotProfileDoubleClicked(QListWidgetItem*))); - connect(profileManager, SIGNAL(loadFromProfile(QString)), fltTabs, SLOT(loadFromProfile(QString))); - connect(profileManager, SIGNAL(saveToProfile(QString)), fltTabs, SLOT(saveToProfile(QString))); + connect(profileAddBtn, &QPushButton::clicked, this, &GeneralFilter::slotAddBtnClicked); + connect(profileLoadBtn, &QPushButton::clicked, this, &GeneralFilter::slotLoadBtnClicked); + connect(profileOverwriteBtn, &QPushButton::clicked, this, &GeneralFilter::slotOverwriteBtnClicked); + connect(profileRemoveBtn, &QPushButton::clicked, this, &GeneralFilter::slotRemoveBtnClicked); + connect(profileListBox, &KrListWidget::itemDoubleClicked, this, &GeneralFilter::slotProfileDoubleClicked); + connect(profileManager, &ProfileManager::loadFromProfile, fltTabs, &FilterTabs::loadFromProfile); + connect(profileManager, &ProfileManager::saveToProfile, fltTabs, &FilterTabs::saveToProfile); } connect(searchFor, SIGNAL(activated(QString)), searchFor, SLOT(addToHistory(QString))); @@ -470,6 +473,34 @@ } } +QCheckBox *GeneralFilter::createExcludeCheckBox(const KConfigGroup &group) +{ + QCheckBox *excludeCheckBox = new QCheckBox(this); + excludeCheckBox->setText(i18n("Exclude Folder Names")); + excludeCheckBox->setToolTip(i18n("Filters out specified directory names from the results.")); + excludeCheckBox->setChecked(static_cast(group.readEntry("ExcludeFolderNamesUse", 0))); + return excludeCheckBox; +} + +KHistoryComboBox *GeneralFilter::createExcludeComboBox(const KConfigGroup &group) +{ + KHistoryComboBox *excludeComboBox = new KHistoryComboBox(false, this); + QSizePolicy excludeFolderNamesPolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + excludeFolderNamesPolicy.setHeightForWidth(excludeComboBox->sizePolicy().hasHeightForWidth()); + excludeComboBox->setSizePolicy(excludeFolderNamesPolicy); + excludeComboBox->setEditable(true); + excludeComboBox->setDuplicatesEnabled(false); + excludeComboBox->setMaxCount(25); + excludeComboBox->setMinimumContentsLength(10); + excludeComboBox->lineEdit()->setPlaceholderText(i18n("Enter space-separated folder names")); + excludeComboBox->lineEdit()->setWhatsThis( + i18n("You can insert names with escaped spaces or quoted.\nExample: .git \"target " + "build\" build\\ krusader")); + excludeComboBox->setHistoryItems(group.readEntry("ExcludeFolderNamesHistory", QStringList())); + excludeComboBox->setEditText(group.readEntry("ExcludeFolderNames", "")); + return excludeComboBox; +} + void GeneralFilter::slotAddBtnClicked() { profileManager->newProfile(searchFor->currentText().simplified()); diff --git a/krusader/GUI/krlistwidget.h b/krusader/GUI/krlistwidget.h --- a/krusader/GUI/krlistwidget.h +++ b/krusader/GUI/krlistwidget.h @@ -33,9 +33,6 @@ signals: void itemRightClicked(QListWidgetItem * it, const QPoint & pos); - -protected: - virtual bool event(QEvent * event) Q_DECL_OVERRIDE; }; #endif /* KRLISTVIEW_H */ diff --git a/krusader/GUI/krlistwidget.cpp b/krusader/GUI/krlistwidget.cpp --- a/krusader/GUI/krlistwidget.cpp +++ b/krusader/GUI/krlistwidget.cpp @@ -24,41 +24,15 @@ // QtGui #include -KrListWidget::KrListWidget(QWidget * parent) : QListWidget(parent) +KrListWidget::KrListWidget(QWidget *parent) : QListWidget(parent) { KrStyleProxy *style = new KrStyleProxy(); style->setParent(this); setStyle(style); -} - -bool KrListWidget::event(QEvent * event) -{ - switch (event->type()) { - // HACK: QT 4 Context menu key isn't handled properly - case QEvent::ContextMenu: { - QContextMenuEvent* ce = (QContextMenuEvent*) event; - - if (ce->reason() == QContextMenuEvent::Mouse) { - QPoint pos = viewport()->mapFromGlobal(ce->globalPos()); - - QListWidgetItem * item = itemAt(pos); - - emit itemRightClicked(item, ce->globalPos()); - return true; - } else { - if (currentItem()) { - QRect r = visualItemRect(currentItem()); - QPoint p = viewport()->mapToGlobal(QPoint(r.x() + 5, r.y() + 5)); - - emit itemRightClicked(currentItem(), p); - return true; - } - } - } - break; - default: - break; - } - return QListWidget::event(event); + setContextMenuPolicy(Qt::CustomContextMenu); + connect(this, &QListWidget::customContextMenuRequested, [=](const QPoint &pos) { + QListWidgetItem *item = itemAt(pos); + emit itemRightClicked(item, viewport()->mapToGlobal(pos)); + }); } diff --git a/krusader/Search/krsearchdialog.h b/krusader/Search/krsearchdialog.h --- a/krusader/Search/krsearchdialog.h +++ b/krusader/Search/krsearchdialog.h @@ -106,6 +106,7 @@ SearchResultContainer *result; KrView *resultView; KrSearchBar *searchBar; + QFrame *foundTextFrame; KRQuery *query; KRSearchMod *searcher; diff --git a/krusader/Search/krsearchdialog.cpp b/krusader/Search/krsearchdialog.cpp --- a/krusader/Search/krsearchdialog.cpp +++ b/krusader/Search/krsearchdialog.cpp @@ -163,12 +163,6 @@ QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); buttonsLayout->addItem(spacer); - mainFeedToListBoxBtn = new QPushButton(this); - mainFeedToListBoxBtn->setText(i18n("Feed to listbox")); - mainFeedToListBoxBtn->setIcon(Icon("list-add")); - mainFeedToListBoxBtn->setEnabled(false); - buttonsLayout->addWidget(mainFeedToListBoxBtn); - mainSearchBtn = new QPushButton(this); mainSearchBtn->setText(i18n("Search")); mainSearchBtn->setIcon(Icon("edit-find")); @@ -202,27 +196,6 @@ // creating the result tab - QHBoxLayout* resultLabelLayout = new QHBoxLayout(); - resultLabelLayout->setSpacing(6); - resultLabelLayout->setContentsMargins(0, 0, 0, 0); - - foundLabel = new QLabel(resultTab); - QSizePolicy foundpolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); - foundpolicy.setHeightForWidth(foundLabel->sizePolicy().hasHeightForWidth()); - foundLabel->setSizePolicy(foundpolicy); - foundLabel->setFrameShape(QLabel::StyledPanel); - foundLabel->setFrameShadow(QLabel::Sunken); - foundLabel->setText(i18n("Found 0 matches.")); - resultLabelLayout->addWidget(foundLabel); - - searchingLabel = new KSqueezedTextLabel(resultTab); - searchingLabel->setFrameShape(QLabel::StyledPanel); - searchingLabel->setFrameShadow(QLabel::Sunken); - searchingLabel->setText(""); - resultLabelLayout->addWidget(searchingLabel); - - resultLayout->addLayout(resultLabelLayout, 2, 0); - // creating the result list view result = new SearchResultContainer(this); // the view @@ -235,30 +208,45 @@ resultView->setFiles(result); resultView->refresh(); resultLayout->addWidget(resultView->widget(), 0, 0); - // search bar + // search bar - hidden by default searchBar = new KrSearchBar(resultView, this); searchBar->hide(); resultLayout->addWidget(searchBar, 1, 0); + // text found row + foundTextFrame = new QFrame(resultTab); + foundTextFrame->setFrameShape(QLabel::StyledPanel); + foundTextFrame->setFrameShadow(QLabel::Sunken); + QHBoxLayout* foundTextLayout = new QHBoxLayout(); foundTextLayout->setSpacing(6); - foundTextLayout->setContentsMargins(0, 0, 0, 0); - - QLabel *l1 = new QLabel(resultTab); - QSizePolicy l1policy(QSizePolicy::Minimum, QSizePolicy::Minimum); - l1policy.setHeightForWidth(l1->sizePolicy().hasHeightForWidth()); - l1->setSizePolicy(l1policy); - l1->setFrameShape(QLabel::StyledPanel); - l1->setFrameShadow(QLabel::Sunken); - l1->setText(i18n("Text found:")); - foundTextLayout->addWidget(l1); + QLabel *textFoundLabel = new QLabel(i18n("Text found:"), resultTab); + foundTextLayout->addWidget(textFoundLabel); foundTextLabel = new KrSqueezedTextLabel(resultTab); - foundTextLabel->setFrameShape(QLabel::StyledPanel); - foundTextLabel->setFrameShadow(QLabel::Sunken); - foundTextLabel->setText(""); foundTextLayout->addWidget(foundTextLabel); - resultLayout->addLayout(foundTextLayout, 3, 0); + + foundTextFrame->setLayout(foundTextLayout); + foundTextFrame->hide(); + + resultLayout->addWidget(foundTextFrame, 2, 0); + + // result info row + QHBoxLayout* resultLabelLayout = new QHBoxLayout(); + resultLabelLayout->setSpacing(6); + resultLabelLayout->setContentsMargins(0, 0, 0, 0); + + searchingLabel = new KSqueezedTextLabel(i18n("Idle"), resultTab); + resultLabelLayout->addWidget(searchingLabel); + + foundLabel = new QLabel("", resultTab); + resultLabelLayout->addWidget(foundLabel); + + mainFeedToListBoxBtn = new QPushButton(QIcon::fromTheme("list-add"), i18n("Feed to listbox"), this); + mainFeedToListBoxBtn->setEnabled(false); + resultLabelLayout->addWidget(mainFeedToListBoxBtn); + + resultLayout->addLayout(resultLabelLayout, 3, 0); searcherTabs->addTab(resultTab, i18n("&Results")); @@ -417,16 +405,21 @@ } // prepare the gui /////////////////////////////////////////////// - mainSearchBtn->setEnabled(false); - mainCloseBtn->setEnabled(false); - mainStopBtn->setEnabled(true); - mainFeedToListBoxBtn->setEnabled(false); result->clear(); resultView->setSortMode(KrViewProperties::NoColumn, 0); + + foundTextFrame->setVisible(!query->content().isEmpty()); + foundTextLabel->setText(""); + searchingLabel->setText(""); foundLabel->setText(i18n("Found 0 matches.")); + mainFeedToListBoxBtn->setEnabled(false); + + mainSearchBtn->setEnabled(false); + mainStopBtn->setEnabled(true); + mainCloseBtn->setEnabled(false); + searcherTabs->setCurrentIndex(2); // show the results page - foundTextLabel->setText(""); isBusy = true; @@ -436,10 +429,9 @@ if (searcher != 0) abort(); searcher = new KRSearchMod(query); - connect(searcher, SIGNAL(searching(QString)), - searchingLabel, SLOT(setText(QString))); + connect(searcher, &KRSearchMod::searching, searchingLabel, &KSqueezedTextLabel::setText); connect(searcher, &KRSearchMod::found, this, &KrSearchDialog::slotFound); - connect(searcher, SIGNAL(finished()), this, SLOT(stopSearch())); + connect(searcher, &KRSearchMod::finished, this, &KrSearchDialog::stopSearch); searcher->start(); @@ -601,11 +593,10 @@ int listBoxNum = group.readEntry("Feed To Listbox Counter", 1); QString queryName; if(query) { - QString where = KrServices::toStringList(query->searchInDirs()).join(", "); - if(query->content().isEmpty()) - queryName = i18n("Search results for \"%1\" in %2", query->nameFilter(), where); - else - queryName = i18n("Search results for \"%1\" containing \"%2\" in %3", query->nameFilter(), query->content(), where); + const QString where = KrServices::toStringList(query->searchInDirs()).join(", "); + queryName = query->content().isEmpty() ? + i18n("Search results for \"%1\" in %2", query->nameFilter(), where) : + i18n("Search results for \"%1\" containing \"%2\" in %3", query->nameFilter(), query->content(), where); } QString fileSystemName; do { diff --git a/krusader/Synchronizer/synchronizergui.cpp b/krusader/Synchronizer/synchronizergui.cpp --- a/krusader/Synchronizer/synchronizergui.cpp +++ b/krusader/Synchronizer/synchronizergui.cpp @@ -560,8 +560,8 @@ connect(fileFilter, SIGNAL(currentTextChanged(QString)), this, SLOT(connectFilters(QString))); connect(generalFilter->searchFor, SIGNAL(currentTextChanged(QString)), this, SLOT(connectFilters(QString))); connect(generalFilter->searchFor, SIGNAL(currentTextChanged(QString)), this, SLOT(setCompletion())); - connect(generalFilter->dontSearchIn, SIGNAL(checkValidity(QString&,QString&)), - this, SLOT(checkExcludeURLValidity(QString&,QString&))); + connect(generalFilter->dontSearchIn, &KURLListRequester::checkValidity, + this, &SynchronizerGUI::checkExcludeURLValidity); connect(profileManager, SIGNAL(loadFromProfile(QString)), filterTabs, SLOT(loadFromProfile(QString))); connect(profileManager, SIGNAL(saveToProfile(QString)), filterTabs, SLOT(saveToProfile(QString)));