2 #include <kstandarddirs.h>
10 #include <config-workspace.h>
12 #include "advanceddialog.h"
15 #include "advanceddialog.moc"
17 KScreenSaverAdvancedDialog::KScreenSaverAdvancedDialog(QWidget
*parent
)
21 setCaption( i18n( "Advanced Options" ) );
22 setButtons( Ok
| Cancel
);
23 showButtonSeparator( true );
25 dialog
= new AdvancedDialog(this);
26 setMainWidget(dialog
);
30 connect(dialog
->qcbPriority
, SIGNAL(activated(int)),
31 this, SLOT(slotPriorityChanged(int)));
33 connect(dialog
->qcbTopLeft
, SIGNAL(activated(int)),
34 this, SLOT(slotChangeTopLeftCorner(int)));
35 connect(dialog
->qcbTopRight
, SIGNAL(activated(int)),
36 this, SLOT(slotChangeTopLeftCorner(int)));
37 connect(dialog
->qcbBottomLeft
, SIGNAL(activated(int)),
38 this, SLOT(slotChangeTopLeftCorner(int)));
39 connect(dialog
->qcbBottomRight
, SIGNAL(activated(int)),
40 this, SLOT(slotChangeTopLeftCorner(int)));
42 #ifndef HAVE_SETPRIORITY
43 dialog
->qgbPriority
->setEnabled(false);
47 void KScreenSaverAdvancedDialog::readSettings()
49 KConfigGroup
config(KSharedConfig::openConfig("kscreensaverrc"), "ScreenSaver");
51 mPriority
= config
.readEntry("Priority", 19);
52 if (mPriority
< 0) mPriority
= 0;
53 if (mPriority
> 19) mPriority
= 19;
55 dialog
->qcbTopLeft
->setCurrentIndex(config
.readEntry("ActionTopLeft", 0));
56 dialog
->qcbTopRight
->setCurrentIndex(config
.readEntry("ActionTopRight", 0));
57 dialog
->qcbBottomLeft
->setCurrentIndex(config
.readEntry("ActionBottomLeft", 0));
58 dialog
->qcbBottomRight
->setCurrentIndex(config
.readEntry("ActionBottomRight", 0));
63 dialog
->qcbPriority
->setCurrentIndex(0);
64 kDebug() << "setting low";
67 dialog
->qcbPriority
->setCurrentIndex(1);
68 kDebug() << "setting medium";
71 dialog
->qcbPriority
->setCurrentIndex(2);
72 kDebug() << "setting high";
79 void KScreenSaverAdvancedDialog::slotPriorityChanged(int val
)
85 kDebug() << "low priority";
89 kDebug() << "medium priority";
93 kDebug() << "high priority";
99 void KScreenSaverAdvancedDialog::accept()
103 KConfig
*config
= new KConfig("kscreensaverrc");
104 KConfigGroup group
= config
->group("ScreenSaver");
106 group
.writeEntry("Priority", mPriority
);
108 "ActionTopLeft", dialog
->qcbTopLeft
->currentIndex());
110 "ActionTopRight", dialog
->qcbTopRight
->currentIndex());
112 "ActionBottomLeft", dialog
->qcbBottomLeft
->currentIndex());
114 "ActionBottomRight", dialog
->qcbBottomRight
->currentIndex());
122 void KScreenSaverAdvancedDialog::slotChangeBottomRightCorner(int)
127 void KScreenSaverAdvancedDialog::slotChangeBottomLeftCorner(int)
132 void KScreenSaverAdvancedDialog::slotChangeTopRightCorner(int)
137 void KScreenSaverAdvancedDialog::slotChangeTopLeftCorner(int)
142 /* =================================================================================================== */
144 AdvancedDialog::AdvancedDialog(QWidget
*parent
) : AdvancedDialogImpl(parent
)
146 monitorLabel
->setPixmap(QPixmap(KStandardDirs::locate("data", "kcontrol/pics/monitor.png")));
147 qcbPriority
->setWhatsThis( "<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>");
148 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>");
149 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>");
150 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>");
151 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>");
152 qlTopLeft
->setWhatsThis( qsTopLeft
);
153 qcbTopLeft
->setWhatsThis( qsTopLeft
);
154 qlTopRight
->setWhatsThis( qsTopRight
);
155 qcbTopRight
->setWhatsThis( qsTopRight
);
156 qlBottomLeft
->setWhatsThis( qsBottomLeft
);
157 qcbBottomLeft
->setWhatsThis( qsBottomLeft
);
158 qlBottomRight
->setWhatsThis( qsBottomRight
);
159 qcbBottomRight
->setWhatsThis( qsBottomRight
);
162 AdvancedDialog::~AdvancedDialog()
167 void AdvancedDialog::setMode(QComboBox
*box
, int i
)
169 box
->setCurrentIndex(i
);
172 int AdvancedDialog::mode(QComboBox
*box
)
174 return box
->currentIndex();