00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
#ifndef _KPILOT_TODOWIDGET_H
00032
#define _KPILOT_TODOWIDGET_H
00033
00034
class TodoListView;
00035
class QComboBox;
00036
class QPushButton;
00037
class QTextView;
00038
00039
class PilotDatabase;
00040
00041
#include "pi-todo.h"
00042
00043
#include "pilotComponent.h"
00044
#include "pilotTodoEntry.h"
00045
#include "listItems.h"
00046
00047
class TodoListView :
public KListView
00048 {
00049 Q_OBJECT
00050
public:
00051 TodoListView(QWidget * parent = 0,
const char * name = 0 ):KListView(parent, name){};
00052 ~TodoListView() {};
00053 signals:
00054
void itemChecked(QCheckListItem*item);
00055
void itemChecked(QCheckListItem*item,
bool on);
00056
00057
public:
00058
void itemWasChecked(QCheckListItem*item,
bool on) {
00059 emit itemChecked(item);
00060 emit itemChecked(item, on);
00061 }
00062 };
00063
00064
class TodoCheckListItem :
public PilotCheckListItem
00065 {
00066
public:
00067 TodoCheckListItem(QListView*parent,
const QString&text, recordid_t pilotid,
void*r);
00068 ~TodoCheckListItem() {};
00069
virtual void stateChange(
bool state);
00070 };
00071
00072
class TodoWidget :
public PilotComponent
00073 {
00074 Q_OBJECT
00075
00076
public:
00077 TodoWidget(QWidget* parent,
const QString& dbpath);
00078 ~TodoWidget();
00079
00080
00081
virtual bool preHotSync(QString &);
00082
virtual void postHotSync();
00083
virtual void showComponent();
00084
virtual void hideComponent();
00085
00086
public slots:
00091
void slotShowTodo(QListViewItem*);
00092
void slotEditRecord(QListViewItem*item);
00093
void slotEditRecord();
00094
void slotCreateNewRecord();
00095
void slotDeleteRecord();
00096
void slotEditCancelled();
00097
00098
void slotUpdateButtons();
00099
00100 signals:
00101
void recordChanged(PilotTodoEntry *);
00102
00103
protected slots:
00108
void slotUpdateRecord(PilotTodoEntry*);
00109
00113
void slotAddRecord(PilotTodoEntry*);
00114
00119
void slotSetCategory(
int);
00120
00121
00122
void slotItemChecked(QCheckListItem*item,
bool on);
00123
void slotItemRenamed(QListViewItem*item,
const QString &txt,
int nr);
00124
private:
00125
void setupWidget();
00126
void updateWidget();
00127
void writeTodo(PilotTodoEntry* which,
PilotDatabase *db=0L);
00128
00135
int getAllTodos(
PilotDatabase *todoDB);
00136
00141 QString createTitle(PilotTodoEntry *,
int displayMode);
00142
00157 QComboBox *fCatList;
00158 QTextView *fTodoInfo;
00159
struct ToDoAppInfo fTodoAppInfo;
00160 QPtrList<PilotTodoEntry> fTodoList;
00161 TodoListView *fListBox;
00162 QPushButton *fEditButton,*fDeleteButton;
00163
PilotDatabase *fTodoDB;
00164
protected:
00169
int fPendingTodos;
00170
00171 };
00172
00173
#else
00174
#ifdef DEBUG
00175
#warning "File doubly included"
00176
#endif
00177
#endif