File indexing completed on 2024-12-15 04:54:44

0001 /* SPDX-FileCopyrightText: 2009 James Bendig <james@imptalk.com>
0002 
0003    SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 #pragma once
0006 
0007 #include "messagelist_export.h"
0008 #include <Akonadi/Collection>
0009 #include <QComboBox>
0010 namespace MessageList
0011 {
0012 namespace Core
0013 {
0014 class Aggregation;
0015 class StorageModel;
0016 }
0017 
0018 namespace Utils
0019 {
0020 class AggregationComboBoxPrivate;
0021 /**
0022  * A specialized QComboBox that lists all message list aggregations.
0023  */
0024 class MESSAGELIST_EXPORT AggregationComboBox : public QComboBox
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     explicit AggregationComboBox(QWidget *parent);
0030     ~AggregationComboBox() override;
0031 
0032     [[nodiscard]] QString currentAggregation() const;
0033 
0034     void writeDefaultConfig() const;
0035 
0036     void writeStorageModelConfig(MessageList::Core::StorageModel *storageModel, bool isPrivateSetting) const;
0037     void writeStorageModelConfig(const QString &id, bool isPrivateSetting) const;
0038 
0039     void readStorageModelConfig(MessageList::Core::StorageModel *storageModel, bool &isPrivateSetting);
0040     void readStorageModelConfig(const Akonadi::Collection &col, bool &isPrivateSetting);
0041     void readStorageModelConfig(const QString &id, bool &isPrivateSetting);
0042 
0043 public Q_SLOTS:
0044     void selectDefault();
0045     void slotLoadAggregations();
0046 
0047 private:
0048     std::unique_ptr<AggregationComboBoxPrivate> const d;
0049 };
0050 } // namespace Utils
0051 } // namespace MessageList