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 <qfont.h>
00028
#include <qfontmetrics.h>
00029
#include <qlineedit.h>
00030
#include <qptrlist.h>
00031
#include <qlistbox.h>
00032
#include <qpopupmenu.h>
00033
#include <qlabel.h>
00034
#include <qmap.h>
00035
#include <qtimer.h>
00036
#include <qevent.h>
00037
#include <qtooltip.h>
00038
#include <qpoint.h>
00039
#include <qrect.h>
00040
00041
#include <klistview.h>
00042
00043
#include <libkcal/calendar.h>
00044
#include <libkcal/todo.h>
00045
00046
#include <korganizer/baseview.h>
00047
00048
#include "kotodoviewitem.h"
00049
#include "koprefs.h"
00050
#include "koglobals.h"
00051
#include "calprinter.h"
00052
00053
class QDragEnterEvent;
00054
class QDragMoveEvent;
00055
class QDragLeaveEvent;
00056
class QDropEvent;
00057
00058
class KOTodoListView;
00059
00060
class DocPrefs;
00061
00062
00063
class KOTodoListViewToolTip :
public QToolTip
00064 {
00065
public:
00066 KOTodoListViewToolTip( QWidget *parent, KOTodoListView *lv );
00067
00068
protected:
00069
void maybeTip(
const QPoint &pos );
00070
00071
private:
00072 KOTodoListView *todolist;
00073 };
00074
00075
00076
class KOTodoListView :
public KListView
00077 {
00078 Q_OBJECT
00079
public:
00080 KOTodoListView( QWidget *parent = 0,
const char *name = 0 );
00081 ~KOTodoListView();
00082
00083
void setCalendar( Calendar * );
00084
00085 signals:
00086
void todoDropped( Todo * );
00087
void todoChanged( Todo*, Todo* );
00088
void todoAdded( Todo* );
00089
00090
protected:
00091
virtual bool event( QEvent * );
00092
00093
void contentsDragEnterEvent( QDragEnterEvent * );
00094
void contentsDragMoveEvent( QDragMoveEvent * );
00095
void contentsDragLeaveEvent( QDragLeaveEvent * );
00096
void contentsDropEvent( QDropEvent * );
00097
00098
void contentsMousePressEvent( QMouseEvent * );
00099
void contentsMouseMoveEvent( QMouseEvent * );
00100
void contentsMouseReleaseEvent( QMouseEvent * );
00101
void contentsMouseDoubleClickEvent( QMouseEvent * );
00102
00103
private:
00104 Calendar *mCalendar;
00105
00106 QPoint mPressPos;
00107
bool mMousePressed;
00108 QListViewItem *mOldCurrent;
00109 KOTodoListViewToolTip *tooltip;
00110 };
00111
00112
00116 class KOQuickTodo :
public QLineEdit
00117 {
00118 Q_OBJECT
00119
public:
00120
KOQuickTodo( QWidget *parent = 0 );
00121
00122
protected:
00123
void focusInEvent( QFocusEvent *ev );
00124
void focusOutEvent( QFocusEvent *ev );
00125 };
00126
00127
00134 class KOTodoView :
public KOrg::BaseView
00135 {
00136 Q_OBJECT
00137
public:
00138
KOTodoView( Calendar *cal, QWidget *parent = 0,
const char *name = 0 );
00139 ~
KOTodoView();
00140
00141
void setCalendar( Calendar * );
00142
00143 Incidence::List
selectedIncidences();
00144 Todo::List selectedTodos();
00145
00146 DateList
selectedDates() {
return DateList(); }
00147
00149 int currentDateCount() {
return 0; }
00150
00151
void printPreview(
CalPrinter *calPrinter,
const QDate &fd,
00152
const QDate &td );
00153
00154 CalPrinter::PrintType printType();
00155
00156
void setDocumentId(
const QString & );
00157
00158
void saveLayout( KConfig *config,
const QString &group )
const;
00159
void restoreLayout( KConfig *config,
const QString &group );
00161 QPopupMenu *getCategoryPopupMenu(
KOTodoViewItem *todoItem );
00162
00163
public slots:
00164
void updateView();
00165
void updateConfig();
00166
00167
void changeEventDisplay( Event *,
int );
00168
00169
void showDates(
const QDate &start,
const QDate &end );
00170
void showEvents(
const Event::List & );
00171
00172
void clearSelection();
00173
00174
void editItem( QListViewItem *item,
const QPoint &,
int );
00175
void editItem( QListViewItem *item );
00176
void showItem( QListViewItem *item,
const QPoint &,
int );
00177
void popupMenu( QListViewItem *item,
const QPoint &,
int );
00178
void newTodo();
00179
void newSubTodo();
00180
void showTodo();
00181
void editTodo();
00182
void deleteTodo();
00183
00184
void setNewPriority(
int );
00185
void setNewPercentage(
int );
00186
void changedCategories(
int );
00187
00188
void purgeCompleted();
00189
00190
void itemClicked( QListViewItem * );
00191
void itemStateChanged( QListViewItem * );
00192
void modified(
bool );
00193
void setTodoModified( Todo *oldTodo, Todo *todo )
00194 {
00195 emit todoChanged( oldTodo, todo );
00196 }
00197
00198 signals:
00199
void newTodoSignal();
00200
void newSubTodoSignal( Todo * );
00201
void unSubTodoSignal();
00202
void showTodoSignal( Todo * );
00203
00204
void editTodoSignal( Todo * );
00205
void deleteTodoSignal( Todo * );
00206
void todoModifiedSignal( Todo *, Todo *,
int );
00207
void todoChanged ( Todo*, Todo* );
00208
void todoAdded ( Todo* );
00209
00210
void isModified(
bool );
00211
00212
void purgeCompletedSignal();
00213
00214
protected slots:
00215
void processSelectionChange();
00216
void addQuickTodo();
00217
00218
private:
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
friend class KOTodoViewItem;
00229
00230
void setTodoModified( Todo * );
00231 QMap<Todo *,KOTodoViewItem *>::ConstIterator insertTodoItem( Todo *todo );
00232
void restoreItemState( QListViewItem * );
00233
00234 KOTodoListView *mTodoListView;
00235 QPopupMenu *mItemPopupMenu;
00236 QPopupMenu *mPopupMenu;
00237 QPopupMenu *mPriorityPopupMenu;
00238 QPopupMenu *mPercentageCompletedPopupMenu;
00239 QPopupMenu *mCategoryPopupMenu;
00240
00241 QMap<int, int> mPercentage;
00242 QMap<int, int> mPriority;
00243 QMap<int, QString> mCategory;
00244
00245
KOTodoViewItem *mActiveItem;
00246
00247 QMap<Todo *,KOTodoViewItem *> mTodoMap;
00248
00249 DocPrefs *mDocPrefs;
00250 QString mCurrentDoc;
00251
KOQuickTodo *mQuickAdd;
00252
00253
static const int POPUP_UNSUBTODO;
00254 };
00255
00256
#endif