File indexing completed on 2024-04-14 15:05:23
0001 /*************************************************************************** 0002 This class provides a container for the authentication data. 0003 ------------------- 0004 begin : Sa Feb 28 2004 0005 copyright : (C) 2004-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 SMB4KAUTHINFO_H 0027 #define SMB4KAUTHINFO_H 0028 0029 // application specific includes 0030 #include "smb4kbasicnetworkitem.h" 0031 #include "smb4kglobal.h" 0032 0033 // Qt includes 0034 #include <QString> 0035 #include <QScopedPointer> 0036 #include <QUrl> 0037 0038 // forward declarations 0039 class Smb4KAuthInfoPrivate; 0040 0041 using namespace Smb4KGlobal; 0042 0043 /** 0044 * This class provides a container for the authentication data. 0045 * 0046 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0047 */ 0048 0049 0050 class Q_DECL_EXPORT Smb4KAuthInfo 0051 { 0052 friend class Smb4KAuthInfoPrivate; 0053 0054 public: 0055 /** 0056 * Constructor 0057 * 0058 * @param item The network item 0059 */ 0060 explicit Smb4KAuthInfo(Smb4KBasicNetworkItem *item); 0061 0062 /** 0063 * The empty constructor. 0064 */ 0065 Smb4KAuthInfo(); 0066 0067 /** 0068 * The copy constructor. 0069 * 0070 * @param info The Smb4KAuthInfo object that will be copied. 0071 */ 0072 Smb4KAuthInfo(const Smb4KAuthInfo &info); 0073 0074 /** 0075 * The destructor 0076 */ 0077 ~Smb4KAuthInfo(); 0078 0079 /** 0080 * Sets the workgroup name. 0081 * 0082 * @param workgroup The name of the workgroup 0083 */ 0084 void setWorkgroupName(const QString &workgroup); 0085 0086 /** 0087 * Returns the name of the workgroup. 0088 * 0089 * @returns The workgroup of the server/share for which this 0090 * authentication data is for. 0091 */ 0092 QString workgroupName() const; 0093 0094 /** 0095 * Returns the host name. 0096 * 0097 * @returns the host name. 0098 */ 0099 QString hostName() const; 0100 0101 /** 0102 * Returns the share name. 0103 * 0104 * @returns the share name. 0105 */ 0106 QString shareName() const; 0107 0108 /** 0109 * Sets the username. 0110 * 0111 * In case of a 'homes' share, this function will also set the share 0112 * name to @p username. 0113 * 0114 * @param username The login for the server/share 0115 */ 0116 void setUserName(const QString &username); 0117 0118 /** 0119 * Returns the username. 0120 * 0121 * @returns The username 0122 */ 0123 QString userName() const; 0124 0125 /** 0126 * Sets the password. 0127 * 0128 * @param passwd The password for the server/share 0129 */ 0130 void setPassword(const QString &passwd); 0131 0132 /** 0133 * Returns the password. 0134 */ 0135 QString password() const; 0136 0137 /** 0138 * Returns the type. 0139 * 0140 * @returns the type. 0141 */ 0142 Smb4KGlobal::NetworkItem type() const; 0143 0144 /** 0145 * If the item is a homes share, this function returns TRUE. In 0146 * all other cases, this function returns FALSE. 0147 * 0148 * @returns TRUE if the item is a homes share. 0149 */ 0150 bool isHomesShare() const; 0151 0152 /** 0153 * Sets the URL of the share after some checks are passed. 0154 * 0155 * @param url The URL of the network item 0156 */ 0157 void setUrl(const QUrl &url); 0158 0159 /** 0160 * Sets the URL of the share. 0161 * 0162 * @param url The URL of the network item 0163 */ 0164 void setUrl(const QString &url); 0165 0166 /** 0167 * Returns the URL of the network item 0168 * 0169 * @returns the URL 0170 */ 0171 QUrl url() const; 0172 0173 /** 0174 * Sets the IP address for this authentication information object 0175 * 0176 * @param ip The IP address 0177 */ 0178 void setIpAddress(const QString &ip); 0179 0180 /** 0181 * Returns the IP address 0182 * 0183 * @returns the IP address 0184 */ 0185 QString ipAddress() const; 0186 0187 /** 0188 * Returns the display string. Prefer this over all other alternatives in your 0189 * GUI. 0190 * @returns the display string. 0191 */ 0192 QString displayString() const; 0193 0194 private: 0195 /** 0196 * Pointer to Smb4KAuthInfoPrivate class 0197 */ 0198 const QScopedPointer<Smb4KAuthInfoPrivate> d; 0199 }; 0200 0201 #endif