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;
19namespace Akonadi
20{
21class AccountActivitiesAbstract;
22}
23namespace MailCommon
24{
25/**
26 * A dialog that lets the user select a folder.
27 * TODO: Move most of this to Akonadi::CollectionDialog
28 */
29class MAILCOMMON_EXPORT FolderSelectionDialog : public QDialog
30{
31 Q_OBJECT
32
33public:
34 enum SelectionFolderOption {
35 None = 0,
36 EnableCheck = 1,
37 ShowUnreadCount = 2,
38 HideVirtualFolder = 4,
39 NotAllowToCreateNewFolder = 8,
40 HideOutboxFolder = 16,
41 NotUseGlobalSettings = 64
42 };
43 Q_DECLARE_FLAGS(SelectionFolderOptions, SelectionFolderOption)
44
46 ~FolderSelectionDialog() override;
47
48 void setSelectionMode(QAbstractItemView::SelectionMode mode);
49 [[nodiscard]] QAbstractItemView::SelectionMode selectionMode() const;
50
51 [[nodiscard]] Akonadi::Collection selectedCollection() const;
52 void setSelectedCollection(const Akonadi::Collection &collection);
53
54 [[nodiscard]] Akonadi::Collection::List selectedCollections() const;
55
56 void setAccountActivities(Akonadi::AccountActivitiesAbstract *accountActivities);
57
58private Q_SLOTS:
59 MAILCOMMON_NO_EXPORT void slotSelectionChanged();
60 MAILCOMMON_NO_EXPORT void slotAddChildFolder();
61 MAILCOMMON_NO_EXPORT void collectionCreationResult(KJob *);
62 MAILCOMMON_NO_EXPORT void rowsInserted(const QModelIndex &col, int, int);
63 MAILCOMMON_NO_EXPORT void slotDoubleClick(const QModelIndex &);
64 MAILCOMMON_NO_EXPORT void slotFolderTreeWidgetContextMenuRequested(const QPoint &);
65
66protected:
67 void focusTreeView();
68 void readConfig();
69 void writeConfig();
70 bool canCreateCollection(Akonadi::Collection &parentCol);
71
72 void hideEvent(QHideEvent *) override;
73
74 void showEvent(QShowEvent *) override;
75
76private:
77 class FolderSelectionDialogPrivate;
78 std::unique_ptr<FolderSelectionDialogPrivate> const d;
79};
80}
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 Fri Oct 11 2024 12:18:39 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.