File indexing completed on 2024-04-21 05:48:26

0001 /**
0002  * SPDX-FileCopyrightText: (C) 2003 Sébastien Laoût <slaout@linux62.org>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "settings.h"
0008 
0009 #include <QCheckBox>
0010 #include <QDate>
0011 #include <QFormLayout>
0012 #include <QGridLayout>
0013 #include <QGroupBox>
0014 #include <QGuiApplication>
0015 #include <QHBoxLayout>
0016 #include <QLabel>
0017 #include <QLineEdit>
0018 #include <QLocale>
0019 #include <QMimeDatabase>
0020 #include <QMimeType>
0021 #include <QPushButton>
0022 #include <QSpinBox>
0023 #include <QTabWidget>
0024 #include <QUrl>
0025 #include <QVBoxLayout>
0026 
0027 #include <kcmutils_version.h>
0028 #include <KConfig>
0029 #include <KConfigGroup>
0030 #include <KPluginLoader>
0031 #include <KPluginMetaData>
0032 #include <KIO/Global>
0033 #include <KLocalizedString>
0034 
0035 #include "aboutdata.h"
0036 #include "basketscene.h"
0037 #include "kgpgme.h"
0038 #include "linklabel.h"
0039 #include "variouswidgets.h"
0040 
0041 /** Settings */
0042 
0043 // General:                                      // TODO: Use this grouping everywhere!
0044 bool Settings::s_showNotesToolTip = true; // TODO: RENAME: useBasketTooltips
0045 bool Settings::s_confirmNoteDeletion = true;
0046 bool Settings::s_bigNotes = false;
0047 bool Settings::s_autoBullet = true;
0048 bool Settings::s_pasteAsPlainText = false;
0049 bool Settings::s_exportTextTags = true;
0050 bool Settings::s_detectTextTags = true;
0051 bool Settings::s_useGnuPGAgent = false;
0052 bool Settings::s_treeOnLeft = true;
0053 bool Settings::s_filterOnTop = false;
0054 int Settings::s_defImageX = 300;
0055 int Settings::s_defImageY = 200;
0056 bool Settings::s_enableReLockTimeout = true;
0057 int Settings::s_reLockTimeoutMinutes = 0;
0058 int Settings::s_newNotesPlace = 1;
0059 int Settings::s_viewTextFileContent = false;
0060 int Settings::s_viewHtmlFileContent = false;
0061 int Settings::s_viewImageFileContent = false;
0062 int Settings::s_viewSoundFileContent = false;
0063 // Applications:
0064 bool Settings::s_htmlUseProg = false; // TODO: RENAME: s_*App (with KService!)
0065 bool Settings::s_imageUseProg = true;
0066 bool Settings::s_animationUseProg = true;
0067 bool Settings::s_soundUseProg = false;
0068 QString Settings::s_htmlProg = "quanta";
0069 QString Settings::s_imageProg = "kolourpaint";
0070 QString Settings::s_animationProg = "gimp";
0071 QString Settings::s_soundProg = QString();
0072 // Addictive Features:
0073 bool Settings::s_groupOnInsertionLine = false;
0074 int Settings::s_middleAction = 0;
0075 // Rememberings:
0076 int Settings::s_defIconSize = 32; // TODO: RENAME: importIconSize
0077 bool Settings::s_blinkedFilter = false;
0078 int Settings::s_basketTreeWidth = -1;
0079 bool Settings::s_welcomeBasketsAdded = false;
0080 QString Settings::s_dataFolder = QString();
0081 QDate Settings::s_lastBackup = QDate();
0082 QPoint Settings::s_mainWindowPosition = QPoint();
0083 QSize Settings::s_mainWindowSize = QSize();
0084 bool Settings::s_showEmptyBasketInfo = true;
0085 bool Settings::s_spellCheckTextNotes = true;
0086 // Version Sync
0087 bool Settings::s_versionSyncEnabled = false;
0088 
0089 void Settings::loadConfig()
0090 {
0091     LinkLook defaultSoundLook;
0092     LinkLook defaultFileLook;
0093     LinkLook defaultLocalLinkLook;
0094     LinkLook defaultNetworkLinkLook;
0095     LinkLook defaultLauncherLook; /* italic  bold    underlining                color      hoverColor  iconSize  preview */
0096     LinkLook defaultCrossReferenceLook;
0097 
0098     defaultSoundLook.setLook(false, false, LinkLook::Never, QColor(), QColor(), 32, LinkLook::None);
0099     defaultFileLook.setLook(false, false, LinkLook::Never, QColor(), QColor(), 32, LinkLook::TwiceIconSize);
0100     defaultLocalLinkLook.setLook(true, false, LinkLook::OnMouseHover, QColor(), QColor(), 22, LinkLook::TwiceIconSize);
0101     defaultNetworkLinkLook.setLook(false, false, LinkLook::OnMouseOutside, QColor(), QColor(), 16, LinkLook::None);
0102     defaultLauncherLook.setLook(false, true, LinkLook::Never, QColor(), QColor(), 48, LinkLook::None);
0103     defaultCrossReferenceLook.setLook(false, false, LinkLook::OnMouseHover, QColor(), QColor(), 16, LinkLook::None);
0104 
0105     loadLinkLook(LinkLook::soundLook, "Sound Look", defaultSoundLook);
0106     loadLinkLook(LinkLook::fileLook, "File Look", defaultFileLook);
0107     loadLinkLook(LinkLook::localLinkLook, "Local Link Look", defaultLocalLinkLook);
0108     loadLinkLook(LinkLook::networkLinkLook, "Network Link Look", defaultNetworkLinkLook);
0109     loadLinkLook(LinkLook::launcherLook, "Launcher Look", defaultLauncherLook);
0110     loadLinkLook(LinkLook::crossReferenceLook, "Cross Reference Look", defaultCrossReferenceLook);
0111 
0112     KConfigGroup config = Global::config()->group("Main window"); // TODO: Split with a "System tray icon" group !
0113     setTreeOnLeft(config.readEntry("treeOnLeft", true));
0114     setFilterOnTop(config.readEntry("filterOnTop", false));
0115     setShowNotesToolTip(config.readEntry("showNotesToolTip", true));
0116     setBigNotes(config.readEntry("bigNotes", false));
0117     setConfirmNoteDeletion(config.readEntry("confirmNoteDeletion", true));
0118     setPasteAsPlainText(config.readEntry("pasteAsPlainText", false));
0119     setAutoBullet(config.readEntry("autoBullet", true));
0120     setExportTextTags(config.readEntry("exportTextTags", true));
0121     setDetectTextTags(config.readEntry("detectTextTags", true));
0122     setUseGnuPGAgent(config.readEntry("useGnuPGAgent", false));
0123     setBlinkedFilter(config.readEntry("blinkedFilter", false));
0124     setEnableReLockTimeout(config.readEntry("enableReLockTimeout", true));
0125     setReLockTimeoutMinutes(config.readEntry("reLockTimeoutMinutes", 0));
0126     setMiddleAction(config.readEntry("middleAction", 0));
0127     setGroupOnInsertionLine(config.readEntry("groupOnInsertionLine", false));
0128     setSpellCheckTextNotes(config.readEntry("spellCheckTextNotes", true));
0129     setBasketTreeWidth(config.readEntry("basketTreeWidth", -1));
0130     setWelcomeBasketsAdded(config.readEntry("welcomeBasketsAdded", false));
0131     setDataFolder(config.readEntry("dataFolder", QString()));
0132     setLastBackup(config.readEntry("lastBackup", QDate()));
0133     setMainWindowPosition(config.readEntry("position", QPoint()));
0134     setMainWindowSize(config.readEntry("size", QSize()));
0135 
0136     config = Global::config()->group("Notification Messages");
0137     setShowEmptyBasketInfo(config.readEntry("emptyBasketInfo", true));
0138 
0139     config = Global::config()->group("Programs");
0140     setIsHtmlUseProg(config.readEntry("htmlUseProg", false));
0141     setIsImageUseProg(config.readEntry("imageUseProg", true));
0142     setIsAnimationUseProg(config.readEntry("animationUseProg", true));
0143     setIsSoundUseProg(config.readEntry("soundUseProg", false));
0144     setHtmlProg(config.readEntry("htmlProg", "quanta"));
0145     setImageProg(config.readEntry("imageProg", "kolourpaint"));
0146     setAnimationProg(config.readEntry("animationProg", "gimp"));
0147     setSoundProg(config.readEntry("soundProg", QString()));
0148 
0149     config = Global::config()->group("Note Addition");
0150     setNewNotesPlace(config.readEntry("newNotesPlace", 1));
0151     setViewTextFileContent(config.readEntry("viewTextFileContent", false));
0152     setViewHtmlFileContent(config.readEntry("viewHtmlFileContent", false));
0153     setViewImageFileContent(config.readEntry("viewImageFileContent", true));
0154     setViewSoundFileContent(config.readEntry("viewSoundFileContent", true));
0155 
0156     config = Global::config()->group("Insert Note Default Values");
0157     setDefImageX(config.readEntry("defImageX", 300));
0158     setDefImageY(config.readEntry("defImageY", 200));
0159     setDefIconSize(config.readEntry("defIconSize", 32));
0160 
0161     config = Global::config()->group("MainWindow Toolbar mainToolBar");
0162     // The first time we start, we define "Text Alongside Icons" for the main toolbar.
0163     // After that, the user is free to hide the text from the icons or customize as he/she want.
0164     // But it is a good default (Fitt's Laws, better looking, less "empty"-feeling), especially for this application.
0165     //  if (!config->readEntry("alreadySetIconTextRight", false)) {
0166     //      config->writeEntry( "IconText",                "IconTextRight" );
0167     //      config->writeEntry( "alreadySetIconTextRight", true            );
0168     //  }
0169     if (!config.readEntry("alreadySetToolbarSettings", false)) {
0170         config.writeEntry("IconText", "IconOnly"); // In 0.6.0 Alpha versions, it was made "IconTextRight". We're back to IconOnly
0171         config.writeEntry("Index", "0");           // Make sure the main toolbar is the first...
0172         config = Global::config()->group("MainWindow Toolbar richTextEditToolBar");
0173         config.writeEntry("Position", "Top"); // In 0.6.0 Alpha versions, it was made "Bottom"
0174         config.writeEntry("Index", "1");      // ... and the rich text toolbar is on the right of the main toolbar
0175         config = Global::config()->group("MainWindow Toolbar mainToolBar");
0176         config.writeEntry("alreadySetToolbarSettings", true);
0177     }
0178 
0179     config = Global::config()->group("Version Sync");
0180     setVersionSyncEnabled(config.readEntry("enabled", false));
0181 }
0182 
0183 void Settings::saveConfig()
0184 {
0185     saveLinkLook(LinkLook::soundLook, "Sound Look");
0186     saveLinkLook(LinkLook::fileLook, "File Look");
0187     saveLinkLook(LinkLook::localLinkLook, "Local Link Look");
0188     saveLinkLook(LinkLook::networkLinkLook, "Network Link Look");
0189     saveLinkLook(LinkLook::launcherLook, "Launcher Look");
0190     saveLinkLook(LinkLook::crossReferenceLook, "Cross Reference Look");
0191 
0192     KConfigGroup config = Global::config()->group("Main window");
0193     config.writeEntry("treeOnLeft", treeOnLeft());
0194     config.writeEntry("filterOnTop", filterOnTop());
0195     config.writeEntry("showNotesToolTip", showNotesToolTip());
0196     config.writeEntry("confirmNoteDeletion", confirmNoteDeletion());
0197     config.writeEntry("pasteAsPlainText", pasteAsPlainText());
0198     config.writeEntry("bigNotes", bigNotes());
0199     config.writeEntry("autoBullet", autoBullet());
0200     config.writeEntry("exportTextTags", exportTextTags());
0201     config.writeEntry("detectTextTags", detectTextTags());
0202 #ifdef HAVE_LIBGPGME
0203     if (KGpgMe::isGnuPGAgentAvailable())
0204         config.writeEntry("useGnuPGAgent", useGnuPGAgent());
0205 #endif
0206     config.writeEntry("blinkedFilter", blinkedFilter());
0207     config.writeEntry("enableReLockTimeout", enableReLockTimeout());
0208     config.writeEntry("reLockTimeoutMinutes", reLockTimeoutMinutes());
0209     config.writeEntry("middleAction", middleAction());
0210     config.writeEntry("groupOnInsertionLine", groupOnInsertionLine());
0211     config.writeEntry("spellCheckTextNotes", spellCheckTextNotes());
0212     config.writeEntry("basketTreeWidth", basketTreeWidth());
0213     config.writeEntry("welcomeBasketsAdded", welcomeBasketsAdded());
0214     config.writePathEntry("dataFolder", dataFolder());
0215     config.writeEntry("lastBackup", QDate(lastBackup()));
0216     config.writeEntry("position", mainWindowPosition());
0217     config.writeEntry("size", mainWindowSize());
0218 
0219     config = Global::config()->group("Notification Messages");
0220     config.writeEntry("emptyBasketInfo", showEmptyBasketInfo());
0221 
0222     config = Global::config()->group("Programs");
0223     config.writeEntry("htmlUseProg", isHtmlUseProg());
0224     config.writeEntry("imageUseProg", isImageUseProg());
0225     config.writeEntry("animationUseProg", isAnimationUseProg());
0226     config.writeEntry("soundUseProg", isSoundUseProg());
0227     config.writeEntry("htmlProg", htmlProg());
0228     config.writeEntry("imageProg", imageProg());
0229     config.writeEntry("animationProg", animationProg());
0230     config.writeEntry("soundProg", soundProg());
0231 
0232     config = Global::config()->group("Note Addition");
0233     config.writeEntry("newNotesPlace", newNotesPlace());
0234     config.writeEntry("viewTextFileContent", viewTextFileContent());
0235     config.writeEntry("viewHtmlFileContent", viewHtmlFileContent());
0236     config.writeEntry("viewImageFileContent", viewImageFileContent());
0237     config.writeEntry("viewSoundFileContent", viewSoundFileContent());
0238 
0239     config = Global::config()->group("Insert Note Default Values");
0240     config.writeEntry("defImageX", defImageX());
0241     config.writeEntry("defImageY", defImageY());
0242     config.writeEntry("defIconSize", defIconSize());
0243 
0244     config = Global::config()->group("Version Sync");
0245     config.writeEntry("enabled", versionSyncEnabled());
0246 
0247     config.sync();
0248 }
0249 
0250 void Settings::loadLinkLook(LinkLook *look, const QString &name, const LinkLook &defaultLook)
0251 {
0252     KConfigGroup config = Global::config()->group(name);
0253 
0254     QString underliningStrings[] = {"Always", "Never", "OnMouseHover", "OnMouseOutside"};
0255     QString defaultUnderliningString = underliningStrings[defaultLook.underlining()];
0256 
0257     QString previewStrings[] = {"None", "IconSize", "TwiceIconSize", "ThreeIconSize"};
0258     QString defaultPreviewString = previewStrings[defaultLook.preview()];
0259 
0260     bool italic = config.readEntry("italic", defaultLook.italic());
0261     bool bold = config.readEntry("bold", defaultLook.bold());
0262     QString underliningString = config.readEntry("underlining", defaultUnderliningString);
0263     QColor color = config.readEntry("color", defaultLook.color());
0264     QColor hoverColor = config.readEntry("hoverColor", defaultLook.hoverColor());
0265     int iconSize = config.readEntry("iconSize", defaultLook.iconSize());
0266     QString previewString = config.readEntry("preview", defaultPreviewString);
0267 
0268     int underlining = 0;
0269     if (underliningString == underliningStrings[1])
0270         underlining = 1;
0271     else if (underliningString == underliningStrings[2])
0272         underlining = 2;
0273     else if (underliningString == underliningStrings[3])
0274         underlining = 3;
0275 
0276     int preview = 0;
0277     if (previewString == previewStrings[1])
0278         preview = 1;
0279     else if (previewString == previewStrings[2])
0280         preview = 2;
0281     else if (previewString == previewStrings[3])
0282         preview = 3;
0283 
0284     look->setLook(italic, bold, underlining, color, hoverColor, iconSize, preview);
0285 }
0286 
0287 void Settings::saveLinkLook(LinkLook *look, const QString &name)
0288 {
0289     KConfigGroup config = Global::config()->group(name);
0290 
0291     QString underliningStrings[] = {"Always", "Never", "OnMouseHover", "OnMouseOutside"};
0292     QString underliningString = underliningStrings[look->underlining()];
0293 
0294     QString previewStrings[] = {"None", "IconSize", "TwiceIconSize", "ThreeIconSize"};
0295     QString previewString = previewStrings[look->preview()];
0296 
0297     config.writeEntry("italic", look->italic());
0298     config.writeEntry("bold", look->bold());
0299     config.writeEntry("underlining", underliningString);
0300     config.writeEntry("color", look->color());
0301     config.writeEntry("hoverColor", look->hoverColor());
0302     config.writeEntry("iconSize", look->iconSize());
0303     config.writeEntry("preview", previewString);
0304 }
0305 
0306 void Settings::setBigNotes(bool big)
0307 {
0308     if (big == s_bigNotes)
0309         return;
0310 
0311     s_bigNotes = big;
0312     // Big notes for accessibility reasons OR Standard small notes:
0313     Note::NOTE_MARGIN = (big ? 4 : 2);
0314     Note::INSERTION_HEIGHT = (big ? 5 : 3);
0315     Note::EXPANDER_WIDTH = 9;
0316     Note::EXPANDER_HEIGHT = 9;
0317     Note::GROUP_WIDTH = 2 * Note::NOTE_MARGIN + Note::EXPANDER_WIDTH;
0318     Note::HANDLE_WIDTH = Note::GROUP_WIDTH;
0319     Note::RESIZER_WIDTH = Note::GROUP_WIDTH;
0320     Note::TAG_ARROW_WIDTH = 5 + (big ? 4 : 0);
0321     Note::EMBLEM_SIZE = 16;
0322     Note::MIN_HEIGHT = 2 * Note::NOTE_MARGIN + Note::EMBLEM_SIZE;
0323 
0324     if (Global::bnpView)
0325         Global::bnpView->relayoutAllBaskets();
0326 }
0327 
0328 void Settings::setAutoBullet(bool yes)
0329 {
0330     s_autoBullet = yes;
0331     if (Global::bnpView && Global::bnpView->currentBasket()) {
0332         Global::bnpView->currentBasket()->editorPropertiesChanged();
0333     }
0334 }
0335 
0336 /** SettingsDialog */
0337 SettingsDialog::SettingsDialog(QWidget *parent)
0338     : KCMultiDialog(parent)
0339 {
0340     const QVector<KPluginMetaData> availablePlugins = KPluginLoader::findPlugins(QStringLiteral("pim/kcms/basket"));
0341     for (const KPluginMetaData &metaData : availablePlugins) {
0342 #if KCMUTILS_VERSION >= QT_VERSION_CHECK(5, 84, 0)
0343         addModule(metaData);
0344 #else
0345         addModule(metaData.pluginId());
0346 #endif
0347     }
0348 }
0349 
0350 SettingsDialog::~SettingsDialog()
0351 {}
0352 
0353 int SettingsDialog::exec(){
0354     // Help, RestoreDefaults buttons not implemented!
0355     //setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel);
0356     QTimer::singleShot(0, this, SLOT(adjustSize()));
0357     return KCMultiDialog::exec();
0358 }
0359 
0360 void SettingsDialog::adjustSize()
0361 {
0362     QSize maxPageSize;
0363     const KPageWidgetModel *model = qobject_cast<const KPageWidgetModel *>(pageWidget()->model());
0364     if (!model) return;
0365 
0366     const int pageCount = model->rowCount();
0367     for (int pageId = 0; pageId < pageCount; ++pageId) {
0368         QWidget *pageWidget = model->item(model->index(pageId, 0))->widget();
0369         if (!pageWidget) continue;
0370 
0371         maxPageSize = maxPageSize.expandedTo(pageWidget->sizeHint());
0372     }
0373 
0374     if (!maxPageSize.isEmpty())
0375         resize(1.25 * maxPageSize.width(), 1.25 * maxPageSize.height());
0376 }
0377 
0378 /** GeneralPage */
0379 GeneralPage::GeneralPage(QWidget *parent, const QVariantList &args)
0380     : KCModule(parent, args)
0381 {
0382     KAboutData *about = new AboutData();
0383     about->setComponentName("kcmbasket_config_general");
0384     setAboutData(about);
0385 
0386     QFormLayout *layout = new QFormLayout(this);
0387 
0388     // Basket Tree Position:
0389     m_treeOnLeft = new KComboBox(this);
0390     m_treeOnLeft->addItem(i18n("On left"));
0391     m_treeOnLeft->addItem(i18n("On right"));
0392 
0393     layout->addRow(i18n("&Basket tree position:"), m_treeOnLeft);
0394     connect(m_treeOnLeft, SIGNAL(activated(int)), this, SLOT(changed()));
0395 
0396     // Filter Bar Position:
0397     m_filterOnTop = new KComboBox(this);
0398     m_filterOnTop->addItem(i18n("On top"));
0399     m_filterOnTop->addItem(i18n("On bottom"));
0400 
0401     layout->addRow(i18n("&Filter bar position:"), m_filterOnTop);
0402     connect(m_filterOnTop, SIGNAL(activated(int)), this, SLOT(changed()));
0403 
0404     GeneralPage::load();
0405 }
0406 
0407 void GeneralPage::load()
0408 {
0409     m_treeOnLeft->setCurrentIndex((int)!Settings::treeOnLeft());
0410     m_filterOnTop->setCurrentIndex((int)!Settings::filterOnTop());
0411 
0412 }
0413 
0414 void GeneralPage::save()
0415 {
0416     Settings::setTreeOnLeft(!m_treeOnLeft->currentIndex());
0417     Settings::setFilterOnTop(!m_filterOnTop->currentIndex());
0418 }
0419 
0420 void GeneralPage::defaults()
0421 {
0422     // TODO
0423 }
0424 
0425 /** BasketsPage */
0426 
0427 BasketsPage::BasketsPage(QWidget *parent, const QVariantList &args)
0428     : KCModule(parent, args)
0429 {
0430     KAboutData *about = new AboutData();
0431     about->setComponentName("kcmbasket_config_baskets");
0432     setAboutData(about);
0433 
0434     QVBoxLayout *layout = new QVBoxLayout(this);
0435     QHBoxLayout *hLay;
0436     HelpLabel *hLabel;
0437 
0438     // Appearance:
0439 
0440     QGroupBox *appearanceBox = new QGroupBox(i18n("Appearance"), this);
0441     QVBoxLayout *appearanceLayout = new QVBoxLayout;
0442     appearanceBox->setLayout(appearanceLayout);
0443     layout->addWidget(appearanceBox);
0444 
0445     m_showNotesToolTip = new QCheckBox(i18n("&Show tooltips in baskets"), appearanceBox);
0446     appearanceLayout->addWidget(m_showNotesToolTip);
0447     connect(m_showNotesToolTip, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0448 
0449     m_bigNotes = new QCheckBox(i18n("&Big notes"), appearanceBox);
0450     appearanceLayout->addWidget(m_bigNotes);
0451     connect(m_bigNotes, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0452 
0453     // Behavior:
0454 
0455     QGroupBox *behaviorBox = new QGroupBox(i18n("Behavior"), this);
0456     QVBoxLayout *behaviorLayout = new QVBoxLayout;
0457     behaviorBox->setLayout(behaviorLayout);
0458     layout->addWidget(behaviorBox);
0459 
0460     m_autoBullet = new QCheckBox(i18n("&Transform lines starting with * or - to lists in text editors"), behaviorBox);
0461     behaviorLayout->addWidget(m_autoBullet);
0462     connect(m_autoBullet, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0463 
0464     m_confirmNoteDeletion = new QCheckBox(i18n("Ask confirmation before &deleting notes"), behaviorBox);
0465     behaviorLayout->addWidget(m_confirmNoteDeletion);
0466     connect(m_confirmNoteDeletion, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0467 
0468     m_pasteAsPlainText = new QCheckBox(i18n("Keep text formatting when pasting"), behaviorBox);
0469     behaviorLayout->addWidget(m_pasteAsPlainText);
0470     connect(m_pasteAsPlainText, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0471 
0472     m_detectTextTags = new QCheckBox(i18n("Automatically detect tags from note's content"), behaviorBox);
0473     behaviorLayout->addWidget(m_detectTextTags);
0474     connect(m_detectTextTags, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0475 
0476     QWidget *widget = new QWidget(behaviorBox);
0477     behaviorLayout->addWidget(widget);
0478     hLay = new QHBoxLayout(widget);
0479     m_exportTextTags = new QCheckBox(i18n("&Export tags in texts"), widget);
0480     connect(m_exportTextTags, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0481 
0482     hLabel = new HelpLabel(i18n("When does this apply?"),
0483                            "<p>" + i18n("It does apply when you copy and paste, or drag and drop notes to a text editor.") + "</p>" + "<p>" + i18n("If enabled, this property lets you paste the tags as textual equivalents.") + "<br>" +
0484                                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>, "
0485                                     "representing an empty checkbox and a checked box.") +
0486                                "</p>" + "<p align='center'><img src=\":/images/tag_export_help.png\"></p>",
0487                            widget);
0488     hLay->addWidget(m_exportTextTags);
0489     hLay->addWidget(hLabel);
0490     hLay->setContentsMargins(0, 0, 0, 0);
0491     hLay->addStretch();
0492 
0493     m_groupOnInsertionLineWidget = new QWidget(behaviorBox);
0494     behaviorLayout->addWidget(m_groupOnInsertionLineWidget);
0495     QHBoxLayout *hLayV = new QHBoxLayout(m_groupOnInsertionLineWidget);
0496     m_groupOnInsertionLine = new QCheckBox(i18n("&Group a new note when clicking on the right of the insertion line"), m_groupOnInsertionLineWidget);
0497     HelpLabel *helpV = new HelpLabel(i18n("How to group a new note?"),
0498                                      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>") +
0499                                          "<p align='center'><img src=\":/images/insertion_help.png\"></p>" +
0500                                          i18n("<p>Place your mouse between notes, where you want to add a new one.<br>"
0501                                               "Click on the <b>left</b> of the insertion-line middle-mark to <b>insert</b> a note.<br>"
0502                                               "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>"),
0503                                      m_groupOnInsertionLineWidget);
0504     hLayV->addWidget(m_groupOnInsertionLine);
0505     hLayV->addWidget(helpV);
0506     hLayV->insertStretch(-1);
0507     layout->addWidget(m_groupOnInsertionLineWidget);
0508     connect(m_groupOnInsertionLine, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0509 
0510     widget = new QWidget(behaviorBox);
0511     behaviorLayout->addWidget(widget);
0512     QGridLayout *ga = new QGridLayout(widget);
0513     ga->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding), 0, 3);
0514 
0515     m_middleAction = new KComboBox(widget);
0516     m_middleAction->addItem(i18n("Do nothing"));
0517     m_middleAction->addItem(i18n("Paste clipboard"));
0518     m_middleAction->addItem(i18n("Insert image note"));
0519     m_middleAction->addItem(i18n("Insert link note"));
0520     m_middleAction->addItem(i18n("Insert cross reference"));
0521     m_middleAction->addItem(i18n("Insert launcher note"));
0522     m_middleAction->addItem(i18n("Insert color note"));
0523     m_middleAction->addItem(i18n("Grab screen zone"));
0524     m_middleAction->addItem(i18n("Insert color from screen"));
0525     m_middleAction->addItem(i18n("Load note from file"));
0526     m_middleAction->addItem(i18n("Import Launcher for desktop application"));
0527     m_middleAction->addItem(i18n("Import icon"));
0528 
0529     QLabel *labelM = new QLabel(widget);
0530     labelM->setText(i18n("&Shift+middle-click anywhere:"));
0531     labelM->setBuddy(m_middleAction);
0532 
0533     ga->addWidget(labelM, 0, 0);
0534     ga->addWidget(m_middleAction, 0, 1);
0535     ga->addWidget(new QLabel(i18n("at cursor position"), widget), 0, 2);
0536     ga->setContentsMargins(1, 0, 0, 0);
0537     connect(m_middleAction, SIGNAL(activated(int)), this, SLOT(changed()));
0538 
0539     // Protection:
0540 
0541     QGroupBox *protectionBox = new QGroupBox(i18n("Password Protection"), this);
0542     QVBoxLayout *protectionLayout = new QVBoxLayout;
0543     layout->addWidget(protectionBox);
0544     protectionBox->setLayout(protectionLayout);
0545     widget = new QWidget(protectionBox);
0546     protectionLayout->addWidget(widget);
0547 
0548     // Re-Lock timeout configuration
0549     hLay = new QHBoxLayout(widget);
0550     m_enableReLockTimeoutMinutes = new QCheckBox(i18n("A&utomatically lock protected baskets when closed for"), widget);
0551     hLay->addWidget(m_enableReLockTimeoutMinutes);
0552     m_reLockTimeoutMinutes = new QSpinBox(widget);
0553     m_reLockTimeoutMinutes->setMinimum(0);
0554     m_reLockTimeoutMinutes->setSuffix(i18n(" minutes"));
0555     hLay->addWidget(m_reLockTimeoutMinutes);
0556     // label = new QLabel(i18n("minutes"), this);
0557     // hLay->addWidget(label);
0558     hLay->addStretch();
0559     //  layout->addLayout(hLay);
0560     connect(m_enableReLockTimeoutMinutes, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0561     connect(m_reLockTimeoutMinutes, SIGNAL(valueChanged(int)), this, SLOT(changed()));
0562     connect(m_enableReLockTimeoutMinutes, SIGNAL(toggled(bool)), m_reLockTimeoutMinutes, SLOT(setEnabled(bool)));
0563 
0564 #ifdef HAVE_LIBGPGME
0565     m_useGnuPGAgent = new QCheckBox(i18n("Use GnuPG agent for &private/public key protected baskets"), protectionBox);
0566     protectionLayout->addWidget(m_useGnuPGAgent);
0567     //  hLay->addWidget(m_useGnuPGAgent);
0568     connect(m_useGnuPGAgent, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0569 #endif
0570 
0571     layout->insertStretch(-1);
0572     BasketsPage::load();
0573 }
0574 
0575 void BasketsPage::load()
0576 {
0577     m_showNotesToolTip->setChecked(Settings::showNotesToolTip());
0578     m_bigNotes->setChecked(Settings::bigNotes());
0579 
0580     m_autoBullet->setChecked(Settings::autoBullet());
0581     m_confirmNoteDeletion->setChecked(Settings::confirmNoteDeletion());
0582     m_pasteAsPlainText->setChecked(!Settings::pasteAsPlainText());
0583     m_exportTextTags->setChecked(Settings::exportTextTags());
0584     m_detectTextTags->setChecked(Settings::detectTextTags());
0585     m_groupOnInsertionLine->setChecked(Settings::groupOnInsertionLine());
0586     m_middleAction->setCurrentIndex(Settings::middleAction());
0587 
0588     // The correctness of this code depends on the default of enableReLockTimeout
0589     // being true - otherwise, the reLockTimeoutMinutes widget is not disabled properly.
0590     m_enableReLockTimeoutMinutes->setChecked(Settings::enableReLockTimeout());
0591     m_reLockTimeoutMinutes->setValue(Settings::reLockTimeoutMinutes());
0592 #ifdef HAVE_LIBGPGME
0593     m_useGnuPGAgent->setChecked(Settings::useGnuPGAgent());
0594 
0595     if (KGpgMe::isGnuPGAgentAvailable()) {
0596         m_useGnuPGAgent->setChecked(Settings::useGnuPGAgent());
0597     } else {
0598         m_useGnuPGAgent->setChecked(false);
0599         m_useGnuPGAgent->setEnabled(false);
0600     }
0601 #endif
0602 }
0603 
0604 void BasketsPage::save()
0605 {
0606     Settings::setShowNotesToolTip(m_showNotesToolTip->isChecked());
0607     Settings::setBigNotes(m_bigNotes->isChecked());
0608 
0609     Settings::setAutoBullet(m_autoBullet->isChecked());
0610     Settings::setConfirmNoteDeletion(m_confirmNoteDeletion->isChecked());
0611     Settings::setPasteAsPlainText(!m_pasteAsPlainText->isChecked());
0612     Settings::setExportTextTags(m_exportTextTags->isChecked());
0613     Settings::setDetectTextTags(m_detectTextTags->isChecked());
0614 
0615     Settings::setGroupOnInsertionLine(m_groupOnInsertionLine->isChecked());
0616     Settings::setMiddleAction(m_middleAction->currentIndex());
0617 
0618     Settings::setEnableReLockTimeout(m_enableReLockTimeoutMinutes->isChecked());
0619     Settings::setReLockTimeoutMinutes(m_reLockTimeoutMinutes->value());
0620 #ifdef HAVE_LIBGPGME
0621     Settings::setUseGnuPGAgent(m_useGnuPGAgent->isChecked());
0622 #endif
0623 }
0624 
0625 void BasketsPage::defaults()
0626 {
0627     // TODO
0628 }
0629 
0630 /** class NewNotesPage: */
0631 
0632 NewNotesPage::NewNotesPage(QWidget *parent, const QVariantList &args)
0633     : KCModule(parent, args)
0634 {
0635     KAboutData *about = new AboutData();
0636     about->setComponentName("kcmbasket_config_new_notes");
0637     setAboutData(about);
0638 
0639     QVBoxLayout *layout = new QVBoxLayout(this);
0640     QHBoxLayout *hLay;
0641     QLabel *label;
0642 
0643     // Place of New Notes:
0644 
0645     hLay = new QHBoxLayout;
0646     m_newNotesPlace = new KComboBox(this);
0647 
0648     label = new QLabel(this);
0649     label->setText(i18n("&Place of new notes:"));
0650     label->setBuddy(m_newNotesPlace);
0651 
0652     m_newNotesPlace->addItem(i18n("On top"));
0653     m_newNotesPlace->addItem(i18n("On bottom"));
0654     m_newNotesPlace->addItem(i18n("At current note"));
0655     hLay->addWidget(label);
0656     hLay->addWidget(m_newNotesPlace);
0657     hLay->addStretch();
0658     // layout->addLayout(hLay);
0659     label->hide();
0660     m_newNotesPlace->hide();
0661     connect(m_newNotesPlace, SIGNAL(editTextChanged(const QString &)), this, SLOT(changed()));
0662 
0663     // New Images Size:
0664 
0665     hLay = new QHBoxLayout;
0666     m_imgSizeX = new QSpinBox(this);
0667     m_imgSizeX->setMinimum(1);
0668     m_imgSizeX->setMaximum(4096);
0669     // m_imgSizeX->setReferencePoint(100); //from KIntNumInput
0670     connect(m_imgSizeX, SIGNAL(valueChanged(int)), this, SLOT(changed()));
0671 
0672     label = new QLabel(this);
0673     label->setText(i18n("&New images size:"));
0674     label->setBuddy(m_imgSizeX);
0675 
0676     hLay->addWidget(label);
0677     hLay->addWidget(m_imgSizeX);
0678 
0679     m_imgSizeY = new QSpinBox(this);
0680     m_imgSizeY->setMinimum(1);
0681     m_imgSizeY->setMaximum(4096);
0682     // m_imgSizeY->setReferencePoint(100);
0683     connect(m_imgSizeY, SIGNAL(valueChanged(int)), this, SLOT(changed()));
0684 
0685     label = new QLabel(this);
0686     label->setText(i18n("&by"));
0687     label->setBuddy(m_imgSizeY);
0688 
0689     hLay->addWidget(label);
0690     hLay->addWidget(m_imgSizeY);
0691     label = new QLabel(i18n("pixels"), this);
0692     hLay->addWidget(label);
0693     m_pushVisualize = new QPushButton(i18n("&Visualize..."), this);
0694     hLay->addWidget(m_pushVisualize);
0695     hLay->addStretch();
0696     layout->addLayout(hLay);
0697     connect(m_pushVisualize, SIGNAL(clicked()), this, SLOT(visualize()));
0698 
0699     // View File Content:
0700 
0701     QGroupBox *buttonGroup = new QGroupBox(i18n("View Content of Added Files for the Following Types"), this);
0702     QVBoxLayout *buttonLayout = new QVBoxLayout;
0703     m_viewTextFileContent = new QCheckBox(i18n("&Plain text"), buttonGroup);
0704     m_viewHtmlFileContent = new QCheckBox(i18n("&HTML page"), buttonGroup);
0705     m_viewImageFileContent = new QCheckBox(i18n("&Image or animation"), buttonGroup);
0706     m_viewSoundFileContent = new QCheckBox(i18n("&Sound"), buttonGroup);
0707 
0708     buttonLayout->addWidget(m_viewTextFileContent);
0709     buttonLayout->addWidget(m_viewHtmlFileContent);
0710     buttonLayout->addWidget(m_viewImageFileContent);
0711     buttonLayout->addWidget(m_viewSoundFileContent);
0712     buttonGroup->setLayout(buttonLayout);
0713 
0714     layout->addWidget(buttonGroup);
0715     connect(m_viewTextFileContent, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0716     connect(m_viewHtmlFileContent, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0717     connect(m_viewImageFileContent, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0718     connect(m_viewSoundFileContent, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0719 
0720     layout->insertStretch(-1);
0721     NewNotesPage::load();
0722 }
0723 
0724 void NewNotesPage::load()
0725 {
0726     m_newNotesPlace->setCurrentIndex(Settings::newNotesPlace());
0727 
0728     m_imgSizeX->setValue(Settings::defImageX());
0729     m_imgSizeY->setValue(Settings::defImageY());
0730 
0731     m_viewTextFileContent->setChecked(Settings::viewTextFileContent());
0732     m_viewHtmlFileContent->setChecked(Settings::viewHtmlFileContent());
0733     m_viewImageFileContent->setChecked(Settings::viewImageFileContent());
0734     m_viewSoundFileContent->setChecked(Settings::viewSoundFileContent());
0735 }
0736 
0737 void NewNotesPage::save()
0738 {
0739     Settings::setNewNotesPlace(m_newNotesPlace->currentIndex());
0740 
0741     Settings::setDefImageX(m_imgSizeX->value());
0742     Settings::setDefImageY(m_imgSizeY->value());
0743 
0744     Settings::setViewTextFileContent(m_viewTextFileContent->isChecked());
0745     Settings::setViewHtmlFileContent(m_viewHtmlFileContent->isChecked());
0746     Settings::setViewImageFileContent(m_viewImageFileContent->isChecked());
0747     Settings::setViewSoundFileContent(m_viewSoundFileContent->isChecked());
0748 }
0749 
0750 void NewNotesPage::defaults()
0751 {
0752     // TODO
0753 }
0754 
0755 void NewNotesPage::visualize()
0756 {
0757     QPointer<ViewSizeDialog> size = new ViewSizeDialog(this, m_imgSizeX->value(), m_imgSizeY->value());
0758     size->exec();
0759     m_imgSizeX->setValue(size->width());
0760     m_imgSizeY->setValue(size->height());
0761 }
0762 
0763 /** class NotesAppearancePage: */
0764 
0765 NotesAppearancePage::NotesAppearancePage(QWidget *parent, const QVariantList &args)
0766     : KCModule(parent, args)
0767 {
0768     KAboutData *about = new AboutData();
0769     about->setComponentName("kcmbasket_config_notes_appearance");
0770     setAboutData(about);
0771 
0772     QVBoxLayout *layout = new QVBoxLayout(this);
0773     QTabWidget *tabs = new QTabWidget(this);
0774     layout->addWidget(tabs);
0775 
0776     m_soundLook = new LinkLookEditWidget(this, i18n("Conference audio record"), "folder-sound", tabs);
0777     m_fileLook = new LinkLookEditWidget(this, i18n("Annual report"), "folder-documents", tabs);
0778     m_localLinkLook = new LinkLookEditWidget(this, i18n("Home folder"), "user-home", tabs);
0779     m_networkLinkLook = new LinkLookEditWidget(this, "kde.org", KIO::iconNameForUrl(QUrl("https://kde.org")), tabs);
0780     m_launcherLook = new LinkLookEditWidget(this, i18n("Launch %1", QGuiApplication::applicationDisplayName()), "basket", tabs);
0781     m_crossReferenceLook = new LinkLookEditWidget(this, i18n("Another basket"), "basket", tabs);
0782 
0783     tabs->addTab(m_soundLook, i18n("&Sounds"));
0784     tabs->addTab(m_fileLook, i18n("&Files"));
0785     tabs->addTab(m_localLinkLook, i18n("&Local Links"));
0786     tabs->addTab(m_networkLinkLook, i18n("&Network Links"));
0787     tabs->addTab(m_launcherLook, i18n("Launc&hers"));
0788     tabs->addTab(m_crossReferenceLook, i18n("&Cross References"));
0789 
0790     NotesAppearancePage::load();
0791 }
0792 
0793 void NotesAppearancePage::load()
0794 {
0795     m_soundLook->set(LinkLook::soundLook);
0796     m_fileLook->set(LinkLook::fileLook);
0797     m_localLinkLook->set(LinkLook::localLinkLook);
0798     m_networkLinkLook->set(LinkLook::networkLinkLook);
0799     m_launcherLook->set(LinkLook::launcherLook);
0800     m_crossReferenceLook->set(LinkLook::crossReferenceLook);
0801 }
0802 
0803 void NotesAppearancePage::save()
0804 {
0805     m_soundLook->saveChanges();
0806     m_fileLook->saveChanges();
0807     m_localLinkLook->saveChanges();
0808     m_networkLinkLook->saveChanges();
0809     m_launcherLook->saveChanges();
0810     m_crossReferenceLook->saveChanges();
0811     Global::bnpView->linkLookChanged();
0812 }
0813 
0814 void NotesAppearancePage::defaults()
0815 {
0816     // TODO
0817 }
0818 
0819 /** class ApplicationsPage: */
0820 
0821 ApplicationsPage::ApplicationsPage(QWidget *parent, const QVariantList &args)
0822     : KCModule(parent, args)
0823 {
0824     KAboutData *about = new AboutData();
0825     about->setComponentName("kcmbasket_config_apps");
0826     setAboutData(about);
0827 
0828     /* Applications page */
0829     QVBoxLayout *layout = new QVBoxLayout(this);
0830 
0831     m_htmlUseProg = new QCheckBox(i18n("Open &text notes with a custom application:"), this);
0832     m_htmlProg = new RunCommandRequester(QString(), i18n("Open text notes with:"), this);
0833     QHBoxLayout *hLayH = new QHBoxLayout;
0834     hLayH->insertSpacing(-1, 20);
0835     hLayH->addWidget(m_htmlProg);
0836     connect(m_htmlUseProg, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0837     connect(m_htmlProg->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(changed()));
0838 
0839     m_imageUseProg = new QCheckBox(i18n("Open &image notes with a custom application:"), this);
0840     m_imageProg = new RunCommandRequester(QString(), i18n("Open image notes with:"), this);
0841     QHBoxLayout *hLayI = new QHBoxLayout;
0842     hLayI->insertSpacing(-1, 20);
0843     hLayI->addWidget(m_imageProg);
0844     connect(m_imageUseProg, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0845     connect(m_imageProg->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(changed()));
0846 
0847     m_animationUseProg = new QCheckBox(i18n("Open a&nimation notes with a custom application:"), this);
0848     m_animationProg = new RunCommandRequester(QString(), i18n("Open animation notes with:"), this);
0849     QHBoxLayout *hLayA = new QHBoxLayout;
0850     hLayA->insertSpacing(-1, 20);
0851     hLayA->addWidget(m_animationProg);
0852     connect(m_animationUseProg, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0853     connect(m_animationProg->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(changed()));
0854 
0855     m_soundUseProg = new QCheckBox(i18n("Open so&und notes with a custom application:"), this);
0856     m_soundProg = new RunCommandRequester(QString(), i18n("Open sound notes with:"), this);
0857     QHBoxLayout *hLayS = new QHBoxLayout;
0858     hLayS->insertSpacing(-1, 20);
0859     hLayS->addWidget(m_soundProg);
0860     connect(m_soundUseProg, SIGNAL(stateChanged(int)), this, SLOT(changed()));
0861     connect(m_soundProg->lineEdit(), SIGNAL(textChanged(const QString &)), this, SLOT(changed()));
0862 
0863     QString whatsthis = i18n(
0864         "<p>If checked, the application defined below will be used when opening that type of note.</p>"
0865         "<p>Otherwise, the application you've configured in Konqueror will be used.</p>");
0866 
0867     m_htmlUseProg->setWhatsThis(whatsthis);
0868     m_imageUseProg->setWhatsThis(whatsthis);
0869     m_animationUseProg->setWhatsThis(whatsthis);
0870     m_soundUseProg->setWhatsThis(whatsthis);
0871 
0872     whatsthis = i18n(
0873         "<p>Define the application to use for opening that type of note instead of the "
0874         "application configured in Konqueror.</p>");
0875 
0876     m_htmlProg->setWhatsThis(whatsthis);
0877     m_imageProg->setWhatsThis(whatsthis);
0878     m_animationProg->setWhatsThis(whatsthis);
0879     m_soundProg->setWhatsThis(whatsthis);
0880 
0881     layout->addWidget(m_htmlUseProg);
0882     layout->addItem(hLayH);
0883     layout->addWidget(m_imageUseProg);
0884     layout->addItem(hLayI);
0885     layout->addWidget(m_animationUseProg);
0886     layout->addItem(hLayA);
0887     layout->addWidget(m_soundUseProg);
0888     layout->addItem(hLayS);
0889 
0890     QHBoxLayout *hLay = new QHBoxLayout;
0891     HelpLabel *hl1 = new HelpLabel(i18n("How to change the application used to open Web links?"),
0892                                    i18n("<p>When opening Web links, they are opened in different applications, depending on the content of the link "
0893                                         "(a Web page, an image, a PDF document...), such as if they were files on your computer.</p>"
0894                                         "<p>Here is how to do if you want every Web addresses to be opened in your Web browser. "
0895                                         "It is useful if you are not using Plasma (if you are using eg. GNOME, XFCE...).</p>"
0896                                         "<ul>"
0897                                         "<li>Open the KDE System Settings (if it is not available, try to type \"systemsettings\" in a command line terminal);</li>"
0898                                         "<li>Go to the \"Applications\" and then \"Default Applications\" section;</li>"
0899                                         "<li>Choose \"Web Browser\", check \"with the following command:\" and enter the name of your Web browser (like \"firefox\" or \"epiphany\").</li>"
0900                                         "</ul>"
0901                                         "<p>Now, when you click <i>any</i> link that start with \"https://...\", it will be opened in your Web browser (eg. Mozilla Firefox or Epiphany or...).</p>"
0902                                         "<p>For more fine-grained configuration (like opening only Web pages in your Web browser), read the second help link.</p>"),
0903                                    this);
0904     hLay->addWidget(hl1);
0905     hLay->addStretch();
0906     layout->addLayout(hLay);
0907 
0908     hLay = new QHBoxLayout;
0909     HelpLabel *hl2 = new HelpLabel(i18n("How to change the applications used to open files and links?"),
0910                                    i18n("<p>Here is how to set the application to be used for each type of file. "
0911                                         "This also applies to Web links if you choose not to open them systematically in a Web browser (see the first help link). "
0912                                         "The default settings should be good enough for you, but this tip is useful if you are using GNOME, XFCE, or another environment than Plasma.</p>"
0913                                         "<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). "
0914                                         "Repeat these steps for each type of file you want to open in a specific application.</p>"
0915                                         "<ul>"
0916                                         "<li>Open the KDE System Settings (if it is not available, try to type \"systemsettings\" in a command line terminal);</li>"
0917                                         "<li>Go to the \"Applications\" and then \"File Associations\" section;</li>"
0918                                         "<li>In the tree, expand \"text\" and click \"html\";</li>"
0919                                         "<li>In the applications list, add your Web browser as the first entry;</li>"
0920                                         "<li>Do the same for the type \"application -> xhtml+xml\".</li>"
0921                                         "</ul>"),
0922                                    this);
0923     hLay->addWidget(hl2);
0924     hLay->addStretch();
0925     layout->addLayout(hLay);
0926 
0927     connect(m_htmlUseProg, SIGNAL(toggled(bool)), m_htmlProg, SLOT(setEnabled(bool)));
0928     connect(m_imageUseProg, SIGNAL(toggled(bool)), m_imageProg, SLOT(setEnabled(bool)));
0929     connect(m_animationUseProg, SIGNAL(toggled(bool)), m_animationProg, SLOT(setEnabled(bool)));
0930     connect(m_soundUseProg, SIGNAL(toggled(bool)), m_soundProg, SLOT(setEnabled(bool)));
0931 
0932     layout->insertStretch(-1);
0933     ApplicationsPage::load();
0934 }
0935 
0936 void ApplicationsPage::load()
0937 {
0938     m_htmlProg->setRunCommand(Settings::htmlProg());
0939     m_htmlUseProg->setChecked(Settings::isHtmlUseProg());
0940     m_htmlProg->setEnabled(Settings::isHtmlUseProg());
0941 
0942     m_imageProg->setRunCommand(Settings::imageProg());
0943     m_imageUseProg->setChecked(Settings::isImageUseProg());
0944     m_imageProg->setEnabled(Settings::isImageUseProg());
0945 
0946     m_animationProg->setRunCommand(Settings::animationProg());
0947     m_animationUseProg->setChecked(Settings::isAnimationUseProg());
0948     m_animationProg->setEnabled(Settings::isAnimationUseProg());
0949 
0950     m_soundProg->setRunCommand(Settings::soundProg());
0951     m_soundUseProg->setChecked(Settings::isSoundUseProg());
0952     m_soundProg->setEnabled(Settings::isSoundUseProg());
0953 }
0954 
0955 void ApplicationsPage::save()
0956 {
0957     Settings::setIsHtmlUseProg(m_htmlUseProg->isChecked());
0958     Settings::setHtmlProg(m_htmlProg->runCommand());
0959 
0960     Settings::setIsImageUseProg(m_imageUseProg->isChecked());
0961     Settings::setImageProg(m_imageProg->runCommand());
0962 
0963     Settings::setIsAnimationUseProg(m_animationUseProg->isChecked());
0964     Settings::setAnimationProg(m_animationProg->runCommand());
0965 
0966     Settings::setIsSoundUseProg(m_soundUseProg->isChecked());
0967     Settings::setSoundProg(m_soundProg->runCommand());
0968 }
0969 
0970 void ApplicationsPage::defaults()
0971 {
0972     // TODO
0973 }
0974 
0975 #include "moc_settings.cpp"