From 46f61ed2b35896e05f17cf99812ddd6614a486f7 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 4 Jan 2015 20:38:02 +0900 Subject: [PATCH] Added option to suppress 'Find in files' error dialog in Kate. This resolves bug 1911. Signed-off-by: Michele Calgaro --- doc/kate/mdi.docbook | 8 ++++++++ kate/app/kategrepdialog.cpp | 26 +++++++++++++++++++++----- kate/app/kategrepdialog.h | 4 +++- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/doc/kate/mdi.docbook b/doc/kate/mdi.docbook index 993682b6e..6a8020747 100644 --- a/doc/kate/mdi.docbook +++ b/doc/kate/mdi.docbook @@ -340,6 +340,14 @@ It is possible to specify multiple patterns by separating them with commas + +Hide errors + +If checked, the dialog window showing the search errors will +not be displayed at the end of the search. + + + Folder diff --git a/kate/app/kategrepdialog.cpp b/kate/app/kategrepdialog.cpp index 7713400aa..70f067100 100644 --- a/kate/app/kategrepdialog.cpp +++ b/kate/app/kategrepdialog.cpp @@ -149,13 +149,22 @@ GrepTool::GrepTool(TQWidget *parent, const char *name) lFiles->setFixedSize(lFiles->sizeHint()); loInput->addWidget(lFiles, 2, 0, Qt::AlignRight | Qt::AlignVCenter); + TQBoxLayout *loFiles = new TQHBoxLayout( 2 ); + loInput->addLayout( loFiles, 2, 1 ); + cmbFiles = new KComboBox(true, this); lFiles->setBuddy(TQT_TQWIDGET(cmbFiles->focusProxy())); cmbFiles->setMinimumSize(cmbFiles->sizeHint()); cmbFiles->setInsertionPolicy(TQComboBox::NoInsertion); cmbFiles->setDuplicatesEnabled(false); cmbFiles->insertStringList(lastSearchFiles); - loInput->addWidget(cmbFiles, 2, 1); + loFiles->addWidget(cmbFiles); + + cbHideErrors = new TQCheckBox( i18n("Hide errors"), this ); + cbHideErrors->setMinimumWidth( cbHideErrors->sizeHint().width() ); + cbHideErrors->setChecked( config->readBoolEntry( "HideErrors", false ) ); + loFiles->addWidget(cbHideErrors); + loFiles->setStretchFactor(cmbFiles, 100); TQLabel *lDir = new TQLabel(i18n("Folder:"), this); lDir->setFixedSize(lDir->sizeHint()); @@ -199,8 +208,8 @@ GrepTool::GrepTool(TQWidget *parent, const char *name) TQWhatsThis::add(lPattern, i18n("

Enter the expression you want to search for here." - "

If 'regular expression' is unchecked, any non-space letters in your " - "expression will be escaped with a backslash character." + "

If 'regular expression' is unchecked, all characters that are not " + "letters in your expression will be escaped with a backslash character." "

Possible meta characters are:
" ". - Matches any character
" "^ - Matches the beginning of a line
" @@ -243,6 +252,9 @@ GrepTool::GrepTool(TQWidget *parent, const char *name) i18n("The results of the grep run are listed here. Select a\n" "filename/line number combination and press Enter or doubleclick\n" "on the item to show the respective line in the editor.")); + TQWhatsThis::add( cbHideErrors, i18n( + "

If this is checked, the dialog window showing the search errors " + "will not be displayed at the end of the search.") ); // event filter, do something relevant for RETURN cmbPattern->installEventFilter( this ); @@ -460,6 +472,7 @@ void GrepTool::finish() config->writeEntry("Recursive", cbRecursive->isChecked()); config->writeEntry("CaseSensitive", cbCasesensitive->isChecked()); config->writeEntry("Regex", cbRegex->isChecked()); + config->writeEntry("HideErrors", cbHideErrors->isChecked()); } void GrepTool::slotCancel() @@ -474,9 +487,12 @@ void GrepTool::childExited() btnClear->setEnabled( true ); btnSearch->setGuiItem( KGuiItem(i18n("Find"), "edit-find") ); - if ( ! errbuf.isEmpty() ) + if ( !errbuf.isEmpty()) { - KMessageBox::information( parentWidget(), i18n("Error:

") + errbuf, i18n("Grep Tool Error") ); + if (!cbHideErrors->isChecked()) + { + KMessageBox::information( parentWidget(), i18n("Error:

") + errbuf, i18n("Grep Tool Error") ); + } errbuf.truncate(0); } else diff --git a/kate/app/kategrepdialog.h b/kate/app/kategrepdialog.h index a3cbbc871..1bd930735 100644 --- a/kate/app/kategrepdialog.h +++ b/kate/app/kategrepdialog.h @@ -79,7 +79,9 @@ private: KComboBox *cmbFiles, *cmbPattern; KURLRequester *cmbDir; TQCheckBox *cbRecursive; - TQCheckBox *cbCasesensitive, *cbRegex; + TQCheckBox *cbCasesensitive; + TQCheckBox *cbRegex; + TQCheckBox *cbHideErrors; TQListBox *lbResult; KPushButton *btnSearch, *btnClear; TDEProcess *childproc;