File indexing completed on 2024-04-14 15:05:29
0001 /*************************************************************************** 0002 Private helpers for the homes shares handler 0003 ------------------- 0004 begin : Mo Apr 11 2011 0005 copyright : (C) 2011-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, 51 Franklin Street, Suite 500, Boston, * 0023 * MA 02110-1335 USA * 0024 ***************************************************************************/ 0025 0026 #ifndef SMB4KHOMESSHARESHANDLER_P_H 0027 #define SMB4KHOMESSHARESHANDLER_P_H 0028 0029 // application specific includes 0030 #include "smb4khomesshareshandler.h" 0031 #include "smb4kglobal.h" 0032 0033 // Qt includes 0034 #include <QStringList> 0035 #include <QDialog> 0036 #include <QPushButton> 0037 #include <QHostAddress> 0038 0039 // KDE includes 0040 #include <KCompletion/KComboBox> 0041 0042 0043 class Smb4KHomesUsers 0044 { 0045 public: 0046 /** 0047 * Constructor 0048 */ 0049 Smb4KHomesUsers(const SharePtr &share, const QStringList &users); 0050 0051 /** 0052 * Copy constructor 0053 */ 0054 Smb4KHomesUsers(const Smb4KHomesUsers &users); 0055 0056 /** 0057 * Empty constructor 0058 */ 0059 Smb4KHomesUsers(); 0060 0061 /** 0062 * Destructor 0063 */ 0064 ~Smb4KHomesUsers(); 0065 0066 /** 0067 * Workgroup name 0068 */ 0069 QString workgroupName() const; 0070 0071 /** 0072 * Set workgroup name 0073 */ 0074 void setWorkgroupName(const QString &name); 0075 0076 /** 0077 * Host name 0078 */ 0079 QString hostName() const; 0080 0081 /** 0082 * Set host name 0083 */ 0084 void setHostName(const QString &name); 0085 0086 /** 0087 * Share name 0088 */ 0089 QString shareName() const; 0090 0091 /** 0092 * Set share name 0093 */ 0094 void setShareName(const QString &name); 0095 0096 /** 0097 * IP address 0098 */ 0099 QString hostIP() const; 0100 0101 /** 0102 * Set IP address 0103 */ 0104 void setHostIP(const QString &ip); 0105 0106 /** 0107 * User list 0108 */ 0109 QStringList users() const; 0110 0111 /** 0112 * Set user list 0113 */ 0114 void setUsers(const QStringList &users); 0115 0116 /** 0117 * Profile 0118 */ 0119 QString profile() const; 0120 0121 /** 0122 * Set profile 0123 */ 0124 void setProfile(const QString &profile); 0125 0126 private: 0127 QString m_workgroup_name; 0128 QString m_host_name; 0129 QString m_share_name; 0130 QHostAddress m_host_ip; 0131 QStringList m_users; 0132 QString m_profile; 0133 }; 0134 0135 0136 class Smb4KHomesUserDialog : public QDialog 0137 { 0138 Q_OBJECT 0139 0140 public: 0141 /** 0142 * Constructor 0143 */ 0144 explicit Smb4KHomesUserDialog(const SharePtr &share, QWidget *parent = 0); 0145 0146 /** 0147 * Destructor 0148 */ 0149 ~Smb4KHomesUserDialog(); 0150 0151 /** 0152 * Set the user names 0153 */ 0154 void setUserNames(const QStringList &users); 0155 0156 /** 0157 * Get the user names 0158 */ 0159 QStringList userNames(); 0160 0161 /** 0162 * Get the user name to use 0163 */ 0164 QString login() { return m_user_combo->currentText(); } 0165 0166 protected Q_SLOTS: 0167 /** 0168 * Is connected to the textChanged() signal of the combo box 0169 * in the "Specify User" dialog. 0170 * 0171 * @param text The text in the combo box 0172 */ 0173 void slotTextChanged(const QString &text); 0174 0175 /** 0176 * This slot is called if the User1 button, i.e. the "Clear" button 0177 * in the "Specify User" dialog has been clicked. It removes all 0178 * entries from the combo box. 0179 */ 0180 void slotClearClicked(); 0181 0182 /** 0183 * This slot is called when the "OK" button is clicked. 0184 */ 0185 void slotOkClicked(); 0186 0187 /** 0188 * This slot is used to add the input text to the completion object 0189 * of the input combo box. 0190 */ 0191 void slotHomesUserEntered(); 0192 0193 private: 0194 void setupView(); 0195 QPushButton *m_clear_button; 0196 QPushButton *m_ok_button; 0197 QPushButton *m_cancel_button; 0198 KComboBox *m_user_combo; 0199 SharePtr m_share; 0200 }; 0201 0202 0203 class Smb4KHomesSharesHandlerPrivate 0204 { 0205 public: 0206 QList<Smb4KHomesUsers *> homesUsers; 0207 }; 0208 0209 0210 class Smb4KHomesSharesHandlerStatic 0211 { 0212 public: 0213 Smb4KHomesSharesHandler instance; 0214 }; 0215 0216 #endif