[kde-doc-english] [ark/Applications/15.08] /: Implement configuration dialog

Elvis Angelaccio elvis.angelaccio at kdemail.net
Wed Jul 22 10:22:39 UTC 2015


Git commit 7850a0aabf2149eab5d53d3e9fea57c6113cc563 by Elvis Angelaccio.
Committed on 22/07/2015 at 10:15.
Pushed by elvisangelaccio into branch 'Applications/15.08'.

Implement configuration dialog

This patch implements the standard configuration dialog (using
KConfigDialog) in Ark, as expected from a KDE application.

The widgets showed in the config dialog are provided by Kerfuffle, through the
Ark Part interface. This should help to show the Ark settings in, for
instance, Konqueror's config dialog.

REVIEW: 121997
BUG: 165314
FIXED-IN: 15.08
GUI:

M  +28   -0    app/mainwindow.cpp
M  +2    -0    app/mainwindow.h
M  +5    -0    kerfuffle/CMakeLists.txt
M  +4    -2    kerfuffle/ark.kcfg
A  +58   -0    kerfuffle/extractionsettings.ui
A  +38   -0    kerfuffle/extractionsettingspage.cpp     [License: BSD]
A  +45   -0    kerfuffle/extractionsettingspage.h     [License: BSD]
A  +72   -0    kerfuffle/previewsettings.ui
A  +44   -0    kerfuffle/previewsettingspage.cpp     [License: BSD]
A  +48   -0    kerfuffle/previewsettingspage.h     [License: BSD]
A  +48   -0    kerfuffle/settingspage.cpp     [License: BSD]
A  +53   -0    kerfuffle/settingspage.h     [License: BSD]
M  +10   -1    part/interface.h
M  +16   -0    part/part.cpp
M  +2    -0    part/part.h

http://commits.kde.org/ark/7850a0aabf2149eab5d53d3e9fea57c6113cc563

diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp
index 6511d54..a71874e 100644
--- a/app/mainwindow.cpp
+++ b/app/mainwindow.cpp
@@ -24,6 +24,7 @@
 #include "logging.h"
 #include "mainwindow.h"
 #include "kerfuffle/archive_kerfuffle.h"
+#include "kerfuffle/settingspage.h"
 #include "part/interface.h"
 
 #include <KPluginFactory>
@@ -36,7 +37,9 @@
 #include <KShortcutsDialog>
 #include <KService>
 #include <KSharedConfig>
+#include <KConfigDialog>
 #include <KConfigGroup>
+#include <KConfigSkeleton>
 #include <KXMLGUIFactory>
 
 #include <QDebug>
@@ -175,6 +178,7 @@ void MainWindow::setupActions()
 
     KStandardAction::configureToolbars(this, SLOT(editToolbars()), actionCollection());
     KStandardAction::keyBindings(this, SLOT(editKeyBindings()), actionCollection());
+    KStandardAction::preferences(this, SLOT(showSettings()), actionCollection());
 }
 
 void MainWindow::updateActions()
@@ -270,6 +274,30 @@ void MainWindow::quit()
     close();
 }
 
