File indexing completed on 2023-12-03 05:04:23

0001 /*
0002     The configuration dialog of Smb4K
0003 
0004     SPDX-FileCopyrightText: 2004-2022 Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef SMB4KCONFIGDIALOG_H
0009 #define SMB4KCONFIGDIALOG_H
0010 
0011 // Qt includes
0012 #include <QAbstractButton>
0013 
0014 // KDE includes
0015 #include <KConfigDialog>
0016 
0017 // application specific includes
0018 #include "core/smb4kglobal.h"
0019 
0020 // forward declarations
0021 class Smb4KSettings;
0022 
0023 /**
0024  * This is the (new) configuration dialog of Smb4K.
0025  *
0026  * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0027  */
0028 
0029 class Q_DECL_EXPORT Smb4KConfigDialog : public KConfigDialog
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     /**
0035      * The constructor
0036      * @param parent        The parent widget
0037      * @param args          The argument list
0038      */
0039     Smb4KConfigDialog(QWidget *parent, const QList<QVariant> &args);
0040 
0041     /**
0042      * The destructor
0043      */
0044     ~Smb4KConfigDialog();
0045 
0046 protected Q_SLOTS:
0047     /**
0048      * Reimplemented from KConfigDialog. Used to do things that
0049      * KConfigDialog::updateSettings() does not do.
0050      */
0051     void updateSettings() override;
0052 
0053     /**
0054      * Enable/disable the "Apply" button if settings that are not managed by
0055      * KConfig XT have changed.
0056      */
0057     void slotEnableApplyButton();
0058 
0059     /**
0060      * This slot is used to check the settings of the different pages.
0061      *
0062      * @param current     the current dialog page
0063      * @param before      the previous dialog page
0064      */
0065     void slotCheckPage(KPageWidgetItem *current, KPageWidgetItem *before);
0066 
0067 private:
0068     /**
0069      * "User Interface" page
0070      */
0071     KPageWidgetItem *m_user_interface;
0072 
0073     /**
0074      * "Network" page
0075      */
0076     KPageWidgetItem *m_network;
0077 
0078     /**
0079      * "Authentication" page
0080      */
0081     KPageWidgetItem *m_authentication;
0082 
0083     /**
0084      * "Mounting" page
0085      */
0086     KPageWidgetItem *m_mounting;
0087 
0088     /**
0089      * "Synchronization" page
0090      */
0091     KPageWidgetItem *m_synchronization;
0092 
0093     /**
0094      * "Custom Settings" page
0095      */
0096     KPageWidgetItem *m_custom_settings;
0097 
0098     /**
0099      * "Profiles" page
0100      */
0101     KPageWidgetItem *m_profiles;
0102 
0103     /**
0104      * "Bookmarks" page
0105      */
0106     KPageWidgetItem *m_bookmarks;
0107 
0108     /**
0109      * Set up the config dialog.
0110      */
0111     void setupDialog();
0112 
0113     /**
0114      * Checks that mandatory needed input is provided for settings that
0115      * need it. This function will report all missing input to the user
0116      * via a message box.
0117      *
0118      * @param page          The page to check
0119      *
0120      * @returns TRUE if the check passed and FALSE if it failed.
0121      */
0122     bool checkSettings(KPageWidgetItem *page = nullptr);
0123 };
0124 
0125 #endif