File indexing completed on 2024-04-21 05:01:47

0001 /*
0002     smb4knetworkbrowseritem  -  Smb4K's network browser list item.
0003 
0004     SPDX-FileCopyrightText: 2007-2021 Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef SMB4KNETWORKBROWSERITEM_H
0009 #define SMB4KNETWORKBROWSERITEM_H
0010 
0011 // application specific includes
0012 #include "core/smb4kglobal.h"
0013 
0014 // Qt includes
0015 #include <QTreeWidget>
0016 #include <QTreeWidgetItem>
0017 
0018 // forward declarations
0019 class Smb4KNetworkBrowser;
0020 
0021 /**
0022  * This class provides the items for the network neighborhood browser
0023  * of Smb4K.
0024  *
0025  * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0026  */
0027 
0028 class Smb4KNetworkBrowserItem : public QTreeWidgetItem
0029 {
0030 public:
0031     /**
0032      * The constructor for toplevel items.
0033      *
0034      * @param parent        The parent tree widget
0035      * @param item          The network item
0036      */
0037     Smb4KNetworkBrowserItem(QTreeWidget *parent, const NetworkItemPtr &item);
0038 
0039     /**
0040      * The constructor for child items.
0041      *
0042      * @param parent        The parent tree widget item.
0043      * @param item          The network item
0044      */
0045     Smb4KNetworkBrowserItem(QTreeWidgetItem *parent, const NetworkItemPtr &item);
0046 
0047     /**
0048      * The destructor.
0049      */
0050     virtual ~Smb4KNetworkBrowserItem();
0051 
0052     /**
0053      * Columns of the item.
0054      */
0055     enum Columns { Network = 0, Type = 1, IP = 2, Comment = 3 };
0056 
0057     /**
0058      * This function is provided for convenience. It returns a pointer to
0059      * the Smb4KWorkgroup object if it is present or NULL if it is not.
0060      *
0061      * @returns a pointer to the workgroup item or NULL.
0062      */
0063     WorkgroupPtr workgroupItem();
0064 
0065     /**
0066      * This function is provided for convenience. It returns a pointer to
0067      * the Smb4KHost object if it is present or NULL if it is not.
0068      *
0069      * @returns a pointer to the host item or NULL.
0070      */
0071     HostPtr hostItem();
0072 
0073     /**
0074      * This function is provided for convenience. It returns a pointer to
0075      * the Smb4KShare object if it is present or NULL if it is not.
0076      *
0077      * @returns a pointer to the share item or NULL.
0078      */
0079     SharePtr shareItem();
0080 
0081     /**
0082      * This function returns the encapsulated network item.
0083      *
0084      * @returns a pointer to the encapsulated Smb4KBasicNetworkItem object
0085      * or NULL if there is no item defined (this should never happen).
0086      */
0087     NetworkItemPtr networkItem();
0088 
0089     /**
0090      * This function updates the internal network item.
0091      */
0092     void update();
0093 
0094 private:
0095     /**
0096      * The network item
0097      */
0098     NetworkItemPtr m_item;
0099 };
0100 
0101 #endif