2
#include <kstandarddirs.h>
6
#include <qwhatsthis.h>
11
#include "advanceddialog.h"
12
#include "advanceddialogimpl.h"
15
#include "advanceddialog.moc"
17
KScreenSaverAdvancedDialog::KScreenSaverAdvancedDialog(QWidget *parent, const char* name)
18
: KDialogBase( parent, name, true, i18n( "Advanced Options" ),
19
Ok | Cancel, Ok, true )
22
dialog = new AdvancedDialog(this);
23
setMainWidget(dialog);
27
connect(dialog->qcbPriority, SIGNAL(activated(int)),
28
this, SLOT(slotPriorityChanged(int)));
30
connect(dialog->qcbTopLeft, SIGNAL(activated(int)),
31
this, SLOT(slotChangeTopLeftCorner(int)));
32
connect(dialog->qcbTopRight, SIGNAL(activated(int)),
33
this, SLOT(slotChangeTopLeftCorner(int)));
34
connect(dialog->qcbBottomLeft, SIGNAL(activated(int)),
35
this, SLOT(slotChangeTopLeftCorner(int)));
36
connect(dialog->qcbBottomRight, SIGNAL(activated(int)),
37
this, SLOT(slotChangeTopLeftCorner(int)));
39
#ifndef HAVE_SETPRIORITY
40
dialog->qgbPriority->setEnabled(false);
44
void KScreenSaverAdvancedDialog::readSettings()
46
KConfig *config = new KConfig("kdesktoprc");
47
config->setGroup("ScreenSaver");
49
mPriority = config->readNumEntry("Priority", 19);
50
if (mPriority < 0) mPriority = 0;
51
if (mPriority > 19) mPriority = 19;
53
dialog->qcbTopLeft->setCurrentItem(config->readNumEntry("ActionTopLeft", 0));
54
dialog->qcbTopRight->setCurrentItem(config->readNumEntry("ActionTopRight", 0));
55
dialog->qcbBottomLeft->setCurrentItem(config->readNumEntry("ActionBottomLeft", 0));
56
dialog->qcbBottomRight->setCurrentItem(config->readNumEntry("ActionBottomRight", 0));
62
dialog->qcbPriority->setCurrentItem(0);
63
kdDebug() << "setting low" << endl;
66
dialog->qcbPriority->setCurrentItem(1);
67
kdDebug() << "setting medium" << endl;
70
dialog->qcbPriority->setCurrentItem(2);
71
kdDebug() << "setting high" << endl;
79
void KScreenSaverAdvancedDialog::slotPriorityChanged(int val)
85
kdDebug() << "low priority" << endl;
89
kdDebug() << "medium priority" << endl;
93
kdDebug() << "high priority" << endl;
99
void KScreenSaverAdvancedDialog::slotOk()
103
KConfig *config = new KConfig("kdesktoprc");
104
config->setGroup( "ScreenSaver" );
106
config->writeEntry("Priority", mPriority);
108
"ActionTopLeft", dialog->qcbTopLeft->currentItem());
110
"ActionTopRight", dialog->qcbTopRight->currentItem());
112
"ActionBottomLeft", dialog->qcbBottomLeft->currentItem());
114
"ActionBottomRight", dialog->qcbBottomRight->currentItem());
121
void KScreenSaverAdvancedDialog::slotChangeBottomRightCorner(int)
126
void KScreenSaverAdvancedDialog::slotChangeBottomLeftCorner(int)
131
void KScreenSaverAdvancedDialog::slotChangeTopRightCorner(int)
136
void KScreenSaverAdvancedDialog::slotChangeTopLeftCorner(int)
141
/* =================================================================================================== */
143
AdvancedDialog::AdvancedDialog(QWidget *parent, const char *name) : AdvancedDialogImpl(parent, name)
145
monitorLabel->setPixmap(QPixmap(locate("data", "kcontrol/pics/monitor.png")));
146
QWhatsThis::add(qcbPriority, "<qt>" + i18n("Specify the priority that the screensaver will run at. A higher priority may mean that the screensaver runs faster, though may reduce the speed that other programs run at while the screensaver is active.") + "</qt>");
147
QString qsTopLeft("<qt>" + i18n("The action to take when the mouse cursor is located in the top left corner of the screen for 15 seconds.") + "</qt>");
148
QString qsTopRight("<qt>" + i18n("The action to take when the mouse cursor is located in the top right corner of the screen for 15 seconds.") + "</qt>");
149
QString qsBottomLeft("<qt>" + i18n("The action to take when the mouse cursor is located in the bottom left corner of the screen for 15 seconds.") + "</qt>");
150
QString qsBottomRight("<qt>" + i18n("The action to take when the mouse cursor is located in the bottom right corner of the screen for 15 seconds.") + "</qt>");
151
QWhatsThis::add(qlTopLeft, qsTopLeft);
152
QWhatsThis::add(qcbTopLeft, qsTopLeft);
153
QWhatsThis::add(qlTopRight, qsTopRight);
154
QWhatsThis::add(qcbTopRight, qsTopRight);
155
QWhatsThis::add(qlBottomLeft, qsBottomLeft);
156
QWhatsThis::add(qcbBottomLeft, qsBottomLeft);
157
QWhatsThis::add(qlBottomRight, qsBottomRight);
158
QWhatsThis::add(qcbBottomRight, qsBottomRight);
161
AdvancedDialog::~AdvancedDialog()
166
void AdvancedDialog::setMode(QComboBox *box, int i)
168
box->setCurrentItem(i);
171
int AdvancedDialog::mode(QComboBox *box)
173
return box->currentItem();