diff --git a/data/kjots_config_misc.desktop b/data/kjots_config_misc.desktop
--- a/data/kjots_config_misc.desktop
+++ b/data/kjots_config_misc.desktop
@@ -1,14 +1,14 @@
[Desktop Entry]
-Icon=kjots
+Icon=preferences-other
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-ModuleType=Library
X-KDE-Library=kcm_kjots
X-KDE-HasReadOnlyMode=false
X-KDE-ParentApp=kjots
X-KDE-ParentComponents=kjots,kontact_kjotsplugin
-X-KDE-CfgDlgHierarchy=Notebooks
+X-KDE-CfgDlgHierarchy=Notes
X-KDE-Weight=200
Name=Misc
diff --git a/src/confpagemisc.ui b/src/confpagemisc.ui
--- a/src/confpagemisc.ui
+++ b/src/confpagemisc.ui
@@ -6,109 +6,62 @@
0
0
- 289
- 123
+ 417
+ 76
-
-
- 0
-
- -
-
-
- This is the number of minutes KJots will wait before automatically saving changes.
-
-
- 1 minute
-
-
- minutes
-
-
- 1
-
-
- 1440
-
-
-
- -
-
-
- This is the number of minutes KJots will wait before automatically saving changes.
-
-
- S&ave every:
-
-
- false
-
-
- autoSaveInterval
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Expanding
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Expanding
-
-
-
- 20
- 30
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 20
-
-
-
-
- -
-
-
- When "Save changes periodically" is checked, KJots will automatically save changes made to books at the interval defined below.
-
-
- &Save changes periodically
-
-
- true
-
-
+
+
-
+
+
-
+
+
+ This is the number of minutes KJots will wait before automatically saving changes.
+
+
+ S&ave every:
+
+
+ false
+
+
+ kcfg_AutoSaveInterval
+
+
+
+ -
+
+
+ This is the number of minutes KJots will wait before automatically saving changes.
+
+
+ 1 minute
+
+
+ minutes
+
+
+ 1
+
+
+ 1440
+
+
+
+ -
+
+
+ When "Save changes periodically" is checked, KJots will automatically save changes made to books at the interval defined below.
+
+
+ &Save changes periodically
+
+
+ true
+
+
+
+
@@ -119,32 +72,12 @@
toggled(bool)
kcfg_AutoSaveInterval
setEnabled(bool)
-
-
- 20
- 20
-
-
- 20
- 20
-
-
kcfg_AutoSave
toggled(bool)
textLabel1
setEnabled(bool)
-
-
- 20
- 20
-
-
- 20
- 20
-
-
diff --git a/src/kjotsconfigdlg.h b/src/kjotsconfigdlg.h
--- a/src/kjotsconfigdlg.h
+++ b/src/kjotsconfigdlg.h
@@ -23,41 +23,14 @@
#include
#include "ui_confpagemisc.h"
-class confPageMisc : public QWidget, public Ui::confPageMisc
-{
- Q_OBJECT
-
-public:
- explicit confPageMisc(QWidget *parent) : QWidget(parent)
- {
- setupUi(this);
- }
-};
-
class KJotsConfigMisc : public KCModule
{
Q_OBJECT
public:
explicit KJotsConfigMisc(QWidget *parent, const QVariantList &args = QVariantList());
-
- void load() override;
- void save() override;
-private Q_SLOTS:
- void modified();
private:
- confPageMisc *miscPage;
-};
-
-class KJotsConfigDlg : public KCMultiDialog
-{
- Q_OBJECT
-
-public:
- explicit KJotsConfigDlg(const QString &title, QWidget *parent);
-
-public Q_SLOTS:
- void slotOk();
+ std::unique_ptr ui;
};
#endif /* KJOTSCONFIGDLG_H */
diff --git a/src/kjotsconfigdlg.cpp b/src/kjotsconfigdlg.cpp
--- a/src/kjotsconfigdlg.cpp
+++ b/src/kjotsconfigdlg.cpp
@@ -17,60 +17,19 @@
*/
#include "kjotsconfigdlg.h"
+#include "KJotsSettings.h"
#include
-#include
-#include
-
-KJotsConfigDlg::KJotsConfigDlg(const QString &title, QWidget *parent)
- : KCMultiDialog(parent)
-{
- setWindowTitle(title);
- setFaceType(KPageDialog::List);
- setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
- button(QDialogButtonBox::Ok)->setDefault(true);
-
- addModule(QStringLiteral("kjots_config_misc"));
- connect(button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &KJotsConfigDlg::slotOk);
-}
-
-void KJotsConfigDlg::slotOk()
-{
-}
-
KJotsConfigMisc::KJotsConfigMisc(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
+ , ui(new Ui::confPageMisc)
{
auto *lay = new QHBoxLayout(this);
- miscPage = new confPageMisc(nullptr);
+ auto miscPage = new QWidget(this);
+ ui->setupUi(miscPage);
lay->addWidget(miscPage);
- connect(miscPage->autoSaveInterval, qOverload(&QSpinBox::valueChanged), this, &KJotsConfigMisc::modified);
- connect(miscPage->autoSave, &QCheckBox::stateChanged, this, &KJotsConfigMisc::modified);
+ addConfig(KJotsSettings::self(), miscPage);
load();
}
-void KJotsConfigMisc::modified()
-{
- Q_EMIT changed(true);
-}
-
-void KJotsConfigMisc::load()
-{
- KConfig config(QStringLiteral("kjotsrc"));
- KConfigGroup group = config.group("kjots");
- miscPage->autoSaveInterval->setValue(group.readEntry("AutoSaveInterval", 5));
- miscPage->autoSave->setChecked(group.readEntry("AutoSave", true));
- Q_EMIT changed(false);
-}
-
-void KJotsConfigMisc::save()
-{
- KConfig config(QStringLiteral("kjotsrc"));
- KConfigGroup group = config.group("kjots");
- group.writeEntry("AutoSaveInterval", miscPage->autoSaveInterval->value());
- group.writeEntry("AutoSave", miscPage->autoSave->isChecked());
- group.sync();
- Q_EMIT changed(false);
-}
-
#include "moc_kjotsconfigdlg.cpp"
diff --git a/src/kjotswidget.cpp b/src/kjotswidget.cpp
--- a/src/kjotswidget.cpp
+++ b/src/kjotswidget.cpp
@@ -77,6 +77,7 @@
#include
#include
#include
+#include
// KMime
#include
@@ -558,9 +559,12 @@
void KJotsWidget::configure()
{
- // create a new preferences dialog...
- auto *dialog = new KJotsConfigDlg(i18n("Settings"), this);
- connect(dialog, qOverload<>(&KJotsConfigDlg::configCommitted), this, &KJotsWidget::updateConfiguration);
+ if (KConfigDialog::showDialog(QStringLiteral("kjotssettings"))) {
+ return;
+ }
+ auto* dialog = new KConfigDialog(this, QStringLiteral("kjotssettings"), KJotsSettings::self());
+ dialog->addPage(new KJotsConfigMisc(dialog), i18nc("@title:window config dialog page", "Misc"), QStringLiteral("preferences-other"));
+ connect(dialog, &KConfigDialog::settingsChanged, this, &KJotsWidget::updateConfiguration);
dialog->show();
}