File indexing completed on 2024-05-12 05:21:25
0001 /* 0002 This file is part of KOrganizer. 0003 0004 SPDX-FileCopyrightText: 2000, 2003 Cornelius Schumacher <schumacher@kde.org> 0005 SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0 0008 */ 0009 0010 #pragma once 0011 0012 #include "mainwindow.h" 0013 0014 #include <KParts/ReadOnlyPart> 0015 0016 class CalendarView; 0017 0018 namespace Akonadi 0019 { 0020 class Item; 0021 } 0022 0023 namespace KParts 0024 { 0025 class StatusBarExtension; 0026 } 0027 0028 class KOrganizerPart : public KParts::ReadOnlyPart, public KOrg::MainWindow 0029 { 0030 Q_OBJECT 0031 public: 0032 explicit KOrganizerPart(QWidget *parentWidget, QObject *parent, const KPluginMetaData &data, const QVariantList &); 0033 ~KOrganizerPart() override; 0034 0035 KOrg::CalendarViewBase *view() const override; 0036 0037 /** 0038 Load calendar file from URL and merge it into the current calendar. 0039 0040 @param url The URL to open. 0041 @param merge Whether the URL should be imported into the current calendar 0042 or added as a new calendar resource. 0043 0044 @return true on success, false if an error occurred 0045 */ 0046 [[nodiscard]] bool openURL(const QUrl &url, bool merge = false) override; 0047 0048 /** Save calendar file to URL of current calendar */ 0049 [[nodiscard]] bool saveURL() override; 0050 0051 /** Save calendar file to URL */ 0052 [[nodiscard]] bool saveAsURL(const QUrl &url) override; 0053 0054 /** Get current URL */ 0055 [[nodiscard]] QUrl getCurrentURL() const override; 0056 0057 KXMLGUIFactory *mainGuiFactory() override 0058 { 0059 return factory(); 0060 } 0061 0062 KXMLGUIClient *mainGuiClient() override 0063 { 0064 return this; 0065 } 0066 0067 QWidget *topLevelWidget() override; 0068 ActionManager *actionManager() override; 0069 KActionCollection *getActionCollection() const override 0070 { 0071 return actionCollection(); 0072 } 0073 0074 void showStatusMessage(const QString &message) override; 0075 0076 void setTitle() override; 0077 0078 public Q_SLOTS: 0079 void slotChangeInfo(const Akonadi::Item &, const QDate &date); 0080 0081 protected: 0082 bool openFile() override; 0083 0084 private: 0085 CalendarView *mView = nullptr; 0086 ActionManager *mActionManager = nullptr; 0087 KParts::StatusBarExtension *mStatusBarExtension = nullptr; 0088 QWidget *mTopLevelWidget = nullptr; 0089 0090 Q_SIGNALS: 0091 void textChanged(const QString &); 0092 };