summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp3
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() {
// I'm afraid we must call this every time now, otherwise
// spend expensive time comparing all these strings...
// but only call if we changed something -zecke
populateCategories();
}
raiseCurrentView( );
return uid;
}
/* delete it silently... */
bool MainWindow::remove( int uid ) {
if (m_syncing) return false;
/* argh need to get the whole OEvent... to disable alarms -zecke */
handleAlarms( OPimTodo(), m_todoMgr.event( uid ) );
return m_todoMgr.remove( uid );
}
void MainWindow::beam( int uid) {
if( uid == 0 ) return;
::unlink( beamfile );
m_todoMgr.load();
OPimTodo todo = event( uid );
OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(QString::fromLatin1(beamfile) );
OPimTodoAccess acc( cal );
acc.load();
acc.add( todo );
acc.save();
Ir* ir = new Ir(this );
connect(ir, SIGNAL(done(Ir*) ),
this, SLOT(beamDone(Ir*) ) );
ir->send(beamfile, todo.summary(), "text/x-vCalendar" );
}
void MainWindow::show( int uid ) {
m_todoMgr.load(); // might not be loaded yet
m_showing = true;
slotShow( uid );
raise();
QPEApplication::setKeepRunning();
}
void MainWindow::edit( int uid ) {
m_todoMgr.load();
slotEdit( uid );
}
void MainWindow::add( const OPimRecord& rec) {
- if ( rec.rtti() != OPimTodo::rtti() ) return;
+ OPimTodo test;
+ if ( rec.rtti() != test.rtti() ) return;
m_todoMgr.load(); // might not be loaded
const OPimTodo& todo = static_cast<const OPimTodo&>(rec);
m_todoMgr.add(todo );
currentView()->addEvent( todo );
// I'm afraid we must call this every time now, otherwise
// spend expensive time comparing all these strings...
// but only call if we changed something -zecke
populateCategories();
}
void MainWindow::slotReturnFromView() {
m_showing = false;
raiseCurrentView();
}
namespace {
OPimNotifyManager::Alarms findNonMatching( const OPimNotifyManager::Alarms& oldAls,
const OPimNotifyManager::Alarms& newAls ) {
OPimNotifyManager::Alarms nonMatching;
OPimNotifyManager::Alarms::ConstIterator oldIt = oldAls.begin();
OPimNotifyManager::Alarms::ConstIterator newIt;
for ( ; oldIt != oldAls.end(); ++oldIt ) {
bool found = false;
QDateTime oldDt = (*oldIt).dateTime();
for (newIt= newAls.begin(); newIt != newAls.end(); ++newIt ) {
if ( oldDt == (*newIt).dateTime() ) {
found = true;
break;
}
}
if (!found)
nonMatching.append( (*oldIt) );
}
return nonMatching;
}
void addAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
OPimNotifyManager::Alarms::ConstIterator it;
for ( it = als.begin(); it != als.end(); ++it ) {
owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl;
AlarmServer::addAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
}
}
void removeAlarms( const OPimNotifyManager::Alarms& als, int uid ) {
OPimNotifyManager::Alarms::ConstIterator it;