Diffstat (limited to 'noncore/apps/tinykate/libkate/view/kateviewdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateviewdialog.cpp | 556 |
1 files changed, 556 insertions, 0 deletions
diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp new file mode 100644 index 0000000..a311042 --- a/dev/null +++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp | |||
@@ -0,0 +1,556 @@ | |||
1 | /*************************************************************************** | ||
2 | kateviewdialog.cpp - description | ||
3 | ------------------- | ||
4 | copyright : (C) 2001 by The Kate Team | ||
5 | (C) 2002 by Joseph Wenninger | ||
6 | email : kwrite-devel@kde.org | ||
7 | jowenn@kde.org | ||
8 | |||
9 | ***************************************************************************/ | ||
10 | |||
11 | /*************************************************************************** | ||
12 | * * | ||
13 | * This program is free software; you can redistribute it and/or modify * | ||
14 | * it under the terms of the GNU General Public License as published by * | ||
15 | * the Free Software Foundation; either version 2 of the License, or * | ||
16 | * (at your option) any later version. * | ||
17 | * * | ||
18 | ***************************************************************************/ | ||
19 | // Dialogs | ||
20 | |||
21 | #include <stdio.h> | ||
22 | #include <stdlib.h> | ||
23 | |||
24 | #include <qgrid.h> | ||
25 | #include <qlabel.h> | ||
26 | #include <qlayout.h> | ||
27 | #include <qlistbox.h> | ||
28 | #include <qspinbox.h> | ||
29 | #include <qcombobox.h> | ||
30 | #include <qgroupbox.h> | ||
31 | #include <qlineedit.h> | ||
32 | #include <qcheckbox.h> | ||
33 | #include <qcollection.h> | ||
34 | #include <qpushbutton.h> | ||
35 | #include <qobjectlist.h> | ||
36 | #include <qradiobutton.h> | ||
37 | #include <qwhatsthis.h> | ||
38 | #include <qstringlist.h> | ||
39 | #include <klocale.h> | ||
40 | #include <kcolorbtn.h> | ||
41 | #include <qcombobox.h> | ||
42 | #include <kglobal.h> | ||
43 | #include <qvbox.h> | ||
44 | #include <qspinbox.h> | ||
45 | #include <kfontdialog.h> | ||
46 | |||
47 | #include "../document/katedocument.h" | ||
48 | #include "kateviewdialog.h" | ||
49 | |||
50 | SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ) | ||
51 | : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok ) | ||
52 | , m_replace( 0L ) | ||
53 | { | ||
54 | QWidget *page = new QWidget( this ); | ||
55 | setMainWidget( page ); | ||
56 | |||
57 | QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); | ||
58 | |||
59 | m_search = new QComboBox( true, page ); | ||
60 | m_search->insertStringList( searchFor ); | ||
61 | m_search->setMinimumWidth( m_search->sizeHint().width() ); | ||
62 | m_search->lineEdit()->selectAll(); | ||
63 | QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page ); | ||
64 | m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page ); | ||
65 | topLayout->addWidget( label ); | ||
66 | topLayout->addWidget( m_search ); | ||
67 | topLayout->addWidget( m_optRegExp ); | ||
68 | |||
69 | if( flags & KateView::sfReplace ) | ||
70 | { | ||
71 | // make it a replace dialog | ||
72 | setCaption( i18n( "Replace Text" ) ); | ||
73 | m_replace = new QComboBox( true, page ); | ||
74 | m_replace->insertStringList( replaceWith ); | ||
75 | m_replace->setMinimumWidth( m_search->sizeHint().width() ); | ||
76 | label = new QLabel( m_replace, i18n( "&Replace With:" ), page ); | ||
77 | //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page ); | ||
78 | topLayout->addWidget( label ); | ||
79 | topLayout->addWidget( m_replace ); | ||
80 | //topLayout->addWidget( m_optPlaceholders ); | ||
81 | } | ||
82 | |||
83 | QGroupBox *group = new QGroupBox( i18n( "Options" ), page ); | ||
84 | topLayout->addWidget( group, 10 ); | ||
85 | |||
86 | QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() ); | ||
87 | gbox->addRowSpacing( 0, fontMetrics().lineSpacing() ); | ||
88 | gbox->setRowStretch( 4, 10 ); | ||
89 | |||
90 | m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group ); | ||
91 | gbox->addWidget( m_opt1, 1, 0 ); | ||
92 | |||
93 | m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group ); | ||
94 | gbox->addWidget( m_opt2, 2, 0 ); | ||
95 | |||
96 | m_opt3 = new QCheckBox(i18n("&From Beginning" ), group ); | ||
97 | gbox->addWidget( m_opt3, 3, 0 ); | ||
98 | |||
99 | m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group ); | ||
100 | gbox->addWidget( m_opt4, 1, 1 ); | ||
101 | |||
102 | m_opt5 = new QCheckBox(i18n("&Selected Text" ), group ); | ||
103 | gbox->addWidget( m_opt5, 2, 1 ); | ||
104 | |||
105 | m_opt1->setChecked( flags & KateView::sfCaseSensitive ); | ||
106 | m_opt2->setChecked( flags & KateView::sfWholeWords ); | ||
107 | m_opt3->setChecked( flags & KateView::sfFromBeginning ); | ||
108 | m_optRegExp->setChecked( flags & KateView::sfRegularExpression ); | ||
109 | m_opt4->setChecked( flags & KateView::sfBackward ); | ||
110 | m_opt5->setChecked( flags & KateView::sfSelected ); | ||
111 | |||
112 | if( m_replace ) | ||
113 | { | ||
114 | m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group ); | ||
115 | m_opt6->setChecked( flags & KateView::sfPrompt ); | ||
116 | gbox->addWidget( m_opt6, 3, 1 ); | ||
117 | } | ||
118 | |||
119 | m_search->setFocus(); | ||
120 | } | ||
121 | |||
122 | QString SearchDialog::getSearchFor() | ||
123 | { | ||
124 | return m_search->currentText(); | ||
125 | } | ||
126 | |||
127 | QString SearchDialog::getReplaceWith() | ||
128 | { | ||
129 | return m_replace->currentText(); | ||
130 | } | ||
131 | |||
132 | int SearchDialog::getFlags() | ||
133 | { | ||
134 | int flags = 0; | ||
135 | |||
136 | if( m_opt1->isChecked() ) flags |= KateView::sfCaseSensitive; | ||
137 | if( m_opt2->isChecked() ) flags |= KateView::sfWholeWords; | ||
138 | if( m_opt3->isChecked() ) flags |= KateView::sfFromBeginning; | ||
139 | if( m_opt4->isChecked() ) flags |= KateView::sfBackward; | ||
140 | if( m_opt5->isChecked() ) flags |= KateView::sfSelected; | ||
141 | if( m_optRegExp->isChecked() ) flags |= KateView::sfRegularExpression; | ||
142 | if( m_replace ) | ||
143 | { | ||
144 | if( m_opt6->isChecked() ) | ||
145 | flags |= KateView::sfPrompt; | ||
146 | |||
147 | flags |= KateView::sfReplace; | ||
148 | } | ||
149 | |||
150 | return flags; | ||
151 | } | ||
152 | |||
153 | void SearchDialog::slotOk() | ||
154 | { | ||
155 | if ( !m_search->currentText().isEmpty() ) | ||
156 | { | ||
157 | if ( !m_optRegExp->isChecked() ) | ||
158 | { | ||
159 | accept(); | ||
160 | } | ||
161 | else | ||
162 | { | ||
163 | // Check for a valid regular expression. | ||
164 | |||
165 | QRegExp regExp( m_search->currentText() ); | ||
166 | |||
167 | if ( regExp.isValid() ) | ||
168 | accept(); | ||
169 | } | ||
170 | } | ||
171 | } | ||
172 | |||
173 | void SearchDialog::setSearchText( const QString &searchstr ) | ||
174 | { | ||
175 | m_search->insertItem( searchstr, 0 ); | ||
176 | m_search->setCurrentItem( 0 ); | ||
177 | m_search->lineEdit()->selectAll(); | ||
178 | } | ||
179 | |||
180 | // this dialog is not modal | ||
181 | ReplacePrompt::ReplacePrompt( QWidget *parent ) | ||
182 | : KDialogBase(parent, 0L, false, i18n( "Replace Text" ), | ||
183 | User3 | User2 | User1 | Close, User3, true, | ||
184 | i18n("&All"), i18n("&No"), i18n("&Yes")) { | ||
185 | |||
186 | QWidget *page = new QWidget(this); | ||
187 | setMainWidget(page); | ||
188 | |||
189 | QBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); | ||
190 | QLabel *label = new QLabel(i18n("Replace this occurence?"),page); | ||
191 | topLayout->addWidget(label ); | ||
192 | } | ||
193 | |||
194 | void ReplacePrompt::slotUser1( void ) { // All | ||
195 | done(KateView::srAll); | ||
196 | } | ||
197 | |||
198 | void ReplacePrompt::slotUser2( void ) { // No | ||
199 | done(KateView::srNo); | ||
200 | } | ||
201 | |||
202 | void ReplacePrompt::slotUser3( void ) { // Yes | ||
203 | accept(); | ||
204 | } | ||
205 | |||
206 | void ReplacePrompt::done(int r) { | ||
207 | setResult(r); | ||
208 | emit clicked(); | ||
209 | } | ||
210 | |||
211 | void ReplacePrompt::closeEvent(QCloseEvent *) { | ||
212 | reject(); | ||
213 | } | ||
214 | |||
215 | GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max) | ||
216 | : KDialogBase(parent, 0L, true, i18n("Goto Line"), Ok | Cancel, Ok) { | ||
217 | |||
218 | QWidget *page = new QWidget(this); | ||
219 | setMainWidget(page); | ||
220 | |||
221 | QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); | ||
222 | e1 = new QSpinBox(page); | ||
223 | e1->setMinValue(1); | ||
224 | e1->setMaxValue(max); | ||
225 | e1->setValue((int)line); | ||
226 | |||
227 | QLabel *label = new QLabel( e1,i18n("&Goto Line:"), page ); | ||
228 | topLayout->addWidget(label); | ||
229 | topLayout->addWidget(e1); | ||
230 | topLayout->addSpacing(spacingHint()); // A little bit extra space | ||
231 | topLayout->addStretch(10); | ||
232 | e1->setFocus(); | ||
233 | } | ||
234 | |||
235 | int GotoLineDialog::getLine() { | ||
236 | return e1->value(); | ||
237 | } | ||
238 | |||
239 | const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent, | ||
240 | KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces}; | ||
241 | |||
242 | IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view) | ||
243 | : QWidget(parent, 0L) | ||
244 | { | ||
245 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); | ||
246 | int configFlags = view->config(); | ||
247 | |||
248 | opt[0] = new QCheckBox(i18n("&Auto Indent"), this); | ||
249 | layout->addWidget(opt[0], 0, AlignLeft); | ||
250 | opt[0]->setChecked(configFlags & flags[0]); | ||
251 | |||
252 | opt[1] = new QCheckBox(i18n("Indent With &Spaces"), this); | ||
253 | layout->addWidget(opt[1], 0, AlignLeft); | ||
254 | opt[1]->setChecked(configFlags & flags[1]); | ||
255 | |||
256 | opt[2] = new QCheckBox(i18n("&Backspace Key Indents"), this); | ||
257 | layout->addWidget(opt[2], 0, AlignLeft); | ||
258 | opt[2]->setChecked(configFlags & flags[2]); | ||
259 | |||
260 | opt[3] = new QCheckBox(i18n("&Tab Key Indents"), this); | ||
261 | layout->addWidget(opt[3], 0, AlignLeft); | ||
262 | opt[3]->setChecked(configFlags & flags[3]); | ||
263 | |||
264 | opt[4] = new QCheckBox(i18n("Keep Indent &Profile"), this); | ||
265 | layout->addWidget(opt[4], 0, AlignLeft); | ||
266 | // opt[4]->setChecked(configFlags & flags[4]); | ||
267 | opt[4]->setChecked(true); | ||
268 | opt[4]->hide(); | ||
269 | |||
270 | opt[5] = new QCheckBox(i18n("&Keep Extra Spaces"), this); | ||
271 | layout->addWidget(opt[5], 0, AlignLeft); | ||
272 | opt[5]->setChecked(configFlags & flags[5]); | ||
273 | |||
274 | layout->addStretch(); | ||
275 | |||
276 | // What is this? help | ||
277 | 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")); | ||
278 | 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")); | ||
279 | QWhatsThis::add(opt[2], i18n("This allows the <b>backspace</b> key to be used to indent.")); | ||
280 | QWhatsThis::add(opt[3], i18n("This allows the <b>tab</b> key to be used to indent.")); | ||
281 | QWhatsThis::add(opt[4], i18n("This retains current indentation settings for future documents.")); | ||
282 | QWhatsThis::add(opt[5], i18n("Indentations of more than the selected number of spaces will not be shortened.")); | ||
283 | } | ||
284 | |||
285 | void IndentConfigTab::getData(KateView *view) { | ||
286 | int configFlags, z; | ||
287 | |||
288 | configFlags = view->config(); | ||
289 | for (z = 0; z < numFlags; z++) { | ||
290 | configFlags &= ~flags[z]; | ||
291 | if (opt[z]->isChecked()) configFlags |= flags[z]; | ||
292 | } | ||
293 | view->setConfig(configFlags); | ||
294 | } | ||
295 | |||
296 | const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput, | ||
297 | KateView::cfMouseAutoCopy, KateView::cfSingleSelection, KateView::cfVerticalSelect, KateView::cfXorSelect}; | ||
298 | |||
299 | SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view) | ||
300 | : QWidget(parent, 0L) | ||
301 | { | ||
302 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); | ||
303 | int configFlags = view->config(); | ||
304 | |||
305 | opt[0] = new QCheckBox(i18n("&Persistent Selections"), this); | ||
306 | layout->addWidget(opt[0], 0, AlignLeft); | ||
307 | opt[0]->setChecked(configFlags & flags[0]); | ||
308 | |||
309 | opt[1] = new QCheckBox(i18n("&Overwrite Selections"), this); | ||
310 | layout->addWidget(opt[1], 0, AlignLeft); | ||
311 | opt[1]->setChecked(configFlags & flags[1]); | ||
312 | |||
313 | opt[2] = new QCheckBox(i18n("Mouse &Autocopy"), this); | ||
314 | layout->addWidget(opt[2], 0, AlignLeft); | ||
315 | opt[2]->setChecked(configFlags & flags[2]); | ||
316 | |||
317 | opt[3] = new QCheckBox(i18n("&X11-like Single Selection"), this); | ||
318 | layout->addWidget(opt[3], 0, AlignLeft); | ||
319 | opt[3]->setChecked(configFlags & flags[3]); | ||
320 | |||
321 | opt[4] = new QCheckBox(i18n("&Vertical Selections"), this); | ||
322 | layout->addWidget(opt[4], 0, AlignLeft); | ||
323 | opt[4]->setChecked(configFlags & flags[4]); | ||
324 | |||
325 | opt[5] = new QCheckBox(i18n("&Toggle Old"), this); | ||
326 | layout->addWidget(opt[5], 0, AlignLeft); | ||
327 | opt[5]->setChecked(configFlags & flags[5]); | ||
328 | |||
329 | layout->addStretch(); | ||
330 | |||
331 | // What is this? help | ||
332 | QWhatsThis::add(opt[0], i18n("Enabling this prevents key input or cursor movement by way of the arrow keys from causing the elimination of text selection.<p><b>Note:</b> If the Overwrite Selections option is activated then any typed character input or paste operation will replace the selected text.")); | ||
333 | QWhatsThis::add(opt[1], i18n("When this is on, any keyed character input or paste operation will replace the selected text.")); | ||
334 | QWhatsThis::add(opt[2], i18n("When this is on, any text selected with the mouse will be automatically copied to the clipboard.")); | ||
335 | QWhatsThis::add(opt[3], i18n("Not implemented yet.")); | ||
336 | QWhatsThis::add(opt[4], i18n("Enabling this allows you to make vertical selections.")); | ||
337 | QWhatsThis::add(opt[5], i18n("Not yet implemented.")); | ||
338 | } | ||
339 | |||
340 | void SelectConfigTab::getData(KateView *view) { | ||
341 | int configFlags, z; | ||
342 | |||
343 | configFlags = view->config(); | ||
344 | for (z = 0; z < numFlags; z++) { | ||
345 | configFlags &= ~flags[z]; // clear flag | ||
346 | if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked | ||
347 | } | ||
348 | view->setConfig(configFlags); | ||
349 | } | ||
350 | |||
351 | const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces, | ||
352 | KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome, | ||
353 | KateView::cfPageUDMovesCursor, KateView::cfWrapCursor}; | ||
354 | |||
355 | EditConfigTab::EditConfigTab(QWidget *parent, KateView *view) | ||
356 | : QWidget(parent, 0L) { | ||
357 | |||
358 | QHBoxLayout *mainLayout; | ||
359 | QVBoxLayout *cbLayout, *leLayout; | ||
360 | int configFlags; | ||
361 | |||
362 | mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() ); | ||
363 | |||
364 | // checkboxes | ||
365 | cbLayout = new QVBoxLayout( mainLayout ); | ||
366 | configFlags = view->config(); | ||
367 | |||
368 | opt[0] = new QCheckBox(i18n("&Word wrap"), this); | ||
369 | cbLayout->addWidget(opt[0], 0, AlignLeft); | ||
370 | opt[0]->setChecked(view->doc()->wordWrap()); | ||
371 | |||
372 | opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this); | ||
373 | cbLayout->addWidget(opt[1], 0, AlignLeft); | ||
374 | opt[1]->setChecked(configFlags & flags[1]); | ||
375 | |||
376 | opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this); | ||
377 | cbLayout->addWidget(opt[2], 0, AlignLeft); | ||
378 | opt[2]->setChecked(configFlags & flags[2]); | ||
379 | |||
380 | opt[3] = new QCheckBox(i18n("&Auto brackets"), this); | ||
381 | cbLayout->addWidget(opt[3], 0, AlignLeft); | ||
382 | opt[3]->setChecked(configFlags & flags[3]); | ||
383 | |||
384 | opt[4] = new QCheckBox(i18n("Group &undos"), this); | ||
385 | cbLayout->addWidget(opt[4], 0, AlignLeft); | ||
386 | opt[4]->setChecked(configFlags & flags[4]); | ||
387 | |||
388 | opt[5] = new QCheckBox(i18n("&Show tabs"), this); | ||
389 | cbLayout->addWidget(opt[5], 0, AlignLeft); | ||
390 | opt[5]->setChecked(configFlags & flags[5]); | ||
391 | |||
392 | opt[6] = new QCheckBox(i18n("Smart &home"), this); | ||
393 | cbLayout->addWidget(opt[6], 0, AlignLeft); | ||
394 | opt[6]->setChecked(configFlags & flags[6]); | ||
395 | |||
396 | opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this); | ||
397 | cbLayout->addWidget(opt[7], 0, AlignLeft); | ||
398 | opt[7]->setChecked(configFlags & flags[7]); | ||
399 | |||
400 | opt[8] = new QCheckBox(i18n("Wrap &cursor"), this); | ||
401 | cbLayout->addWidget(opt[8], 0, AlignLeft); | ||
402 | opt[8]->setChecked(configFlags & flags[8]); | ||
403 | |||
404 | cbLayout->addStretch(); | ||
405 | |||
406 | // edit lines | ||
407 | leLayout = new QVBoxLayout(); | ||
408 | mainLayout->addLayout(leLayout,10); | ||
409 | |||
410 | e1 = new QSpinBox(this); | ||
411 | e1->setMinValue(20); | ||
412 | e1->setMaxValue( 200); | ||
413 | e1->setValue((int)(view->doc()->wordWrapAt())); | ||
414 | #warning fixme e1->setLabel(i18n("Wrap Words At:")); | ||
415 | |||
416 | e2 = new QSpinBox(this); | ||
417 | e2->setMinValue(1); | ||
418 | e2->setMaxValue(16); | ||
419 | e2->setValue((int)view->tabWidth()); | ||
420 | |||
421 | #warning fixme e2->setLabel(i18n("Tab/Indent Width:")); | ||
422 | |||
423 | e3 = new QSpinBox(this); | ||
424 | e3->setMinValue(5); | ||
425 | e3->setMaxValue( 30000); | ||
426 | #warning fixme e3->setLabel(i18n("Undo steps:")); | ||
427 | e3->setValue((int)view->undoSteps()); | ||
428 | |||
429 | leLayout->addWidget(e1, 0, AlignLeft); | ||
430 | leLayout->addWidget(e2, 0, AlignLeft); | ||
431 | leLayout->addWidget(e3, 0, AlignLeft); | ||
432 | |||
433 | |||
434 | QVBox *box = new QVBox (this); | ||
435 | leLayout->addWidget (box, 0, AlignLeft); | ||
436 | |||
437 | new QLabel (i18n("Encoding:"), box); | ||
438 | |||
439 | encoding = new QComboBox(box); | ||
440 | #warning fixme | ||
441 | #if 0 | ||
442 | encoding->insertStringList (KGlobal::charsets()->availableEncodingNames()); | ||
443 | encoding->setCurrentItem (KGlobal::charsets()->availableEncodingNames().findIndex(view->doc()->encoding())); | ||
444 | #endif | ||
445 | leLayout->addStretch(); | ||
446 | |||
447 | // What is this? help | ||
448 | QWhatsThis::add(opt[0], i18n("Word wrap is a feature that causes the editor to automatically start a new line of text and move (wrap) the cursor to the beginning of that new line. KateView will automatically start a new line of text when the current line reaches the length specified by the Wrap Words At: option.<p><b>NOTE:<b> Word Wrap will not change existing lines or wrap them for easy reading as in some applications.")); | ||
449 | QWhatsThis::add(e1, i18n("If the Word Wrap option is selected this entry determines the length (in characters) at which the editor will automatically start a new line.")); | ||
450 | QWhatsThis::add(opt[1], i18n("KateView will replace any tabs with the number of spaces indicated in the Tab Width: entry.")); | ||
451 | QWhatsThis::add(e2, i18n("If the Replace Tabs By Spaces option is selected this entry determines the number of spaces with which the editor will automatically replace tabs.")); | ||
452 | QWhatsThis::add(opt[2], i18n("KateView will automatically eliminate extra spaces at the ends of lines of text.")); | ||
453 | QWhatsThis::add(opt[3], i18n("When the user types a left bracket ([,(, or {) KateView automatically enters the right bracket (}, ), or ]) to the right of the cursor.")); | ||
454 | QWhatsThis::add(opt[4], i18n("Checking this will cause sequences of similar actions to be undone at once.")); | ||
455 | QWhatsThis::add(opt[5], i18n("The editor will display a symbol to indicate the presence of a tab in the text.")); | ||
456 | QWhatsThis::add(opt[6], i18n("Not yet implemented.")); | ||
457 | QWhatsThis::add(opt[7], i18n("If this is selected, the insertion cursor will be moved to the first/last line when pressing the page up/down buttons.<p>If not selected, it will remain at it's relative position in the visible text.")); | ||
458 | QWhatsThis::add(e3, i18n("Sets the number of undo/redo steps to record. More steps uses more memory.")); | ||
459 | QWhatsThis::add(opt[8], i18n("When on, moving the insertion cursor using the <b>Left</b> and <b>Right</b> keys will go on to previous/next line at beginning/end of the line, similar to most editors.<p>When off, the insertion cursor cannot be moved left of the line start, but it can be moved off the line end, which can be very handy for programmers.")); | ||
460 | } | ||
461 | |||
462 | void EditConfigTab::getData(KateView *view) | ||
463 | { | ||
464 | int configFlags, z; | ||
465 | |||
466 | configFlags = view->config(); | ||
467 | for (z = 1; z < numFlags; z++) { | ||
468 | configFlags &= ~flags[z]; | ||
469 | if (opt[z]->isChecked()) configFlags |= flags[z]; | ||
470 | } | ||
471 | view->setConfig(configFlags); | ||
472 | |||
473 | view->setEncoding (encoding->currentText()); | ||
474 | view->doc()->setWordWrapAt(e1->value()); | ||
475 | view->doc()->setWordWrap (opt[0]->isChecked()); | ||
476 | view->setTabWidth(e2->value()); | ||
477 | view->setUndoSteps(e3->value()); | ||
478 | } | ||
479 | |||
480 | ColorConfig::ColorConfig( QWidget *parent, char *name ) | ||
481 | : QWidget( parent, name ) | ||
482 | { | ||
483 | QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint()); | ||
484 | glay->setColStretch(1,1); | ||
485 | glay->setRowStretch(5,1); | ||
486 | |||
487 | QLabel *label; | ||
488 | |||
489 | label = new QLabel( i18n("Background:"), this); | ||
490 | label->setAlignment( AlignRight|AlignVCenter ); | ||
491 | m_back = new KColorButton( this ); | ||
492 | glay->addWidget( label, 0, 0 ); | ||
493 | glay->addWidget( m_back, 0, 1 ); | ||
494 | |||
495 | label = new QLabel( i18n("Selected:"), this); | ||
496 | label->setAlignment( AlignRight|AlignVCenter ); | ||
497 | m_selected = new KColorButton( this ); | ||
498 | glay->addWidget( label, 2, 0 ); | ||
499 | glay->addWidget( m_selected, 2, 1 ); | ||
500 | |||
501 | // QWhatsThis help | ||
502 | QWhatsThis::add(m_back, i18n("Sets the background color of the editing area")); | ||
503 | QWhatsThis::add(m_selected, i18n("Sets the background color of the selection. To set the text color for selected text, use the "<b>Configure Highlighting</b>" dialog.")); | ||
504 | } | ||
505 | |||
506 | |||
507 | ColorConfig::~ColorConfig() | ||
508 | { | ||
509 | } | ||
510 | |||
511 | void ColorConfig::setColors(QColor *colors) | ||
512 | { | ||
513 | m_back->setColor( colors[0] ); | ||
514 | m_selected->setColor( colors[1] ); | ||
515 | } | ||
516 | |||
517 | void ColorConfig::getColors(QColor *colors) | ||
518 | { | ||
519 | colors[0] = m_back->color(); | ||
520 | colors[1] = m_selected->color(); | ||
521 | } | ||
522 | |||
523 | FontConfig::FontConfig( QWidget *parent, char *name ) | ||
524 | : QWidget( parent, name ) | ||
525 | { | ||
526 | // sizemanagment | ||
527 | QGridLayout *grid = new QGridLayout( this, 1, 1 ); | ||
528 | #if 0 | ||
529 | m_fontchooser = new KFontChooser ( this ); | ||
530 | m_fontchooser->enableColumn(KFontChooser::StyleList, false); | ||
531 | grid->addWidget( m_fontchooser, 0, 0); | ||
532 | |||
533 | connect (m_fontchooser, SIGNAL (fontSelected( const QFont & )), this, SLOT (slotFontSelected( const QFont & ))); | ||
534 | #endif | ||
535 | } | ||
536 | |||
537 | FontConfig::~FontConfig() | ||
538 | { | ||
539 | } | ||
540 | |||
541 | void FontConfig::setFont ( const QFont &font ) | ||
542 | { | ||
543 | #if 0 | ||
544 | m_fontchooser->setFont (font); | ||
545 | myFont = font; | ||
546 | #endif | ||
547 | } | ||
548 | |||
549 | void FontConfig::slotFontSelected( const QFont &font ) | ||
550 | { | ||
551 | myFont = font; | ||
552 | } | ||
553 | |||
554 | |||
555 | |||
556 | |||