00001 /* This file is part of the KDE project 00002 Copyright (C) 2003 - 2005 Dag Andersen <danders@get2net.dk> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; 00007 version 2 of the License. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef KPTREPORTVIEW_H 00021 #define KPTREPORTVIEW_H 00022 00023 #include "kptcontext.h" 00024 #include "kptproject.h" 00025 #include "kpttask.h" 00026 #include "kptresource.h" 00027 #include "kptduration.h" 00028 #include <qsplitter.h> 00029 #include <QString> 00030 00031 #include <k3listview.h> 00032 00033 class KAction; 00034 class KPrinter; 00035 00036 namespace Kugar 00037 { 00038 class MReportViewer; 00039 } // Kugar namespace 00040 00041 //class QString; 00042 class QStringList; 00043 class QDomDocument; 00044 class QDomNode; 00045 class QIODevice; 00046 00047 namespace KPlato 00048 { 00049 00050 class View; 00051 class Node; 00052 class KugarReportViewer; 00053 class ReportTagsPrivate; 00054 00055 class ReportView : public QSplitter 00056 { 00057 Q_OBJECT 00058 00059 public: 00060 00061 ReportView(View *view, QWidget *parent); 00062 00063 ~ReportView(); 00064 00065 void zoom(double /*zoom*/) {} 00066 00067 void draw(const QString &report); 00068 View *mainView() const { return m_mainview; } 00069 00070 void setup(KPrinter &printer); 00071 void print(KPrinter &printer); 00072 00073 void setReportData(); 00074 00075 void getTemplateFile(const QString &tpl); 00076 void openTemplateFile(const QString &file); 00077 void loadTemplate(QIODevice &dev); 00078 void loadTemplate(QDomDocument &doc); 00079 void handleHeader(QDomNode &node); 00080 void handleDetail(QDomElement &elem); 00081 void handleKPlato(QDomElement &elem); 00082 void replaceTags(QDomNode &node); 00083 00084 QString setReportDetail(); 00085 QString setTaskChildren(Node *node); 00086 QString setTaskDetail(Node *node); 00087 QStringList getProperties(QDomElement &elem); 00088 00089 QString setResourceDetail(Resource *res); 00090 QString setResourceGroupDetail(ResourceGroup *group); 00091 00092 QString setDetail(const QString &source, QStringList &properties, QString &level); 00093 00094 virtual bool setContext(Context::Reportview &context); 00095 virtual void getContext(Context::Reportview &context) const; 00096 00097 void enableNavigationBtn(); 00098 00099 signals: 00100 void setFirstPageActionEnabled(bool); 00101 void setNextPageActionEnabled(bool); 00102 void setPriorPageActionEnabled(bool); 00103 void setLastPageActionEnabled(bool); 00104 00105 public slots: 00106 void slotFirstPage(); 00107 void slotNextPage(); 00108 void slotPrevPage(); 00109 void slotLastPage(); 00110 00111 protected slots: 00112 void slotReportListClicked(Q3ListViewItem* item); 00113 void slotReportListSelectionChanged(Q3ListViewItem* item); 00114 00115 private: 00116 class ReportItem : public K3ListViewItem { 00117 public: 00118 ReportItem(K3ListView *p, QString name, QString _url) 00119 : K3ListViewItem(p, name), 00120 url(_url) 00121 {} 00122 QString url; 00123 }; 00124 void initReportList(); 00125 00126 private: 00127 View *m_mainview; 00128 K3ListView *m_reportList; 00129 KugarReportViewer *m_reportview; 00130 int m_defaultFontSize; 00131 00132 QDomDocument templateDoc; 00133 00134 ReportTagsPrivate *m_reportTags; 00135 }; 00136 00137 } //KPlato namespace 00138 00139 #endif