-rw-r--r-- | korganizer/kolistview.h | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h new file mode 100644 index 0000000..23afdb1 --- a/dev/null +++ b/korganizer/kolistview.h | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | This file is part of KOrganizer. | ||
3 | Copyright (c) 1999 Preston Brown | ||
4 | Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | |||
20 | As a special exception, permission is given to link this program | ||
21 | with any edition of Qt, and distribute the resulting executable, | ||
22 | without including the source code for Qt in the source distribution. | ||
23 | */ | ||
24 | #ifndef _KOLISTVIEW_H | ||
25 | #define _KOLISTVIEW_H | ||
26 | |||
27 | #include <qlistview.h> | ||
28 | #include <qmap.h> | ||
29 | #include <qdict.h> | ||
30 | |||
31 | #include <klistview.h> | ||
32 | |||
33 | #ifndef DESKTOP_VERSION | ||
34 | #include <qtopia/ir.h> | ||
35 | #else | ||
36 | #define Ir char | ||
37 | #endif | ||
38 | #include <libkcal/incidence.h> | ||
39 | |||
40 | #include "koeventview.h" | ||
41 | #include "customlistviewitem.h" | ||
42 | |||
43 | using namespace KCal; | ||
44 | |||
45 | typedef CustomListViewItem<Incidence *> KOListViewItem; | ||
46 | |||
47 | /** | ||
48 | This class provides the initialisation of a KOListViewItem for calendar | ||
49 | components using the Incidence::Visitor. | ||
50 | */ | ||
51 | class ListItemVisitor : public Incidence::Visitor | ||
52 | { | ||
53 | public: | ||
54 | ListItemVisitor(KOListViewItem *, QDate d); | ||
55 | ~ListItemVisitor(); | ||
56 | |||
57 | bool visit(Event *); | ||
58 | bool visit(Todo *); | ||
59 | bool visit(Journal *); | ||
60 | |||
61 | private: | ||
62 | KOListViewItem *mItem; | ||
63 | QDate mDate; | ||
64 | }; | ||
65 | |||
66 | /** | ||
67 | This class provides a multi-column list view of events. It can | ||
68 | display events from one particular day or several days, it doesn't | ||
69 | matter. To use a view that only handles one day at a time, use | ||
70 | KODayListView. | ||
71 | |||
72 | @short multi-column list view of various events. | ||
73 | @author Preston Brown <pbrown@kde.org> | ||
74 | @see KOBaseView, KODayListView | ||
75 | */ | ||
76 | class KOListView; | ||
77 | |||
78 | class KOListViewListView : public KListView | ||
79 | { | ||
80 | Q_OBJECT | ||
81 | public: | ||
82 | KOListViewListView(KOListView * lv ); | ||
83 | signals: | ||
84 | void newEvent(); | ||
85 | void showIncidence( Incidence* ); | ||
86 | private: | ||
87 | void keyPressEvent ( QKeyEvent * ) ; | ||
88 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | ||
89 | void contentsMousePressEvent(QMouseEvent *e); | ||
90 | void contentsMouseReleaseEvent(QMouseEvent *e); | ||
91 | void contentsMouseMoveEvent(QMouseEvent *e); | ||
92 | bool mAllowPopupMenu; | ||
93 | bool mMouseDown; | ||
94 | int mYMousePos; | ||
95 | }; | ||
96 | |||
97 | class KOListView : public KOEventView | ||
98 | { | ||
99 | Q_OBJECT | ||
100 | public: | ||
101 | KOListView(Calendar *calendar, QWidget *parent = 0, | ||
102 | const char *name = 0); | ||
103 | ~KOListView(); | ||
104 | |||
105 | virtual int maxDatesHint(); | ||
106 | virtual int currentDateCount(); | ||
107 | virtual QPtrList<Incidence> selectedIncidences(); | ||
108 | virtual DateList selectedDates(); | ||
109 | |||
110 | void showDates(bool show); | ||
111 | Incidence* currentItem(); | ||
112 | void addTodos(QPtrList<Todo> eventList); | ||
113 | void addJournals(QPtrList<Journal> eventList); | ||
114 | virtual void printPreview(CalPrinter *calPrinter, | ||
115 | const QDate &, const QDate &); | ||
116 | |||
117 | void readSettings(KConfig *config, QString setting = "KOListView Layout"); | ||
118 | void writeSettings(KConfig *config, QString setting = "KOListView Layout"); | ||
119 | void updateList(); | ||
120 | void setStartDate(const QDate &start); | ||
121 | int count(); | ||
122 | signals: | ||
123 | void signalNewEvent(); | ||
124 | void beamIncidenceList(QPtrList<Incidence>); | ||
125 | |||
126 | public slots: | ||
127 | virtual void updateView(); | ||
128 | virtual void showDates(const QDate &start, const QDate &end); | ||
129 | virtual void showEvents(QPtrList<Event> eventList); | ||
130 | void clearSelection(); | ||
131 | void allSelection(); | ||
132 | |||
133 | void clear(); | ||
134 | void beamDone( Ir *ir ); | ||
135 | void showDates(); | ||
136 | void hideDates(); | ||
137 | void deleteAll(); | ||
138 | void saveToFile(); | ||
139 | void saveDescriptionToFile(); | ||
140 | void beamSelected(); | ||
141 | void updateConfig(); | ||
142 | void addCat(); | ||
143 | void setCat(); | ||
144 | void setCategories( bool removeOld ); | ||
145 | void changeEventDisplay(Event *, int); | ||
146 | |||
147 | void defaultItemAction(QListViewItem *item); | ||
148 | void popupMenu(QListViewItem *item,const QPoint &,int); | ||
149 | |||
150 | protected slots: | ||
151 | void processSelectionChange(QListViewItem *); | ||
152 | |||
153 | protected: | ||
154 | void addEvents(QPtrList<Event> eventList); | ||
155 | void addIncidence(Incidence *); | ||
156 | KOListViewItem *getItemForEvent(Event *event); | ||
157 | |||
158 | private: | ||
159 | KOListViewListView *mListView; | ||
160 | KOEventPopupMenu *mPopupMenu; | ||
161 | KOListViewItem *mActiveItem; | ||
162 | QDict<Incidence> mUidDict; | ||
163 | QDate mStartDate; | ||
164 | void keyPressEvent ( QKeyEvent * ) ; | ||
165 | }; | ||
166 | |||
167 | #endif | ||