korganizer
kotodoview.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KOTODOVIEW_H
00026 #define KOTODOVIEW_H
00027
00028 #include <qmap.h>
00029 #include <qtooltip.h>
00030
00031 #include <klistview.h>
00032
00033 #include <libkcal/todo.h>
00034 #include <korganizer/baseview.h>
00035
00036 class QDragEnterEvent;
00037 class QDragMoveEvent;
00038 class QDragLeaveEvent;
00039 class QDropEvent;
00040 class QPopupMenu;
00041
00042 class KOTodoListView;
00043 class KOTodoViewItem;
00044 class KDatePickerPopup;
00045
00046 class DocPrefs;
00047
00048 namespace KPIM {
00049 class ClickLineEdit;
00050 }
00051 namespace KCal {
00052 class Incidence;
00053 class Calendar;
00054 }
00055 using namespace KCal;
00056 using namespace KOrg;
00057
00058 class KOTodoListViewToolTip : public QToolTip
00059 {
00060 public:
00061 KOTodoListViewToolTip( QWidget *parent, Calendar *calendar, KOTodoListView *lv );
00062
00063 protected:
00064 void maybeTip( const QPoint &pos );
00065
00066 private:
00067 Calendar *mCalendar;
00068 KOTodoListView *todolist;
00069 };
00070
00071
00072 class KOTodoListView : public KListView
00073 {
00074 Q_OBJECT
00075 public:
00076 KOTodoListView( QWidget *parent = 0, const char *name = 0 );
00077 ~KOTodoListView();
00078
00079 void setCalendar( Calendar * );
00080
00081 void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
00082
00083 protected:
00084 virtual bool event( QEvent * );
00085
00086 void contentsDragEnterEvent( QDragEnterEvent * );
00087 void contentsDragMoveEvent( QDragMoveEvent * );
00088 void contentsDragLeaveEvent( QDragLeaveEvent * );
00089 void contentsDropEvent( QDropEvent * );
00090
00091 void contentsMousePressEvent( QMouseEvent * );
00092 void contentsMouseMoveEvent( QMouseEvent * );
00093 void contentsMouseReleaseEvent( QMouseEvent * );
00094 void contentsMouseDoubleClickEvent( QMouseEvent * );
00095
00096 private:
00097 Calendar *mCalendar;
00098 KOrg::IncidenceChangerBase *mChanger;
00099
00100 QPoint mPressPos;
00101 bool mMousePressed;
00102 QListViewItem *mOldCurrent;
00103 KOTodoListViewToolTip *tooltip;
00104 };
00105
00106
00113 class KOTodoView : public KOrg::BaseView
00114 {
00115 Q_OBJECT
00116 public:
00117 KOTodoView( Calendar *cal, QWidget *parent = 0, const char *name = 0 );
00118 ~KOTodoView();
00119
00120 void setCalendar( Calendar * );
00121
00122 Incidence::List selectedIncidences();
00123 Todo::List selectedTodos();
00124
00125 DateList selectedDates() { return DateList(); }
00126
00128 int currentDateCount() { return 0; }
00129
00130 CalPrinterBase::PrintType printType();
00131
00132 void setDocumentId( const QString & );
00133
00134 void saveLayout( KConfig *config, const QString &group ) const;
00135 void restoreLayout( KConfig *config, const QString &group );
00137 QPopupMenu *getCategoryPopupMenu( KOTodoViewItem *todoItem );
00138 void setIncidenceChanger( IncidenceChangerBase *changer );
00139
00140 public slots:
00141 void updateView();
00142 void updateConfig();
00143
00144 void changeIncidenceDisplay( Incidence *, int );
00145
00146 void showDates( const QDate &start, const QDate &end );
00147 void showIncidences( const Incidence::List &incidenceList, const QDate &date );
00148
00149 void clearSelection();
00150
00151 void editItem( QListViewItem *item, const QPoint &, int );
00152 void editItem( QListViewItem *item );
00153 void showItem( QListViewItem *item, const QPoint &, int );
00154 void showItem( QListViewItem *item );
00155 void popupMenu( QListViewItem *item, const QPoint &, int );
00156 void newTodo();
00157 void newSubTodo();
00158 void showTodo();
00159 void editTodo();
00160 void printTodo();
00161 void deleteTodo();
00162
00163 void setNewPercentage( KOTodoViewItem *item, int percentage );
00164
00165 void setNewPriority( int );
00166 void setNewPercentage( int );
00167 void setNewDate( QDate );
00168 void copyTodoToDate( QDate );
00169 void changedCategories( int );
00170
00171 void purgeCompleted();
00172
00173 void itemStateChanged( QListViewItem * );
00174
00175 void setNewPercentageDelayed( KOTodoViewItem *item, int percentage );
00176 void processDelayedNewPercentage();
00177
00178 signals:
00179 void unSubTodoSignal();
00180 void unAllSubTodoSignal();
00181
00182 void purgeCompletedSignal();
00183
00184 protected slots:
00185 void processSelectionChange();
00186 void addQuickTodo();
00187 void removeTodoItems();
00188
00189 private:
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 friend class KOTodoViewItem;
00200
00201 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem( Todo *todo );
00202 bool scheduleRemoveTodoItem( KOTodoViewItem *todoItem );
00203 void restoreItemState( QListViewItem * );
00204
00205 KOTodoListView *mTodoListView;
00206 QPopupMenu *mItemPopupMenu;
00207 QPopupMenu *mPopupMenu;
00208 QPopupMenu *mPriorityPopupMenu;
00209 QPopupMenu *mPercentageCompletedPopupMenu;
00210 QPopupMenu *mCategoryPopupMenu;
00211 KDatePickerPopup *mMovePopupMenu;
00212 KDatePickerPopup *mCopyPopupMenu;
00213
00214 QMap<int, int> mPercentage;
00215 QMap<int, int> mPriority;
00216 QMap<int, QString> mCategory;
00217
00218 KOTodoViewItem *mActiveItem;
00219
00220 QMap<Todo *,KOTodoViewItem *> mTodoMap;
00221 QPtrList<KOTodoViewItem> mItemsToDelete;
00222 QValueList< QPair<KOTodoViewItem *, int> > mPercentChangedMap;
00223
00224 DocPrefs *mDocPrefs;
00225 QString mCurrentDoc;
00226 KPIM::ClickLineEdit *mQuickAdd;
00227
00228 public:
00229 enum {
00230 eSummaryColumn = 0,
00231 eRecurColumn = 1,
00232 ePriorityColumn = 2,
00233 ePercentColumn = 3,
00234 eDueDateColumn = 4,
00235 eCategoriesColumn = 5,
00236 eDescriptionColumn = 6
00237 };
00238 enum {
00239 ePopupEdit = 1300,
00240 ePopupDelete = 1301,
00241 ePopupMoveTo = 1302,
00242 ePopupCopyTo = 1303,
00243 ePopupUnSubTodo = 1304,
00244 ePopupUnAllSubTodo = 1305
00245 };
00246
00247 };
00248
00249 #endif
|