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.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp
index 2002e87..9424c23 100644
--- a/core/pim/todo/mainwindow.cpp
+++ b/core/pim/todo/mainwindow.cpp
@@ -287,51 +287,48 @@ 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() {
- 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;
- owarn << " Category " << cat << " " << m_curCat << oendl;
-
- int filter = 1;
+ int filter = OPimTodoAccess::FilterCategory;
if (!m_completed )
- filter |= 4;
+ filter |= OPimTodoAccess::DoNotShowCompleted;
if (m_overdue)
- filter |= 2;
+ filter |= OPimTodoAccess::OnlyOverDue;
return m_todoMgr.sorted( asc, sortOrder, filter, cat );
}
OPimTodoAccess::List MainWindow::sorted( bool asc, int sortOrder, int addFilter) {
int cat = 0;
if ( m_curCat != QWidget::tr("All Categories") )
cat = currentCatId();
if ( m_curCat == QWidget::tr("Unfiled") )
cat = -1;
return m_todoMgr.sorted(asc, sortOrder, addFilter, cat );
@@ -365,25 +362,24 @@ 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() ){
- 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 +524,24 @@ void MainWindow::slotFind() {
}
void MainWindow::slotEdit() {
slotEdit( currentView()->current() );
}
/*
* set the category
*/
void MainWindow::setCategory( int c) {
if ( c <= 0 ) return;
- 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];
@@ -674,25 +669,24 @@ void MainWindow::raiseCurrentView() {
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;
- 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);
@@ -733,25 +727,24 @@ 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() {
- 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 ) {
@@ -780,25 +773,24 @@ 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 );
- 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
*/
@@ -944,33 +936,31 @@ 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 ) {
- 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 ) {
- 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();