+void MainWindow::showSettings()
+{
+    Interface *iface = qobject_cast<Interface*>(m_part);
+    Q_ASSERT(iface);
+
+    KConfigDialog *dialog = new KConfigDialog(this, QLatin1String("settings"), iface->config());
+
+    foreach (Kerfuffle::SettingsPage *page, iface->settingsPages(this)) {
+        dialog->addPage(page, page->name(), page->iconName());
+    }
+    // Hide the icons list if only one page has been added.
+    dialog->setFaceType(KPageDialog::Auto);
+
+    connect(dialog, SIGNAL(settingsChanged(QString)), this, SLOT(writeSettings()));
+    dialog->show();
+}
+
+void MainWindow::writeSettings()
+{
+    Interface *iface = qobject_cast<Interface*>(m_part);
+    Q_ASSERT(iface);
+    iface->config()->save();
+}
+
 void MainWindow::newArchive()
 {
     qCDebug(ARK) << "Creating new archive";
diff --git a/app/mainwindow.h b/app/mainwindow.h
index a7b2398..ec0340c 100644
--- a/app/mainwindow.h
+++ b/app/mainwindow.h
@@ -49,6 +49,8 @@ private slots:
     void newArchive();
     void openArchive();
     void quit();
+    void showSettings();
+    void writeSettings();
 
     void editKeyBindings();
     void editToolbars();
diff --git a/kerfuffle/CMakeLists.txt b/kerfuffle/CMakeLists.txt
index 2966410..1ef63bc 100644
--- a/kerfuffle/CMakeLists.txt
+++ b/kerfuffle/CMakeLists.txt
@@ -3,6 +3,9 @@
 set(kerfuffle_SRCS
     archive_kerfuffle.cpp
     archiveinterface.cpp
+    extractionsettingspage.cpp
+    previewsettingspage.cpp
+    settingspage.cpp
     jobs.cpp
 	extractiondialog.cpp
 	adddialog.cpp
@@ -14,6 +17,8 @@ set(kerfuffle_SRCS
 kconfig_add_kcfg_files(kerfuffle_SRCS settings.kcfgc)
 
 ki18n_wrap_ui(kerfuffle_SRCS extractiondialog.ui adddialog.ui )
+ki18n_wrap_ui(kerfuffle_SRCS extractionsettings.ui)
+ki18n_wrap_ui(kerfuffle_SRCS previewsettings.ui)
 
 add_library(kerfuffle SHARED ${kerfuffle_SRCS})
 generate_export_header(kerfuffle BASE_NAME kerfuffle)
diff --git a/kerfuffle/ark.kcfg b/kerfuffle/ark.kcfg
index a5731fb..8da488b 100644
--- a/kerfuffle/ark.kcfg
+++ b/kerfuffle/ark.kcfg
@@ -27,12 +27,14 @@
 			<label>Whether to show the information panel.</label>
 			<default>true</default>
 		</entry>
+	</group>
+	<group name="Preview">
 		<entry name="limitPreviewFileSize" type="Bool">
-			<label>Limit preview file size</label>
+			<label>Whether to limit the preview according to file size.</label>
 			<default>true</default>
 		</entry>
 		<entry name="previewFileSizeLimit" type="Int">
-			<label>Preview file size limit in megabytes</label>
+			<label>Preview file size limit in megabytes.</label>
 			<default>200</default>
 		</entry>
 	</group>
diff --git a/kerfuffle/extractionsettings.ui b/kerfuffle/extractionsettings.ui
new file mode 100644
index 0000000..eb78115
--- /dev/null
+++ b/kerfuffle/extractionsettings.ui
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ExtractionSettings</class>
+ <widget class="QWidget" name="ExtractionSettings">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>544</width>
+    <height>487</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QCheckBox" name="kcfg_openDestinationFolderAfterExtraction">
+     <property name="text">
+      <string>Open destination folder after extraction</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="kcfg_closeAfterExtraction">
+     <property name="text">
+      <string>Close Ark after extraction</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="kcfg_preservePaths">
+     <property name="text">
+      <string>Preserve paths when extracting</string>
+     </property>
+     <property name="checked">
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>388</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/kerfuffle/extractionsettingspage.cpp b/kerfuffle/extractionsettingspage.cpp
new file mode 100644
index 0000000..8b9e8cb
--- /dev/null
+++ b/kerfuffle/extractionsettingspage.cpp
@@ -0,0 +1,38 @@
+/*
+ * ark -- archiver for the KDE project
+ *
+ * Copyright (C) 2015 Elvis Angelaccio <elvis.angelaccio at kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "extractionsettingspage.h"
+
+namespace Kerfuffle
+{
+ExtractionSettingsPage::ExtractionSettingsPage(QWidget *parent, const QString &name, const QString &iconName)
+    : SettingsPage(parent, name, iconName)
+{
+    setupUi(this);
+}
+}
+
diff --git a/kerfuffle/extractionsettingspage.h b/kerfuffle/extractionsettingspage.h
new file mode 100644
index 0000000..534f52c
--- /dev/null
+++ b/kerfuffle/extractionsettingspage.h
@@ -0,0 +1,45 @@
+/*
+ * ark -- archiver for the KDE project
+ *
+ * Copyright (C) 2015 Elvis Angelaccio <elvis.angelaccio at kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef EXTRACTIONSETTINGSPAGE_H
+#define EXTRACTIONSETTINGSPAGE_H
+
+#include "settingspage.h"
+#include "ui_extractionsettings.h"
+
+namespace Kerfuffle
+{
+class KERFUFFLE_EXPORT ExtractionSettingsPage : public SettingsPage, public Ui::ExtractionSettings
+{
+    Q_OBJECT
+
+public:
+    explicit ExtractionSettingsPage(QWidget *parent = 0, const QString &name = QString(), const QString &iconName = QString());
+};
+}
+
+#endif
diff --git a/kerfuffle/previewsettings.ui b/kerfuffle/previewsettings.ui
new file mode 100644
index 0000000..7e1e440
--- /dev/null
+++ b/kerfuffle/previewsettings.ui
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PreviewSettings</class>
+ <widget class="QWidget" name="PreviewSettings">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>547</width>
+    <height>487</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QWidget" name="sizeLimitWidget" native="true">
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <widget class="QCheckBox" name="kcfg_limitPreviewFileSize">
+        <property name="enabled">
+         <bool>true</bool>
+        </property>
+        <property name="text">
+         <string>Disable preview for files larger than:</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QSpinBox" name="kcfg_previewFileSizeLimit">
+        <property name="suffix">
+         <string> megabytes</string>
+        </property>
+        <property name="minimum">
+         <number>10</number>
+        </property>
+        <property name="maximum">
+         <number>10000</number>
+        </property>
+        <property name="singleStep">
+         <number>10</number>
+        </property>
+        <property name="value">
+         <number>200</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>40</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/kerfuffle/previewsettingspage.cpp b/kerfuffle/previewsettingspage.cpp
new file mode 100644
index 0000000..bd947ea
--- /dev/null
+++ b/kerfuffle/previewsettingspage.cpp
@@ -0,0 +1,44 @@
+/*
+ * ark -- archiver for the KDE project
+ *
+ * Copyright (C) 2015 Elvis Angelaccio <elvis.angelaccio at kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "previewsettingspage.h"
+
+namespace Kerfuffle
+{
+PreviewSettingsPage::PreviewSettingsPage(QWidget *parent, const QString &name, const QString &iconName)
+    : SettingsPage(parent, name, iconName)
+{
+    setupUi(this);
+    connect(kcfg_limitPreviewFileSize, &QCheckBox::toggled, this, &PreviewSettingsPage::slotToggled);
+}
+
+void PreviewSettingsPage::slotToggled(bool enabled)
+{
+    kcfg_previewFileSizeLimit->setEnabled(enabled);
+}
+}
+
diff --git a/kerfuffle/previewsettingspage.h b/kerfuffle/previewsettingspage.h
new file mode 100644
index 0000000..6cbbd47
--- /dev/null
+++ b/kerfuffle/previewsettingspage.h
@@ -0,0 +1,48 @@
+/*
+ * ark -- archiver for the KDE project
+ *
+ * Copyright (C) 2015 Elvis Angelaccio <elvis.angelaccio at kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PREVIEWSETTINGSPAGE_H
+#define PREVIEWSETTINGSPAGE_H
+
+#include "settingspage.h"
+#include "ui_previewsettings.h"
+
+namespace Kerfuffle
+{
+class KERFUFFLE_EXPORT PreviewSettingsPage : public SettingsPage, public Ui::PreviewSettings
+{
+    Q_OBJECT
+
+public:
+    explicit PreviewSettingsPage(QWidget *parent = 0, const QString &name = QString(), const QString &iconName = QString());
+
+private slots:
+    void slotToggled(bool enabled);
+};
+}
+
+#endif
diff --git a/kerfuffle/settingspage.cpp b/kerfuffle/settingspage.cpp
new file mode 100644
index 0000000..76cb546
--- /dev/null
+++ b/kerfuffle/settingspage.cpp
@@ -0,0 +1,48 @@
+/*
+ * ark -- archiver for the KDE project
+ *
+ * Copyright (C) 2015 Elvis Angelaccio <elvis.angelaccio at kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "settingspage.h"
+
+namespace Kerfuffle
+{
+SettingsPage::SettingsPage(QWidget *parent, const QString &name, const QString &iconName)
+    : QWidget(parent),
+      m_name(name),
+      m_iconName(iconName)
+{}
+
+QString SettingsPage::name() const
+{
+    return m_name;
+}
+
+QString SettingsPage::iconName() const
+{
+    return m_iconName;
+}
+}
+
diff --git a/kerfuffle/settingspage.h b/kerfuffle/settingspage.h
new file mode 100644
index 0000000..b288664
--- /dev/null
+++ b/kerfuffle/settingspage.h
@@ -0,0 +1,53 @@
+/*
+ * ark -- archiver for the KDE project
+ *
+ * Copyright (C) 2015 Elvis Angelaccio <elvis.angelaccio at kdemail.net>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ( INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * ( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SETTINGSPAGE_H
+#define SETTINGSPAGE_H
+
+#include "kerfuffle_export.h"
+
+#include <QWidget>
+
+namespace Kerfuffle
+{
+class KERFUFFLE_EXPORT SettingsPage : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit SettingsPage(QWidget *parent = 0, const QString &name = QString(), const QString &iconName = QString());
+
+    QString name() const;
+    QString iconName() const;
+
+private:
+    QString m_name;
+    QString m_iconName;
+};
+}
+
+#endif
diff --git a/part/interface.h b/part/interface.h
index 40f5902..70eabf9 100644
--- a/part/interface.h
+++ b/part/interface.h
@@ -24,14 +24,23 @@
 #include <QStringList>
 #include <QtPlugin>
 
+namespace Kerfuffle
+{
+class SettingsPage;
+}
+
+class KConfigSkeleton;
+
 class Interface
 {
 public:
     virtual ~Interface() {}
 
     virtual bool isBusy() const = 0;
+    virtual KConfigSkeleton *config() const = 0;
+    virtual QList<Kerfuffle::SettingsPage*> settingsPages(QWidget *parent) const = 0;
 };
 
-Q_DECLARE_INTERFACE(Interface, "org.kde.kerfuffle.partinterface/0.42")
+Q_DECLARE_INTERFACE(Interface, "org.kde.kerfuffle.partinterface/0.43")
 
 #endif // INTERFACE_H
diff --git a/part/part.cpp b/part/part.cpp
index 9cd2780..5312bfc 100644
--- a/part/part.cpp
+++ b/part/part.cpp
@@ -31,8 +31,10 @@
 #include "jobtracker.h"
 #include "kerfuffle/archive_kerfuffle.h"
 #include "kerfuffle/extractiondialog.h"
+#include "kerfuffle/extractionsettingspage.h"
 #include "kerfuffle/jobs.h"
 #include "kerfuffle/settings.h"
+#include "kerfuffle/previewsettingspage.h"
 
 #include <KAboutData>
 #include <KActionCollection>
@@ -525,6 +527,20 @@ bool Part::isBusy() const
     return m_busy;
 }
 
+KConfigSkeleton *Part::config() const
+{
+    return ArkSettings::self();
+}
+
+QList<Kerfuffle::SettingsPage*> Part::settingsPages(QWidget *parent) const
+{
+    static QList<SettingsPage*> pages;
+    pages.append(new ExtractionSettingsPage(parent, i18n("Extraction settings"), QLatin1String("archive-extract")));
+    pages.append(new PreviewSettingsPage(parent, i18n("Preview settings"), QLatin1String("document-preview-archive")));
+
+    return pages;
+}
+
 void Part::slotLoadingStarted()
 {
 }
diff --git a/part/part.h b/part/part.h
index 92832c1..5098bd5 100644
--- a/part/part.h
+++ b/part/part.h
@@ -68,6 +68,8 @@ public:
     bool saveFile() Q_DECL_OVERRIDE;
 
     bool isBusy() const Q_DECL_OVERRIDE;
+    KConfigSkeleton *config() const Q_DECL_OVERRIDE;
+    QList<Kerfuffle::SettingsPage*> settingsPages(QWidget *parent) const Q_DECL_OVERRIDE;
 
 public slots:
     void extractSelectedFilesTo(const QString& localPath);


More information about the kde-doc-english mailing list