summaryrefslogtreecommitdiff
path: root/core/pim/todo/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/todo/mainwindow.cpp98
1 files changed, 48 insertions, 50 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index fc189bd..0613f2c 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -27,8 +27,22 @@
*/
#include <unistd.h>
+#include <opie2/opimrecurrence.h>
+#include <opie2/opimnotifymanager.h>
+#include <opie2/otodoaccessvcal.h>
+#include <opie2/oapplicationfactory.h>
+
+#include <qpe/applnk.h>
+#include <qpe/config.h>
+#include <qpe/ir.h>
+#include <qpe/resource.h>
+#include <qpe/qpemessagebox.h>
+#include <qpe/alarmserver.h>
+#include <qpe/timestring.h>
+#include <qpe/qpeapplication.h>
+
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qtoolbar.h>
#include <qpopupmenu.h>
@@ -40,24 +54,8 @@
#include <qlayout.h>
#include <qlineedit.h>
#include <qwhatsthis.h>
-#include <qpe/applnk.h>
-#include <qpe/config.h>
-#include <qpe/ir.h>
-#include <qpe/resource.h>
-#include <qpe/qpemessagebox.h>
-#include <qpe/alarmserver.h>
-#include <qpe/timestring.h>
-#include <qpe/qpeapplication.h>
-
-#include <opie/orecur.h>
-#include <opie/opimnotifymanager.h>
-#include <opie/otodoaccessvcal.h>
-#include <opie/owidgetstack.h>
-
-#include <opie/oapplicationfactory.h>
-
#include "quickeditimpl.h"
#include "todotemplatemanager.h"
#include "templateeditor.h"
#include "tableview.h"
@@ -309,12 +307,12 @@ QPopupMenu* MainWindow::edit() {
}
QToolBar* MainWindow::toolbar() {
return m_tool;
}
-OTodoAccess::List MainWindow::list()const {
+OPimTodoAccess::List MainWindow::list()const {
return m_todoMgr.list();
}
-OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
+OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
int cat = 0;
if ( m_curCat != QWidget::tr("All Categories") )
cat = currentCatId();
if ( m_curCat == QWidget::tr("Unfiled") )
@@ -330,9 +328,9 @@ OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder ) {
filter |= 2;
return m_todoMgr.sorted( asc, sortOrder, filter, cat );
}
-OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
+OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
int cat = 0;
if ( m_curCat != QWidget::tr("All Categories") )
cat = currentCatId();
@@ -340,9 +338,9 @@ OTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
cat = -1;
return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
}
-OTodo MainWindow::event( int uid ) {
+OPimTodo MainWindow::event( int uid ) {
return m_todoMgr.event( uid );
}
bool MainWindow::isSyncing()const {
return m_syncing;
@@ -432,16 +430,16 @@ void MainWindow::populateTemplates() {
*/
void MainWindow::slotNewFromTemplate( int id ) {
QString name = m_template->text( id );
- OTodo event = templateManager()->templateEvent( name );
+ OPimTodo event = templateManager()->templateEvent( name );
event = currentEditor()->edit(this,
event );
if ( currentEditor()->accepted() ) {
/* assign new todo */
event.setUid( 1 );
- handleAlarms( OTodo(), event );
+ handleAlarms( OPimTodo(), event );
m_todoMgr.add( event );
currentView()->addEvent( event );
populateCategories();
@@ -456,9 +454,9 @@ void MainWindow::slotDuplicate() {
QMessageBox::warning(this, QWidget::tr("Todo"),
QWidget::tr("Data can not be edited, currently syncing"));
return;
}
- OTodo ev = m_todoMgr.event( currentView()->current() );
+ OPimTodo ev = m_todoMgr.event( currentView()->current() );
/* let's generate a new uid */
ev.setUid(1);
m_todoMgr.add( ev );
@@ -477,9 +475,9 @@ void MainWindow::slotDelete() {
QString strName = currentView()->currentRepresentation();
if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), strName ) )
return;
- handleAlarms( m_todoMgr.event( currentView()->current() ), OTodo() );
+ handleAlarms( m_todoMgr.event( currentView()->current() ), OPimTodo() );
m_todoMgr.remove( currentView()->current() );
currentView()->removeEvent( currentView()->current() );
raiseCurrentView();
}
@@ -489,13 +487,13 @@ void MainWindow::slotDelete(int uid ) {
QMessageBox::warning(this, QWidget::tr("Todo"),
QWidget::tr("Data can not be edited, currently syncing"));
return;
}
- OTodo to = m_todoMgr.event(uid);
+ OPimTodo to = m_todoMgr.event(uid);
if (!QPEMessageBox::confirmDelete(this, QWidget::tr("Todo"), to.toShortText() ) )
return;
- handleAlarms(to, OTodo() );
+ handleAlarms(to, OPimTodo() );
m_todoMgr.remove( to.uid() );
currentView()->removeEvent( to.uid() );
raiseCurrentView();
}
@@ -596,22 +594,22 @@ void MainWindow::beamDone( Ir* ir) {
delete ir;
::unlink( beamfile );
}
void MainWindow::receiveFile( const QString& filename ) {
- OTodoAccessVCal* cal = new OTodoAccessVCal(filename );
+ OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename );
- OTodoAccess acc( cal );
+ OPimTodoAccess acc( cal );
acc.load();
- OTodoAccess::List list = acc.allRecords();
+ OPimTodoAccess::List list = acc.allRecords();
if (list.count()){
QString message = QWidget::tr("<P>%1 new tasks arrived.<p>Would you like to add them to your Todolist?").arg(list.count() );
if ( QMessageBox::information(this, QWidget::tr("New Tasks"),
message, QMessageBox::Ok,
QMessageBox::Cancel ) == QMessageBox::Ok ) {
- OTodoAccess::List::Iterator it;
+ OPimTodoAccess::List::Iterator it;
for ( it = list.begin(); it != list.end(); ++it )
m_todoMgr.add( (*it) );
currentView()->updateView();
@@ -707,11 +705,11 @@ void MainWindow::slotEdit( int uid ) {
QWidget::tr("Data can't be edited, currently syncing"));
return;
}
- OTodo old_todo = m_todoMgr.event( uid );
+ OPimTodo old_todo = m_todoMgr.event( uid );
- OTodo todo = currentEditor()->edit(this, old_todo );
+ OPimTodo todo = currentEditor()->edit(this, old_todo );
/* if completed */
if ( currentEditor()->accepted() ) {
handleAlarms( old_todo, todo );
@@ -727,9 +725,9 @@ void MainWindow::slotEdit( int uid ) {
void MainWindow::slotUpdate1( int uid, const SmallTodo& ev) {
m_todoMgr.update( uid, ev );
}
*/
-void MainWindow::updateTodo( const OTodo& ev) {
+void MainWindow::updateTodo( const OPimTodo& ev) {
m_todoMgr.update( ev.uid() , ev );
}
/* The view changed it's configuration
* update the view menu
@@ -745,9 +743,9 @@ void MainWindow::setReadAhead( uint count ) {
m_todoMgr.todoDB()->setReadAhead( count );
}
void MainWindow::slotQuickEntered() {
qWarning("entered");
- OTodo todo = quickEditor()->todo();
+ OPimTodo todo = quickEditor()->todo();
if (todo.isEmpty() )
return;
m_todoMgr.add( todo );
@@ -759,10 +757,10 @@ QuickEditBase* MainWindow::quickEditor() {
}
void MainWindow::slotComplete( int uid ) {
slotComplete( event(uid) );
}
-void MainWindow::slotComplete( const OTodo& todo ) {
- OTodo to = todo;
+void MainWindow::slotComplete( const OPimTodo& todo ) {
+ OPimTodo to = todo;
to.setCompleted( !to.isCompleted() );
to.setCompletedDate( QDate::currentDate() );
/*
@@ -776,14 +774,14 @@ void MainWindow::slotComplete( const OTodo& todo ) {
* new one and add this diff to start, completed and alarm dates
* -zecke
*/
if ( to.hasRecurrence() && to.isCompleted() ) {
- OTodo to2( to );
+ OPimTodo to2( to );
/* the spinned off one won't recur anymore */
- to.setRecurrence( ORecur() );
+ to.setRecurrence( OPimRecurrence() );
- ORecur rec = to2.recurrence();
+ OPimRecurrence rec = to2.recurrence();
rec.setStart( to.dueDate() );
to2.setRecurrence( rec );
/*
* if there is a next occurence
@@ -824,9 +822,9 @@ void MainWindow::slotComplete( const OTodo& todo ) {
al.setDateTime( al.dateTime().addDays( dayDiff ) );
als.append( al );
}
to2.notifiers().setAlarms( als );
- handleAlarms( OTodo(), todo );
+ handleAlarms( OPimTodo(), todo );
}
to2.setCompletedDate( inval );
to2.setCompleted( false );
@@ -854,15 +852,15 @@ int MainWindow::create() {
}
m_todoMgr.load();
- OTodo todo = currentEditor()->newTodo( currentCatId(),
+ OPimTodo todo = currentEditor()->newTodo( currentCatId(),
this );
if ( currentEditor()->accepted() ) {
//todo.assignUid();
uid = todo.uid();
- handleAlarms( OTodo(), todo );
+ handleAlarms( OPimTodo(), todo );
m_todoMgr.add( todo );
currentView()->addEvent( todo );
@@ -879,9 +877,9 @@ int MainWindow::create() {
bool MainWindow::remove( int uid ) {
if (m_syncing) return false;
/* argh need to get the whole OEvent... to disable alarms -zecke */
- handleAlarms( OTodo(), m_todoMgr.event( uid ) );
+ handleAlarms( OPimTodo(), m_todoMgr.event( uid ) );
return m_todoMgr.remove( uid );
}
void MainWindow::beam( int uid) {
@@ -889,11 +887,11 @@ void MainWindow::beam( int uid) {
::unlink( beamfile );
m_todoMgr.load();
- OTodo todo = event( uid );
- OTodoAccessVCal* cal = new OTodoAccessVCal(QString::fromLatin1(beamfile) );
- OTodoAccess acc( cal );
+ 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 );
@@ -912,12 +910,12 @@ void MainWindow::edit( int uid ) {
m_todoMgr.load();
slotEdit( uid );
}
void MainWindow::add( const OPimRecord& rec) {
- if ( rec.rtti() != OTodo::rtti() ) return;
+ if ( rec.rtti() != OPimTodo::rtti() ) return;
m_todoMgr.load(); // might not be loaded
- const OTodo& todo = static_cast<const OTodo&>(rec);
+ const OPimTodo& todo = static_cast<const OPimTodo&>(rec);
m_todoMgr.add(todo );
currentView()->addEvent( todo );
@@ -968,9 +966,9 @@ namespace {
}
}
}
-void MainWindow::handleAlarms( const OTodo& oldTodo, const OTodo& newTodo) {
+void MainWindow::handleAlarms( const OPimTodo& oldTodo, const OPimTodo& newTodo) {
/*
* if oldTodo is not empty and has notifiers we need to find the deleted ones
*/
if(!oldTodo.isEmpty() && oldTodo.hasNotifiers() ) {
@@ -996,9 +994,9 @@ void MainWindow::handleAlarms( const OTodo& oldTodo, const OTodo& newTodo) {
/* we might have not loaded the db */
void MainWindow::doAlarm( const QDateTime& dt, int uid ) {
m_todoMgr.load();
- OTodo todo = m_todoMgr.event( uid );
+ OPimTodo todo = m_todoMgr.event( uid );
if (!todo.hasNotifiers() ) return;
/*
* let's find the right alarm and find out if silent