summaryrefslogtreecommitdiff
path: root/core/pim/todo/tableview.cpp
authorzecke <zecke>2002-11-30 11:20:47 (UTC)
committer zecke <zecke>2002-11-30 11:20:47 (UTC)
commitfdda15344fdf7f71fd9e1e4db15ecc5e12224ddb (patch) (side-by-side diff)
tree32e68b5b483dd3ce8041542e7d95f0b6d8dbf644 /core/pim/todo/tableview.cpp
parentbd692f7ebe04e23151cce39baf311b925ccf91b1 (diff)
downloadopie-fdda15344fdf7f71fd9e1e4db15ecc5e12224ddb.zip
opie-fdda15344fdf7f71fd9e1e4db15ecc5e12224ddb.tar.gz
opie-fdda15344fdf7f71fd9e1e4db15ecc5e12224ddb.tar.bz2
Back from hospital with new power
This versions clean up m failure on templates with Qt... in todoview Implements Recurrance( backends to not safe it yet ) OPimState and Maintainer mode in some ways and much more This one also implements the OPimMainWindow specs and has a small Memu replacement to get the toolbar in one line
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
@@ -26,24 +26,26 @@
*/
#include <stdlib.h>
#include <cmath>
#include <qlineedit.h>
#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;
namespace {
static const int BoxSize = 14;
static const int RowHeight = 20;
}
@@ -111,50 +113,51 @@ TableView::TableView( MainWindow* window, QWidget* wid )
}
/* a new day has started
* update the day
*/
void TableView::newDay() {
clear();
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();
OTodoAccess::List::Iterator it, end;
it = sorted().begin();
end = sorted().end();
qWarning("setTodos");
QTime time;
@@ -233,28 +236,25 @@ void TableView::slotClicked(int row, int col, int,
switch( col ) {
case 0:{
int x = point.x() -columnPos( col );
int y = point.y() -rowPos( row );
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;
case 2: {
m_menuTimer->stop();
showTodo( ui );
break;
}
@@ -360,25 +360,25 @@ void TableView::paintCell(QPainter* p, int row, int col, const QRect& cr, bool
break;
case 1:
// priority field
{
QString text = QString::number(task.priority());
p->drawText(2,2 + fm.ascent(), text);
}
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:
{
QString text;
if (task.hasDueDate()) {
int off = QDate::currentDate().daysTo( task.dueDate() );
text = QString::number(off) + tr(" day(s)");
/*
* set color if not completed
@@ -453,25 +453,25 @@ void TableView::setCellContentFromEditor(int row, int col ) {
}
void TableView::slotPriority() {
setCellContentFromEditor( currentRow(), currentColumn() );
}
/*
* We'll use the TimerEvent to read ahead or to keep the cahce always
* 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;
if (ro < 0 ) ro = 0;
sorted()[ro];
ro = row+4;
sorted()[ro];
} else {
@@ -504,24 +504,21 @@ void TableView::timerEvent( QTimerEvent* ev ) {
* in the x coordinate and this way it's able to pass the
* m_completeStrokeWidth criteria
* WORKAROUND: strike through needs to strike through the same
* row and two columns!
*/
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 );
}