summaryrefslogtreecommitdiff
path: root/utils/themeeditor/gui/findreplacedialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/gui/findreplacedialog.cpp')
-rw-r--r--utils/themeeditor/gui/findreplacedialog.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/utils/themeeditor/gui/findreplacedialog.cpp b/utils/themeeditor/gui/findreplacedialog.cpp
index e2b8b9bc43..2a6161189e 100644
--- a/utils/themeeditor/gui/findreplacedialog.cpp
+++ b/utils/themeeditor/gui/findreplacedialog.cpp
@@ -57,13 +57,13 @@ void FindReplaceDialog::closeEvent(QCloseEvent* event)
57 57
58void FindReplaceDialog::setupUI() 58void FindReplaceDialog::setupUI()
59{ 59{
60 QObject::connect(ui->findButton, SIGNAL(pressed()), 60 QObject::connect(ui->findButton, SIGNAL(clicked()),
61 this, SLOT(find())); 61 this, SLOT(find()));
62 QObject::connect(ui->replaceButton, SIGNAL(pressed()), 62 QObject::connect(ui->replaceButton, SIGNAL(clicked()),
63 this, SLOT(replace())); 63 this, SLOT(replace()));
64 QObject::connect(ui->replaceAllButton, SIGNAL(pressed()), 64 QObject::connect(ui->replaceAllButton, SIGNAL(clicked()),
65 this, SLOT(replaceAll())); 65 this, SLOT(replaceAll()));
66 QObject::connect(ui->closeButton, SIGNAL(pressed()), 66 QObject::connect(ui->closeButton, SIGNAL(clicked()),
67 this, SLOT(close())); 67 this, SLOT(close()));
68 QObject::connect(ui->findBox, SIGNAL(textChanged(QString)), 68 QObject::connect(ui->findBox, SIGNAL(textChanged(QString)),
69 this, SLOT(textChanged())); 69 this, SLOT(textChanged()));
@@ -77,10 +77,6 @@ void FindReplaceDialog::find()
77 if(!editor) 77 if(!editor)
78 return; 78 return;
79 79
80 /* Figuring out the range to search in */
81 int begin = editor->textCursor().selectionStart();
82 int end = editor->textCursor().selectionEnd();
83
84 QTextDocument::FindFlags flags = 0; 80 QTextDocument::FindFlags flags = 0;
85 if(ui->caseBox->isChecked()) 81 if(ui->caseBox->isChecked())
86 flags |= QTextDocument::FindCaseSensitively; 82 flags |= QTextDocument::FindCaseSensitively;
@@ -109,7 +105,7 @@ void FindReplaceDialog::find()
109 QPalette newPal; 105 QPalette newPal;
110 if(!textFound.isNull()) 106 if(!textFound.isNull())
111 { 107 {
112 newPal.setColor(QPalette::Foreground, QColor(150, 255, 150)); 108 newPal.setColor(QPalette::Foreground, QColor(0, 150, 0));
113 ui->statusLabel->setPalette(newPal); 109 ui->statusLabel->setPalette(newPal);
114 ui->statusLabel->setText(tr("Match Found")); 110 ui->statusLabel->setText(tr("Match Found"));
115 editor->setTextCursor(textFound); 111 editor->setTextCursor(textFound);
@@ -126,12 +122,31 @@ void FindReplaceDialog::find()
126 122
127void FindReplaceDialog::replace() 123void FindReplaceDialog::replace()
128{ 124{
125 if(textFound.isNull())
126 find();
127
128 if(textFound.isNull())
129 return;
129 130
131 editor->setTextCursor(textFound);
132 editor->insertPlainText(ui->replaceBox->text());
133 textFound = QTextCursor();
130} 134}
131 135
132void FindReplaceDialog::replaceAll() 136void FindReplaceDialog::replaceAll()
133{ 137{
134 138
139 do
140 {
141 if(!textFound.isNull())
142 {
143 editor->setTextCursor(textFound);
144 editor->insertPlainText(ui->replaceBox->text());
145 }
146
147 find();
148 }while(!textFound.isNull());
149
135} 150}
136 151
137void FindReplaceDialog::textChanged() 152void FindReplaceDialog::textChanged()