File indexing completed on 2024-03-24 16:27:15
0001 /*************************************************************************** 0002 This is the bookmark container for Smb4K (next generation). 0003 ------------------- 0004 begin : So Jun 8 2008 0005 copyright : (C) 2008-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 SMB4KBOOKMARK_H 0027 #define SMB4KBOOKMARK_H 0028 0029 // application specific includes 0030 #include "smb4kglobal.h" 0031 0032 // Qt includes 0033 #include <QString> 0034 #include <QScopedPointer> 0035 #include <QUrl> 0036 #include <QIcon> 0037 0038 0039 // forward declarations 0040 class Smb4KShare; 0041 class Smb4KBookmarkPrivate; 0042 0043 /** 0044 * This is the container class for bookmarks in Smb4K. It is a complete 0045 * rewrite of the previous class and comes with several improvements. 0046 * 0047 * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net> 0048 */ 0049 0050 class Q_DECL_EXPORT Smb4KBookmark 0051 { 0052 friend class Smb4KBookmarkPrivate; 0053 0054 public: 0055 /** 0056 * The constructor. 0057 * 0058 * @param share The share for which the bookmark should 0059 * be created. 0060 * 0061 * @param label The optional bookmark label. 0062 */ 0063 explicit Smb4KBookmark(Smb4KShare *share, const QString &label = QString()); 0064 0065 /** 0066 * The copy constructor. 0067 * 0068 * @param bookmark The bookmark that should be copied. 0069 */ 0070 Smb4KBookmark(const Smb4KBookmark &bookmark); 0071 0072 /** 0073 * The empty constructor. 0074 */ 0075 Smb4KBookmark(); 0076 0077 /** 0078 * The destructor 0079 */ 0080 ~Smb4KBookmark(); 0081 0082 /** 0083 * Set the workgroup name. 0084 * 0085 * @param workgroup The workgroup where the share is located. 0086 */ 0087 void setWorkgroupName(const QString &workgroup); 0088 0089 /** 0090 * Returns the workgroup/domain name. 0091 * 0092 * @returns the workgroup/domain name. 0093 */ 0094 QString workgroupName() const; 0095 0096 /** 0097 * Set the host name. 0098 * 0099 * @param host The host where the share is located. 0100 */ 0101 void setHostName(const QString &host); 0102 0103 /** 0104 * Returns the host name. 0105 * 0106 * @returns the host name. 0107 */ 0108 QString hostName() const; 0109 0110 /** 0111 * Set the share name. 0112 * 0113 * @param share The share name 0114 */ 0115 void setShareName(const QString &share); 0116 0117 /** 0118 * Returns the share name. 0119 * 0120 * @returns the share name. 0121 */ 0122 QString shareName() const; 0123 0124 /** 0125 * Set the host's IP address. 0126 * 0127 * @param ip The host's IP address 0128 */ 0129 void setHostIpAddress(const QString &ip); 0130 0131 /** 0132 * Returns the host's IP address. 0133 * 0134 * @returns the host's IP address. 0135 */ 0136 QString hostIpAddress() const; 0137 0138 /** 0139 * Set the share's type. 0140 * 0141 * @param type The type of the share. 0142 */ 0143 void setShareType(Smb4KGlobal::ShareType type); 0144 0145 /** 0146 * Returns the share's type. 0147 * 0148 * @returns the type of the share. 0149 */ 0150 Smb4KGlobal::ShareType shareType() const; 0151 0152 /** 0153 * Set the (optional) bookmark label. 0154 * 0155 * @param label The bookmark's label 0156 */ 0157 void setLabel(const QString &label); 0158 0159 /** 0160 * Returns the bookmark's label. 0161 * 0162 * @returns the bookmark's label. 0163 */ 0164 QString label() const; 0165 0166 /** 0167 * Sets the login that is used to mount this share. 0168 * 0169 * @param login The login 0170 */ 0171 void setLogin(const QString &login); 0172 0173 /** 0174 * Returns the login that is used to mount this share. 0175 * 0176 * @returns the login. 0177 */ 0178 QString login() const; 0179 0180 /** 0181 * Sets the URL of the share after some checks are passed. 0182 * 0183 * @param url The URL of the network item 0184 */ 0185 void setUrl(const QUrl &url); 0186 0187 /** 0188 * Sets the URL of the share. 0189 * 0190 * @param url The URL of the network item 0191 */ 0192 void setUrl(const QString &url); 0193 0194 /** 0195 * Returns the URL of this bookmark. 0196 * 0197 * @returns the URL 0198 */ 0199 QUrl url() const; 0200 0201 /** 0202 * Set the group this bookmark belongs to. 0203 * 0204 * @param name The group name 0205 */ 0206 void setGroupName(const QString &name); 0207 0208 /** 0209 * Returns the group name of this bookmark. 0210 * 0211 * @returns the group name 0212 */ 0213 QString groupName() const; 0214 0215 /** 0216 * Sets the profile this bookmark belongs to. The profile is meant 0217 * to distinguish between several network environments, like home 0218 * and work, and is not an alternative to the group functions. 0219 * 0220 * @param profile The profile name 0221 */ 0222 void setProfile(const QString &profile); 0223 0224 /** 0225 * Returns the name of the profile this bookmark belongs to. 0226 * 0227 * @returns the profile name 0228 */ 0229 QString profile() const; 0230 0231 /** 0232 * This function sets the icon of the bookmark. 0233 * 0234 * @param icon The icon 0235 */ 0236 void setIcon(const QIcon &icon); 0237 0238 /** 0239 * This function returns the icon of the network item. By default, it 0240 * is the null icon. You must set the appropriate icon either in 0241 * a class that inherits this one or from somewhere else. 0242 * 0243 * @returns the network item's icon. 0244 */ 0245 QIcon icon() const; 0246 0247 /** 0248 * Returns the display string. Prefer this over all other alternatives in your 0249 * GUI. 0250 * @returns the display string. 0251 */ 0252 QString displayString() const; 0253 0254 private: 0255 const QScopedPointer<Smb4KBookmarkPrivate> d; 0256 }; 0257 0258 #endif