-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,572 +1,572 @@ | |||
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]); |
384 | 384 | ||
385 | opt[4] = new QCheckBox(i18n("Group &undos"), this); | 385 | opt[4] = new QCheckBox(i18n("Group &undos"), this); |
386 | cbLayout->addWidget(opt[4], 0, AlignLeft); | 386 | cbLayout->addWidget(opt[4], 0, AlignLeft); |
387 | opt[4]->setChecked(configFlags & flags[4]); | 387 | opt[4]->setChecked(configFlags & flags[4]); |
388 | 388 | ||
389 | opt[5] = new QCheckBox(i18n("&Show tabs"), this); | 389 | opt[5] = new QCheckBox(i18n("&Show tabs"), this); |
390 | cbLayout->addWidget(opt[5], 0, AlignLeft); | 390 | cbLayout->addWidget(opt[5], 0, AlignLeft); |
391 | opt[5]->setChecked(configFlags & flags[5]); | 391 | opt[5]->setChecked(configFlags & flags[5]); |
392 | 392 | ||
393 | opt[6] = new QCheckBox(i18n("Smart &home"), this); | 393 | opt[6] = new QCheckBox(i18n("Smart &home"), this); |
394 | cbLayout->addWidget(opt[6], 0, AlignLeft); | 394 | cbLayout->addWidget(opt[6], 0, AlignLeft); |
395 | opt[6]->setChecked(configFlags & flags[6]); | 395 | opt[6]->setChecked(configFlags & flags[6]); |
396 | 396 | ||
397 | opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this); | 397 | opt[7] = new QCheckBox(i18n("&Page up/down moves cursor"), this); |
398 | cbLayout->addWidget(opt[7], 0, AlignLeft); | 398 | cbLayout->addWidget(opt[7], 0, AlignLeft); |
399 | opt[7]->setChecked(configFlags & flags[7]); | 399 | opt[7]->setChecked(configFlags & flags[7]); |
400 | 400 | ||
401 | opt[8] = new QCheckBox(i18n("Wrap &cursor"), this); | 401 | opt[8] = new QCheckBox(i18n("Wrap &cursor"), this); |
402 | cbLayout->addWidget(opt[8], 0, AlignLeft); | 402 | cbLayout->addWidget(opt[8], 0, AlignLeft); |
403 | opt[8]->setChecked(configFlags & flags[8]); | 403 | opt[8]->setChecked(configFlags & flags[8]); |
404 | 404 | ||
405 | cbLayout->addStretch(); | 405 | cbLayout->addStretch(); |
406 | 406 | ||
407 | // edit lines | 407 | // edit lines |
408 | leLayout = new QVBoxLayout(); | 408 | leLayout = new QVBoxLayout(); |
409 | mainLayout->addLayout(leLayout,10); | 409 | mainLayout->addLayout(leLayout,10); |
410 | 410 | ||
411 | e1 = new QSpinBox(this); | 411 | e1 = new QSpinBox(this); |
412 | e1->setMinValue(20); | 412 | e1->setMinValue(20); |
413 | e1->setMaxValue( 200); | 413 | e1->setMaxValue( 200); |
414 | e1->setValue((int)(view->doc()->wordWrapAt())); | 414 | e1->setValue((int)(view->doc()->wordWrapAt())); |
415 | #warning fixme e1->setLabel(i18n("Wrap Words At:")); | 415 | #warning fixme e1->setLabel(i18n("Wrap Words At:")); |
416 | 416 | ||
417 | e2 = new QSpinBox(this); | 417 | e2 = new QSpinBox(this); |
418 | e2->setMinValue(1); | 418 | e2->setMinValue(1); |
419 | e2->setMaxValue(16); | 419 | e2->setMaxValue(16); |
420 | e2->setValue((int)view->tabWidth()); | 420 | e2->setValue((int)view->tabWidth()); |
421 | 421 | ||
422 | #warning fixme e2->setLabel(i18n("Tab/Indent Width:")); | 422 | #warning fixme e2->setLabel(i18n("Tab/Indent Width:")); |
423 | 423 | ||
424 | e3 = new QSpinBox(this); | 424 | e3 = new QSpinBox(this); |
425 | e3->setMinValue(5); | 425 | e3->setMinValue(5); |
426 | e3->setMaxValue( 30000); | 426 | e3->setMaxValue( 30000); |
427 | #warning fixme e3->setLabel(i18n("Undo steps:")); | 427 | #warning fixme e3->setLabel(i18n("Undo steps:")); |
428 | e3->setValue((int)view->undoSteps()); | 428 | e3->setValue((int)view->undoSteps()); |
429 | 429 | ||
430 | leLayout->addWidget(e1, 0, AlignLeft); | 430 | leLayout->addWidget(e1, 0, AlignLeft); |
431 | leLayout->addWidget(e2, 0, AlignLeft); | 431 | leLayout->addWidget(e2, 0, AlignLeft); |
432 | leLayout->addWidget(e3, 0, AlignLeft); | 432 | leLayout->addWidget(e3, 0, AlignLeft); |
433 | 433 | ||
434 | 434 | ||
435 | QVBox *box = new QVBox (this); | 435 | QVBox *box = new QVBox (this); |
436 | leLayout->addWidget (box, 0, AlignLeft); | 436 | leLayout->addWidget (box, 0, AlignLeft); |
437 | 437 | ||
438 | new QLabel (i18n("Encoding:"), box); | 438 | new QLabel (i18n("Encoding:"), box); |
439 | 439 | ||
440 | encoding = new QComboBox(box); | 440 | encoding = new QComboBox(box); |
441 | #warning fixme | 441 | #warning fixme |
442 | #if 0 | 442 | #if 0 |
443 | encoding->insertStringList (KGlobal::charsets()->availableEncodingNames()); | 443 | encoding->insertStringList (KGlobal::charsets()->availableEncodingNames()); |
444 | encoding->setCurrentItem (KGlobal::charsets()->availableEncodingNames().findIndex(view->doc()->encoding())); | 444 | encoding->setCurrentItem (KGlobal::charsets()->availableEncodingNames().findIndex(view->doc()->encoding())); |
445 | #endif | 445 | #endif |
446 | leLayout->addStretch(); | 446 | leLayout->addStretch(); |
447 | 447 | ||
448 | // What is this? help | 448 | // What is this? help |
449 | 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(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.")); |
450 | 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(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.")); |
451 | QWhatsThis::add(opt[1], i18n("KateView will replace any tabs with the number of spaces indicated in the Tab Width: entry.")); | 451 | QWhatsThis::add(opt[1], i18n("KateView will replace any tabs with the number of spaces indicated in the Tab Width: entry.")); |
452 | 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(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.")); |
453 | QWhatsThis::add(opt[2], i18n("KateView will automatically eliminate extra spaces at the ends of lines of text.")); | 453 | QWhatsThis::add(opt[2], i18n("KateView will automatically eliminate extra spaces at the ends of lines of text.")); |
454 | 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[3], i18n("When the user types a left bracket ([,(, or {) KateView automatically enters the right bracket (}, ), or ]) to the right of the cursor.")); |
455 | QWhatsThis::add(opt[4], i18n("Checking this will cause sequences of similar actions to be undone at once.")); | 455 | QWhatsThis::add(opt[4], i18n("Checking this will cause sequences of similar actions to be undone at once.")); |
456 | 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[5], i18n("The editor will display a symbol to indicate the presence of a tab in the text.")); |
457 | QWhatsThis::add(opt[6], i18n("Not yet implemented.")); | 457 | QWhatsThis::add(opt[6], i18n("Not yet implemented.")); |
458 | 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(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.")); |
459 | QWhatsThis::add(e3, i18n("Sets the number of undo/redo steps to record. More steps uses more memory.")); | 459 | QWhatsThis::add(e3, i18n("Sets the number of undo/redo steps to record. More steps uses more memory.")); |
460 | 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 | 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.")); |
461 | } | 461 | } |
462 | 462 | ||
463 | void EditConfigTab::getData(KateView *view) | 463 | void EditConfigTab::getData(KateView *view) |
464 | { | 464 | { |
465 | int configFlags, z; | 465 | int configFlags, z; |
466 | 466 | ||
467 | configFlags = view->config(); | 467 | configFlags = view->config(); |
468 | for (z = 1; z < numFlags; z++) { | 468 | for (z = 1; z < numFlags; z++) { |
469 | configFlags &= ~flags[z]; | 469 | configFlags &= ~flags[z]; |
470 | if (opt[z]->isChecked()) configFlags |= flags[z]; | 470 | if (opt[z]->isChecked()) configFlags |= flags[z]; |
471 | } | 471 | } |
472 | view->setConfig(configFlags); | 472 | view->setConfig(configFlags); |
473 | 473 | ||
474 | view->setEncoding (encoding->currentText()); | 474 | view->setEncoding (encoding->currentText()); |
475 | view->doc()->setWordWrapAt(e1->value()); | 475 | view->doc()->setWordWrapAt(e1->value()); |
476 | view->doc()->setWordWrap (opt[0]->isChecked()); | 476 | view->doc()->setWordWrap (opt[0]->isChecked()); |
477 | view->setTabWidth(e2->value()); | 477 | view->setTabWidth(e2->value()); |
478 | view->setUndoSteps(e3->value()); | 478 | view->setUndoSteps(e3->value()); |
479 | } | 479 | } |
480 | 480 | ||
481 | ColorConfig::ColorConfig( QWidget *parent, char *name ) | 481 | ColorConfig::ColorConfig( QWidget *parent, char *name ) |
482 | : QWidget( parent, name ) | 482 | : QWidget( parent, name ) |
483 | { | 483 | { |
484 | QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint()); | 484 | QGridLayout *glay = new QGridLayout( this, 6, 2, 0, KDialog::spacingHint()); |
485 | glay->setColStretch(1,1); | 485 | glay->setColStretch(1,1); |
486 | glay->setRowStretch(5,1); | 486 | glay->setRowStretch(5,1); |
487 | 487 | ||
488 | QLabel *label; | 488 | QLabel *label; |
489 | 489 | ||
490 | label = new QLabel( i18n("Background:"), this); | 490 | label = new QLabel( i18n("Background:"), this); |
491 | label->setAlignment( AlignRight|AlignVCenter ); | 491 | label->setAlignment( AlignRight|AlignVCenter ); |
492 | m_back = new KColorButton( this ); | 492 | m_back = new KColorButton( this ); |
493 | glay->addWidget( label, 0, 0 ); | 493 | glay->addWidget( label, 0, 0 ); |
494 | glay->addWidget( m_back, 0, 1 ); | 494 | glay->addWidget( m_back, 0, 1 ); |
495 | 495 | ||
496 | label = new QLabel( i18n("Selected:"), this); | 496 | label = new QLabel( i18n("Selected:"), this); |
497 | label->setAlignment( AlignRight|AlignVCenter ); | 497 | label->setAlignment( AlignRight|AlignVCenter ); |
498 | m_selected = new KColorButton( this ); | 498 | m_selected = new KColorButton( this ); |
499 | glay->addWidget( label, 2, 0 ); | 499 | glay->addWidget( label, 2, 0 ); |
500 | glay->addWidget( m_selected, 2, 1 ); | 500 | glay->addWidget( m_selected, 2, 1 ); |
501 | 501 | ||
502 | // QWhatsThis help | 502 | // QWhatsThis help |
503 | QWhatsThis::add(m_back, i18n("Sets the background color of the editing area")); | 503 | QWhatsThis::add(m_back, i18n("Sets the background color of the editing area")); |
504 | 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 | 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.")); |
505 | } | 505 | } |
506 | 506 | ||
507 | 507 | ||
508 | ColorConfig::~ColorConfig() | 508 | ColorConfig::~ColorConfig() |
509 | { | 509 | { |
510 | } | 510 | } |
511 | 511 | ||
512 | void ColorConfig::setColors(QColor *colors) | 512 | void ColorConfig::setColors(QColor *colors) |
513 | { | 513 | { |
514 | m_back->setColor( colors[0] ); | 514 | m_back->setColor( colors[0] ); |
515 | m_selected->setColor( colors[1] ); | 515 | m_selected->setColor( colors[1] ); |
516 | } | 516 | } |
517 | 517 | ||
518 | void ColorConfig::getColors(QColor *colors) | 518 | void ColorConfig::getColors(QColor *colors) |
519 | { | 519 | { |
520 | colors[0] = m_back->color(); | 520 | colors[0] = m_back->color(); |
521 | colors[1] = m_selected->color(); | 521 | colors[1] = m_selected->color(); |
522 | } | 522 | } |
523 | 523 | ||
524 | FontConfig::FontConfig( QWidget *parent, char *name ) | 524 | FontConfig::FontConfig( QWidget *parent, char *name ) |
525 | : QWidget( parent, name ) | 525 | : QWidget( parent, name ) |
526 | { | 526 | { |
527 | // sizemanagment | 527 | // sizemanagment |
528 | QGridLayout *grid = new QGridLayout( this, 1, 1 ); | 528 | QGridLayout *grid = new QGridLayout( this, 1, 1 ); |
529 | // QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); | 529 | // QString familyStr = cfg. readEntry ( "FontFamily", "Helvetica" ); |
530 | // QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); | 530 | // QString styleStr = cfg. readEntry ( "FontStyle", "Regular" ); |
531 | // int size = cfg. readNumEntry ( "FontSize", 10 ); | 531 | // int size = cfg. readNumEntry ( "FontSize", 10 ); |
532 | // OFontSelector *m_fontselect; | 532 | // OFontSelector *m_fontselect; |
533 | 533 | ||
534 | m_fontselect = new OFontSelector ( false, this, "FontTab" ); | 534 | m_fontselect = new OFontSelector ( false, this, "FontTab" ); |
535 | // m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); | 535 | // m_fontselect-> setSelectedFont ( familyStr, styleStr, size ); |
536 | // QWhatsThis::add( m_fontselect, | 536 | // QWhatsThis::add( m_fontselect, |
537 | // tr( "Select the desired name, style and size of the default font applications will use." ) ); | 537 | // tr( "Select the desired name, style and size of the default font applications will use." ) ); |
538 | 538 | ||
539 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), | 539 | connect( m_fontselect, SIGNAL( fontSelected(const QFont&)), |
540 | this, SLOT( slotFontSelected(const QFont&))); | 540 | this, SLOT( slotFontSelected(const QFont&))); |
541 | grid->addWidget( m_fontselect, 0, 0); | 541 | grid->addWidget( m_fontselect, 0, 0); |
542 | 542 | ||
543 | 543 | ||
544 | // #if 0 | 544 | // #if 0 |
545 | // m_fontchooser = new KFontChooser ( this ); | 545 | // m_fontchooser = new KFontChooser ( this ); |
546 | // m_fontchooser->enableColumn(KFontChooser::StyleList, false); | 546 | // m_fontchooser->enableColumn(KFontChooser::StyleList, false); |
547 | // grid->addWidget( m_fontchooser, 0, 0); | 547 | // grid->addWidget( m_fontchooser, 0, 0); |
548 | 548 | ||
549 | // connect (m_fontchooser, SIGNAL (fontSelected(const QFont&)), this, SLOT (slotFontSelected(const QFont&))); | 549 | // connect (m_fontchooser, SIGNAL (fontSelected(const QFont&)), this, SLOT (slotFontSelected(const QFont&))); |
550 | // #endif | 550 | // #endif |
551 | } | 551 | } |
552 | 552 | ||
553 | FontConfig::~FontConfig() | 553 | FontConfig::~FontConfig() |
554 | { | 554 | { |
555 | } | 555 | } |
556 | 556 | ||
557 | void FontConfig::setFont ( const QFont &font ) | 557 | void FontConfig::setFont ( const QFont &font ) |
558 | { | 558 | { |
559 | //#if 0 | 559 | //#if 0 |
560 | m_fontselect->setFont (font); | 560 | m_fontselect->setFont (font); |
561 | myFont = font; | 561 | myFont = font; |
562 | //#endif | 562 | //#endif |
563 | } | 563 | } |
564 | 564 | ||
565 | void FontConfig::slotFontSelected( const QFont &font ) | 565 | void FontConfig::slotFontSelected( const QFont &font ) |
566 | { | 566 | { |
567 | myFont = font; | 567 | myFont = font; |
568 | } | 568 | } |
569 | 569 | ||
570 | 570 | ||
571 | 571 | ||
572 | 572 | ||