Messagelib

aggregationeditor.h
1 /******************************************************************************
2  *
3  * SPDX-FileCopyrightText: 2008 Szymon Tomasz Stefanek <[email protected]>
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  *
7  *******************************************************************************/
8 
9 #pragma once
10 
11 #include <utils/optionseteditor.h>
12 
13 class QComboBox;
14 
15 namespace MessageList
16 {
17 namespace Core
18 {
19 class Aggregation;
20 } // namespace Core
21 
22 namespace Utils
23 {
24 /**
25  * A widget that allows editing a single MessageList::Aggregation.
26  *
27  * Used by ConfigureAggregationsDialog.
28  */
30 {
31  Q_OBJECT
32 public:
33  explicit AggregationEditor(QWidget *parent);
34  ~AggregationEditor() override;
35 
36 private:
37  Core::Aggregation *mCurrentAggregation = nullptr; // shallow, may be null!
38 
39  // Grouping, Threading and Sorting tab
40  QComboBox *mGroupingCombo = nullptr;
41  QComboBox *mGroupExpandPolicyCombo = nullptr;
42  QComboBox *mThreadingCombo = nullptr;
43  QComboBox *mThreadLeaderCombo = nullptr;
44  QComboBox *mThreadExpandPolicyCombo = nullptr;
45  // Advanced tab
46  QComboBox *mFillViewStrategyCombo = nullptr;
47 
48 public:
49  /**
50  * Sets the Aggregation to be edited.
51  * Saves and forgets any previously Aggregation that was being edited.
52  * The set parameter may be 0: in this case the editor is simply disabled.
53  */
54  void editAggregation(Core::Aggregation *set);
55 
56  /**
57  * Returns the Aggregation currently edited by this AggregationEditor.
58  * May be 0.
59  */
61  {
62  return mCurrentAggregation;
63  }
64 
65  /**
66  * Explicitly commits the changes in the editor to the edited Aggregation, if any.
67  */
68  void commit();
69 
70 Q_SIGNALS:
71  /**
72  * This is triggered when the aggregation name changes in the editor text field.
73  * It's connected to the Aggregation configuration dialog which updates
74  * the list of aggregations with the new name.
75  */
76  void aggregationNameChanged();
77 
78 private:
79  // Helpers for filling the various editing elements
80 
81  void fillGroupingCombo();
82  void fillGroupExpandPolicyCombo();
83  void fillThreadingCombo();
84  void fillThreadLeaderCombo();
85  void fillThreadExpandPolicyCombo();
86  void fillFillViewStrategyCombo();
87  void setReadOnly(bool readOnly);
88 
89 private Q_SLOTS:
90 
91  // Internal handlers for editing element interaction
92 
93  void groupingComboActivated(int idx);
94  void threadingComboActivated(int idx);
95  void slotNameEditTextEdited(const QString &newName) override;
96 };
97 } // namespace Utils
98 } // namespace MessageList
99 
A set of aggregation options that can be applied to the MessageList::Model in a single shot...
Definition: aggregation.h:28
A widget that allows editing a single MessageList::Aggregation.
Core::Aggregation * editedAggregation() const
Returns the Aggregation currently edited by this AggregationEditor.
The base class for the OptionSet editors.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Dec 4 2021 23:12:52 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.