Commit 34f3f6659023b85d99a5302afd1d4e7d445d7673

todolist: add handling for alarms post sync/time change

  Add handling for of alarms after syncing and when the system time changes
  in todolist.
  
9494 initEditor();
9595 initShow();
9696
97 connect( qApp, SIGNAL( appMessage(const QCString&,const QByteArray&) ),
98 this, SLOT( slotAppMessage(const QCString&,const QByteArray&) ) );
99
97100 raiseCurrentView();
98101 QTimer::singleShot( 0, this, SLOT(initStuff()) );
99102}
10031003 }
10041004}
10051005
1006void MainWindow::handleAllAlarms()
1007{
1008 if( !m_todoMgr.isLoaded() )
1009 m_todoMgr.load();
1010
1011 // Delete all todo alarms
1012 AlarmServer::deleteAlarm( QDateTime(), "QPE/Application/todolist", QCString(), -1 );
1013
1014 // Register all todo alarms
1015 m_todoMgr.updateList();
1016 OPimTodoAccess::List list = m_todoMgr.list();
1017 OPimTodoAccess::List::Iterator it;
1018 for ( it = list.begin(); it != list.end(); ++it ) {
1019 const OPimTodo& todo = (*it);
1020 if ( todo.hasNotifiers() )
1021 addAlarms( todo.notifiers().alarms(), todo.uid() );
1022 }
1023}
1024
10061025/* we might have not loaded the db */
10071026bool MainWindow::doAlarm( const QDateTime& dt, int uid )
10081027{
10801080 owarn << "Started for alarm at " << dt << " (uid=" << uid << ") that does not exist!" << oendl;
10811081
10821082 return needshow;
1083}
1084
1085void MainWindow::slotAppMessage( const QCString& msg, const QByteArray& data )
1086{
1087 if( msg == "registerAllAlarms()" ) {
1088 handleAllAlarms();
1089 }
10831090}
  
106106 private:
107107 /* handle setting and removing alarms */
108108 void handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo );
109 void handleAllAlarms();
109110 void receiveFile( const QString& filename );
110111 void connectBase( ViewBase* );
111112 void initUI();
181181
182182 void setDocument( const QString& );
183183
184 void slotAppMessage( const QCString& msg, const QByteArray& data );
184185
185186 void beamDone( Ir* );
186187 void slotShowDetails();
  
166166
167167bool TodoManager::isLoaded()const
168168{
169 return ( m_db == 0 );
169 return ( m_db != 0 );
170170}
171171
172172bool TodoManager::load()
  
11datebook_postsync postsync datebook QPE/Application/datebook registerAllAlarms()
22datebook_pretime presystemtimechange datebook QPE/Application/datebook
33datebook_posttime postsystemtimechange datebook QPE/Application/datebook registerAllAlarms()
4todolist_postsync postsync todolist QPE/Application/todolist registerAllAlarms()
5todolist_pretime presystemtimechange todolist QPE/Application/todolist
6todolist_posttime postsystemtimechange todolist QPE/Application/todolist registerAllAlarms()