From ffe8a83e053396df448e9413828527613ca3bd46 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:46:43 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kutils/kfinddialog.cpp | 154 ++++++++++++++++++++++++------------------------- 1 file changed, 77 insertions(+), 77 deletions(-) (limited to 'kutils/kfinddialog.cpp') diff --git a/kutils/kfinddialog.cpp b/kutils/kfinddialog.cpp index 7a18111a3..7cc6dff46 100644 --- a/kutils/kfinddialog.cpp +++ b/kutils/kfinddialog.cpp @@ -19,20 +19,20 @@ */ #include "kfinddialog.h" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include #include -#include +#include #include #include @@ -43,15 +43,15 @@ public: KFindDialogPrivate() : m_regexpDialog(0), m_regexpDialogQueryDone(false), m_enabled(WholeWordsOnly | FromCursor | SelectedText | CaseSensitive | FindBackwards | RegularExpression), m_initialShowDone(false) {} - QDialog* m_regexpDialog; + TQDialog* m_regexpDialog; bool m_regexpDialogQueryDone; long m_enabled; // uses Options to define which search options are enabled bool m_initialShowDone; - QStringList findStrings; - QString pattern; + TQStringList findStrings; + TQString pattern; }; -KFindDialog::KFindDialog(QWidget *parent, const char *name, long options, const QStringList &findStrings, bool hasSelection) : +KFindDialog::KFindDialog(TQWidget *parent, const char *name, long options, const TQStringList &findStrings, bool hasSelection) : KDialogBase(parent, name, true, i18n("Find Text"), Ok | Cancel, Ok), m_findExtension (0), m_replaceExtension (0) @@ -62,7 +62,7 @@ KFindDialog::KFindDialog(QWidget *parent, const char *name, long options, const setButtonCancel( KStdGuiItem::close() ); } -KFindDialog::KFindDialog(bool modal, QWidget *parent, const char *name, long options, const QStringList &findStrings, bool hasSelection) : +KFindDialog::KFindDialog(bool modal, TQWidget *parent, const char *name, long options, const TQStringList &findStrings, bool hasSelection) : KDialogBase(parent, name, modal, i18n("Find Text"), Ok | Cancel, Ok), m_findExtension (0), m_replaceExtension (0) @@ -73,7 +73,7 @@ KFindDialog::KFindDialog(bool modal, QWidget *parent, const char *name, long opt setButtonCancel( KStdGuiItem::close() ); } -KFindDialog::KFindDialog(QWidget *parent, const char *name, bool /*forReplace*/) : +KFindDialog::KFindDialog(TQWidget *parent, const char *name, bool /*forReplace*/) : KDialogBase(parent, name, true, i18n("Replace Text"), Ok | Cancel, Ok), m_findExtension (0), m_replaceExtension (0) @@ -87,48 +87,48 @@ KFindDialog::~KFindDialog() delete d; } -QWidget *KFindDialog::findExtension() +TQWidget *KFindDialog::findExtension() { if (!m_findExtension) { - m_findExtension = new QWidget(m_findGrp); + m_findExtension = new TQWidget(m_findGrp); m_findLayout->addMultiCellWidget(m_findExtension, 3, 3, 0, 1); } return m_findExtension; } -QStringList KFindDialog::findHistory() const +TQStringList KFindDialog::findHistory() const { return m_find->historyItems(); } -void KFindDialog::init(bool forReplace, const QStringList &findStrings, bool hasSelection) +void KFindDialog::init(bool forReplace, const TQStringList &findStrings, bool hasSelection) { - QVBoxLayout *topLayout; - QGridLayout *optionsLayout; + TQVBoxLayout *topLayout; + TQGridLayout *optionsLayout; // Create common parts of dialog. - QWidget *page = new QWidget(this); + TQWidget *page = new TQWidget(this); setMainWidget(page); - topLayout = new QVBoxLayout(page); + topLayout = new TQVBoxLayout(page); topLayout->setSpacing( KDialog::spacingHint() ); topLayout->setMargin( 0 ); - m_findGrp = new QGroupBox(0, Qt::Vertical, i18n("Find"), page); + m_findGrp = new TQGroupBox(0, Qt::Vertical, i18n("Find"), page); m_findGrp->layout()->setSpacing( KDialog::spacingHint() ); // m_findGrp->layout()->setMargin( KDialog::marginHint() ); - m_findLayout = new QGridLayout(m_findGrp->layout()); + m_findLayout = new TQGridLayout(m_findGrp->layout()); m_findLayout->setSpacing( KDialog::spacingHint() ); // m_findLayout->setMargin( KDialog::marginHint() ); - m_findLabel = new QLabel(i18n("&Text to find:"), m_findGrp); + m_findLabel = new TQLabel(i18n("&Text to find:"), m_findGrp); m_find = new KHistoryCombo(true, m_findGrp); m_find->setMaxCount(10); m_find->setDuplicatesEnabled(false); - m_regExp = new QCheckBox(i18n("Regular e&xpression"), m_findGrp); - m_regExpItem = new QPushButton(i18n("&Edit..."), m_findGrp); + m_regExp = new TQCheckBox(i18n("Regular e&xpression"), m_findGrp); + m_regExpItem = new TQPushButton(i18n("&Edit..."), m_findGrp); m_regExpItem->setEnabled(false); m_findLayout->addWidget(m_findLabel, 0, 0); @@ -137,19 +137,19 @@ void KFindDialog::init(bool forReplace, const QStringList &findStrings, bool has m_findLayout->addWidget(m_regExpItem, 2, 1); topLayout->addWidget(m_findGrp); - m_replaceGrp = new QGroupBox(0, Qt::Vertical, i18n("Replace With"), page); + m_replaceGrp = new TQGroupBox(0, Qt::Vertical, i18n("Replace With"), page); m_replaceGrp->layout()->setSpacing( KDialog::spacingHint() ); // m_replaceGrp->layout()->setMargin( KDialog::marginHint() ); - m_replaceLayout = new QGridLayout(m_replaceGrp->layout()); + m_replaceLayout = new TQGridLayout(m_replaceGrp->layout()); m_replaceLayout->setSpacing( KDialog::spacingHint() ); // m_replaceLayout->setMargin( KDialog::marginHint() ); - m_replaceLabel = new QLabel(i18n("Replace&ment text:"), m_replaceGrp); + m_replaceLabel = new TQLabel(i18n("Replace&ment text:"), m_replaceGrp); m_replace = new KHistoryCombo(true, m_replaceGrp); m_replace->setMaxCount(10); m_replace->setDuplicatesEnabled(false); - m_backRef = new QCheckBox(i18n("Use p&laceholders"), m_replaceGrp); - m_backRefItem = new QPushButton(i18n("Insert Place&holder"), m_replaceGrp); + m_backRef = new TQCheckBox(i18n("Use p&laceholders"), m_replaceGrp); + m_backRefItem = new TQPushButton(i18n("Insert Place&holder"), m_replaceGrp); m_backRefItem->setEnabled(false); m_replaceLayout->addWidget(m_replaceLabel, 0, 0); @@ -158,25 +158,25 @@ void KFindDialog::init(bool forReplace, const QStringList &findStrings, bool has m_replaceLayout->addWidget(m_backRefItem, 2, 1); topLayout->addWidget(m_replaceGrp); - m_optionGrp = new QGroupBox(0, Qt::Vertical, i18n("Options"), page); + m_optionGrp = new TQGroupBox(0, Qt::Vertical, i18n("Options"), page); m_optionGrp->layout()->setSpacing(KDialog::spacingHint()); // m_optionGrp->layout()->setMargin(KDialog::marginHint()); - optionsLayout = new QGridLayout(m_optionGrp->layout()); + optionsLayout = new TQGridLayout(m_optionGrp->layout()); optionsLayout->setSpacing( KDialog::spacingHint() ); // optionsLayout->setMargin( KDialog::marginHint() ); - m_caseSensitive = new QCheckBox(i18n("C&ase sensitive"), m_optionGrp); - m_wholeWordsOnly = new QCheckBox(i18n("&Whole words only"), m_optionGrp); - m_fromCursor = new QCheckBox(i18n("From c&ursor"), m_optionGrp); - m_findBackwards = new QCheckBox(i18n("Find &backwards"), m_optionGrp); - m_selectedText = new QCheckBox(i18n("&Selected text"), m_optionGrp); + m_caseSensitive = new TQCheckBox(i18n("C&ase sensitive"), m_optionGrp); + m_wholeWordsOnly = new TQCheckBox(i18n("&Whole words only"), m_optionGrp); + m_fromCursor = new TQCheckBox(i18n("From c&ursor"), m_optionGrp); + m_findBackwards = new TQCheckBox(i18n("Find &backwards"), m_optionGrp); + m_selectedText = new TQCheckBox(i18n("&Selected text"), m_optionGrp); setHasSelection( hasSelection ); // If we have a selection, we make 'find in selection' default // and if we don't, then the option has to be unchecked, obviously. m_selectedText->setChecked( hasSelection ); slotSelectedTextToggled( hasSelection ); - m_promptOnReplace = new QCheckBox(i18n("&Prompt on replace"), m_optionGrp); + m_promptOnReplace = new TQCheckBox(i18n("&Prompt on replace"), m_optionGrp); m_promptOnReplace->setChecked( true ); optionsLayout->addWidget(m_caseSensitive, 0, 0); @@ -192,13 +192,13 @@ void KFindDialog::init(bool forReplace, const QStringList &findStrings, bool has m_placeholders = 0L; // signals and slots connections - connect(m_selectedText, SIGNAL(toggled(bool)), this, SLOT(slotSelectedTextToggled(bool))); - connect(m_regExp, SIGNAL(toggled(bool)), m_regExpItem, SLOT(setEnabled(bool))); - connect(m_backRef, SIGNAL(toggled(bool)), m_backRefItem, SLOT(setEnabled(bool))); - connect(m_regExpItem, SIGNAL(clicked()), this, SLOT(showPatterns())); - connect(m_backRefItem, SIGNAL(clicked()), this, SLOT(showPlaceholders())); + 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_regExpItem, TQT_SIGNAL(clicked()), this, TQT_SLOT(showPatterns())); + connect(m_backRefItem, TQT_SIGNAL(clicked()), this, TQT_SLOT(showPlaceholders())); - connect(m_find, SIGNAL(textChanged ( const QString & )),this, SLOT(textSearchChanged( const QString & ))); + connect(m_find, TQT_SIGNAL(textChanged ( const TQString & )),this, TQT_SLOT(textSearchChanged( const TQString & ))); // tab order setTabOrder(m_find, m_regExp); @@ -228,7 +228,7 @@ void KFindDialog::init(bool forReplace, const QStringList &findStrings, bool has enableButtonOK( !pattern().isEmpty() ); if (forReplace) { - setButtonOK(KGuiItem( i18n("&Replace"), QString::null, + setButtonOK(KGuiItem( i18n("&Replace"), TQString::null, i18n("Start replace"), i18n("If you press the Replace button, the text you entered " "above is searched for within the document and any occurrence is " @@ -243,45 +243,45 @@ void KFindDialog::init(bool forReplace, const QStringList &findStrings, bool has } // QWhatsthis texts - QWhatsThis::add ( m_find, i18n( + TQWhatsThis::add ( m_find, i18n( "Enter a pattern to search for, or select a previous pattern from " "the list.") ); - QWhatsThis::add ( m_regExp, i18n( + TQWhatsThis::add ( m_regExp, i18n( "If enabled, search for a regular expression.") ); - QWhatsThis::add ( m_regExpItem, i18n( + TQWhatsThis::add ( m_regExpItem, i18n( "Click here to edit your regular expression using a graphical editor.") ); - QWhatsThis::add ( m_replace, i18n( + TQWhatsThis::add ( m_replace, i18n( "Enter a replacement string, or select a previous one from the list.") ); - QWhatsThis::add( m_backRef, i18n( + TQWhatsThis::add( m_backRef, i18n( "If enabled, any occurrence of \\N, where " "N is a integer number, will be replaced with " "the corresponding capture (\"parenthesized substring\") from the " "pattern.

