summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoview.h
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /korganizer/kotodoview.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'korganizer/kotodoview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.h230
1 files changed, 230 insertions, 0 deletions
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
new file mode 100644
index 0000000..4495702
--- a/dev/null
+++ b/korganizer/kotodoview.h
@@ -0,0 +1,230 @@
1/*
2 This file is part of KOrganizer.
3 Copyright (c) 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution.
22*/
23#ifndef KOTODOVIEW_H
24#define KOTODOVIEW_H
25
26#include <qfont.h>
27#include <qfontmetrics.h>
28#include <qlineedit.h>
29#include <qptrlist.h>
30#include <qstrlist.h>
31#include <qlistbox.h>
32#include <qpopupmenu.h>
33#include <qlabel.h>
34#include <qmap.h>
35#include <qlistview.h>
36#include <klistview.h>
37
38#include <libkcal/calendar.h>
39#include <libkcal/todo.h>
40
41#include <korganizer/baseview.h>
42
43#include "kotodoviewitem.h"
44#include "koprefs.h"
45#include "koglobals.h"
46
47class QDragEnterEvent;
48class QDragMoveEvent;
49class QDragLeaveEvent;
50class QDropEvent;
51
52class DocPrefs;
53
54class KOTodoListView : public KListView
55{
56 Q_OBJECT
57 public:
58 KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0);
59 virtual ~KOTodoListView() {}
60
61 signals:
62 void todoDropped(Todo *);
63 void double_Clicked(QListViewItem *item);
64
65 protected:
66 void contentsDragEnterEvent(QDragEnterEvent *);
67 void contentsDragMoveEvent(QDragMoveEvent *);
68 void contentsDragLeaveEvent(QDragLeaveEvent *);
69 void contentsDropEvent(QDropEvent *);
70
71 void contentsMousePressEvent(QMouseEvent *);
72 void contentsMouseMoveEvent(QMouseEvent *);
73 void contentsMouseReleaseEvent(QMouseEvent *);
74 void contentsMouseDoubleClickEvent(QMouseEvent *);
75
76 private:
77 Calendar *mCalendar;
78 QPoint mPressPos;
79 bool mMousePressed;
80 QListViewItem *mOldCurrent;
81 void keyPressEvent ( QKeyEvent * ) ;
82};
83
84
85/**
86 This is the line-edit on top of the todoview for fast addition of new todos
87*/
88class KOQuickTodo : public QLineEdit
89{
90 public:
91 KOQuickTodo(QWidget *parent=0);
92 protected:
93 void focusInEvent(QFocusEvent *ev);
94 void focusOutEvent(QFocusEvent *ev);
95};
96
97
98/**
99 This class provides a multi-column list view of todo events.
100
101 @short multi-column list view of todo events.
102 @author Cornelius Schumacher <schumacher@kde.org>
103*/
104class KOTodoView : public KOrg::BaseView
105{
106 Q_OBJECT
107 public:
108 KOTodoView(Calendar *, QWidget* parent=0, const char* name=0 );
109 ~KOTodoView();
110
111 QPtrList<Incidence> selectedIncidences();
112 QPtrList<Todo> selectedTodos();
113
114 DateList selectedDates()
115 {DateList q;
116 return q;}
117
118 /** Return number of shown dates. TodoView does not show dates, */
119 int currentDateCount() { return 0; }
120 void setNarrow();
121
122 void printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td);
123
124 void setDocumentId( const QString & );
125
126 void saveLayout(KConfig *config, const QString &group) const;
127 void restoreLayout(KConfig *config, const QString &group);
128 /** Create a popup menu to set categories */
129 QPopupMenu *getCategoryPopupMenu (KOTodoViewItem *todoItem);
130
131 public slots:
132 void updateView();
133 void updateConfig();
134
135 void changeEventDisplay(Event *, int);
136
137 void showDates(const QDate &start, const QDate &end);
138 void showEvents(QPtrList<Event> eventList);
139
140 void clearSelection();
141 void jumpToDate ();
142
143 void editItem(QListViewItem *item);
144 void showItem(QListViewItem *item,const QPoint &,int);
145 void popupMenu(QListViewItem *item,const QPoint &,int);
146 void newTodo();
147 void newSubTodo();
148 void unparentTodo();
149 void showTodo();
150 void editTodo();
151 void cloneTodo();
152 void cancelTodo();
153 void moveTodo();
154 void beamTodo();
155 void deleteTodo();
156
157 void setNewPriority(int);
158 void setNewPercentage(int);
159 void changedCategories(int);
160
161 void purgeCompleted();
162 void toggleCompleted();
163 void toggleQuickTodo();
164 void updateTodo( Todo *, int );
165
166 void itemClicked(QListViewItem *);
167 void itemStateChanged(QListViewItem *);
168 void modified(bool);
169 void itemDoubleClicked(QListViewItem *item);
170
171 signals:
172 void newTodoSignal();
173 void newSubTodoSignal(Todo *);
174 void unparentTodoSignal(Todo *);
175 void showTodoSignal(Todo *);
176
177 void editTodoSignal(Todo *);
178 void deleteTodoSignal(Todo *);
179 void todoModifiedSignal (Todo *, int);
180
181 void isModified(bool);
182 void cloneTodoSignal( Incidence * );
183 void cancelTodoSignal( Incidence * );
184 void moveTodoSignal( Incidence * );
185 void beamTodoSignal( Incidence * );
186 void purgeCompletedSignal();
187
188 protected slots:
189 void processSelectionChange();
190 void addQuickTodo();
191
192 private:
193 /*
194 * the TodoEditor approach is rather unscaling in the long
195 * run.
196 * Korganizer keeps it in memory and we need to update
197 * 1. make KOTodoViewItem a QObject again?
198 * 2. add a public method for setting one todo modified?
199 * 3. add a private method for setting a todo modified + friend here?
200 * -- zecke 2002-07-08
201 */
202 friend class KOTodoViewItem;
203 void setTodoModified( Todo* );
204 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem(Todo *todo);
205 void restoreItemState( QListViewItem * );
206
207 KOTodoListView *mTodoListView;
208 QPopupMenu *mItemPopupMenu;
209 QPopupMenu *mPopupMenu;
210 QPopupMenu *mPriorityPopupMenu;
211 QPopupMenu *mPercentageCompletedPopupMenu;
212 QPopupMenu *mCategoryPopupMenu;
213
214 QMap<int, int> mPercentage;
215 QMap<int, int> mPriority;
216 QMap<int, QString> mCategory;
217 KOTodoViewItem *mActiveItem;
218
219 QMap<Todo *,KOTodoViewItem *> mTodoMap;
220 QString mName;
221
222 DocPrefs *mDocPrefs;
223 QString mCurrentDoc;
224 KOQuickTodo *mQuickAdd;
225 bool mBlockUpdate;
226 void todoModified(Todo *, int );
227 void keyPressEvent ( QKeyEvent * ) ;
228};
229
230#endif