File indexing completed on 2024-04-28 16:24:40

0001 /* This file is part of the KDE project
0002    Copyright (C) 2007 - 2010 Dag Andersen <danders@get2net.dk>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef KPTVIEWLISTDIALOG_H
0021 #define KPTVIEWLISTDIALOG_H
0022 
0023 #include "ui_kptviewlistaddview.h"
0024 #include "ui_kptviewlisteditview.h"
0025 #include "ui_kptviewlisteditcategory.h"
0026 
0027 #include <KoDialog.h>
0028 
0029 #include <QWidget>
0030 #include <QDomDocument>
0031 
0032 
0033 namespace KPlato
0034 {
0035 
0036 class View;
0037 class ViewListWidget;
0038 class ViewListItem;
0039 class AddViewPanel;
0040 class EditViewPanel;
0041 class EditCategoryPanel;
0042 class ViewBase;
0043 class AddReportsViewPanel;
0044 
0045 class ViewListDialog : public KoDialog
0046 {
0047     Q_OBJECT
0048 public:
0049     ViewListDialog(View *view, ViewListWidget &viewlist, QWidget *parent=0);
0050 
0051 protected Q_SLOTS:
0052     void slotOk();
0053 
0054     void slotViewListItemRemoved(KPlato::ViewListItem *);
0055 
0056 Q_SIGNALS:
0057     void viewCreated(KPlato::ViewBase *view);
0058 
0059 private:
0060     AddViewPanel *m_panel;
0061 };
0062 
0063 class AddViewPanel : public QWidget
0064 {
0065     Q_OBJECT
0066 public:
0067     AddViewPanel(View *view, ViewListWidget &viewlist, QWidget *parent);
0068 
0069     bool ok();
0070 
0071     Ui::AddViewPanel widget;
0072 
0073 Q_SIGNALS:
0074     void enableButtonOk(bool);
0075     void viewCreated(KPlato::ViewBase *view);
0076 
0077 protected Q_SLOTS:
0078     void changed();
0079     void viewtypeChanged(int idx);
0080     void categoryChanged();
0081     void fillAfter(KPlato::ViewListItem *cat);
0082 
0083     void viewnameChanged(const QString &text);
0084     void viewtipChanged(const QString &text);
0085 
0086 private:
0087     View *m_view;
0088     ViewListWidget &m_viewlist;
0089     QMap<QString, ViewListItem*> m_categories;
0090     QStringList m_viewtypes;
0091     bool m_viewnameChanged;
0092     bool m_viewtipChanged;
0093 };
0094 
0095 class ViewListEditViewDialog : public KoDialog
0096 {
0097     Q_OBJECT
0098 public:
0099     ViewListEditViewDialog(ViewListWidget &viewlist, ViewListItem *item, QWidget *parent=0);
0100 
0101 protected Q_SLOTS:
0102     void slotOk();
0103 
0104     void slotViewListItemRemoved(KPlato::ViewListItem*);
0105 
0106 private:
0107     EditViewPanel *m_panel;
0108 };
0109 
0110 class EditViewPanel : public QWidget
0111 {
0112     Q_OBJECT
0113 public:
0114     EditViewPanel(ViewListWidget &viewlist, ViewListItem *item, QWidget *parent);
0115 
0116     bool ok();
0117 
0118     Ui::EditViewPanel widget;
0119 
0120 Q_SIGNALS:
0121     void enableButtonOk(bool);
0122 
0123 protected Q_SLOTS:
0124     void changed();
0125     void categoryChanged();
0126     void fillAfter(KPlato::ViewListItem *cat);
0127 
0128 private:
0129     ViewListItem *m_item;
0130     ViewListWidget &m_viewlist;
0131     QMap<QString, ViewListItem*> m_categories;
0132 };
0133 
0134 class ViewListEditCategoryDialog : public KoDialog
0135 {
0136     Q_OBJECT
0137 public:
0138     ViewListEditCategoryDialog(ViewListWidget &viewlist, ViewListItem *item, QWidget *parent=0);
0139 
0140 protected Q_SLOTS:
0141     void slotOk();
0142 
0143     void slotViewListItemRemoved(KPlato::ViewListItem*);
0144 
0145 private:
0146     EditCategoryPanel *m_panel;
0147 };
0148 
0149 class EditCategoryPanel : public QWidget
0150 {
0151     Q_OBJECT
0152 public:
0153     EditCategoryPanel(ViewListWidget &viewlist, ViewListItem *item, QWidget *parent);
0154 
0155     bool ok();
0156 
0157     Ui::EditCategoryPanel widget;
0158 
0159 Q_SIGNALS:
0160     void enableButtonOk(bool);
0161 
0162 protected Q_SLOTS:
0163     void changed();
0164     void fillAfter();
0165 
0166 private:
0167     ViewListItem *m_item;
0168     ViewListWidget &m_viewlist;
0169 };
0170 
0171 #ifdef PLAN_USE_KREPORT
0172 //-------- Reports
0173 class ViewListReportsDialog : public KoDialog
0174 {
0175     Q_OBJECT
0176 public:
0177     ViewListReportsDialog(View *view, ViewListWidget &viewlist, const QDomDocument &doc, QWidget *parent=0);
0178 
0179 protected Q_SLOTS:
0180     void slotOk();
0181 
0182     void slotViewListItemRemoved(KPlato::ViewListItem*);
0183 
0184 Q_SIGNALS:
0185     void viewCreated(KPlato::ViewBase *view);
0186 
0187 private:
0188     AddReportsViewPanel *m_panel;
0189 };
0190 
0191 class AddReportsViewPanel : public QWidget
0192 {
0193     Q_OBJECT
0194 public:
0195     AddReportsViewPanel(View *view, ViewListWidget &viewlist, const QDomDocument &doc, QWidget *parent);
0196 
0197     bool ok();
0198 
0199     Ui::AddViewPanel widget;
0200 
0201 Q_SIGNALS:
0202     void enableButtonOk(bool);
0203     void viewCreated(KPlato::ViewBase *view);
0204 
0205 protected Q_SLOTS:
0206     void changed();
0207     void viewtypeChanged(int idx);
0208     void categoryChanged();
0209     void fillAfter(KPlato::ViewListItem *cat);
0210 
0211     void viewnameChanged(const QString &text);
0212     void viewtipChanged(const QString &text);
0213 
0214 private:
0215     View *m_view;
0216     ViewListWidget &m_viewlist;
0217     QMap<QString, ViewListItem*> m_categories;
0218     QStringList m_viewtypes;
0219     bool m_viewnameChanged;
0220     bool m_viewtipChanged;
0221     QDomDocument m_data;
0222 };
0223 #endif
0224 
0225 } //KPlato namespace
0226 
0227 #endif // CONFIGDIALOG_H