-rw-r--r-- | noncore/apps/tinykate/libkate/view/kateviewdialog.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp index f82356b..b7cf9f5 100644 --- a/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp +++ b/noncore/apps/tinykate/libkate/view/kateviewdialog.cpp | |||
@@ -1,383 +1,383 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | kateviewdialog.cpp - description | 2 | kateviewdialog.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | copyright : (C) 2001 by The Kate Team | 4 | copyright : (C) 2001 by The Kate Team |
5 | (C) 2002 by Joseph Wenninger | 5 | (C) 2002 by Joseph Wenninger |
6 | email : kwrite-devel@kde.org | 6 | email : kwrite-devel@kde.org |
7 | jowenn@kde.org | 7 | jowenn@kde.org |
8 | 8 | ||
9 | ***************************************************************************/ | 9 | ***************************************************************************/ |
10 | 10 | ||
11 | /*************************************************************************** | 11 | /*************************************************************************** |
12 | * * | 12 | * * |
13 | * This program is free software; you can redistribute it and/or modify * | 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 * | 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 * | 15 | * the Free Software Foundation; either version 2 of the License, or * |
16 | * (at your option) any later version. * | 16 | * (at your option) any later version. * |
17 | * * | 17 | * * |
18 | ***************************************************************************/ | 18 | ***************************************************************************/ |
19 | // Dialogs | 19 | // Dialogs |
20 | 20 | ||
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | 23 | ||
24 | #include <qgrid.h> | 24 | #include <qgrid.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qlayout.h> | 26 | #include <qlayout.h> |
27 | #include <qlistbox.h> | 27 | #include <qlistbox.h> |
28 | #include <qgroupbox.h> | 28 | #include <qgroupbox.h> |
29 | #include <qlineedit.h> | 29 | #include <qlineedit.h> |
30 | #include <qcheckbox.h> | 30 | #include <qcheckbox.h> |
31 | #include <qcollection.h> | 31 | #include <qcollection.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qobjectlist.h> | 33 | #include <qobjectlist.h> |
34 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
35 | #include <qwhatsthis.h> | 35 | #include <qwhatsthis.h> |
36 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kcolorbtn.h> | 38 | #include <kcolorbtn.h> |
39 | #include <kglobal.h> | 39 | #include <kglobal.h> |
40 | #include <qvbox.h> | 40 | #include <qvbox.h> |
41 | #include <qspinbox.h> | 41 | #include <qspinbox.h> |
42 | #include <qcombobox.h> | 42 | #include <qcombobox.h> |
43 | #include <kfontdialog.h> | 43 | #include <kfontdialog.h> |
44 | 44 | ||
45 | #include "../document/katedocument.h" | 45 | #include "../document/katedocument.h" |
46 | #include "kateviewdialog.h" | 46 | #include "kateviewdialog.h" |
47 | #include <opie2/ofontselector.h> | 47 | #include <opie2/ofontselector.h> |
48 | 48 | ||
49 | 49 | ||
50 | using namespace Opie::Ui; | 50 | using namespace Opie::Ui; |
51 | SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ) | 51 | SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ) |
52 | : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok ) | 52 | : KDialogBase( parent, 0L, true, i18n( "Find Text" ), Ok | Cancel, Ok ) |
53 | , m_replace( 0L ) | 53 | , m_replace( 0L ) |
54 | { | 54 | { |
55 | QWidget *page = new QWidget( this ); | 55 | QWidget *page = new QWidget( this ); |
56 | setMainWidget( page ); | 56 | setMainWidget( page ); |
57 | 57 | ||
58 | QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); | 58 | QVBoxLayout *topLayout = new QVBoxLayout( page, 0, spacingHint() ); |
59 | 59 | ||
60 | m_search = new QComboBox( true, page ); | 60 | m_search = new QComboBox( true, page ); |
61 | m_search->insertStringList( searchFor ); | 61 | m_search->insertStringList( searchFor ); |
62 | m_search->setMinimumWidth( m_search->sizeHint().width() ); | 62 | m_search->setMinimumWidth( m_search->sizeHint().width() ); |
63 | m_search->lineEdit()->selectAll(); | 63 | m_search->lineEdit()->selectAll(); |
64 | QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page ); | 64 | QLabel *label = new QLabel( m_search, i18n( "&Text To Find:" ), page ); |
65 | m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page ); | 65 | m_optRegExp = new QCheckBox( i18n( "Regular Expression" ), page ); |
66 | topLayout->addWidget( label ); | 66 | topLayout->addWidget( label ); |
67 | topLayout->addWidget( m_search ); | 67 | topLayout->addWidget( m_search ); |
68 | topLayout->addWidget( m_optRegExp ); | 68 | topLayout->addWidget( m_optRegExp ); |
69 | 69 | ||
70 | if( flags & KateView::sfReplace ) | 70 | if( flags & KateView::sfReplace ) |
71 | { | 71 | { |
72 | // make it a replace dialog | 72 | // make it a replace dialog |
73 | setCaption( i18n( "Replace Text" ) ); | 73 | setCaption( i18n( "Replace Text" ) ); |
74 | m_replace = new QComboBox( true, page ); | 74 | m_replace = new QComboBox( true, page ); |
75 | m_replace->insertStringList( replaceWith ); | 75 | m_replace->insertStringList( replaceWith ); |
76 | m_replace->setMinimumWidth( m_search->sizeHint().width() ); | 76 | m_replace->setMinimumWidth( m_search->sizeHint().width() ); |
77 | label = new QLabel( m_replace, i18n( "&Replace With:" ), page ); | 77 | label = new QLabel( m_replace, i18n( "&Replace With:" ), page ); |
78 | //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page ); | 78 | //m_optPlaceholders = new QCheckBox( i18n( "&Use Placeholders" ), page ); |
79 | topLayout->addWidget( label ); | 79 | topLayout->addWidget( label ); |
80 | topLayout->addWidget( m_replace ); | 80 | topLayout->addWidget( m_replace ); |
81 | //topLayout->addWidget( m_optPlaceholders ); | 81 | //topLayout->addWidget( m_optPlaceholders ); |
82 | } | 82 | } |
83 | 83 | ||
84 | QGroupBox *group = new QGroupBox( i18n( "Options" ), page ); | 84 | QGroupBox *group = new QGroupBox( i18n( "Options" ), page ); |
85 | topLayout->addWidget( group, 10 ); | 85 | topLayout->addWidget( group, 10 ); |
86 | 86 | ||
87 | QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() ); | 87 | QGridLayout *gbox = new QGridLayout( group, 5, 2, spacingHint() ); |
88 | gbox->addRowSpacing( 0, fontMetrics().lineSpacing() ); | 88 | gbox->addRowSpacing( 0, fontMetrics().lineSpacing() ); |
89 | gbox->setRowStretch( 4, 10 ); | 89 | gbox->setRowStretch( 4, 10 ); |
90 | 90 | ||
91 | m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group ); | 91 | m_opt1 = new QCheckBox( i18n( "C&ase Sensitive" ), group ); |
92 | gbox->addWidget( m_opt1, 1, 0 ); | 92 | gbox->addWidget( m_opt1, 1, 0 ); |
93 | 93 | ||
94 | m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group ); | 94 | m_opt2 = new QCheckBox(i18n("&Whole Words Only" ), group ); |
95 | gbox->addWidget( m_opt2, 2, 0 ); | 95 | gbox->addWidget( m_opt2, 2, 0 ); |
96 | 96 | ||
97 | m_opt3 = new QCheckBox(i18n("&From Beginning" ), group ); | 97 | m_opt3 = new QCheckBox(i18n("&From Beginning" ), group ); |
98 | gbox->addWidget( m_opt3, 3, 0 ); | 98 | gbox->addWidget( m_opt3, 3, 0 ); |
99 | 99 | ||
100 | m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group ); | 100 | m_opt4 = new QCheckBox(i18n("Find &Backwards" ), group ); |
101 | gbox->addWidget( m_opt4, 1, 1 ); | 101 | gbox->addWidget( m_opt4, 1, 1 ); |
102 | 102 | ||
103 | m_opt5 = new QCheckBox(i18n("&Selected Text" ), group ); | 103 | m_opt5 = new QCheckBox(i18n("&Selected Text" ), group ); |
104 | gbox->addWidget( m_opt5, 2, 1 ); | 104 | gbox->addWidget( m_opt5, 2, 1 ); |
105 | 105 | ||
106 | m_opt1->setChecked( flags & KateView::sfCaseSensitive ); | 106 | m_opt1->setChecked( flags & KateView::sfCaseSensitive ); |
107 | m_opt2->setChecked( flags & KateView::sfWholeWords ); | 107 | m_opt2->setChecked( flags & KateView::sfWholeWords ); |
108 | m_opt3->setChecked( flags & KateView::sfFromBeginning ); | 108 | m_opt3->setChecked( flags & KateView::sfFromBeginning ); |
109 | m_optRegExp->setChecked( flags & KateView::sfRegularExpression ); | 109 | m_optRegExp->setChecked( flags & KateView::sfRegularExpression ); |
110 | m_opt4->setChecked( flags & KateView::sfBackward ); | 110 | m_opt4->setChecked( flags & KateView::sfBackward ); |
111 | m_opt5->setChecked( flags & KateView::sfSelected ); | 111 | m_opt5->setChecked( flags & KateView::sfSelected ); |
112 | 112 | ||
113 | if( m_replace ) | 113 | if( m_replace ) |
114 | { | 114 | { |
115 | m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group ); | 115 | m_opt6 = new QCheckBox( i18n( "&Prompt On Replace" ), group ); |
116 | m_opt6->setChecked( flags & KateView::sfPrompt ); | 116 | m_opt6->setChecked( flags & KateView::sfPrompt ); |
117 | gbox->addWidget( m_opt6, 3, 1 ); | 117 | gbox->addWidget( m_opt6, 3, 1 ); |
118 | } | 118 | } |
119 | 119 | ||
120 | m_search->setFocus(); | 120 | m_search->setFocus(); |
121 | } | 121 | } |
122 | 122 | ||
123 | QString SearchDialog::getSearchFor() | 123 | QString SearchDialog::getSearchFor() |
124 | { | 124 | { |
125 | return m_search->currentText(); | 125 | return m_search->currentText(); |
126 | } | 126 | } |
127 | 127 | ||
128 | QString SearchDialog::getReplaceWith() | 128 | QString SearchDialog::getReplaceWith() |
129 | { | 129 | { |
130 | return m_replace->currentText(); | 130 | return m_replace->currentText(); |
131 | } | 131 | } |
132 | 132 | ||
133 | int SearchDialog::getFlags() | 133 | int SearchDialog::getFlags() |
134 | { | 134 | { |
135 | int flags = 0; | 135 | int flags = 0; |
136 | 136 | ||
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 occurence?"),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 | e1->setFocus(); | 233 | e1->setFocus(); |
234 | } | 234 | } |
235 | 235 | ||
236 | int GotoLineDialog::getLine() { | 236 | int GotoLineDialog::getLine() { |
237 | return e1->value(); | 237 | return e1->value(); |
238 | } | 238 | } |
239 | 239 | ||
240 | const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent, | 240 | const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent, |
241 | KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces}; | 241 | KateView::cfBackspaceIndents,KateView::cfTabIndents, KateView::cfKeepIndentProfile, KateView::cfKeepExtraSpaces}; |
242 | 242 | ||
243 | IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view) | 243 | IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view) |
244 | : QWidget(parent, 0L) | 244 | : QWidget(parent, 0L) |
245 | { | 245 | { |
246 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); | 246 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); |
247 | int configFlags = view->config(); | 247 | int configFlags = view->config(); |
248 | 248 | ||
249 | opt[0] = new QCheckBox(i18n("&Auto Indent"), this); | 249 | opt[0] = new QCheckBox(i18n("&Auto Indent"), this); |
250 | layout->addWidget(opt[0], 0, AlignLeft); | 250 | layout->addWidget(opt[0], 0, AlignLeft); |
251 | opt[0]->setChecked(configFlags & flags[0]); | 251 | opt[0]->setChecked(configFlags & flags[0]); |
252 | 252 | ||
253 | opt[1] = new QCheckBox(i18n("Indent With &Spaces"), this); | 253 | opt[1] = new QCheckBox(i18n("Indent With &Spaces"), this); |
254 | layout->addWidget(opt[1], 0, AlignLeft); | 254 | layout->addWidget(opt[1], 0, AlignLeft); |
255 | opt[1]->setChecked(configFlags & flags[1]); | 255 | opt[1]->setChecked(configFlags & flags[1]); |
256 | 256 | ||
257 | opt[2] = new QCheckBox(i18n("&Backspace Key Indents"), this); | 257 | opt[2] = new QCheckBox(i18n("&Backspace Key Indents"), this); |
258 | layout->addWidget(opt[2], 0, AlignLeft); | 258 | layout->addWidget(opt[2], 0, AlignLeft); |
259 | opt[2]->setChecked(configFlags & flags[2]); | 259 | opt[2]->setChecked(configFlags & flags[2]); |
260 | 260 | ||
261 | opt[3] = new QCheckBox(i18n("&Tab Key Indents"), this); | 261 | opt[3] = new QCheckBox(i18n("&Tab Key Indents"), this); |
262 | layout->addWidget(opt[3], 0, AlignLeft); | 262 | layout->addWidget(opt[3], 0, AlignLeft); |
263 | opt[3]->setChecked(configFlags & flags[3]); | 263 | opt[3]->setChecked(configFlags & flags[3]); |
264 | 264 | ||
265 | opt[4] = new QCheckBox(i18n("Keep Indent &Profile"), this); | 265 | opt[4] = new QCheckBox(i18n("Keep Indent &Profile"), this); |
266 | layout->addWidget(opt[4], 0, AlignLeft); | 266 | layout->addWidget(opt[4], 0, AlignLeft); |
267 | // opt[4]->setChecked(configFlags & flags[4]); | 267 | // opt[4]->setChecked(configFlags & flags[4]); |
268 | opt[4]->setChecked(true); | 268 | opt[4]->setChecked(true); |
269 | opt[4]->hide(); | 269 | opt[4]->hide(); |
270 | 270 | ||
271 | opt[5] = new QCheckBox(i18n("&Keep Extra Spaces"), this); | 271 | opt[5] = new QCheckBox(i18n("&Keep Extra Spaces"), this); |
272 | layout->addWidget(opt[5], 0, AlignLeft); | 272 | layout->addWidget(opt[5], 0, AlignLeft); |
273 | opt[5]->setChecked(configFlags & flags[5]); | 273 | opt[5]->setChecked(configFlags & flags[5]); |
274 | 274 | ||
275 | layout->addStretch(); | 275 | layout->addStretch(); |
276 | 276 | ||
277 | // What is this? help | 277 | // 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")); | 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")); |
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")); | 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")); |
280 | QWhatsThis::add(opt[2], i18n("This allows the <b>backspace</b> key to be used to indent.")); | 280 | 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.")); | 281 | 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.")); | 282 | 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.")); | 283 | QWhatsThis::add(opt[5], i18n("Indentations of more than the selected number of spaces will not be shortened.")); |
284 | } | 284 | } |
285 | 285 | ||
286 | void IndentConfigTab::getData(KateView *view) { | 286 | void IndentConfigTab::getData(KateView *view) { |
287 | int configFlags, z; | 287 | int configFlags, z; |
288 | 288 | ||
289 | configFlags = view->config(); | 289 | configFlags = view->config(); |
290 | for (z = 0; z < numFlags; z++) { | 290 | for (z = 0; z < numFlags; z++) { |
291 | configFlags &= ~flags[z]; | 291 | configFlags &= ~flags[z]; |
292 | if (opt[z]->isChecked()) configFlags |= flags[z]; | 292 | if (opt[z]->isChecked()) configFlags |= flags[z]; |
293 | } | 293 | } |
294 | view->setConfig(configFlags); | 294 | view->setConfig(configFlags); |
295 | } | 295 | } |
296 | 296 | ||
297 | const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput, | 297 | const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput, |
298 | KateView::cfMouseAutoCopy, KateView::cfSingleSelection, KateView::cfVerticalSelect, KateView::cfXorSelect}; | 298 | KateView::cfMouseAutoCopy, KateView::cfSingleSelection, KateView::cfVerticalSelect, KateView::cfXorSelect}; |
299 | 299 | ||
300 | SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view) | 300 | SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view) |
301 | : QWidget(parent, 0L) | 301 | : QWidget(parent, 0L) |
302 | { | 302 | { |
303 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); | 303 | QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() ); |
304 | int configFlags = view->config(); | 304 | int configFlags = view->config(); |
305 | 305 | ||
306 | opt[0] = new QCheckBox(i18n("&Persistent Selections"), this); | 306 | opt[0] = new QCheckBox(i18n("&Persistent Selections"), this); |
307 | layout->addWidget(opt[0], 0, AlignLeft); | 307 | layout->addWidget(opt[0], 0, AlignLeft); |
308 | opt[0]->setChecked(configFlags & flags[0]); | 308 | opt[0]->setChecked(configFlags & flags[0]); |
309 | 309 | ||
310 | opt[1] = new QCheckBox(i18n("&Overwrite Selections"), this); | 310 | opt[1] = new QCheckBox(i18n("&Overwrite Selections"), this); |
311 | layout->addWidget(opt[1], 0, AlignLeft); | 311 | layout->addWidget(opt[1], 0, AlignLeft); |
312 | opt[1]->setChecked(configFlags & flags[1]); | 312 | opt[1]->setChecked(configFlags & flags[1]); |
313 | 313 | ||
314 | opt[2] = new QCheckBox(i18n("Mouse &Autocopy"), this); | 314 | opt[2] = new QCheckBox(i18n("Mouse &Autocopy"), this); |
315 | layout->addWidget(opt[2], 0, AlignLeft); | 315 | layout->addWidget(opt[2], 0, AlignLeft); |
316 | opt[2]->setChecked(configFlags & flags[2]); | 316 | opt[2]->setChecked(configFlags & flags[2]); |
317 | 317 | ||
318 | opt[3] = new QCheckBox(i18n("&X11-like Single Selection"), this); | 318 | opt[3] = new QCheckBox(i18n("&X11-like Single Selection"), this); |
319 | layout->addWidget(opt[3], 0, AlignLeft); | 319 | layout->addWidget(opt[3], 0, AlignLeft); |
320 | opt[3]->setChecked(configFlags & flags[3]); | 320 | opt[3]->setChecked(configFlags & flags[3]); |
321 | 321 | ||
322 | opt[4] = new QCheckBox(i18n("&Vertical Selections"), this); | 322 | opt[4] = new QCheckBox(i18n("&Vertical Selections"), this); |
323 | layout->addWidget(opt[4], 0, AlignLeft); | 323 | layout->addWidget(opt[4], 0, AlignLeft); |
324 | opt[4]->setChecked(configFlags & flags[4]); | 324 | opt[4]->setChecked(configFlags & flags[4]); |
325 | 325 | ||
326 | opt[5] = new QCheckBox(i18n("&Toggle Old"), this); | 326 | opt[5] = new QCheckBox(i18n("&Toggle Old"), this); |
327 | layout->addWidget(opt[5], 0, AlignLeft); | 327 | layout->addWidget(opt[5], 0, AlignLeft); |
328 | opt[5]->setChecked(configFlags & flags[5]); | 328 | opt[5]->setChecked(configFlags & flags[5]); |
329 | 329 | ||
330 | layout->addStretch(); | 330 | layout->addStretch(); |
331 | 331 | ||
332 | // What is this? help | 332 | // What is this? help |
333 | 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[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.")); |
334 | 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[1], i18n("When this is on, any keyed character input or paste operation will replace the selected text.")); |
335 | 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[2], i18n("When this is on, any text selected with the mouse will be automatically copied to the clipboard.")); |
336 | QWhatsThis::add(opt[3], i18n("Not implemented yet.")); | 336 | QWhatsThis::add(opt[3], i18n("Not implemented yet.")); |
337 | QWhatsThis::add(opt[4], i18n("Enabling this allows you to make vertical selections.")); | 337 | QWhatsThis::add(opt[4], i18n("Enabling this allows you to make vertical selections.")); |
338 | QWhatsThis::add(opt[5], i18n("Not yet implemented.")); | 338 | QWhatsThis::add(opt[5], i18n("Not yet implemented.")); |
339 | } | 339 | } |
340 | 340 | ||
341 | void SelectConfigTab::getData(KateView *view) { | 341 | void SelectConfigTab::getData(KateView *view) { |
342 | int configFlags, z; | 342 | int configFlags, z; |
343 | 343 | ||
344 | configFlags = view->config(); | 344 | configFlags = view->config(); |
345 | for (z = 0; z < numFlags; z++) { | 345 | for (z = 0; z < numFlags; z++) { |
346 | configFlags &= ~flags[z]; // clear flag | 346 | configFlags &= ~flags[z]; // clear flag |
347 | if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked | 347 | if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked |
348 | } | 348 | } |
349 | view->setConfig(configFlags); | 349 | view->setConfig(configFlags); |
350 | } | 350 | } |
351 | 351 | ||
352 | const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces, | 352 | const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces, |
353 | KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome, | 353 | KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome, |
354 | KateView::cfPageUDMovesCursor, KateView::cfWrapCursor}; | 354 | KateView::cfPageUDMovesCursor, KateView::cfWrapCursor}; |
355 | 355 | ||
356 | EditConfigTab::EditConfigTab(QWidget *parent, KateView *view) | 356 | EditConfigTab::EditConfigTab(QWidget *parent, KateView *view) |
357 | : QWidget(parent, 0L) { | 357 | : QWidget(parent, 0L) { |
358 | 358 | ||
359 | QHBoxLayout *mainLayout; | 359 | QHBoxLayout *mainLayout; |
360 | QVBoxLayout *cbLayout, *leLayout; | 360 | QVBoxLayout *cbLayout, *leLayout; |
361 | int configFlags; | 361 | int configFlags; |
362 | 362 | ||
363 | mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() ); | 363 | mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() ); |
364 | 364 | ||
365 | // checkboxes | 365 | // checkboxes |
366 | cbLayout = new QVBoxLayout( mainLayout ); | 366 | cbLayout = new QVBoxLayout( mainLayout ); |
367 | configFlags = view->config(); | 367 | configFlags = view->config(); |
368 | 368 | ||
369 | opt[0] = new QCheckBox(i18n("&Word wrap"), this); | 369 | opt[0] = new QCheckBox(i18n("&Word wrap"), this); |
370 | cbLayout->addWidget(opt[0], 0, AlignLeft); | 370 | cbLayout->addWidget(opt[0], 0, AlignLeft); |
371 | opt[0]->setChecked(view->doc()->wordWrap()); | 371 | opt[0]->setChecked(view->doc()->wordWrap()); |
372 | 372 | ||
373 | opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this); | 373 | opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this); |
374 | cbLayout->addWidget(opt[1], 0, AlignLeft); | 374 | cbLayout->addWidget(opt[1], 0, AlignLeft); |
375 | opt[1]->setChecked(configFlags & flags[1]); | 375 | opt[1]->setChecked(configFlags & flags[1]); |
376 | 376 | ||
377 | opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this); | 377 | opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this); |
378 | cbLayout->addWidget(opt[2], 0, AlignLeft); | 378 | cbLayout->addWidget(opt[2], 0, AlignLeft); |
379 | opt[2]->setChecked(configFlags & flags[2]); | 379 | opt[2]->setChecked(configFlags & flags[2]); |
380 | 380 | ||
381 | opt[3] = new QCheckBox(i18n("&Auto brackets"), this); | 381 | opt[3] = new QCheckBox(i18n("&Auto brackets"), this); |
382 | cbLayout->addWidget(opt[3], 0, AlignLeft); | 382 | cbLayout->addWidget(opt[3], 0, AlignLeft); |
383 | opt[3]->setChecked(configFlags & flags[3]); | 383 | opt[3]->setChecked(configFlags & flags[3]); |