00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "ToolbarPrefs.h"
00010
00011 #include <qcheckbox.h>
00012 #include <qlabel.h>
00013 #include <qpushbutton.h>
00014 #include <qspinbox.h>
00015 #include <qlayout.h>
00016 #include <qvariant.h>
00017 #include <qtooltip.h>
00018 #include <qwhatsthis.h>
00019 #include <qcombobox.h>
00020 #include <qbuttongroup.h>
00021 #include <qlineedit.h>
00022 #ifdef USEQPE
00023 #include <qpe/menubutton.h>
00024 #endif
00025
00026 CBarPrefs::CBarPrefs(const QString& appdir, bool fs, QWidget* parent, const char* name) : QDialog(parent, name, true), config( appdir )
00027 {
00028 setCaption(tr( "Toolbar Settings" ) );
00029 QTabWidget* td = new QTabWidget(this);
00030 misc = new CMiscBarPrefs(this);
00031 filebar = new CFileBarPrefs(config, this);
00032 navbar = new CNavBarPrefs(config, this);
00033 viewbar = new CViewBarPrefs(config, this);
00034 markbar = new CMarkBarPrefs(config, this);
00035 indbar = new CIndBarPrefs(config, this);
00036 td->addTab(filebar, tr("File"));
00037 td->addTab(navbar, tr("Navigation"));
00038 td->addTab(viewbar, tr("View"));
00039 td->addTab(markbar, tr("Marks"));
00040 td->addTab(indbar, tr("Indicators"));
00041 td->addTab(misc, tr("Policy"));
00042 QVBoxLayout* v = new QVBoxLayout(this);
00043 v->addWidget(td);
00044
00045 if (fs) showMaximized();
00046 }
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 CFileBarPrefs::CFileBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
00220 : QWidget( parent, name, fl ), config(_config)
00221 {
00222 config.setGroup( "Toolbar" );
00223 QVBoxLayout* vb = new QVBoxLayout(this);
00224
00225 QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "File", this);
00226 vb->addWidget(bg);
00227
00228 open = new QCheckBox( tr("Open"), bg );
00229 open->setChecked(config.readBoolEntry( "Open", false ));
00230 connect(open, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00231 close = new QCheckBox( tr("Close"), bg );
00232 close->setChecked(config.readBoolEntry( "Close", false ));
00233 connect(close, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00234 info = new QCheckBox( tr("Info"), bg );
00235 info->setChecked(config.readBoolEntry( "Info", false ));
00236 connect(info, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00237 twotouch = new QCheckBox( tr("Two/One\nTouch"), bg );
00238 twotouch->setChecked(config.readBoolEntry( "Two/One Touch", false ));
00239 connect(twotouch, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00240 find = new QCheckBox( tr("Find"), bg );
00241 find->setChecked(config.readBoolEntry( "Find", false ));
00242 connect(find, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00243 m_isChanged = false;
00244 }
00245
00246 void CFileBarPrefs::saveall()
00247 {
00248 config.setGroup( "Toolbar" );
00249 config.writeEntry( "Open", open->isChecked());
00250 config.writeEntry( "Close", close->isChecked());
00251 config.writeEntry( "Info", info->isChecked());
00252 config.writeEntry( "Two/One Touch", twotouch->isChecked());
00253 config.writeEntry( "Find", find->isChecked());
00254 }
00255
00256 CFileBarPrefs::~CFileBarPrefs()
00257 {
00258 }
00259
00260 CNavBarPrefs::CNavBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
00261 : QWidget( parent, name, fl ), config(_config)
00262 {
00263 config.setGroup( "Toolbar" );
00264 QVBoxLayout* vb = new QVBoxLayout(this);
00265
00266 QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "Navigation", this);
00267 vb->addWidget(bg);
00268 scroll = new QCheckBox( tr("Scroll"), bg );
00269 scroll->setChecked(config.readBoolEntry( "Scroll", false ));
00270 connect(scroll, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00271
00272 navback = new QCheckBox( tr("Back"), bg );
00273 navback->setChecked(config.readBoolEntry( "Back", false ));
00274 connect(navback, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00275 navhome = new QCheckBox( tr("Home"), bg );
00276 navhome->setChecked(config.readBoolEntry( "Home", false ));
00277 connect(navhome, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00278 navforward = new QCheckBox( tr("Forward"), bg );
00279 navforward->setChecked(config.readBoolEntry( "Forward", false ));
00280 connect(navforward, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00281
00282 pageup = new QCheckBox( tr("Page Up"), bg );
00283 pageup->setChecked(config.readBoolEntry( "Page Up", false ));
00284 connect(pageup, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00285 pagedown = new QCheckBox( tr("Page Down"), bg );
00286 pagedown->setChecked(config.readBoolEntry( "Page Down", false ));
00287 connect(pagedown, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00288 gotostart = new QCheckBox( tr("Goto Start"), bg );
00289 gotostart->setChecked(config.readBoolEntry( "Goto Start", false ));
00290 connect(gotostart, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00291 gotoend = new QCheckBox( tr("Goto End"), bg );
00292 gotoend->setChecked(config.readBoolEntry( "Goto End", false ));
00293 connect(gotoend, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00294 jump = new QCheckBox( tr("Jump"), bg );
00295 jump->setChecked(config.readBoolEntry( "Jump", false ));
00296 connect(jump, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00297 pageline = new QCheckBox( tr("Page/Line Scroll"), bg );
00298 pageline->setChecked(config.readBoolEntry( "Page/Line Scroll", false ));
00299 connect(pageline, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00300 m_isChanged = false;
00301 }
00302
00303 void CNavBarPrefs::saveall()
00304 {
00305 config.setGroup( "Toolbar" );
00306 config.writeEntry( "Scroll", scroll->isChecked());
00307 config.writeEntry( "Back", navback->isChecked());
00308 config.writeEntry( "Home", navhome->isChecked());
00309 config.writeEntry( "Forward", navforward->isChecked());
00310 config.writeEntry( "Page Up", pageup->isChecked());
00311 config.writeEntry( "Page Down", pagedown->isChecked());
00312 config.writeEntry( "Goto Start", gotostart->isChecked());
00313 config.writeEntry( "Goto End", gotoend->isChecked());
00314 config.writeEntry( "Jump", jump->isChecked());
00315 config.writeEntry( "Page/Line Scroll", pageline->isChecked());
00316 }
00317
00318 CNavBarPrefs::~CNavBarPrefs()
00319 {
00320 }
00321
00322 CViewBarPrefs::CViewBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
00323 : QWidget( parent, name, fl ), config(_config)
00324 {
00325 QVBoxLayout* vb = new QVBoxLayout(this);
00326
00327 QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "View", this);
00328 vb->addWidget(bg);
00329
00330 config.setGroup( "Toolbar" );
00331
00332 fullscreen = new QCheckBox( tr("Fullscreen"), bg );
00333 fullscreen->setChecked(config.readBoolEntry( "Fullscreen", false ));
00334 connect(fullscreen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00335 rotate = new QCheckBox( tr("Rotate"), bg );
00336 rotate->setChecked(config.readBoolEntry( "Rotate", false ));
00337 connect(rotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00338
00339 invert = new QCheckBox( tr("Invert"), bg );
00340 invert->setChecked(config.readBoolEntry( "Invert Action", false ));
00341 connect(invert, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00342
00343 zoomin = new QCheckBox( tr("Zoom In"), bg );
00344 zoomin->setChecked(config.readBoolEntry( "Zoom In", false ));
00345 connect(zoomin, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00346 zoomout = new QCheckBox( tr("Zoom Out"), bg );
00347 zoomout->setChecked(config.readBoolEntry( "Zoom Out", false ));
00348 connect(zoomout, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00349 setfont = new QCheckBox( tr("Set Font"), bg );
00350 setfont->setChecked(config.readBoolEntry( "Set Font", false ));
00351 connect(setfont, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00352
00353 encoding = new QCheckBox( tr("Encoding"), bg );
00354 encoding->setChecked(config.readBoolEntry("Encoding Select", false));
00355 connect(encoding, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00356 ideogram = new QCheckBox( tr("Ideogram"), bg );
00357 ideogram->setChecked(config.readBoolEntry("Ideogram Mode", false));
00358 connect(ideogram, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00359 m_isChanged = false;
00360 }
00361
00362 void CViewBarPrefs::saveall()
00363 {
00364 config.setGroup( "Toolbar" );
00365 config.writeEntry( "Fullscreen", fullscreen->isChecked());
00366 config.writeEntry( "Rotate", rotate->isChecked());
00367 config.writeEntry( "Invert Action", invert->isChecked());
00368 config.writeEntry( "Zoom In", zoomin->isChecked());
00369 config.writeEntry( "Zoom Out", zoomout->isChecked());
00370 config.writeEntry( "Set Font", setfont->isChecked());
00371 config.writeEntry("Encoding Select", encoding->isChecked());
00372 config.writeEntry("Ideogram Mode", ideogram->isChecked());
00373 }
00374
00375 CViewBarPrefs::~CViewBarPrefs()
00376 {
00377 }
00378
00379 CMarkBarPrefs::CMarkBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
00380 : QWidget( parent, name, fl ), config(_config)
00381 {
00382 QVBoxLayout* vb = new QVBoxLayout(this);
00383
00384 QGroupBox* bg = new QGroupBox(2, Qt::Horizontal, "Marks", this);
00385 vb->addWidget(bg);
00386 mark = new QCheckBox( tr("Bookmark"), bg );
00387 mark->setChecked(config.readBoolEntry( "Mark", false ));
00388 connect(mark, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00389 annotate = new QCheckBox( tr("Annotate"), bg );
00390 annotate->setChecked(config.readBoolEntry( "Annotate", false ));
00391 connect(annotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00392 go_to = new QCheckBox( tr("Goto"), bg );
00393 go_to->setChecked(config.readBoolEntry( "Goto", false ));
00394 connect(go_to, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00395 Delete = new QCheckBox( tr("Delete"), bg );
00396 Delete->setChecked(config.readBoolEntry( "Delete", false ));
00397 connect(Delete, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00398 autogen = new QCheckBox( tr("Autogen"), bg );
00399 autogen->setChecked(config.readBoolEntry( "Autogen", false ));
00400 connect(autogen, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00401 clear = new QCheckBox( tr("Clear"), bg );
00402 clear->setChecked(config.readBoolEntry( "Clear", false ));
00403 connect(clear, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00404 save = new QCheckBox( tr("Save"), bg );
00405 save->setChecked(config.readBoolEntry( "Save", false ));
00406 connect(save, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00407 tidy = new QCheckBox( tr("Tidy"), bg );
00408 tidy->setChecked(config.readBoolEntry( "Tidy", false ));
00409 connect(tidy, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00410 startblock = new QCheckBox( tr("Mark Block"), bg );
00411 startblock->setChecked(config.readBoolEntry( "Start Block", false ));
00412 connect(startblock, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00413 copyblock = new QCheckBox( tr("Copy Block"), bg );
00414 copyblock->setChecked(config.readBoolEntry( "Copy Block", false ));
00415 connect(copyblock, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00416 m_isChanged = false;
00417 }
00418
00419 void CMarkBarPrefs::saveall()
00420 {
00421 config.setGroup( "Toolbar" );
00422 config.writeEntry( "Mark", mark->isChecked());
00423 config.writeEntry( "Annotate", annotate->isChecked());
00424 config.writeEntry( "Goto", go_to->isChecked());
00425 config.writeEntry( "Delete", Delete->isChecked());
00426 config.writeEntry( "Autogen", autogen->isChecked());
00427 config.writeEntry( "Clear", clear->isChecked());
00428 config.writeEntry( "Save", save->isChecked());
00429 config.writeEntry( "Tidy", tidy->isChecked());
00430 config.writeEntry( "Start Block", startblock->isChecked());
00431 config.writeEntry( "Copy Block", copyblock->isChecked());
00432 }
00433
00434 CMarkBarPrefs::~CMarkBarPrefs()
00435 {
00436 }
00437
00438 CMiscBarPrefs::CMiscBarPrefs( QWidget* parent, const char* name, WFlags fl )
00439 : QWidget( parent, name, fl )
00440 {
00441
00442 QGridLayout* hl = new QGridLayout(this,2,2);
00443
00444 hl->setMargin( 0 );
00445
00446 QGroupBox* gb = new QGroupBox(1, Qt::Horizontal, "Dialogs", this);
00447 floating = new QCheckBox(gb);
00448 floating->setText(tr("Floating"));
00449 hl->addWidget( gb, 0, 0 );
00450
00451
00452 gb = new QGroupBox(1, Qt::Horizontal, "Bars (Restart)", this);
00453
00454
00455
00456
00457
00458 #ifdef USECOMBO
00459 tbpolicy = new QComboBox(gb);
00460 #else
00461 tbpolicy = new MenuButton(gb);
00462 #endif
00463 tbpolicy->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
00464 #ifdef USEQPE
00465 tbpolicy->insertItem(tr("Single bar"));
00466 tbpolicy->insertItem(tr("Menu/tool bar"));
00467 tbpolicy->insertItem(tr("Multiple bars"));
00468 #else
00469 tbpolicy->insertItem(tr("Single bar"));
00470 tbpolicy->insertItem(tr("Multiple bars"));
00471 #endif
00472
00473 #ifdef USECOMBO
00474 tbposition = new QComboBox(gb);
00475 #else
00476 tbposition = new MenuButton(gb);
00477 #endif
00478 tbposition->insertItem(tr("Top"));
00479 tbposition->insertItem(tr("Bottom"));
00480 tbposition->insertItem(tr("Right"));
00481 tbposition->insertItem(tr("Left"));
00482 tbposition->insertItem(tr("Minimised"));
00483
00484 tbmovable = new QCheckBox( tr("Movable"), gb );
00485
00486 hl->addWidget(gb, 0, 1);
00487
00488 gb = new QGroupBox(1, Qt::Horizontal, "QT Scroll Bar", this);
00489
00490 #ifdef USECOMBO
00491 qtscroll = new QComboBox(gb);
00492 #else
00493 qtscroll = new MenuButton(gb);
00494 #endif
00495 qtscroll->insertItem(tr("None"));
00496 qtscroll->insertItem(tr("Right"));
00497 qtscroll->insertItem(tr("Left"));
00498
00499 hl->addWidget(gb, 1, 0);
00500 gb = new QGroupBox(1, Qt::Horizontal, "Miniscroll", this);
00501
00502 #ifdef USECOMBO
00503 localscroll = new QComboBox(gb);
00504 #else
00505 localscroll = new MenuButton(gb);
00506 #endif
00507 localscroll->insertItem(tr("None"));
00508 localscroll->insertItem(tr("Bottom"));
00509 localscroll->insertItem(tr("Right"));
00510 localscroll->insertItem(tr("Left"));
00511
00512
00513
00514
00515 hl->addWidget(gb, 1, 1);
00516
00517 }
00518
00519 CMiscBarPrefs::~CMiscBarPrefs()
00520 {
00521
00522 }
00523
00524
00525 CIndBarPrefs::CIndBarPrefs( Config& _config, QWidget* parent, const char* name, WFlags fl )
00526 : QWidget( parent, name, fl ), config(_config)
00527 {
00528 QVBoxLayout* vb = new QVBoxLayout(this);
00529
00530 QGroupBox* bg = new QGroupBox(1, Qt::Horizontal, "Indicators", this);
00531 vb->addWidget(bg);
00532 indannotate = new QCheckBox( tr("Annotation"), bg );
00533 indannotate->setChecked(config.readBoolEntry( "Annotation indicator", false ));
00534 connect(indannotate, SIGNAL(stateChanged(int)), this, SLOT( isChanged(int) ) );
00535 m_isChanged = false;
00536 }
00537
00538 void CIndBarPrefs::saveall()
00539 {
00540 config.setGroup( "Toolbar" );
00541 config.writeEntry( "Annotation indicator", indannotate->isChecked());
00542 }
00543
00544 CIndBarPrefs::~CIndBarPrefs()
00545 {
00546 }