Mailcommon

folderselectiondialog.h
1 /*
2 
3  SPDX-FileCopyrightText: 2009-2022 Laurent Montel <[email protected]>
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 
18 class KJob;
19 
20 namespace MailCommon
21 {
22 /**
23  * A dialog that lets the user select a folder.
24  * TODO: Move most of this to Akonadi::CollectionDialog
25  */
26 class MAILCOMMON_EXPORT FolderSelectionDialog : public QDialog
27 {
28  Q_OBJECT
29 
30 public:
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  Q_REQUIRED_RESULT QAbstractItemView::SelectionMode selectionMode() const;
47 
48  Q_REQUIRED_RESULT Akonadi::Collection selectedCollection() const;
49  void setSelectedCollection(const Akonadi::Collection &collection);
50 
51  Q_REQUIRED_RESULT Akonadi::Collection::List selectedCollections() const;
52 
53 private Q_SLOTS:
54  void slotSelectionChanged();
55  void slotAddChildFolder();
56  void collectionCreationResult(KJob *);
57  void rowsInserted(const QModelIndex &col, int, int);
58  void slotDoubleClick(const QModelIndex &);
59  void slotFolderTreeWidgetContextMenuRequested(const QPoint &);
60 
61 protected:
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 
71 private:
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-2022 The KDE developers.
Generated on Sat Oct 1 2022 04:00:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.