File indexing completed on 2024-05-19 08:54:42

0001 /*
0002     The configuration dialog of Smb4K
0003 
0004     SPDX-FileCopyrightText: 2004-2023 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 // application specific includes
0012 #include "core/smb4kglobal.h"
0013 #include "smb4kconfigpageauthentication.h"
0014 #include "smb4kconfigpagebookmarks.h"
0015 #include "smb4kconfigpagecustomsettings.h"
0016 #include "smb4kconfigpagemounting.h"
0017 #include "smb4kconfigpagenetwork.h"
0018 #include "smb4kconfigpageprofiles.h"
0019 #include "smb4kconfigpagesynchronization.h"
0020 #include "smb4kconfigpageuserinterface.h"
0021 
0022 // Qt includes
0023 #include <QAbstractButton>
0024 
0025 // KDE includes
0026 #include <KConfigDialog>
0027 
0028 // forward declarations
0029 class Smb4KSettings;
0030 
0031 /**
0032  * This is the (new) configuration dialog of Smb4K.
0033  *
0034  * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0035  */
0036 
0037 class Q_DECL_EXPORT Smb4KConfigDialog : public KConfigDialog
0038 {
0039     Q_OBJECT
0040 
0041 public:
0042     /**
0043      * The constructor
0044      * @param parent        The parent widget
0045      * @param args          The argument list
0046      */
0047     Smb4KConfigDialog(QWidget *parent, const QList<QVariant> &args);
0048 
0049     /**
0050      * The destructor
0051      */
0052     ~Smb4KConfigDialog();
0053 
0054 protected Q_SLOTS:
0055     /**
0056      * Reimplemented from KConfigDialog. Used to do things that
0057      * KConfigDialog::updateSettings() does not do.
0058      */
0059     void updateSettings() override;
0060 
0061     /**
0062      * Enable/disable the "Apply" button if settings that are not managed by
0063      * KConfig XT have changed.
0064      */
0065     void slotEnableApplyButton();
0066 
0067     /**
0068      * This slot is used to check the settings of the different pages.
0069      *
0070      * @param current     the current dialog page
0071      * @param before      the previous dialog page
0072      */
0073     void slotCheckPage(KPageWidgetItem *current, KPageWidgetItem *before);
0074 
0075 private:
0076     /**
0077      * Set up the config dialog.
0078      */
0079     void setupDialog();
0080 
0081     /**
0082      * Checks that mandatory needed input is provided for settings that
0083      * need it. This function will report all missing input to the user
0084      * via a message box.
0085      *
0086      * @param page          The page to check
0087      *
0088      * @returns TRUE if the check passed and FALSE if it failed.
0089      */
0090     bool checkSettings(KPageWidgetItem *page = nullptr);
0091 
0092     Smb4KConfigPageUserInterface *m_userInterfacePage;
0093     Smb4KConfigPageNetwork *m_networkPage;
0094     Smb4KConfigPageMounting *m_mountingPage;
0095     Smb4KConfigPageAuthentication *m_authenticationPage;
0096     Smb4KConfigPageSynchronization *m_synchronizationPage;
0097     Smb4KConfigPageCustomSettings *m_customSettingsPage;
0098     Smb4KConfigPageProfiles *m_profilesPage;
0099     Smb4KConfigPageBookmarks *m_bookmarksPage;
0100 
0101     KPageWidgetItem *m_userInterface;
0102     KPageWidgetItem *m_network;
0103     KPageWidgetItem *m_mounting;
0104     KPageWidgetItem *m_authentication;
0105     KPageWidgetItem *m_synchronization;
0106     KPageWidgetItem *m_customSettings;
0107     KPageWidgetItem *m_profiles;
0108     KPageWidgetItem *m_bookmarks;
0109 };
0110 
0111 #endif