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.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index d552928..924fde1 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -56,16 +56,16 @@
56#include "tableview.h" 56#include "tableview.h"
57 57
58#include "textviewshow.h" 58#include "textviewshow.h"
59#include "todoeditor.h" 59#include "todoeditor.h"
60#include "mainwindow.h" 60#include "mainwindow.h"
61 61
62using namespace Opie::Core; 62using Opie::Core::OApplicationFactory;
63OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) 63OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> )
64 64
65 using namespace Opie; 65using namespace Opie;
66using namespace Todo; 66using namespace Todo;
67 67
68MainWindow::MainWindow( QWidget* parent, 68MainWindow::MainWindow( QWidget* parent,
69 const char* name, WFlags ) 69 const char* name, WFlags )
70 : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) 70 : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
71{ 71{
@@ -293,13 +293,13 @@ 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 Opie::Core::owarn << "Options" << oendl; 299 owarn << "Options" << oendl;
300 return m_options; 300 return m_options;
301} 301}
302QPopupMenu* MainWindow::edit() { 302QPopupMenu* MainWindow::edit() {
303 return m_edit; 303 return m_edit;
304} 304}
305QToolBar* MainWindow::toolbar() { 305QToolBar* MainWindow::toolbar() {
@@ -312,13 +312,13 @@ OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
312 int cat = 0; 312 int cat = 0;
313 if ( m_curCat != QWidget::tr("All Categories") ) 313 if ( m_curCat != QWidget::tr("All Categories") )
314 cat = currentCatId(); 314 cat = currentCatId();
315 if ( m_curCat == QWidget::tr("Unfiled") ) 315 if ( m_curCat == QWidget::tr("Unfiled") )
316 cat = -1; 316 cat = -1;
317 317
318 Opie::Core::owarn << " Category " << cat << " " << m_curCat << oendl; 318 owarn << " Category " << cat << " " << m_curCat << oendl;
319 319
320 int filter = 1; 320 int filter = 1;
321 321
322 if (!m_completed ) 322 if (!m_completed )
323 filter |= 4; 323 filter |= 4;
324 if (m_overdue) 324 if (m_overdue)
@@ -371,13 +371,13 @@ void MainWindow::closeEvent( QCloseEvent* e ) {
371 if (m_syncing ) { 371 if (m_syncing ) {
372 e->accept(); 372 e->accept();
373 return; 373 return;
374 } 374 }
375 bool quit = false; 375 bool quit = false;
376 if ( m_todoMgr.saveAll() ){ 376 if ( m_todoMgr.saveAll() ){
377 Opie::Core::owarn << "saved" << oendl; 377 owarn << "saved" << oendl;
378 quit = true; 378 quit = true;
379 }else { 379 }else {
380 if ( QMessageBox::critical( this, QWidget::tr("Out of space"), 380 if ( QMessageBox::critical( this, QWidget::tr("Out of space"),
381 QWidget::tr("Todo was unable\n" 381 QWidget::tr("Todo was unable\n"
382 "to save your changes.\n" 382 "to save your changes.\n"
383 "Free up some space\n" 383 "Free up some space\n"
@@ -534,13 +534,13 @@ void MainWindow::slotEdit() {
534 * set the category 534 * set the category
535 */ 535 */
536void MainWindow::setCategory( int c) { 536void MainWindow::setCategory( int c) {
537 if ( c <= 0 ) return; 537 if ( c <= 0 ) return;
538 538
539 539
540 Opie::Core::owarn << "Iterating over cats " << c << oendl; 540 owarn << "Iterating over cats " << c << oendl;
541 for ( unsigned int i = 1; i < m_catMenu->count(); i++ ) 541 for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
542 m_catMenu->setItemChecked(i, c == (int)i ); 542 m_catMenu->setItemChecked(i, c == (int)i );
543 543
544 if (c == 1 ) { 544 if (c == 1 ) {
545 m_curCat = QString::null; 545 m_curCat = QString::null;
546 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) ); 546 setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) );
@@ -597,23 +597,23 @@ void MainWindow::receiveFile( const QString& filename ) {
597 OPimTodoAccess acc( cal ); 597 OPimTodoAccess acc( cal );
598 acc.load(); 598 acc.load();
599 OPimTodoAccess::List list = acc.allRecords(); 599 OPimTodoAccess::List list = acc.allRecords();
600 600
601 if (list.count()){ 601 if (list.count()){
602 602
603 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() ); 603 QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
604 604
605 if ( QMessageBox::information(this, QWidget::tr("New Tasks"), 605 if ( QMessageBox::information(this, QWidget::tr("New Tasks"),
606 message, QMessageBox::Ok, 606 message, QMessageBox::Ok,
607 QMessageBox::Cancel ) == QMessageBox::Ok ) { 607 QMessageBox::Cancel ) == QMessageBox::Ok ) {
608 OPimTodoAccess::List::Iterator it; 608 OPimTodoAccess::List::Iterator it;
609 for ( it = list.begin(); it != list.end(); ++it ) 609 for ( it = list.begin(); it != list.end(); ++it )
610 m_todoMgr.add( (*it) ); 610 m_todoMgr.add( (*it) );
611 611
612 currentView()->updateView(); 612 currentView()->updateView();
613 } 613 }
614 } 614 }
615} 615}
616 616
617void MainWindow::slotFlush() { 617void MainWindow::slotFlush() {
618 m_syncing = TRUE; 618 m_syncing = TRUE;
619 m_todoMgr.save(); 619 m_todoMgr.save();
@@ -678,13 +678,15 @@ void MainWindow::slotShowDue(bool ov) {
678 m_overdue = ov; 678 m_overdue = ov;
679 currentView()->showOverDue( ov ); 679 currentView()->showOverDue( ov );
680 raiseCurrentView(); 680 raiseCurrentView();
681} 681}
682void MainWindow::slotShow( int uid ) { 682void MainWindow::slotShow( int uid ) {
683 if ( uid == 0 ) return; 683 if ( uid == 0 ) return;
684 Opie::Core::owarn << "slotShow" << oendl; 684
685
686 owarn << "slotShow" << oendl;
685 currentShow()->slotShow( event( uid ) ); 687 currentShow()->slotShow( event( uid ) );
686 m_stack->raiseWidget( currentShow()->widget() ); 688 m_stack->raiseWidget( currentShow()->widget() );
687} 689}
688void MainWindow::slotShowNext() { 690void MainWindow::slotShowNext() {
689 int l = currentView()->next(); 691 int l = currentView()->next();
690 if (l!=0) 692 if (l!=0)
@@ -737,13 +739,13 @@ void MainWindow::updateList() {
737} 739}
738void MainWindow::setReadAhead( uint count ) { 740void MainWindow::setReadAhead( uint count ) {
739 if (m_todoMgr.todoDB() ) 741 if (m_todoMgr.todoDB() )
740 m_todoMgr.todoDB()->setReadAhead( count ); 742 m_todoMgr.todoDB()->setReadAhead( count );
741} 743}
742void MainWindow::slotQuickEntered() { 744void MainWindow::slotQuickEntered() {
743 Opie::Core::owarn << "entered" << oendl; 745 owarn << "entered" << oendl;
744 OPimTodo todo = quickEditor()->todo(); 746 OPimTodo todo = quickEditor()->todo();
745 if (todo.isEmpty() ) 747 if (todo.isEmpty() )
746 return; 748 return;
747 749
748 m_todoMgr.add( todo ); 750 m_todoMgr.add( todo );
749 currentView()->addEvent( todo ); 751 currentView()->addEvent( todo );
@@ -784,13 +786,13 @@ void MainWindow::slotComplete( const OPimTodo& todo ) {
784 * if there is a next occurence 786 * if there is a next occurence
785 * from the duedate of the last recurrance 787 * from the duedate of the last recurrance
786 */ 788 */
787 QDate date; 789 QDate date;
788 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) { 790 if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) {
789 int dayDiff = to.dueDate().daysTo( date ); 791 int dayDiff = to.dueDate().daysTo( date );
790 Opie::Core::owarn << "day diff is " << dayDiff << oendl; 792 owarn << "day diff is " << dayDiff << oendl;
791 QDate inval; 793 QDate inval;
792 /* generate a new uid for the old record */ 794 /* generate a new uid for the old record */
793 to.setUid( 1 ); 795 to.setUid( 1 );
794 796
795 /* add the old one cause it has a new UID here cause it was spin off */ 797 /* add the old one cause it has a new UID here cause it was spin off */
796 m_todoMgr.add( to ); 798 m_todoMgr.add( to );
@@ -947,21 +949,21 @@ namespace {
947 } 949 }
948 return nonMatching; 950 return nonMatching;
949 } 951 }
950 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 952 void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
951 OPimNotifyManager::Alarms::ConstIterator it; 953 OPimNotifyManager::Alarms::ConstIterator it;
952 for ( it = als.begin(); it != als.end(); ++it ) { 954 for ( it = als.begin(); it != als.end(); ++it ) {
953 Opie::Core::owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl; 955 owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl;
954 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 956 AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
955 } 957 }
956 958
957 } 959 }
958 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { 960 void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
959 OPimNotifyManager::Alarms::ConstIterator it; 961 OPimNotifyManager::Alarms::ConstIterator it;
960 for ( it = als.begin(); it != als.end(); ++it ) { 962 for ( it = als.begin(); it != als.end(); ++it ) {
961 Opie::Core::owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl; 963 owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl;
962 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); 964 AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
963 } 965 }
964 } 966 }
965} 967}
966 968
967void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) { 969void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) {