kword

KWConfig.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2001 Montel Laurent <lmontel@mandrakesoft.com>
3 Copyright (C) 2005 Thomas Zander <zander@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#include <tdeconfig.h>
22#include <kiconloader.h>
23#include <tdelocale.h>
24#include <KoUnitWidgets.h>
25#include <knuminput.h>
26#include <knumvalidator.h>
27#include <tdefontdialog.h>
28#include <kdebug.h>
29
30#include <tqcheckbox.h>
31#include <tqlabel.h>
32#include <tqvbox.h>
33#include <tqcombobox.h>
34#include <tqwhatsthis.h>
35#include <tqvgroupbox.h>
36#include <tqpushbutton.h>
37#include <tqlistbox.h>
38#include <tqlineedit.h>
39#include <tqlayout.h>
40
41#include "KWConfig.h"
42#include "KWView.h"
43#include "KWFrameSet.h"
44#include "KWDocument.h"
45#include "KWCanvas.h"
46#include "KWViewMode.h"
47#include "KWCommand.h"
48#include "KWVariable.h"
49#include "KoEditPath.h"
50#include "KWPageManager.h"
51#include "KWPage.h"
52#include "KoSpeaker.h"
53
54#include <KoVariable.h>
55#include <kformulaconfigpage.h>
56
57#include <tdespell2/configwidget.h>
58#include <tdespell2/settings.h>
59#include <tdespell2/broker.h>
60using namespace KSpell2;
61
62#include <float.h>
63#include <tdemessagebox.h>
64#include <tdelistview.h>
65#include <kstandarddirs.h>
66#include <tdeglobalsettings.h>
67#include <tdeglobal.h>
68#include <kurlrequesterdlg.h>
69#include <tdefiledialog.h>
70#include <tqtabwidget.h>
71#include <keditlistbox.h>
72#include <KoGlobal.h>
73
74// little helper stolen from kmail
75// (Note: KDialogBase should have version of the methods that take a TQString for the icon name)
76static inline TQPixmap loadIcon( const char * name ) {
77 return TDEGlobal::instance()->iconLoader()
78 ->loadIcon( TQString::fromLatin1(name), TDEIcon::NoGroup, TDEIcon::SizeMedium );
79}
80
81KWConfig::KWConfig( KWView* parent )
82 : KDialogBase(KDialogBase::IconList,i18n("Configure KWord") ,
83 KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel| KDialogBase::Default,
84 KDialogBase::Ok, parent)
85
86{
87 TQVBox *page2 = addVBoxPage( i18n("Interface"), i18n("Interface Settings"),
88 loadIcon("configure") );
89 m_interfacePage=new ConfigureInterfacePage(parent, page2);
90
91 TQVBox *page4 = addVBoxPage( i18n("Document"), i18n("Document Settings"),
92 loadIcon("x-office-document") );
93
94 m_defaultDocPage=new ConfigureDefaultDocPage(parent, page4);
95
96 TQVBox *page = addVBoxPage( i18n("Spelling"), i18n("Spell Checker Behavior"),
97 loadIcon("tools-check-spelling") );
98 m_spellPage = new ConfigureSpellPage(parent, page);
99
100 TQVBox *page5 = addVBoxPage( i18n("Formula"), i18n("Formula Defaults"),
101 loadIcon("kformula") );
102 m_formulaPage=new KFormula::ConfigurePage( parent->kWordDocument()->formulaDocument( false ),
103 this, KWFactory::instance()->config(), page5 );
104
105 TQVBox *page3 = addVBoxPage( i18n("Misc"), i18n("Misc Settings"),
106 loadIcon("misc") );
107 m_miscPage=new ConfigureMiscPage(parent, page3);
108
109 TQVBox *page6 = addVBoxPage( i18n("Path"), i18n("Path Settings"),
110 loadIcon("path") );
111 m_pathPage=new ConfigurePathPage(parent, page6);
112
113 if (KoSpeaker::isKttsdInstalled()) {
114 TQVBox *page7 = addVBoxPage( i18n("Abbreviation for Text-to-Speech", "TTS"),
115 i18n("Text-to-Speech Settings"), loadIcon("access") );
116 m_ttsPage=new ConfigureTTSPage(parent, page7);
117 } else m_ttsPage = 0;
118
119 m_doc = parent->kWordDocument();
120 connect(this, TQ_SIGNAL(okClicked()),this,TQ_SLOT(slotApply()));
121
122 connect( m_interfacePage, TQ_SIGNAL( unitChanged( int ) ), TQ_SLOT( unitChanged( int ) ) );
123 unitChanged( parent->kWordDocument()->unit() );
124}
125
126void KWConfig::unitChanged( int u )
127{
128 KoUnit::Unit unit = static_cast<KoUnit::Unit>(u);
129 //m_spellPage->setUnit( unit );
130 m_interfacePage->setUnit( unit );
131 m_miscPage->setUnit( unit );
132 m_defaultDocPage->setUnit( unit );
133 //m_formulaPage->setUnit( unit );
134 //m_pathPage->setUnit( unit );
135}
136
137void KWConfig::openPage(int flags)
138{
139 if(flags & KW_TDESPELL)
140 showPage( 2 );
141 else if(flags & KP_INTERFACE)
142 showPage(0 );
143 else if(flags & KP_MISC)
144 showPage(4);
145 else if(flags & KP_DOCUMENT)
146 showPage(2 );
147 else if(flags & KP_FORMULA)
148 showPage(3);
149 else if ( flags & KP_PATH )
150 showPage(4);
151}
152
153void KWConfig::slotApply()
154{
155 KMacroCommand *macro = 0L;
156 if (m_spellPage) m_spellPage->apply();
157 m_interfacePage->apply();
158 m_pathPage->apply();
159 KCommand * cmd = m_miscPage->apply();
160 if ( cmd )
161 {
162 if ( !macro )
163 macro = new KMacroCommand( i18n("Change Config"));
164 macro->addCommand(cmd);
165 }
166
167 cmd=m_defaultDocPage->apply();
168 if ( cmd )
169 {
170 if ( !macro )
171 macro = new KMacroCommand( i18n("Change Config"));
172
173 macro->addCommand( cmd );
174 }
175 m_formulaPage->apply();
176 if (m_ttsPage) m_ttsPage->apply();
177 if (macro)
178 m_doc->addCommand( macro );
179 KWFactory::instance()->config()->sync();
180}
181
182void KWConfig::slotDefault()
183{
184 switch(activePageIndex())
185 {
186 case 0:
187 m_interfacePage->slotDefault();
188 break;
189 case 1:
190 m_defaultDocPage->slotDefault();
191 break;
192 case 2:
193 if (m_spellPage) m_spellPage->slotDefault();
194 break;
195 case 3:
196 m_formulaPage->slotDefault();
197 break;
198 case 4:
199 m_miscPage->slotDefault();
200 break;
201 case 5:
202 m_pathPage->slotDefault();
203 break;
204 case 6:
205 m_ttsPage->slotDefault();
206 default:
207 break;
208 }
209}
210
212
213ConfigureSpellPage::ConfigureSpellPage( KWView *view, TQVBox *box, char *name )
214 : TQObject( box->parent(), name )
215{
216 m_pView=view;
217 config = KWFactory::instance()->config();
218 m_spellConfigWidget = new ConfigWidget( view->broker(), box );
219 m_spellConfigWidget->setBackgroundCheckingButtonShown( true );
220 m_spellConfigWidget->layout()->setMargin( 0 );
221}
222
223void ConfigureSpellPage::apply()
224{
225 KWDocument* doc = m_pView->kWordDocument();
226
227 m_spellConfigWidget->save();
228
229 m_pView->kWordDocument()->setSpellCheckIgnoreList(
230 m_pView->broker()->settings()->currentIgnoreList() );
231 //FIXME reactivate just if there are changes.
232 doc->enableBackgroundSpellCheck( m_pView->broker()->settings()->backgroundCheckerEnabled() );
233 doc->reactivateBgSpellChecking();
234}
235
236void ConfigureSpellPage::slotDefault()
237{
238 m_spellConfigWidget->slotDefault();
239}
240
241ConfigureInterfacePage::ConfigureInterfacePage( KWView *view, TQVBox *box, char *name )
242 : TQObject( box->parent(), name )
243{
244 m_pView=view;
245 config = KWFactory::instance()->config();
246 TQVGroupBox* gbInterfaceGroup = new TQVGroupBox( i18n("Interface"), box, "GroupBox" );
247 gbInterfaceGroup->setMargin( KDialog::marginHint() );
248 gbInterfaceGroup->setInsideSpacing( KDialog::spacingHint() );
249
250 double ptGridX=MM_TO_POINT(5.0 );
251 double ptGridY=MM_TO_POINT(5.0 );
252 double ptIndent = MM_TO_POINT(10.0);
253 bool oldShowStatusBar = true;
254 bool oldPgUpDownMovesCaret = false;
255 bool oldShowScrollBar = true;
256 oldNbRecentFiles=10;
257 int nbPagePerRow=4;
258 KoUnit::Unit unit = m_pView->kWordDocument()->unit();
259 if( config->hasGroup("Interface") )
260 {
261 config->setGroup( "Interface" );
262 ptGridX=config->readDoubleNumEntry("GridX", ptGridX);
263 ptGridY=config->readDoubleNumEntry("GridY", ptGridY);
264 ptIndent = config->readDoubleNumEntry("Indent", ptIndent);
265 oldNbRecentFiles=config->readNumEntry("NbRecentFile", oldNbRecentFiles);
266 nbPagePerRow=config->readNumEntry("nbPagePerRow", nbPagePerRow);
267 oldShowStatusBar = config->readBoolEntry( "ShowStatusBar", true );
268 oldPgUpDownMovesCaret = config->readBoolEntry( "PgUpDownMovesCaret", false );
269 oldShowScrollBar = config->readBoolEntry("ShowScrollBar", true);
270 }
271
272 TQHBox *hbUnit = new TQHBox(gbInterfaceGroup);
273 hbUnit->setSpacing(KDialog::spacingHint());
274 TQLabel *unitLabel= new TQLabel(i18n("&Units:"),hbUnit);
275
276 m_unitCombo = new TQComboBox( hbUnit );
277 m_unitCombo->insertStringList( KoUnit::listOfUnitName() );
278 connect(m_unitCombo, TQ_SIGNAL(activated(int)), this, TQ_SIGNAL(unitChanged(int)));
279 unitLabel->setBuddy( m_unitCombo );
280 TQString unitHelp = i18n("Select the unit type used every time a distance or width/height "
281 "is displayed or entered. This one setting is for the whole of KWord: all dialogs, the rulers etc. "
282 "Note that KWord documents specify the unit which was used to create them, so this setting "
283 "only affects this document and all documents that will be created later.");
284 TQWhatsThis::add( unitLabel, unitHelp );
285 TQWhatsThis::add( m_unitCombo, unitHelp );
286
287 showStatusBar = new TQCheckBox(i18n("Show &status bar"),gbInterfaceGroup);
288 showStatusBar->setChecked(oldShowStatusBar);
289 TQWhatsThis::add( showStatusBar, i18n("Show or hide the status bar. If enabled, the status bar is shown at the bottom, which displays various information."));
290
291 showScrollBar = new TQCheckBox( i18n("Show s&crollbar"), gbInterfaceGroup);
292 showScrollBar->setChecked(oldShowScrollBar);
293 TQWhatsThis::add( showScrollBar, i18n("Show or hide the scroll bar. If enabled, the scroll bar is shown on the right and lets you scroll up and down, which is useful for navigating through the document."));
294
295 pgUpDownMovesCaret = new TQCheckBox(i18n("PageUp/PageDown &moves the caret"),gbInterfaceGroup);
296 pgUpDownMovesCaret->setChecked(oldPgUpDownMovesCaret);
297 TQWhatsThis::add( pgUpDownMovesCaret, i18n(
298 "If this option is enabled, the PageUp and PageDown keys "
299 "move the text caret, as in other TDE applications. "
300 "If it is disabled, they move the scrollbars, as in most other word processors." ) );
301
302 TQHBox* hbRecent = new TQHBox( gbInterfaceGroup );
303 TQString recentHelp = i18n("The number of files remembered in the file open dialog and in the "
304 "recent files menu item.");
305 TQLabel* labelRecent = new TQLabel( i18n("Number of recent &files:"), hbRecent );
306 TQWhatsThis::add( labelRecent, recentHelp );
307 recentFiles=new KIntNumInput( oldNbRecentFiles, hbRecent );
308 recentFiles->setRange(1, 20, 1);
309 labelRecent->setBuddy( recentFiles );
310 TQWhatsThis::add( recentFiles, recentHelp );
311
312 TQHBox* hbGridX = new TQHBox( gbInterfaceGroup );
313 TQString gridxHelp = i18n("The grid size on which frames, tabs and other content snaps while "
314 "moving and scaling.");
315 TQLabel* labelGridX = new TQLabel( i18n("&Horizontal grid size:"), hbGridX );
316 TQWhatsThis::add( labelGridX, gridxHelp );
317 gridX=new KoUnitDoubleSpinBox( hbGridX,
318 0.1,
319 50,
320 0.1,
321 ptGridX,
322 unit );
323 labelGridX->setBuddy( gridX );
324 TQWhatsThis::add( gridX, gridxHelp );
325
326 TQHBox* hbGridY = new TQHBox( gbInterfaceGroup );
327 TQString gridyHelp = i18n("The grid size on which frames and other content snaps while "
328 "moving and scaling.");
329 TQLabel* labelGridY = new TQLabel( i18n("&Vertical grid size:"), hbGridY );
330 TQWhatsThis::add( labelGridY, gridyHelp );
331 gridY=new KoUnitDoubleSpinBox( hbGridY,
332 0.1,
333 50,
334 0.1,
335 ptGridY,
336 unit );
337 labelGridY->setBuddy( gridY );
338
339 TQWhatsThis::add( gridY, gridyHelp );
340
341 TQHBox* hbIndent = new TQHBox( gbInterfaceGroup );
342 TQString indentHelp = i18n("Configure the indent width used when using the 'Increase' "
343 "or 'Decrease' indentation buttons on a paragraph.<p>The lower the value, "
344 "the more often the buttons will have to be pressed to gain the same "
345 "indentation.");
346 TQLabel* labelIndent = new TQLabel( i18n("&Paragraph indent by toolbar buttons:"), hbIndent );
347 TQWhatsThis::add( labelIndent, indentHelp );
348 indent = new KoUnitDoubleSpinBox( hbIndent,
349 0.1,
350 5000,
351 0.1,
352 ptIndent,
353 unit );
354 labelIndent->setBuddy( indent );
355 TQWhatsThis::add( indent, indentHelp );
356
357 TQHBox* hbPagePerRow = new TQHBox( gbInterfaceGroup );
358 TQString pagePerRowHelp = i18n("After selecting Preview Mode (from the \"View\" menu,) "
359 "this is the number of pages KWord will "
360 "position on one horizontal row.");
361 TQLabel* labelPagePerRow = new TQLabel( i18n("Number of pa&ges per row in preview mode:" ), hbPagePerRow );
362 TQWhatsThis::add( labelPagePerRow, pagePerRowHelp );
363 m_nbPagePerRow=new KIntNumInput( 0, nbPagePerRow, hbPagePerRow );
364 m_nbPagePerRow->setRange(1, 10, 1);
365 labelPagePerRow->setBuddy( m_nbPagePerRow );
366 hbPagePerRow->setStretchFactor( m_nbPagePerRow, 1 );
367 TQWhatsThis::add(m_nbPagePerRow , pagePerRowHelp );
368}
369
370void ConfigureInterfacePage::apply()
371{
372 KWDocument * doc = m_pView->kWordDocument();
373 double valX = TQMAX( 0.1, gridX->value() );
374 double valY = TQMAX( 0.1, gridY->value() );
375 int nbRecent=recentFiles->value();
376
377 bool statusBar=showStatusBar->isChecked();
378 bool scrollBar = showScrollBar->isChecked();
379 config->setGroup( "Interface" );
380 bool updateView = false;
381 if(valX!=doc->gridX())
382 {
383 config->writeEntry( "GridX", valX, true, false, 'g', DBL_DIG /* 6 is not enough */ );
384 doc->setGridX(valX);
385 updateView= true;
386 }
387 if(valY!=doc->gridY())
388 {
389 config->writeEntry( "GridY", valY, true, false, 'g', DBL_DIG /* 6 is not enough */ );
390 doc->setGridY(valY);
391 updateView= true;
392 }
393 double newIndent = indent->value();
394 if( newIndent != doc->indentValue() )
395 {
396 config->writeEntry( "Indent", newIndent, true, false, 'g', DBL_DIG /* 6 is not enough */ );
397 doc->setIndentValue( newIndent );
398 }
399 if(nbRecent!=oldNbRecentFiles)
400 {
401 config->writeEntry( "NbRecentFile", nbRecent);
402 m_pView->changeNbOfRecentFiles(nbRecent);
403 }
404 bool refreshGUI= false;
405
406 if( statusBar != doc->showStatusBar() )
407 {
408 config->writeEntry( "ShowStatusBar", statusBar );
409 doc->setShowStatusBar( statusBar );
410 refreshGUI=true;
411 }
412
413 if( scrollBar != doc->showScrollBar() )
414 {
415 config->writeEntry( "ShowScrollBar", scrollBar );
416 doc->setShowScrollBar( scrollBar );
417 refreshGUI=true;
418 }
419
420 bool b = pgUpDownMovesCaret->isChecked();
421 if ( b != doc->pgUpDownMovesCaret() )
422 {
423 config->writeEntry( "PgUpDownMovesCaret", b );
424 doc->setPgUpDownMovesCaret( b );
425 }
426
427 if( refreshGUI )
428 doc->reorganizeGUI();
429
430
431 int nbPageByRow=m_nbPagePerRow->value();
432 if(nbPageByRow!=doc->nbPagePerRow())
433 {
434 config->writeEntry("nbPagePerRow",nbPageByRow);
435 m_pView->getGUI()->canvasWidget()->viewMode()->setPagesPerRow(nbPageByRow);
436 doc->setNbPagePerRow(nbPageByRow);
437 //m_pView->getGUI()->canvasWidget()->refreshViewMode();
438 //necessary to recreate new view because in switchViewMode
439 //we delete viewmode that we want to apply (LM)
440 // This needs to be cleaned up .... (DF)
441 doc->switchViewMode( doc->viewModeType() ); // force a refresh
442 }
443
444 config->setGroup( "Misc" );
445 KoUnit::Unit unit = static_cast<KoUnit::Unit>( m_unitCombo->currentItem() );
446 // It's already been set in the document, see unitChanged
447 config->writeEntry( "Units", KoUnit::unitName( unit ) );
448 if ( updateView )
449 doc->repaintAllViews(false);
450}
451
452void ConfigureInterfacePage::setUnit( KoUnit::Unit unit )
453{
454 m_unitCombo->blockSignals( true );
455 m_unitCombo->setCurrentItem( unit );
456 m_unitCombo->blockSignals( false );
457 // We need to set it in the doc immediately, because much code here uses doc->unit()
458 m_pView->kWordDocument()->setUnit( unit );
459
460 gridX->setUnit( unit );
461 gridY->setUnit( unit );
462 indent->setUnit( unit );
463}
464
465void ConfigureInterfacePage::slotDefault()
466{
467 KWDocument * doc = m_pView->kWordDocument();
468 m_unitCombo->setCurrentItem( KoUnit::U_CM );
469 emit unitChanged( m_unitCombo->currentItem() );
470 gridX->setValue( KoUnit::toUserValue( MM_TO_POINT( 5.0 ),doc->unit() ) );
471 gridY->setValue( KoUnit::toUserValue( MM_TO_POINT( 5.0 ),doc->unit() ) );
472 m_nbPagePerRow->setValue(4);
473 double newIndent = KoUnit::toUserValue( MM_TO_POINT( 10 ), doc->unit() );
474 indent->setValue( newIndent );
475 recentFiles->setValue(10);
476 showStatusBar->setChecked(true);
477 pgUpDownMovesCaret->setChecked(false);
478 showScrollBar->setChecked( true);
479}
480
482
483ConfigureMiscPage::ConfigureMiscPage( KWView *view, TQVBox *box, char *name )
484 : TQObject( box->parent(), name )
485{
486 m_pView=view;
487 config = KWFactory::instance()->config();
488 TQVGroupBox* gbMiscGroup = new TQVGroupBox( i18n("Misc"), box, "GroupBox" );
489 gbMiscGroup->setMargin( KDialog::marginHint() );
490 gbMiscGroup->setInsideSpacing( KDialog::spacingHint() );
491
492 m_oldNbRedo=30;
493
494 // Don't load the unit from config file because the unit can come from the kword file
495 // => unit can be different from config file
496
497 if( config->hasGroup("Misc") )
498 {
499 config->setGroup( "Misc" );
500 m_oldNbRedo=config->readNumEntry("UndoRedo",m_oldNbRedo);
501 }
502
503 TQHBox* hbUndoRedo = new TQHBox( gbMiscGroup );
504 TQLabel* labelUndoRedo = new TQLabel( i18n("Undo/&redo limit:"), hbUndoRedo );
505 TQString undoHelp = i18n("Limit the number of undo/redo actions remembered. "
506 "A lower value helps to save memory, a higher value allows "
507 "you to undo and redo more editing steps.");
508 m_undoRedoLimit=new KIntNumInput( m_oldNbRedo, hbUndoRedo );
509 m_undoRedoLimit->setRange(1, 100, 1);
510 labelUndoRedo->setBuddy( m_undoRedoLimit );
511 TQWhatsThis::add( m_undoRedoLimit, undoHelp );
512 TQWhatsThis::add( labelUndoRedo, undoHelp );
513
514 KWDocument* doc = m_pView->kWordDocument();
515 m_displayLink=new TQCheckBox(i18n("Display &links"),gbMiscGroup);
516 m_displayLink->setChecked(doc->variableCollection()->variableSetting()->displayLink());
517 TQWhatsThis::add( m_displayLink, i18n("If enabled, a link is highlighted as such and is clickable.\n\n"
518 "You can insert a link from the Insert menu."));
519 m_underlineLink=new TQCheckBox(i18n("&Underline all links"),gbMiscGroup);
520 m_underlineLink->setChecked(doc->variableCollection()->variableSetting()->underlineLink());
521 TQWhatsThis::add( m_underlineLink, i18n("If enabled, a link is underlined."));
522
523 m_displayComment=new TQCheckBox(i18n("Display c&omments"),gbMiscGroup);
524 m_displayComment->setChecked(doc->variableCollection()->variableSetting()->displayComment());
525 TQWhatsThis::add( m_displayComment, i18n("If enabled, comments are indicated by a small yellow box.\n\n"
526 "You can show and edit a comment from the context menu."));
527
528 m_displayFieldCode=new TQCheckBox(i18n("Display field code"),gbMiscGroup);
529 m_displayFieldCode->setChecked(doc->variableCollection()->variableSetting()->displayFieldCode());
530 TQWhatsThis::add( m_displayFieldCode, i18n("If enabled, the type of link is displayed instead "
531 "of displaying the link text.\n\n"
532 "There are various types of link that can be inserted, "
533 "such as hyperlinks, files, mail, news and bookmarks."));
534
535
536 TQVGroupBox* gbViewFormatting = new TQVGroupBox( i18n("View Formatting"), box, "view_formatting" );
537 TQWhatsThis::add( gbViewFormatting, i18n("These settings can be used to select the formatting "
538 "characters that should be shown.\n\n"
539 "Note that the selected formatting characters are only "
540 "shown if formatting characters are enabled in general, "
541 "which can be done from the View menu."));
542 gbViewFormatting->setMargin( KDialog::marginHint() );
543 gbViewFormatting->setInsideSpacing( KDialog::spacingHint() );
544
545 m_oldFormattingEndParag = doc->viewFormattingEndParag();
546 m_oldFormattingSpace = doc->viewFormattingSpace();
547 m_oldFormattingTabs = doc->viewFormattingTabs();
548 m_oldFormattingBreak = doc->viewFormattingBreak();
549
550 m_cbViewFormattingEndParag = new TQCheckBox( i18n("View formatting end paragraph"), gbViewFormatting);
551 m_cbViewFormattingEndParag->setChecked(m_oldFormattingEndParag);
552
553 m_cbViewFormattingSpace = new TQCheckBox( i18n("View formatting space"), gbViewFormatting);
554 m_cbViewFormattingSpace->setChecked(m_oldFormattingSpace);
555
556 m_cbViewFormattingTabs = new TQCheckBox( i18n("View formatting tabs"), gbViewFormatting);
557 m_cbViewFormattingTabs->setChecked(m_oldFormattingTabs);
558
559 m_cbViewFormattingBreak = new TQCheckBox( i18n("View formatting break"), gbViewFormatting);
560 m_cbViewFormattingBreak->setChecked(m_oldFormattingBreak);
561}
562
563ConfigureDefaultDocPage::~ConfigureDefaultDocPage()
564{
565 delete font;
566}
567
568KCommand *ConfigureMiscPage::apply()
569{
570 KWDocument * doc = m_pView->kWordDocument();
571 config->setGroup( "Misc" );
572 int newUndo=m_undoRedoLimit->value();
573 if(newUndo!=m_oldNbRedo)
574 {
575 config->writeEntry("UndoRedo",newUndo);
576 doc->setUndoRedoLimit(newUndo);
577 m_oldNbRedo=newUndo;
578 }
579 KMacroCommand * macroCmd=0L;
580 bool b=m_displayLink->isChecked();
581 if(doc->variableCollection()->variableSetting()->displayLink()!=b)
582 {
583 if(!macroCmd)
584 {
585 macroCmd=new KMacroCommand(i18n("Change Display Link Command"));
586 }
587 KWChangeVariableSettingsCommand *cmd=new KWChangeVariableSettingsCommand( i18n("Change Display Link Command"), doc, doc->variableCollection()->variableSetting()->displayLink() ,b, KWChangeVariableSettingsCommand::VS_DISPLAYLINK);
588
589 cmd->execute();
590 macroCmd->addCommand(cmd);
591 }
592 b=m_underlineLink->isChecked();
593 if(doc->variableCollection()->variableSetting()->underlineLink()!=b)
594 {
595 if(!macroCmd)
596 {
597 macroCmd=new KMacroCommand(i18n("Change Display Link Command"));
598 }
599 KWChangeVariableSettingsCommand *cmd=new KWChangeVariableSettingsCommand( i18n("Change Display Link Command"), doc, doc->variableCollection()->variableSetting()->underlineLink() ,b, KWChangeVariableSettingsCommand::VS_UNDERLINELINK);
600 cmd->execute();
601 macroCmd->addCommand(cmd);
602 }
603
604 b=m_displayComment->isChecked();
605 if(doc->variableCollection()->variableSetting()->displayComment()!=b)
606 {
607 if(!macroCmd)
608 {
609 macroCmd=new KMacroCommand(i18n("Change Display Link Command"));
610 }
611 KWChangeVariableSettingsCommand *cmd=new KWChangeVariableSettingsCommand( i18n("Change Display Link Command"), doc, doc->variableCollection()->variableSetting()->displayComment() ,b, KWChangeVariableSettingsCommand::VS_DISPLAYCOMMENT);
612 cmd->execute();
613 macroCmd->addCommand(cmd);
614 }
615 b=m_displayFieldCode->isChecked();
616 if(doc->variableCollection()->variableSetting()->displayFieldCode()!=b)
617 {
618 if(!macroCmd)
619 {
620 macroCmd=new KMacroCommand(i18n("Change Display Field Code Command"));
621 }
622 KWChangeVariableSettingsCommand *cmd=new KWChangeVariableSettingsCommand( i18n("Change Display Field Code Command"), doc, doc->variableCollection()->variableSetting()->displayFieldCode() ,b, KWChangeVariableSettingsCommand::VS_DISPLAYFIELDCODE);
623 cmd->execute();
624 macroCmd->addCommand(cmd);
625 }
626
627 bool state =m_cbViewFormattingEndParag->isChecked();
628 bool needRepaint = false;
629 if ( state != m_oldFormattingEndParag )
630 {
631 doc->setViewFormattingEndParag(state);
632 needRepaint = true;
633 m_oldFormattingEndParag = state;
634 }
635 state = m_cbViewFormattingSpace->isChecked();
636 if ( state != m_oldFormattingSpace)
637 {
638 doc->setViewFormattingSpace(state);
639 needRepaint = true;
640 m_oldFormattingSpace = state;
641 }
642 state = m_cbViewFormattingBreak->isChecked();
643 if ( state != m_oldFormattingBreak)
644 {
645 doc->setViewFormattingBreak(state);
646 needRepaint = true;
647 m_oldFormattingBreak = state;
648 }
649 state = m_cbViewFormattingTabs->isChecked();
650 if ( state != m_oldFormattingTabs )
651 {
652 doc->setViewFormattingTabs(state);
653 needRepaint = true;
654 m_oldFormattingTabs= state;
655 }
656 if ( needRepaint )
657 {
658 doc->layout();
659 doc->repaintAllViews();
660 }
661 return macroCmd;
662}
663
664void ConfigureMiscPage::slotDefault()
665{
666 m_undoRedoLimit->setValue(30);
667 m_displayLink->setChecked(true);
668 m_displayComment->setChecked(true);
669 m_underlineLink->setChecked(true);
670 m_cbViewFormattingEndParag->setChecked(true);
671 m_cbViewFormattingSpace->setChecked(true);
672 m_cbViewFormattingTabs->setChecked(true);
673 m_cbViewFormattingBreak->setChecked(true);
674 m_displayFieldCode->setChecked( false );
675}
676
677void ConfigureMiscPage::setUnit( KoUnit::Unit )
678{
679}
680
682
683ConfigureDefaultDocPage::ConfigureDefaultDocPage( KWView *view, TQVBox *box, char *name )
684 : TQObject( box->parent(), name )
685{
686 m_pView=view;
687 KWDocument * doc = m_pView->kWordDocument();
688 config = KWFactory::instance()->config();
689 TQVGroupBox* gbDocumentDefaults = new TQVGroupBox( i18n("Document Defaults"), box, "GroupBox" );
690 gbDocumentDefaults->setMargin( KDialog::marginHint() );
691 gbDocumentDefaults->setInsideSpacing( KDialog::spacingHint() );
692
693 double ptColumnSpacing=3;
694 KoUnit::Unit unit = doc->unit();
695 if( config->hasGroup("Document defaults") )
696 {
697 config->setGroup( "Document defaults" );
698 ptColumnSpacing=config->readDoubleNumEntry("ColumnSpacing",ptColumnSpacing);
699 // loaded by kwdoc already defaultFont=config->readEntry("DefaultFont",defaultFont);
700 }
701
702
703 TQHBox* hbColumnSpacing = new TQHBox( gbDocumentDefaults );
704 TQLabel* columnSpacingLabel = new TQLabel( i18n("Default column spacing:"), hbColumnSpacing );
705 m_columnSpacing = new KoUnitDoubleSpinBox( hbColumnSpacing,
706 0.1,
707 50,
708 0.1,
709 ptColumnSpacing,
710 unit );
711 columnSpacingLabel->setBuddy( m_columnSpacing );
712 TQWhatsThis::add( m_columnSpacing, i18n("When setting a document to use more than one column "
713 "this distance will be used to separate the columns. This value is merely a default "
714 "setting as the column spacing can be changed per document") );
715
716 TQWidget *fontContainer = new TQWidget(gbDocumentDefaults);
717 TQGridLayout * fontLayout = new TQGridLayout(fontContainer, 1, 3);
718
719 fontLayout->setSpacing(KDialog::spacingHint());
720 fontLayout->setColStretch(0, 0);
721 fontLayout->setColStretch(1, 1);
722 fontLayout->setColStretch(2, 0);
723
724 TQLabel *fontTitle = new TQLabel(i18n("Default font:"), fontContainer);
725
726 font= new TQFont( doc->defaultFont() );
727
728 TQString labelName = font->family() + ' ' + TQString::number(font->pointSize());
729 fontName = new TQLabel(labelName, fontContainer);
730 fontName->setFont(*font);
731 fontName->setFrameStyle(TQFrame::StyledPanel | TQFrame::Sunken);
732
733 TQPushButton *chooseButton = new TQPushButton(i18n("Choose..."), fontContainer);
734 connect(chooseButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(selectNewDefaultFont()));
735
736 fontLayout->addWidget(fontTitle, 0, 0);
737 fontLayout->addWidget(fontName, 0, 1);
738 fontLayout->addWidget(chooseButton, 0, 2);
739
740
741 oldAutoSaveValue=KoDocument::defaultAutoSave() / 60;
742 m_oldLanguage = doc->globalLanguage();
743 m_oldHyphenation = doc->globalHyphenation();
744 if( config->hasGroup("Interface") )
745 {
746 config->setGroup( "Interface" );
747 oldAutoSaveValue=config->readNumEntry("AutoSave",oldAutoSaveValue);
748 m_oldLanguage = config->readEntry( "language", m_oldLanguage);
749 m_oldHyphenation = config->readBoolEntry( "hyphenation", m_oldHyphenation);
750 }
751
752
753 TQWidget *languageContainer = new TQWidget(gbDocumentDefaults);
754 TQGridLayout * languageLayout = new TQGridLayout(languageContainer, 1, 3);
755
756 languageLayout->setSpacing(KDialog::spacingHint());
757 languageLayout->setColStretch(0, 0);
758 languageLayout->setColStretch(1, 1);
759
760 TQLabel *languageTitle = new TQLabel(i18n("Global language:"), languageContainer);
761
762 m_globalLanguage = new TQComboBox( languageContainer );
763 m_globalLanguage->insertStringList( KoGlobal::listOfLanguages() );
764 m_globalLanguage->setCurrentText( KoGlobal::languageFromTag( m_oldLanguage ) );
765
766 languageLayout->addWidget(languageTitle, 0, 0);
767 languageLayout->addWidget(m_globalLanguage, 0, 1);
768
769 m_autoHyphenation = new TQCheckBox( i18n("Automatic hyphenation"), gbDocumentDefaults);
770 m_autoHyphenation->setChecked( m_oldHyphenation );
771
772 TQVGroupBox* gbDocumentSettings = new TQVGroupBox( i18n("Document Settings"), box );
773 gbDocumentSettings->setMargin( KDialog::marginHint() );
774 gbDocumentSettings->setInsideSpacing( KDialog::spacingHint() );
775
776 TQHBox* hbAutoSave = new TQHBox( gbDocumentSettings );
777 TQLabel* labelAutoSave = new TQLabel( i18n("Autosave every (min):"), hbAutoSave );
778 autoSave = new KIntNumInput( oldAutoSaveValue, hbAutoSave );
779 autoSave->setRange(0, 60, 1);
780 labelAutoSave->setBuddy(autoSave);
781 TQWhatsThis::add( autoSave, i18n("A backup copy of the current document is created when a change "
782 "has been made. The interval used to create backup documents is set here.") );
783 autoSave->setSpecialValueText(i18n("No autosave"));
784 autoSave->setSuffix(i18n(" min"));
785
786 m_oldBackupFile = true;
787 if( config->hasGroup("Interface") )
788 {
789 config->setGroup( "Interface" );
790 m_oldBackupFile=config->readBoolEntry("BackupFile",m_oldBackupFile);
791 }
792
793 m_createBackupFile = new TQCheckBox( i18n("Create backup file"), gbDocumentSettings);
794 m_createBackupFile->setChecked( m_oldBackupFile );
795
796 TQHBox* hbStartingPage = new TQHBox( gbDocumentSettings );
797 TQLabel* labelStartingPage = new TQLabel(i18n("Starting page number:"), hbStartingPage);
798
799 m_oldStartingPage=doc->variableCollection()->variableSetting()->startingPageNumber();
800 m_variableNumberOffset=new KIntNumInput(hbStartingPage);
801 m_variableNumberOffset->setRange(-1000, 9999, 1, false);
802 m_variableNumberOffset->setValue(m_oldStartingPage);
803 labelStartingPage->setBuddy( m_variableNumberOffset );
804
805 TQHBox* hbTabStop = new TQHBox( gbDocumentSettings );
806 tabStop = new TQLabel(i18n("Tab stop (%1):").arg(doc->unitName()), hbTabStop);
807 m_tabStopWidth = new KoUnitDoubleSpinBox( hbTabStop,
808 MM_TO_POINT(2),
809 doc->pageManager()->page(doc->startPage())->width(),
810 0.1,
811 doc->tabStopValue(),
812 unit );
813 m_oldTabStopWidth = doc->tabStopValue();
814
815 TQVGroupBox* gbDocumentCursor = new TQVGroupBox( i18n("Cursor"), box );
816 gbDocumentCursor->setMargin( KDialog::marginHint() );
817 gbDocumentCursor->setInsideSpacing( KDialog::spacingHint() );
818
819 m_cursorInProtectedArea= new TQCheckBox(i18n("Cursor in protected area"),gbDocumentCursor);
820 m_cursorInProtectedArea->setChecked(doc->cursorInProtectedArea());
821
822// m_directInsertCursor= new TQCheckBox(i18n("Direct insert cursor"),gbDocumentCursor);
823// m_directInsertCursor->setChecked(doc->insertDirectCursor());
824}
825
826KCommand *ConfigureDefaultDocPage::apply()
827{
828 config->setGroup( "Document defaults" );
829 KWDocument * doc = m_pView->kWordDocument();
830 double colSpacing = m_columnSpacing->value();
831 if ( colSpacing != doc->defaultColumnSpacing() )
832 {
833 config->writeEntry( "ColumnSpacing", colSpacing , true, false, 'g', DBL_DIG );
834 doc->setDefaultColumnSpacing(colSpacing);
835 }
836 config->writeEntry("DefaultFont",TQString(font->toString()));
837
838 config->setGroup( "Interface" );
839 int autoSaveVal=autoSave->value();
840 if(autoSaveVal!=oldAutoSaveValue)
841 {
842 config->writeEntry( "AutoSave", autoSaveVal );
843 doc->setAutoSave(autoSaveVal*60);
844 oldAutoSaveValue=autoSaveVal;
845 }
846
847 bool state =m_createBackupFile->isChecked();
848 if(state!=m_oldBackupFile)
849 {
850 config->writeEntry( "BackupFile", state );
851 doc->setBackupFile( state);
852 m_oldBackupFile=state;
853 }
854
855 state = m_cursorInProtectedArea->isChecked();
856 if ( state != doc->cursorInProtectedArea() )
857 {
858 config->writeEntry( "cursorInProtectArea", state );
859 doc->setCursorInProtectedArea( state );
860 }
861
862// state = m_directInsertCursor->isChecked();
863// if ( state != doc->insertDirectCursor() )
864// doc->setInsertDirectCursor( state );
865
866 //Laurent Todo add a message box to inform user that
867 //global language will change after re-launch kword
868 TQString lang = KoGlobal::tagOfLanguage( m_globalLanguage->currentText() );
869 config->writeEntry( "language" , lang);
870 m_oldLanguage = lang;
871 //don't call this fiunction otherwise we can have a textobject with
872 // a default language and other textobject with other default language.
873 //doc->setGlobalLanguage( lang );
874
875 state = m_autoHyphenation->isChecked();
876 config->writeEntry( "hyphenation", state );
877 m_oldHyphenation = state;
878
879 KMacroCommand * macroCmd=0L;
880 int newStartingPage=m_variableNumberOffset->value();
881 if(newStartingPage!=m_oldStartingPage)
882 {
883 macroCmd=new KMacroCommand(i18n("Change Starting Page Number"));
884 KWChangeStartingPageCommand *cmd = new KWChangeStartingPageCommand( i18n("Change Starting Page Number"), doc, m_oldStartingPage,newStartingPage );
885 cmd->execute();
886 macroCmd->addCommand(cmd);
887 m_oldStartingPage=newStartingPage;
888 }
889 double newTabStop = m_tabStopWidth->value();
890 if ( newTabStop != m_oldTabStopWidth)
891 {
892 if ( !macroCmd )
893 macroCmd=new KMacroCommand(i18n("Change Tab Stop Value"));
894
895
896 KWChangeTabStopValueCommand *cmd = new KWChangeTabStopValueCommand( i18n("Change Tab Stop Value"), m_oldTabStopWidth, newTabStop, doc);
897 cmd->execute();
898 macroCmd->addCommand(cmd);
899 m_oldTabStopWidth = newTabStop;
900 }
901
902 return macroCmd;
903}
904
905void ConfigureDefaultDocPage::slotDefault()
906{
907 m_columnSpacing->setValue( 3 );
908 autoSave->setValue( KoDocument::defaultAutoSave() / 60 );
909 m_variableNumberOffset->setValue(1);
910 m_cursorInProtectedArea->setChecked(true);
911 m_tabStopWidth->setValue( MM_TO_POINT(15) );
912 m_createBackupFile->setChecked( true );
913// m_directInsertCursor->setChecked( false );
914 m_globalLanguage->setCurrentText( KoGlobal::languageFromTag( TDEGlobal::locale()->language() ) );
915 m_autoHyphenation->setChecked( false );
916}
917
918void ConfigureDefaultDocPage::selectNewDefaultFont() {
919 TQStringList list;
920 TDEFontChooser::getFontList(list, TDEFontChooser::SmoothScalableFonts);
921 TDEFontDialog dlg( (TQWidget *)this->parent(), "Font Selector", false, true, list, true );
922 dlg.setFont(*font);
923 int result = dlg.exec();
924 if (KDialog::Accepted == result) {
925 delete font;
926 font = new TQFont(dlg.font());
927 fontName->setText(font->family() + ' ' + TQString::number(font->pointSize()));
928 fontName->setFont(*font);
929 m_pView->kWordDocument()->setDefaultFont( *font );
930 }
931}
932
933void ConfigureDefaultDocPage::setUnit( KoUnit::Unit unit )
934{
935 m_columnSpacing->setUnit( unit );
936 m_tabStopWidth->setUnit( unit );
937 tabStop->setText( i18n( "Tab stop:" ) );
938}
939
941
942ConfigurePathPage::ConfigurePathPage( KWView *view, TQVBox *box, char *name )
943 : TQObject( box->parent(), name )
944{
945 m_pView=view;
946 KWDocument * doc = m_pView->kWordDocument();
947 config = KWFactory::instance()->config();
948 TQVGroupBox* gbPathGroup = new TQVGroupBox( i18n("Path"), box, "GroupBox" );
949 gbPathGroup->setMargin( KDialog::marginHint() );
950 gbPathGroup->setInsideSpacing( KDialog::spacingHint() );
951
952 m_pPathView = new TDEListView( gbPathGroup );
953 m_pPathView->setResizeMode(TQListView::NoColumn);
954 m_pPathView->addColumn( i18n( "Type" ) );
955 m_pPathView->addColumn( i18n( "Path" ), 400 ); // not too big by default
956 (void) new TQListViewItem( m_pPathView, i18n("Personal Expression"), doc->personalExpressionPath().join(";") );
957 (void) new TQListViewItem( m_pPathView, i18n("Backup Path"),doc->backupPath() );
958
959 m_modifyPath = new TQPushButton( i18n("Modify Path..."), gbPathGroup);
960 connect( m_modifyPath, TQ_SIGNAL( clicked ()), this, TQ_SLOT( slotModifyPath()));
961 connect( m_pPathView, TQ_SIGNAL( doubleClicked (TQListViewItem *, const TQPoint &, int )), this, TQ_SLOT( slotModifyPath()));
962 connect( m_pPathView, TQ_SIGNAL( selectionChanged ( TQListViewItem * )), this, TQ_SLOT( slotSelectionChanged(TQListViewItem * )));
963 slotSelectionChanged(m_pPathView->currentItem());
964}
965
966void ConfigurePathPage::slotSelectionChanged(TQListViewItem * item)
967{
968 m_modifyPath->setEnabled( item );
969}
970
971void ConfigurePathPage::slotModifyPath()
972{
973 TQListViewItem *item = m_pPathView->currentItem ();
974 if ( item )
975 {
976 if ( item->text(0)==i18n("Personal Expression"))
977 {
978 KoEditPathDia * dlg = new KoEditPathDia( item->text( 1), 0L, "editpath");
979 if (dlg->exec() )
980 item->setText(1, dlg->newPath());
981 delete dlg;
982 }
983 if ( item->text(0)==i18n("Backup Path"))
984 {
985 KoChangePathDia *dlg = new KoChangePathDia( item->text(1), 0L, "backup path" );
986 if (dlg->exec() )
987 item->setText(1, dlg->newPath());
988 delete dlg;
989 }
990 }
991}
992
993void ConfigurePathPage::slotDefault()
994{
995 TQListViewItem * item = m_pPathView->findItem(i18n("Personal Expression"), 0);
996 if ( item )
997 item->setText(1, KWFactory::instance()->dirs()->resourceDirs("expression").join(";"));
998 item = m_pPathView->findItem(i18n("Backup Path"), 0);
999 if ( item )
1000 item->setText(1, TQString() );
1001}
1002
1003void ConfigurePathPage::apply()
1004{
1005 TQListViewItem * item = m_pPathView->findItem(i18n("Personal Expression"), 0);
1006 if ( item )
1007 {
1008 TQStringList lst = TQStringList::split(TQString(";"), item->text(1));
1009 if ( lst != m_pView->kWordDocument()->personalExpressionPath())
1010 {
1011 m_pView->kWordDocument()->setPersonalExpressionPath(lst);
1012 config->setGroup( "Kword Path" );
1013 config->writePathEntry( "expression path", lst);
1014 }
1015 }
1016 item = m_pPathView->findItem(i18n("Backup Path"), 0);
1017 if ( item )
1018 {
1019 TQString res = item->text(1 );
1020 if ( res != m_pView->kWordDocument()->backupPath())
1021 {
1022 config->setGroup( "Kword Path" );
1023 m_pView->kWordDocument()->setBackupPath( res );
1024 config->writePathEntry( "backup path",res );
1025 }
1026 }
1027
1028}
1029
1031
1032ConfigureTTSPage::ConfigureTTSPage( KWView *view, TQVBox *box, char *name )
1033 : TQObject( box->parent(), name )
1034{
1035 Q_UNUSED(view);
1036 // m_pView=_view;
1037 // KWDocument * doc = m_pView->kWordDocument();
1038
1039 m_cbSpeakPointerWidget = new TQCheckBox(i18n("Speak widget under &mouse pointer"), box);
1040 m_cbSpeakFocusWidget = new TQCheckBox(i18n("Speak widget with &focus"), box);
1041 m_gbScreenReaderOptions = new TQVGroupBox("", box);
1042 m_gbScreenReaderOptions->setMargin( KDialog::marginHint() );
1043 m_gbScreenReaderOptions->setInsideSpacing( KDialog::spacingHint() );
1044 m_cbSpeakTooltips = new TQCheckBox(i18n("Speak &tool tips"), m_gbScreenReaderOptions);
1045 m_cbSpeakWhatsThis = new TQCheckBox(i18n("Speak &What's This"), m_gbScreenReaderOptions);
1046 m_cbSpeakDisabled = new TQCheckBox(i18n("Verbal indication if widget is disabled (grayed)",
1047 "&Say whether disabled"), m_gbScreenReaderOptions);
1048 m_cbSpeakAccelerators = new TQCheckBox(i18n("Spea&k accelerators"), m_gbScreenReaderOptions);
1049 TQHBox* hbAcceleratorPrefix = new TQHBox(m_gbScreenReaderOptions);
1050 TQWidget* spacer = new TQWidget(hbAcceleratorPrefix);
1051 spacer->setMinimumWidth(2 * KDialog::marginHint());
1052 m_lblAcceleratorPrefix =
1053 new TQLabel(i18n("A word spoken before another word", "Pr&efaced by the word:"),
1054 hbAcceleratorPrefix);
1055 m_leAcceleratorPrefixWord = new TQLineEdit(i18n("Keyboard accelerator, such as Alt+F", "Accelerator"),
1056 hbAcceleratorPrefix);
1057 m_lblAcceleratorPrefix->setBuddy(m_leAcceleratorPrefixWord);
1058 TQHBox* hbPollingInterval = new TQHBox(m_gbScreenReaderOptions);
1059 hbPollingInterval->setMargin( 0 );
1060 TQLabel* lblPollingInterval = new TQLabel(i18n("&Polling interval:"), hbPollingInterval);
1061 m_iniPollingInterval = new KIntNumInput(hbPollingInterval);
1062 m_iniPollingInterval->setSuffix(" ms");
1063 m_iniPollingInterval->setRange(100, 5000, 100, true);
1064 lblPollingInterval->setBuddy(m_iniPollingInterval);
1065
1066 config = KWFactory::instance()->config();
1067 config->setGroup("TTS");
1068 m_cbSpeakPointerWidget->setChecked(config->readBoolEntry("SpeakPointerWidget", false));
1069 m_cbSpeakFocusWidget->setChecked(config->readBoolEntry("SpeakFocusWidget", false));
1070 m_cbSpeakTooltips->setChecked(config->readBoolEntry("SpeakTooltips", true));
1071 m_cbSpeakWhatsThis->setChecked(config->readBoolEntry("SpeakWhatsThis", false));
1072 m_cbSpeakDisabled->setChecked(config->readBoolEntry("SpeakDisabled", true));
1073 m_cbSpeakAccelerators->setChecked(config->readBoolEntry("SpeakAccelerators", true));
1074 m_leAcceleratorPrefixWord->setText(config->readEntry("AcceleratorPrefixWord",
1075 i18n("Keyboard accelerator, such as Alt+F", "Accelerator")));
1076 m_iniPollingInterval->setValue(config->readNumEntry("PollingInterval", 600));
1077
1078 screenReaderOptionChanged();
1079 connect(m_cbSpeakPointerWidget, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(screenReaderOptionChanged()));
1080 connect(m_cbSpeakFocusWidget, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(screenReaderOptionChanged()));
1081 connect(m_cbSpeakAccelerators, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(screenReaderOptionChanged()));
1082}
1083
1084void ConfigureTTSPage::slotDefault()
1085{
1086 m_cbSpeakPointerWidget->setChecked(false);
1087 m_cbSpeakFocusWidget->setChecked(false);
1088 m_cbSpeakTooltips->setChecked(true);
1089 m_cbSpeakWhatsThis->setChecked(false);
1090 m_cbSpeakDisabled->setChecked(true);
1091 m_cbSpeakAccelerators->setChecked(true);
1092 m_leAcceleratorPrefixWord->setText(i18n("Keyboard accelerator, such as Alt+F", "Accelerator"));
1093 m_iniPollingInterval->setValue(600);
1094}
1095
1096void ConfigureTTSPage::apply()
1097{
1098 config->setGroup("TTS");
1099 config->writeEntry("SpeakPointerWidget", m_cbSpeakPointerWidget->isChecked());
1100 config->writeEntry("SpeakFocusWidget", m_cbSpeakFocusWidget->isChecked());
1101 config->writeEntry("SpeakTooltips", m_cbSpeakTooltips->isChecked());
1102 config->writeEntry("SpeakWhatsThis", m_cbSpeakWhatsThis->isChecked());
1103 config->writeEntry("SpeakDisabled", m_cbSpeakDisabled->isChecked());
1104 config->writeEntry("SpeakAccelerators", m_cbSpeakAccelerators->isChecked());
1105 config->writeEntry("AcceleratorPrefixWord", m_leAcceleratorPrefixWord->text());
1106 config->writeEntry("PollingInterval", m_iniPollingInterval->value());
1107 if (kospeaker) kospeaker->readConfig(config);
1108}
1109
1110void ConfigureTTSPage::screenReaderOptionChanged()
1111{
1112 m_gbScreenReaderOptions->setEnabled(
1113 m_cbSpeakPointerWidget->isChecked() | m_cbSpeakFocusWidget->isChecked());
1114 m_leAcceleratorPrefixWord->setEnabled(m_cbSpeakAccelerators->isChecked());
1115 m_lblAcceleratorPrefix->setEnabled(m_cbSpeakAccelerators->isChecked());
1116}
1117
1118#include "KWConfig.moc"
KWPage * page(int pageNumber) const
return the KWPage of a specific page number. Returns 0 if page does not exist.
double width() const
return the width of this page (in pt)
Definition KWPage.cpp:38