Warning, file /pim/mailcommon/src/folder/folderselectiondialog.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002 
0003   SPDX-FileCopyrightText: 2009-2024 Laurent Montel <montel@kde.org>
0004 
0005   SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #pragma once
0009 
0010 #include "mailcommon_export.h"
0011 
0012 #include <Akonadi/Collection>
0013 
0014 #include <QDialog>
0015 
0016 #include <QAbstractItemView>
0017 
0018 class KJob;
0019 
0020 namespace MailCommon
0021 {
0022 /**
0023  * A dialog that lets the user select a folder.
0024  * TODO: Move most of this to Akonadi::CollectionDialog
0025  */
0026 class MAILCOMMON_EXPORT FolderSelectionDialog : public QDialog
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     enum SelectionFolderOption {
0032         None = 0,
0033         EnableCheck = 1,
0034         ShowUnreadCount = 2,
0035         HideVirtualFolder = 4,
0036         NotAllowToCreateNewFolder = 8,
0037         HideOutboxFolder = 16,
0038         NotUseGlobalSettings = 64
0039     };
0040     Q_DECLARE_FLAGS(SelectionFolderOptions, SelectionFolderOption)
0041 
0042     FolderSelectionDialog(QWidget *parent, FolderSelectionDialog::SelectionFolderOptions options);
0043     ~FolderSelectionDialog() override;
0044 
0045     void setSelectionMode(QAbstractItemView::SelectionMode mode);
0046     [[nodiscard]] QAbstractItemView::SelectionMode selectionMode() const;
0047 
0048     [[nodiscard]] Akonadi::Collection selectedCollection() const;
0049     void setSelectedCollection(const Akonadi::Collection &collection);
0050 
0051     [[nodiscard]] Akonadi::Collection::List selectedCollections() const;
0052 
0053 private Q_SLOTS:
0054     MAILCOMMON_NO_EXPORT void slotSelectionChanged();
0055     MAILCOMMON_NO_EXPORT void slotAddChildFolder();
0056     MAILCOMMON_NO_EXPORT void collectionCreationResult(KJob *);
0057     MAILCOMMON_NO_EXPORT void rowsInserted(const QModelIndex &col, int, int);
0058     MAILCOMMON_NO_EXPORT void slotDoubleClick(const QModelIndex &);
0059     MAILCOMMON_NO_EXPORT void slotFolderTreeWidgetContextMenuRequested(const QPoint &);
0060 
0061 protected:
0062     void focusTreeView();
0063     void readConfig();
0064     void writeConfig();
0065     bool canCreateCollection(Akonadi::Collection &parentCol);
0066 
0067     void hideEvent(QHideEvent *) override;
0068 
0069     void showEvent(QShowEvent *) override;
0070 
0071 private:
0072     class FolderSelectionDialogPrivate;
0073     std::unique_ptr<FolderSelectionDialogPrivate> const d;
0074 };
0075 }