File indexing completed on 2024-04-28 05:11:33
0001 /* 0002 SPDX-FileCopyrightText: 2010 Bertjan Broeksema <broeksema@kde.org> 0003 SPDX-FileCopyrightText: 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include "incidenceeditor-ng.h" 0011 0012 namespace Ui 0013 { 0014 class EventOrTodoDesktop; 0015 } 0016 0017 namespace IncidenceEditorNG 0018 { 0019 class IncidenceCategories : public IncidenceEditor 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit IncidenceCategories(Ui::EventOrTodoDesktop *ui); 0024 0025 void load(const KCalendarCore::Incidence::Ptr &incidence) override; 0026 void load(const Akonadi::Item &item) override; 0027 void save(const KCalendarCore::Incidence::Ptr &incidence) override; 0028 void save(Akonadi::Item &item) override; 0029 0030 /** 0031 * Returns the list of currently selected categories. 0032 */ 0033 [[nodiscard]] QStringList categories() const; 0034 0035 [[nodiscard]] bool isDirty() const override; 0036 void printDebugInfo() const override; 0037 0038 private: 0039 void createMissingCategories(); 0040 0041 void onSelectionChanged(const Akonadi::Tag::List &); 0042 void onMissingTagCreated(KJob *); 0043 0044 Ui::EventOrTodoDesktop *const mUi; 0045 0046 /** 0047 * List of categories for which no tag might exist. 0048 * 0049 * For each category of the edited incidence, we want to make sure that there exists a 0050 * corresponding tag in Akonadi. For missing categories, a \a TagCreateJob is issued. 0051 * Eventually, there should be no missing categories left. In case tag creation fails for some 0052 * categories, this list still holds these categories so they don't get lost 0053 */ 0054 QStringList mMissingCategories; 0055 bool mDirty = false; 0056 }; 0057 }