summaryrefslogtreecommitdiff
path: root/core/pim/todo/tableview.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/todo/tableview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/tableview.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp
index ded2dbd..0f683c9 100644
--- a/core/pim/todo/tableview.cpp
+++ b/core/pim/todo/tableview.cpp
@@ -32,12 +32,14 @@
#include <qtimer.h>
#include <qpoint.h>
#include <qpopupmenu.h>
#include <qpe/config.h>
+#include <opie/orecur.h>
+
#include "mainwindow.h"
//#include "tableitems.h"
#include "tableview.h"
using namespace Todo;
@@ -117,38 +119,39 @@ void TableView::newDay() {
updateView();
}
TableView::~TableView() {
}
void TableView::slotShowMenu() {
- QPopupMenu *menu = todoWindow()->contextMenu( current() );
+ QPopupMenu *menu = todoWindow()->contextMenu( current(), sorted()[currentRow()].recurrence().doesRecur() );
menu->exec(QCursor::pos() );
delete menu;
}
QString TableView::type() const {
return QString::fromLatin1( tr("Table View") );
}
int TableView::current() {
int uid = sorted().uidAt(currentRow() );
- qWarning("uid %d", uid );
+
return uid;
}
QString TableView::currentRepresentation() {
- return text( currentRow(), 2);
+ OTodo to = sorted()[currentRow()];
+ return to.summary().isEmpty() ? to.description().left(20) : to.summary() ;
}
/* show overdue */
void TableView::showOverDue( bool ) {
clear();
updateView();
}
void TableView::updateView( ) {
qWarning("update view");
m_row = false;
static int id;
- id = startTimer(2000 );
+ id = startTimer(4000 );
/* FIXME we want one page to be read!
*
* Calculate that screensize
*/
todoWindow()->setReadAhead( 4 );
sort();
@@ -239,16 +242,13 @@ void TableView::slotClicked(int row, int col, int,
int w = columnWidth( col );
int h = rowHeight( row );
if ( x >= ( w - BoxSize ) / 2 &&
x <= ( w - BoxSize ) / 2 + BoxSize &&
y >= ( h - BoxSize ) / 2 &&
y <= ( h - BoxSize ) / 2 + BoxSize ) {
- OTodo todo = sorted()[row];
- todo.setCompleted( !todo.isCompleted() );
- TodoView::update( todo.uid(), todo );
- updateView();
+ TodoView::complete(sorted()[row] );
}
}
break;
case 1:
break;
@@ -366,13 +366,13 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
}
break;
case 2:
// description field
{
QString text = task.summary().isEmpty() ?
- task.description() :
+ task.description().left(20) :
task.summary();
p->drawText(2,2 + fm.ascent(), text);
}
break;
case 3:
{
@@ -459,13 +459,13 @@ void TableView::slotPriority() {
* filled enough.
* We will try to read ahead 4 items in both ways
* up and down. On odd or even we will currentRow()+-4 or +-9
*
*/
void TableView::timerEvent( QTimerEvent* ev ) {
- qWarning("sorted %d", sorted().count() );
+// qWarning("sorted %d", sorted().count() );
if (sorted().count() == 0 )
return;
int row = currentRow();
if ( m_row ) {
int ro = row-4;
@@ -510,17 +510,14 @@ void TableView::contentsMouseReleaseEvent( QMouseEvent* e) {
int row = rowAt(m_prevP.y());
int colOld = columnAt(m_prevP.x() );
int colNew = columnAt(e->x() );
qWarning("colNew: %d colOld: %d", colNew, colOld );
if ( row == rowAt( e->y() ) && row != -1 &&
colOld != colNew ) {
- OTodo todo = sorted()[row];
- todo.setCompleted( !todo.isCompleted() );
- TodoView::update( todo.uid(), todo );
- updateView();
- return;
+ TodoView::complete( sorted()[row] );
+ return;
}
QTable::contentsMouseReleaseEvent( e );
}
void TableView::contentsMouseMoveEvent( QMouseEvent* e ) {
m_menuTimer->stop();
QTable::contentsMouseMoveEvent( e );