korganizer

kotodoview.h
1 /*
2  This file is part of KOrganizer.
3 
4  Copyright (c) 2000,2001,2003 Cornelius Schumacher <schumacher@kde.org>
5  Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 
21  As a special exception, permission is given to link this program
22  with any edition of TQt, and distribute the resulting executable,
23  without including the source code for TQt in the source distribution.
24 */
25 #ifndef KOTODOVIEW_H
26 #define KOTODOVIEW_H
27 
28 #include <tqmap.h>
29 #include <tqtooltip.h>
30 
31 #include <tdelistview.h>
32 
33 #include <libkcal/todo.h>
34 #include <korganizer/baseview.h>
35 
36 class TQDragEnterEvent;
37 class TQDragMoveEvent;
38 class TQDragLeaveEvent;
39 class TQDropEvent;
40 class TQPopupMenu;
41 
42 class KOTodoListView;
43 class KOTodoViewItem;
44 class KDatePickerPopup;
45 
46 class DocPrefs;
47 
48 namespace KPIM {
49  class ClickLineEdit;
50 }
51 namespace KCal {
52 class Incidence;
53 class Calendar;
54 }
55 using namespace KCal;
56 using namespace KOrg;
57 
58 class KOTodoListViewToolTip : public TQToolTip
59 {
60  public:
61  KOTodoListViewToolTip( TQWidget *parent, Calendar *calendar, KOTodoListView *lv );
62 
63  protected:
64  void maybeTip( const TQPoint &pos );
65 
66  private:
67  Calendar *mCalendar;
68  KOTodoListView *todolist;
69 };
70 
71 
72 class KOTodoListView : public TDEListView
73 {
74  TQ_OBJECT
75 
76  public:
77  KOTodoListView( TQWidget *parent = 0, const char *name = 0 );
78  ~KOTodoListView();
79 
80  void setCalendar( Calendar * );
81 
82  void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
83 
84  protected:
85  virtual bool event( TQEvent * );
86 
87  void contentsDragEnterEvent( TQDragEnterEvent * );
88  void contentsDragMoveEvent( TQDragMoveEvent * );
89  void contentsDragLeaveEvent( TQDragLeaveEvent * );
90  void contentsDropEvent( TQDropEvent * );
91 
92  void contentsMousePressEvent( TQMouseEvent * );
93  void contentsMouseMoveEvent( TQMouseEvent * );
94  void contentsMouseReleaseEvent( TQMouseEvent * );
95  void contentsMouseDoubleClickEvent( TQMouseEvent * );
96 
97  private:
98  Calendar *mCalendar;
99  KOrg::IncidenceChangerBase *mChanger;
100 
101  TQPoint mPressPos;
102  bool mMousePressed;
103  TQListViewItem *mOldCurrent;
104 };
105 
106 
114 {
115  TQ_OBJECT
116 
117  public:
118  KOTodoView( Calendar *cal, TQWidget *parent = 0, const char *name = 0 );
119  ~KOTodoView();
120 
121  void setCalendar( Calendar * );
122 
123  Incidence::List selectedIncidences();
124  Todo::List selectedTodos();
125 
126  DateList selectedIncidenceDates() { return DateList(); }
127 
129  int currentDateCount() { return 0; }
130 
131  CalPrinterBase::PrintType printType();
132 
133  void setDocumentId( const TQString & );
134 
135  void saveLayout( TDEConfig *config, const TQString &group ) const;
136  void restoreLayout( TDEConfig *config, const TQString &group );
138  TQPopupMenu *getCategoryPopupMenu( KOTodoViewItem *todoItem );
139  void setIncidenceChanger( IncidenceChangerBase *changer );
140 
141  public slots:
142  void updateView();
143  void updateConfig();
144 
145  void changeIncidenceDisplay( Incidence *, int );
146 
147  void showDates( const TQDate &start, const TQDate &end );
148  void showIncidences( const Incidence::List &incidenceList, const TQDate &date );
149 
150  void clearSelection();
151 
152  void editItem( TQListViewItem *item, const TQPoint &, int );
153  void editItem( TQListViewItem *item );
154  void showItem( TQListViewItem *item, const TQPoint &, int );
155  void showItem( TQListViewItem *item );
156  void popupMenu( TQListViewItem *item, const TQPoint &, int );
157  void newTodo();
158  void newSubTodo();
159  void showTodo();
160  void editTodo();
161  void printTodo();
162  void deleteTodo();
163 
164  void setNewPercentage( KOTodoViewItem *item, int percentage );
165 
166  void setNewPriority( int );
167  void setNewPercentage( int );
168  void setNewDate( TQDate );
169  void copyTodoToDate( TQDate );
170  void changedCategories( int );
171 
172  void purgeCompleted();
173 
174  void itemStateChanged( TQListViewItem * );
175 
176  void setNewPercentageDelayed( KOTodoViewItem *item, int percentage );
177  void processDelayedNewPercentage();
178 
179  signals:
180  void unSubTodoSignal();
181  void unAllSubTodoSignal();
182  void purgeCompletedSignal();
183  void configChanged();
184 
185  protected slots:
186  void processSelectionChange();
187  void addQuickTodo();
188  void removeTodoItems();
189 
190  private:
191  /*
192  * the TodoEditor approach is rather unscaling in the long
193  * run.
194  * Korganizer keeps it in memory and we need to update
195  * 1. make KOTodoViewItem a TQObject again?
196  * 2. add a public method for setting one todo modified?
197  * 3. add a private method for setting a todo modified + friend here?
198  * -- zecke 2002-07-08
199  */
200  friend class KOTodoViewItem;
201 
202  TQMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem( Todo *todo );
203  bool scheduleRemoveTodoItem( KOTodoViewItem *todoItem );
204  void restoreItemState( TQListViewItem * );
205 
206  KOTodoListView *mTodoListView;
207  TQPopupMenu *mItemPopupMenu;
208  TQPopupMenu *mPopupMenu;
209  TQPopupMenu *mPriorityPopupMenu;
210  TQPopupMenu *mPercentageCompletedPopupMenu;
211  TQPopupMenu *mCategoryPopupMenu;
212  KDatePickerPopup *mMovePopupMenu;
213  KDatePickerPopup *mCopyPopupMenu;
214 
215  TQMap<int, int> mPercentage;
216  TQMap<int, int> mPriority;
217  TQMap<int, TQString> mCategory;
218 
219  KOTodoViewItem *mActiveItem;
220 
221  TQMap<Todo *,KOTodoViewItem *> mTodoMap;
222  TQPtrList<KOTodoViewItem> mItemsToDelete;
223  TQValueList< TQPair<KOTodoViewItem *, int> > mPercentChangedMap;
224 
225  DocPrefs *mDocPrefs;
226  TQString mCurrentDoc;
227  KPIM::ClickLineEdit *mQuickAdd;
228 
229  public:
230  enum {
231  eSummaryColumn = 0,
232  eRecurColumn = 1,
233  ePriorityColumn = 2,
234  ePercentColumn = 3,
235  eDueDateColumn = 4,
236  eCategoriesColumn = 5,
237  eFolderColumn = 6
238  };
239  enum {
240  ePopupEdit = 1300,
241  ePopupDelete = 1301,
242  ePopupMoveTo = 1302,
243  ePopupCopyTo = 1303,
244  ePopupUnSubTodo = 1304,
245  ePopupUnAllSubTodo = 1305
246  };
247 
248 };
249 
250 #endif
This class provides a way of displaying a single Event of Todo-Type in a KTodoView.
This class provides a multi-column list view of todo events.
Definition: kotodoview.h:114
DateList selectedIncidenceDates()
Definition: kotodoview.h:126
int currentDateCount()
Return number of shown dates.
Definition: kotodoview.h:129
This class provides an interface for all views being displayed within the main calendar view.
Definition: baseview.h:60