File indexing completed on 2024-04-21 05:01:38
0001 /* 0002 Smb4K's container class for information about a directory or file. 0003 0004 SPDX-FileCopyrightText: 2018-2023 Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef SMB4KFILE_H 0009 #define SMB4KFILE_H 0010 0011 // application specific includes 0012 #include "smb4kbasicnetworkitem.h" 0013 0014 // Qt includes 0015 #include <QHostAddress> 0016 #include <QScopedPointer> 0017 0018 class Smb4KFilePrivate; 0019 0020 class Q_DECL_EXPORT Smb4KFile : public Smb4KBasicNetworkItem 0021 { 0022 public: 0023 /** 0024 * Constructor 0025 * 0026 * @param url The URL of the file or directory 0027 */ 0028 Smb4KFile(const QUrl &url); 0029 0030 /** 0031 * Copy constructor 0032 * 0033 * @param file The other Smb4KFile object 0034 */ 0035 Smb4KFile(const Smb4KFile &file); 0036 0037 /** 0038 * Empty constructor 0039 */ 0040 Smb4KFile(); 0041 0042 /** 0043 * Destructor 0044 */ 0045 ~Smb4KFile(); 0046 0047 /** 0048 * Sets the workgroup name to @p name. 0049 * 0050 * @param name The workgroup name 0051 */ 0052 void setWorkgroupName(const QString &name) const; 0053 0054 /** 0055 * Returns the workgroup name. 0056 * 0057 * @returns the workgroup name. 0058 */ 0059 QString workgroupName() const; 0060 0061 /** 0062 * Returns the host's name. 0063 * 0064 * @returns the name of the host. 0065 */ 0066 QString hostName() const; 0067 0068 /** 0069 * Set the host's IP address to @p ip. 0070 * 0071 * @param ip The IP address of the host 0072 */ 0073 void setHostIpAddress(const QHostAddress &address) const; 0074 0075 /** 0076 * Returns the host's IP address. 0077 * 0078 * @returns the IP address 0079 */ 0080 QString hostIpAddress() const; 0081 0082 /** 0083 * Returns TRUE if the host's IP address is set and FALSE otherwise. 0084 * 0085 * @returns TRUE if the host's IP address is set and FALSE otherwise. 0086 */ 0087 bool hasHostIpAddress() const; 0088 0089 /** 0090 * Returns the share's name. 0091 * 0092 * @returns the name of the share. 0093 */ 0094 QString shareName() const; 0095 0096 /** 0097 * Set the user name for the share where this file or directory is located to @p name. 0098 * 0099 * @param name The user name 0100 */ 0101 void setUserName(const QString &name) const; 0102 0103 /** 0104 * Return the user name for the share where this file or directory is located. 0105 * 0106 * @returns the user name 0107 */ 0108 QString userName() const; 0109 0110 /** 0111 * Set the password for the share where this file or directory is located to @p pass. 0112 * 0113 * @param pass The password 0114 */ 0115 void setPassword(const QString &pass) const; 0116 0117 /** 0118 * Return the password for the share where this file or directory is located. 0119 * 0120 * @returns the password 0121 */ 0122 QString password() const; 0123 0124 /** 0125 * Indicate that this network item is a directory. 0126 * 0127 * @param directory Set this to TRUE if this is a directory 0128 */ 0129 void setDirectory(bool directory) const; 0130 0131 /** 0132 * Returns TRUE if the network item is a directory and FALSE otherwise. 0133 * 0134 * @return TRUE if this item is a directory 0135 */ 0136 bool isDirectory() const; 0137 0138 /** 0139 * Returns the name of the file or directory. 0140 * 0141 * @returns the name of the file or directory. 0142 */ 0143 QString name() const; 0144 0145 /** 0146 * Returns TRUE if the file or directory is hidden and FALSE otherwise. 0147 * 0148 * @returns TRUE is the file or directory id hidden 0149 */ 0150 bool isHidden() const; 0151 0152 /** 0153 * Copy assignment operator 0154 */ 0155 Smb4KFile &operator=(const Smb4KFile &other); 0156 0157 private: 0158 const QScopedPointer<Smb4KFilePrivate> d; 0159 }; 0160 0161 Q_DECLARE_METATYPE(Smb4KFile) 0162 0163 #endif