File indexing completed on 2024-04-21 15:42:47

0001 /***************************************************************************
0002     Smb4K's container class for information about a directory or file.
0003                              -------------------
0004     begin                : Sa Nov 10 2018
0005     copyright            : (C) 2018-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 SMB4KFILE_H
0027 #define SMB4KFILE_H
0028 
0029 // application specific includes
0030 #include "smb4kbasicnetworkitem.h"
0031 
0032 // Qt includes
0033 #include <QScopedPointer>
0034 #include <QHostAddress>
0035 
0036 class Smb4KFilePrivate;
0037 
0038 class Q_DECL_EXPORT Smb4KFile : public Smb4KBasicNetworkItem
0039 {
0040   public:
0041     /**
0042      * Constructor
0043      * 
0044      * @param url           The URL of the file or directory
0045      * 
0046      * @param item          The type of the item (only Directory and File)
0047      */
0048     Smb4KFile(const QUrl &url, Smb4KGlobal::NetworkItem item);
0049     
0050     /**
0051      * Copy constructor
0052      * 
0053      * @param file          The other Smb4KFile object
0054      */
0055     Smb4KFile(const Smb4KFile &file);
0056   
0057     /**
0058      * Destructor
0059      */
0060     ~Smb4KFile();
0061     
0062     /**
0063      * Sets the workgroup name to @p name.
0064      * 
0065      * @param name          The workgroup name
0066      */
0067     void setWorkgroupName(const QString &name);
0068     
0069     /**
0070      * Returns the workgroup name.
0071      * 
0072      * @returns the workgroup name.
0073      */
0074     QString workgroupName() const;
0075     
0076     /**
0077      * Returns the host's name.
0078      * 
0079      * @returns the name of the host.
0080      */
0081     QString hostName() const;
0082     
0083     /**
0084      * Set the host's IP address to @p ip.
0085      * 
0086      * @param ip            The IP address of the host
0087      */
0088     void setHostIpAddress(const QHostAddress &address);
0089     
0090     /**
0091      * Returns the host's IP address.
0092      * 
0093      * @returns the IP address
0094      */
0095     QString hostIpAddress() const;
0096     
0097     /**
0098      * Returns TRUE if the host's IP address is set and FALSE otherwise.
0099      * 
0100      * @returns TRUE if the host's IP address is set and FALSE otherwise.
0101      */
0102     bool hasHostIpAddress() const;
0103     
0104     /**
0105      * Returns the share's name.
0106      * 
0107      * @returns the name of the share.
0108      */
0109     QString shareName() const;
0110     
0111     /**
0112      * Set the login name for the share where this file or directory is located to @p name.
0113      * 
0114      * @param name          The login name
0115      */
0116     void setLogin(const QString &name);
0117     
0118     /**
0119      * Return the login name for the share where this file or directory is located.
0120      * 
0121      * @returns the login name
0122      */
0123     QString login() const;
0124     
0125     /**
0126      * Set the password for the share where this file or directory is located to @p pass.
0127      * 
0128      * @param pass          The password
0129      */
0130     void setPassword(const QString &pass);
0131     
0132     /**
0133      * Return the password for the share where this file or directory is located.
0134      * 
0135      * @returns the password
0136      */
0137     QString password() const;
0138     
0139     /**
0140      * Returns TRUE if the network item is a directory and FALSE otherwise.
0141      * 
0142      * @return TRUE if this item is a directory
0143      */
0144     bool isDirectory() const;
0145     
0146     /**
0147      * Returns the name of the file or directory.
0148      * 
0149      * @returns the name of the file or directory.
0150      */
0151     QString name() const;
0152     
0153     /**
0154      * Returns TRUE if the file or directory is hidden and FALSE otherwise.
0155      * 
0156      * @returns TRUE is the file or directory id hidden
0157      */
0158     bool isHidden() const;
0159   
0160   private:
0161     const QScopedPointer<Smb4KFilePrivate> d;
0162 };
0163 
0164 #endif