diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2014-03-09 14:13:10 +0900 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2015-12-23 02:22:41 +0100 |
commit | adf437b7e51afb73cf0f22352c2e96b9e8bf66c0 (patch) | |
tree | d0d5315e90ee838d7e0e9db7fb25ac0639f3b8e1 /kutils | |
parent | 18c445cb5b6270fa017d464d87d2690309d3ff29 (diff) | |
download | tdelibs-adf437b7e51afb73cf0f22352c2e96b9e8bf66c0.tar.gz tdelibs-adf437b7e51afb73cf0f22352c2e96b9e8bf66c0.zip |
In KFindDialog/KReplaceDialog the option "use placeholders" only makes
sense and works when searching using regular expressions.
This resolves bug 1863.
(cherry picked from commit 81515b6d1a00df00fadb0ff0748ca5faecf12ce7)
Diffstat (limited to 'kutils')
-rw-r--r-- | kutils/kfinddialog.cpp | 21 | ||||
-rw-r--r-- | kutils/kfinddialog.h | 4 |
2 files changed, 20 insertions, 5 deletions
diff --git a/kutils/kfinddialog.cpp b/kutils/kfinddialog.cpp index ef3c131cc..c5866dd04 100644 --- a/kutils/kfinddialog.cpp +++ b/kutils/kfinddialog.cpp @@ -149,8 +149,9 @@ void KFindDialog::init(bool forReplace, const TQStringList &findStrings, bool ha m_replace->setMaxCount(10); m_replace->setDuplicatesEnabled(false); m_backRef = new TQCheckBox(i18n("Use p&laceholders"), m_replaceGrp); + m_backRef->setEnabled(m_regExp->isChecked()); m_backRefItem = new TQPushButton(i18n("Insert Place&holder"), m_replaceGrp); - m_backRefItem->setEnabled(false); + m_backRefItem->setEnabled(m_regExp->isChecked() && m_backRef->isChecked()); m_replaceLayout->addWidget(m_replaceLabel, 0, 0); m_replaceLayout->addMultiCellWidget(m_replace, 1, 1, 0, 1); @@ -193,8 +194,8 @@ void KFindDialog::init(bool forReplace, const TQStringList &findStrings, bool ha // signals and slots connections connect(m_selectedText, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotSelectedTextToggled(bool))); - connect(m_regExp, TQT_SIGNAL(toggled(bool)), m_regExpItem, TQT_SLOT(setEnabled(bool))); - connect(m_backRef, TQT_SIGNAL(toggled(bool)), m_backRefItem, TQT_SLOT(setEnabled(bool))); + connect(m_regExp, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotRegexCheckBoxToggled(bool))); + connect(m_backRef, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPlaceholdersCheckBoxToggled(bool))); connect(m_regExpItem, TQT_SIGNAL(clicked()), this, TQT_SLOT(showPatterns())); connect(m_backRefItem, TQT_SIGNAL(clicked()), this, TQT_SLOT(showPlaceholders())); @@ -276,11 +277,23 @@ void KFindDialog::init(bool forReplace, const TQStringList &findStrings, bool ha "Ask before replacing each match found.") ); } -void KFindDialog::textSearchChanged( const TQString & text) +void KFindDialog::textSearchChanged(const TQString & text) { enableButtonOK( !text.isEmpty() ); } +void KFindDialog::slotRegexCheckBoxToggled(bool checked) +{ + m_regExpItem->setEnabled(checked); + m_backRef->setEnabled(checked); + m_backRefItem->setEnabled(checked && m_backRef->isChecked()); +} + +void KFindDialog::slotPlaceholdersCheckBoxToggled(bool checked) +{ + m_backRefItem->setEnabled(checked && m_regExp->isChecked()); +} + void KFindDialog::showEvent( TQShowEvent *e ) { if ( !d->m_initialShowDone ) diff --git a/kutils/kfinddialog.h b/kutils/kfinddialog.h index fcf870836..0f979ab49 100644 --- a/kutils/kfinddialog.h +++ b/kutils/kfinddialog.h @@ -250,7 +250,9 @@ protected slots: void slotSelectedTextToggled(bool); void showPatterns(); void showPlaceholders(); - void textSearchChanged( const TQString &); + void textSearchChanged(const TQString &); + void slotRegexCheckBoxToggled(bool checked); + void slotPlaceholdersCheckBoxToggled(bool checked); protected: virtual void showEvent ( TQShowEvent * ); |