File indexing completed on 2024-05-12 05:12:44

0001 /*
0002     SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <ui_browserwidget_contentview.h>
0010 #include <ui_browserwidget_itemview.h>
0011 
0012 #include <Akonadi/Collection>
0013 #include <Akonadi/ETMViewStateSaver>
0014 #include <Akonadi/Item>
0015 
0016 #include <QWidget>
0017 
0018 class QModelIndex;
0019 class QStandardItemModel;
0020 
0021 class KJob;
0022 class KToggleAction;
0023 class KXmlGuiWindow;
0024 
0025 class AkonadiBrowserModel;
0026 
0027 template<typename T>
0028 class KViewStateMaintainer;
0029 
0030 namespace Akonadi
0031 {
0032 class ChangeRecorder;
0033 class EntityTreeView;
0034 class Job;
0035 class StandardActionManager;
0036 class Monitor;
0037 class TagModel;
0038 class StatisticsProxyModel;
0039 }
0040 namespace Akonadi
0041 {
0042 class ContactViewer;
0043 class ContactGroupViewer;
0044 }
0045 
0046 namespace CalendarSupport
0047 {
0048 class IncidenceViewer;
0049 }
0050 
0051 namespace MessageViewer
0052 {
0053 class Viewer;
0054 }
0055 
0056 class BrowserWidget : public QWidget
0057 {
0058     Q_OBJECT
0059 
0060 public:
0061     explicit BrowserWidget(KXmlGuiWindow *xmlGuiWindow, QWidget *parent = nullptr);
0062     ~BrowserWidget() override;
0063 
0064 public Q_SLOTS:
0065     void dumpToXml();
0066     void clearCache();
0067 
0068 private Q_SLOTS:
0069     void currentChanged(const QModelIndex &index);
0070     void itemFetchDone(KJob *job);
0071     void modelChanged();
0072     void save();
0073     void saveResult(KJob *job);
0074     void addAttribute();
0075     void delAttribute();
0076     void setItem(const Akonadi::Item &item);
0077     void dumpToXmlResult(KJob *job);
0078     void clear();
0079     void updateItemFetchScope();
0080 
0081     void contentViewChanged();
0082 
0083     void tagViewContextMenuRequested(const QPoint &pos);
0084     void tagViewDoubleClicked(const QModelIndex &index);
0085     void addSubTagRequested();
0086     void addTagRequested();
0087     void editTagRequested();
0088     void removeTagRequested();
0089     void createTag();
0090     void modifyTag();
0091 
0092 private:
0093     Akonadi::Collection currentCollection() const;
0094 
0095     Akonadi::ChangeRecorder *mBrowserMonitor = nullptr;
0096     AkonadiBrowserModel *mBrowserModel = nullptr;
0097     Akonadi::EntityTreeView *mCollectionView = nullptr;
0098     Akonadi::StatisticsProxyModel *statisticsProxyModel = nullptr;
0099     Ui::ItemViewWidget itemUi;
0100     Ui::ContentViewWidget contentUi;
0101     Akonadi::Item mCurrentItem;
0102     QStandardItemModel *mAttrModel = nullptr;
0103     Akonadi::StandardActionManager *mStdActionManager = nullptr;
0104     Akonadi::Monitor *mMonitor = nullptr;
0105     KViewStateMaintainer<Akonadi::ETMViewStateSaver> *m_stateMaintainer = nullptr;
0106     KToggleAction *mCacheOnlyAction = nullptr;
0107     QTreeView *mTagView = nullptr;
0108     Akonadi::TagModel *mTagModel = nullptr;
0109 
0110     Akonadi::ContactViewer *mContactView = nullptr;
0111     Akonadi::ContactGroupViewer *mContactGroupView = nullptr;
0112     CalendarSupport::IncidenceViewer *mIncidenceView = nullptr;
0113     MessageViewer::Viewer *mMailView = nullptr;
0114 };