summaryrefslogtreecommitdiffstats
path: root/kutils/kreplace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kutils/kreplace.cpp')
-rw-r--r--kutils/kreplace.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/kutils/kreplace.cpp b/kutils/kreplace.cpp
index 856d330d5..f825e93cc 100644
--- a/kutils/kreplace.cpp
+++ b/kutils/kreplace.cpp
@@ -35,7 +35,7 @@ class KReplaceNextDialog : public KDialogBase
{
public:
KReplaceNextDialog( TQWidget *parent );
- void setLabel( const TQString& pattern, const TQString& tqreplacement );
+ void setLabel( const TQString& pattern, const TQString& replacement );
private:
TQLabel* m_mainLabel;
};
@@ -50,28 +50,28 @@ KReplaceNextDialog::KReplaceNextDialog(TQWidget *parent) :
{
m_mainLabel = new TQLabel( this );
setMainWidget( m_mainLabel );
- resize(tqminimumSize());
+ resize(minimumSize());
}
-void KReplaceNextDialog::setLabel( const TQString& pattern, const TQString& tqreplacement )
+void KReplaceNextDialog::setLabel( const TQString& pattern, const TQString& replacement )
{
- m_mainLabel->setText( i18n("Replace '%1' with '%2'?").arg(pattern).arg(tqreplacement) );
+ m_mainLabel->setText( i18n("Replace '%1' with '%2'?").arg(pattern).arg(replacement) );
}
////
-KReplace::KReplace(const TQString &pattern, const TQString &tqreplacement, long options, TQWidget *parent) :
+KReplace::KReplace(const TQString &pattern, const TQString &replacement, long options, TQWidget *parent) :
KFind( pattern, options, parent )
{
- m_tqreplacements = 0;
- m_tqreplacement = tqreplacement;
+ m_replacements = 0;
+ m_replacement = replacement;
}
-KReplace::KReplace(const TQString &pattern, const TQString &tqreplacement, long options, TQWidget *parent, TQWidget *dlg) :
+KReplace::KReplace(const TQString &pattern, const TQString &replacement, long options, TQWidget *parent, TQWidget *dlg) :
KFind( pattern, options, parent, dlg )
{
- m_tqreplacements = 0;
- m_tqreplacement = tqreplacement;
+ m_replacements = 0;
+ m_replacement = replacement;
}
KReplace::~KReplace()
@@ -79,7 +79,7 @@ KReplace::~KReplace()
// KFind::~KFind will delete m_dialog
}
-KDialogBase* KReplace::tqreplaceNextDialog( bool create )
+KDialogBase* KReplace::replaceNextDialog( bool create )
{
if ( m_dialog || create )
return dialog();
@@ -90,7 +90,7 @@ KReplaceNextDialog* KReplace::dialog()
{
if ( !m_dialog )
{
- m_dialog = new KReplaceNextDialog( tqparentWidget() );
+ m_dialog = new KReplaceNextDialog( parentWidget() );
connect( m_dialog, TQT_SIGNAL( user1Clicked() ), this, TQT_SLOT( slotReplaceAll() ) );
connect( m_dialog, TQT_SIGNAL( user2Clicked() ), this, TQT_SLOT( slotSkip() ) );
connect( m_dialog, TQT_SIGNAL( user3Clicked() ), this, TQT_SLOT( slotReplace() ) );
@@ -101,13 +101,13 @@ KReplaceNextDialog* KReplace::dialog()
void KReplace::displayFinalDialog() const
{
- if ( !m_tqreplacements )
- KMessageBox::information(tqparentWidget(), i18n("No text was tqreplaced."));
+ if ( !m_replacements )
+ KMessageBox::information(parentWidget(), i18n("No text was replaced."));
else
- KMessageBox::information(tqparentWidget(), i18n("1 tqreplacement done.", "%n tqreplacements done.", m_tqreplacements ) );
+ KMessageBox::information(parentWidget(), i18n("1 replacement done.", "%n replacements done.", m_replacements ) );
}
-KFind::Result KReplace::tqreplace()
+KFind::Result KReplace::replace()
{
#ifdef DEBUG_REPLACE
kdDebug() << k_funcinfo << "m_index=" << m_index << endl;
@@ -125,11 +125,11 @@ KFind::Result KReplace::tqreplace()
#endif
// Find the next match.
if ( m_options & KReplaceDialog::RegularExpression )
- m_index = KFind::tqfind(m_text, *m_regExp, m_index, m_options, &m_matchedLength);
+ m_index = KFind::find(m_text, *m_regExp, m_index, m_options, &m_matchedLength);
else
- m_index = KFind::tqfind(m_text, m_pattern, m_index, m_options, &m_matchedLength);
+ m_index = KFind::find(m_text, m_pattern, m_index, m_options, &m_matchedLength);
#ifdef DEBUG_REPLACE
- kdDebug() << k_funcinfo << "KFind::tqfind returned m_index=" << m_index << endl;
+ kdDebug() << k_funcinfo << "KFind::find returned m_index=" << m_index << endl;
#endif
if ( m_index != -1 )
{
@@ -141,10 +141,10 @@ KFind::Result KReplace::tqreplace()
#ifdef DEBUG_REPLACE
kdDebug() << k_funcinfo << "PromptOnReplace" << endl;
#endif
- // Display accurate initial string and tqreplacement string, they can vary
+ // Display accurate initial string and replacement string, they can vary
TQString matchedText = m_text.mid( m_index, m_matchedLength );
TQString rep = matchedText;
- KReplace::tqreplace(rep, m_tqreplacement, 0, m_options, m_matchedLength);
+ KReplace::replace(rep, m_replacement, 0, m_options, m_matchedLength);
dialog()->setLabel( matchedText, rep );
dialog()->show();
@@ -177,46 +177,46 @@ KFind::Result KReplace::tqreplace()
return NoMatch;
}
-int KReplace::tqreplace(TQString &text, const TQString &pattern, const TQString &tqreplacement, int index, long options, int *tqreplacedLength)
+int KReplace::replace(TQString &text, const TQString &pattern, const TQString &replacement, int index, long options, int *replacedLength)
{
int matchedLength;
- index = KFind::tqfind(text, pattern, index, options, &matchedLength);
+ index = KFind::find(text, pattern, index, options, &matchedLength);
if (index != -1)
{
- *tqreplacedLength = tqreplace(text, tqreplacement, index, options, matchedLength);
+ *replacedLength = replace(text, replacement, index, options, matchedLength);
if (options & KReplaceDialog::FindBackwards)
index--;
else
- index += *tqreplacedLength;
+ index += *replacedLength;
}
return index;
}
-int KReplace::tqreplace(TQString &text, const TQRegExp &pattern, const TQString &tqreplacement, int index, long options, int *tqreplacedLength)
+int KReplace::replace(TQString &text, const TQRegExp &pattern, const TQString &replacement, int index, long options, int *replacedLength)
{
int matchedLength;
- index = KFind::tqfind(text, pattern, index, options, &matchedLength);
+ index = KFind::find(text, pattern, index, options, &matchedLength);
if (index != -1)
{
- *tqreplacedLength = tqreplace(text, tqreplacement, index, options, matchedLength);
+ *replacedLength = replace(text, replacement, index, options, matchedLength);
if (options & KReplaceDialog::FindBackwards)
index--;
else
- index += *tqreplacedLength;
+ index += *replacedLength;
}
return index;
}
-int KReplace::tqreplace(TQString &text, const TQString &tqreplacement, int index, long options, int length)
+int KReplace::replace(TQString &text, const TQString &replacement, int index, long options, int length)
{
- TQString rep = tqreplacement;
- // Backreferences: tqreplace \0 with the right portion of 'text'
+ TQString rep = replacement;
+ // Backreferences: replace \0 with the right portion of 'text'
if ( options & KReplaceDialog::BackReference )
- rep.tqreplace( "\\0", text.mid( index, length ) );
- // Then tqreplace rep into the text
- text.tqreplace(index, length, rep);
+ rep.replace( "\\0", text.mid( index, length ) );
+ // Then replace rep into the text
+ text.replace(index, length, rep);
return rep.length();
}
@@ -225,7 +225,7 @@ void KReplace::slotReplaceAll()
doReplace();
m_options &= ~KReplaceDialog::PromptOnReplace;
emit optionsChanged();
- emit tqfindNext();
+ emit findNext();
}
void KReplace::slotSkip()
@@ -238,7 +238,7 @@ void KReplace::slotSkip()
delete m_dialog; // hide it again
m_dialog = 0L;
} else
- emit tqfindNext();
+ emit findNext();
}
void KReplace::slotReplace()
@@ -248,24 +248,24 @@ void KReplace::slotReplace()
delete m_dialog; // hide it again
m_dialog = 0L;
} else
- emit tqfindNext();
+ emit findNext();
}
void KReplace::doReplace()
{
- int tqreplacedLength = KReplace::tqreplace(m_text, m_tqreplacement, m_index, m_options, m_matchedLength);
+ int replacedLength = KReplace::replace(m_text, m_replacement, m_index, m_options, m_matchedLength);
- // Tell the world about the tqreplacement we made, in case someone wants to
+ // Tell the world about the replacement we made, in case someone wants to
// highlight it.
- emit tqreplace(m_text, m_index, tqreplacedLength, m_matchedLength);
+ emit replace(m_text, m_index, replacedLength, m_matchedLength);
#ifdef DEBUG_REPLACE
- kdDebug() << k_funcinfo << "after tqreplace() signal: m_index=" << m_index << " tqreplacedLength=" << tqreplacedLength << endl;
+ kdDebug() << k_funcinfo << "after replace() signal: m_index=" << m_index << " replacedLength=" << replacedLength << endl;
#endif
- m_tqreplacements++;
+ m_replacements++;
if (m_options & KReplaceDialog::FindBackwards)
m_index--;
else {
- m_index += tqreplacedLength;
+ m_index += replacedLength;
// when replacing the empty pattern, move on. See also kjs/regexp.cpp for how this should be done for regexps.
if ( m_pattern.isEmpty() )
++m_index;
@@ -278,13 +278,13 @@ void KReplace::doReplace()
void KReplace::resetCounts()
{
KFind::resetCounts();
- m_tqreplacements = 0;
+ m_replacements = 0;
}
bool KReplace::shouldRestart( bool forceAsking, bool showNumMatches ) const
{
- // Only ask if we did a "tqfind from cursor", otherwise it's pointless.
- // ... Or if the prompt-on-tqreplace option was set.
+ // Only ask if we did a "find from cursor", otherwise it's pointless.
+ // ... Or if the prompt-on-replace option was set.
// Well, unless the user can modify the document during a search operation,
// hence the force boolean.
if ( !forceAsking && (m_options & KFindDialog::FromCursor) == 0
@@ -296,10 +296,10 @@ bool KReplace::shouldRestart( bool forceAsking, bool showNumMatches ) const
TQString message;
if ( showNumMatches )
{
- if ( !m_tqreplacements )
- message = i18n("No text was tqreplaced.");
+ if ( !m_replacements )
+ message = i18n("No text was replaced.");
else
- message = i18n("1 tqreplacement done.", "%n tqreplacements done.", m_tqreplacements );
+ message = i18n("1 replacement done.", "%n replacements done.", m_replacements );
}
else
{
@@ -316,7 +316,7 @@ bool KReplace::shouldRestart( bool forceAsking, bool showNumMatches ) const
i18n("Do you want to restart search from the end?")
: i18n("Do you want to restart search at the beginning?");
- int ret = KMessageBox::questionYesNo( tqparentWidget(), message, TQString::null, i18n("Restart"), i18n("Stop") );
+ int ret = KMessageBox::questionYesNo( parentWidget(), message, TQString::null, i18n("Restart"), i18n("Stop") );
return( ret == KMessageBox::Yes );
}