summaryrefslogtreecommitdiff
path: root/core/pim/todo/tableview.h
Unidiff
Diffstat (limited to 'core/pim/todo/tableview.h') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/tableview.h44
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
@@ -46,13 +46,12 @@ namespace Todo {
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& );
@@ -63,19 +62,21 @@ namespace Todo {
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
81private slots: 82private slots:
@@ -87,33 +88,6 @@ private slots:
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