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, KOTodoListView *lv );
00062
00063 protected:
00064 void maybeTip( const QPoint &pos );
00065
00066 private:
00067 KOTodoListView *todolist;
00068 };
00069
00070
00071 class KOTodoListView : public KListView
00072 {
00073 Q_OBJECT
00074 public:
00075 KOTodoListView( QWidget *parent = 0, const char *name = 0 );
00076 ~KOTodoListView();
00077
00078 void setCalendar( Calendar * );
00079
00080 void setIncidenceChanger( IncidenceChangerBase *changer ) { mChanger = changer; }
00081
00082 protected:
00083 virtual bool event( QEvent * );
00084
00085 void contentsDragEnterEvent( QDragEnterEvent * );
00086 void contentsDragMoveEvent( QDragMoveEvent * );
00087 void contentsDragLeaveEvent( QDragLeaveEvent * );
00088 void contentsDropEvent( QDropEvent * );
00089
00090 void contentsMousePressEvent( QMouseEvent * );
00091 void contentsMouseMoveEvent( QMouseEvent * );
00092 void contentsMouseReleaseEvent( QMouseEvent * );
00093 void contentsMouseDoubleClickEvent( QMouseEvent * );
00094
00095 private:
00096 Calendar *mCalendar;
00097 KOrg::IncidenceChangerBase *mChanger;
00098
00099 QPoint mPressPos;
00100 bool mMousePressed;
00101 QListViewItem *mOldCurrent;
00102 KOTodoListViewToolTip *tooltip;
00103 };
00104
00105
00112 class KOTodoView : public KOrg::BaseView
00113 {
00114 Q_OBJECT
00115 public:
00116 KOTodoView( Calendar *cal, QWidget *parent = 0, const char *name = 0 );
00117 ~KOTodoView();
00118
00119 void setCalendar( Calendar * );
00120
00121 Incidence::List selectedIncidences();
00122 Todo::List selectedTodos();
00123
00124 DateList selectedDates() { return DateList(); }
00125
00127 int currentDateCount() { return 0; }
00128
00129 CalPrinterBase::PrintType printType();
00130
00131 void setDocumentId( const QString & );
00132
00133 void saveLayout( KConfig *config, const QString &group ) const;
00134 void restoreLayout( KConfig *config, const QString &group );
00136 QPopupMenu *getCategoryPopupMenu( KOTodoViewItem *todoItem );
00137 void setIncidenceChanger( IncidenceChangerBase *changer );
00138
00139 public slots:
00140 void updateView();
00141 void updateConfig();
00142
00143 void changeIncidenceDisplay( Incidence *, int );
00144
00145 void showDates( const QDate &start, const QDate &end );
00146 void showIncidences( const Incidence::List &incidenceList );
00147
00148 void clearSelection();
00149
00150 void editItem( QListViewItem *item, const QPoint &, int );
00151 void editItem( QListViewItem *item );
00152 void showItem( QListViewItem *item, const QPoint &, int );
00153 void showItem( QListViewItem *item );
00154 void popupMenu( QListViewItem *item, const QPoint &, int );
00155 void newTodo();
00156 void newSubTodo();
00157 void showTodo();
00158 void editTodo();
00159 void printTodo();
00160 void deleteTodo();
00161
00162 void setNewPercentage( KOTodoViewItem *item, int percentage );
00163
00164 void setNewPriority( int );
00165 void setNewPercentage( int );
00166 void setNewDate( QDate );
00167 void copyTodoToDate( QDate );
00168 void changedCategories( int );
00169
00170 void purgeCompleted();
00171
00172 void itemStateChanged( QListViewItem * );
00173
00174 void setNewPercentageDelayed( KOTodoViewItem *item, int percentage );
00175 void processDelayedNewPercentage();
00176
00177 signals:
00178 void unSubTodoSignal();
00179 void unAllSubTodoSignal();
00180
00181 void todoCompleted( Todo * );
00182
00183 void purgeCompletedSignal();
00184
00185 protected slots:
00186 void processSelectionChange();
00187 void addQuickTodo();
00188 void removeTodoItems();
00189
00190 private:
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200 friend class KOTodoViewItem;
00201
00202 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem( Todo *todo );
00203 bool scheduleRemoveTodoItem( KOTodoViewItem *todoItem );
00204 void restoreItemState( QListViewItem * );
00205
00206 KOTodoListView *mTodoListView;
00207 QPopupMenu *mItemPopupMenu;
00208 QPopupMenu *mPopupMenu;
00209 QPopupMenu *mPriorityPopupMenu;
00210 QPopupMenu *mPercentageCompletedPopupMenu;
00211 QPopupMenu *mCategoryPopupMenu;
00212 KDatePickerPopup *mMovePopupMenu;
00213 KDatePickerPopup *mCopyPopupMenu;
00214
00215 QMap<int, int> mPercentage;
00216 QMap<int, int> mPriority;
00217 QMap<int, QString> mCategory;
00218
00219 KOTodoViewItem *mActiveItem;
00220
00221 QMap<Todo *,KOTodoViewItem *> mTodoMap;
00222 QPtrList<KOTodoViewItem> mItemsToDelete;
00223 QValueList< QPair<KOTodoViewItem *, int> > mPercentChangedMap;
00224
00225 DocPrefs *mDocPrefs;
00226 QString mCurrentDoc;
00227 KPIM::ClickLineEdit *mQuickAdd;
00228
00229 public:
00230 enum {
00231 eSummaryColumn = 0,
00232 eRecurColumn = 1,
00233 ePriorityColumn = 2,
00234 ePercentColumn = 3,
00235 eDueDateColumn = 4,
00236 eCategoriesColumn = 5,
00237 eDescriptionColumn = 6
00238 };
00239 enum {
00240 ePopupEdit = 1300,
00241 ePopupDelete = 1301,
00242 ePopupMoveTo = 1302,
00243 ePopupCopyTo = 1303,
00244 ePopupUnSubTodo = 1304,
00245 ePopupUnAllSubTodo = 1305
00246 };
00247
00248 };
00249
00250 #endif
|