To include (a literal \\N in your " "replacement, put an extra backslash in front of it, like " "\\\\N.") ); - QWhatsThis::add ( m_backRefItem, i18n( + TQWhatsThis::add ( m_backRefItem, i18n( "Click for a menu of available captures.") ); - QWhatsThis::add ( m_wholeWordsOnly, i18n( + TQWhatsThis::add ( m_wholeWordsOnly, i18n( "Require word boundaries in both ends of a match to succeed.") ); - QWhatsThis::add ( m_fromCursor, i18n( + TQWhatsThis::add ( m_fromCursor, i18n( "Start searching at the current cursor location rather than at the top.") ); - QWhatsThis::add ( m_selectedText, i18n( + TQWhatsThis::add ( m_selectedText, i18n( "Only search within the current selection.") ); - QWhatsThis::add ( m_caseSensitive, i18n( + TQWhatsThis::add ( m_caseSensitive, i18n( "Perform a case sensitive search: entering the pattern " "'Joe' will not match 'joe' or 'JOE', only 'Joe'.") ); - QWhatsThis::add ( m_findBackwards, i18n( + TQWhatsThis::add ( m_findBackwards, i18n( "Search backwards.") ); - QWhatsThis::add ( m_promptOnReplace, i18n( + TQWhatsThis::add ( m_promptOnReplace, i18n( "Ask before replacing each match found.") ); } -void KFindDialog::textSearchChanged( const QString & text) +void KFindDialog::textSearchChanged( const TQString & text) { enableButtonOK( !text.isEmpty() ); } -void KFindDialog::showEvent( QShowEvent *e ) +void KFindDialog::showEvent( TQShowEvent *e ) { if ( !d->m_initialShowDone ) { @@ -289,11 +289,11 @@ void KFindDialog::showEvent( QShowEvent *e ) kdDebug() << "showEvent\n"; if (!d->findStrings.isEmpty()) setFindHistory(d->findStrings); - d->findStrings = QStringList(); + d->findStrings = TQStringList(); if (!d->pattern.isEmpty()) { m_find->lineEdit()->setText( d->pattern ); m_find->lineEdit()->selectAll(); - d->pattern = QString::null; + d->pattern = TQString::null; } } KDialogBase::showEvent(e); @@ -318,12 +318,12 @@ long KFindDialog::options() const return options; } -QString KFindDialog::pattern() const +TQString KFindDialog::pattern() const { return m_find->currentText(); } -void KFindDialog::setPattern (const QString &pattern) +void KFindDialog::setPattern (const TQString &pattern) { m_find->lineEdit()->setText( pattern ); m_find->lineEdit()->selectAll(); @@ -331,7 +331,7 @@ void KFindDialog::setPattern (const QString &pattern) kdDebug() << "setPattern " << pattern< 0) { @@ -423,7 +423,7 @@ void KFindDialog::showPatterns() { if ( !d->m_regexpDialogQueryDone ) { - d->m_regexpDialog = KParts::ComponentFactory::createInstanceFromQuery( "KRegExpEditor/KRegExpEditor", QString::null, this ); + d->m_regexpDialog = KParts::ComponentFactory::createInstanceFromQuery( "KRegExpEditor/KRegExpEditor", TQString::null, this ); d->m_regexpDialogQueryDone = true; } @@ -433,7 +433,7 @@ void KFindDialog::showPatterns() assert( iface ); iface->setRegExp( pattern() ); - if ( d->m_regexpDialog->exec() == QDialog::Accepted ) + if ( d->m_regexpDialog->exec() == TQDialog::Accepted ) setPattern( iface->regExp() ); } else // No complete regexp-editor available, bring up the old popupmenu @@ -465,7 +465,7 @@ void KFindDialog::showPatterns() // Populate the popup menu. if (!m_patterns) { - m_patterns = new QPopupMenu(this); + m_patterns = new TQPopupMenu(this); for (i = 0; (unsigned)i < sizeof(items) / sizeof(items[0]); i++) { m_patterns->insertItem(i18n(items[i].description), i, i); @@ -476,7 +476,7 @@ void KFindDialog::showPatterns() i = m_patterns->exec(m_regExpItem->mapToGlobal(m_regExpItem->rect().bottomLeft())); if (i != -1) { - QLineEdit *editor = m_find->lineEdit(); + TQLineEdit *editor = m_find->lineEdit(); editor->insert(items[i].regExp); editor->setCursorPosition(editor->cursorPosition() + items[i].cursorAdjustment); @@ -491,16 +491,16 @@ void KFindDialog::showPlaceholders() // Populate the popup menu. if (!m_placeholders) { - m_placeholders = new QPopupMenu(this); - connect( m_placeholders, SIGNAL(aboutToShow()), this, SLOT(slotPlaceholdersAboutToShow()) ); + m_placeholders = new TQPopupMenu(this); + connect( m_placeholders, TQT_SIGNAL(aboutToShow()), this, TQT_SLOT(slotPlaceholdersAboutToShow()) ); } // Insert the selection into the edit control. int i = m_placeholders->exec(m_backRefItem->mapToGlobal(m_backRefItem->rect().bottomLeft())); if (i != -1) { - QLineEdit *editor = m_replace->lineEdit(); - editor->insert( QString("\\%1").arg( i ) ); + TQLineEdit *editor = m_replace->lineEdit(); + editor->insert( TQString("\\%1").arg( i ) ); } } @@ -509,7 +509,7 @@ void KFindDialog::slotPlaceholdersAboutToShow() m_placeholders->clear(); m_placeholders->insertItem( i18n("Complete Match"), 0 ); - QRegExp r( pattern() ); + TQRegExp r( pattern() ); uint n = r.numCaptures(); for ( uint i=0; i < n; i++ ) m_placeholders->insertItem( i18n("Captured Text (%1)").arg( i+1 ), i+1 ); @@ -527,7 +527,7 @@ void KFindDialog::slotOk() if (m_regExp->isChecked()) { // Check for a valid regular expression. - QRegExp regExp(pattern()); + TQRegExp regExp(pattern()); if (!regExp.isValid()) { -- cgit v1.2.1