File indexing completed on 2024-05-12 16:39:27
0001 /* This file is part of the KDE project 0002 Copyright (C) 1998, 1999, 2000 Torben Weis <weis@kde.org> 0003 Copyright (C) 2002 - 2009, 2011 Dag Andersen <danders@get2net.dk> 0004 Copyright (C) 2019 Dag Andersen <danders@get2net.dk> 0005 0006 This library is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU Library General Public 0008 License as published by the Free Software Foundation; either 0009 version 2 of the License, or (at your option) any later version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Library General Public License for more details. 0015 0016 You should have received a copy of the GNU Library General Public License 0017 along with this library; see the file COPYING.LIB. If not, write to 0018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 * Boston, MA 02110-1301, USA. 0020 */ 0021 0022 #ifndef KPLATOWORK_VIEW 0023 #define KPLATOWORK_VIEW 0024 0025 #include <KoView.h> 0026 0027 #include <QMap> 0028 #include <QStackedWidget> 0029 0030 class QPrinter; 0031 class QPrintDialog; 0032 class QMenu; 0033 class QActionGroup; 0034 0035 class KActionCollection; 0036 0037 class KoStore; 0038 class KoView; 0039 0040 class KPlatoWork_MainWindow; 0041 0042 namespace KPlato 0043 { 0044 0045 class Document; 0046 class GanttView; 0047 class ScheduleManager; 0048 0049 class Node; 0050 class Schedule; 0051 class Resource; 0052 0053 } 0054 using namespace KPlato; 0055 0056 /// Then namespace for the KPlato work package handler 0057 namespace KPlatoWork 0058 { 0059 0060 class Part; 0061 class View; 0062 class AbstractView; 0063 class TaskWorkPackageView; 0064 class TaskWPGanttView; 0065 0066 //------------- 0067 class View : public QStackedWidget 0068 { 0069 Q_OBJECT 0070 0071 public: 0072 explicit View(Part* part, QWidget *parent, KActionCollection *collection); 0073 ~View() override; 0074 0075 Part *part() const; 0076 0077 virtual void setupPrinter(QPrinter &printer, QPrintDialog &printDialog); 0078 virtual void print(QPrinter &printer, QPrintDialog &printDialog); 0079 0080 QMenu *popupMenu(const QString& name, const QPoint &pos); 0081 0082 // virtual ViewAdaptor* dbusObject(); 0083 0084 virtual bool loadContext(); 0085 virtual void saveContext() const; 0086 0087 ScheduleManager *currentScheduleManager() const; 0088 long currentScheduleId() const; 0089 0090 TaskWorkPackageView *createTaskWorkPackageView(); 0091 TaskWPGanttView *createGanttView(); 0092 0093 KPlatoWork_MainWindow *kplatoWorkMainWindow() const; 0094 0095 Node *currentNode() const; 0096 Document *currentDocument() const; 0097 0098 Q_SIGNALS: 0099 void currentScheduleManagerChanged(KPlato::ScheduleManager *sm); 0100 void openInternalDocument(KoStore *); 0101 void sigUpdateReadWrite(bool); 0102 0103 void viewDocument(KPlato::Document *doc); 0104 0105 public Q_SLOTS: 0106 void slotEditCut(); 0107 void slotEditCopy(); 0108 void slotEditPaste(); 0109 0110 void slotConfigure(); 0111 0112 void slotPopupMenu(const QString& menuname, const QPoint &pos); 0113 0114 void slotTaskProgress(); 0115 void slotTaskCompletion(); 0116 0117 protected Q_SLOTS: 0118 void slotCurrentChanged(int index); 0119 void slotProgressChanged(int value); 0120 0121 void slotEditDocument(); 0122 void slotEditDocument(KPlato::Document *doc); 0123 void slotViewDocument(); 0124 void slotRemoveDocument(); 0125 0126 void slotSendPackage(); 0127 void slotTaskDescription(); 0128 void slotRemoveCurrentPackage(); 0129 void slotRemoveSelectedPackages(); 0130 void slotSelectionChanged(); 0131 0132 void slotViewList(); 0133 void slotViewGantt(); 0134 0135 protected: 0136 virtual void updateReadWrite(bool readwrite); 0137 0138 QAction *addScheduleAction(Schedule *sch); 0139 void setLabel(); 0140 AbstractView *currentView() const; 0141 0142 private: 0143 void createViews(); 0144 0145 private: 0146 Part *m_part; 0147 0148 QActionGroup *m_scheduleActionGroup; 0149 QMap<QAction*, Schedule*> m_scheduleActions; 0150 ScheduleManager *m_manager; 0151 0152 bool m_readWrite; 0153 0154 // ------ Edit 0155 QAction *actionCut; 0156 QAction *actionCopy; 0157 QAction *actionPaste; 0158 QAction *actionRemoveSelectedPackages; 0159 0160 // ------ View 0161 QAction *actionViewList; 0162 QAction *actionViewGantt; 0163 0164 // ------ Settings 0165 QAction *actionConfigure; 0166 0167 QAction *actionViewDocument; 0168 QAction *actionEditDocument; 0169 QAction *actionRemoveDocument; 0170 0171 QAction *actionSendPackage; 0172 QAction *actionPackageSettings; 0173 QAction *actionTaskCompletion; 0174 QAction *actionViewDescription; 0175 QAction *actionRemoveCurrentPackage; 0176 }; 0177 0178 } //KplatoWork namespace 0179 0180 #endif