00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <kconfig.h>
00022 #include <kiconloader.h>
00023 #include <klocale.h>
00024 #include <KoUnitWidgets.h>
00025 #include <knuminput.h>
00026 #include <knumvalidator.h>
00027 #include <kfontdialog.h>
00028 #include <kdebug.h>
00029
00030 #include <qcheckbox.h>
00031 #include <qlabel.h>
00032 #include <qvbox.h>
00033 #include <qcombobox.h>
00034 #include <qwhatsthis.h>
00035 #include <qvgroupbox.h>
00036 #include <qpushbutton.h>
00037 #include <qlistbox.h>
00038 #include <qlineedit.h>
00039 #include <qlayout.h>
00040
00041 #include "KWConfig.h"
00042 #include "KWView.h"
00043 #include "KWFrameSet.h"
00044 #include "KWDocument.h"
00045 #include "KWCanvas.h"
00046 #include "KWViewMode.h"
00047 #include "KWCommand.h"
00048 #include "KWVariable.h"
00049 #include "KoEditPath.h"
00050 #include "KWPageManager.h"
00051 #include "KWPage.h"
00052 #include "KoSpeaker.h"
00053
00054 #include <KoVariable.h>
00055 #include <kformulaconfigpage.h>
00056
00057 #include <kspell2/configwidget.h>
00058 #include <kspell2/settings.h>
00059 #include <kspell2/broker.h>
00060 using namespace KSpell2;
00061
00062 #include <float.h>
00063 #include <kmessagebox.h>
00064 #include <klistview.h>
00065 #include <kstandarddirs.h>
00066 #include <kglobalsettings.h>
00067 #include <kglobal.h>
00068 #include <kurlrequesterdlg.h>
00069 #include <kfiledialog.h>
00070 #include <qtabwidget.h>
00071 #include <keditlistbox.h>
00072 #include <KoGlobal.h>
00073
00074
00075
00076 static inline QPixmap loadIcon( const char * name ) {
00077 return KGlobal::instance()->iconLoader()
00078 ->loadIcon( QString::fromLatin1(name), KIcon::NoGroup, KIcon::SizeMedium );
00079 }
00080
00081 KWConfig::KWConfig( KWView* parent )
00082 : KDialogBase(KDialogBase::IconList,i18n("Configure KWord") ,
00083 KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel| KDialogBase::Default,
00084 KDialogBase::Ok, parent)
00085
00086 {
00087 QVBox *page2 = addVBoxPage( i18n("Interface"), i18n("Interface Settings"),
00088 loadIcon("configure") );
00089 m_interfacePage=new ConfigureInterfacePage(parent, page2);
00090
00091 QVBox *page4 = addVBoxPage( i18n("Document"), i18n("Document Settings"),
00092 loadIcon("kword_kwd") );
00093
00094 m_defaultDocPage=new ConfigureDefaultDocPage(parent, page4);
00095
00096 QVBox *page = addVBoxPage( i18n("Spelling"), i18n("Spell Checker Behavior"),
00097 loadIcon("spellcheck") );
00098 m_spellPage = new ConfigureSpellPage(parent, page);
00099
00100 QVBox *page5 = addVBoxPage( i18n("Formula"), i18n("Formula Defaults"),
00101 loadIcon("kformula") );
00102 m_formulaPage=new KFormula::ConfigurePage( parent->kWordDocument()->formulaDocument( false ),
00103 this, KWFactory::instance()->config(), page5 );
00104
00105 QVBox *page3 = addVBoxPage( i18n("Misc"), i18n("Misc Settings"),
00106 loadIcon("misc") );
00107 m_miscPage=new ConfigureMiscPage(parent, page3);
00108
00109 QVBox *page6 = addVBoxPage( i18n("Path"), i18n("Path Settings"),
00110 loadIcon("path") );
00111 m_pathPage=new ConfigurePathPage(parent, page6);
00112
00113 if (KoSpeaker::isKttsdInstalled()) {
00114 QVBox *page7 = addVBoxPage( i18n("Abbreviation for Text-to-Speech", "TTS"),
00115 i18n("Text-to-Speech Settings"), loadIcon("access") );
00116 m_ttsPage=new ConfigureTTSPage(parent, page7);
00117 } else m_ttsPage = 0;
00118
00119 m_doc = parent->kWordDocument();
00120 connect(this, SIGNAL(okClicked()),this,SLOT(slotApply()));
00121
00122 connect( m_interfacePage, SIGNAL( unitChanged( int ) ), SLOT( unitChanged( int ) ) );
00123 unitChanged( parent->kWordDocument()->unit() );
00124 }
00125
00126 void KWConfig::unitChanged( int u )
00127 {
00128 KoUnit::Unit unit = static_cast<KoUnit::Unit>(u);
00129
00130 m_interfacePage->setUnit( unit );
00131 m_miscPage->setUnit( unit );
00132 m_defaultDocPage->setUnit( unit );
00133
00134
00135 }
00136
00137 void KWConfig::openPage(int flags)
00138 {
00139 if(flags & KW_KSPELL)
00140 showPage( 2 );
00141 else if(flags & KP_INTERFACE)
00142 showPage(0 );
00143 else if(flags & KP_MISC)
00144 showPage(4);
00145 else if(flags & KP_DOCUMENT)
00146 showPage(2 );
00147 else if(flags & KP_FORMULA)
00148 showPage(3);
00149 else if ( flags & KP_PATH )
00150 showPage(4);
00151 }
00152
00153 void KWConfig::slotApply()
00154 {
00155 KMacroCommand *macro = 0L;
00156 if (m_spellPage) m_spellPage->apply();
00157 m_interfacePage->apply();
00158 m_pathPage->apply();
00159 KCommand * cmd = m_miscPage->apply();
00160 if ( cmd )
00161 {
00162 if ( !macro )
00163 macro = new KMacroCommand( i18n("Change Config"));
00164 macro->addCommand(cmd);
00165 }
00166
00167 cmd=m_defaultDocPage->apply();
00168 if ( cmd )
00169 {
00170 if ( !macro )
00171 macro = new KMacroCommand( i18n("Change Config"));
00172
00173 macro->addCommand( cmd );
00174 }
00175 m_formulaPage->apply();
00176 if (m_ttsPage) m_ttsPage->apply();
00177 if (macro)
00178 m_doc->addCommand( macro );
00179 KWFactory::instance()->config()->sync();
00180 }
00181
00182 void KWConfig::slotDefault()
00183 {
00184 switch(activePageIndex())
00185 {
00186 case 0:
00187 m_interfacePage->slotDefault();
00188 break;
00189 case 1:
00190 m_defaultDocPage->slotDefault();
00191 break;
00192 case 2:
00193 if (m_spellPage) m_spellPage->slotDefault();
00194 break;
00195 case 3:
00196 m_formulaPage->slotDefault();
00197 break;
00198 case 4:
00199 m_miscPage->slotDefault();
00200 break;
00201 case 5:
00202 m_pathPage->slotDefault();
00203 break;
00204 case 6:
00205 m_ttsPage->slotDefault();
00206 default:
00207 break;
00208 }
00209 }
00210
00212
00213 ConfigureSpellPage::ConfigureSpellPage( KWView *view, QVBox *box, char *name )
00214 : QObject( box->parent(), name )
00215 {
00216 m_pView=view;
00217 config = KWFactory::instance()->config();
00218 m_spellConfigWidget = new ConfigWidget( view->broker(), box );
00219 m_spellConfigWidget->setBackgroundCheckingButtonShown( true );
00220 m_spellConfigWidget->layout()->setMargin( 0 );
00221 }
00222
00223 void ConfigureSpellPage::apply()
00224 {
00225 KWDocument* doc = m_pView->kWordDocument();
00226
00227 m_spellConfigWidget->save();
00228
00229 m_pView->kWordDocument()->setSpellCheckIgnoreList(
00230 m_pView->broker()->settings()->currentIgnoreList() );
00231
00232 doc->enableBackgroundSpellCheck( m_pView->broker()->settings()->backgroundCheckerEnabled() );
00233 doc->reactivateBgSpellChecking();
00234 }
00235
00236 void ConfigureSpellPage::slotDefault()
00237 {
00238 m_spellConfigWidget->slotDefault();
00239 }
00240
00241 ConfigureInterfacePage::ConfigureInterfacePage( KWView *view, QVBox *box, char *name )
00242 : QObject( box->parent(), name )
00243 {
00244 m_pView=view;
00245 config = KWFactory::instance()->config();
00246 QVGroupBox* gbInterfaceGroup = new QVGroupBox( i18n("Interface"), box, "GroupBox" );
00247 gbInterfaceGroup->setMargin( KDialog::marginHint() );
00248 gbInterfaceGroup->setInsideSpacing( KDialog::spacingHint() );
00249
00250 double ptGridX=MM_TO_POINT(5.0 );
00251 double ptGridY=MM_TO_POINT(5.0 );
00252 double ptIndent = MM_TO_POINT(10.0);
00253 bool oldShowStatusBar = true;
00254 bool oldPgUpDownMovesCaret = false;
00255 bool oldShowScrollBar = true;
00256 oldNbRecentFiles=10;
00257 int nbPagePerRow=4;
00258 KoUnit::Unit unit = m_pView->kWordDocument()->unit();
00259 if( config->hasGroup("Interface") )
00260 {
00261 config->setGroup( "Interface" );
00262 ptGridX=config->readDoubleNumEntry("GridX", ptGridX);
00263 ptGridY=config->readDoubleNumEntry("GridY", ptGridY);
00264 ptIndent = config->readDoubleNumEntry("Indent", ptIndent);
00265 oldNbRecentFiles=config->readNumEntry("NbRecentFile", oldNbRecentFiles);
00266 nbPagePerRow=config->readNumEntry("nbPagePerRow", nbPagePerRow);
00267 oldShowStatusBar = config->readBoolEntry( "ShowStatusBar", true );
00268 oldPgUpDownMovesCaret = config->readBoolEntry( "PgUpDownMovesCaret", false );
00269 oldShowScrollBar = config->readBoolEntry("ShowScrollBar", true);
00270 }
00271
00272 QHBox *hbUnit = new QHBox(gbInterfaceGroup);
00273 hbUnit->setSpacing(KDialog::spacingHint());
00274 QLabel *unitLabel= new QLabel(i18n("&Units:"),hbUnit);
00275
00276 m_unitCombo = new QComboBox( hbUnit );
00277 m_unitCombo->insertStringList( KoUnit::listOfUnitName() );
00278 connect(m_unitCombo, SIGNAL(activated(int)), this, SIGNAL(unitChanged(int)));
00279 unitLabel->setBuddy( m_unitCombo );
00280 QString unitHelp = i18n("Select the unit type used every time a distance or width/height "
00281 "is displayed or entered. This one setting is for the whole of KWord: all dialogs, the rulers etc. "
00282 "Note that KWord documents specify the unit which was used to create them, so this setting "
00283 "only affects this document and all documents that will be created later.");
00284 QWhatsThis::add( unitLabel, unitHelp );
00285 QWhatsThis::add( m_unitCombo, unitHelp );
00286
00287 showStatusBar = new QCheckBox(i18n("Show &status bar"),gbInterfaceGroup);
00288 showStatusBar->setChecked(oldShowStatusBar);
00289 QWhatsThis::add( showStatusBar, i18n("Show or hide the status bar. If enabled, the status bar is shown at the bottom, which displays various information."));
00290
00291 showScrollBar = new QCheckBox( i18n("Show s&crollbar"), gbInterfaceGroup);
00292 showScrollBar->setChecked(oldShowScrollBar);
00293 QWhatsThis::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."));
00294
00295 pgUpDownMovesCaret = new QCheckBox(i18n("PageUp/PageDown &moves the caret"),gbInterfaceGroup);
00296 pgUpDownMovesCaret->setChecked(oldPgUpDownMovesCaret);
00297 QWhatsThis::add( pgUpDownMovesCaret, i18n(
00298 "If this option is enabled, the PageUp and PageDown keys "
00299 "move the text caret, as in other KDE applications. "
00300 "If it is disabled, they move the scrollbars, as in most other word processors." ) );
00301
00302 QHBox* hbRecent = new QHBox( gbInterfaceGroup );
00303 QString recentHelp = i18n("The number of files remembered in the file open dialog and in the "
00304 "recent files menu item.");
00305 QLabel* labelRecent = new QLabel( i18n("Number of recent &files:"), hbRecent );
00306 QWhatsThis::add( labelRecent, recentHelp );
00307 recentFiles=new KIntNumInput( oldNbRecentFiles, hbRecent );
00308 recentFiles->setRange(1, 20, 1);
00309 labelRecent->setBuddy( recentFiles );
00310 QWhatsThis::add( recentFiles, recentHelp );
00311
00312 QHBox* hbGridX = new QHBox( gbInterfaceGroup );
00313 QString gridxHelp = i18n("The grid size on which frames, tabs and other content snaps while "
00314 "moving and scaling.");
00315 QLabel* labelGridX = new QLabel( i18n("&Horizontal grid size:"), hbGridX );
00316 QWhatsThis::add( labelGridX, gridxHelp );
00317 gridX=new KoUnitDoubleSpinBox( hbGridX,
00318 0.1,
00319 50,
00320 0.1,
00321 ptGridX,
00322 unit );
00323 labelGridX->setBuddy( gridX );
00324 QWhatsThis::add( gridX, gridxHelp );
00325
00326 QHBox* hbGridY = new QHBox( gbInterfaceGroup );
00327 QString gridyHelp = i18n("The grid size on which frames and other content snaps while "
00328 "moving and scaling.");
00329 QLabel* labelGridY = new QLabel( i18n("&Vertical grid size:"), hbGridY );
00330 QWhatsThis::add( labelGridY, gridyHelp );
00331 gridY=new KoUnitDoubleSpinBox( hbGridY,
00332 0.1,
00333 50,
00334 0.1,
00335 ptGridY,
00336 unit );
00337 labelGridY->setBuddy( gridY );
00338
00339 QWhatsThis::add( gridY, gridyHelp );
00340
00341 QHBox* hbIndent = new QHBox( gbInterfaceGroup );
00342 QString indentHelp = i18n("Configure the indent width used when using the 'Increase' "
00343 "or 'Decrease' indentation buttons on a paragraph.<p>The lower the value, "
00344 "the more often the buttons will have to be pressed to gain the same "
00345 "indentation.");
00346 QLabel* labelIndent = new QLabel( i18n("&Paragraph indent by toolbar buttons:"), hbIndent );
00347 QWhatsThis::add( labelIndent, indentHelp );
00348 indent = new KoUnitDoubleSpinBox( hbIndent,
00349 0.1,
00350 5000,
00351 0.1,
00352 ptIndent,
00353 unit );
00354 labelIndent->setBuddy( indent );
00355 QWhatsThis::add( indent, indentHelp );
00356
00357 QHBox* hbPagePerRow = new QHBox( gbInterfaceGroup );
00358 QString pagePerRowHelp = i18n("After selecting Preview Mode (from the \"View\" menu,) "
00359 "this is the number of pages KWord will "
00360 "position on one horizontal row.");
00361 QLabel* labelPagePerRow = new QLabel( i18n("Number of pa&ges per row in preview mode:" ), hbPagePerRow );
00362 QWhatsThis::add( labelPagePerRow, pagePerRowHelp );
00363 m_nbPagePerRow=new KIntNumInput( 0, nbPagePerRow, hbPagePerRow );
00364 m_nbPagePerRow->setRange(1, 10, 1);
00365 labelPagePerRow->setBuddy( m_nbPagePerRow );
00366 hbPagePerRow->setStretchFactor( m_nbPagePerRow, 1 );
00367 QWhatsThis::add(m_nbPagePerRow , pagePerRowHelp );
00368 }
00369
00370 void ConfigureInterfacePage::apply()
00371 {
00372 KWDocument * doc = m_pView->kWordDocument();
00373 double valX = QMAX( 0.1, gridX->value() );
00374 double valY = QMAX( 0.1, gridY->value() );
00375 int nbRecent=recentFiles->value();
00376
00377 bool statusBar=showStatusBar->isChecked();
00378 bool scrollBar = showScrollBar->isChecked();
00379 config->setGroup( "Interface" );
00380 bool updateView = false;
00381 if(valX!=doc->gridX())
00382 {
00383 config->writeEntry( "GridX", valX, true, false, 'g', DBL_DIG );
00384 doc->setGridX(valX);
00385 updateView= true;
00386 }
00387 if(valY!=doc->gridY())
00388 {
00389 config->writeEntry( "GridY", valY, true, false, 'g', DBL_DIG );
00390 doc->setGridY(valY);
00391 updateView= true;
00392 }
00393 double newIndent = indent->value();
00394 if( newIndent != doc->indentValue() )
00395 {
00396 config->writeEntry( "Indent", newIndent, true, false, 'g', DBL_DIG );
00397 doc->setIndentValue( newIndent );
00398 }
00399 if(nbRecent!=oldNbRecentFiles)
00400 {
00401 config->writeEntry( "NbRecentFile", nbRecent);
00402 m_pView->changeNbOfRecentFiles(nbRecent);
00403 }
00404 bool refreshGUI= false;
00405
00406 if( statusBar != doc->showStatusBar() )
00407 {
00408 config->writeEntry( "ShowStatusBar", statusBar );
00409 doc->setShowStatusBar( statusBar );
00410 refreshGUI=true;
00411 }
00412
00413 if( scrollBar != doc->showScrollBar() )
00414 {
00415 config->writeEntry( "ShowScrollBar", scrollBar );
00416 doc->setShowScrollBar( scrollBar );
00417 refreshGUI=true;
00418 }
00419
00420 bool b = pgUpDownMovesCaret->isChecked();
00421 if ( b != doc->pgUpDownMovesCaret() )
00422 {
00423 config->writeEntry( "PgUpDownMovesCaret", b );
00424 doc->setPgUpDownMovesCaret( b );
00425 }
00426
00427 if( refreshGUI )
00428 doc->reorganizeGUI();
00429
00430
00431 int nbPageByRow=m_nbPagePerRow->value();
00432 if(nbPageByRow!=doc->nbPagePerRow())
00433 {
00434 config->writeEntry("nbPagePerRow",nbPageByRow);
00435 m_pView->getGUI()->canvasWidget()->viewMode()->setPagesPerRow(nbPageByRow);
00436 doc->setNbPagePerRow(nbPageByRow);
00437
00438
00439
00440
00441 doc->switchViewMode( doc->viewModeType() );
00442 }
00443
00444 config->setGroup( "Misc" );
00445 KoUnit::Unit unit = static_cast<KoUnit::Unit>( m_unitCombo->currentItem() );
00446
00447 config->writeEntry( "Units", KoUnit::unitName( unit ) );
00448 if ( updateView )
00449 doc->repaintAllViews(false);
00450 }
00451
00452 void ConfigureInterfacePage::setUnit( KoUnit::Unit unit )
00453 {
00454 m_unitCombo->blockSignals( true );
00455 m_unitCombo->setCurrentItem( unit );
00456 m_unitCombo->blockSignals( false );
00457
00458 m_pView->kWordDocument()->setUnit( unit );
00459
00460 gridX->setUnit( unit );
00461 gridY->setUnit( unit );
00462 indent->setUnit( unit );
00463 }
00464
00465 void ConfigureInterfacePage::slotDefault()
00466 {
00467 KWDocument * doc = m_pView->kWordDocument();
00468 m_unitCombo->setCurrentItem( KoUnit::U_CM );
00469 emit unitChanged( m_unitCombo->currentItem() );
00470 gridX->setValue( KoUnit::toUserValue( MM_TO_POINT( 5.0 ),doc->unit() ) );
00471 gridY->setValue( KoUnit::toUserValue( MM_TO_POINT( 5.0 ),doc->unit() ) );
00472 m_nbPagePerRow->setValue(4);
00473 double newIndent = KoUnit::toUserValue( MM_TO_POINT( 10 ), doc->unit() );
00474 indent->setValue( newIndent );
00475 recentFiles->setValue(10);
00476 showStatusBar->setChecked(true);
00477 pgUpDownMovesCaret->setChecked(false);
00478 showScrollBar->setChecked( true);
00479 }
00480
00482
00483 ConfigureMiscPage::ConfigureMiscPage( KWView *view, QVBox *box, char *name )
00484 : QObject( box->parent(), name )
00485 {
00486 m_pView=view;
00487 config = KWFactory::instance()->config();
00488 QVGroupBox* gbMiscGroup = new QVGroupBox( i18n("Misc"), box, "GroupBox" );
00489 gbMiscGroup->setMargin( KDialog::marginHint() );
00490 gbMiscGroup->setInsideSpacing( KDialog::spacingHint() );
00491
00492 m_oldNbRedo=30;
00493
00494
00495
00496
00497 if( config->hasGroup("Misc") )
00498 {
00499 config->setGroup( "Misc" );
00500 m_oldNbRedo=config->readNumEntry("UndoRedo",m_oldNbRedo);
00501 }
00502
00503 QHBox* hbUndoRedo = new QHBox( gbMiscGroup );
00504 QLabel* labelUndoRedo = new QLabel( i18n("Undo/&redo limit:"), hbUndoRedo );
00505 QString undoHelp = i18n("Limit the number of undo/redo actions remembered. "
00506 "A lower value helps to save memory, a higher value allows "
00507 "you to undo and redo more editing steps.");
00508 m_undoRedoLimit=new KIntNumInput( m_oldNbRedo, hbUndoRedo );
00509 m_undoRedoLimit->setRange(1, 100, 1);
00510 labelUndoRedo->setBuddy( m_undoRedoLimit );
00511 QWhatsThis::add( m_undoRedoLimit, undoHelp );
00512 QWhatsThis::add( labelUndoRedo, undoHelp );
00513
00514 KWDocument* doc = m_pView->kWordDocument();
00515 m_displayLink=new QCheckBox(i18n("Display &links"),gbMiscGroup);
00516 m_displayLink->setChecked(doc->variableCollection()->variableSetting()->displayLink());
00517 QWhatsThis::add( m_displayLink, i18n("If enabled, a link is highlighted as such and is clickable.\n\n"
00518 "You can insert a link from the Insert menu."));
00519 m_underlineLink=new QCheckBox(i18n("&Underline all links"),gbMiscGroup);
00520 m_underlineLink->setChecked(doc->variableCollection()->variableSetting()->underlineLink());
00521 QWhatsThis::add( m_underlineLink, i18n("If enabled, a link is underlined."));
00522
00523 m_displayComment=new QCheckBox(i18n("Display c&omments"),gbMiscGroup);
00524 m_displayComment->setChecked(doc->variableCollection()->variableSetting()->displayComment());
00525 QWhatsThis::add( m_displayComment, i18n("If enabled, comments are indicated by a small yellow box.\n\n"
00526 "You can show and edit a comment from the context menu."));
00527
00528 m_displayFieldCode=new QCheckBox(i18n("Display field code"),gbMiscGroup);
00529 m_displayFieldCode->setChecked(doc->variableCollection()->variableSetting()->displayFieldCode());
00530 QWhatsThis::add( m_displayFieldCode, i18n("If enabled, the type of link is displayed instead "
00531 "of displaying the link text.\n\n"
00532 "There are various types of link that can be inserted, "
00533 "such as hyperlinks, files, mail, news and bookmarks."));
00534
00535
00536 QVGroupBox* gbViewFormatting = new QVGroupBox( i18n("View Formatting"), box, "view_formatting" );
00537 QWhatsThis::add( gbViewFormatting, i18n("These settings can be used to select the formatting "
00538 "characters that should be shown.\n\n"
00539 "Note that the selected formatting characters are only "
00540 "shown if formatting characters are enabled in general, "
00541 "which can be done from the View menu."));
00542 gbViewFormatting->setMargin( KDialog::marginHint() );
00543 gbViewFormatting->setInsideSpacing( KDialog::spacingHint() );
00544
00545 m_oldFormattingEndParag = doc->viewFormattingEndParag();
00546 m_oldFormattingSpace = doc->viewFormattingSpace();
00547 m_oldFormattingTabs = doc->viewFormattingTabs();
00548 m_oldFormattingBreak = doc->viewFormattingBreak();
00549
00550 m_cbViewFormattingEndParag = new QCheckBox( i18n("View formatting end paragraph"), gbViewFormatting);
00551 m_cbViewFormattingEndParag->setChecked(m_oldFormattingEndParag);
00552
00553 m_cbViewFormattingSpace = new QCheckBox( i18n("View formatting space"), gbViewFormatting);
00554 m_cbViewFormattingSpace->setChecked(m_oldFormattingSpace);
00555
00556 m_cbViewFormattingTabs = new QCheckBox( i18n("View formatting tabs"), gbViewFormatting);
00557 m_cbViewFormattingTabs->setChecked(m_oldFormattingTabs);
00558
00559 m_cbViewFormattingBreak = new QCheckBox( i18n("View formatting break"), gbViewFormatting);
00560 m_cbViewFormattingBreak->setChecked(m_oldFormattingBreak);
00561 }
00562
00563 ConfigureDefaultDocPage::~ConfigureDefaultDocPage()
00564 {
00565 delete font;
00566 }
00567
00568 KCommand *ConfigureMiscPage::apply()
00569 {
00570 KWDocument * doc = m_pView->kWordDocument();
00571 config->setGroup( "Misc" );
00572 int newUndo=m_undoRedoLimit->value();
00573 if(newUndo!=m_oldNbRedo)
00574 {
00575 config->writeEntry("UndoRedo",newUndo);
00576 doc->setUndoRedoLimit(newUndo);
00577 m_oldNbRedo=newUndo;
00578 }
00579 KMacroCommand * macroCmd=0L;
00580 bool b=m_displayLink->isChecked();
00581 if(doc->variableCollection()->variableSetting()->displayLink()!=b)
00582 {
00583 if(!macroCmd)
00584 {
00585 macroCmd=new KMacroCommand(i18n("Change Display Link Command"));
00586 }
00587 KWChangeVariableSettingsCommand *cmd=new KWChangeVariableSettingsCommand( i18n("Change Display Link Command"), doc, doc->variableCollection()->variableSetting()->displayLink() ,b, KWChangeVariableSettingsCommand::VS_DISPLAYLINK);
00588
00589 cmd->execute();
00590 macroCmd->addCommand(cmd);
00591 }
00592 b=m_underlineLink->isChecked();
00593 if(doc->variableCollection()->variableSetting()->underlineLink()!=b)
00594 {
00595 if(!macroCmd)
00596 {
00597 macroCmd=new KMacroCommand(i18n("Change Display Link Command"));
00598 }
00599 KWChangeVariableSettingsCommand *cmd=new KWChangeVariableSettingsCommand( i18n("Change Display Link Command"), doc, doc->variableCollection()->variableSetting()->underlineLink() ,b, KWChangeVariableSettingsCommand::VS_UNDERLINELINK);
00600 cmd->execute();
00601 macroCmd->addCommand(cmd);
00602 }
00603
00604 b=m_displayComment->isChecked();
00605 if(doc->variableCollection()->variableSetting()->displayComment()!=b)
00606 {
00607 if(!macroCmd)
00608 {
00609 macroCmd=new KMacroCommand(i18n("Change Display Link Command"));
00610 }
00611 KWChangeVariableSettingsCommand *cmd=new KWChangeVariableSettingsCommand( i18n("Change Display Link Command"), doc, doc->variableCollection()->variableSetting()->displayComment() ,b, KWChangeVariableSettingsCommand::VS_DISPLAYCOMMENT);
00612 cmd->execute();
00613 macroCmd->addCommand(cmd);
00614 }
00615 b=m_displayFieldCode->isChecked();
00616 if(doc->variableCollection()->variableSetting()->displayFieldCode()!=b)
00617 {
00618 if(!macroCmd)
00619 {
00620 macroCmd=new KMacroCommand(i18n("Change Display Field Code Command"));
00621 }
00622 KWChangeVariableSettingsCommand *cmd=new KWChangeVariableSettingsCommand( i18n("Change Display Field Code Command"), doc, doc->variableCollection()->variableSetting()->displayFieldCode() ,b, KWChangeVariableSettingsCommand::VS_DISPLAYFIELDCODE);
00623 cmd->execute();
00624 macroCmd->addCommand(cmd);
00625 }
00626
00627 bool state =m_cbViewFormattingEndParag->isChecked();
00628 bool needRepaint = false;
00629 if ( state != m_oldFormattingEndParag )
00630 {
00631 doc->setViewFormattingEndParag(state);
00632 needRepaint = true;
00633 m_oldFormattingEndParag = state;
00634 }
00635 state = m_cbViewFormattingSpace->isChecked();
00636 if ( state != m_oldFormattingSpace)
00637 {
00638 doc->setViewFormattingSpace(state);
00639 needRepaint = true;
00640 m_oldFormattingSpace = state;
00641 }
00642 state = m_cbViewFormattingBreak->isChecked();
00643 if ( state != m_oldFormattingBreak)
00644 {
00645 doc->setViewFormattingBreak(state);
00646 needRepaint = true;
00647 m_oldFormattingBreak = state;
00648 }
00649 state = m_cbViewFormattingTabs->isChecked();
00650 if ( state != m_oldFormattingTabs )
00651 {
00652 doc->setViewFormattingTabs(state);
00653 needRepaint = true;
00654 m_oldFormattingTabs= state;
00655 }
00656 if ( needRepaint )
00657 {
00658 doc->layout();
00659 doc->repaintAllViews();
00660 }
00661 return macroCmd;
00662 }
00663
00664 void ConfigureMiscPage::slotDefault()
00665 {
00666 m_undoRedoLimit->setValue(30);
00667 m_displayLink->setChecked(true);
00668 m_displayComment->setChecked(true);
00669 m_underlineLink->setChecked(true);
00670 m_cbViewFormattingEndParag->setChecked(true);
00671 m_cbViewFormattingSpace->setChecked(true);
00672 m_cbViewFormattingTabs->setChecked(true);
00673 m_cbViewFormattingBreak->setChecked(true);
00674 m_displayFieldCode->setChecked( false );
00675 }
00676
00677 void ConfigureMiscPage::setUnit( KoUnit::Unit )
00678 {
00679 }
00680
00682
00683 ConfigureDefaultDocPage::ConfigureDefaultDocPage( KWView *view, QVBox *box, char *name )
00684 : QObject( box->parent(), name )
00685 {
00686 m_pView=view;
00687 KWDocument * doc = m_pView->kWordDocument();
00688 config = KWFactory::instance()->config();
00689 QVGroupBox* gbDocumentDefaults = new QVGroupBox( i18n("Document Defaults"), box, "GroupBox" );
00690 gbDocumentDefaults->setMargin( KDialog::marginHint() );
00691 gbDocumentDefaults->setInsideSpacing( KDialog::spacingHint() );
00692
00693 double ptColumnSpacing=3;
00694 KoUnit::Unit unit = doc->unit();
00695 if( config->hasGroup("Document defaults") )
00696 {
00697 config->setGroup( "Document defaults" );
00698 ptColumnSpacing=config->readDoubleNumEntry("ColumnSpacing",ptColumnSpacing);
00699
00700 }
00701
00702
00703 QHBox* hbColumnSpacing = new QHBox( gbDocumentDefaults );
00704 QLabel* columnSpacingLabel = new QLabel( i18n("Default column spacing:"), hbColumnSpacing );
00705 m_columnSpacing = new KoUnitDoubleSpinBox( hbColumnSpacing,
00706 0.1,
00707 50,
00708 0.1,
00709 ptColumnSpacing,
00710 unit );
00711 columnSpacingLabel->setBuddy( m_columnSpacing );
00712 QWhatsThis::add( m_columnSpacing, i18n("When setting a document to use more than one column "
00713 "this distance will be used to separate the columns. This value is merely a default "
00714 "setting as the column spacing can be changed per document") );
00715
00716 QWidget *fontContainer = new QWidget(gbDocumentDefaults);
00717 QGridLayout * fontLayout = new QGridLayout(fontContainer, 1, 3);
00718
00719 fontLayout->setSpacing(KDialog::spacingHint());
00720 fontLayout->setColStretch(0, 0);
00721 fontLayout->setColStretch(1, 1);
00722 fontLayout->setColStretch(2, 0);
00723
00724 QLabel *fontTitle = new QLabel(i18n("Default font:"), fontContainer);
00725
00726 font= new QFont( doc->defaultFont() );
00727
00728 QString labelName = font->family() + ' ' + QString::number(font->pointSize());
00729 fontName = new QLabel(labelName, fontContainer);
00730 fontName->setFont(*font);
00731 fontName->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
00732
00733 QPushButton *chooseButton = new QPushButton(i18n("Choose..."), fontContainer);
00734 connect(chooseButton, SIGNAL(clicked()), this, SLOT(selectNewDefaultFont()));
00735
00736 fontLayout->addWidget(fontTitle, 0, 0);
00737 fontLayout->addWidget(fontName, 0, 1);
00738 fontLayout->addWidget(chooseButton, 0, 2);
00739
00740
00741 oldAutoSaveValue=KoDocument::defaultAutoSave() / 60;
00742 m_oldLanguage = doc->globalLanguage();
00743 m_oldHyphenation = doc->globalHyphenation();
00744 if( config->hasGroup("Interface") )
00745 {
00746 config->setGroup( "Interface" );
00747 oldAutoSaveValue=config->readNumEntry("AutoSave",oldAutoSaveValue);
00748 m_oldLanguage = config->readEntry( "language", m_oldLanguage);
00749 m_oldHyphenation = config->readBoolEntry( "hyphenation", m_oldHyphenation);
00750 }
00751
00752
00753 QWidget *languageContainer = new QWidget(gbDocumentDefaults);
00754 QGridLayout * languageLayout = new QGridLayout(languageContainer, 1, 3);
00755
00756 languageLayout->setSpacing(KDialog::spacingHint());
00757 languageLayout->setColStretch(0, 0);
00758 languageLayout->setColStretch(1, 1);
00759
00760 QLabel *languageTitle = new QLabel(i18n("Global language:"), languageContainer);
00761
00762 m_globalLanguage = new QComboBox( languageContainer );
00763 m_globalLanguage->insertStringList( KoGlobal::listOfLanguages() );
00764 m_globalLanguage->setCurrentText( KoGlobal::languageFromTag( m_oldLanguage ) );
00765
00766 languageLayout->addWidget(languageTitle, 0, 0);
00767 languageLayout->addWidget(m_globalLanguage, 0, 1);
00768
00769 m_autoHyphenation = new QCheckBox( i18n("Automatic hyphenation"), gbDocumentDefaults);
00770 m_autoHyphenation->setChecked( m_oldHyphenation );
00771
00772 QVGroupBox* gbDocumentSettings = new QVGroupBox( i18n("Document Settings"), box );
00773 gbDocumentSettings->setMargin( KDialog::marginHint() );
00774 gbDocumentSettings->setInsideSpacing( KDialog::spacingHint() );
00775
00776 QHBox* hbAutoSave = new QHBox( gbDocumentSettings );
00777 QLabel* labelAutoSave = new QLabel( i18n("Autosave every (min):"), hbAutoSave );
00778 autoSave = new KIntNumInput( oldAutoSaveValue, hbAutoSave );
00779 autoSave->setRange(0, 60, 1);
00780 labelAutoSave->setBuddy(autoSave);
00781 QWhatsThis::add( autoSave, i18n("A backup copy of the current document is created when a change "
00782 "has been made. The interval used to create backup documents is set here.") );
00783 autoSave->setSpecialValueText(i18n("No autosave"));
00784 autoSave->setSuffix(i18n(" min"));
00785
00786 m_oldBackupFile = true;
00787 if( config->hasGroup("Interface") )
00788 {
00789 config->setGroup( "Interface" );
00790 m_oldBackupFile=config->readBoolEntry("BackupFile",m_oldBackupFile);
00791 }
00792
00793 m_createBackupFile = new QCheckBox( i18n("Create backup file"), gbDocumentSettings);
00794 m_createBackupFile->setChecked( m_oldBackupFile );
00795
00796 QHBox* hbStartingPage = new QHBox( gbDocumentSettings );
00797 QLabel* labelStartingPage = new QLabel(i18n("Starting page number:"), hbStartingPage);
00798
00799 m_oldStartingPage=doc->variableCollection()->variableSetting()->startingPageNumber();
00800 m_variableNumberOffset=new KIntNumInput(hbStartingPage);
00801 m_variableNumberOffset->setRange(-1000, 9999, 1, false);
00802 m_variableNumberOffset->setValue(m_oldStartingPage);
00803 labelStartingPage->setBuddy( m_variableNumberOffset );
00804
00805 QHBox* hbTabStop = new QHBox( gbDocumentSettings );
00806 tabStop = new QLabel(i18n("Tab stop (%1):").arg(doc->unitName()), hbTabStop);
00807 m_tabStopWidth = new KoUnitDoubleSpinBox( hbTabStop,
00808 MM_TO_POINT(2),
00809 doc->pageManager()->page(doc->startPage())->width(),
00810 0.1,
00811 doc->tabStopValue(),
00812 unit );
00813 m_oldTabStopWidth = doc->tabStopValue();
00814
00815 QVGroupBox* gbDocumentCursor = new QVGroupBox( i18n("Cursor"), box );
00816 gbDocumentCursor->setMargin( KDialog::marginHint() );
00817 gbDocumentCursor->setInsideSpacing( KDialog::spacingHint() );
00818
00819 m_cursorInProtectedArea= new QCheckBox(i18n("Cursor in protected area"),gbDocumentCursor);
00820 m_cursorInProtectedArea->setChecked(doc->cursorInProtectedArea());
00821
00822
00823
00824 }
00825
00826 KCommand *ConfigureDefaultDocPage::apply()
00827 {
00828 config->setGroup( "Document defaults" );
00829 KWDocument * doc = m_pView->kWordDocument();
00830 double colSpacing = m_columnSpacing->value();
00831 if ( colSpacing != doc->defaultColumnSpacing() )
00832 {
00833 config->writeEntry( "ColumnSpacing", colSpacing , true, false, 'g', DBL_DIG );
00834 doc->setDefaultColumnSpacing(colSpacing);
00835 }
00836 config->writeEntry("DefaultFont",font->toString());
00837
00838 config->setGroup( "Interface" );
00839 int autoSaveVal=autoSave->value();
00840 if(autoSaveVal!=oldAutoSaveValue)
00841 {
00842 config->writeEntry( "AutoSave", autoSaveVal );
00843 doc->setAutoSave(autoSaveVal*60);
00844 oldAutoSaveValue=autoSaveVal;
00845 }
00846
00847 bool state =m_createBackupFile->isChecked();
00848 if(state!=m_oldBackupFile)
00849 {
00850 config->writeEntry( "BackupFile", state );
00851 doc->setBackupFile( state);
00852 m_oldBackupFile=state;
00853 }
00854
00855 state = m_cursorInProtectedArea->isChecked();
00856 if ( state != doc->cursorInProtectedArea() )
00857 {
00858 config->writeEntry( "cursorInProtectArea", state );
00859 doc->setCursorInProtectedArea( state );
00860 }
00861
00862
00863
00864
00865
00866
00867
00868 QString lang = KoGlobal::tagOfLanguage( m_globalLanguage->currentText() );
00869 config->writeEntry( "language" , lang);
00870 m_oldLanguage = lang;
00871
00872
00873
00874
00875 state = m_autoHyphenation->isChecked();
00876 config->writeEntry( "hyphenation", state );
00877 m_oldHyphenation = state;
00878
00879 KMacroCommand * macroCmd=0L;
00880 int newStartingPage=m_variableNumberOffset->value();
00881 if(newStartingPage!=m_oldStartingPage)
00882 {
00883 macroCmd=new KMacroCommand(i18n("Change Starting Page Number"));
00884 KWChangeStartingPageCommand *cmd = new KWChangeStartingPageCommand( i18n("Change Starting Page Number"), doc, m_oldStartingPage,newStartingPage );
00885 cmd->execute();
00886 macroCmd->addCommand(cmd);
00887 m_oldStartingPage=newStartingPage;
00888 }
00889 double newTabStop = m_tabStopWidth->value();
00890 if ( newTabStop != m_oldTabStopWidth)
00891 {
00892 if ( !macroCmd )
00893 macroCmd=new KMacroCommand(i18n("Change Tab Stop Value"));
00894
00895
00896 KWChangeTabStopValueCommand *cmd = new KWChangeTabStopValueCommand( i18n("Change Tab Stop Value"), m_oldTabStopWidth, newTabStop, doc);
00897 cmd->execute();
00898 macroCmd->addCommand(cmd);
00899 m_oldTabStopWidth = newTabStop;
00900 }
00901
00902 return macroCmd;
00903 }
00904
00905 void ConfigureDefaultDocPage::slotDefault()
00906 {
00907 m_columnSpacing->setValue( 3 );
00908 autoSave->setValue( KoDocument::defaultAutoSave() / 60 );
00909 m_variableNumberOffset->setValue(1);
00910 m_cursorInProtectedArea->setChecked(true);
00911 m_tabStopWidth->setValue( MM_TO_POINT(15) );
00912 m_createBackupFile->setChecked( true );
00913
00914 m_globalLanguage->setCurrentText( KoGlobal::languageFromTag( KGlobal::locale()->language() ) );
00915 m_autoHyphenation->setChecked( false );
00916 }
00917
00918 void ConfigureDefaultDocPage::selectNewDefaultFont() {
00919 QStringList list;
00920 KFontChooser::getFontList(list, KFontChooser::SmoothScalableFonts);
00921 KFontDialog dlg( (QWidget *)this->parent(), "Font Selector", false, true, list, true );
00922 dlg.setFont(*font);
00923 int result = dlg.exec();
00924 if (KDialog::Accepted == result) {
00925 delete font;
00926 font = new QFont(dlg.font());
00927 fontName->setText(font->family() + ' ' + QString::number(font->pointSize()));
00928 fontName->setFont(*font);
00929 m_pView->kWordDocument()->setDefaultFont( *font );
00930 }
00931 }
00932
00933 void ConfigureDefaultDocPage::setUnit( KoUnit::Unit unit )
00934 {
00935 m_columnSpacing->setUnit( unit );
00936 m_tabStopWidth->setUnit( unit );
00937 tabStop->setText( i18n( "Tab stop:" ) );
00938 }
00939
00941
00942 ConfigurePathPage::ConfigurePathPage( KWView *view, QVBox *box, char *name )
00943 : QObject( box->parent(), name )
00944 {
00945 m_pView=view;
00946 KWDocument * doc = m_pView->kWordDocument();
00947 config = KWFactory::instance()->config();
00948 QVGroupBox* gbPathGroup = new QVGroupBox( i18n("Path"), box, "GroupBox" );
00949 gbPathGroup->setMargin( KDialog::marginHint() );
00950 gbPathGroup->setInsideSpacing( KDialog::spacingHint() );
00951
00952 m_pPathView = new KListView( gbPathGroup );
00953 m_pPathView->setResizeMode(QListView::NoColumn);
00954 m_pPathView->addColumn( i18n( "Type" ) );
00955 m_pPathView->addColumn( i18n( "Path" ), 400 );
00956 (void) new QListViewItem( m_pPathView, i18n("Personal Expression"), doc->personalExpressionPath().join(";") );
00957 (void) new QListViewItem( m_pPathView, i18n("Backup Path"),doc->backupPath() );
00958
00959 m_modifyPath = new QPushButton( i18n("Modify Path..."), gbPathGroup);
00960 connect( m_modifyPath, SIGNAL( clicked ()), this, SLOT( slotModifyPath()));
00961 connect( m_pPathView, SIGNAL( doubleClicked (QListViewItem *, const QPoint &, int )), this, SLOT( slotModifyPath()));
00962 connect( m_pPathView, SIGNAL( selectionChanged ( QListViewItem * )), this, SLOT( slotSelectionChanged(QListViewItem * )));
00963 slotSelectionChanged(m_pPathView->currentItem());
00964 }
00965
00966 void ConfigurePathPage::slotSelectionChanged(QListViewItem * item)
00967 {
00968 m_modifyPath->setEnabled( item );
00969 }
00970
00971 void ConfigurePathPage::slotModifyPath()
00972 {
00973 QListViewItem *item = m_pPathView->currentItem ();
00974 if ( item )
00975 {
00976 if ( item->text(0)==i18n("Personal Expression"))
00977 {
00978 KoEditPathDia * dlg = new KoEditPathDia( item->text( 1), 0L, "editpath");
00979 if (dlg->exec() )
00980 item->setText(1, dlg->newPath());
00981 delete dlg;
00982 }
00983 if ( item->text(0)==i18n("Backup Path"))
00984 {
00985 KoChangePathDia *dlg = new KoChangePathDia( item->text(1), 0L, "backup path" );
00986 if (dlg->exec() )
00987 item->setText(1, dlg->newPath());
00988 delete dlg;
00989 }
00990 }
00991 }
00992
00993 void ConfigurePathPage::slotDefault()
00994 {
00995 QListViewItem * item = m_pPathView->findItem(i18n("Personal Expression"), 0);
00996 if ( item )
00997 item->setText(1, KWFactory::instance()->dirs()->resourceDirs("expression").join(";"));
00998 item = m_pPathView->findItem(i18n("Backup Path"), 0);
00999 if ( item )
01000 item->setText(1, QString::null );
01001 }
01002
01003 void ConfigurePathPage::apply()
01004 {
01005 QListViewItem * item = m_pPathView->findItem(i18n("Personal Expression"), 0);
01006 if ( item )
01007 {
01008 QStringList lst = QStringList::split(QString(";"), item->text(1));
01009 if ( lst != m_pView->kWordDocument()->personalExpressionPath())
01010 {
01011 m_pView->kWordDocument()->setPersonalExpressionPath(lst);
01012 config->setGroup( "Kword Path" );
01013 config->writePathEntry( "expression path", lst);
01014 }
01015 }
01016 item = m_pPathView->findItem(i18n("Backup Path"), 0);
01017 if ( item )
01018 {
01019 QString res = item->text(1 );
01020 if ( res != m_pView->kWordDocument()->backupPath())
01021 {
01022 config->setGroup( "Kword Path" );
01023 m_pView->kWordDocument()->setBackupPath( res );
01024 config->writePathEntry( "backup path",res );
01025 }
01026 }
01027
01028 }
01029
01031
01032 ConfigureTTSPage::ConfigureTTSPage( KWView *view, QVBox *box, char *name )
01033 : QObject( box->parent(), name )
01034 {
01035 Q_UNUSED(view);
01036
01037
01038
01039 m_cbSpeakPointerWidget = new QCheckBox(i18n("Speak widget under &mouse pointer"), box);
01040 m_cbSpeakFocusWidget = new QCheckBox(i18n("Speak widget with &focus"), box);
01041 m_gbScreenReaderOptions = new QVGroupBox("", box);
01042 m_gbScreenReaderOptions->setMargin( KDialog::marginHint() );
01043 m_gbScreenReaderOptions->setInsideSpacing( KDialog::spacingHint() );
01044 m_cbSpeakTooltips = new QCheckBox(i18n("Speak &tool tips"), m_gbScreenReaderOptions);
01045 m_cbSpeakWhatsThis = new QCheckBox(i18n("Speak &What's This"), m_gbScreenReaderOptions);
01046 m_cbSpeakDisabled = new QCheckBox(i18n("Verbal indication if widget is disabled (grayed)",
01047 "&Say whether disabled"), m_gbScreenReaderOptions);
01048 m_cbSpeakAccelerators = new QCheckBox(i18n("Spea&k accelerators"), m_gbScreenReaderOptions);
01049 QHBox* hbAcceleratorPrefix = new QHBox(m_gbScreenReaderOptions);
01050 QWidget* spacer = new QWidget(hbAcceleratorPrefix);
01051 spacer->setMinimumWidth(2 * KDialog::marginHint());
01052 m_lblAcceleratorPrefix =
01053 new QLabel(i18n("A word spoken before another word", "Pr&efaced by the word:"),
01054 hbAcceleratorPrefix);
01055 m_leAcceleratorPrefixWord = new QLineEdit(i18n("Keyboard accelerator, such as Alt+F", "Accelerator"),
01056 hbAcceleratorPrefix);
01057 m_lblAcceleratorPrefix->setBuddy(m_leAcceleratorPrefixWord);
01058 QHBox* hbPollingInterval = new QHBox(m_gbScreenReaderOptions);
01059 hbPollingInterval->setMargin( 0 );
01060 QLabel* lblPollingInterval = new QLabel(i18n("&Polling interval:"), hbPollingInterval);
01061 m_iniPollingInterval = new KIntNumInput(hbPollingInterval);
01062 m_iniPollingInterval->setSuffix(" ms");
01063 m_iniPollingInterval->setRange(100, 5000, 100, true);
01064 lblPollingInterval->setBuddy(m_iniPollingInterval);
01065
01066 config = KWFactory::instance()->config();
01067 config->setGroup("TTS");
01068 m_cbSpeakPointerWidget->setChecked(config->readBoolEntry("SpeakPointerWidget", false));
01069 m_cbSpeakFocusWidget->setChecked(config->readBoolEntry("SpeakFocusWidget", false));
01070 m_cbSpeakTooltips->setChecked(config->readBoolEntry("SpeakTooltips", true));
01071 m_cbSpeakWhatsThis->setChecked(config->readBoolEntry("SpeakWhatsThis", false));
01072 m_cbSpeakDisabled->setChecked(config->readBoolEntry("SpeakDisabled", true));
01073 m_cbSpeakAccelerators->setChecked(config->readBoolEntry("SpeakAccelerators", true));
01074 m_leAcceleratorPrefixWord->setText(config->readEntry("AcceleratorPrefixWord",
01075 i18n("Keyboard accelerator, such as Alt+F", "Accelerator")));
01076 m_iniPollingInterval->setValue(config->readNumEntry("PollingInterval", 600));
01077
01078 screenReaderOptionChanged();
01079 connect(m_cbSpeakPointerWidget, SIGNAL(toggled(bool)), this, SLOT(screenReaderOptionChanged()));
01080 connect(m_cbSpeakFocusWidget, SIGNAL(toggled(bool)), this, SLOT(screenReaderOptionChanged()));
01081 connect(m_cbSpeakAccelerators, SIGNAL(toggled(bool)), this, SLOT(screenReaderOptionChanged()));
01082 }
01083
01084 void ConfigureTTSPage::slotDefault()
01085 {
01086 m_cbSpeakPointerWidget->setChecked(false);
01087 m_cbSpeakFocusWidget->setChecked(false);
01088 m_cbSpeakTooltips->setChecked(true);
01089 m_cbSpeakWhatsThis->setChecked(false);
01090 m_cbSpeakDisabled->setChecked(true);
01091 m_cbSpeakAccelerators->setChecked(true);
01092 m_leAcceleratorPrefixWord->setText(i18n("Keyboard accelerator, such as Alt+F", "Accelerator"));
01093 m_iniPollingInterval->setValue(600);
01094 }
01095
01096 void ConfigureTTSPage::apply()
01097 {
01098 config->setGroup("TTS");
01099 config->writeEntry("SpeakPointerWidget", m_cbSpeakPointerWidget->isChecked());
01100 config->writeEntry("SpeakFocusWidget", m_cbSpeakFocusWidget->isChecked());
01101 config->writeEntry("SpeakTooltips", m_cbSpeakTooltips->isChecked());
01102 config->writeEntry("SpeakWhatsThis", m_cbSpeakWhatsThis->isChecked());
01103 config->writeEntry("SpeakDisabled", m_cbSpeakDisabled->isChecked());
01104 config->writeEntry("SpeakAccelerators", m_cbSpeakAccelerators->isChecked());
01105 config->writeEntry("AcceleratorPrefixWord", m_leAcceleratorPrefixWord->text());
01106 config->writeEntry("PollingInterval", m_iniPollingInterval->value());
01107 if (kospeaker) kospeaker->readConfig(config);
01108 }
01109
01110 void ConfigureTTSPage::screenReaderOptionChanged()
01111 {
01112 m_gbScreenReaderOptions->setEnabled(
01113 m_cbSpeakPointerWidget->isChecked() | m_cbSpeakFocusWidget->isChecked());
01114 m_leAcceleratorPrefixWord->setEnabled(m_cbSpeakAccelerators->isChecked());
01115 m_lblAcceleratorPrefix->setEnabled(m_cbSpeakAccelerators->isChecked());
01116 }
01117
01118 #include "KWConfig.moc"