Ran am2cmake.
[basket4.git] / src / settings.cpp
blobdd7b969acfa6d0b9131468e80cfbca48b517aa75
1 /***************************************************************************
2 * Copyright (C) 2003 by Sébastien Laoût *
3 * slaout@linux62.org *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #include <config.h>
22 #include <qlayout.h>
23 #include <qlineedit.h>
24 #include <q3hbox.h>
25 #include <q3vbox.h>
26 #include <qtabwidget.h>
27 #include <q3groupbox.h>
28 #include <qlabel.h>
29 #include <qpushbutton.h>
30 //Added by qt3to4:
31 #include <Q3HBoxLayout>
32 #include <Q3GridLayout>
33 #include <QPixmap>
34 #include <Q3VBoxLayout>
35 #include <knuminput.h>
36 #include <kcolorcombo.h>
37 #include <kiconloader.h>
38 #include <kconfig.h>
39 #include <kglobal.h>
40 #include <klocale.h>
41 #include <q3whatsthis.h>
42 #include <q3buttongroup.h>
43 #include <qradiobutton.h>
44 #include <qvbuttongroup.h>
45 #include <kapplication.h>
46 #include <kaboutdata.h>
47 #include <kmimetype.h>
48 #include <kstandarddirs.h>
49 #include <kdebug.h>
50 #include <qdatetime.h>
52 #include "kgpgme.h"
53 #include "basket.h"
54 #include "linklabel.h"
55 #include "settings.h"
56 #include "variouswidgets.h"
57 #include "note.h"
59 /** Settings */
61 // General: // TODO: Use this grouping everywhere!
62 bool Settings::s_useSystray = true;
63 bool Settings::s_usePassivePopup = true;
64 bool Settings::s_playAnimations = true;
65 bool Settings::s_showNotesToolTip = true; // TODO: RENAME: useBasketTooltips
66 bool Settings::s_confirmNoteDeletion = true;
67 bool Settings::s_bigNotes = false;
68 bool Settings::s_autoBullet = true;
69 bool Settings::s_exportTextTags = true;
70 bool Settings::s_useGnuPGAgent = false;
71 bool Settings::s_treeOnLeft = true;
72 bool Settings::s_filterOnTop = true;
73 int Settings::s_defImageX = 300;
74 int Settings::s_defImageY = 200;
75 bool Settings::s_enableReLockTimeout = true;
76 int Settings::s_reLockTimeoutMinutes = 0;
77 int Settings::s_newNotesPlace = 1;
78 int Settings::s_viewTextFileContent = false;
79 int Settings::s_viewHtmlFileContent = false;
80 int Settings::s_viewImageFileContent = false;
81 int Settings::s_viewSoundFileContent = false;
82 // Applications:
83 bool Settings::s_htmlUseProg = false; // TODO: RENAME: s_*App (with KService!)
84 bool Settings::s_imageUseProg = true;
85 bool Settings::s_animationUseProg = true;
86 bool Settings::s_soundUseProg = false;
87 QString Settings::s_htmlProg = "quanta";
88 QString Settings::s_imageProg = "kolourpaint";
89 QString Settings::s_animationProg = "gimp";
90 QString Settings::s_soundProg = "";
91 // Addictive Features:
92 bool Settings::s_groupOnInsertionLine = false;
93 int Settings::s_middleAction = 0;
94 bool Settings::s_showIconInSystray = false; // TODO: RENAME: basketIconInSystray
95 bool Settings::s_hideOnMouseOut = false;
96 int Settings::s_timeToHideOnMouseOut = 0;
97 bool Settings::s_showOnMouseIn = false;
98 int Settings::s_timeToShowOnMouseIn = 1;
99 // Rememberings:
100 int Settings::s_defIconSize = 32; // TODO: RENAME: importIconSize
101 bool Settings::s_blinkedFilter = false;
102 bool Settings::s_startDocked = false;
103 int Settings::s_basketTreeWidth = -1;
104 bool Settings::s_welcomeBasketsAdded = false;
105 QString Settings::s_dataFolder = "";
106 QDate Settings::s_lastBackup = QDate();
107 QPoint Settings::s_mainWindowPosition = QPoint();
108 QSize Settings::s_mainWindowSize = QSize();
109 bool Settings::s_showEmptyBasketInfo = true;
110 bool Settings::s_spellCheckTextNotes = true;
112 void Settings::loadConfig()
114 LinkLook defaultSoundLook;
115 LinkLook defaultFileLook;
116 LinkLook defaultLocalLinkLook;
117 LinkLook defaultNetworkLinkLook;
118 LinkLook defaultLauncherLook; /* italic bold underlining color hoverColor iconSize preview */
119 defaultSoundLook.setLook( false, false, LinkLook::Never, QColor(), QColor(), 32, LinkLook::None );
120 defaultFileLook.setLook( false, false, LinkLook::Never, QColor(), QColor(), 32, LinkLook::TwiceIconSize );
121 defaultLocalLinkLook.setLook( true, false, LinkLook::OnMouseHover, QColor(), QColor(), 22, LinkLook::TwiceIconSize );
122 defaultNetworkLinkLook.setLook( false, false, LinkLook::OnMouseOutside, QColor(), QColor(), 16, LinkLook::None );
123 defaultLauncherLook.setLook( false, true, LinkLook::Never, QColor(), QColor(), 48, LinkLook::None );
125 loadLinkLook(LinkLook::soundLook, "Sound Look", defaultSoundLook );
126 loadLinkLook(LinkLook::fileLook, "File Look", defaultFileLook );
127 loadLinkLook(LinkLook::localLinkLook, "Local Link Look", defaultLocalLinkLook );
128 loadLinkLook(LinkLook::networkLinkLook, "Network Link Look", defaultNetworkLinkLook);
129 loadLinkLook(LinkLook::launcherLook, "Launcher Look", defaultLauncherLook );
131 KConfig* config = Global::config();
132 config->setGroup("Main window"); // TODO: Split with a "System tray icon" group !
133 setTreeOnLeft( config->readBoolEntry("treeOnLeft", true) );
134 setFilterOnTop( config->readBoolEntry("filterOnTop", true) );
135 setPlayAnimations( config->readBoolEntry("playAnimations", true) );
136 setShowNotesToolTip( config->readBoolEntry("showNotesToolTip", true) );
137 setBigNotes( config->readBoolEntry("bigNotes", false) );
138 setConfirmNoteDeletion( config->readBoolEntry("confirmNoteDeletion", true) );
139 setAutoBullet( config->readBoolEntry("autoBullet", true) );
140 setExportTextTags( config->readBoolEntry("exportTextTags", true) );
141 setUseGnuPGAgent( config->readBoolEntry("useGnuPGAgent", false) );
142 setBlinkedFilter( config->readBoolEntry("blinkedFilter", false) );
143 setEnableReLockTimeout( config->readNumEntry( "enableReLockTimeout", true) );
144 setReLockTimeoutMinutes( config->readNumEntry( "reLockTimeoutMinutes", 0) );
145 setUseSystray( config->readBoolEntry("useSystray", true) );
146 setShowIconInSystray( config->readBoolEntry("showIconInSystray", false) );
147 setStartDocked( config->readBoolEntry("startDocked", false) );
148 setMiddleAction( config->readNumEntry( "middleAction", 0) );
149 setGroupOnInsertionLine( config->readBoolEntry("groupOnInsertionLine", false) );
150 setSpellCheckTextNotes( config->readBoolEntry("spellCheckTextNotes", true) );
151 setHideOnMouseOut( config->readBoolEntry("hideOnMouseOut", false) );
152 setTimeToHideOnMouseOut( config->readNumEntry( "timeToHideOnMouseOut", 0) );
153 setShowOnMouseIn( config->readBoolEntry("showOnMouseIn", false) );
154 setTimeToShowOnMouseIn( config->readNumEntry( "timeToShowOnMouseIn", 1) );
155 setBasketTreeWidth( config->readNumEntry( "basketTreeWidth", -1) );
156 setUsePassivePopup( config->readBoolEntry("usePassivePopup", true) );
157 setWelcomeBasketsAdded( config->readBoolEntry("welcomeBasketsAdded", false) );
158 setDataFolder( config->readPathEntry("dataFolder", "") );
159 setLastBackup( config->readDateTimeEntry("lastBackup", new QDateTime()).date());
160 setMainWindowPosition( config->readPointEntry("position" ) );
161 setMainWindowSize( config->readSizeEntry( "size" ) );
163 config->setGroup("Notification Messages");
164 setShowEmptyBasketInfo( config->readBoolEntry("emptyBasketInfo", true) );
166 config->setGroup("Programs");
167 setIsHtmlUseProg( config->readBoolEntry("htmlUseProg", false) );
168 setIsImageUseProg( config->readBoolEntry("imageUseProg", true) );
169 setIsAnimationUseProg( config->readBoolEntry("animationUseProg", true) );
170 setIsSoundUseProg( config->readBoolEntry("soundUseProg", false) );
171 setHtmlProg( config->readEntry( "htmlProg", "quanta") );
172 setImageProg( config->readEntry( "imageProg", "kolourpaint") );
173 setAnimationProg( config->readEntry( "animationProg", "gimp") );
174 setSoundProg( config->readEntry( "soundProg", "") );
176 config->setGroup("Note Addition");
177 setNewNotesPlace( config->readNumEntry( "newNotesPlace", 1) );
178 setViewTextFileContent( config->readBoolEntry("viewTextFileContent", false) );
179 setViewHtmlFileContent( config->readBoolEntry("viewHtmlFileContent", false) );
180 setViewImageFileContent( config->readBoolEntry("viewImageFileContent", true) );
181 setViewSoundFileContent( config->readBoolEntry("viewSoundFileContent", true) );
183 config->setGroup("Insert Note Default Values");
184 setDefImageX( config->readNumEntry( "defImageX", 300) );
185 setDefImageY( config->readNumEntry( "defImageY", 200) );
186 setDefIconSize( config->readNumEntry( "defIconSize", 32) );
188 config->setGroup("MainWindow Toolbar mainToolBar");
189 // The first time we start, we define "Text Alongside Icons" for the main toolbar.
190 // After that, the user is free to hide the text from the icons or customize as he/she want.
191 // But it is a good default (Fitt's Laws, better looking, less "empty"-feeling), especially for this application.
192 // if (!config->readBoolEntry("alreadySetIconTextRight", false)) {
193 // config->writeEntry( "IconText", "IconTextRight" );
194 // config->writeEntry( "alreadySetIconTextRight", true );
195 // }
196 if (!config->readBoolEntry("alreadySetToolbarSettings", false)) {
197 config->writeEntry("IconText", "IconOnly"); // In 0.6.0 Alpha versions, it was made "IconTextRight". We're back to IconOnly
198 config->writeEntry("Index", "0"); // Make sure the main toolbar is the first...
199 config->setGroup("MainWindow Toolbar richTextEditToolBar");
200 config->writeEntry("Position", "Top"); // In 0.6.0 Alpha versions, it was made "Bottom"
201 config->writeEntry("Index", "1"); // ... and the rich text toolbar is on the right of the main toolbar
202 config->setGroup("MainWindow Toolbar mainToolBar");
203 config->writeEntry("alreadySetToolbarSettings", true);
207 void Settings::saveConfig()
209 saveLinkLook(LinkLook::soundLook, "Sound Look" );
210 saveLinkLook(LinkLook::fileLook, "File Look" );
211 saveLinkLook(LinkLook::localLinkLook, "Local Link Look" );
212 saveLinkLook(LinkLook::networkLinkLook, "Network Link Look");
213 saveLinkLook(LinkLook::launcherLook, "Launcher Look" );
215 KConfig* config = Global::config();
216 config->setGroup("Main window");
217 config->writeEntry( "treeOnLeft", treeOnLeft() );
218 config->writeEntry( "filterOnTop", filterOnTop() );
219 config->writeEntry( "playAnimations", playAnimations() );
220 config->writeEntry( "showNotesToolTip", showNotesToolTip() );
221 config->writeEntry( "confirmNoteDeletion", confirmNoteDeletion() );
222 config->writeEntry( "bigNotes", bigNotes() );
223 config->writeEntry( "autoBullet", autoBullet() );
224 config->writeEntry( "exportTextTags", exportTextTags() );
225 #ifdef HAVE_LIBGPGME
226 if (KGpgMe::isGnuPGAgentAvailable())
227 config->writeEntry( "useGnuPGAgent", useGnuPGAgent() );
228 #endif
229 config->writeEntry( "blinkedFilter", blinkedFilter() );
230 config->writeEntry( "enableReLockTimeout", enableReLockTimeout() );
231 config->writeEntry( "reLockTimeoutMinutes", reLockTimeoutMinutes() );
232 config->writeEntry( "useSystray", useSystray() );
233 config->writeEntry( "showIconInSystray", showIconInSystray() );
234 config->writeEntry( "startDocked", startDocked() );
235 config->writeEntry( "middleAction", middleAction() );
236 config->writeEntry( "groupOnInsertionLine", groupOnInsertionLine() );
237 config->writeEntry( "spellCheckTextNotes", spellCheckTextNotes() );
238 config->writeEntry( "hideOnMouseOut", hideOnMouseOut() );
239 config->writeEntry( "timeToHideOnMouseOut", timeToHideOnMouseOut() );
240 config->writeEntry( "showOnMouseIn", showOnMouseIn() );
241 config->writeEntry( "timeToShowOnMouseIn", timeToShowOnMouseIn() );
242 config->writeEntry( "basketTreeWidth", basketTreeWidth() );
243 config->writeEntry( "usePassivePopup", usePassivePopup() );
244 config->writeEntry( "welcomeBasketsAdded", welcomeBasketsAdded() );
245 config->writePathEntry("dataFolder", dataFolder() );
246 config->writeEntry( "lastBackup", QDateTime(lastBackup()));
247 config->writeEntry( "position", mainWindowPosition() );
248 config->writeEntry( "size", mainWindowSize() );
250 config->setGroup("Notification Messages");
251 config->writeEntry( "emptyBasketInfo", showEmptyBasketInfo() );
253 config->setGroup("Programs");
254 config->writeEntry( "htmlUseProg", isHtmlUseProg() );
255 config->writeEntry( "imageUseProg", isImageUseProg() );
256 config->writeEntry( "animationUseProg", isAnimationUseProg() );
257 config->writeEntry( "soundUseProg", isSoundUseProg() );
258 config->writeEntry( "htmlProg", htmlProg() );
259 config->writeEntry( "imageProg", imageProg() );
260 config->writeEntry( "animationProg", animationProg() );
261 config->writeEntry( "soundProg", soundProg() );
263 config->setGroup("Note Addition");
264 config->writeEntry( "newNotesPlace", newNotesPlace() );
265 config->writeEntry( "viewTextFileContent", viewTextFileContent() );
266 config->writeEntry( "viewHtmlFileContent", viewHtmlFileContent() );
267 config->writeEntry( "viewImageFileContent", viewImageFileContent() );
268 config->writeEntry( "viewSoundFileContent", viewSoundFileContent() );
270 config->setGroup("Insert Note Default Values");
271 config->writeEntry( "defImageX", defImageX() );
272 config->writeEntry( "defImageY", defImageY() );
273 config->writeEntry( "defIconSize", defIconSize() );
275 config->sync();
278 void Settings::loadLinkLook(LinkLook *look, const QString &name, const LinkLook &defaultLook)
280 KConfig* config = Global::config();
281 config->setGroup(name);
283 QString underliningStrings[] = { "Always", "Never", "OnMouseHover", "OnMouseOutside" };
284 QString defaultUnderliningString = underliningStrings[defaultLook.underlining()];
286 QString previewStrings[] = { "None", "IconSize", "TwiceIconSize", "ThreeIconSize" };
287 QString defaultPreviewString = previewStrings[defaultLook.preview()];
289 bool italic = config->readBoolEntry( "italic", defaultLook.italic() );
290 bool bold = config->readBoolEntry( "bold", defaultLook.bold() );
291 QString underliningString = config->readEntry( "underlining", defaultUnderliningString );
292 QColor color = config->readPropertyEntry( "color", defaultLook.color() ).asColor();
293 QColor hoverColor = config->readPropertyEntry( "hoverColor", defaultLook.hoverColor() ).asColor();
294 int iconSize = config->readNumEntry( "iconSize", defaultLook.iconSize() );
295 QString previewString = config->readEntry( "preview", defaultPreviewString );
297 int underlining = 0;
298 if (underliningString == underliningStrings[1]) underlining = 1;
299 else if (underliningString == underliningStrings[2]) underlining = 2;
300 else if (underliningString == underliningStrings[3]) underlining = 3;
302 int preview = 0;
303 if (previewString == previewStrings[1]) preview = 1;
304 else if (previewString == previewStrings[2]) preview = 2;
305 else if (previewString == previewStrings[3]) preview = 3;
307 look->setLook(italic, bold, underlining, color, hoverColor, iconSize, preview);
310 void Settings::saveLinkLook(LinkLook *look, const QString &name)
312 KConfig* config = Global::config();
313 config->setGroup(name);
315 QString underliningStrings[] = { "Always", "Never", "OnMouseHover", "OnMouseOutside" };
316 QString underliningString = underliningStrings[look->underlining()];
318 QString previewStrings[] = { "None", "IconSize", "TwiceIconSize", "ThreeIconSize" };
319 QString previewString = previewStrings[look->preview()];
321 config->writeEntry( "italic", look->italic() );
322 config->writeEntry( "bold", look->bold() );
323 config->writeEntry( "underlining", underliningString );
324 config->writeEntry( "color", look->color() );
325 config->writeEntry( "hoverColor", look->hoverColor() );
326 config->writeEntry( "iconSize", look->iconSize() );
327 config->writeEntry( "preview", previewString );
330 void Settings::setBigNotes(bool big)
332 if (big == s_bigNotes)
333 return;
335 s_bigNotes = big;
336 // Big notes for accessibility reasons OR Standard small notes:
337 Note::NOTE_MARGIN = (big ? 4 : 2);
338 Note::INSERTION_HEIGHT = (big ? 5 : 3);
339 Note::EXPANDER_WIDTH = 9;
340 Note::EXPANDER_HEIGHT = 9;
341 Note::GROUP_WIDTH = 2*Note::NOTE_MARGIN + Note::EXPANDER_WIDTH;
342 Note::HANDLE_WIDTH = Note::GROUP_WIDTH;
343 Note::RESIZER_WIDTH = Note::GROUP_WIDTH;
344 Note::TAG_ARROW_WIDTH = 5 + (big ? 4 : 0);
345 Note::EMBLEM_SIZE = 16;
346 Note::MIN_HEIGHT = 2*Note::NOTE_MARGIN + Note::EMBLEM_SIZE;
348 if (Global::bnpView)
349 Global::bnpView->relayoutAllBaskets();
352 void Settings::setAutoBullet(bool yes)
354 s_autoBullet = yes;
355 if (Global::bnpView && Global::bnpView->currentBasket()) {
356 Global::bnpView->currentBasket()->editorPropertiesChanged();
360 /** GeneralPage */
362 GeneralPage::GeneralPage(QWidget * parent, const char * name)
363 : KCModule(parent, name)
365 Q3VBoxLayout *layout = new Q3VBoxLayout(this, /*margin=*/0, KDialogBase::spacingHint());
366 Q3HBoxLayout *hLay;
367 QLabel *label;
368 HelpLabel *hLabel;
370 Q3GridLayout *gl = new Q3GridLayout(layout, /*nRows=*/3, /*nCols=*/3);
371 gl->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), 0, 2);
373 // Basket Tree Position:
374 m_treeOnLeft = new QComboBox(this);
375 m_treeOnLeft->insertItem(i18n("On left"));
376 m_treeOnLeft->insertItem(i18n("On right"));
377 label = new QLabel(m_treeOnLeft, i18n("&Basket tree position:"), this);
378 gl->addWidget(label, 0, 0);
379 gl->addWidget(m_treeOnLeft, 0, 1);
380 connect( m_treeOnLeft, SIGNAL(activated(int)), this, SLOT(changed()) );
382 // Filter Bar Position:
383 m_filterOnTop = new QComboBox(this);
384 m_filterOnTop->insertItem(i18n("On top"));
385 m_filterOnTop->insertItem(i18n("On bottom"));
386 label = new QLabel(m_filterOnTop, i18n("&Filter bar position:"), this);
387 gl->addWidget(label, 1, 0);
388 gl->addWidget(m_filterOnTop, 1, 1);
389 connect( m_filterOnTop, SIGNAL(activated(int)), this, SLOT(changed()) );
391 // Use Baloons to Report Results of Global Actions:
392 hLay = new Q3HBoxLayout(0L, /*margin=*/0, KDialogBase::spacingHint());
393 m_usePassivePopup = new QCheckBox(i18n("&Use balloons to report results of global actions"), this);
394 connect( m_usePassivePopup, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
395 hLabel = new HelpLabel(
396 i18n("What are global actions?"),
397 ("<p>" + i18n("You can configure global shortcuts to do some actions without having to show the main window. For instance, you can paste the clipboard content, take a color from "
398 "a point of the screen, etc. You can also use the mouse scroll wheel over the system tray icon to change the current basket. Or use the middle mouse button "
399 "on that icon to paste the current selection.") + "</p>" +
400 "<p>" + i18n("When doing so, %1 pops up a little balloon message to inform you the action has been successfully done. You can disable that balloon.") + "</p>" +
401 "<p>" + i18n("Note that those messages are smart enough to not appear if the main window is visible. This is because you already see the result of your actions in the main window.") + "</p>")
402 .arg(kapp->aboutData()->programName()),
403 this);
404 hLay->addWidget(m_usePassivePopup);
405 hLay->addWidget(hLabel);
406 hLay->addStretch();
407 layout->addLayout(hLay);
409 // System Tray Icon:
410 Q3GroupBox *gbSys = new Q3GroupBox(3, Qt::Vertical, i18n("System Tray Icon"), this);
411 layout->addWidget(gbSys);
412 Q3VBoxLayout *sysLay = new Q3VBoxLayout(gbSys, /*margin=*/0, KDialogBase::spacingHint());
414 // Dock in System Tray:
415 m_useSystray = new QCheckBox(i18n("&Dock in system tray"), gbSys);
416 sysLay->addWidget(m_useSystray);
417 connect( m_useSystray, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
419 m_systray = new QWidget(gbSys);
420 Q3VBoxLayout *subSysLay = new Q3VBoxLayout(m_systray, /*margin=*/0, KDialogBase::spacingHint());
421 sysLay->addWidget(m_systray);
423 // Show Current Basket Icon in System Tray Icon:
424 m_showIconInSystray = new QCheckBox(i18n("&Show current basket icon in system tray icon"), m_systray);
425 subSysLay->addWidget(m_showIconInSystray);
426 connect(m_showIconInSystray, SIGNAL(stateChanged(int)), this, SLOT(changed()));
428 Q3GridLayout *gs = new Q3GridLayout(0, /*nRows=*/2, /*nCols=*/3);
429 subSysLay->addLayout(gs);
430 gs->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), 0, 2);
432 // Hide Main Window when Mouse Goes out of it for Some Time:
433 m_timeToHideOnMouseOut = new KIntNumInput(0, m_systray);
434 m_hideOnMouseOut = new QCheckBox(i18n("&Hide main window when mouse leaves it for"), m_systray);
435 m_timeToHideOnMouseOut->setRange(0, 600, 1, false);
436 m_timeToHideOnMouseOut->setSuffix(i18n(" tenths of seconds"));
437 gs->addWidget(m_hideOnMouseOut, 0, 0);
438 gs->addWidget(m_timeToHideOnMouseOut, 0, 1);
439 connect(m_hideOnMouseOut, SIGNAL(stateChanged(int)), this, SLOT(changed()));
440 connect(m_timeToHideOnMouseOut, SIGNAL(valueChanged (int)), this, SLOT(changed()));
441 // subSysLay->addWidget(
443 // Show Main Window when Mouse Hovers over the System Tray Icon for Some Time:
444 m_timeToShowOnMouseIn = new KIntNumInput(0, m_systray);
445 m_showOnMouseIn = new QCheckBox(i18n("Show &main window when mouse hovers over the system tray icon for"), m_systray);
446 m_timeToShowOnMouseIn->setRange(0, 600, 1, false);
447 m_timeToShowOnMouseIn->setSuffix(i18n(" tenths of seconds"));
448 gs->addWidget(m_showOnMouseIn, 1, 0);
449 gs->addWidget(m_timeToShowOnMouseIn, 1, 1);
450 connect(m_showOnMouseIn, SIGNAL(stateChanged(int)), this, SLOT(changed()));
451 connect(m_timeToShowOnMouseIn, SIGNAL(valueChanged (int)), this, SLOT(changed()));
453 connect( m_hideOnMouseOut, SIGNAL(toggled(bool)), m_timeToHideOnMouseOut, SLOT(setEnabled(bool)) );
454 connect( m_showOnMouseIn, SIGNAL(toggled(bool)), m_timeToShowOnMouseIn, SLOT(setEnabled(bool)) );
456 connect( m_useSystray, SIGNAL(toggled(bool)), m_systray, SLOT(setEnabled(bool)) );
458 layout->insertStretch(-1);
459 load();
462 void GeneralPage::load()
464 m_treeOnLeft->setCurrentItem( (int)!Settings::treeOnLeft() );
465 m_filterOnTop->setCurrentItem( (int)!Settings::filterOnTop() );
467 m_usePassivePopup->setChecked(Settings::usePassivePopup());
469 m_useSystray->setChecked( Settings::useSystray() );
470 m_systray->setEnabled( Settings::useSystray() );
472 m_showIconInSystray->setChecked( Settings::showIconInSystray() );
474 m_hideOnMouseOut->setChecked( Settings::hideOnMouseOut() );
475 m_timeToHideOnMouseOut->setValue( Settings::timeToHideOnMouseOut() );
476 m_timeToHideOnMouseOut->setEnabled( Settings::hideOnMouseOut() );
478 m_showOnMouseIn->setChecked( Settings::showOnMouseIn() );
479 m_timeToShowOnMouseIn->setValue( Settings::timeToShowOnMouseIn() );
480 m_timeToShowOnMouseIn->setEnabled( Settings::showOnMouseIn() );
485 void GeneralPage::save()
487 Settings::setTreeOnLeft( ! m_treeOnLeft->currentItem() );
488 Settings::setFilterOnTop( ! m_filterOnTop->currentItem() );
490 Settings::setUsePassivePopup( m_usePassivePopup->isChecked() );
492 Settings::setUseSystray( m_useSystray->isChecked() );
493 Settings::setShowIconInSystray( m_showIconInSystray->isChecked() );
494 Settings::setShowOnMouseIn( m_showOnMouseIn->isChecked() );
495 Settings::setTimeToShowOnMouseIn( m_timeToShowOnMouseIn->value() );
496 Settings::setHideOnMouseOut( m_hideOnMouseOut->isChecked() );
497 Settings::setTimeToHideOnMouseOut( m_timeToHideOnMouseOut->value() );
500 void GeneralPage::defaults()
502 // TODO
505 /** BasketsPage */
507 BasketsPage::BasketsPage(QWidget * parent, const char * name)
508 : KCModule(parent, name)
510 Q3VBoxLayout *layout = new Q3VBoxLayout(this, /*margin=*/0, KDialogBase::spacingHint());
511 Q3HBoxLayout *hLay;
512 HelpLabel *hLabel;
514 // Appearance:
516 Q3GroupBox *appearanceBox = new Q3GroupBox(3, Qt::Vertical, i18n("Appearance"), this);
517 layout->addWidget(appearanceBox);
519 m_playAnimations = new QCheckBox(i18n("Ani&mate changes in baskets"), appearanceBox);
520 connect( m_playAnimations, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
522 m_showNotesToolTip = new QCheckBox(i18n("&Show tooltips in baskets"), appearanceBox);
523 connect( m_showNotesToolTip, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
525 m_bigNotes = new QCheckBox(i18n("&Big notes"), appearanceBox);
526 connect( m_bigNotes, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
528 // Behavior:
530 Q3GroupBox *behaviorBox = new Q3GroupBox(5, Qt::Vertical, i18n("Behavior"), this);
531 layout->addWidget(behaviorBox);
533 m_autoBullet = new QCheckBox(i18n("&Transform lines starting with * or - to lists in text editors"), behaviorBox);
534 connect( m_autoBullet, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
536 m_confirmNoteDeletion = new QCheckBox(i18n("Ask confirmation before &deleting notes"), behaviorBox);
537 connect( m_confirmNoteDeletion, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
539 QWidget *widget = new QWidget(behaviorBox);
540 hLay = new Q3HBoxLayout(widget, /*margin=*/0, KDialogBase::spacingHint());
541 m_exportTextTags = new QCheckBox(i18n("&Export tags in texts"), widget);
542 connect( m_exportTextTags, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
544 QPixmap pixmapHelp(KGlobal::dirs()->findResource("data", "basket/images/tag_export_help.png"));
545 Q3MimeSourceFactory::defaultFactory()->setPixmap("__resource_help_tag_export.png", pixmapHelp);
546 hLabel = new HelpLabel(
547 i18n("When does this apply?"),
548 "<p>" + i18n("It does apply when you copy and paste, or drag and drop notes to a text editor.") + "</p>" +
549 "<p>" + i18n("If enabled, this property lets you paste the tags as textual equivalents.") + "<br>" +
550 i18n("For instance, a list of notes with the <b>To Do</b> and <b>Done</b> tags are exported as lines preceded by <b>[ ]</b> or <b>[x]</b>, "
551 "representing an empty checkbox and a checked box.") + "</p>" +
552 "<p align='center'><img src=\"__resource_help_tag_export.png\"></p>",
553 widget);
554 hLay->addWidget(m_exportTextTags);
555 hLay->addWidget(hLabel);
556 hLay->addStretch();
558 m_groupOnInsertionLineWidget = new QWidget(behaviorBox);
559 Q3HBoxLayout *hLayV = new Q3HBoxLayout(m_groupOnInsertionLineWidget, /*margin=*/0, KDialogBase::spacingHint());
560 m_groupOnInsertionLine = new QCheckBox(i18n("&Group a new note when clicking on the right of the insertion line"), m_groupOnInsertionLineWidget);
561 QPixmap pixmap(KGlobal::dirs()->findResource("data", "basket/images/insertion_help.png"));
562 Q3MimeSourceFactory::defaultFactory()->setPixmap("__resource_help_insertion_line.png", pixmap);
563 HelpLabel *helpV = new HelpLabel(
564 i18n("How to group a new note?"),
565 i18n("<p>When this option is enabled, the insertion-line not only allows you to insert notes at the cursor position, but also allows you to group a new note with the one under the cursor:</p>") +
566 "<p align='center'><img src=\"__resource_help_insertion_line.png\"></p>" +
567 i18n("<p>Place your mouse between notes, where you want to add a new one.<br>"
568 "Click on the <b>left</b> of the insertion-line middle-mark to <b>insert</b> a note.<br>"
569 "Click on the <b>right</b> to <b>group</b> a note, with the one <b>below or above</b>, depending on where your mouse is.</p>"),
570 m_groupOnInsertionLineWidget);
571 hLayV->addWidget(m_groupOnInsertionLine);
572 hLayV->addWidget(helpV);
573 hLayV->insertStretch(-1);
574 layout->addWidget(m_groupOnInsertionLineWidget);
575 connect(m_groupOnInsertionLine, SIGNAL(stateChanged(int)), this, SLOT(changed()));
577 widget = new QWidget(behaviorBox);
578 Q3GridLayout *ga = new Q3GridLayout(widget, /*nRows=*/3, /*nCols=*/4, /*margin=*/0, KDialogBase::spacingHint());
579 ga->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), 0, 3);
581 m_middleAction = new QComboBox(widget);
582 m_middleAction->insertItem( i18n("Do nothing") );
583 m_middleAction->insertItem( i18n("Paste clipboard") );
584 m_middleAction->insertItem( i18n("Insert image note") );
585 m_middleAction->insertItem( i18n("Insert link note") );
586 m_middleAction->insertItem( i18n("Insert launcher note") );
587 m_middleAction->insertItem( i18n("Insert color note") );
588 m_middleAction->insertItem( i18n("Grab screen zone") );
589 m_middleAction->insertItem( i18n("Insert color from screen") );
590 m_middleAction->insertItem( i18n("Load note from file") );
591 m_middleAction->insertItem( i18n("Import Launcher from KDE Menu") );
592 m_middleAction->insertItem( i18n("Import icon") );
593 QLabel *labelM = new QLabel(m_middleAction, i18n("&Shift+middle-click anywhere:"), widget);
594 ga->addWidget(labelM, 0, 0);
595 ga->addWidget(m_middleAction, 0, 1);
596 ga->addWidget(new QLabel(i18n("at cursor position"), widget), 0, 2);
597 connect( m_middleAction, SIGNAL(activated(int)), this, SLOT(changed()) );
599 // Protection:
601 Q3GroupBox *protectionBox = new Q3GroupBox(3, Qt::Vertical, i18n("Password Protection"), this);
602 layout->addWidget(protectionBox);
603 widget = new QWidget(protectionBox);
605 // Re-Lock timeout configuration
606 hLay = new Q3HBoxLayout(widget, /*margin=*/0, KDialogBase::spacingHint());
607 m_enableReLockTimeoutMinutes = new QCheckBox(i18n("A&utomatically lock protected baskets when closed for"), widget);
608 hLay->addWidget(m_enableReLockTimeoutMinutes);
609 m_reLockTimeoutMinutes = new KIntNumInput(widget);
610 m_reLockTimeoutMinutes->setMinValue(0);
611 m_reLockTimeoutMinutes->setSuffix(i18n(" minutes"));
612 hLay->addWidget(m_reLockTimeoutMinutes);
613 //label = new QLabel(i18n("minutes"), this);
614 //hLay->addWidget(label);
615 hLay->addStretch();
616 // layout->addLayout(hLay);
617 connect( m_enableReLockTimeoutMinutes, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
618 connect( m_reLockTimeoutMinutes, SIGNAL(valueChanged(int)), this, SLOT(changed()) );
619 connect( m_enableReLockTimeoutMinutes, SIGNAL(toggled(bool)), m_reLockTimeoutMinutes, SLOT(setEnabled(bool)) );
621 #ifdef HAVE_LIBGPGME
622 m_useGnuPGAgent = new QCheckBox(i18n("Use GnuPG agent for &private/public key protected baskets"), protectionBox);
623 // hLay->addWidget(m_useGnuPGAgent);
624 connect( m_useGnuPGAgent, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
625 #endif
627 layout->insertStretch(-1);
628 load();
631 void BasketsPage::load()
633 m_playAnimations->setChecked(Settings::playAnimations());
634 m_showNotesToolTip->setChecked(Settings::showNotesToolTip());
635 m_bigNotes->setChecked(Settings::bigNotes());
637 m_autoBullet->setChecked(Settings::autoBullet());
638 m_confirmNoteDeletion->setChecked(Settings::confirmNoteDeletion());
639 m_exportTextTags->setChecked(Settings::exportTextTags());
641 m_groupOnInsertionLine->setChecked(Settings::groupOnInsertionLine());
642 m_middleAction->setCurrentItem(Settings::middleAction());
644 // The correctness of this code depends on the default of enableReLockTimeout
645 // being true - otherwise, the reLockTimeoutMinutes widget is not disabled properly.
646 m_enableReLockTimeoutMinutes->setChecked(Settings::enableReLockTimeout());
647 m_reLockTimeoutMinutes->setValue(Settings::reLockTimeoutMinutes());
648 #ifdef HAVE_LIBGPGME
649 m_useGnuPGAgent->setChecked(Settings::useGnuPGAgent());
651 if (KGpgMe::isGnuPGAgentAvailable()) {
652 m_useGnuPGAgent->setChecked(Settings::useGnuPGAgent());
653 } else {
654 m_useGnuPGAgent->setChecked(false);
655 m_useGnuPGAgent->setEnabled(false);
657 #endif
660 void BasketsPage::save()
662 Settings::setPlayAnimations( m_playAnimations->isChecked() );
663 Settings::setShowNotesToolTip( m_showNotesToolTip->isChecked() );
664 Settings::setBigNotes( m_bigNotes->isChecked() );
666 Settings::setAutoBullet( m_autoBullet->isChecked() );
667 Settings::setConfirmNoteDeletion( m_confirmNoteDeletion->isChecked() );
668 Settings::setExportTextTags( m_exportTextTags->isChecked() );
670 Settings::setGroupOnInsertionLine( m_groupOnInsertionLine->isChecked() );
671 Settings::setMiddleAction( m_middleAction->currentItem() );
673 Settings::setEnableReLockTimeout( m_enableReLockTimeoutMinutes->isChecked());
674 Settings::setReLockTimeoutMinutes(m_reLockTimeoutMinutes->value());
675 #ifdef HAVE_LIBGPGME
676 Settings::setUseGnuPGAgent( m_useGnuPGAgent->isChecked() );
677 #endif
680 void BasketsPage::defaults()
682 // TODO
685 /** class NewNotesPage: */
687 NewNotesPage::NewNotesPage(QWidget * parent, const char * name)
688 : KCModule(parent, name)
690 Q3VBoxLayout *layout = new Q3VBoxLayout(this, /*margin=*/0, KDialogBase::spacingHint());
691 Q3HBoxLayout *hLay;
692 QLabel *label;
694 // Place of New Notes:
696 hLay = new Q3HBoxLayout(0L, /*margin=*/0, KDialogBase::spacingHint());
697 m_newNotesPlace = new QComboBox(this);
698 label = new QLabel(m_newNotesPlace, i18n("&Place of new notes:"), this);
699 m_newNotesPlace->insertItem(i18n("On top"));
700 m_newNotesPlace->insertItem(i18n("On bottom"));
701 m_newNotesPlace->insertItem(i18n("At current note"));
702 hLay->addWidget(label);
703 hLay->addWidget(m_newNotesPlace);
704 hLay->addStretch();
705 //layout->addLayout(hLay);
706 label->hide();
707 m_newNotesPlace->hide();
708 connect( m_newNotesPlace, SIGNAL(textChanged(const QString &)), this, SLOT(changed()) );
710 // New Images Size:
712 hLay = new Q3HBoxLayout(0L, /*margin=*/0, KDialogBase::spacingHint());
713 m_imgSizeX = new KIntNumInput(this);
714 m_imgSizeX->setMinValue(1);
715 m_imgSizeX->setMaxValue(4096);
716 m_imgSizeX->setReferencePoint(100);
717 connect( m_imgSizeX, SIGNAL(valueChanged(int)), this, SLOT(changed()) );
718 label = new QLabel(m_imgSizeX, i18n("&New images size:"), this);
719 hLay->addWidget(label);
720 hLay->addWidget(m_imgSizeX);
721 m_imgSizeY = new KIntNumInput(this);
722 m_imgSizeY->setMinValue(1);
723 m_imgSizeY->setMaxValue(4096);
724 m_imgSizeY->setReferencePoint(100);
725 connect( m_imgSizeY, SIGNAL(valueChanged(int)), this, SLOT(changed()) );
726 label = new QLabel(m_imgSizeY, i18n("&by"), this);
727 hLay->addWidget(label);
728 hLay->addWidget(m_imgSizeY);
729 label = new QLabel(i18n("pixels"), this);
730 hLay->addWidget(label);
731 m_pushVisualize = new QPushButton(i18n("&Visualize..."), this);
732 hLay->addWidget(m_pushVisualize);
733 hLay->addStretch();
734 layout->addLayout(hLay);
735 connect( m_pushVisualize, SIGNAL(clicked()), this, SLOT(visualize()) );
737 // View File Content:
739 Q3VButtonGroup *buttonGroup = new Q3VButtonGroup(i18n("View Content of Added Files for the Following Types"), this);
740 m_viewTextFileContent = new QCheckBox( i18n("&Plain text"), buttonGroup );
741 m_viewHtmlFileContent = new QCheckBox( i18n("&HTML page"), buttonGroup );
742 m_viewImageFileContent = new QCheckBox( i18n("&Image or animation"), buttonGroup );
743 m_viewSoundFileContent = new QCheckBox( i18n("&Sound"), buttonGroup );
744 layout->addWidget(buttonGroup);
745 connect( m_viewTextFileContent, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
746 connect( m_viewHtmlFileContent, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
747 connect( m_viewImageFileContent, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
748 connect( m_viewSoundFileContent, SIGNAL(stateChanged(int)), this, SLOT(changed()) );
750 layout->insertStretch(-1);
751 load();
754 void NewNotesPage::load()
756 m_newNotesPlace->setCurrentItem(Settings::newNotesPlace());
758 m_imgSizeX->setValue(Settings::defImageX());
759 m_imgSizeY->setValue(Settings::defImageY());
761 m_viewTextFileContent->setChecked( Settings::viewTextFileContent() );
762 m_viewHtmlFileContent->setChecked( Settings::viewHtmlFileContent() );
763 m_viewImageFileContent->setChecked( Settings::viewImageFileContent() );
764 m_viewSoundFileContent->setChecked( Settings::viewSoundFileContent() );
767 void NewNotesPage::save()
769 Settings::setNewNotesPlace(m_newNotesPlace->currentItem());
771 Settings::setDefImageX(m_imgSizeX->value());
772 Settings::setDefImageY(m_imgSizeY->value());
774 Settings::setViewTextFileContent( m_viewTextFileContent->isChecked() );
775 Settings::setViewHtmlFileContent( m_viewHtmlFileContent->isChecked() );
776 Settings::setViewImageFileContent( m_viewImageFileContent->isChecked() );
777 Settings::setViewSoundFileContent( m_viewSoundFileContent->isChecked() );
780 void NewNotesPage::defaults()
782 // TODO
785 void NewNotesPage::visualize()
787 ViewSizeDialog size(this, m_imgSizeX->value(), m_imgSizeY->value());
788 size.exec();
789 m_imgSizeX->setValue(size.width());
790 m_imgSizeY->setValue(size.height());
793 /** class NotesAppearancePage: */
795 NotesAppearancePage::NotesAppearancePage(QWidget * parent, const char * name)
796 : KCModule(parent, name)
798 Q3VBoxLayout *layout = new Q3VBoxLayout(this, /*margin=*/0, KDialogBase::spacingHint());
799 QTabWidget *tabs = new QTabWidget(this);
800 layout->addWidget(tabs);
802 m_soundLook = new LinkLookEditWidget(this, i18n("Conference audio record"), "sound", tabs);
803 m_fileLook = new LinkLookEditWidget(this, i18n("Annual report"), "document", tabs);
804 m_localLinkLook = new LinkLookEditWidget(this, i18n("Home folder"), "folder_home", tabs);
805 m_networkLinkLook = new LinkLookEditWidget(this, "www.kde.org", KMimeType::iconForURL("http://www.kde.org"), tabs);
806 m_launcherLook = new LinkLookEditWidget(this, i18n("Launch %1").arg(kapp->aboutData()->programName()), "basket", tabs);
807 tabs->addTab(m_soundLook, i18n("&Sounds") );
808 tabs->addTab(m_fileLook, i18n("&Files") );
809 tabs->addTab(m_localLinkLook, i18n("&Local Links") );
810 tabs->addTab(m_networkLinkLook, i18n("&Network Links"));
811 tabs->addTab(m_launcherLook, i18n("Launc&hers") );
813 load();
816 void NotesAppearancePage::load()
818 m_soundLook->set(LinkLook::soundLook);
819 m_fileLook->set(LinkLook::fileLook);
820 m_localLinkLook->set(LinkLook::localLinkLook);
821 m_networkLinkLook->set(LinkLook::networkLinkLook);
822 m_launcherLook->set(LinkLook::launcherLook);
825 void NotesAppearancePage::save()
827 m_soundLook->saveChanges();
828 m_fileLook->saveChanges();
829 m_localLinkLook->saveChanges();
830 m_networkLinkLook->saveChanges();
831 m_launcherLook->saveChanges();
832 Global::bnpView->linkLookChanged();
835 void NotesAppearancePage::defaults()
837 // TODO
840 /** class ApplicationsPage: */
842 ApplicationsPage::ApplicationsPage(QWidget * parent, const char * name)
843 : KCModule(parent, name)
845 /* Applications page */
846 Q3VBoxLayout *layout = new Q3VBoxLayout(this, /*margin=*/0, KDialogBase::spacingHint());
848 m_htmlUseProg = new QCheckBox(i18n("Open &text notes with a custom application:"), this);
849 m_htmlProg = new RunCommandRequester("", i18n("Open text notes with:"), this);
850 Q3HBoxLayout *hLayH = new Q3HBoxLayout(0L, /*margin=*/0, KDialogBase::spacingHint());
851 hLayH->insertSpacing(-1, 20);
852 hLayH->addWidget(m_htmlProg);
853 connect(m_htmlUseProg, SIGNAL(stateChanged(int)), this, SLOT(changed()));
854 connect(m_htmlProg->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(changed()));
856 m_imageUseProg = new QCheckBox(i18n("Open &image notes with a custom application:"), this);
857 m_imageProg = new RunCommandRequester("", i18n("Open image notes with:"), this);
858 Q3HBoxLayout *hLayI = new Q3HBoxLayout(0L, /*margin=*/0, KDialogBase::spacingHint());
859 hLayI->insertSpacing(-1, 20);
860 hLayI->addWidget(m_imageProg);
861 connect(m_imageUseProg, SIGNAL(stateChanged(int)), this, SLOT(changed()));
862 connect(m_imageProg->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(changed()));
864 m_animationUseProg = new QCheckBox(i18n("Open a&nimation notes with a custom application:"), this);
865 m_animationProg = new RunCommandRequester("", i18n("Open animation notes with:"), this);
866 Q3HBoxLayout *hLayA = new Q3HBoxLayout(0L, /*margin=*/0, KDialogBase::spacingHint());
867 hLayA->insertSpacing(-1, 20);
868 hLayA->addWidget(m_animationProg);
869 connect(m_animationUseProg, SIGNAL(stateChanged(int)), this, SLOT(changed()));
870 connect(m_animationProg->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(changed()));
872 m_soundUseProg = new QCheckBox(i18n("Open so&und notes with a custom application:"), this);
873 m_soundProg = new RunCommandRequester("", i18n("Open sound notes with:"), this);
874 Q3HBoxLayout *hLayS = new Q3HBoxLayout(0L, /*margin=*/0, KDialogBase::spacingHint());
875 hLayS->insertSpacing(-1, 20);
876 hLayS->addWidget(m_soundProg);
877 connect(m_soundUseProg, SIGNAL(stateChanged(int)), this, SLOT(changed()));
878 connect(m_soundProg->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(changed()));
880 QString whatsthis = i18n(
881 "<p>If checked, the application defined below will be used when opening that type of note.</p>"
882 "<p>Otherwise, the application you've configured in Konqueror will be used.</p>");
884 Q3WhatsThis::add(m_htmlUseProg, whatsthis);
885 Q3WhatsThis::add(m_imageUseProg, whatsthis);
886 Q3WhatsThis::add(m_animationUseProg, whatsthis);
887 Q3WhatsThis::add(m_soundUseProg, whatsthis);
889 whatsthis = i18n(
890 "<p>Define the application to use for opening that type of note instead of the "
891 "application configured in Konqueror.</p>");
893 Q3WhatsThis::add(m_htmlProg, whatsthis);
894 Q3WhatsThis::add(m_imageProg, whatsthis);
895 Q3WhatsThis::add(m_animationProg, whatsthis);
896 Q3WhatsThis::add(m_soundProg, whatsthis);
898 layout->addWidget(m_htmlUseProg);
899 layout->addItem(hLayH);
900 layout->addWidget(m_imageUseProg);
901 layout->addItem(hLayI);
902 layout->addWidget(m_animationUseProg);
903 layout->addItem(hLayA);
904 layout->addWidget(m_soundUseProg);
905 layout->addItem(hLayS);
907 layout->addSpacing(KDialogBase::spacingHint());
909 Q3HBoxLayout *hLay = new Q3HBoxLayout(0L, /*margin=*/0, /*spacing=*/0);
910 HelpLabel *hl1 = new HelpLabel(
911 i18n("How to change the application used to open Web links?"),
912 i18n("<p>When opening Web links, they are opened in different applications, depending on the content of the link "
913 "(a Web page, an image, a PDF document...), such as if they were files on your computer.</p>"
914 "<p>Here is how to do if you want every Web addresses to be opened in your Web browser. "
915 "It is useful if you are not using KDE (if you are using eg. GNOME, XFCE...).</p>"
916 "<ul>"
917 "<li>Open the KDE Control Center (if it is not available, try to type \"kcontrol\" in a command line terminal);</li>"
918 "<li>Go to the \"KDE Components\" and then \"Components Selector\" section;</li>"
919 "<li>Choose \"Web Browser\", check \"In the following browser:\" and enter the name of your Web browser (like \"firefox\" or \"epiphany\").</li>"
920 "</ul>"
921 "<p>Now, when you click <i>any</i> link that start with \"http://...\", it will be opened in your Web browser (eg. Mozilla Firefox or Epiphany or...).</p>"
922 "<p>For more fine-grained configuration (like opening only Web pages in your Web browser), read the second help link.</p>"),
923 this);
924 hLay->addWidget(hl1);
925 hLay->addStretch();
926 layout->addLayout(hLay);
928 hLay = new Q3HBoxLayout(0L, /*margin=*/0, /*spacing=*/0);
929 HelpLabel *hl2 = new HelpLabel(
930 i18n("How to change the applications used to open files and links?"),
931 i18n("<p>Here is how to set the application to be used for each type of file. "
932 "This also applies to Web links if you choose not to open them systematically in a Web browser (see the first help link). "
933 "The default settings should be good enough for you, but this tip is useful if you are using GNOME, XFCE, or another environment than KDE.</p>"
934 "<p>This is an example of how to open HTML pages in your Web browser (and keep using the other applications for other addresses or files). "
935 "Repeat these steps for each type of file you want to open in a specific application.</p>"
936 "<ul>"
937 "<li>Open the KDE Control Center (if it is not available, try to type \"kcontrol\" in a command line terminal);</li>"
938 "<li>Go to the \"KDE Components\" and then \"File Associations\" section;</li>"
939 "<li>In the tree, expand \"text\" and click \"html\";</li>"
940 "<li>In the applications list, add your Web browser as the first entry;</li>"
941 "<li>Do the same for the type \"application -> xhtml+xml\".</li>"
942 "</ul>"),
943 this);
944 hLay->addWidget(hl2);
945 hLay->addStretch();
946 layout->addLayout(hLay);
948 connect( m_htmlUseProg, SIGNAL(toggled(bool)), m_htmlProg, SLOT(setEnabled(bool)) );
949 connect( m_imageUseProg, SIGNAL(toggled(bool)), m_imageProg, SLOT(setEnabled(bool)) );
950 connect( m_animationUseProg, SIGNAL(toggled(bool)), m_animationProg, SLOT(setEnabled(bool)) );
951 connect( m_soundUseProg, SIGNAL(toggled(bool)), m_soundProg, SLOT(setEnabled(bool)) );
953 layout->insertStretch(-1);
954 load();
957 void ApplicationsPage::load()
959 m_htmlProg->setRunCommand(Settings::htmlProg());
960 m_htmlUseProg->setChecked(Settings::isHtmlUseProg());
961 m_htmlProg->setEnabled(Settings::isHtmlUseProg());
963 m_imageProg->setRunCommand(Settings::imageProg());
964 m_imageUseProg->setChecked(Settings::isImageUseProg());
965 m_imageProg->setEnabled(Settings::isImageUseProg());
967 m_animationProg->setRunCommand(Settings::animationProg());
968 m_animationUseProg->setChecked(Settings::isAnimationUseProg());
969 m_animationProg->setEnabled(Settings::isAnimationUseProg());
971 m_soundProg->setRunCommand(Settings::soundProg());
972 m_soundUseProg->setChecked(Settings::isSoundUseProg());
973 m_soundProg->setEnabled(Settings::isSoundUseProg());
976 void ApplicationsPage::save()
978 Settings::setIsHtmlUseProg( m_htmlUseProg->isChecked() );
979 Settings::setHtmlProg( m_htmlProg->runCommand() );
981 Settings::setIsImageUseProg( m_imageUseProg->isChecked() );
982 Settings::setImageProg( m_imageProg->runCommand() );
984 Settings::setIsAnimationUseProg( m_animationUseProg->isChecked() );
985 Settings::setAnimationProg( m_animationProg->runCommand() );
987 Settings::setIsSoundUseProg( m_soundUseProg->isChecked() );
988 Settings::setSoundProg( m_soundProg->runCommand() );
991 void ApplicationsPage::defaults()
993 // TODO
996 #include "settings.moc"