File indexing completed on 2024-02-25 05:12:03

0001 /*
0002  *  Preview dialog
0003  *
0004  *  SPDX-FileCopyrightText: 2023 Alexander Reinholdt <alexander.reinholdt@kdemail.net>
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef SMB4KPREVIEWDIALOG_H
0009 #define SMB4KPREVIEWDIALOG_H
0010 
0011 // application specific includes
0012 #include "core/smb4kglobal.h"
0013 
0014 // Qt includes
0015 #include <QAction>
0016 #include <QDialog>
0017 #include <QListWidget>
0018 #include <QPushButton>
0019 
0020 // KDE includes
0021 #include <KDualAction>
0022 #include <KUrlComboBox>
0023 
0024 class Q_DECL_EXPORT Smb4KPreviewDialog : public QDialog
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     /**
0030      * Constructor
0031      */
0032     explicit Smb4KPreviewDialog(QWidget *parent = nullptr);
0033 
0034     /**
0035      * Destructor
0036      */
0037     virtual ~Smb4KPreviewDialog();
0038 
0039     /**
0040      * Set the share that is to be previewed.
0041      *
0042      * @param share     The share item
0043      *
0044      * @returns TRUE if the share was set successfully.
0045      */
0046     bool setShare(SharePtr share);
0047 
0048 public Q_SLOTS:
0049     void loadPreview(const NetworkItemPtr &networkItem);
0050 
0051 protected Q_SLOTS:
0052     void slotCloseButtonClicked();
0053     void slotItemActivated(QListWidgetItem *item);
0054     void slotPreviewResults(const QList<FilePtr> &files);
0055     void slotReloadActionTriggered(bool checked);
0056     void slotUpActionTriggered();
0057     void slotUrlActivated(const QUrl &url);
0058     void slotAdjustReloadAction(const NetworkItemPtr &item, int type);
0059 
0060 private:
0061     QListWidget *m_listWidget;
0062     QPushButton *m_closeButton;
0063     SharePtr m_share;
0064     NetworkItemPtr m_currentItem;
0065     KDualAction *m_reloadAction;
0066     QAction *m_upAction;
0067     KUrlComboBox *m_urlComboBox;
0068 };
0069 
0070 #endif