65 #ifdef HAVE_QSCINTILLA
74 setWindowTitle (
"Find and Replace");
75 setWindowIcon (QIcon(
":/actions/icons/search.png"));
77 _search_label =
new QLabel (tr (
"Find &what:"));
78 _search_line_edit =
new QLineEdit;
79 _search_label->setBuddy (_search_line_edit);
80 _replace_label =
new QLabel (tr (
"Re&place with:"));
81 _replace_line_edit =
new QLineEdit;
82 _replace_label->setBuddy (_replace_line_edit);
84 _case_check_box =
new QCheckBox (tr (
"Match &case"));
85 _from_start_check_box =
new QCheckBox (tr (
"Search from &start"));
86 _wrap_check_box =
new QCheckBox (tr (
"&Wrap while searching"));
87 _wrap_check_box->setChecked(
true);
88 _find_next_button =
new QPushButton (tr (
"&Find Next"));
89 _find_prev_button =
new QPushButton (tr (
"Find &Previous"));
90 _replace_button =
new QPushButton (tr (
"&Replace"));
91 _replace_all_button =
new QPushButton (tr (
"Replace &All"));
94 _more_button->setCheckable (
true);
95 _more_button->setAutoDefault (
false);
97 _button_box =
new QDialogButtonBox (Qt::Vertical);
98 _button_box->addButton (_find_next_button, QDialogButtonBox::ActionRole);
99 _button_box->addButton (_find_prev_button, QDialogButtonBox::ActionRole);
100 _button_box->addButton (_replace_button, QDialogButtonBox::ActionRole);
101 _button_box->addButton (_replace_all_button, QDialogButtonBox::ActionRole);
102 _button_box->addButton (_more_button, QDialogButtonBox::ActionRole);
103 _button_box->addButton (QDialogButtonBox::Close);
105 _extension =
new QWidget (
this);
106 _whole_words_check_box =
new QCheckBox (tr (
"&Whole words"));
107 _regex_check_box =
new QCheckBox (tr (
"Regular E&xpressions"));
108 _backward_check_box =
new QCheckBox (tr (
"Search &backward"));
109 _search_selection_check_box =
new QCheckBox (tr (
"Search se&lection"));
110 _search_selection_check_box->setCheckable (
false);
111 _search_selection_check_box->setEnabled (
false);
113 _edit_area = edit_area;
114 connect (_find_next_button, SIGNAL (clicked ()),
115 this, SLOT (find_next ()));
116 connect (_find_prev_button, SIGNAL (clicked ()),
117 this, SLOT (find_prev ()));
118 connect (_more_button, SIGNAL (toggled (
bool)),
119 _extension, SLOT (setVisible (
bool)));
120 connect (_replace_button, SIGNAL (clicked ()),
122 connect (_replace_all_button, SIGNAL (clicked ()),
123 this, SLOT (replace_all ()));
124 connect (_backward_check_box, SIGNAL (stateChanged (
int)),
125 this, SLOT (handle_backward_search_changed (
int)));
126 connect (_button_box, SIGNAL (rejected ()),
127 this, SLOT (close ()));
129 QVBoxLayout *extension_layout =
new QVBoxLayout ();
130 extension_layout->setMargin (0);
131 extension_layout->addWidget (_whole_words_check_box);
132 extension_layout->addWidget (_backward_check_box);
133 extension_layout->addWidget (_search_selection_check_box);
134 _extension->setLayout (extension_layout);
136 QGridLayout *top_left_layout =
new QGridLayout;
137 top_left_layout->addWidget (_search_label, 1, 1);
138 top_left_layout->addWidget (_search_line_edit, 1, 2);
139 top_left_layout->addWidget (_replace_label, 2, 1);
140 top_left_layout->addWidget (_replace_line_edit, 2, 2);
142 QVBoxLayout *left_layout =
new QVBoxLayout;
143 left_layout->addLayout (top_left_layout);
144 left_layout->insertStretch (1, 5);
145 left_layout->addWidget (_case_check_box);
146 left_layout->addWidget (_from_start_check_box);
147 left_layout->addWidget (_wrap_check_box);
148 left_layout->addWidget (_regex_check_box);
150 QGridLayout *main_layout =
new QGridLayout;
151 main_layout->setSizeConstraint (QLayout::SetFixedSize);
152 main_layout->addLayout (left_layout, 0, 0);
153 main_layout->addWidget (_button_box, 0, 1);
154 main_layout->addWidget (_extension, 1, 0);
155 setLayout (main_layout);
158 _find_next_button->setDefault (
true);
159 _find_result_available =
false;
162 QWidget * desktop = QApplication::desktop ();
163 int xp = p->x () + p->frameGeometry ().width ();
165 if (desktop != 0 && sizeHint ().isValid ())
167 if (xp + sizeHint ().width () > desktop->width ())
168 xp = desktop->width () - sizeHint ().width ();
191 int lbeg, lend, cbeg, cend;
192 _edit_area->getSelection(&lbeg,&cbeg,&lend,&cend);
213 int line = -1, col = -1;
215 bool do_forward =
true;
251 #ifdef HAVE_QSCI_VERSION_2_6_0
281 Qt::CaseSensitivity cs;
284 cs = Qt::CaseSensitive;
288 cs = Qt::CaseInsensitive;
303 QMessageBox msg_box (QMessageBox::Information, tr (
"Replace Result"),
304 tr (
"%1 items replaced").
arg(count),
305 QMessageBox::Ok,
this);
314 QMessageBox msg_box (QMessageBox::Information, tr (
"Find Result"),
315 tr (
"No more matches found"), QMessageBox::Ok,
this);