File indexing completed on 2024-02-25 05:12:01

0001 /*
0002  *  Editor dialog for the custom settings
0003  *
0004  *  SPDX-FileCopyrightText: 2023 Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef SMB4KCUSTOMSETTINGSDIALOG_H
0009 #define SMB4KCUSTOMSETTINGSDIALOG_H
0010 
0011 // application specific includes
0012 #include "core/smb4kglobal.h"
0013 #include "smb4kcustomsettingseditorwidget.h"
0014 
0015 // Qt includes
0016 #include <QDialog>
0017 #include <QPushButton>
0018 
0019 class Q_DECL_EXPORT Smb4KCustomSettingsEditor : public QDialog
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     /**
0025      * Constructor
0026      */
0027     explicit Smb4KCustomSettingsEditor(QWidget *parent = nullptr);
0028 
0029     /**
0030      * Destructor
0031      */
0032     virtual ~Smb4KCustomSettingsEditor();
0033 
0034     /**
0035      * Set the network item. Ideally, this function should be used before
0036      * the dialog is shown.
0037      *
0038      * This function should be run before the dialog is shown.
0039      *
0040      * @param networkItem       The network item for which the custom settings
0041      *                          should be defined
0042      *
0043      * @returns TRUE if a network item was set and false otherwise
0044      */
0045     bool setNetworkItem(NetworkItemPtr networkItem);
0046 
0047 protected Q_SLOTS:
0048     void slotRestoreDefaults();
0049     void slotSaveCustomSettings();
0050     void slotCustomSettingsEdited(bool changed);
0051     void slotCustomSettingsUpdated();
0052 
0053 private:
0054     CustomSettingsPtr m_customSettings;
0055     QLabel *m_descriptionText;
0056     Smb4KCustomSettingsEditorWidget *m_editorWidget;
0057     QPushButton *m_resetButton;
0058     QPushButton *m_saveButton;
0059     QPushButton *m_cancelButton;
0060     bool m_defaultsRestored;
0061     bool m_changedCustomSettings;
0062     bool m_savingCustomSettings;
0063 };
0064 
0065 #endif