diff options
Diffstat (limited to 'kdeui/keditcl2.cpp')
-rw-r--r-- | kdeui/keditcl2.cpp | 230 |
1 files changed, 115 insertions, 115 deletions
diff --git a/kdeui/keditcl2.cpp b/kdeui/keditcl2.cpp index f3f8c0bbb..36d1b8f3b 100644 --- a/kdeui/keditcl2.cpp +++ b/kdeui/keditcl2.cpp @@ -50,9 +50,9 @@ void KEdit::search(){ - if( tqreplace_dialog && tqreplace_dialog->isVisible() ) + if( replace_dialog && replace_dialog->isVisible() ) { - tqreplace_dialog->hide(); + replace_dialog->hide(); } if( !srchdialog ) @@ -62,8 +62,8 @@ void KEdit::search(){ connect(srchdialog,TQT_SIGNAL(done()),this,TQT_SLOT(searchdone_slot())); } - // If we already searched / tqreplaced something before make sure it shows - // up in the tqfind dialog line-edit. + // If we already searched / replaced something before make sure it shows + // up in the find dialog line-edit. TQString string; string = srchdialog->getText(); @@ -162,7 +162,7 @@ int KEdit::doSearch(TQString s_pattern, bool case_sensitive, string = textLine(i); - pos = string.tqfind(s_pattern, i == line ? col : 0, case_sensitive); + pos = string.find(s_pattern, i == line ? col : 0, case_sensitive); if( pos != -1){ @@ -191,7 +191,7 @@ int KEdit::doSearch(TQString s_pattern, bool case_sensitive, string = textLine(i); int line_length = string.length(); - pos = string.tqfindRev(s_pattern, line == i ? col : line_length , case_sensitive); + pos = string.findRev(s_pattern, line == i ? col : line_length , case_sensitive); if (pos != -1){ @@ -244,47 +244,47 @@ bool KEdit::repeatSearch() { // -void KEdit::tqreplace() +void KEdit::replace() { if( srchdialog && srchdialog->isVisible() ) { srchdialog->hide(); } - if( !tqreplace_dialog ) + if( !replace_dialog ) { - tqreplace_dialog = new KEdReplace( this, "tqreplace_dialog", false ); - connect(tqreplace_dialog,TQT_SIGNAL(tqfind()),this,TQT_SLOT(tqreplace_search_slot())); - connect(tqreplace_dialog,TQT_SIGNAL(tqreplace()),this,TQT_SLOT(tqreplace_slot())); - connect(tqreplace_dialog,TQT_SIGNAL(tqreplaceAll()),this,TQT_SLOT(tqreplace_all_slot())); - connect(tqreplace_dialog,TQT_SIGNAL(done()),this,TQT_SLOT(tqreplacedone_slot())); + replace_dialog = new KEdReplace( this, "replace_dialog", false ); + connect(replace_dialog,TQT_SIGNAL(find()),this,TQT_SLOT(replace_search_slot())); + connect(replace_dialog,TQT_SIGNAL(replace()),this,TQT_SLOT(replace_slot())); + connect(replace_dialog,TQT_SIGNAL(replaceAll()),this,TQT_SLOT(replace_all_slot())); + connect(replace_dialog,TQT_SIGNAL(done()),this,TQT_SLOT(replacedone_slot())); } - TQString string = tqreplace_dialog->getText(); - tqreplace_dialog->setText(string.isEmpty() ? pattern : string); + TQString string = replace_dialog->getText(); + replace_dialog->setText(string.isEmpty() ? pattern : string); deselect(); - last_tqreplace = NONE; + last_replace = NONE; - tqreplace_dialog->show(); - tqreplace_dialog->result(); + replace_dialog->show(); + replace_dialog->result(); } -void KEdit::tqreplace_slot(){ +void KEdit::replace_slot(){ - if (!tqreplace_dialog) + if (!replace_dialog) return; - if(!can_tqreplace){ + if(!can_replace){ KNotifyClient::beep(); return; } int line,col, length; - TQString string = tqreplace_dialog->getReplaceText(); + TQString string = replace_dialog->getReplaceText(); length = string.length(); this->cut(); @@ -293,9 +293,9 @@ void KEdit::tqreplace_slot(){ insertAt(string,line,col); setModified(true); - can_tqreplace = false; + can_replace = false; - if (tqreplace_dialog->get_direction()) + if (replace_dialog->get_direction()) { // Backward setCursorPosition(line,col+length); @@ -313,40 +313,40 @@ void KEdit::tqreplace_slot(){ } } -void KEdit::tqreplace_all_slot(){ +void KEdit::replace_all_slot(){ - if (!tqreplace_dialog) + if (!replace_dialog) return; - TQString to_find_string = tqreplace_dialog->getText(); + TQString to_find_string = replace_dialog->getText(); int lineFrom, lineTo, colFrom, colTo; getSelection(&lineFrom, &colFrom, &lineTo, &colTo); - // tqreplace_dialog->get_direction() is true if searching backward - if (tqreplace_dialog->get_direction()) + // replace_dialog->get_direction() is true if searching backward + if (replace_dialog->get_direction()) { if (colTo != -1) { - tqreplace_all_col = colTo - to_find_string.length(); - tqreplace_all_line = lineTo; + replace_all_col = colTo - to_find_string.length(); + replace_all_line = lineTo; } else { - getCursorPosition(&tqreplace_all_line,&tqreplace_all_col); - tqreplace_all_col--; + getCursorPosition(&replace_all_line,&replace_all_col); + replace_all_col--; } } else { if (colFrom != -1) { - tqreplace_all_col = colFrom; - tqreplace_all_line = lineFrom; + replace_all_col = colFrom; + replace_all_line = lineFrom; } else { - getCursorPosition(&tqreplace_all_line,&tqreplace_all_col); + getCursorPosition(&replace_all_line,&replace_all_col); } } @@ -359,16 +359,16 @@ again: while(result){ - result = doReplace(to_find_string, tqreplace_dialog->case_sensitive(), - false, (!tqreplace_dialog->get_direction()), - tqreplace_all_line,tqreplace_all_col,true); + result = doReplace(to_find_string, replace_dialog->case_sensitive(), + false, (!replace_dialog->get_direction()), + replace_all_line,replace_all_col,true); } setAutoUpdate(true); update(); - if(!tqreplace_dialog->get_direction()){ // forward search + if(!replace_dialog->get_direction()){ // forward search int query = KMessageBox::questionYesNo( srchdialog, @@ -376,8 +376,8 @@ again: "Continue from the beginning?"), i18n("Find"),KStdGuiItem::cont(),i18n("Stop")); if (query == KMessageBox::Yes){ - tqreplace_all_line = 0; - tqreplace_all_col = 0; + replace_all_line = 0; + replace_all_col = 0; goto again; } } @@ -390,9 +390,9 @@ again: i18n("Find"),KStdGuiItem::cont(),i18n("Stop")); if (query == KMessageBox::Yes){ TQString string = textLine( numLines() - 1 ); - tqreplace_all_line = numLines() - 1; - tqreplace_all_col = string.length(); - last_tqreplace = BACKWARD; + replace_all_line = numLines() - 1; + replace_all_col = string.length(); + last_replace = BACKWARD; goto again; } } @@ -402,20 +402,20 @@ again: } -void KEdit::tqreplace_search_slot(){ +void KEdit::replace_search_slot(){ int line, col; - if (!tqreplace_dialog) + if (!replace_dialog) return; - TQString to_find_string = tqreplace_dialog->getText(); + TQString to_find_string = replace_dialog->getText(); int lineFrom, lineTo, colFrom, colTo; getSelection(&lineFrom, &colFrom, &lineTo, &colTo); - // tqreplace_dialog->get_direction() is true if searching backward - if (tqreplace_dialog->get_direction()) + // replace_dialog->get_direction() is true if searching backward + if (replace_dialog->get_direction()) { if (colFrom != -1) { @@ -443,14 +443,14 @@ void KEdit::tqreplace_search_slot(){ again: - int result = doReplace(to_find_string, tqreplace_dialog->case_sensitive(), - false, (!tqreplace_dialog->get_direction()), line, col, false ); + int result = doReplace(to_find_string, replace_dialog->case_sensitive(), + false, (!replace_dialog->get_direction()), line, col, false ); if(!result){ - if(!tqreplace_dialog->get_direction()){ // forward search + if(!replace_dialog->get_direction()){ // forward search int query = KMessageBox::questionYesNo( - tqreplace_dialog, + replace_dialog, i18n("End of document reached.\n"\ "Continue from the beginning?"), i18n("Replace"),KStdGuiItem::cont(),i18n("Stop")); @@ -463,7 +463,7 @@ again: else{ //backward search int query = KMessageBox::questionYesNo( - tqreplace_dialog, + replace_dialog, i18n("Beginning of document reached.\n"\ "Continue from the end?"), i18n("Replace"),KStdGuiItem::cont(),i18n("Stop")); @@ -471,7 +471,7 @@ again: TQString string = textLine( numLines() - 1 ); line = numLines() - 1; col = string.length(); - last_tqreplace = BACKWARD; + last_replace = BACKWARD; goto again; } } @@ -484,18 +484,18 @@ again: -void KEdit::tqreplacedone_slot(){ +void KEdit::replacedone_slot(){ - if (!tqreplace_dialog) + if (!replace_dialog) return; - tqreplace_dialog->hide(); - // tqreplace_dialog->clearFocus(); + replace_dialog->hide(); + // replace_dialog->clearFocus(); setFocus(); - last_tqreplace = NONE; - can_tqreplace = false; + last_replace = NONE; + can_replace = false; } @@ -503,7 +503,7 @@ void KEdit::tqreplacedone_slot(){ /* antlarr: KDE 4: make it const TQString & */ int KEdit::doReplace(TQString s_pattern, bool case_sensitive, - bool wildcard, bool forward, int line, int col, bool tqreplace_all){ + bool wildcard, bool forward, int line, int col, bool replace_all){ (void) wildcard; // reserved for possible extension to regex @@ -513,11 +513,11 @@ int KEdit::doReplace(TQString s_pattern, bool case_sensitive, TQString string; TQString stringnew; - TQString tqreplacement; + TQString replacement; - tqreplacement = tqreplace_dialog->getReplaceText(); + replacement = replace_dialog->getReplaceText(); line_counter = line; - tqreplace_all_col = col; + replace_all_col = col; if(forward){ @@ -527,34 +527,34 @@ int KEdit::doReplace(TQString s_pattern, bool case_sensitive, string = textLine(line_counter); - if (tqreplace_all){ - pos = string.tqfind(s_pattern, tqreplace_all_col, case_sensitive); + if (replace_all){ + pos = string.find(s_pattern, replace_all_col, case_sensitive); } else{ - pos = string.tqfind(s_pattern, line_counter == line ? col : 0, case_sensitive); + pos = string.find(s_pattern, line_counter == line ? col : 0, case_sensitive); } if (pos == -1 ){ line_counter++; - tqreplace_all_col = 0; - tqreplace_all_line = line_counter; + replace_all_col = 0; + replace_all_line = line_counter; } if( pos != -1){ length = s_pattern.length(); - if(tqreplace_all){ // automatic + if(replace_all){ // automatic stringnew = string.copy(); do { - stringnew.tqreplace(pos,length,tqreplacement); + stringnew.replace(pos,length,replacement); - tqreplace_all_col = pos + tqreplacement.length(); - tqreplace_all_line = line_counter; + replace_all_col = pos + replacement.length(); + replace_all_line = line_counter; - pos = stringnew.tqfind(s_pattern, tqreplace_all_col, case_sensitive); + pos = stringnew.find(s_pattern, replace_all_col, case_sensitive); } while( pos != -1); @@ -573,8 +573,8 @@ int KEdit::doReplace(TQString s_pattern, bool case_sensitive, setCursorPosition( line_counter , pos + length, true ); pattern = s_pattern; - last_tqreplace = FORWARD; - can_tqreplace = true; + last_replace = FORWARD; + can_replace = true; return 1; @@ -591,55 +591,55 @@ int KEdit::doReplace(TQString s_pattern, bool case_sensitive, int line_length = string.length(); - if( tqreplace_all ){ - if (tqreplace_all_col < 0) + if( replace_all ){ + if (replace_all_col < 0) pos = -1; else - pos = string.tqfindRev(s_pattern, tqreplace_all_col , case_sensitive); + pos = string.findRev(s_pattern, replace_all_col , case_sensitive); } else{ if ((line == line_counter) && (col < 0)) pos = -1; else - pos = string.tqfindRev(s_pattern, + pos = string.findRev(s_pattern, line == line_counter ? col : line_length , case_sensitive); } if (pos == -1 ){ line_counter--; - tqreplace_all_col = 0; + replace_all_col = 0; if(line_counter >= 0){ string = textLine(line_counter); - tqreplace_all_col = string.length(); + replace_all_col = string.length(); } - tqreplace_all_line = line_counter; + replace_all_line = line_counter; } if (pos != -1){ length = s_pattern.length(); - if(tqreplace_all){ // automatic + if(replace_all){ // automatic stringnew = string.copy(); - stringnew.tqreplace(pos,length,tqreplacement); + stringnew.replace(pos,length,replacement); removeLine(line_counter); insertLine(stringnew,line_counter); - tqreplace_all_col = pos-length; - tqreplace_all_line = line_counter; - if (tqreplace_all_col < 0) + replace_all_col = pos-length; + replace_all_line = line_counter; + if (replace_all_col < 0) { line_counter--; if(line_counter >= 0){ string = textLine(line_counter); - tqreplace_all_col = string.length(); + replace_all_col = string.length(); } - tqreplace_all_line = line_counter; + replace_all_line = line_counter; } setModified(true); @@ -658,8 +658,8 @@ int KEdit::doReplace(TQString s_pattern, bool case_sensitive, setCursorPosition(line_counter, pos ,true ); pattern = s_pattern; - last_tqreplace = BACKWARD; - can_tqreplace = true; + last_replace = BACKWARD; + can_replace = true; return 1; } @@ -698,7 +698,7 @@ public: KEdFind::KEdFind( TQWidget *parent, const char *name, bool modal ) :KDialogBase( parent, name, modal, i18n("Find"), - modal ? User1|Cancel : User1|Close, User1, false, KGuiItem( i18n("&Find"), "tqfind") ) + modal ? User1|Cancel : User1|Close, User1, false, KGuiItem( i18n("&Find"), "find") ) { setWFlags( WType_TopLevel ); @@ -709,7 +709,7 @@ KEdFind::KEdFind( TQWidget *parent, const char *name, bool modal ) d = new KEdFindPrivate( page ); TQString text = i18n("Find:"); - TQLabel *label = new TQLabel( text, page , "tqfind" ); + TQLabel *label = new TQLabel( text, page , "find" ); topLayout->addWidget( label ); d->combo->setMinimumWidth(fontMetrics().maxWidth()*20); @@ -813,24 +813,24 @@ class KEdReplace::KEdReplacePrivate public: KEdReplacePrivate( TQWidget *parent ) { searchCombo = new KHistoryCombo( parent, "value" ); - tqreplaceCombo = new KHistoryCombo( parent, "tqreplace_value" ); + replaceCombo = new KHistoryCombo( parent, "replace_value" ); searchCombo->setMaxCount( 20 ); // just some defaults - tqreplaceCombo->setMaxCount( 20 ); + replaceCombo->setMaxCount( 20 ); } ~KEdReplacePrivate() { delete searchCombo; - delete tqreplaceCombo; + delete replaceCombo; } - KHistoryCombo *searchCombo, *tqreplaceCombo; + KHistoryCombo *searchCombo, *replaceCombo; }; KEdReplace::KEdReplace( TQWidget *parent, const char *name, bool modal ) :KDialogBase( parent, name, modal, i18n("Replace"), modal ? User3|User2|User1|Cancel : User3|User2|User1|Close, User3, false, - i18n("Replace &All"), i18n("&Replace"), KGuiItem( i18n("&Find"), "tqfind") ) + i18n("Replace &All"), i18n("&Replace"), KGuiItem( i18n("&Find"), "find") ) { setWFlags( WType_TopLevel ); @@ -842,7 +842,7 @@ KEdReplace::KEdReplace( TQWidget *parent, const char *name, bool modal ) d = new KEdReplacePrivate( page ); TQString text = i18n("Find:"); - TQLabel *label = new TQLabel( text, page, "tqfind" ); + TQLabel *label = new TQLabel( text, page, "find" ); topLayout->addWidget( label ); d->searchCombo->setMinimumWidth(fontMetrics().maxWidth()*20); @@ -850,11 +850,11 @@ KEdReplace::KEdReplace( TQWidget *parent, const char *name, bool modal ) topLayout->addWidget(d->searchCombo); text = i18n("Replace with:"); - label = new TQLabel( text, page, "tqreplace" ); + label = new TQLabel( text, page, "replace" ); topLayout->addWidget( label ); - d->tqreplaceCombo->setMinimumWidth(fontMetrics().maxWidth()*20); - topLayout->addWidget(d->tqreplaceCombo); + d->replaceCombo->setMinimumWidth(fontMetrics().maxWidth()*20); + topLayout->addWidget(d->replaceCombo); connect(d->searchCombo, TQT_SIGNAL(textChanged ( const TQString & )), this,TQT_SLOT(textSearchChanged ( const TQString & ))); @@ -892,7 +892,7 @@ void KEdReplace::slotCancel( void ) { emit done(); d->searchCombo->clearEdit(); - d->tqreplaceCombo->clearEdit(); + d->replaceCombo->clearEdit(); KDialogBase::slotCancel(); } @@ -905,8 +905,8 @@ void KEdReplace::slotUser1( void ) { if( !d->searchCombo->currentText().isEmpty() ) { - d->tqreplaceCombo->addToHistory( d->tqreplaceCombo->currentText() ); - emit tqreplaceAll(); + d->replaceCombo->addToHistory( d->replaceCombo->currentText() ); + emit replaceAll(); } } @@ -915,8 +915,8 @@ void KEdReplace::slotUser2( void ) { if( !d->searchCombo->currentText().isEmpty() ) { - d->tqreplaceCombo->addToHistory( d->tqreplaceCombo->currentText() ); - emit tqreplace(); + d->replaceCombo->addToHistory( d->replaceCombo->currentText() ); + emit replace(); } } @@ -925,7 +925,7 @@ void KEdReplace::slotUser3( void ) if( !d->searchCombo->currentText().isEmpty() ) { d->searchCombo->addToHistory( d->searchCombo->currentText() ); - emit tqfind(); + emit find(); } } @@ -938,7 +938,7 @@ TQString KEdReplace::getText() TQString KEdReplace::getReplaceText() { - return d->tqreplaceCombo->currentText(); + return d->replaceCombo->currentText(); } @@ -966,9 +966,9 @@ KHistoryCombo * KEdReplace::searchCombo() const return d->searchCombo; } -KHistoryCombo * KEdReplace::tqreplaceCombo() const +KHistoryCombo * KEdReplace::replaceCombo() const { - return d->tqreplaceCombo; + return d->replaceCombo; } @@ -1034,7 +1034,7 @@ void KEdit::misspelling (const TQString &word, const TQStringList &, unsigned in void KEdit::corrected (const TQString &originalword, const TQString &newword, unsigned int pos) { //we'll reselect the original word in case the user has played with - //the selection in eframe or the word was auto-tqreplaced + //the selection in eframe or the word was auto-replaced unsigned int l = 0; unsigned int cnt = 0; |