File indexing completed on 2024-12-08 04:34:48

0001 /*
0002  *  Editor widget 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 SMB4KCUSTOMSETTINGSEDITORWIDGET_H
0009 #define SMB4KCUSTOMSETTINGSEDITORWIDGET_H
0010 
0011 // application specific includes
0012 #include "core/smb4kglobal.h"
0013 
0014 // Qt includes
0015 #include <QCheckBox>
0016 #include <QLabel>
0017 #include <QSpinBox>
0018 #include <QTabWidget>
0019 
0020 // KDE includes
0021 #include <KComboBox>
0022 #include <KLineEdit>
0023 
0024 /**
0025  * This widget is used to edit custom settings
0026  *
0027  * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0028  * @since 3.3.0
0029  */
0030 
0031 class Smb4KCustomSettingsEditorWidget : public QTabWidget
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     /**
0037      * Constructor
0038      */
0039     explicit Smb4KCustomSettingsEditorWidget(QWidget *parent = nullptr);
0040 
0041     /**
0042      * Destructor
0043      */
0044     virtual ~Smb4KCustomSettingsEditorWidget();
0045 
0046     /**
0047      * Set the custom settings object that needs to be edited
0048      */
0049     void setCustomSettings(const Smb4KCustomSettings &settings);
0050 
0051     /**
0052      * Get the custom settings object that has been edited
0053      */
0054     Smb4KCustomSettings getCustomSettings() const;
0055 
0056     /**
0057      * Clears the input widgets
0058      */
0059     void clear();
0060 
0061 Q_SIGNALS:
0062     void edited(bool changed);
0063 
0064 protected Q_SLOTS:
0065     void slotAlwaysRemoutShareToggled(bool checked);
0066 #ifdef Q_OS_LINUX
0067     void slotUseWriteAccessToggled(bool checked);
0068     void slotWriteAccessChanged(int index);
0069     void slotUseFileSystemPortToggled(bool checked);
0070     void slotFileSystemPortChanged(int port);
0071     void slotCifsUnixExtensionSupportToggled(bool checked);
0072 #endif
0073     void slotUseUserIdToggled(bool checked);
0074     void slotUserIdChanged(int index);
0075     void slotUseGroupIdToggled(bool checked);
0076     void slotGroupIdChanged(int index);
0077     void slotUseFileModeToggled(bool checked);
0078     void slotFileModeChanged(const QString &text);
0079     void slotUseDirectoryModeToggled(bool checked);
0080     void slotDirectoryModeChanged(const QString &text);
0081 #ifdef Q_OS_LINUX
0082     void slotUseSmbMountProtocolVersionToggled(bool checked);
0083     void slotSmbMountProtocolVersionChanged(int index);
0084     void slotUseSecurityModeToggled(bool checked);
0085     void slotSecurityModeChanged(int index);
0086 #endif
0087     void slotUseClientProtocolVersionsToggled(bool checked);
0088     void slotMinimalClientProtocolVersionChanged(int index);
0089     void slotMaximalClientProtocolVersionChanged(int index);
0090     void slotUseRemoteSmbPortToggled(bool checked);
0091     void slotRemoteSmbPortChanged(int port);
0092     void slotUseKerberosToggled(bool checked);
0093     void slotMacAddressChanged(const QString &text);
0094     void slotSendPacketBeforeScanToggled(bool checked);
0095     void slotSendPacketBeforeMountToggled(bool checked);
0096 
0097 private:
0098     void setupView();
0099     void checkValues();
0100     bool m_haveCustomSettings;
0101     Smb4KCustomSettings m_customSettings;
0102     QCheckBox *m_alwaysRemountShare;
0103 #ifdef Q_OS_LINUX
0104     QCheckBox *m_useWriteAccess;
0105     KComboBox *m_writeAccess;
0106     QCheckBox *m_useFileSystemPort;
0107     QSpinBox *m_fileSystemPort;
0108     QCheckBox *m_cifsUnixExtensionSupport;
0109 #endif
0110     QCheckBox *m_useUserId;
0111     KComboBox *m_userId;
0112     QCheckBox *m_useGroupId;
0113     KComboBox *m_groupId;
0114     QCheckBox *m_useFileMode;
0115     KLineEdit *m_fileMode;
0116     QCheckBox *m_useDirectoryMode;
0117     KLineEdit *m_directoryMode;
0118 #ifdef Q_OS_LINUX
0119     QCheckBox *m_useSmbMountProtocolVersion;
0120     KComboBox *m_smbMountProtocolVersion;
0121     QCheckBox *m_useSecurityMode;
0122     KComboBox *m_securityMode;
0123 #endif
0124     QCheckBox *m_useClientProtocolVersions;
0125     QLabel *m_minimalClientProtocolVersionLabel;
0126     KComboBox *m_minimalClientProtocolVersion;
0127     QLabel *m_maximalClientProtocolVersionLabel;
0128     KComboBox *m_maximalClientProtocolVersion;
0129     QCheckBox *m_useRemoteSmbPort;
0130     QSpinBox *m_remoteSmbPort;
0131     QCheckBox *m_useKerberos;
0132     QLabel *m_macAddressLabel;
0133     KLineEdit *m_macAddress;
0134     QCheckBox *m_sendPacketBeforeScan;
0135     QCheckBox *m_sendPacketBeforeMount;
0136 };
0137 
0138 #endif