File indexing completed on 2024-11-24 04:48:16
0001 /* 0002 This file is part of KOrganizer. 0003 0004 SPDX-FileCopyrightText: 2001, 2002 Cornelius Schumacher <schumacher@kde.org> 0005 SPDX-FileCopyrightText: 2004 Reinhold Kainhofer <reinhold@kainhofer.com> 0006 SPDX-FileCopyrightText: 2005 Thomas Zander <zander@kde.org> 0007 0008 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0009 */ 0010 0011 #pragma once 0012 0013 #include "ui_filteredit_base.h" 0014 0015 #include <QDialog> 0016 0017 class FilterEdit; 0018 class QPushButton; 0019 namespace KCalendarCore 0020 { 0021 class CalFilter; 0022 } 0023 0024 namespace Akonadi 0025 { 0026 class TagSelectionDialog; 0027 } 0028 0029 /** 0030 This is the class to add/edit a calendar filter. 0031 0032 @short Creates a dialog box to create/edit a calendar filter 0033 @author Cornelius Schumacher, Thomas Zander 0034 */ 0035 class FilterEditDialog : public QDialog 0036 { 0037 Q_OBJECT 0038 public: 0039 explicit FilterEditDialog(QList<KCalendarCore::CalFilter *> *, QWidget *parent = nullptr); 0040 ~FilterEditDialog() override; 0041 0042 Q_SIGNALS: 0043 void filterChanged(); 0044 void editCategories(); 0045 0046 public Q_SLOTS: 0047 void updateFilterList(); 0048 void setDialogConsistent(bool consistent); 0049 0050 private: 0051 FilterEdit *mFilterEdit = nullptr; 0052 QPushButton *mOkButton = nullptr; 0053 QPushButton *mApplyButton = nullptr; 0054 0055 protected Q_SLOTS: 0056 void slotApply(); 0057 void slotOk(); 0058 }; 0059 0060 class FilterEdit : public QWidget, Ui::FilterEdit_base 0061 { 0062 Q_OBJECT 0063 public: 0064 explicit FilterEdit(QList<KCalendarCore::CalFilter *> *filters, QWidget *parent); 0065 ~FilterEdit() override; 0066 0067 void updateFilterList(); 0068 void saveChanges(); 0069 0070 Q_SIGNALS: 0071 void dataConsistent(bool); 0072 void filterChanged(); 0073 void editCategories(); 0074 0075 private: 0076 void filterSelected(); 0077 void bNewPressed(); 0078 void bDeletePressed(); 0079 void updateSelectedName(const QString &); 0080 void updateCategorySelection(); 0081 void editCategorySelection(); 0082 void slotHelp(); 0083 0084 [[nodiscard]] bool correctName(const QString &newText); 0085 void filterSelected(KCalendarCore::CalFilter *f); 0086 0087 QString mNegativeBackground; 0088 QList<KCalendarCore::CalFilter *> *mFilters = nullptr; 0089 KCalendarCore::CalFilter *mCurrent = nullptr; 0090 Akonadi::TagSelectionDialog *mCategorySelectDialog = nullptr; 0091 };