summaryrefslogtreecommitdiffstats
path: root/smb4k/configdlg/smb4kconfigdialog.h
diff options
context:
space:
mode:
Diffstat (limited to 'smb4k/configdlg/smb4kconfigdialog.h')
-rw-r--r--smb4k/configdlg/smb4kconfigdialog.h208
1 files changed, 208 insertions, 0 deletions
diff --git a/smb4k/configdlg/smb4kconfigdialog.h b/smb4k/configdlg/smb4kconfigdialog.h
new file mode 100644
index 0000000..8e6f9f8
--- /dev/null
+++ b/smb4k/configdlg/smb4kconfigdialog.h
@@ -0,0 +1,208 @@
+/***************************************************************************
+ smb4kconfigdialog - The configuration dialog of Smb4K
+ -------------------
+ begin : Sa Apr 14 2007
+ copyright : (C) 2007 by Alexander Reinholdt
+ email : dustpuppy@users.berlios.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef SMB4KCONFIGDIALOG_H
+#define SMB4KCONFIGDIALOG_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// KDE includes
+#include <kconfigdialog.h>
+#include <klibloader.h>
+#include <kaboutdata.h>
+#include <kinstance.h>
+
+// forward declarations
+class Smb4KSettings;
+
+/**
+ * This is the (new) configuration dialog of Smb4K.
+ *
+ * @author Alexander Reinholdt <dustpuppy@users.berlios.de>
+ */
+
+class Smb4KConfigDialog : public KConfigDialog
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor.
+ *
+ * @param settings The Smb4KSettings object that needs to be passed
+ * so that the settings can be managed.
+ *
+ * @param parent The parent widget
+ *
+ * @param name The name of this dialog
+ */
+ Smb4KConfigDialog( Smb4KSettings *settings, QWidget *parent = 0, const char *name = 0 );
+
+ /**
+ * The destructor
+ */
+ ~Smb4KConfigDialog();
+
+ protected:
+ /**
+ * Reimplemented from QWidget to do last things before the
+ * configuration dialog is shown.
+ *
+ * @param e The show event object
+ */
+ void showEvent( QShowEvent *e );
+
+ protected slots:
+ /**
+ * Reimplemented from KConfigDialog. This slot does application
+ * specific stuff first and then executes KConfigDialog::slotApply().
+ */
+ void slotApply();
+
+ /**
+ * Reimplemented from KConfigDialog. This slot does application
+ * specific stuff first and then executes KConfigDialog::slotOk().
+ */
+ void slotOk();
+
+ /**
+ *Reimplemented from KConfigDialog. This slot does application
+ * specific stuff first and then executes KConfigDialog::slotCancel().
+ */
+ void slotCancel();
+
+ /**
+ * The custom Samba settings changed. Decide if we have to
+ * enable the 'Apply' button or not.
+ */
+ void slotCustomSambaSettingsChanged();
+
+ /**
+ * The 'Remove Entries' button in the 'Super User' page has been
+ * clicked. Initialize the removal of Smb4K's configuration entries
+ * from the configuration file of the currently chosen program.
+ */
+ void slotRemoveSuperUserEntries();
+
+ /**
+ * This slot is activated if the Smb4KFileIO::failed() signal is
+ * received. It deselects all check boxes in the "Super User" page.
+ */
+ void slotReceivedFileIOFailed();
+
+ /**
+ * This slot is activated if the Smb4KFileIO::finished() signal is
+ * received. It closes the dialog by invoking KConfigDialog::slotOk().
+ */
+ void slotReceivedFileIOFinished();
+
+ private:
+ /**
+ * Load the custom Samba options
+ */
+ void loadCustomSambaOptions();
+
+ /**
+ * Save the custom Samba options
+ */
+ void saveCustomSambaOptions();
+
+ /**
+ * Load the authentication data
+ */
+ void loadAuthenticationData();
+
+ /**
+ * Save the authentication data
+ */
+ void saveAuthenticationData();
+
+ /**
+ * Write super user configuration entries to configuration file.
+ *
+ * @returns TRUE if something needs to be written.
+ */
+ bool writeSuperUserEntries();
+
+ /**
+ * Remove super user configuration entries from the configuration file.
+ */
+ void removeSuperUserEntries();
+
+ /**
+ * Checks that mandatorily needed input is provided for settings that
+ * need it. This function will report all missing input to the user
+ * via a message box.
+ *
+ * @returns TRUE if the check passed and FALSE if it failed.
+ */
+ bool checkSettings();
+};
+
+
+class KInstance;
+class KAboutData;
+
+
+class Smb4KConfigDialogFactory : KLibFactory
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * The constructor.
+ */
+ Smb4KConfigDialogFactory();
+
+ /**
+ * The destructor.
+ */
+ virtual ~Smb4KConfigDialogFactory();
+
+ /**
+ * The instance
+ */
+ static KInstance *instance();
+
+ protected:
+ QObject *createObject( QObject *parent = 0, const char *name = 0,
+ const char *classname = "QObject",
+ const QStringList &args = QStringList() );
+
+ private:
+ /**
+ * The factory's instance
+ */
+ static KInstance *m_instance;
+
+ /**
+ * The factory's KAboutData object
+ */
+ static KAboutData *m_about;
+};
+
+#endif