summaryrefslogtreecommitdiff
path: root/core/pim/todo/mainwindow.cpp
Unidiff
Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index f3afa5f..33f13aa 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -1,8 +1,10 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3 Copyright (C) 2002 zecke
4 Copyright (C) 2002 Stefan Eilers
3** 5**
4** This file is part of Qtopia Environment. 6** This file is part of Qtopia Environment.
5** 7**
6** This file may be distributed and/or modified under the terms of the 8** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 9** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 10** Foundation and appearing in the file LICENSE.GPL included in the
@@ -104,12 +106,17 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
104// qDebug("after load: t=%d", t.elapsed() ); 106// qDebug("after load: t=%d", t.elapsed() );
105 107
106 Config config( "todo" ); 108 Config config( "todo" );
107 config.setGroup( "View" ); 109 config.setGroup( "View" );
108 bool complete = config.readBoolEntry( "ShowComplete", true ); 110 bool complete = config.readBoolEntry( "ShowComplete", true );
109 table->setShowCompleted( complete ); 111 table->setShowCompleted( complete );
112
113 /* added 20.01.2k2 by se */
114 bool showdeadline = config.readBoolEntry("ShowDeadLine", true);
115 table->setShowDeadline (showdeadline);
116
110 QString category = config.readEntry( "Category", QString::null ); 117 QString category = config.readEntry( "Category", QString::null );
111 table->setShowCategory( category ); 118 table->setShowCategory( category );
112 119
113 QPEToolBar *bar = new QPEToolBar( this ); 120 QPEToolBar *bar = new QPEToolBar( this );
114 bar->setHorizontalStretchable( TRUE ); 121 bar->setHorizontalStretchable( TRUE );
115 122
@@ -171,12 +178,15 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
171 //a->setEnabled( FALSE ); 178 //a->setEnabled( FALSE );
172 findAction = a; 179 findAction = a;
173// qDebug("mainwindow #2: t=%d", t.elapsed() ); 180// qDebug("mainwindow #2: t=%d", t.elapsed() );
174 181
175 completedAction = new QAction( QString::null, tr("Completed tasks"), 0, this, 0, TRUE ); 182 completedAction = new QAction( QString::null, tr("Completed tasks"), 0, this, 0, TRUE );
176 183
184 /* added 20.01.2k2 by se */
185 showdeadlineAction = new QAction( QString::null, tr( "Show Deadline" ), 0, this, 0, TRUE );
186
177 catMenu->setCheckable( true ); 187 catMenu->setCheckable( true );
178 populateCategories(); 188 populateCategories();
179 189
180 mb->insertItem( tr( "Task" ), edit ); 190 mb->insertItem( tr( "Task" ), edit );
181 mb->insertItem( tr( "View" ), catMenu ); 191 mb->insertItem( tr( "View" ), catMenu );
182 192
@@ -192,12 +202,13 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
192 table->updateVisible(); 202 table->updateVisible();
193 table->setUpdatesEnabled( TRUE ); 203 table->setUpdatesEnabled( TRUE );
194 table->setPaintingEnabled( TRUE ); 204 table->setPaintingEnabled( TRUE );
195 table->viewport()->setUpdatesEnabled( TRUE ); 205 table->viewport()->setUpdatesEnabled( TRUE );
196 206
197 connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) ); 207 connect( completedAction, SIGNAL( toggled(bool) ), this, SLOT( showCompleted(bool) ) );
208 connect( showdeadlineAction, SIGNAL( toggled(bool) ), this, SLOT( showDeadline(bool) ) );
198 connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) ); 209 connect( catMenu, SIGNAL(activated(int)), this, SLOT(setCategory(int)) );
199 connect( table, SIGNAL( currentChanged( int, int ) ), 210 connect( table, SIGNAL( currentChanged( int, int ) ),
200 this, SLOT( currentEntryChanged( int, int ) ) ); 211 this, SLOT( currentEntryChanged( int, int ) ) );
201 212
202// qDebug("done: t=%d", t.elapsed() ); 213// qDebug("done: t=%d", t.elapsed() );
203} 214}
@@ -348,12 +359,14 @@ void TodoWindow::setCategory( int c )
348void TodoWindow::populateCategories() 359void TodoWindow::populateCategories()
349{ 360{
350 catMenu->clear(); 361 catMenu->clear();
351 362
352 completedAction->addTo( catMenu ); 363 completedAction->addTo( catMenu );
353 completedAction->setOn( table->showCompleted() ); 364 completedAction->setOn( table->showCompleted() );
365 showdeadlineAction->addTo( catMenu );
366 showdeadlineAction->setOn( table->showDeadline() );
354 367
355 int id, rememberId; 368 int id, rememberId;
356 id = 1; 369 id = 1;
357 catMenu->insertItem( tr( "All Categories" ), id++ ); 370 catMenu->insertItem( tr( "All Categories" ), id++ );
358// catMenu->insertSeparator(); 371// catMenu->insertSeparator();
359 QStringList categories = table->categories(); 372 QStringList categories = table->categories();
@@ -399,12 +412,14 @@ void TodoWindow::closeEvent( QCloseEvent *e )
399 // error, but I feel that it is "ok" for us to exit 412 // error, but I feel that it is "ok" for us to exit
400 // espically since we aren't told if the write succeeded... 413 // espically since we aren't told if the write succeeded...
401 Config config( "todo" ); 414 Config config( "todo" );
402 config.setGroup( "View" ); 415 config.setGroup( "View" );
403 config.writeEntry( "ShowComplete", table->showCompleted() ); 416 config.writeEntry( "ShowComplete", table->showCompleted() );
404 config.writeEntry( "Category", table->showCategory() ); 417 config.writeEntry( "Category", table->showCategory() );
418 /* added 20.01.2k2 by se */
419 config.writeEntry( "ShowDeadLine", table->showDeadline());
405 } else { 420 } else {
406 if ( QMessageBox::critical( this, tr("Out of space"), 421 if ( QMessageBox::critical( this, tr("Out of space"),
407 tr("Todo was unable\n" 422 tr("Todo was unable\n"
408 "to save your changes.\n" 423 "to save your changes.\n"
409 "Free up some space\n" 424 "Free up some space\n"
410 "and try again.\n" 425 "and try again.\n"
@@ -470,6 +485,14 @@ void TodoWindow::slotBeam()
470 485
471void TodoWindow::beamDone( Ir *ir ) 486void TodoWindow::beamDone( Ir *ir )
472{ 487{
473 delete ir; 488 delete ir;
474 unlink( beamfile ); 489 unlink( beamfile );
475} 490}
491
492/* added 20.01.2k2 by se */
493void TodoWindow::showDeadline( bool s )
494{
495 table->setPaintingEnabled( false );
496 table->setShowDeadline( s );
497 table->setPaintingEnabled( true );
498}