-rw-r--r-- | core/pim/todo/tableview.h | 44 |
1 files changed, 9 insertions, 35 deletions
diff --git a/core/pim/todo/tableview.h b/core/pim/todo/tableview.h index 1fa21b2..b608204 100644 --- a/core/pim/todo/tableview.h +++ b/core/pim/todo/tableview.h | |||
@@ -37,83 +37,57 @@ | |||
37 | 37 | ||
38 | class QTimer; | 38 | class QTimer; |
39 | 39 | ||
40 | namespace Todo { | 40 | namespace Todo { |
41 | class CheckItem; | 41 | class CheckItem; |
42 | class DueTextItem; | 42 | class DueTextItem; |
43 | class TableView : public QTable, public TodoView { | 43 | class TableView : public QTable, public TodoView { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | TableView( MainWindow*, QWidget* parent ); | 46 | TableView( MainWindow*, QWidget* parent ); |
47 | ~TableView(); | 47 | ~TableView(); |
48 | 48 | ||
49 | void updateFromTable( const OTodo&, CheckItem* = 0 ); | ||
50 | OTodo find(int uid); | ||
51 | 49 | ||
52 | QString type()const; | 50 | QString type()const; |
53 | int current(); | 51 | int current(); |
54 | QString currentRepresentation(); | 52 | QString currentRepresentation(); |
55 | 53 | ||
54 | void clear(); | ||
56 | void showOverDue( bool ); | 55 | void showOverDue( bool ); |
57 | void updateView(); | 56 | void updateView(); |
58 | void setTodo( int uid, const OTodo& ); | 57 | void setTodo( int uid, const OTodo& ); |
59 | void addEvent( const OTodo& event ); | 58 | void addEvent( const OTodo& event ); |
60 | void replaceEvent( const OTodo& ); | 59 | void replaceEvent( const OTodo& ); |
61 | void removeEvent( int uid ); | 60 | void removeEvent( int uid ); |
62 | void setShowCompleted( bool ); | 61 | void setShowCompleted( bool ); |
63 | void setShowDeadline( bool ); | 62 | void setShowDeadline( bool ); |
64 | 63 | ||
65 | void setShowCategory(const QString& =QString::null ); | 64 | void setShowCategory(const QString& =QString::null ); |
66 | void clear(); | ||
67 | void newDay(); | 65 | void newDay(); |
68 | QArray<int> completed(); | ||
69 | QWidget* widget(); | 66 | QWidget* widget(); |
70 | void sortColumn(int, bool, bool ); | 67 | void sortColumn(int, bool, bool ); |
68 | |||
69 | /* | ||
70 | * we do our drawing ourselves | ||
71 | * because we don't want to have | ||
72 | * 40.000 QTableItems for 10.000 | ||
73 | * OTodos where we only show 10 at a time! | ||
74 | */ | ||
75 | void paintCell(QPainter* p, int row, int col, const QRect&, bool ); | ||
71 | private: | 76 | private: |
72 | /* reimplented for internal reasons */ | 77 | /* reimplented for internal reasons */ |
73 | void viewportPaintEvent( QPaintEvent* ); | 78 | void viewportPaintEvent( QPaintEvent* ); |
74 | inline void insertTodo( const OTodo&, int row ); | ||
75 | CheckItem* checkItem( int row ); | ||
76 | DueTextItem* dueItem( int row ); | ||
77 | QTimer *m_menuTimer; | 79 | QTimer *m_menuTimer; |
78 | QMap<int, CheckItem*> m_cache; | ||
79 | bool m_enablePaint:1; | 80 | bool m_enablePaint:1; |
80 | 81 | ||
81 | private slots: | 82 | private slots: |
82 | void slotShowMenu(); | 83 | void slotShowMenu(); |
83 | void slotClicked(int, int, int, | 84 | void slotClicked(int, int, int, |
84 | const QPoint& ); | 85 | const QPoint& ); |
85 | void slotPressed(int, int, int, | 86 | void slotPressed(int, int, int, |
86 | const QPoint& ); | 87 | const QPoint& ); |
87 | void slotValueChanged(int, int); | 88 | void slotValueChanged(int, int); |
88 | void slotCurrentChanged(int, int ); | 89 | void slotCurrentChanged(int, int ); |
89 | }; | 90 | }; |
90 | inline void TableView::insertTodo( const OTodo& event, int row ) { | ||
91 | |||
92 | |||
93 | QString sortKey = (char) ( (event.isCompleted() ? 'a' : 'A' ) | ||
94 | + event.priority() ) | ||
95 | + Qtopia::buildSortKey( event.description() ); | ||
96 | CheckItem *chk = new CheckItem( this, sortKey, event.uid(), event.categories() ); | ||
97 | chk->setChecked( event.isCompleted() ); | ||
98 | |||
99 | ComboItem *cmb = new ComboItem(this, QTableItem::WhenCurrent ); | ||
100 | cmb->setText( QString::number( event.priority() ) ); | ||
101 | |||
102 | QString sum = event.summary(); | ||
103 | QTableItem* ti = new TodoTextItem( this, sum.isEmpty() ? | ||
104 | event.description().left(40).simplifyWhiteSpace() : | ||
105 | sum ); | ||
106 | ti->setReplaceable( FALSE ); | ||
107 | |||
108 | DueTextItem *due = new DueTextItem(this, event ); | ||
109 | |||
110 | setItem( row, 0, chk ); | ||
111 | setItem( row, 1, cmb ); | ||
112 | setItem( row, 2, ti ); | ||
113 | setItem( row, 3, due ); | ||
114 | |||
115 | m_cache.insert( event.uid(), chk ); | ||
116 | } | ||
117 | }; | 91 | }; |
118 | 92 | ||
119 | #endif | 93 | #endif |