author | paule <paule> | 2007-01-13 07:05:32 (UTC) |
---|---|---|
committer | paule <paule> | 2007-01-13 07:05:32 (UTC) |
commit | c0eb83f37ec3c49d0c6b322840605f2a95ea0b52 (patch) (unidiff) | |
tree | e776b5f8fd7f5d8f5ff5e9e3c6d9d638999ed622 | |
parent | 75c65c1dc728929f0430b8faf956195657b73311 (diff) | |
download | opie-c0eb83f37ec3c49d0c6b322840605f2a95ea0b52.zip opie-c0eb83f37ec3c49d0c6b322840605f2a95ea0b52.tar.gz opie-c0eb83f37ec3c49d0c6b322840605f2a95ea0b52.tar.bz2 |
Set sensible minimum width for Goto Line dialog
-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateviewdialog.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp index b7cf9f5..d6fde62 100644 --- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp +++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp | |||
@@ -137,192 +137,195 @@ int SearchDialog::getFlags() | |||
137 | if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive; | 137 | if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive; |
138 | if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords; | 138 | if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords; |
139 | if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning; | 139 | if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning; |
140 | if( m_opt4->isChecked() ) flags |= KateView::sfBackward; | 140 | if( m_opt4->isChecked() ) flags |= KateView::sfBackward; |
141 | if( m_opt5->isChecked() ) flags |= KateView::sfSelected; | 141 | if( m_opt5->isChecked() ) flags |= KateView::sfSelected; |
142 | if( m_optRegExp->isChecked() ) flags |= KateView::sfRegularExpression; | 142 | if( m_optRegExp->isChecked() ) flags |= KateView::sfRegularExpression; |
143 | if( m_replace ) | 143 | if( m_replace ) |
144 | { | 144 | { |
145 | if( m_opt6->isChecked() ) | 145 | if( m_opt6->isChecked() ) |
146 | flags |= KateView::sfPrompt; | 146 | flags |= KateView::sfPrompt; |
147 | 147 | ||
148 | flags |= KateView::sfReplace; | 148 | flags |= KateView::sfReplace; |
149 | } | 149 | } |
150 | 150 | ||
151 | return flags; | 151 | return flags; |
152 | } | 152 | } |
153 | 153 | ||
154 | void SearchDialog::slotOk() | 154 | void SearchDialog::slotOk() |
155 | { | 155 | { |
156 | if ( !m_search->currentText().isEmpty() ) | 156 | if ( !m_search->currentText().isEmpty() ) |
157 | { | 157 | { |
158 | if ( !m_optRegExp->isChecked() ) | 158 | if ( !m_optRegExp->isChecked() ) |
159 | { | 159 | { |
160 | accept(); | 160 | accept(); |
161 | } | 161 | } |
162 | else | 162 | else |
163 | { | 163 | { |
164 | // Check for a valid regular expression. | 164 | // Check for a valid regular expression. |
165 | 165 | ||
166 | QRegExp regExp( m_search->currentText() ); | 166 | QRegExp regExp( m_search->currentText() ); |
167 | 167 | ||
168 | if ( regExp.isValid() ) | 168 | if ( regExp.isValid() ) |
169 | accept(); | 169 | accept(); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | void SearchDialog::setSearchText( const QString &searchstr ) | 174 | void SearchDialog::setSearchText( const QString &searchstr ) |
175 | { | 175 | { |
176 | m_search->insertItem( searchstr, 0 ); | 176 | m_search->insertItem( searchstr, 0 ); |
177 | m_search->setCurrentItem( 0 ); | 177 | m_search->setCurrentItem( 0 ); |
178 | m_search->lineEdit()->selectAll(); | 178 | m_search->lineEdit()->selectAll(); |
179 | } | 179 | } |
180 | 180 | ||
181 | // this dialog is not modal | 181 | // this dialog is not modal |
182 | ReplacePrompt::ReplacePrompt( QWidget *parent ) | 182 | ReplacePrompt::ReplacePrompt( QWidget *parent ) |
183 | : KDialogBase(parent, 0L, false, i18n( "Replace Text" ), | 183 | : KDialogBase(parent, 0L, false, i18n( "Replace Text" ), |
184 | User3 | User2 | User1 | Close, User3, true, | 184 | User3 | User2 | User1 | Close, User3, true, |
185 | i18n("&All"), i18n("&No"), i18n("&Yes")) { | 185 | i18n("&All"), i18n("&No"), i18n("&Yes")) { |
186 | 186 | ||
187 | QWidget *page = new QWidget(this); | 187 | QWidget *page = new QWidget(this); |
188 | setMainWidget(page); | 188 | setMainWidget(page); |
189 | 189 | ||
190 | QBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); | 190 | QBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); |
191 | QLabel *label = new QLabel(i18n("Replace this occurrence?"),page); | 191 | QLabel *label = new QLabel(i18n("Replace this occurrence?"),page); |
192 | topLayout->addWidget(label ); | 192 | topLayout->addWidget(label ); |
193 | } | 193 | } |
194 | 194 | ||
195 | void ReplacePrompt::slotUser1( void ) { // All | 195 | void ReplacePrompt::slotUser1( void ) { // All |
196 | done(KateView::srAll); | 196 | done(KateView::srAll); |
197 | } | 197 | } |
198 | 198 | ||
199 | void ReplacePrompt::slotUser2( void ) { // No | 199 | void ReplacePrompt::slotUser2( void ) { // No |
200 | done(KateView::srNo); | 200 | done(KateView::srNo); |
201 | } | 201 | } |
202 | 202 | ||
203 | void ReplacePrompt::slotUser3( void ) { // Yes | 203 | void ReplacePrompt::slotUser3( void ) { // Yes |
204 | accept(); | 204 | accept(); |
205 | } | 205 | } |
206 | 206 | ||
207 | void ReplacePrompt::done(int r) { | 207 | void ReplacePrompt::done(int r) { |
208 | setResult(r); | 208 | setResult(r); |
209 | emit clicked(); | 209 | emit clicked(); |
210 | } | 210 | } |
211 | 211 | ||
212 | void ReplacePrompt::closeEvent(QCloseEvent *) { | 212 | void ReplacePrompt::closeEvent(QCloseEvent *) { |
213 | reject(); | 213 | reject(); |
214 | } | 214 | } |
215 | 215 | ||
216 | GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max) | 216 | GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max) |
217 | : KDialogBase(parent, 0L, true, i18n("Goto Line"), Ok | Cancel, Ok) { | 217 | : KDialogBase(parent, 0L, true, i18n("Goto Line"), Ok | Cancel, Ok) { |
218 | 218 | ||
219 | QWidget *page = new QWidget(this); | 219 | QWidget *page = new QWidget(this); |
220 | setMainWidget(page); | 220 | setMainWidget(page); |
221 | 221 | ||
222 | QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); | 222 | QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); |
223 | e1 = new QSpinBox(page); | 223 | e1 = new QSpinBox(page); |
224 | e1->setMinValue(1); | 224 | e1->setMinValue(1); |
225 | e1->setMaxValue(max); | 225 | e1->setMaxValue(max); |
226 | e1->setValue((int)line); | 226 | e1->setValue((int)line); |
227 | 227 | ||
228 | QLabel *label = new QLabel( e1,i18n("&Goto Line:"), page ); | 228 | QLabel *label = new QLabel( e1,i18n("&Goto Line:"), page ); |
229 | topLayout->addWidget(label); | 229 | topLayout->addWidget(label); |
230 | topLayout->addWidget(e1); | 230 | topLayout->addWidget(e1); |
231 | topLayout->addSpacing(spacingHint()); // A little bit extra space | 231 | topLayout->addSpacing(spacingHint()); // A little bit extra space |
232 | topLayout->addStretch(10); | 232 | topLayout->addStretch(10); |
233 | |||
234 | page->setMinimumWidth(100); | ||
235 | |||
233 | e1->setFocus(); | 236 | e1->setFocus(); |
234 | } | 237 | } |
235 | 238 | ||
236 | int GotoLineDialog::getLine() { | 239 | int GotoLineDialog::getLine() { |
237 | return e1->value(); | 240 | return e1->value(); |
238 | } | 241 | } |
239 | 242 | ||
240 | const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent, | 243 | const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent, |
241 | KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces}; | 244 | KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces}; |
242 | 245 | ||
243 | IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view) | 246 | IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view) |
244 | : QWidget(parent, 0L) | 247 | : QWidget(parent, 0L) |
245 | { | 248 | { |
246 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); | 249 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); |
247 | int configFlags = view->config(); | 250 | int configFlags = view->config(); |
248 | 251 | ||
249 | opt[0] = new QCheckBox(i18n("&Auto Indent"), this); | 252 | opt[0] = new QCheckBox(i18n("&Auto Indent"), this); |
250 | layout->addWidget(opt[0], 0, AlignLeft); | 253 | layout->addWidget(opt[0], 0, AlignLeft); |
251 | opt[0]->setChecked(configFlags & flags[0]); | 254 | opt[0]->setChecked(configFlags & flags[0]); |
252 | 255 | ||
253 | opt[1] = new QCheckBox(i18n("Indent With &Spaces"), this); | 256 | opt[1] = new QCheckBox(i18n("Indent With &Spaces"), this); |
254 | layout->addWidget(opt[1], 0, AlignLeft); | 257 | layout->addWidget(opt[1], 0, AlignLeft); |
255 | opt[1]->setChecked(configFlags & flags[1]); | 258 | opt[1]->setChecked(configFlags & flags[1]); |
256 | 259 | ||
257 | opt[2] = new QCheckBox(i18n("&Backspace Key Indents"), this); | 260 | opt[2] = new QCheckBox(i18n("&Backspace Key Indents"), this); |
258 | layout->addWidget(opt[2], 0, AlignLeft); | 261 | layout->addWidget(opt[2], 0, AlignLeft); |
259 | opt[2]->setChecked(configFlags & flags[2]); | 262 | opt[2]->setChecked(configFlags & flags[2]); |
260 | 263 | ||
261 | opt[3] = new QCheckBox(i18n("&Tab Key Indents"), this); | 264 | opt[3] = new QCheckBox(i18n("&Tab Key Indents"), this); |
262 | layout->addWidget(opt[3], 0, AlignLeft); | 265 | layout->addWidget(opt[3], 0, AlignLeft); |
263 | opt[3]->setChecked(configFlags & flags[3]); | 266 | opt[3]->setChecked(configFlags & flags[3]); |
264 | 267 | ||
265 | opt[4] = new QCheckBox(i18n("Keep Indent &Profile"), this); | 268 | opt[4] = new QCheckBox(i18n("Keep Indent &Profile"), this); |
266 | layout->addWidget(opt[4], 0, AlignLeft); | 269 | layout->addWidget(opt[4], 0, AlignLeft); |
267 | // opt[4]->setChecked(configFlags & flags[4]); | 270 | // opt[4]->setChecked(configFlags & flags[4]); |
268 | opt[4]->setChecked(true); | 271 | opt[4]->setChecked(true); |
269 | opt[4]->hide(); | 272 | opt[4]->hide(); |
270 | 273 | ||
271 | opt[5] = new QCheckBox(i18n("&Keep Extra Spaces"), this); | 274 | opt[5] = new QCheckBox(i18n("&Keep Extra Spaces"), this); |
272 | layout->addWidget(opt[5], 0, AlignLeft); | 275 | layout->addWidget(opt[5], 0, AlignLeft); |
273 | opt[5]->setChecked(configFlags & flags[5]); | 276 | opt[5]->setChecked(configFlags & flags[5]); |
274 | 277 | ||
275 | layout->addStretch(); | 278 | layout->addStretch(); |
276 | 279 | ||
277 | // What is this? help | 280 | // What is this? help |
278 | QWhatsThis::add(opt[0], i18n("When <b>Auto indent</b> is on, KateView will indent new lines to equal the indent on the previous line.<p>If the previous line is blank, the nearest line above with text is used")); | 281 | QWhatsThis::add(opt[0], i18n("When <b>Auto indent</b> is on, KateView will indent new lines to equal the indent on the previous line.<p>If the previous line is blank, the nearest line above with text is used")); |
279 | QWhatsThis::add(opt[1], i18n("Check this if you want to indent with spaces rather than tabs.<br>A Tab will be converted to <u>Tab-width</u> as set in the <b>edit</b> options")); | 282 | QWhatsThis::add(opt[1], i18n("Check this if you want to indent with spaces rather than tabs.<br>A Tab will be converted to <u>Tab-width</u> as set in the <b>edit</b> options")); |
280 | QWhatsThis::add(opt[2], i18n("This allows the <b>backspace</b> key to be used to indent.")); | 283 | QWhatsThis::add(opt[2], i18n("This allows the <b>backspace</b> key to be used to indent.")); |
281 | QWhatsThis::add(opt[3], i18n("This allows the <b>tab</b> key to be used to indent.")); | 284 | QWhatsThis::add(opt[3], i18n("This allows the <b>tab</b> key to be used to indent.")); |
282 | QWhatsThis::add(opt[4], i18n("This retains current indentation settings for future documents.")); | 285 | QWhatsThis::add(opt[4], i18n("This retains current indentation settings for future documents.")); |
283 | QWhatsThis::add(opt[5], i18n("Indentations of more than the selected number of spaces will not be shortened.")); | 286 | QWhatsThis::add(opt[5], i18n("Indentations of more than the selected number of spaces will not be shortened.")); |
284 | } | 287 | } |
285 | 288 | ||
286 | void IndentConfigTab::getData(KateView *view) { | 289 | void IndentConfigTab::getData(KateView *view) { |
287 | int configFlags, z; | 290 | int configFlags, z; |
288 | 291 | ||
289 | configFlags = view->config(); | 292 | configFlags = view->config(); |
290 | for (z = 0; z < numFlags; z++) { | 293 | for (z = 0; z < numFlags; z++) { |
291 | configFlags &= ~flags[z]; | 294 | configFlags &= ~flags[z]; |
292 | if (opt[z]->isChecked()) configFlags |= flags[z]; | 295 | if (opt[z]->isChecked()) configFlags |= flags[z]; |
293 | } | 296 | } |
294 | view->setConfig(configFlags); | 297 | view->setConfig(configFlags); |
295 | } | 298 | } |
296 | 299 | ||
297 | const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput, | 300 | const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput, |
298 | KateView::cfMouseAutoCopy, KateView::cfSingleSelection, KateView::cfVerticalSelect, KateView::cfXorSelect}; | 301 | KateView::cfMouseAutoCopy, KateView::cfSingleSelection, KateView::cfVerticalSelect, KateView::cfXorSelect}; |
299 | 302 | ||
300 | SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view) | 303 | SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view) |
301 | : QWidget(parent, 0L) | 304 | : QWidget(parent, 0L) |
302 | { | 305 | { |
303 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); | 306 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); |
304 | int configFlags = view->config(); | 307 | int configFlags = view->config(); |
305 | 308 | ||
306 | opt[0] = new QCheckBox(i18n("&Persistent Selections"), this); | 309 | opt[0] = new QCheckBox(i18n("&Persistent Selections"), this); |
307 | layout->addWidget(opt[0], 0, AlignLeft); | 310 | layout->addWidget(opt[0], 0, AlignLeft); |
308 | opt[0]->setChecked(configFlags & flags[0]); | 311 | opt[0]->setChecked(configFlags & flags[0]); |
309 | 312 | ||
310 | opt[1] = new QCheckBox(i18n("&Overwrite Selections"), this); | 313 | opt[1] = new QCheckBox(i18n("&Overwrite Selections"), this); |
311 | layout->addWidget(opt[1], 0, AlignLeft); | 314 | layout->addWidget(opt[1], 0, AlignLeft); |
312 | opt[1]->setChecked(configFlags & flags[1]); | 315 | opt[1]->setChecked(configFlags & flags[1]); |
313 | 316 | ||
314 | opt[2] = new QCheckBox(i18n("Mouse &Autocopy"), this); | 317 | opt[2] = new QCheckBox(i18n("Mouse &Autocopy"), this); |
315 | layout->addWidget(opt[2], 0, AlignLeft); | 318 | layout->addWidget(opt[2], 0, AlignLeft); |
316 | opt[2]->setChecked(configFlags & flags[2]); | 319 | opt[2]->setChecked(configFlags & flags[2]); |
317 | 320 | ||
318 | opt[3] = new QCheckBox(i18n("&X11-like Single Selection"), this); | 321 | opt[3] = new QCheckBox(i18n("&X11-like Single Selection"), this); |
319 | layout->addWidget(opt[3], 0, AlignLeft); | 322 | layout->addWidget(opt[3], 0, AlignLeft); |
320 | opt[3]->setChecked(configFlags & flags[3]); | 323 | opt[3]->setChecked(configFlags & flags[3]); |
321 | 324 | ||
322 | opt[4] = new QCheckBox(i18n("&Vertical Selections"), this); | 325 | opt[4] = new QCheckBox(i18n("&Vertical Selections"), this); |
323 | layout->addWidget(opt[4], 0, AlignLeft); | 326 | layout->addWidget(opt[4], 0, AlignLeft); |
324 | opt[4]->setChecked(configFlags & flags[4]); | 327 | opt[4]->setChecked(configFlags & flags[4]); |
325 | 328 | ||
326 | opt[5] = new QCheckBox(i18n("&Toggle Old"), this); | 329 | opt[5] = new QCheckBox(i18n("&Toggle Old"), this); |
327 | layout->addWidget(opt[5], 0, AlignLeft); | 330 | layout->addWidget(opt[5], 0, AlignLeft); |
328 | opt[5]->setChecked(configFlags & flags[5]); | 331 | opt[5]->setChecked(configFlags & flags[5]); |