File indexing completed on 2024-09-29 12:40:47

0001 /***************************************************************************
0002     smb4knetworkbrowseritem  -  Smb4K's network browser list item.
0003                              -------------------
0004     begin                : Mo Jan 8 2007
0005     copyright            : (C) 2007-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 SMB4KNETWORKBROWSERITEM_H
0027 #define SMB4KNETWORKBROWSERITEM_H
0028 
0029 // application specific includes
0030 #include "core/smb4kglobal.h"
0031 #include "smb4ktooltip.h"
0032 
0033 // Qt includes
0034 #include <QTreeWidgetItem>
0035 #include <QTreeWidget>
0036 
0037 
0038 class Smb4KNetworkBrowser;
0039 class Smb4KNetworkBrowserItem : public QTreeWidgetItem
0040 {
0041   public:
0042     /**
0043      * The constructor for toplevel items.
0044      *
0045      * @param parent        The parent tree widget
0046      * @param item          The network item
0047      */
0048     Smb4KNetworkBrowserItem(QTreeWidget *parent, const NetworkItemPtr &item);
0049 
0050     /**
0051      * The constructor for child items.
0052      *
0053      * @param parent        The parent tree widget item.
0054      * @param item          The network item
0055      */
0056     Smb4KNetworkBrowserItem(QTreeWidgetItem *parent, const NetworkItemPtr &item);
0057 
0058     /**
0059      * The destructor.
0060      */
0061     virtual ~Smb4KNetworkBrowserItem();
0062 
0063     /**
0064      * Columns of the item.
0065      */
0066     enum Columns{ Network = 0,
0067                   Type = 1,
0068                   IP = 2,
0069                   Comment = 3 };
0070 
0071     /**
0072      * This function is provided for convenience. It returns a pointer to 
0073      * the Smb4KWorkgroup object if it is present or NULL if it is not.
0074      *
0075      * @returns a pointer to the workgroup item or NULL.
0076      */
0077     WorkgroupPtr workgroupItem();
0078 
0079     /**
0080      * This function is provided for convenience. It returns a pointer to 
0081      * the Smb4KHost object if it is present or NULL if it is not.
0082      *
0083      * @returns a pointer to the host item or NULL.
0084      */
0085     HostPtr hostItem();
0086 
0087     /**
0088      * This function is provided for convenience. It returns a pointer to 
0089      * the Smb4KShare object if it is present or NULL if it is not.
0090      *
0091      * @returns a pointer to the share item or NULL.
0092      */
0093     SharePtr shareItem();
0094     
0095     /**
0096      * This function returns the encapsulated network item.
0097      * 
0098      * @returns a pointer to the encapsulated Smb4KBasicNetworkItem object
0099      * or NULL if there is no item defined (this should never happen).
0100      */
0101     const NetworkItemPtr &networkItem();
0102     
0103     /**
0104      * This function updates the internal network item.
0105      */
0106     void update();
0107     
0108     /**
0109      * This function returns the tool tip of this item.
0110      * 
0111      * @returns the tool tip.
0112      */
0113     Smb4KToolTip *tooltip();
0114 
0115   private:
0116     /**
0117      * The network item
0118      */
0119     NetworkItemPtr m_item;
0120     
0121     /**
0122      * The tool tip of this item
0123      */
0124     Smb4KToolTip *m_tooltip;
0125 };
0126 
0127 #endif