00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifdef HAVE_CONFIG_H
00022 #include <config.h>
00023 #endif
00024
00025
00026 #include <kapplication.h>
00027 #include <KoUnitWidgets.h>
00028 #include <klocale.h>
00029 #include <kconfig.h>
00030 #include <kdialogbase.h>
00031 #include <kiconloader.h>
00032 #include <knuminput.h>
00033 #include <kcolorbutton.h>
00034 #include "KPrVariableCollection.h"
00035 #include "KPrCanvas.h"
00036 #include <tkcoloractions.h>
00037
00038 #include <KoSpeaker.h>
00039
00040 #include <qgroupbox.h>
00041 #include <qvgroupbox.h>
00042 #include <qlabel.h>
00043 #include <qlayout.h>
00044 #include <qvbox.h>
00045 #include <qcheckbox.h>
00046 #include <qcombobox.h>
00047 #include <qtabwidget.h>
00048 #include <qwhatsthis.h>
00049
00050 #include "KPrPenStyleWidget.h"
00051 #include "KPrBrushProperty.h"
00052 #include "KPrPieProperty.h"
00053 #include "KPrRectProperty.h"
00054 #include "KPrPolygonProperty.h"
00055
00056 #include "KPrConfig.h"
00057 #include "KPrView.h"
00058 #include "KPrDocument.h"
00059 #include "KPrPage.h"
00060 #include <KoUnit.h>
00061
00062 #include <float.h>
00063 #include <knumvalidator.h>
00064 #include <qlineedit.h>
00065 #include "KPrCommand.h"
00066 #include <qvgroupbox.h>
00067 #include <kfontdialog.h>
00068 #include <klineedit.h>
00069 #include <KoRect.h>
00070 #include <kmessagebox.h>
00071 #include <kdeversion.h>
00072 #include <kurlrequesterdlg.h>
00073 #include <klistview.h>
00074 #include <kfiledialog.h>
00075 #include <KoEditPath.h>
00076
00077 #include <kspell2/configwidget.h>
00078 #include <kspell2/settings.h>
00079 #include <kspell2/broker.h>
00080 using namespace KSpell2;
00081
00082 KPrConfig::KPrConfig( KPrView* parent )
00083 : KDialogBase(KDialogBase::IconList,i18n("Configure KPresenter") ,
00084 KDialogBase::Ok | KDialogBase::Apply | KDialogBase::Cancel| KDialogBase::Default,
00085 KDialogBase::Ok, parent)
00086
00087 {
00088 m_doc = parent->kPresenterDoc();
00089 QVBox *page = addVBoxPage( i18n("Interface"), i18n("Interface"),
00090 BarIcon("misc", KIcon::SizeMedium) );
00091 _interfacePage=new KPrConfigureInterfacePage( parent, page );
00092 page = addVBoxPage( i18n("Color"), i18n("Color"),
00093 BarIcon("colorize", KIcon::SizeMedium) );
00094 _colorBackground = new KPrConfigureColorBackground( parent, page );
00095
00096 page = addVBoxPage( i18n("Spelling"), i18n("Spellchecker Behavior"),
00097 BarIcon("spellcheck", KIcon::SizeMedium) );
00098 _spellPage=new KPrConfigureSpellPage(parent, page);
00099
00100 page = addVBoxPage( i18n("Misc"), i18n("Misc"),
00101 BarIcon("misc", KIcon::SizeMedium) );
00102 _miscPage=new KPrConfigureMiscPage(parent, page);
00103
00104 page = addVBoxPage( i18n("Document"), i18n("Document Settings"),
00105 BarIcon("kpresenter_kpr", KIcon::SizeMedium) );
00106
00107 _defaultDocPage=new KPrConfigureDefaultDocPage(parent, page);
00108
00109 page = addVBoxPage( i18n("Tools"), i18n("Default Tools Settings"),
00110 BarIcon("configure", KIcon::SizeMedium) );
00111
00112 _toolsPage=new KPrConfigureToolsPage(parent, page);
00113
00114 page = addVBoxPage( i18n("Paths"), i18n("Path Settings"),
00115 BarIcon("path") );
00116
00117 m_pathPage=new KPrConfigurePathPage(parent, page);
00118
00119 if (KoSpeaker::isKttsdInstalled()) {
00120 page = addVBoxPage( i18n("Abbreviation for Text-to-Speech", "TTS"), i18n("Text-to-Speech Settings"),
00121 BarIcon("access", KIcon::SizeMedium) );
00122 m_ttsPage=new KPrConfigureTTSPage(parent, page);
00123 } else m_ttsPage = 0;
00124
00125 connect( this, SIGNAL( okClicked() ),this, SLOT( slotApply() ) );
00126 }
00127
00128 void KPrConfig::openPage(int flags)
00129 {
00130 if(flags & KP_INTERFACE)
00131 showPage( 0 );
00132 else if(flags & KP_COLOR)
00133 showPage(1 );
00134 else if(flags & KP_KSPELL)
00135 showPage(2);
00136 else if(flags & KP_MISC)
00137 showPage(3 );
00138 else if(flags & KP_DOC)
00139 showPage(4 );
00140 else if(flags & KP_TOOLS)
00141 showPage(5);
00142 else if(flags & KP_PATH)
00143 showPage(6);
00144 }
00145
00146 void KPrConfig::slotApply()
00147 {
00148 KMacroCommand *macro = 0L;
00149 _interfacePage->apply();
00150 _colorBackground->apply();
00151 if (_spellPage) _spellPage->apply();
00152 m_pathPage->apply();
00153 KCommand *cmd = _miscPage->apply();
00154 if ( cmd )
00155 {
00156 if ( !macro )
00157 macro = new KMacroCommand(i18n("Change Config") );
00158 macro->addCommand( cmd );
00159 }
00160 cmd = _defaultDocPage->apply();
00161 if ( cmd )
00162 {
00163 if ( !macro )
00164 macro = new KMacroCommand(i18n("Change Config") );
00165
00166 macro->addCommand( cmd );
00167 }
00168
00169 _toolsPage->apply();
00170 if (m_ttsPage) m_ttsPage->apply();
00171 if ( macro )
00172 m_doc->addCommand( macro);
00173 }
00174
00175 void KPrConfig::slotDefault()
00176 {
00177 switch( activePageIndex() ) {
00178 case 0:
00179 _interfacePage->slotDefault();
00180 break;
00181 case 1:
00182 _colorBackground->slotDefault();
00183 break;
00184 case 2:
00185 if (_spellPage) _spellPage->slotDefault();
00186 break;
00187 case 3:
00188 _miscPage->slotDefault();
00189 break;
00190 case 4:
00191 _defaultDocPage->slotDefault();
00192 break;
00193 case 5:
00194 _toolsPage->slotDefault();
00195 break;
00196 case 6:
00197 m_pathPage->slotDefault();
00198 break;
00199 case 7:
00200 m_ttsPage->slotDefault();
00201 default:
00202 break;
00203 }
00204 }
00205
00206 KPrConfigureInterfacePage::KPrConfigureInterfacePage( KPrView *_view, QWidget *parent , char *name )
00207 :QWidget ( parent,name )
00208 {
00209 QVBoxLayout *box = new QVBoxLayout( this, 0, 0 );
00210
00211 m_pView=_view;
00212 config = KPrFactory::global()->config();
00213
00214 KoUnit::Unit unit = m_pView->kPresenterDoc()->unit();
00215
00216 oldNbRecentFiles=10;
00217 double ptIndent = MM_TO_POINT(10.0);
00218 bool bShowRuler=true;
00219 bool oldShowStatusBar = true;
00220
00221 if( config->hasGroup("Interface") ) {
00222 config->setGroup( "Interface" );
00223 oldNbRecentFiles=config->readNumEntry("NbRecentFile",oldNbRecentFiles);
00224 ptIndent = config->readDoubleNumEntry("Indent", ptIndent);
00225 bShowRuler=config->readBoolEntry("Rulers",true);
00226 oldShowStatusBar = config->readBoolEntry( "ShowStatusBar" , true );
00227
00228 }
00229
00230 showRuler= new QCheckBox(i18n("Show rulers"),this);
00231 QWhatsThis::add(showRuler, i18n( "When checked, both vertical and horizontal rulers are shown on the KPresenter slide (this is the default). When unchecked, the rulers are not shown on any slide." ) );
00232 showRuler->setChecked(bShowRuler);
00233 box->addWidget(showRuler);
00234
00235 showStatusBar = new QCheckBox(i18n("Show status bar"),this);
00236 QWhatsThis::add(showStatusBar, i18n( "Toggle the statusbar, which is shown by default." ) );
00237 showStatusBar->setChecked(oldShowStatusBar);
00238 box->addWidget(showStatusBar);
00239
00240
00241 recentFiles=new KIntNumInput( oldNbRecentFiles, this);
00242 recentFiles->setRange(1, 20, 1);
00243 recentFiles->setLabel(i18n("Number of recent files:"));
00244 QWhatsThis::add(recentFiles, i18n( "Set the number of recent files which will be opened using the File->Open Recent menu. Default is to remember 10 filenames. The maximum you can set is 20 and the minimum is 1." ) );
00245
00246 box->addWidget(recentFiles);
00247
00248 QString suffix = KoUnit::unitName( unit ).prepend(' ');
00249 indent = new KDoubleNumInput( this );
00250 indent->setValue( KoUnit::toUserValue( ptIndent, unit ) );
00251 indent->setRange(KoUnit::toUserValue( 0.1, unit ), KoUnit::toUserValue( 50, unit ), KoUnit::toUserValue( 0.1, unit ));
00252
00253
00254 indent->setSuffix( suffix );
00255 indent->setLabel(i18n("Text indentation depth:"));
00256 QWhatsThis::add(indent, i18n( "This setting is used by Increase Depth and Decrease Depth menu items (in the Text menu) to change the indentation depth. The Default is 1 centimeter." ) );
00257
00258 box->addWidget(indent);
00259
00260 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00261 box->addItem( spacer);
00262 }
00263
00264 void KPrConfigureInterfacePage::apply()
00265 {
00266 bool ruler=showRuler->isChecked();
00267 bool statusBar=showStatusBar->isChecked();
00268
00269 KPrDocument * doc = m_pView->kPresenterDoc();
00270
00271 config->setGroup( "Interface" );
00272
00273 double newIndent = KoUnit::fromUserValue( indent->value(), doc->unit() );
00274 if( newIndent != doc->getIndentValue() )
00275 {
00276 config->writeEntry( "Indent", newIndent, true, false, 'g', DBL_DIG );
00277 doc->setIndentValue( newIndent );
00278 }
00279 int nbRecent=recentFiles->value();
00280 if(nbRecent!=oldNbRecentFiles)
00281 {
00282 config->writeEntry( "NbRecentFile", nbRecent);
00283 m_pView->changeNbOfRecentFiles(nbRecent);
00284 oldNbRecentFiles=nbRecent;
00285 }
00286 bool refreshGUI=false;
00287 if(ruler != doc->showRuler())
00288 {
00289 config->writeEntry( "Rulers", ruler );
00290 doc->setShowRuler( ruler );
00291 refreshGUI=true;
00292
00293 }
00294 if( statusBar != doc->showStatusBar() )
00295 {
00296 config->writeEntry( "ShowStatusBar", statusBar );
00297 doc->setShowStatusBar( statusBar );
00298 refreshGUI=true;
00299 }
00300
00301 if( refreshGUI )
00302 doc->reorganizeGUI();
00303
00304 }
00305
00306 void KPrConfigureInterfacePage::slotDefault()
00307 {
00308 double newIndent = KoUnit::toUserValue( MM_TO_POINT( 10 ), m_pView->kPresenterDoc()->unit() );
00309 indent->setValue( newIndent );
00310 recentFiles->setValue(10);
00311 showRuler->setChecked(true);
00312 showStatusBar->setChecked(true);
00313 }
00314
00315 KPrConfigureColorBackground::KPrConfigureColorBackground( KPrView* _view, QWidget *parent , char *name )
00316 :QWidget ( parent,name )
00317 {
00318 m_pView = _view;
00319 config = KPrFactory::global()->config();
00320
00321 oldBgColor = m_pView->kPresenterDoc()->txtBackCol();
00322 oldGridColor = m_pView->kPresenterDoc()->gridColor();
00323 QVBoxLayout *box = new QVBoxLayout( this, 0, 0 );
00324
00325 QLabel *lab = new QLabel( this, "label20" );
00326 lab->setText( i18n( "Background object color:" ) );
00327 QWhatsThis::add(lab, i18n( "Change the background color of the text box. The background is white by default. If you have a dark background color and you want to put some white text on it, you can change the color of the text box so that you can see what you are typing. When you have finished, the area around the text will revert to the background color. The Defaults button restores the original settings." ) );
00328 box->addWidget(lab);
00329
00330 bgColor = new KColorButton( oldBgColor,
00331 oldBgColor,
00332 this );
00333 bgColor->setColor( oldBgColor );
00334 box->addWidget(bgColor);
00335
00336
00337 lab = new QLabel( this, "label20" );
00338 lab->setText( i18n( "Grid color:" ) );
00339 QWhatsThis::add(lab, i18n( "Here you can change the grid color, which is black by default." ) );
00340 box->addWidget(lab);
00341
00342 gridColor = new KColorButton( oldGridColor,
00343 oldGridColor,
00344 this );
00345 box->addWidget(gridColor);
00346 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00347 box->addItem( spacer);
00348
00349 }
00350
00351 void KPrConfigureColorBackground::apply()
00352 {
00353 KPrDocument * doc = m_pView->kPresenterDoc();
00354 bool repaintNeeded = false;
00355 QColor _col = bgColor->color();
00356 if( oldBgColor != _col ) {
00357 config->setGroup( "KPresenter Color" );
00358 config->writeEntry( "BackgroundColor", _col );
00359 doc->setTxtBackCol( _col );
00360 doc->replaceObjs();
00361 oldBgColor=_col;
00362 repaintNeeded = true;
00363 }
00364 _col = gridColor->color();
00365 if( oldGridColor != _col ) {
00366 config->setGroup( "KPresenter Color" );
00367 config->writeEntry( "GridColor", _col );
00368 doc->repaint( false );
00369 doc->setGridColor( _col );
00370 oldGridColor=_col;
00371 repaintNeeded = true;
00372 }
00373 if (repaintNeeded)
00374 doc->repaint( false );
00375 }
00376
00377 void KPrConfigureColorBackground::slotDefault()
00378 {
00379 bgColor->setColor( Qt::white );
00380 gridColor->setColor( Qt::black );
00381 }
00382
00383
00384
00385 KPrConfigureSpellPage::KPrConfigureSpellPage( KPrView *_view, QWidget *parent, char *name )
00386 : QWidget( parent, name )
00387 {
00388 m_pView=_view;
00389 config = KPrFactory::global()->config();
00390 m_spellConfigWidget = new ConfigWidget( _view->broker(), parent );
00391 m_spellConfigWidget->setBackgroundCheckingButtonShown( true );
00392 }
00393
00394 void KPrConfigureSpellPage::apply()
00395 {
00396
00397 KPrDocument* doc = m_pView->kPresenterDoc();
00398 m_spellConfigWidget->save();
00399
00400
00401 m_pView->kPresenterDoc()->setSpellCheckIgnoreList(
00402 m_pView->broker()->settings()->currentIgnoreList() );
00403
00404 doc->enableBackgroundSpellCheck( m_pView->broker()->settings()->backgroundCheckerEnabled() );
00405 doc->reactivateBgSpellChecking();
00406 }
00407
00408 void KPrConfigureSpellPage::slotDefault()
00409 {
00410 m_spellConfigWidget->slotDefault();
00411 }
00412
00413 KPrConfigureMiscPage::KPrConfigureMiscPage( KPrView *_view, QWidget *parent, char *name )
00414 : QWidget( parent, name )
00415 {
00416 QVBoxLayout *box = new QVBoxLayout( this, 0, 0 );
00417
00418 m_pView=_view;
00419 config = KPrFactory::global()->config();
00420
00421 QGroupBox* tmpQGroupBox = new QGroupBox( 0, Qt::Vertical, i18n("Misc"), this, "GroupBox" );
00422 tmpQGroupBox->layout()->setSpacing(KDialog::spacingHint());
00423 tmpQGroupBox->layout()->setMargin(KDialog::marginHint());
00424 QGridLayout *grid = new QGridLayout( tmpQGroupBox->layout(), 8, 1 );
00425
00426 m_oldNbRedo=30;
00427 m_printNotes=true;
00428 if( config->hasGroup("Misc") )
00429 {
00430 config->setGroup( "Misc" );
00431 m_oldNbRedo=config->readNumEntry("UndoRedo",m_oldNbRedo);
00432 m_printNotes = config->readBoolEntry("PrintNotes", true);
00433 }
00434
00435 m_undoRedoLimit=new KIntNumInput( m_oldNbRedo, tmpQGroupBox );
00436 m_undoRedoLimit->setLabel(i18n("Undo/redo limit:"));
00437 m_undoRedoLimit->setRange(10, 60, 1);
00438 QWhatsThis::add(m_undoRedoLimit, i18n( "Set the number of actions you can undo and redo (how many actions KPresenter keeps in its Undo buffer). This ranges from a minimum of 10 to a maximum of 60 (the default is 30). Once the number of actions reaches the number set here, earlier actions will be forgotten." ) );
00439 grid->addWidget(m_undoRedoLimit,0,0);
00440
00441 KPrDocument* doc = m_pView->kPresenterDoc();
00442
00443 m_displayLink=new QCheckBox(i18n("Display links"),tmpQGroupBox);
00444 QWhatsThis::add(m_displayLink, i18n( "When you want to include a link in your slide, you can use the Insert->Link... menu, which allows you to insert URL, mail or file links. If the option Display links is checked, all links will be active and displayed in a different color (this is the default behavior). If the option is unchecked, the links will be inactive and the same color as the text. This affects both the edited slides and the slide show." ) );
00445 grid->addWidget(m_displayLink,3,0);
00446 m_displayLink->setChecked(doc->getVariableCollection()->variableSetting()->displayLink());
00447
00448 m_underlineLink=new QCheckBox(i18n("&Underline all links"),tmpQGroupBox);
00449 m_underlineLink->setChecked(doc->getVariableCollection()->variableSetting()->underlineLink());
00450 QWhatsThis::add(m_underlineLink, i18n( "If this is checked, all links will be underlined (this is the default). If it is not checked, the links will not be underlined." ) );
00451 grid->addWidget(m_underlineLink,4,0);
00452
00453
00454 m_displayComment=new QCheckBox(i18n("Display comments"),tmpQGroupBox);
00455 m_displayComment->setChecked(doc->getVariableCollection()->variableSetting()->displayComment());
00456 QWhatsThis::add(m_displayComment, i18n( "Comments are inserted in the text at the cursor using the Insert->Comment... menu. Comments can only be viewed in edit mode and not in the slide show. If this option is checked (default) then each comment will be shown as a small yellow rectangle. You can then right-click on them to edit them, remove them or copy the text." ) );
00457 grid->addWidget(m_displayComment,5,0);
00458
00459 m_displayFieldCode=new QCheckBox(i18n("Display field code"),tmpQGroupBox);
00460 m_displayFieldCode->setChecked(doc->getVariableCollection()->variableSetting()->displayFieldCode());
00461 QWhatsThis::add(m_displayFieldCode, i18n( "In editor mode (not in slide show) this option will display all the variable codes as well as Link at links location. This is very useful to see what variable is displayed. Variables are inserted using the Insert -> Variable menu." ) );
00462 grid->addWidget(m_displayFieldCode,6,0);
00463
00464 m_cbPrintNotes=new QCheckBox(i18n("Print slide notes"),tmpQGroupBox);
00465 m_cbPrintNotes->setChecked(m_printNotes);
00466 QWhatsThis::add(m_cbPrintNotes, i18n( "If checked, all notes will be printed on paper. The notes will all be printed separately on the last page, from the first slide to the last and finally the Master Page Note. You can see the notes for each slide using the View->Show notebar menu." ) );
00467 grid->addWidget(m_cbPrintNotes,7,0);
00468
00469 box->addWidget(tmpQGroupBox);
00470
00471 tmpQGroupBox = new QGroupBox( 0, Qt::Vertical, i18n("Grid"), this, "GroupBox" );
00472 tmpQGroupBox->layout()->setSpacing(KDialog::spacingHint());
00473 tmpQGroupBox->layout()->setMargin(KDialog::marginHint());
00474 grid = new QGridLayout( tmpQGroupBox->layout(), 8, 1 );
00475
00476 KoRect rect = doc->masterPage()->getPageRect();
00477 QLabel *lab=new QLabel(i18n("Horizontal grid size:"), tmpQGroupBox);
00478 QWhatsThis::add(lab, i18n( "Set the space in millimeters between two horizontal points on the grid. Default is 5 millimeters." ) );
00479 grid->addWidget(lab,0,0);
00480 KoUnit::Unit unit = doc->unit();
00481 resolutionX = new KoUnitDoubleSpinBox(tmpQGroupBox, 5.0,rect.width(),1,doc->getGridX() );
00482 resolutionX->setUnit( unit );
00483
00484 grid->addWidget(resolutionX,1,0);
00485
00486 lab=new QLabel(i18n("Vertical grid size:"), tmpQGroupBox);
00487 QWhatsThis::add(lab, i18n( "Set the space in millimeters between two vertical points on the grid. Default is 5 millimeters." ) );
00488 grid->addWidget(lab,2,0);
00489
00490 resolutionY = new KoUnitDoubleSpinBox(tmpQGroupBox, 5.0,rect.height(),1,doc->getGridY() );
00491 resolutionY->setUnit( unit );
00492
00493 grid->addWidget(resolutionY, 3, 0);
00494 box->addWidget(tmpQGroupBox);
00495
00496 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00497 box->addItem( spacer);
00498
00499
00500 }
00501
00502 KCommand * KPrConfigureMiscPage::apply()
00503 {
00504 config->setGroup( "Misc" );
00505 int newUndo=m_undoRedoLimit->value();
00506 KPrDocument* doc = m_pView->kPresenterDoc();
00507 if(newUndo!=m_oldNbRedo)
00508 {
00509 config->writeEntry("UndoRedo",newUndo);
00510 doc->setUndoRedoLimit(newUndo);
00511 m_oldNbRedo=newUndo;
00512 }
00513 config->writeEntry("PrintNotes", m_cbPrintNotes->isChecked());
00514
00515 KMacroCommand * macroCmd=0L;
00516 bool b=m_displayLink->isChecked();
00517 bool b_new=doc->getVariableCollection()->variableSetting()->displayLink();
00518 if(b_new!=b)
00519 {
00520 if(!macroCmd)
00521 macroCmd=new KMacroCommand(i18n("Change Display Link Command"));
00522
00523 KPrChangeVariableSettingsCommand *cmd=new KPrChangeVariableSettingsCommand(
00524 i18n("Change Display Link Command"), doc, b_new, b, KPrChangeVariableSettingsCommand::VS_DISPLAYLINK);
00525 cmd->execute();
00526 macroCmd->addCommand(cmd);
00527 }
00528
00529 b=m_underlineLink->isChecked();
00530 if(doc->getVariableCollection()->variableSetting()->underlineLink()!=b)
00531 {
00532 if(!macroCmd)
00533 macroCmd=new KMacroCommand(i18n("Change Display Link Command"));
00534
00535 KPrChangeVariableSettingsCommand *cmd=new KPrChangeVariableSettingsCommand(
00536 i18n("Change Display Link Command"), doc, doc->getVariableCollection()->variableSetting()->underlineLink(),
00537 b, KPrChangeVariableSettingsCommand::VS_UNDERLINELINK);
00538 cmd->execute();
00539 macroCmd->addCommand(cmd);
00540 }
00541
00542 b=m_displayComment->isChecked();
00543 if(doc->getVariableCollection()->variableSetting()->displayComment()!=b)
00544 {
00545 if(!macroCmd)
00546 macroCmd=new KMacroCommand(i18n("Change Display Link Command"));
00547
00548 KPrChangeVariableSettingsCommand *cmd=new KPrChangeVariableSettingsCommand(
00549 i18n("Change Display Link Command"), doc, doc->getVariableCollection()->variableSetting()->displayComment(),
00550 b, KPrChangeVariableSettingsCommand::VS_DISPLAYCOMMENT);
00551 cmd->execute();
00552 macroCmd->addCommand(cmd);
00553 }
00554
00555 b=m_displayFieldCode->isChecked();
00556 if(doc->getVariableCollection()->variableSetting()->displayFieldCode()!=b)
00557 {
00558 if(!macroCmd)
00559 macroCmd=new KMacroCommand(i18n("Change Display Field Code Command"));
00560
00561 KPrChangeVariableSettingsCommand *cmd=new KPrChangeVariableSettingsCommand(
00562 i18n("Change Display Field Code Command"), doc, doc->getVariableCollection()->variableSetting()->displayComment(),
00563 b, KPrChangeVariableSettingsCommand::VS_DISPLAYFIELDCODE);
00564 cmd->execute();
00565 macroCmd->addCommand(cmd);
00566 }
00567
00568 doc->setGridValue( resolutionX->value(),
00569 resolutionY->value(), true);
00570 doc->repaint( false );
00571
00572 config->sync();
00573
00574 return macroCmd;
00575 }
00576
00577 void KPrConfigureMiscPage::slotDefault()
00578 {
00579 m_undoRedoLimit->setValue(30);
00580 m_displayLink->setChecked(true);
00581 m_displayComment->setChecked(true);
00582 m_underlineLink->setChecked(true);
00583 m_displayFieldCode->setChecked( false );
00584 m_cbPrintNotes->setChecked(true);
00585
00586
00587 resolutionY->setValue( MM_TO_POINT( 5.0 ));
00588 resolutionX->setValue( MM_TO_POINT( 5.0 ));
00589 }
00590
00591 KPrConfigureDefaultDocPage::KPrConfigureDefaultDocPage(KPrView *_view, QWidget *parent, char *name )
00592 : QWidget( parent, name )
00593 {
00594 QVBoxLayout *box = new QVBoxLayout( this, 0, 0 );
00595
00596 m_pView=_view;
00597 config = KPrFactory::global()->config();
00598 KPrDocument *doc = m_pView->kPresenterDoc();
00599 oldAutoSaveValue = doc->defaultAutoSave()/60;
00600 m_oldBackupFile = true;
00601 m_oldLanguage = doc->globalLanguage();
00602 m_oldHyphenation = doc->globalHyphenation();
00603 if( config->hasGroup("Interface") ) {
00604 config->setGroup( "Interface" );
00605 oldAutoSaveValue = config->readNumEntry( "AutoSave", oldAutoSaveValue );
00606 m_oldBackupFile=config->readBoolEntry("BackupFile",m_oldBackupFile);
00607 m_oldLanguage = config->readEntry( "language", m_oldLanguage );
00608 m_oldHyphenation = config->readBoolEntry( "hyphenation", m_oldHyphenation);
00609 }
00610
00611 QVGroupBox* gbDocumentDefaults = new QVGroupBox( i18n("Document Defaults"), this, "GroupBox" );
00612 gbDocumentDefaults->setMargin( KDialog::marginHint() );
00613 gbDocumentDefaults->setInsideSpacing( 5 );
00614
00615 QWidget *fontContainer = new QWidget(gbDocumentDefaults);
00616 QGridLayout * fontLayout = new QGridLayout(fontContainer, 1, 3);
00617
00618 fontLayout->setColStretch(0, 0);
00619 fontLayout->setColStretch(1, 1);
00620 fontLayout->setColStretch(2, 0);
00621
00622 QLabel *fontTitle = new QLabel(i18n("Default font:"), fontContainer);
00623
00624 font= new QFont( doc->defaultFont() );
00625
00626 QString labelName = font->family() + ' ' + QString::number(font->pointSize());
00627 fontName = new QLabel(labelName, fontContainer);
00628 fontName->setFont(*font);
00629 fontName->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
00630
00631 QPushButton *chooseButton = new QPushButton(i18n("Choose..."), fontContainer);
00632 QWhatsThis::add(chooseButton, i18n( "Click here if you want to set a new font. The KDE default Select Font dialog will then be displayed." ) );
00633 connect(chooseButton, SIGNAL(clicked()), this, SLOT(selectNewDefaultFont()));
00634
00635 fontLayout->addWidget(fontTitle, 0, 0);
00636 fontLayout->addWidget(fontName, 0, 1);
00637 fontLayout->addWidget(chooseButton, 0, 2);
00638
00639 QWidget *languageContainer = new QWidget(gbDocumentDefaults);
00640 QGridLayout * languageLayout = new QGridLayout(languageContainer, 1, 3);
00641
00642 languageLayout->setColStretch(0, 0);
00643 languageLayout->setColStretch(1, 1);
00644
00645 QLabel *languageTitle = new QLabel(i18n("Global language:"), languageContainer);
00646 QWhatsThis::add(languageTitle, i18n( "Use this drop down box to determine the default language for the document. This setting is used by the hyphenation and spelling tools." ) );
00647
00648 m_globalLanguage = new QComboBox( languageContainer );
00649 m_globalLanguage->insertStringList( KoGlobal::listOfLanguages() );
00650 m_globalLanguage->setCurrentText( KoGlobal::languageFromTag( doc->globalLanguage() ) );
00651
00652 languageLayout->addWidget(languageTitle, 0, 0);
00653 languageLayout->addWidget(m_globalLanguage, 0, 1);
00654
00655 m_autoHyphenation = new QCheckBox( i18n("Automatic hyphenation"), gbDocumentDefaults);
00656 QWhatsThis::add(m_autoHyphenation, i18n( "Check this box if you want KPresenter to automatically hyphenate long words when it determines the word wrap in text frames. This is not set by default." ) );
00657 m_autoHyphenation->setChecked( m_oldHyphenation );
00658
00659 box->addWidget(gbDocumentDefaults);
00660
00661 QVGroupBox* gbDocumentSettings = new QVGroupBox( i18n("Document Settings"), this );
00662 gbDocumentSettings->setMargin( KDialog::marginHint() );
00663 gbDocumentSettings->setInsideSpacing( KDialog::spacingHint() );
00664
00665 m_createBackupFile = new QCheckBox( i18n("Create backup file"), gbDocumentSettings);
00666 QWhatsThis::add(m_createBackupFile, i18n( "If checked, this will create a .<name>.kpr.autosave.kpr in the folder where your file is. This backup file can then be used in case of a problem.\nThe backup file is updated every time you save your document or every time there is an autosave." ) );
00667 m_createBackupFile->setChecked( m_oldBackupFile );
00668
00669
00670 autoSave = new KIntNumInput( oldAutoSaveValue, gbDocumentSettings );
00671 autoSave->setRange( 0, 60, 1 );
00672 autoSave->setLabel( i18n("Autosave (min):") );
00673 autoSave->setSpecialValueText( i18n("No autosave") );
00674 autoSave->setSuffix( i18n("min") );
00675 QWhatsThis::add(autoSave, i18n( "You can use this to adjust how often KPresenter saves a temporary file. If you set this value to No autosave, KPresenter will not autosave. You can adjust the autosave from 1 to 60 minutes." ) );
00676
00677 new QLabel(i18n("Starting page number:"), gbDocumentSettings);
00678 m_oldStartingPage=doc->getVariableCollection()->variableSetting()->startingPageNumber();
00679 m_variableNumberOffset=new KIntNumInput(gbDocumentSettings);
00680 m_variableNumberOffset->setRange(1, 9999, 1, false);
00681 m_variableNumberOffset->setValue(m_oldStartingPage);
00682 QWhatsThis::add(m_variableNumberOffset, i18n( "Here you can change the number for the first page. It is set to 1 by default.\nTip: this is helpful if you have split a single document into multiple files." ) );
00683
00684 new QLabel(i18n("Tab stop:"), gbDocumentSettings);
00685 m_oldTabStopWidth = doc->tabStopValue();
00686 KoRect rect = doc->masterPage()->getPageRect();
00687 m_tabStopWidth = new KoUnitDoubleSpinBox( gbDocumentSettings , MM_TO_POINT(2), rect.width() ,0.1, m_oldTabStopWidth );
00688
00689 m_tabStopWidth->setUnit( doc->unit() );
00690
00691 QWhatsThis::add(m_tabStopWidth, i18n( "Each KPresenter document has a default set of tab stops. If you add tab stops to your document, the newly added tab stops override the default ones. You can use this text box to define the spacing between default tab stops. As an example, if you enter 1.5 in this text box, and the unit of measurement is in centimeters, the first default tab stop will be located 1.5 cm to the right of the frame's left-hand margin. The second default tab stop will be located at 3 cm from the left-hand margin, and so on." ) );
00692
00693 box->addWidget(gbDocumentSettings);
00694 QVGroupBox* gbDocumentCursor = new QVGroupBox( i18n("Cursor"), this );
00695 gbDocumentCursor->setMargin( KDialog::marginHint() );
00696 gbDocumentCursor->setInsideSpacing( KDialog::spacingHint() );
00697
00698 m_cursorInProtectedArea= new QCheckBox(i18n("Cursor in protected area"),gbDocumentCursor);
00699 m_cursorInProtectedArea->setChecked(doc->cursorInProtectedArea());
00700 QWhatsThis::add(m_cursorInProtectedArea, i18n( "When this box is checked and you click in a protected frame within your document, a cursor will appear. When this box is unchecked, and you click in a protected frame, no cursor will be visible." ) );
00701
00702 m_directInsertCursor= new QCheckBox(i18n("Direct insert cursor"),gbDocumentCursor);
00703 m_directInsertCursor->setChecked(doc->insertDirectCursor());
00704 QWhatsThis::add(m_directInsertCursor, i18n( "When this box is checked, you can select a section of text using your mouse. Move the mouse to a new area in your document and click once with the middle mouse button and a copy of the selected text will be copied and pasted to the new location in the document.\nWhen this box is unchecked, in order to copy text from one section to another, you must select the text, manually copy the text to the clipboard, then manually paste the text in the new location." ) );
00705 box->addWidget(gbDocumentCursor);
00706
00707 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
00708 box->addItem(spacer);
00709
00710 }
00711
00712 KPrConfigureDefaultDocPage::~KPrConfigureDefaultDocPage()
00713 {
00714 delete font;
00715 }
00716
00717 KCommand *KPrConfigureDefaultDocPage::apply()
00718 {
00719 config->setGroup( "Document defaults" );
00720 KPrDocument* doc = m_pView->kPresenterDoc();
00721 config->writeEntry("DefaultFont",font->toString());
00722
00723 config->setGroup( "Interface" );
00724 int autoSaveVal = autoSave->value();
00725 if( autoSaveVal != oldAutoSaveValue ) {
00726 config->writeEntry( "AutoSave", autoSaveVal );
00727 m_pView->kPresenterDoc()->setAutoSave( autoSaveVal*60 );
00728 oldAutoSaveValue=autoSaveVal;
00729 }
00730 bool state =m_createBackupFile->isChecked();
00731
00732 if(state!=m_oldBackupFile)
00733 {
00734 config->writeEntry( "BackupFile", state );
00735 doc->setBackupFile( state);
00736 m_oldBackupFile=state;
00737 }
00738
00739 state = m_cursorInProtectedArea->isChecked();
00740 if ( state != doc->cursorInProtectedArea() )
00741 {
00742 config->writeEntry( "cursorInProtectArea", state );
00743 m_pView->kPresenterDoc()->setCursorInProtectedArea( state );
00744 }
00745
00746 state = m_directInsertCursor->isChecked();
00747 if ( state != doc->insertDirectCursor() )
00748 doc->setInsertDirectCursor( state );
00749
00750
00751
00752 const QString lang = KoGlobal::tagOfLanguage( m_globalLanguage->currentText() );
00753 config->writeEntry( "language" , lang);
00754 m_oldLanguage = lang;
00755
00756
00757
00758
00759
00760 state = m_autoHyphenation->isChecked();
00761 config->writeEntry( "hyphenation", state );
00762 m_oldHyphenation = state;
00763
00764 KMacroCommand *macro = 0L;
00765 int newStartingPage=m_variableNumberOffset->value();
00766 if(newStartingPage!=m_oldStartingPage)
00767 {
00768 macro = new KMacroCommand( i18n("Change Starting Page Number") );
00769 KPrChangeStartingPageCommand *cmd = new KPrChangeStartingPageCommand( i18n("Change Starting Page Number"), doc, m_oldStartingPage,newStartingPage );
00770 cmd->execute();
00771 macro->addCommand( cmd);
00772 m_oldStartingPage=newStartingPage;
00773 }
00774 double newTabStop = m_tabStopWidth->value();
00775 if ( newTabStop != m_oldTabStopWidth)
00776 {
00777 if ( !macro )
00778 macro = new KMacroCommand( i18n("Change Tab Stop Value") );
00779 KPrChangeTabStopValueCommand *cmd = new KPrChangeTabStopValueCommand( i18n("Change Tab Stop Value"), m_oldTabStopWidth, newTabStop, doc);
00780 cmd->execute();
00781 macro->addCommand( cmd );
00782 m_oldTabStopWidth = newTabStop;
00783 }
00784 return macro;
00785 }
00786
00787 void KPrConfigureDefaultDocPage::slotDefault()
00788 {
00789 autoSave->setValue( m_pView->kPresenterDoc()->defaultAutoSave()/60 );
00790 m_variableNumberOffset->setValue(1);
00791 m_cursorInProtectedArea->setChecked(true);
00792 m_tabStopWidth->setValue( MM_TO_POINT(15));
00793 m_createBackupFile->setChecked( true );
00794 m_directInsertCursor->setChecked( false );
00795 m_globalLanguage->setCurrentText( KoGlobal::languageFromTag( KGlobal::locale()->language() ) );
00796 m_autoHyphenation->setChecked( false );
00797 }
00798
00799 void KPrConfigureDefaultDocPage::selectNewDefaultFont() {
00800 QStringList list;
00801 KFontChooser::getFontList(list, KFontChooser::SmoothScalableFonts);
00802 KFontDialog dlg( this, "Font Selector", false, true, list, true );
00803 dlg.setFont(*font);
00804 int result = dlg.exec();
00805 if (KDialog::Accepted == result) {
00806 delete font;
00807 font = new QFont(dlg.font());
00808 fontName->setText(font->family() + ' ' + QString::number(font->pointSize()));
00809 fontName->setFont(*font);
00810 m_pView->kPresenterDoc()->setDefaultFont( *font );
00811 }
00812 }
00813
00814 KPrConfigureToolsPage::KPrConfigureToolsPage( KPrView *_view, QWidget *parent, char *name )
00815 : QWidget( parent, name )
00816 {
00817 QVBoxLayout *box = new QVBoxLayout( this, 0, 0 );
00818
00819 m_pView = _view;
00820 config = KPrFactory::global()->config();
00821 m_pView->getCanvas()->deSelectAllObj();
00822
00823 QTabWidget *tab = new QTabWidget(this);
00824
00825 KoPenCmd::Pen pen( m_pView->getPen(), m_pView->getLineBegin(), m_pView->getLineEnd() );
00826 m_confPenDia = new KPrPenStyleWidget(tab, 0, pen, true );
00827 tab->addTab( m_confPenDia, i18n( "Outl&ine" ) );
00828
00829 KPrBrushCmd::Brush brush( m_pView->getBrush(),
00830 m_pView->getGColor1(),
00831 m_pView->getGColor2(),
00832 m_pView->getGType(),
00833 m_pView->getFillType(),
00834 m_pView->getGUnbalanced(),
00835 m_pView->getGXFactor(),
00836 m_pView->getGYFactor() );
00837 m_brushProperty = new KPrBrushProperty( this, 0, brush );
00838 tab->addTab( m_brushProperty, i18n( "&Fill" ) );
00839
00840 KPrRectValueCmd::RectValues rectValues;
00841 rectValues.xRnd = m_pView->getRndX();
00842 rectValues.yRnd = m_pView->getRndY();
00843 m_rectProperty = new KPrRectProperty( this, 0, rectValues );
00844 tab->addTab( m_rectProperty, i18n( "&Rectangle" ) );
00845
00846 KPrPolygonSettingCmd::PolygonSettings polygonSettings;
00847 polygonSettings.checkConcavePolygon = m_pView->getCheckConcavePolygon();
00848 polygonSettings.cornersValue = m_pView->getCornersValue();
00849 polygonSettings.sharpnessValue = m_pView->getSharpnessValue();
00850 m_polygonProperty = new KPrPolygonProperty( this, 0, polygonSettings );
00851 tab->addTab( m_polygonProperty, i18n( "Polygo&n" ) );
00852
00853 KPrPieValueCmd::PieValues pieValues;
00854 pieValues.pieType = m_pView->getPieType();
00855 pieValues.pieAngle = m_pView->getPieAngle();
00856 pieValues.pieLength = m_pView->getPieLength();
00857 m_pieProperty = new KPrPieProperty( this, 0, pieValues );
00858 tab->addTab( m_pieProperty, i18n( "&Pie" ) );
00859
00860 box->addWidget(tab);
00861 }
00862
00863 KPrConfigureToolsPage::~KPrConfigureToolsPage()
00864 {
00865 }
00866
00867 void KPrConfigureToolsPage::apply()
00868 {
00869 KoPenCmd::Pen pen = m_confPenDia->getPen();
00870 m_pView->setPen( pen.pen );
00871 m_pView->setLineBegin( pen.lineBegin );
00872 m_pView->setLineEnd( pen.lineEnd );
00873 m_pView->getActionPenColor()->setCurrentColor( pen.pen.color() );
00874
00875 KPrBrushCmd::Brush brush = m_brushProperty->getBrush();
00876 m_pView->setBrush( brush.brush );
00877 m_pView->setFillType( brush.fillType );
00878 m_pView->setGColor1( brush.gColor1 );
00879 m_pView->setGColor2( brush.gColor2 );
00880 m_pView->setGType( brush.gType );
00881 m_pView->setGUnbalanced( brush.unbalanced );
00882 m_pView->setGXFactor( brush.xfactor );
00883 m_pView->setGYFactor( brush.yfactor );
00884 m_pView->getActionBrushColor()->setCurrentColor( brush.brush.color() );
00885
00886 KPrRectValueCmd::RectValues rectValues = m_rectProperty->getRectValues();
00887 m_pView->setRndX( rectValues.xRnd );
00888 m_pView->setRndY( rectValues.yRnd );
00889
00890 KPrPolygonSettingCmd::PolygonSettings polygonSettings = m_polygonProperty->getPolygonSettings();
00891 m_pView->setCheckConcavePolygon( polygonSettings.checkConcavePolygon );
00892 m_pView->setCornersValue( polygonSettings.cornersValue );
00893 m_pView->setSharpnessValue( polygonSettings.sharpnessValue );
00894
00895 KPrPieValueCmd::PieValues pieValues = m_pieProperty->getPieValues();
00896 m_pView->setPieType( pieValues.pieType );
00897 m_pView->setPieAngle( pieValues.pieAngle );
00898 m_pView->setPieLength( pieValues.pieLength );
00899
00900
00901
00902
00903 }
00904
00905 void KPrConfigureToolsPage::slotDefault()
00906 {
00907 KoPenCmd::Pen pen( KoPen(black, 1.0, SolidLine), L_NORMAL, L_NORMAL );
00908 m_confPenDia->setPen( pen );
00909 m_pView->getActionPenColor()->setCurrentColor( pen.pen.color() );
00910
00911 KPrBrushCmd::Brush brush( QBrush( white, SolidPattern ), red, green,
00912 BCT_GHORZ, FT_BRUSH, false, 100, 100 );
00913 m_brushProperty->setBrush( brush );
00914 m_pView->getActionBrushColor()->setCurrentColor( brush.brush.color() );
00915
00916 KPrRectValueCmd::RectValues rectValues;
00917 rectValues.xRnd = 0;
00918 rectValues.yRnd = 0;
00919 m_rectProperty->setRectValues( rectValues );
00920
00921 KPrPolygonSettingCmd::PolygonSettings polygonSettings;
00922 polygonSettings.checkConcavePolygon = false;
00923 polygonSettings.cornersValue = 3;
00924 polygonSettings.sharpnessValue = 0;
00925 m_polygonProperty->setPolygonSettings( polygonSettings );
00926
00927 KPrPieValueCmd::PieValues pieValues;
00928 pieValues.pieType = PT_PIE;
00929 pieValues.pieAngle = 45 * 16;
00930 pieValues.pieLength = 270 * 16;
00931 }
00932
00933 KPrConfigurePathPage::KPrConfigurePathPage( KPrView *_view, QWidget *parent, char *name )
00934 : QWidget( parent, name )
00935 {
00936 QVBoxLayout *box = new QVBoxLayout( this, 0, 0 );
00937
00938 m_pView=_view;
00939 KPrDocument* doc = m_pView->kPresenterDoc();
00940 config = KPrFactory::global()->config();
00941
00942 m_pPathView = new KListView( this );
00943 m_pPathView->setResizeMode(QListView::NoColumn);
00944 m_pPathView->addColumn( i18n( "Type" ) );
00945 m_pPathView->addColumn( i18n( "Path" ) );
00946 (void) new QListViewItem( m_pPathView, i18n("Picture Path"),doc->picturePath() );
00947 (void) new QListViewItem( m_pPathView, i18n("Backup Path"),doc->backupPath() );
00948 QWhatsThis::add(m_pPathView, i18n( "There are two paths that are set here: the Backup Path and the Picture Path. The Backup path is the folder where your backup files are saved and the Picture Path is the folder where your pictures are saved." ) );
00949 box->addWidget(m_pPathView);
00950
00951 m_modifyPath = new QPushButton( i18n("Modify Path..."), this);
00952 connect( m_modifyPath, SIGNAL( clicked ()), this, SLOT( slotModifyPath()));
00953 connect( m_pPathView, SIGNAL( doubleClicked (QListViewItem *, const QPoint &, int )),
00954 this, SLOT( slotModifyPath()));
00955 connect( m_pPathView, SIGNAL( selectionChanged ( QListViewItem * )),
00956 this, SLOT( slotSelectionChanged(QListViewItem * )));
00957 slotSelectionChanged(m_pPathView->currentItem());
00958 QWhatsThis::add(m_modifyPath, i18n( "When you click this button, a small dialog will appear and, if Default path is unchecked, you can either enter a path yourself or choose one using the standard KDE file dialog." ) );
00959 box->addWidget(m_modifyPath);
00960
00961 }
00962
00963 void KPrConfigurePathPage::slotSelectionChanged(QListViewItem * item)
00964 {
00965 m_modifyPath->setEnabled( item );
00966 }
00967
00968 void KPrConfigurePathPage::slotModifyPath()
00969 {
00970 QListViewItem *item = m_pPathView->currentItem ();
00971 if ( item )
00972 {
00973 if ( item->text(0)==i18n("Picture Path"))
00974 {
00975 KURLRequesterDlg * dlg = new KURLRequesterDlg( item->text(1), 0L,
00976 "picture path dlg");
00977 dlg->fileDialog()->setMode(KFile::Directory | KFile::LocalOnly);
00978 if ( dlg->exec() )
00979 item->setText( 1, dlg->selectedURL().path());
00980 delete dlg;
00981 }
00982 else if ( item->text(0)==i18n("Backup Path"))
00983 {
00984 KoChangePathDia *dlg = new KoChangePathDia( item->text(1), 0L,
00985 "backup path" );
00986 if (dlg->exec() )
00987 item->setText(1, dlg->newPath());
00988 delete dlg;
00989 }
00990 }
00991 }
00992
00993 void KPrConfigurePathPage::slotDefault()
00994 {
00995 QListViewItem * item = m_pPathView->findItem(i18n("Picture Path"), 0);
00996 if ( item )
00997 item->setText(1, KGlobalSettings::documentPath());
00998 item = m_pPathView->findItem(i18n("Backup Path"), 0);
00999 if ( item )
01000 item->setText(1, QString::null );
01001 }
01002
01003 void KPrConfigurePathPage::apply()
01004 {
01005 QListViewItem *item = m_pPathView->findItem(i18n("Backup Path"), 0);
01006 if ( item )
01007 {
01008 QString res = item->text(1 );
01009 if ( res != m_pView->kPresenterDoc()->backupPath())
01010 {
01011 config->setGroup( "Kpresenter Path" );
01012 m_pView->kPresenterDoc()->setBackupPath( res );
01013 #if KDE_IS_VERSION(3,1,3)
01014 config->writePathEntry( "backup path",res );
01015 #else
01016 config->writeEntry( "backup path",res );
01017 #endif
01018 }
01019 }
01020 item = m_pPathView->findItem(i18n("Picture Path"), 0);
01021 if ( item )
01022 {
01023 QString res = item->text(1 );
01024 if ( res != m_pView->kPresenterDoc()->picturePath())
01025 {
01026 config->setGroup( "Kpresenter Path" );
01027 m_pView->kPresenterDoc()->setPicturePath( res );
01028 #if KDE_IS_VERSION(3,1,3)
01029 config->writePathEntry( "picture path",res );
01030 #else
01031 config->writeEntry( "picture path",res );
01032 #endif
01033 }
01034 }
01035 }
01036
01038
01039 KPrConfigureTTSPage::KPrConfigureTTSPage( KPrView *_view, QWidget *parent, char *name )
01040 : QWidget( parent, name )
01041 {
01042 Q_UNUSED(_view);
01043
01044 QVBoxLayout *box = new QVBoxLayout( this, 0, 0 );
01045
01046 m_cbSpeakPointerWidget = new QCheckBox(i18n("Speak widget under &mouse pointer"), this);
01047 m_cbSpeakFocusWidget = new QCheckBox(i18n("Speak widget with &focus"), this);
01048 m_gbScreenReaderOptions = new QVGroupBox("", this);
01049 box->add(m_cbSpeakPointerWidget);
01050 box->add(m_cbSpeakFocusWidget);
01051 box->add(m_gbScreenReaderOptions);
01052 m_gbScreenReaderOptions->setMargin( KDialog::marginHint() );
01053 m_gbScreenReaderOptions->setInsideSpacing( KDialog::spacingHint() );
01054 m_cbSpeakTooltips = new QCheckBox(i18n("Speak &tool tips"), m_gbScreenReaderOptions);
01055 m_cbSpeakWhatsThis = new QCheckBox(i18n("Speak &What's This?"), m_gbScreenReaderOptions);
01056 m_cbSpeakDisabled = new QCheckBox(i18n("Verbal indication if widget is disabled (grayed)",
01057 "&Say whether disabled"), m_gbScreenReaderOptions);
01058 m_cbSpeakAccelerators = new QCheckBox(i18n("Spea&k accelerators"), m_gbScreenReaderOptions);
01059 QHBox* hbAcceleratorPrefix = new QHBox(m_gbScreenReaderOptions);
01060 QWidget* spacer = new QWidget(hbAcceleratorPrefix);
01061 spacer->setMinimumWidth(2 * KDialog::marginHint());
01062 m_lblAcceleratorPrefix =
01063 new QLabel(i18n("A word spoken before another word", "Pr&efaced by the word:"),
01064 hbAcceleratorPrefix);
01065 m_leAcceleratorPrefixWord = new QLineEdit(i18n("Keyboard accelerator, such as Alt+F", "Accelerator"),
01066 hbAcceleratorPrefix);
01067 m_lblAcceleratorPrefix->setBuddy(m_leAcceleratorPrefixWord);
01068 QHBox* hbPollingInterval = new QHBox(m_gbScreenReaderOptions);
01069 hbPollingInterval->setMargin( 0 );
01070 QLabel* lblPollingInterval = new QLabel(i18n("&Polling interval:"), hbPollingInterval);
01071 m_iniPollingInterval = new KIntNumInput(hbPollingInterval);
01072 m_iniPollingInterval->setSuffix(" ms");
01073 m_iniPollingInterval->setRange(100, 5000, 100, true);
01074 lblPollingInterval->setBuddy(m_iniPollingInterval);
01075
01076 config = KPrFactory::global()->config();
01077 config->setGroup("TTS");
01078 m_cbSpeakPointerWidget->setChecked(config->readBoolEntry("SpeakPointerWidget", false));
01079 m_cbSpeakFocusWidget->setChecked(config->readBoolEntry("SpeakFocusWidget", false));
01080 m_cbSpeakTooltips->setChecked(config->readBoolEntry("SpeakTooltips", true));
01081 m_cbSpeakWhatsThis->setChecked(config->readBoolEntry("SpeakWhatsThis", false));
01082 m_cbSpeakDisabled->setChecked(config->readBoolEntry("SpeakDisabled", true));
01083 m_cbSpeakAccelerators->setChecked(config->readBoolEntry("SpeakAccelerators", true));
01084 m_leAcceleratorPrefixWord->setText(config->readEntry("AcceleratorPrefixWord",
01085 i18n("Keyboard accelerator, such as Alt+F", "Accelerator")));
01086 m_iniPollingInterval->setValue(config->readNumEntry("PollingInterval", 600));
01087
01088 screenReaderOptionChanged();
01089 connect(m_cbSpeakPointerWidget, SIGNAL(toggled(bool)), this, SLOT(screenReaderOptionChanged()));
01090 connect(m_cbSpeakFocusWidget, SIGNAL(toggled(bool)), this, SLOT(screenReaderOptionChanged()));
01091 connect(m_cbSpeakAccelerators, SIGNAL(toggled(bool)), this, SLOT(screenReaderOptionChanged()));
01092 }
01093
01094 void KPrConfigureTTSPage::slotDefault()
01095 {
01096 m_cbSpeakPointerWidget->setChecked(false);
01097 m_cbSpeakFocusWidget->setChecked(false);
01098 m_cbSpeakTooltips->setChecked(true);
01099 m_cbSpeakWhatsThis->setChecked(false);
01100 m_cbSpeakDisabled->setChecked(true);
01101 m_cbSpeakAccelerators->setChecked(true);
01102 m_leAcceleratorPrefixWord->setText(i18n("Keyboard accelerator, such as Alt+F", "Accelerator"));
01103 m_iniPollingInterval->setValue(600);
01104 }
01105
01106 void KPrConfigureTTSPage::apply()
01107 {
01108 config->setGroup("TTS");
01109 config->writeEntry("SpeakPointerWidget", m_cbSpeakPointerWidget->isChecked());
01110 config->writeEntry("SpeakFocusWidget", m_cbSpeakFocusWidget->isChecked());
01111 config->writeEntry("SpeakTooltips", m_cbSpeakTooltips->isChecked());
01112 config->writeEntry("SpeakWhatsThis", m_cbSpeakWhatsThis->isChecked());
01113 config->writeEntry("SpeakDisabled", m_cbSpeakDisabled->isChecked());
01114 config->writeEntry("SpeakAccelerators", m_cbSpeakAccelerators->isChecked());
01115 config->writeEntry("AcceleratorPrefixWord", m_leAcceleratorPrefixWord->text());
01116 config->writeEntry("PollingInterval", m_iniPollingInterval->value());
01117 if (kospeaker) kospeaker->readConfig(config);
01118 }
01119
01120 void KPrConfigureTTSPage::screenReaderOptionChanged()
01121 {
01122 m_gbScreenReaderOptions->setEnabled(
01123 m_cbSpeakPointerWidget->isChecked() | m_cbSpeakFocusWidget->isChecked());
01124 m_leAcceleratorPrefixWord->setEnabled(m_cbSpeakAccelerators->isChecked());
01125 m_lblAcceleratorPrefix->setEnabled(m_cbSpeakAccelerators->isChecked());
01126 }
01127
01128 #include "KPrConfig.moc"