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

0001 /***************************************************************************
0002     This class provides the basic network item for the core library of 
0003     Smb4K.
0004                              -------------------
0005     begin                : Do Apr 2 2009
0006     copyright            : (C) 2009-2019 by Alexander Reinholdt
0007     email                : alexander.reinholdt@kdemail.net
0008  ***************************************************************************/
0009 
0010 /***************************************************************************
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  *   This program is distributed in the hope that it will be useful, but   *
0017  *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
0018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
0019  *   General Public License for more details.                              *
0020  *                                                                         *
0021  *   You should have received a copy of the GNU General Public License     *
0022  *   along with this program; if not, write to the                         *
0023  *   Free Software Foundation, Inc., 51 Franklin Street, Suite 500, Boston,*
0024  *   MA 02110-1335, USA                                                    *
0025  ***************************************************************************/
0026 
0027 #ifndef SMB4KBASICNETWORKITEM_H
0028 #define SMB4KBASICNETWORKITEM_H
0029 
0030 // application specific includes
0031 #include "smb4kglobal.h"
0032 
0033 // Qt includes
0034 #include <QString>
0035 #include <QScopedPointer>
0036 #include <QIcon>
0037 #include <QUrl>
0038 
0039 // forward declarations
0040 class Smb4KBasicNetworkItemPrivate;
0041 
0042 /**
0043  * This is the basic class from which all other network item classes
0044  * are derived.
0045  * 
0046  * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0047  * @since 1.0.0
0048  */
0049 
0050 class Q_DECL_EXPORT Smb4KBasicNetworkItem
0051 {
0052   public:
0053     /**
0054      * The constructor
0055      */
0056     explicit Smb4KBasicNetworkItem(Smb4KGlobal::NetworkItem type = Smb4KGlobal::UnknownNetworkItem);
0057 
0058     /**
0059      * The copy constructor
0060      */
0061     Smb4KBasicNetworkItem(const Smb4KBasicNetworkItem &item);
0062     
0063     /**
0064      * The destructor
0065      */
0066     ~Smb4KBasicNetworkItem();
0067 
0068     /**
0069      * This function returns the type of the basic network
0070      * item.
0071      *
0072      * @returns the type.
0073      */
0074     Smb4KGlobal::NetworkItem type() const;
0075 
0076     /**
0077      * This function sets the icon of the network item.
0078      * 
0079      * @param icon          The icon
0080      */
0081     void setIcon(const QIcon &icon);
0082     
0083     /**
0084      * This function returns the icon of the network item. By default, it
0085      * is the null icon. You must set the appropriate icon either in
0086      * a class that inherits this one or from somewhere else.
0087      * 
0088      * @returns the network item's icon.
0089      */
0090     QIcon icon() const;
0091     
0092     /**
0093      * Set the URL for this network item.
0094      * 
0095      * @param url           The URL
0096      */
0097     void setUrl(const QUrl &url);
0098     
0099     /**
0100      * Return the URL for this network item.
0101      * 
0102      * @returns the URL
0103      */
0104     QUrl url() const;
0105     
0106   protected:
0107     /**
0108      * Expose a pointer to the private URL variable.
0109      */
0110     QUrl *pUrl;
0111     
0112     /**
0113      * Export a pointer to the private icon variable.
0114      */
0115     QIcon *pIcon;
0116     
0117   private:
0118     const QScopedPointer<Smb4KBasicNetworkItemPrivate> d;
0119 };
0120 
0121 #endif