Commit 7b71ae4c authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Kåre Särs
Browse files

Use separate signals for each setting


Signed-off-by: Waqar Ahmed's avatarWaqar Ahmed <waqar.17a@gmail.com>
parent 0bcd7f83
......@@ -65,7 +65,9 @@ bool KateSearchCommand::exec(KTextEditor::View * /*view*/, const QString &cmd, Q
*/
else if (command == QLatin1String("preg")) {
Q_EMIT setSearchPlace(MatchModel::Project);
Q_EMIT setProjectRegexSearch();
Q_EMIT setRegexMode(true);
Q_EMIT setCaseInsensitive(true);
Q_EMIT setExpandResults(true);
Q_EMIT newTab();
}
......@@ -96,7 +98,7 @@ bool KateSearchCommand::help(KTextEditor::View * /*view*/, const QString &cmd, Q
}
else if (cmd.startsWith(QLatin1String("preg"))) {
msg = i18n("Usage: preg [pattern to search for in current project]");
msg = i18n("Usage: preg [regex pattern to search for in current project]");
}
return true;
......
......@@ -28,9 +28,11 @@ Q_SIGNALS:
void setSearchPlace(int place);
void setCurrentFolder();
void setSearchString(const QString &pattern);
void setProjectRegexSearch();
void startSearch();
void newTab();
void setRegexMode(bool enabled);
void setCaseInsensitive(bool enabled);
void setExpandResults(bool enabled);
//
// KTextEditor::Command
......
......@@ -221,7 +221,9 @@ QObject *KatePluginSearch::createView(KTextEditor::MainWindow *mainWindow)
connect(m_searchCommand, &KateSearchCommand::setCurrentFolder, view, &KatePluginSearchView::setCurrentFolder);
connect(m_searchCommand, &KateSearchCommand::setSearchString, view, &KatePluginSearchView::setSearchString);
connect(m_searchCommand, &KateSearchCommand::startSearch, view, &KatePluginSearchView::startSearch);
connect(m_searchCommand, &KateSearchCommand::setProjectRegexSearch, view, &KatePluginSearchView::setProjectRegexSearch);
connect(m_searchCommand, &KateSearchCommand::setRegexMode, view, &KatePluginSearchView::setRegexMode);
connect(m_searchCommand, &KateSearchCommand::setCaseInsensitive, view, &KatePluginSearchView::setCaseInsensitive);
connect(m_searchCommand, &KateSearchCommand::setExpandResults, view, &KatePluginSearchView::setExpandResults);
connect(m_searchCommand, SIGNAL(newTab()), view, SLOT(addTab()));
connect(view, &KatePluginSearchView::searchBusy, m_searchCommand, &KateSearchCommand::setBusy);
......@@ -1798,11 +1800,19 @@ void KatePluginSearchView::goToPreviousMatch()
}
}
void KatePluginSearchView::setProjectRegexSearch()
void KatePluginSearchView::setRegexMode(bool enabled)
{
m_ui.expandResults->setChecked(true);
m_ui.useRegExp->setChecked(true);
m_ui.matchCase->setChecked(true);
m_ui.useRegExp->setChecked(enabled);
}
void KatePluginSearchView::setCaseInsensitive(bool enabled)
{
m_ui.matchCase->setChecked(enabled);
}
void KatePluginSearchView::setExpandResults(bool enabled)
{
m_ui.expandResults->setChecked(enabled);
}
void KatePluginSearchView::readSessionConfig(const KConfigGroup &cg)
......
......@@ -107,7 +107,9 @@ public Q_SLOTS:
void setSearchPlace(int place);
void goToNextMatch();
void goToPreviousMatch();
void setProjectRegexSearch();
void setRegexMode(bool enabled);
void setCaseInsensitive(bool enabled);
void setExpandResults(bool enabled);
private:
enum CopyResultType { AllExpanded, All };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment