File indexing completed on 2024-12-08 07:35:53

0001 /*
0002     The item for Smb4K's shares view.
0003 
0004     SPDX-FileCopyrightText: 2006-2021 Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef SMB4KSHARESVIEWITEM_H
0009 #define SMB4KSHARESVIEWITEM_H
0010 
0011 // application specific includes
0012 #include "core/smb4kglobal.h"
0013 
0014 // Qt includes
0015 #include <QListWidgetItem>
0016 #include <QPointer>
0017 #include <QWidget>
0018 
0019 // forward declarations
0020 class Smb4KSharesView;
0021 
0022 /**
0023  * This class provides the items for the shares icon view
0024  * of Smb4K.
0025  *
0026  * @author Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0027  */
0028 
0029 class Smb4KSharesViewItem : public QListWidgetItem
0030 {
0031 public:
0032     /**
0033      * The constructor.
0034      *
0035      * @param share         The Smb4KShare object that represents the share.
0036      *
0037      * @param parent        The parent widget of this item.
0038      */
0039     Smb4KSharesViewItem(Smb4KSharesView *parent, const SharePtr &share);
0040 
0041     /**
0042      * The destructor
0043      */
0044     ~Smb4KSharesViewItem();
0045 
0046     /**
0047      * This function returns the encapsulated Smb4KShare item.
0048      *
0049      * @returns the encapsulated Smb4KShare item.
0050      */
0051     const SharePtr &shareItem()
0052     {
0053         return m_share;
0054     }
0055 
0056     /**
0057      * This function updates the encapsulated Smb4KShare object.
0058      */
0059     void update();
0060 
0061     /**
0062      * This function modifies the alignment according to the @p mode used in
0063      * the parent list widget.
0064      */
0065     void setItemAlignment(QListView::ViewMode mode);
0066 
0067 private:
0068     /**
0069      * The Smb4KShare item
0070      */
0071     SharePtr m_share;
0072 };
0073 
0074 #endif