00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef KOTODOVIEW_H
00025
#define KOTODOVIEW_H
00026
00027
#include <qmap.h>
00028
#include <qtooltip.h>
00029
00030
#include <klistview.h>
00031
00032
#include <libkcal/todo.h>
00033
#include <korganizer/baseview.h>
00034
#include "calprinter.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
00057
class KOTodoListViewToolTip :
public QToolTip
00058 {
00059
public:
00060 KOTodoListViewToolTip(
QWidget *parent, KOTodoListView *lv );
00061
00062
protected:
00063
void maybeTip(
const QPoint &pos );
00064
00065
private:
00066 KOTodoListView *todolist;
00067 };
00068
00069
00070
class KOTodoListView :
public KListView
00071 {
00072 Q_OBJECT
00073
public:
00074 KOTodoListView(
QWidget *parent = 0,
const char *name = 0 );
00075 ~KOTodoListView();
00076
00077
void setCalendar( Calendar * );
00078
00079 signals:
00080
void incidenceAdded( Incidence* );
00081
void incidenceChanged( Incidence*, Incidence* );
00082
void incidenceDeleted( Incidence* );
00083
void incidenceToBeDeleted( Incidence* );
00084
00085
protected:
00086
virtual bool event(
QEvent * );
00087
00088
void contentsDragEnterEvent(
QDragEnterEvent * );
00089
void contentsDragMoveEvent(
QDragMoveEvent * );
00090
void contentsDragLeaveEvent(
QDragLeaveEvent * );
00091
void contentsDropEvent(
QDropEvent * );
00092
00093
void contentsMousePressEvent(
QMouseEvent * );
00094
void contentsMouseMoveEvent(
QMouseEvent * );
00095
void contentsMouseReleaseEvent(
QMouseEvent * );
00096
void contentsMouseDoubleClickEvent(
QMouseEvent * );
00097
00098
private:
00099 Calendar *mCalendar;
00100
00101
QPoint mPressPos;
00102
bool mMousePressed;
00103
QListViewItem *mOldCurrent;
00104 KOTodoListViewToolTip *tooltip;
00105 };
00106
00107
00114 class KOTodoView :
public KOrg::BaseView
00115 {
00116 Q_OBJECT
00117
public:
00118
KOTodoView( Calendar *cal,
QWidget *parent = 0,
const char *name = 0 );
00119 ~
KOTodoView();
00120
00121
void setCalendar( Calendar * );
00122
00123 Incidence::List
selectedIncidences();
00124 Todo::List selectedTodos();
00125
00126 DateList
selectedDates() {
return DateList(); }
00127
00129 int currentDateCount() {
return 0; }
00130
00131
void printPreview(
CalPrinter *calPrinter,
const QDate &fd,
00132
const QDate &td );
00133
00134 CalPrinter::PrintType printType();
00135
00136
void setDocumentId(
const QString & );
00137
00138
void saveLayout( KConfig *config,
const QString &group )
const;
00139
void restoreLayout( KConfig *config,
const QString &group );
00141
QPopupMenu *getCategoryPopupMenu(
KOTodoViewItem *todoItem );
00142
00143
public slots:
00144
void updateView();
00145
void updateConfig();
00146
00147
void changeIncidenceDisplay( Incidence *,
int );
00148
00149
void showDates(
const QDate &start,
const QDate &end );
00150
void showIncidences(
const Incidence::List & );
00151
00152
void clearSelection();
00153
00154
void editItem(
QListViewItem *item,
const QPoint &,
int );
00155
void editItem(
QListViewItem *item );
00156
void showItem(
QListViewItem *item,
const QPoint &,
int );
00157
void showItem(
QListViewItem *item );
00158
void popupMenu(
QListViewItem *item,
const QPoint &,
int );
00159
void newTodo();
00160
void newSubTodo();
00161
void showTodo();
00162
void editTodo();
00163
void deleteTodo();
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
void setTodoModified( Todo *oldTodo, Todo *todo )
00175 {
00176 emit incidenceChanged( oldTodo, todo );
00177 }
00178
void emitCompletedSignal( Todo * );
00179
00180 signals:
00181
void unSubTodoSignal();
00182
00183
void todoCompleted( Todo * );
00184
00185
void purgeCompletedSignal();
00186
00187
protected slots:
00188
void processSelectionChange();
00189
void addQuickTodo();
00190
void removeTodoItems();
00191
00192
private:
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
friend class KOTodoViewItem;
00203
00204
QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem( Todo *todo );
00205
bool scheduleRemoveTodoItem(
KOTodoViewItem *todoItem );
00206
void restoreItemState(
QListViewItem * );
00207
00208 KOTodoListView *mTodoListView;
00209
QPopupMenu *mItemPopupMenu;
00210
QPopupMenu *mPopupMenu;
00211
QPopupMenu *mPriorityPopupMenu;
00212
QPopupMenu *mPercentageCompletedPopupMenu;
00213
QPopupMenu *mCategoryPopupMenu;
00214 KDatePickerPopup *mMovePopupMenu;
00215 KDatePickerPopup *mCopyPopupMenu;
00216
00217
QMap<int, int> mPercentage;
00218
QMap<int, int> mPriority;
00219
QMap<int, QString> mCategory;
00220
00221
KOTodoViewItem *mActiveItem;
00222
00223
QMap<Todo *,KOTodoViewItem *> mTodoMap;
00224
QPtrList<KOTodoViewItem> mItemsToDelete;
00225
00226 DocPrefs *mDocPrefs;
00227
QString mCurrentDoc;
00228 KPIM::ClickLineEdit *mQuickAdd;
00229
00230
static const int POPUP_UNSUBTODO;
00231 };
00232
00233
#endif