File indexing completed on 2024-04-14 15:05:30
0001 /*************************************************************************** 0002 This file contains private helper classes for the Smb4KMounter class. 0003 ------------------- 0004 begin : Do Jul 19 2007 0005 copyright : (C) 2007-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 SMB4KMOUNTER_P_H 0027 #define SMB4KMOUNTER_P_H 0028 0029 // application specific includes 0030 #include "smb4kmounter.h" 0031 #include "smb4kglobal.h" 0032 0033 // Qt includes 0034 #include <QString> 0035 #include <QDebug> 0036 #include <QCheckBox> 0037 #include <QDialog> 0038 #include <QPushButton> 0039 #include <QPointer> 0040 0041 // KDE includes 0042 #include <KCompletion/KLineEdit> 0043 0044 0045 0046 class Smb4KMountDialog : public QDialog 0047 { 0048 Q_OBJECT 0049 0050 public: 0051 /** 0052 * The constructor. 0053 * 0054 * @param parent The parent widget 0055 */ 0056 explicit Smb4KMountDialog(const SharePtr &share, QWidget *parent = 0); 0057 0058 /** 0059 * The destructor. 0060 */ 0061 ~Smb4KMountDialog(); 0062 0063 /** 0064 * Returns if the share should be bookmarked or not. 0065 * 0066 * @returns TRUE if the share should be bookmarked 0067 */ 0068 bool bookmarkShare() { return m_bookmark->isChecked(); } 0069 0070 /** 0071 * Returns if the user input is valid or not. 0072 * 0073 * @returns TRUE if the user input is valid. 0074 */ 0075 bool validUserInput() { return m_valid; } 0076 0077 protected Q_SLOTS: 0078 /** 0079 * This slot is activated if the OK button has been clicked. 0080 */ 0081 void slotOkClicked(); 0082 0083 /** 0084 * This slot is activated if the Cancel button has been clicked. 0085 */ 0086 void slotCancelClicked(); 0087 0088 /** 0089 * This slot is being enabled if there is input text. 0090 * 0091 * @param text The input text. 0092 */ 0093 void slotChangeInputValue(const QString &text); 0094 0095 /** 0096 * This slot is used for making text completion for the share edit line 0097 * work. 0098 */ 0099 void slotShareNameEntered(); 0100 0101 /** 0102 * This slot is used for making text completion for the IP edit line 0103 * work. 0104 */ 0105 void slotIPEntered(); 0106 0107 /** 0108 * This slot is used for making text completion for the workgroup edit 0109 * line work. 0110 */ 0111 void slotWorkgroupEntered(); 0112 0113 private: 0114 /** 0115 * This function sets up the view. 0116 */ 0117 void setupView(); 0118 0119 /** 0120 * The Ok button 0121 */ 0122 QPushButton *m_ok_button; 0123 0124 /** 0125 * The Cancel button 0126 */ 0127 QPushButton *m_cancel_button; 0128 0129 /** 0130 * The line edit where the user has to enter the share. 0131 */ 0132 KLineEdit *m_share_input; 0133 0134 /** 0135 * The line edit where the user can enter the IP address. 0136 */ 0137 KLineEdit *m_ip_input; 0138 0139 /** 0140 * The line edit where the user can enter the workgroup. 0141 */ 0142 KLineEdit *m_workgroup_input; 0143 0144 /** 0145 * This checkbox determines whether the share should be added to the 0146 * bookmarks. 0147 */ 0148 QCheckBox *m_bookmark; 0149 0150 /** 0151 * The share that is passed to the mounter. 0152 */ 0153 SharePtr m_share; 0154 0155 /** 0156 * Valid user input? 0157 */ 0158 bool m_valid; 0159 }; 0160 0161 0162 class Smb4KMounterPrivate 0163 { 0164 public: 0165 int remountTimeout; 0166 int remountAttempts; 0167 int timerId; 0168 int checkTimeout; 0169 int newlyMounted; 0170 int newlyUnmounted; 0171 QPointer<Smb4KMountDialog> dialog; 0172 QList<SharePtr> importedShares; 0173 QList<SharePtr> retries; 0174 QList<SharePtr> remounts; 0175 QString activeProfile; 0176 bool detectAllShares; 0177 bool firstImportDone; 0178 bool longActionRunning; 0179 }; 0180 0181 0182 class Smb4KMounterStatic 0183 { 0184 public: 0185 Smb4KMounter instance; 0186 }; 0187 0188 #endif