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.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 2002e87..9424c23 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -293,13 +293,12 @@ QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
293 ; // FIXME 293 ; // FIXME
294 } 294 }
295 295
296 return menu; 296 return menu;
297} 297}
298QPopupMenu* MainWindow::options() { 298QPopupMenu* MainWindow::options() {
299 owarn << "Options" << oendl;
300 return m_options; 299 return m_options;
301} 300}
302QPopupMenu* MainWindow::edit() { 301QPopupMenu* MainWindow::edit() {
303 return m_edit; 302 return m_edit;
304} 303}
305QToolBar* MainWindow::toolbar() { 304QToolBar* MainWindow::toolbar() {
@@ -312,20 +311,18 @@ OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
312 int cat = 0; 311 int cat = 0;
313 if ( m_curCat != QWidget::tr("All Categories") ) 312 if ( m_curCat != QWidget::tr("All Categories") )
314 cat = currentCatId(); 313 cat = currentCatId();
315 if ( m_curCat == QWidget::tr("Unfiled") ) 314 if ( m_curCat == QWidget::tr("Unfiled") )
316 cat = -1; 315 cat = -1;
317 316
318 owarn << " Category " << cat << " " << m_curCat << oendl; 317 int filter = OPimTodoAccess::FilterCategory;
319
320 int filter = 1;
321 318
322 if (!m_completed ) 319 if (!m_completed )
323 filter |= 4; 320 filter |= OPimTodoAccess::DoNotShowCompleted;
324 if (m_overdue) 321 if (m_overdue)
325 filter |= 2; 322 filter |= OPimTodoAccess::OnlyOverDue;
326 323
327 return m_todoMgr.sorted( asc, sortOrder, filter, cat ); 324 return m_todoMgr.sorted( asc, sortOrder, filter, cat );
328} 325}
329OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) { 326OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
330 int cat = 0; 327 int cat = 0;
331 if ( m_curCat != QWidget::tr("All Categories") ) 328 if ( m_curCat != QWidget::tr("All Categories") )
@@ -371,13 +368,12 @@ void MainWindow::closeEvent( QCloseEvent* e ) {
371 if (m_syncing ) { 368 if (m_syncing ) {
372 e->accept(); 369 e->accept();
373 return; 370 return;
374 } 371 }
375 bool quit = false; 372 bool quit = false;
376 if ( m_todoMgr.saveAll() ){ 373 if ( m_todoMgr.saveAll() ){
377 owarn << "saved" << oendl;
378 quit = true; 374 quit = true;
379 }else { 375 }else {
380 if ( QMessageBox::critical( this, QWidget::tr("Out of space"), 376 if ( QMessageBox::critical( this, QWidget::tr("Out of space"),
381 QWidget::tr("Todo was unable\n" 377 QWidget::tr("Todo was unable\n"
382 "to save your changes.\n" 378 "to save your changes.\n"
383 "Free up some space\n" 379 "Free up some space\n"
@@ -534,13 +530,12 @@ void MainWindow::slotEdit() {
534 * set the category 530 * set the category
535 */ 531 */
536void MainWindow::setCategory( int c) { 532void MainWindow::setCategory( int c) {
537 if ( c <= 0 ) return; 533 if ( c <= 0 ) return;
538 534
539 535
540 owarn << "Iterating over cats " << c << oendl;
541 for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) 536 for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
542 m_catMenu->setItemChecked(i, c == (int)i ); 537 m_catMenu->setItemChecked(i, c == (int)i );
543 538
544 if (c == 1 ) { 539 if (c == 1 ) {
545 m_curCat = QString::null; 540 m_curCat = QString::null;
546 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); 541 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) );
@@ -680,13 +675,12 @@ void MainWindow::slotShowDue(bool ov) {
680 raiseCurrentView(); 675 raiseCurrentView();
681} 676}
682void MainWindow::slotShow( int uid ) { 677void MainWindow::slotShow( int uid ) {
683 if ( uid == 0 ) return; 678 if ( uid == 0 ) return;
684 679
685 680
686 owarn << "slotShow" << oendl;
687 currentShow()->slotShow( event( uid ) ); 681 currentShow()->slotShow( event( uid ) );
688 m_stack->raiseWidget( currentShow()->widget() ); 682 m_stack->raiseWidget( currentShow()->widget() );
689} 683}
690void MainWindow::slotShowNext() { 684void MainWindow::slotShowNext() {
691 int l = currentView()->next(); 685 int l = currentView()->next();
692 if (l!=0) 686 if (l!=0)
@@ -739,13 +733,12 @@ void MainWindow::updateList() {
739} 733}
740void MainWindow::setReadAhead( uint count ) { 734void MainWindow::setReadAhead( uint count ) {
741 if (m_todoMgr.todoDB() ) 735 if (m_todoMgr.todoDB() )
742 m_todoMgr.todoDB()->setReadAhead( count ); 736 m_todoMgr.todoDB()->setReadAhead( count );
743} 737}
744void MainWindow::slotQuickEntered() { 738void MainWindow::slotQuickEntered() {
745 owarn << "entered" << oendl;
746 OPimTodo todo = quickEditor()->todo(); 739 OPimTodo todo = quickEditor()->todo();
747 if (todo.isEmpty() ) 740 if (todo.isEmpty() )
748 return; 741 return;
749 742
750 m_todoMgr.add( todo ); 743 m_todoMgr.add( todo );
751 currentView()->addEvent( todo ); 744 currentView()->addEvent( todo );
@@ -786,13 +779,12 @@ void MainWindow::slotComplete( const OPimTodo& todo ) {
786 * if there is a next occurence 779 * if there is a next occurence
787 * from the duedate of the last recurrance 780 * from the duedate of the last recurrance
788 */ 781 */
789 QDate date; 782 QDate date;
790 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { 783 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) {
791 int dayDiff = to.dueDate().daysTo( date ); 784 int dayDiff = to.dueDate().daysTo( date );
792 owarn << "day diff is " << dayDiff << oendl;
793 QDate inval; 785 QDate inval;
794 /* generate a new uid for the old record */ 786 /* generate a new uid for the old record */
795 to.setUid( 1 ); 787 to.setUid( 1 );
796 788
797 /* add the old one cause it has a new UID here cause it was spin off */ 789 /* add the old one cause it has a new UID here cause it was spin off */
798 m_todoMgr.add( to ); 790 m_todoMgr.add( to );
@@ -950,21 +942,19 @@ namespace {
950 } 942 }
951 return nonMatching; 943 return nonMatching;
952 } 944 }
953 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 945 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
954 OPimNotifyManager::Alarms::ConstIterator it; 946 OPimNotifyManager::Alarms::ConstIterator it;
955 for ( it = als.begin(); it != als.end(); ++it ) { 947 for ( it = als.begin(); it != als.end(); ++it ) {
956 owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl;
957 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 948 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
958 } 949 }
959 950
960 } 951 }
961 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 952 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
962 OPimNotifyManager::Alarms::ConstIterator it; 953 OPimNotifyManager::Alarms::ConstIterator it;
963 for ( it = als.begin(); it != als.end(); ++it ) { 954 for ( it = als.begin(); it != als.end(); ++it ) {
964 owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl;
965 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 955 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
966 } 956 }
967 } 957 }
968} 958}
969 959
970void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { 960void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) {