1 /* 2 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org> 3 4 SPDX-License-Identifier: LGPL-2.0-or-later 5 */ 6 7 #pragma once 8 9 #include <ui_browserwidget_contentview.h> 10 #include <ui_browserwidget_itemview.h> 11 12 #include <Akonadi/Collection> 13 #include <Akonadi/ETMViewStateSaver> 14 #include <Akonadi/Item> 15 16 #include <QWidget> 17 18 class QModelIndex; 19 class QStandardItemModel; 20 21 class KJob; 22 class KToggleAction; 23 class KXmlGuiWindow; 24 25 class AkonadiBrowserModel; 26 27 template<typename T> class KViewStateMaintainer; 28 29 namespace Akonadi 30 { 31 class ChangeRecorder; 32 class EntityTreeView; 33 class Job; 34 class StandardActionManager; 35 class Monitor; 36 class TagModel; 37 class StatisticsProxyModel; 38 class ContactViewer; 39 class ContactGroupViewer; 40 } 41 42 namespace CalendarSupport 43 { 44 class IncidenceViewer; 45 } 46 47 namespace MessageViewer 48 { 49 class Viewer; 50 } 51 52 class BrowserWidget : public QWidget 53 { 54 Q_OBJECT 55 56 public: 57 explicit BrowserWidget(KXmlGuiWindow *xmlGuiWindow, QWidget *parent = nullptr); 58 ~BrowserWidget() override; 59 60 public Q_SLOTS: 61 void dumpToXml(); 62 void clearCache(); 63 64 private Q_SLOTS: 65 void currentChanged(const QModelIndex &index); 66 void itemFetchDone(KJob *job); 67 void modelChanged(); 68 void save(); 69 void saveResult(KJob *job); 70 void addAttribute(); 71 void delAttribute(); 72 void setItem(const Akonadi::Item &item); 73 void dumpToXmlResult(KJob *job); 74 void clear(); 75 void updateItemFetchScope(); 76 77 void contentViewChanged(); 78 79 void tagViewContextMenuRequested(const QPoint &pos); 80 void tagViewDoubleClicked(const QModelIndex &index); 81 void addSubTagRequested(); 82 void addTagRequested(); 83 void editTagRequested(); 84 void removeTagRequested(); 85 void createTag(); 86 void modifyTag(); 87 88 private: 89 Akonadi::Collection currentCollection() const; 90 91 Akonadi::ChangeRecorder *mBrowserMonitor = nullptr; 92 AkonadiBrowserModel *mBrowserModel = nullptr; 93 Akonadi::EntityTreeView *mCollectionView = nullptr; 94 Akonadi::StatisticsProxyModel *statisticsProxyModel = nullptr; 95 Ui::ItemViewWidget itemUi; 96 Ui::ContentViewWidget contentUi; 97 Akonadi::Item mCurrentItem; 98 QStandardItemModel *mAttrModel = nullptr; 99 Akonadi::StandardActionManager *mStdActionManager = nullptr; 100 Akonadi::Monitor *mMonitor = nullptr; 101 KViewStateMaintainer<Akonadi::ETMViewStateSaver> *m_stateMaintainer = nullptr; 102 KToggleAction *mCacheOnlyAction = nullptr; 103 QTreeView *mTagView = nullptr; 104 Akonadi::TagModel *mTagModel = nullptr; 105 106 Akonadi::ContactViewer *mContactView = nullptr; 107 Akonadi::ContactGroupViewer *mContactGroupView = nullptr; 108 CalendarSupport::IncidenceViewer *mIncidenceView = nullptr; 109 MessageViewer::Viewer *mMailView = nullptr; 110 }; 111 112