Mailcommon

folderselectiondialog.h
1/*
2
3 SPDX-FileCopyrightText: 2009-2024 Laurent Montel <montel@kde.org>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "mailcommon_export.h"
11
12#include <Akonadi/Collection>
13
14#include <QDialog>
15
16#include <QAbstractItemView>
17
18class KJob;
19
20namespace MailCommon
21{
22/**
23 * A dialog that lets the user select a folder.
24 * TODO: Move most of this to Akonadi::CollectionDialog
25 */
26class MAILCOMMON_EXPORT FolderSelectionDialog : public QDialog
27{
28 Q_OBJECT
29
30public:
31 enum SelectionFolderOption {
32 None = 0,
33 EnableCheck = 1,
34 ShowUnreadCount = 2,
35 HideVirtualFolder = 4,
36 NotAllowToCreateNewFolder = 8,
37 HideOutboxFolder = 16,
38 NotUseGlobalSettings = 64
39 };
40 Q_DECLARE_FLAGS(SelectionFolderOptions, SelectionFolderOption)
41
43 ~FolderSelectionDialog() override;
44
45 void setSelectionMode(QAbstractItemView::SelectionMode mode);
46 [[nodiscard]] QAbstractItemView::SelectionMode selectionMode() const;
47
48 [[nodiscard]] Akonadi::Collection selectedCollection() const;
49 void setSelectedCollection(const Akonadi::Collection &collection);
50
51 [[nodiscard]] Akonadi::Collection::List selectedCollections() const;
52
53private Q_SLOTS:
54 MAILCOMMON_NO_EXPORT void slotSelectionChanged();
55 MAILCOMMON_NO_EXPORT void slotAddChildFolder();
56 MAILCOMMON_NO_EXPORT void collectionCreationResult(KJob *);
57 MAILCOMMON_NO_EXPORT void rowsInserted(const QModelIndex &col, int, int);
58 MAILCOMMON_NO_EXPORT void slotDoubleClick(const QModelIndex &);
59 MAILCOMMON_NO_EXPORT void slotFolderTreeWidgetContextMenuRequested(const QPoint &);
60
61protected:
62 void focusTreeView();
63 void readConfig();
64 void writeConfig();
65 bool canCreateCollection(Akonadi::Collection &parentCol);
66
67 void hideEvent(QHideEvent *) override;
68
69 void showEvent(QShowEvent *) override;
70
71private:
72 class FolderSelectionDialogPrivate;
73 std::unique_ptr<FolderSelectionDialogPrivate> const d;
74};
75}
A dialog that lets the user select a folder.
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:01 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.