File indexing completed on 2024-12-08 10:27:14

0001 /*
0002  *  Bookmark 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 SMB4KBOOKMARKDIALOG_H
0009 #define SMB4KBOOKMARKDIALOG_H
0010 
0011 // application specific includes
0012 #include "core/smb4kglobal.h"
0013 
0014 // Qt includes
0015 #include <QDialog>
0016 #include <QListWidget>
0017 #include <QPushButton>
0018 
0019 // KDE includes
0020 #include <KComboBox>
0021 #include <KLineEdit>
0022 
0023 class Q_DECL_EXPORT Smb4KBookmarkDialog : public QDialog
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     /**
0029      * Constructor
0030      */
0031     explicit Smb4KBookmarkDialog(QWidget *parent = nullptr);
0032 
0033     /**
0034      * Destructor
0035      */
0036     virtual ~Smb4KBookmarkDialog();
0037 
0038     /**
0039      * Set the shares that are to be bookmarked. If all shares have already been
0040      * bookmarked, this function returns FALSE otherwise TRUE.
0041      *
0042      * This function should be run before showing the dialog.
0043      *
0044      * @param shares        The list of shares that are to be bookmarked
0045      *
0046      * @returns TRUE if at least one of the shares has not been bookmarked yet.
0047      */
0048     bool setShares(const QList<SharePtr> &shares);
0049 
0050 protected:
0051     bool eventFilter(QObject *object, QEvent *event) override;
0052 
0053 protected Q_SLOTS:
0054     void slotItemDoubleClicked(QListWidgetItem *item);
0055     void slotItemSelectionChanged();
0056     void slotLabelEdited();
0057     void slotCategoryEdited();
0058     void slotSaveBookmarks();
0059 
0060 private:
0061     QListWidget *m_listWidget;
0062     QWidget *m_editorWidget;
0063     KLineEdit *m_labelEdit;
0064     KComboBox *m_categoryEdit;
0065     QPushButton *m_saveButton;
0066     QPushButton *m_cancelButton;
0067 };
0068 
0069 #endif