File indexing completed on 2024-04-21 05:01:35
0001 /* 0002 This class provides a container for the authentication data. 0003 0004 SPDX-FileCopyrightText: 2004-2022 Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef SMB4KAUTHINFO_H 0009 #define SMB4KAUTHINFO_H 0010 0011 // application specific includes 0012 #include "smb4kbasicnetworkitem.h" 0013 #include "smb4kglobal.h" 0014 0015 // Qt includes 0016 #include <QScopedPointer> 0017 #include <QString> 0018 #include <QUrl> 0019 0020 // forward declarations 0021 class Smb4KAuthInfoPrivate; 0022 0023 using namespace Smb4KGlobal; 0024 0025 /** 0026 * This class provides a container for the authentication data. 0027 * 0028 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0029 */ 0030 0031 class Q_DECL_EXPORT Smb4KAuthInfo 0032 { 0033 friend class Smb4KAuthInfoPrivate; 0034 0035 public: 0036 /** 0037 * Constructor 0038 * 0039 * @param item The network item 0040 */ 0041 explicit Smb4KAuthInfo(Smb4KBasicNetworkItem *item); 0042 0043 /** 0044 * The empty constructor. 0045 */ 0046 Smb4KAuthInfo(); 0047 0048 /** 0049 * The copy constructor. 0050 * 0051 * @param info The Smb4KAuthInfo object that will be copied. 0052 */ 0053 Smb4KAuthInfo(const Smb4KAuthInfo &info); 0054 0055 /** 0056 * The destructor 0057 */ 0058 ~Smb4KAuthInfo(); 0059 0060 /** 0061 * Sets the user name. 0062 * 0063 * In case of a 'homes' share, this function will also set the share 0064 * name to @p username. 0065 * 0066 * @param username The user name for the server/share 0067 */ 0068 void setUserName(const QString &username); 0069 0070 /** 0071 * Returns the username. 0072 * 0073 * @returns The username 0074 */ 0075 QString userName() const; 0076 0077 /** 0078 * Sets the password. 0079 * 0080 * @param passwd The password for the server/share 0081 */ 0082 void setPassword(const QString &passwd); 0083 0084 /** 0085 * Returns the password. 0086 */ 0087 QString password() const; 0088 0089 /** 0090 * Returns the type. 0091 * 0092 * @returns the type. 0093 */ 0094 Smb4KGlobal::NetworkItem type() const; 0095 0096 /** 0097 * Sets the URL of the share after some checks are passed. 0098 * 0099 * @param url The URL of the network item 0100 */ 0101 void setUrl(const QUrl &url); 0102 0103 /** 0104 * Returns the URL of the network item 0105 * 0106 * @returns the URL 0107 */ 0108 QUrl url() const; 0109 0110 /** 0111 * Returns the display string. Prefer this over all other alternatives in your 0112 * GUI. 0113 * @returns the display string. 0114 */ 0115 QString displayString() const; 0116 0117 private: 0118 /** 0119 * Pointer to Smb4KAuthInfoPrivate class 0120 */ 0121 const QScopedPointer<Smb4KAuthInfoPrivate> d; 0122 }; 0123 0124 #endif