summaryrefslogtreecommitdiff
authorpaule <paule>2007-01-13 07:05:32 (UTC)
committer paule <paule>2007-01-13 07:05:32 (UTC)
commitc0eb83f37ec3c49d0c6b322840605f2a95ea0b52 (patch) (unidiff)
treee776b5f8fd7f5d8f5ff5e9e3c6d9d638999ed622
parent75c65c1dc728929f0430b8faf956195657b73311 (diff)
downloadopie-c0eb83f37ec3c49d0c6b322840605f2a95ea0b52.zip
opie-c0eb83f37ec3c49d0c6b322840605f2a95ea0b52.tar.gz
opie-c0eb83f37ec3c49d0c6b322840605f2a95ea0b52.tar.bz2
Set sensible minimum width for Goto Line dialog
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/view/kateviewdialog.cpp3
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
@@ -41,384 +41,387 @@
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
50using namespace Opie::Ui; 50using namespace Opie::Ui;
51SearchDialog::SearchDialog( QWidget *parent, QStringList &searchFor, QStringList &replaceWith, int flags ) 51SearchDialog::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
123QString SearchDialog::getSearchFor() 123QString SearchDialog::getSearchFor()
124{ 124{
125 return m_search->currentText(); 125 return m_search->currentText();
126} 126}
127 127
128QString SearchDialog::getReplaceWith() 128QString SearchDialog::getReplaceWith()
129{ 129{
130 return m_replace->currentText(); 130 return m_replace->currentText();
131} 131}
132 132
133int SearchDialog::getFlags() 133int 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
154void SearchDialog::slotOk() 154void 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
174void SearchDialog::setSearchText( const QString &searchstr ) 174void 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
182ReplacePrompt::ReplacePrompt( QWidget *parent ) 182ReplacePrompt::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
195void ReplacePrompt::slotUser1( void ) { // All 195void ReplacePrompt::slotUser1( void ) { // All
196 done(KateView::srAll); 196 done(KateView::srAll);
197} 197}
198 198
199void ReplacePrompt::slotUser2( void ) { // No 199void ReplacePrompt::slotUser2( void ) { // No
200 done(KateView::srNo); 200 done(KateView::srNo);
201} 201}
202 202
203void ReplacePrompt::slotUser3( void ) { // Yes 203void ReplacePrompt::slotUser3( void ) { // Yes
204 accept(); 204 accept();
205} 205}
206 206
207void ReplacePrompt::done(int r) { 207void ReplacePrompt::done(int r) {
208 setResult(r); 208 setResult(r);
209 emit clicked(); 209 emit clicked();
210} 210}
211 211
212void ReplacePrompt::closeEvent(QCloseEvent *) { 212void ReplacePrompt::closeEvent(QCloseEvent *) {
213 reject(); 213 reject();
214} 214}
215 215
216GotoLineDialog::GotoLineDialog(QWidget *parent, int line, int max) 216GotoLineDialog::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
236int GotoLineDialog::getLine() { 239int GotoLineDialog::getLine() {
237 return e1->value(); 240 return e1->value();
238} 241}
239 242
240const int IndentConfigTab::flags[] = {KateView::cfAutoIndent, KateView::cfSpaceIndent, 243const 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
243IndentConfigTab::IndentConfigTab(QWidget *parent, KateView *view) 246IndentConfigTab::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
286void IndentConfigTab::getData(KateView *view) { 289void 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
297const int SelectConfigTab::flags[] = {KateView::cfPersistent, KateView::cfDelOnInput, 300const 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
300SelectConfigTab::SelectConfigTab(QWidget *parent, KateView *view) 303SelectConfigTab::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]);
329 332
330 layout->addStretch(); 333 layout->addStretch();
331 334
332 // What is this? help 335 // 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.")); 336 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.")); 337 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.")); 338 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.")); 339 QWhatsThis::add(opt[3], i18n("Not implemented yet."));
337 QWhatsThis::add(opt[4], i18n("Enabling this allows you to make vertical selections.")); 340 QWhatsThis::add(opt[4], i18n("Enabling this allows you to make vertical selections."));
338 QWhatsThis::add(opt[5], i18n("Not yet implemented.")); 341 QWhatsThis::add(opt[5], i18n("Not yet implemented."));
339} 342}
340 343
341void SelectConfigTab::getData(KateView *view) { 344void SelectConfigTab::getData(KateView *view) {
342 int configFlags, z; 345 int configFlags, z;
343 346
344 configFlags = view->config(); 347 configFlags = view->config();
345 for (z = 0; z < numFlags; z++) { 348 for (z = 0; z < numFlags; z++) {
346 configFlags &= ~flags[z]; // clear flag 349 configFlags &= ~flags[z]; // clear flag
347 if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked 350 if (opt[z]->isChecked()) configFlags |= flags[z]; // set flag if checked
348 } 351 }
349 view->setConfig(configFlags); 352 view->setConfig(configFlags);
350} 353}
351 354
352const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces, 355const int EditConfigTab::flags[] = {KateView::cfWordWrap, KateView::cfReplaceTabs, KateView::cfRemoveSpaces,
353 KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome, 356 KateView::cfAutoBrackets, KateView::cfGroupUndo, KateView::cfShowTabs, KateView::cfSmartHome,
354 KateView::cfPageUDMovesCursor, KateView::cfWrapCursor}; 357 KateView::cfPageUDMovesCursor, KateView::cfWrapCursor};
355 358
356EditConfigTab::EditConfigTab(QWidget *parent, KateView *view) 359EditConfigTab::EditConfigTab(QWidget *parent, KateView *view)
357 : QWidget(parent, 0L) { 360 : QWidget(parent, 0L) {
358 361
359 QHBoxLayout *mainLayout; 362 QHBoxLayout *mainLayout;
360 QVBoxLayout *cbLayout, *leLayout; 363 QVBoxLayout *cbLayout, *leLayout;
361 int configFlags; 364 int configFlags;
362 365
363 mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() ); 366 mainLayout = new QHBoxLayout(this, 0, KDialog::spacingHint() );
364 367
365 // checkboxes 368 // checkboxes
366 cbLayout = new QVBoxLayout( mainLayout ); 369 cbLayout = new QVBoxLayout( mainLayout );
367 configFlags = view->config(); 370 configFlags = view->config();
368 371
369 opt[0] = new QCheckBox(i18n("&Word wrap"), this); 372 opt[0] = new QCheckBox(i18n("&Word wrap"), this);
370 cbLayout->addWidget(opt[0], 0, AlignLeft); 373 cbLayout->addWidget(opt[0], 0, AlignLeft);
371 opt[0]->setChecked(view->doc()->wordWrap()); 374 opt[0]->setChecked(view->doc()->wordWrap());
372 375
373 opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this); 376 opt[1] = new QCheckBox(i18n("Replace &tabs with spaces"), this);
374 cbLayout->addWidget(opt[1], 0, AlignLeft); 377 cbLayout->addWidget(opt[1], 0, AlignLeft);
375 opt[1]->setChecked(configFlags & flags[1]); 378 opt[1]->setChecked(configFlags & flags[1]);
376 379
377 opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this); 380 opt[2] = new QCheckBox(i18n("&Remove trailing spaces"), this);
378 cbLayout->addWidget(opt[2], 0, AlignLeft); 381 cbLayout->addWidget(opt[2], 0, AlignLeft);
379 opt[2]->setChecked(configFlags & flags[2]); 382 opt[2]->setChecked(configFlags & flags[2]);
380 383
381 opt[3] = new QCheckBox(i18n("&Auto brackets"), this); 384 opt[3] = new QCheckBox(i18n("&Auto brackets"), this);
382 cbLayout->addWidget(opt[3], 0, AlignLeft); 385 cbLayout->addWidget(opt[3], 0, AlignLeft);
383 opt[3]->setChecked(configFlags & flags[3]); 386 opt[3]->setChecked(configFlags & flags[3]);
384 387
385 opt[4] = new QCheckBox(i18n("Group &undos"), this); 388 opt[4] = new QCheckBox(i18n("Group &undos"), this);
386 cbLayout->addWidget(opt[4], 0, AlignLeft); 389 cbLayout->addWidget(opt[4], 0, AlignLeft);
387 opt[4]->setChecked(configFlags & flags[4]); 390 opt[4]->setChecked(configFlags & flags[4]);
388 391
389 opt[5] = new QCheckBox(i18n("&Show tabs"), this); 392 opt[5] = new QCheckBox(i18n("&Show tabs"), this);
390 cbLayout->addWidget(opt[5], 0, AlignLeft); 393 cbLayout->addWidget(opt[5], 0, AlignLeft);
391 opt[5]->setChecked(configFlags & flags[5]); 394 opt[5]->setChecked(configFlags & flags[5]);
392 395
393 opt[6] = new QCheckBox(i18n("Smart &home"), this); 396 opt[6] = new QCheckBox(i18n("Smart &home"), this);
394 cbLayout->addWidget(opt[6], 0, AlignLeft); 397 cbLayout->addWidget(opt[6], 0, AlignLeft);
395 opt[6]->setChecked(configFlags & flags[6]); 398 opt[6]->setChecked(configFlags & flags[6]);
396 399
397 opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this); 400 opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this);
398 cbLayout->addWidget(opt[7], 0, AlignLeft); 401 cbLayout->addWidget(opt[7], 0, AlignLeft);
399 opt[7]->setChecked(configFlags & flags[7]); 402 opt[7]->setChecked(configFlags & flags[7]);
400 403
401 opt[8] = new QCheckBox(i18n("Wrap &cursor"), this); 404 opt[8] = new QCheckBox(i18n("Wrap &cursor"), this);
402 cbLayout->addWidget(opt[8], 0, AlignLeft); 405 cbLayout->addWidget(opt[8], 0, AlignLeft);
403 opt[8]->setChecked(configFlags & flags[8]); 406 opt[8]->setChecked(configFlags & flags[8]);
404 407
405 cbLayout->addStretch(); 408 cbLayout->addStretch();
406 409
407 // edit lines 410 // edit lines
408 leLayout = new QVBoxLayout(); 411 leLayout = new QVBoxLayout();
409 mainLayout->addLayout(leLayout,10); 412 mainLayout->addLayout(leLayout,10);
410 413
411 e1 = new QSpinBox(this); 414 e1 = new QSpinBox(this);
412 e1->setMinValue(20); 415 e1->setMinValue(20);
413 e1->setMaxValue( 200); 416 e1->setMaxValue( 200);
414 e1->setValue((int)(view->doc()->wordWrapAt())); 417 e1->setValue((int)(view->doc()->wordWrapAt()));
415#warning fixme e1->setLabel(i18n("Wrap Words At:")); 418#warning fixme e1->setLabel(i18n("Wrap Words At:"));
416 419
417 e2 = new QSpinBox(this); 420 e2 = new QSpinBox(this);
418 e2->setMinValue(1); 421 e2->setMinValue(1);
419 e2->setMaxValue(16); 422 e2->setMaxValue(16);
420 e2->setValue((int)view->tabWidth()); 423 e2->setValue((int)view->tabWidth());
421 424
422#warning fixme e2->setLabel(i18n("Tab/Indent Width:")); 425#warning fixme e2->setLabel(i18n("Tab/Indent Width:"));
423 426
424 e3 = new QSpinBox(this); 427 e3 = new QSpinBox(this);