1/* This file is part of the KDE project
2 Copyright (C) 2007 - 2010 Dag Andersen <danders@get2net.dk>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KPTVIEWLISTDIALOG_H
21#define KPTVIEWLISTDIALOG_H
22
23#include "ui_kptviewlistaddview.h"
24#include "ui_kptviewlisteditview.h"
25#include "ui_kptviewlisteditcategory.h"
26
27#include <kdialog.h>
28
29#include <QWidget>
30
31class KoView;
32
33namespace KPlato
34{
35
36class View;
37class ViewListWidget;
38class ViewListItem;
39class AddViewPanel;
40class EditViewPanel;
41class EditCategoryPanel;
42class ViewBase;
43class AddReportsViewPanel;
44
45class ViewListDialog : public KDialog
46{
47 Q_OBJECT
48public:
49 ViewListDialog( View *view, ViewListWidget &viewlist, QWidget *parent=0 );
50
51protected slots:
52 void slotOk();
53
54 void slotViewListItemRemoved( ViewListItem * );
55
56signals:
57 void viewCreated( ViewBase *view );
58
59private:
60 AddViewPanel *m_panel;
61};
62
63class AddViewPanel : public QWidget
64{
65 Q_OBJECT
66public:
67 AddViewPanel( View *view, ViewListWidget &viewlist, QWidget *parent );
68
69 bool ok();
70
71 Ui::AddViewPanel widget;
72
73signals:
74 void enableButtonOk( bool );
75 void viewCreated( ViewBase *view );
76
77protected slots:
78 void changed();
79 void viewtypeChanged( int idx );
80 void categoryChanged();
81 void fillAfter( ViewListItem *cat );
82
83 void viewnameChanged( const QString &text );
84 void viewtipChanged( const QString &text );
85
86private:
87 View *m_view;
88 ViewListWidget &m_viewlist;
89 QMap<QString, ViewListItem*> m_categories;
90 QStringList m_viewtypes;
91 bool m_viewnameChanged;
92 bool m_viewtipChanged;
93};
94
95class ViewListEditViewDialog : public KDialog
96{
97 Q_OBJECT
98public:
99 ViewListEditViewDialog( ViewListWidget &viewlist, ViewListItem *item, QWidget *parent=0 );
100
101protected slots:
102 void slotOk();
103
104 void slotViewListItemRemoved( ViewListItem * );
105
106private:
107 EditViewPanel *m_panel;
108};
109
110class EditViewPanel : public QWidget
111{
112 Q_OBJECT
113public:
114 EditViewPanel( ViewListWidget &viewlist, ViewListItem *item, QWidget *parent );
115
116 bool ok();
117
118 Ui::EditViewPanel widget;
119
120signals:
121 void enableButtonOk( bool );
122
123protected slots:
124 void changed();
125 void categoryChanged();
126 void fillAfter( ViewListItem *cat );
127
128private:
129 ViewListItem *m_item;
130 ViewListWidget &m_viewlist;
131 QMap<QString, ViewListItem*> m_categories;
132};
133
134class ViewListEditCategoryDialog : public KDialog
135{
136 Q_OBJECT
137public:
138 ViewListEditCategoryDialog( ViewListWidget &viewlist, ViewListItem *item, QWidget *parent=0 );
139
140protected slots:
141 void slotOk();
142
143 void slotViewListItemRemoved( ViewListItem * );
144
145private:
146 EditCategoryPanel *m_panel;
147};
148
149class EditCategoryPanel : public QWidget
150{
151 Q_OBJECT
152public:
153 EditCategoryPanel( ViewListWidget &viewlist, ViewListItem *item, QWidget *parent );
154
155 bool ok();
156
157 Ui::EditCategoryPanel widget;
158
159signals:
160 void enableButtonOk( bool );
161
162protected slots:
163 void changed();
164 void fillAfter();
165
166private:
167 ViewListItem *m_item;
168 ViewListWidget &m_viewlist;
169};
170
171//-------- Reports
172class ViewListReportsDialog : public KDialog
173{
174 Q_OBJECT
175public:
176 ViewListReportsDialog( View *view, ViewListWidget &viewlist, QWidget *parent=0 );
177
178protected slots:
179 void slotOk();
180
181 void slotViewListItemRemoved( ViewListItem * );
182
183signals:
184 void viewCreated( ViewBase *view );
185
186private:
187 AddReportsViewPanel *m_panel;
188};
189
190class AddReportsViewPanel : public QWidget
191{
192 Q_OBJECT
193public:
194 AddReportsViewPanel( View *view, ViewListWidget &viewlist, QWidget *parent );
195
196 bool ok();
197
198 Ui::AddViewPanel widget;
199
200signals:
201 void enableButtonOk( bool );
202 void viewCreated( ViewBase *view );
203
204protected slots:
205 void changed();
206 void viewtypeChanged( int idx );
207 void categoryChanged();
208 void fillAfter( ViewListItem *cat );
209
210 void viewnameChanged( const QString &text );
211 void viewtipChanged( const QString &text );
212
213private:
214 View *m_view;
215 ViewListWidget &m_viewlist;
216 QMap<QString, ViewListItem*> m_categories;
217 QStringList m_viewtypes;
218 bool m_viewnameChanged;
219 bool m_viewtipChanged;
220};
221
222
223} //KPlato namespace
224
225#endif // CONFIGDIALOG_H
226