-rw-r--r-- | core/pim/todo/mainwindow.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index 924fde1..2002e87 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp | |||
@@ -865,97 +865,98 @@ int MainWindow::create() { | |||
865 | 865 | ||
866 | // I'm afraid we must call this every time now, otherwise | 866 | // I'm afraid we must call this every time now, otherwise |
867 | // spend expensive time comparing all these strings... | 867 | // spend expensive time comparing all these strings... |
868 | // but only call if we changed something -zecke | 868 | // but only call if we changed something -zecke |
869 | populateCategories(); | 869 | populateCategories(); |
870 | } | 870 | } |
871 | raiseCurrentView( ); | 871 | raiseCurrentView( ); |
872 | 872 | ||
873 | return uid; | 873 | return uid; |
874 | } | 874 | } |
875 | /* delete it silently... */ | 875 | /* delete it silently... */ |
876 | bool MainWindow::remove( int uid ) { | 876 | bool MainWindow::remove( int uid ) { |
877 | if (m_syncing) return false; | 877 | if (m_syncing) return false; |
878 | 878 | ||
879 | /* argh need to get the whole OEvent... to disable alarms -zecke */ | 879 | /* argh need to get the whole OEvent... to disable alarms -zecke */ |
880 | handleAlarms( OPimTodo(), m_todoMgr.event( uid ) ); | 880 | handleAlarms( OPimTodo(), m_todoMgr.event( uid ) ); |
881 | 881 | ||
882 | return m_todoMgr.remove( uid ); | 882 | return m_todoMgr.remove( uid ); |
883 | } | 883 | } |
884 | void MainWindow::beam( int uid) { | 884 | void MainWindow::beam( int uid) { |
885 | if( uid == 0 ) return; | 885 | if( uid == 0 ) return; |
886 | 886 | ||
887 | ::unlink( beamfile ); | 887 | ::unlink( beamfile ); |
888 | m_todoMgr.load(); | 888 | m_todoMgr.load(); |
889 | 889 | ||
890 | OPimTodo todo = event( uid ); | 890 | OPimTodo todo = event( uid ); |
891 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) ); | 891 | OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) ); |
892 | OPimTodoAccess acc( cal ); | 892 | OPimTodoAccess acc( cal ); |
893 | acc.load(); | 893 | acc.load(); |
894 | acc.add( todo ); | 894 | acc.add( todo ); |
895 | acc.save(); | 895 | acc.save(); |
896 | Ir* ir = new Ir(this ); | 896 | Ir* ir = new Ir(this ); |
897 | connect(ir, SIGNAL(done(Ir*) ), | 897 | connect(ir, SIGNAL(done(Ir*) ), |
898 | this, SLOT(beamDone(Ir*) ) ); | 898 | this, SLOT(beamDone(Ir*) ) ); |
899 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); | 899 | ir->send(beamfile, todo.summary(), "text/x-vCalendar" ); |
900 | } | 900 | } |
901 | void MainWindow::show( int uid ) { | 901 | void MainWindow::show( int uid ) { |
902 | m_todoMgr.load(); // might not be loaded yet | 902 | m_todoMgr.load(); // might not be loaded yet |
903 | m_showing = true; | 903 | m_showing = true; |
904 | slotShow( uid ); | 904 | slotShow( uid ); |
905 | raise(); | 905 | raise(); |
906 | QPEApplication::setKeepRunning(); | 906 | QPEApplication::setKeepRunning(); |
907 | } | 907 | } |
908 | void MainWindow::edit( int uid ) { | 908 | void MainWindow::edit( int uid ) { |
909 | m_todoMgr.load(); | 909 | m_todoMgr.load(); |
910 | slotEdit( uid ); | 910 | slotEdit( uid ); |
911 | } | 911 | } |
912 | void MainWindow::add( const OPimRecord& rec) { | 912 | void MainWindow::add( const OPimRecord& rec) { |
913 | if ( rec.rtti() != OPimTodo::rtti() ) return; | 913 | OPimTodo test; |
914 | if ( rec.rtti() != test.rtti() ) return; | ||
914 | m_todoMgr.load(); // might not be loaded | 915 | m_todoMgr.load(); // might not be loaded |
915 | 916 | ||
916 | const OPimTodo& todo = static_cast<const OPimTodo&>(rec); | 917 | const OPimTodo& todo = static_cast<const OPimTodo&>(rec); |
917 | 918 | ||
918 | m_todoMgr.add(todo ); | 919 | m_todoMgr.add(todo ); |
919 | currentView()->addEvent( todo ); | 920 | currentView()->addEvent( todo ); |
920 | 921 | ||
921 | 922 | ||
922 | // I'm afraid we must call this every time now, otherwise | 923 | // I'm afraid we must call this every time now, otherwise |
923 | // spend expensive time comparing all these strings... | 924 | // spend expensive time comparing all these strings... |
924 | // but only call if we changed something -zecke | 925 | // but only call if we changed something -zecke |
925 | populateCategories(); | 926 | populateCategories(); |
926 | } | 927 | } |
927 | void MainWindow::slotReturnFromView() { | 928 | void MainWindow::slotReturnFromView() { |
928 | m_showing = false; | 929 | m_showing = false; |
929 | raiseCurrentView(); | 930 | raiseCurrentView(); |
930 | } | 931 | } |
931 | 932 | ||
932 | namespace { | 933 | namespace { |
933 | OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, | 934 | OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls, |
934 | const OPimNotifyManager::Alarms& newAls ) { | 935 | const OPimNotifyManager::Alarms& newAls ) { |
935 | OPimNotifyManager::Alarms nonMatching; | 936 | OPimNotifyManager::Alarms nonMatching; |
936 | OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); | 937 | OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin(); |
937 | OPimNotifyManager::Alarms::ConstIterator newIt; | 938 | OPimNotifyManager::Alarms::ConstIterator newIt; |
938 | for ( ; oldIt != oldAls.end(); ++oldIt ) { | 939 | for ( ; oldIt != oldAls.end(); ++oldIt ) { |
939 | bool found = false; | 940 | bool found = false; |
940 | QDateTime oldDt = (*oldIt).dateTime(); | 941 | QDateTime oldDt = (*oldIt).dateTime(); |
941 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { | 942 | for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) { |
942 | if ( oldDt == (*newIt).dateTime() ) { | 943 | if ( oldDt == (*newIt).dateTime() ) { |
943 | found = true; | 944 | found = true; |
944 | break; | 945 | break; |
945 | } | 946 | } |
946 | } | 947 | } |
947 | if (!found) | 948 | if (!found) |
948 | nonMatching.append( (*oldIt) ); | 949 | nonMatching.append( (*oldIt) ); |
949 | } | 950 | } |
950 | return nonMatching; | 951 | return nonMatching; |
951 | } | 952 | } |
952 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 953 | void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
953 | OPimNotifyManager::Alarms::ConstIterator it; | 954 | OPimNotifyManager::Alarms::ConstIterator it; |
954 | for ( it = als.begin(); it != als.end(); ++it ) { | 955 | for ( it = als.begin(); it != als.end(); ++it ) { |
955 | owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl; | 956 | owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl; |
956 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); | 957 | AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid ); |
957 | } | 958 | } |
958 | 959 | ||
959 | } | 960 | } |
960 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { | 961 | void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) { |
961 | OPimNotifyManager::Alarms::ConstIterator it; | 962 | OPimNotifyManager::Alarms::ConstIterator it; |