File indexing completed on 2024-09-01 14:05:03
0001 /*************************************************************************** 0002 The configuration page for the custom options 0003 ------------------- 0004 begin : Sa Jan 19 2013 0005 copyright : (C) 2013-2019 by Alexander Reinholdt 0006 email : alexander.reinholdt@kdemail.net 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * This program is free software; you can redistribute it and/or modify * 0011 * it under the terms of the GNU General Public License as published by * 0012 * the Free Software Foundation; either version 2 of the License, or * 0013 * (at your option) any later version. * 0014 * * 0015 * This program is distributed in the hope that it will be useful, but * 0016 * WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 0018 * General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program; if not, write to the * 0022 * Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,* 0023 * MA 02110-1335, USA * 0024 ***************************************************************************/ 0025 0026 #ifndef SMB4KCONFIGPAGECUSTOMOPTIONS_H 0027 #define SMB4KCONFIGPAGECUSTOMOPTIONS_H 0028 0029 // application specific includes 0030 #include "core/smb4kglobal.h" 0031 0032 // Qt includes 0033 #include <QEvent> 0034 #include <QWidget> 0035 #include <QCheckBox> 0036 #include <QGroupBox> 0037 #include <QListWidget> 0038 #include <QSpinBox> 0039 #include <QTabWidget> 0040 0041 // KDE includes 0042 #include <KCompletion/KComboBox> 0043 #include <KCompletion/KLineEdit> 0044 #include <KWidgetsAddons/KActionMenu> 0045 #include <KXmlGui/KActionCollection> 0046 0047 0048 /** 0049 * This configuration page contains the custom options 0050 * 0051 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0052 * @since 1.1.0 0053 */ 0054 0055 class Smb4KConfigPageCustomOptions : public QWidget 0056 { 0057 Q_OBJECT 0058 0059 public: 0060 /** 0061 * Constructor 0062 */ 0063 explicit Smb4KConfigPageCustomOptions(QWidget *parent = 0); 0064 0065 /** 0066 * Destructor 0067 */ 0068 virtual ~Smb4KConfigPageCustomOptions(); 0069 0070 /** 0071 * This function inserts a list of custom option items into the list widget. 0072 * 0073 * @param list The list with Smb4KSambaOptions objects 0074 */ 0075 void insertCustomOptions(const QList<OptionsPtr> &list); 0076 0077 /** 0078 * This function returns the list of custom option items that are currently 0079 * in the list widget. 0080 * 0081 * @returns the list of custom option items. 0082 */ 0083 const QList<OptionsPtr> getCustomOptions(); 0084 0085 /** 0086 * Returns TRUE if there may be changed custom settings. You must check if 0087 * this is indeed the case in you code. 0088 * 0089 * @returns TRUE if custom settings may have changed. 0090 */ 0091 bool customSettingsMaybeChanged() { return m_maybe_changed; } 0092 0093 protected: 0094 /** 0095 * Reimplemented from QObject 0096 */ 0097 bool eventFilter(QObject *obj, QEvent *e) override; 0098 0099 Q_SIGNALS: 0100 /** 0101 * This signal is emitted every time the custom settings potentially were 0102 * modified by the user. When this signal is emitted, it does not necessarily 0103 * mean that any custom setting changed. It only means that the user edited 0104 * one option. 0105 */ 0106 void customSettingsModified(); 0107 0108 protected Q_SLOTS: 0109 /** 0110 * This slot is invoked when an item is double clicked. It is used 0111 * to edit the item the user double clicked. 0112 * 0113 * @param item The item that was double clicked. 0114 */ 0115 void slotEditCustomItem(QListWidgetItem *item); 0116 0117 /** 0118 * This slot is invoked when the selection in the custom list widget 0119 * changed. 0120 */ 0121 void slotItemSelectionChanged(); 0122 0123 /** 0124 * This slot is invoked when the custom context menu for the custom 0125 * options widget is requested. 0126 * 0127 * @param pos The position where the context menu was requested. 0128 */ 0129 void slotCustomContextMenuRequested(const QPoint &pos); 0130 0131 /** 0132 * This slot is connected to the "Edit" action found in the context menu. 0133 * It is called when this action is triggered. 0134 * 0135 * @param checked TRUE if the action is checked and FALSE otherwise. 0136 */ 0137 void slotEditActionTriggered(bool); 0138 0139 /** 0140 * This slot is connected to the "Remove" action found in the context menu. 0141 * It is called when this action is triggered. 0142 * 0143 * @param checked TRUE if the action is checked and FALSE otherwise. 0144 */ 0145 void slotRemoveActionTriggered(bool); 0146 0147 /** 0148 * This slot is connected to the "Clear List" action found in the context 0149 * menu. It is called when this action is triggered. 0150 * 0151 * @param checked TRUE if the action is checked and FALSE otherwise. 0152 */ 0153 void slotClearActionTriggered(bool); 0154 0155 /** 0156 * This slot is called when a value was changed. 0157 */ 0158 void slotEntryChanged(); 0159 0160 /** 0161 * Enable the options for sending Wake-On-LAN magic packages, if the MAC 0162 * address was entered correctly. 0163 */ 0164 void slotEnableWOLFeatures(const QString &mac_address); 0165 0166 /** 0167 * Enables / disables the settings use when the CIFS Unix extensions are 0168 * not supported / supported. 0169 */ 0170 void slotCifsUnixExtensionsSupport(bool on); 0171 0172 private: 0173 void setupMountingTab(); 0174 void clearEditors(); 0175 void setCurrentOptions(const QString &url); 0176 void populateEditors(); 0177 void commitChanges(); 0178 0179 QList<OptionsPtr> m_optionsList; 0180 OptionsPtr m_currentOptions; 0181 bool m_maybe_changed; 0182 }; 0183 0184 #endif 0185