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.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
@@ -50,28 +50,28 @@
#include <qlayout.h>
#include <qwhatsthis.h>
#include "quickeditimpl.h"
#include "todotemplatemanager.h"
#include "templateeditor.h"
#include "tableview.h"
#include "textviewshow.h"
#include "todoeditor.h"
#include "mainwindow.h"
-using namespace Opie::Core;
+using Opie::Core::OApplicationFactory;
OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> )
- using namespace Opie;
+using namespace Opie;
using namespace Todo;
MainWindow::MainWindow( QWidget* parent,
const char* name, WFlags )
: Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp )
{
if (!name)
setName("todo window");
m_syncing = false;
m_showing = false;
m_counter = 0;
@@ -287,44 +287,44 @@ QPopupMenu* MainWindow::contextMenu( int , bool recur ) {
/*
* if this event recurs we allow
* to detach it.
* remove all
*/
if ( recur ) {
; // FIXME
}
return menu;
}
QPopupMenu* MainWindow::options() {
- Opie::Core::owarn << "Options" << oendl;
+ owarn << "Options" << oendl;
return m_options;
}
QPopupMenu* MainWindow::edit() {
return m_edit;
}
QToolBar* MainWindow::toolbar() {
return m_tool;
}
OPimTodoAccess::List MainWindow::list()const {
return m_todoMgr.list();
}
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") )
cat = -1;
- Opie::Core::owarn << " Category " << cat << " " << m_curCat << oendl;
+ owarn << " Category " << cat << " " << m_curCat << oendl;
int filter = 1;
if (!m_completed )
filter |= 4;
if (m_overdue)
filter |= 2;
return m_todoMgr.sorted( asc, sortOrder, filter, cat );
}
OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
int cat = 0;
@@ -365,25 +365,25 @@ void MainWindow::closeEvent( QCloseEvent* e ) {
return;
}
/*
* we should have flushed and now we're still saving
* so there is no need to flush
*/
if (m_syncing ) {
e->accept();
return;
}
bool quit = false;
if ( m_todoMgr.saveAll() ){
- Opie::Core::owarn << "saved" << oendl;
+ owarn << "saved" << oendl;
quit = true;
}else {
if ( QMessageBox::critical( this, QWidget::tr("Out of space"),
QWidget::tr("Todo was unable\n"
"to save your changes.\n"
"Free up some space\n"
"and try again.\n"
"\nQuit Anyway?"),
QMessageBox::Yes|QMessageBox::Escape,
QMessageBox::No|QMessageBox::Default)
!= QMessageBox::No ) {
e->accept();
@@ -528,25 +528,25 @@ void MainWindow::slotFind() {
}
void MainWindow::slotEdit() {
slotEdit( currentView()->current() );
}
/*
* set the category
*/
void MainWindow::setCategory( int c) {
if ( c <= 0 ) return;
- Opie::Core::owarn << "Iterating over cats " << c << oendl;
+ owarn << "Iterating over cats " << c << oendl;
for ( unsigned int i = 1; i < m_catMenu->count(); i++ )
m_catMenu->setItemChecked(i, c == (int)i );
if (c == 1 ) {
m_curCat = QString::null;
setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("All Categories" ) );
}else if ( c == (int)m_catMenu->count() - 1 ) {
m_curCat = QWidget::tr("Unfiled");
setCaption( QWidget::tr("Todo") + " - " + QWidget::tr("Unfiled") );
}else {
m_curCat = m_todoMgr.categories()[c-2];
@@ -591,35 +591,35 @@ void MainWindow::beamDone( Ir* ir) {
delete ir;
::unlink( beamfile );
}
void MainWindow::receiveFile( const QString& filename ) {
OPimTodoAccessVCal* cal = new OPimTodoAccessVCal(filename );
OPimTodoAccess acc( cal );
acc.load();
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() );
+ 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 ) {
- OPimTodoAccess::List::Iterator it;
- for ( it = list.begin(); it != list.end(); ++it )
- m_todoMgr.add( (*it) );
+ if ( QMessageBox::information(this, QWidget::tr("New Tasks"),
+ message, QMessageBox::Ok,
+ QMessageBox::Cancel ) == QMessageBox::Ok ) {
+ OPimTodoAccess::List::Iterator it;
+ for ( it = list.begin(); it != list.end(); ++it )
+ m_todoMgr.add( (*it) );
- currentView()->updateView();
- }
+ currentView()->updateView();
+ }
}
}
void MainWindow::slotFlush() {
m_syncing = TRUE;
m_todoMgr.save();
}
void MainWindow::slotShowDetails() {
slotShow( currentView()->current() );
}
/*
* populate the Categories
@@ -672,25 +672,27 @@ void MainWindow::raiseCurrentView() {
// in returnFromView we fix up m_showing
if (m_showing ) return;
m_stack->raiseWidget( m_curView->widget() );
}
void MainWindow::slotShowDue(bool ov) {
m_overdue = ov;
currentView()->showOverDue( ov );
raiseCurrentView();
}
void MainWindow::slotShow( int uid ) {
if ( uid == 0 ) return;
- Opie::Core::owarn << "slotShow" << oendl;
+
+
+ owarn << "slotShow" << oendl;
currentShow()->slotShow( event( uid ) );
m_stack->raiseWidget( currentShow()->widget() );
}
void MainWindow::slotShowNext() {
int l = currentView()->next();
if (l!=0)
slotShow(l);
}
void MainWindow::slotShowPrev() {
int l = currentView()->prev();
if (l!=0)
slotShow(l);
@@ -731,25 +733,25 @@ void MainWindow::updateTodo( const OPimTodo& ev) {
*/
void MainWindow::slotUpdate3( QWidget* ) {
}
void MainWindow::updateList() {
m_todoMgr.updateList();
}
void MainWindow::setReadAhead( uint count ) {
if (m_todoMgr.todoDB() )
m_todoMgr.todoDB()->setReadAhead( count );
}
void MainWindow::slotQuickEntered() {
- Opie::Core::owarn << "entered" << oendl;
+ owarn << "entered" << oendl;
OPimTodo todo = quickEditor()->todo();
if (todo.isEmpty() )
return;
m_todoMgr.add( todo );
currentView()->addEvent( todo );
raiseCurrentView();
}
QuickEditBase* MainWindow::quickEditor() {
return m_curQuick;
}
void MainWindow::slotComplete( int uid ) {
@@ -778,25 +780,25 @@ void MainWindow::slotComplete( const OPimTodo& todo ) {
to.setRecurrence( OPimRecurrence() );
OPimRecurrence rec = to2.recurrence();
rec.setStart( to.dueDate() );
to2.setRecurrence( rec );
/*
* if there is a next occurence
* from the duedate of the last recurrance
*/
QDate date;
if ( to2.recurrence().nextOcurrence( to2.dueDate().addDays(1), date ) ) {
int dayDiff = to.dueDate().daysTo( date );
- Opie::Core::owarn << "day diff is " << dayDiff << oendl;
+ owarn << "day diff is " << dayDiff << oendl;
QDate inval;
/* generate a new uid for the old record */
to.setUid( 1 );
/* add the old one cause it has a new UID here cause it was spin off */
m_todoMgr.add( to );
/*
* update the due date
* start date
* and complete date
*/
@@ -941,33 +943,33 @@ namespace {
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 ) {
- Opie::Core::owarn << "Adding alarm for " << (*it).dateTime().toString() << oendl;
+ 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;
for ( it = als.begin(); it != als.end(); ++it ) {
- Opie::Core::owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl;
+ owarn << "Removinf alarm for " << (*it).dateTime().toString() << oendl;
AlarmServer::deleteAlarm( (*it).dateTime(), "QPE/Application/todolist", "alarm(QDateTime,int)", uid );
}
}
}
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() ) {
OPimNotifyManager::Alarms removed;
OPimNotifyManager::Alarms oldAls = oldTodo.notifiers().alarms();