Diffstat (limited to 'core/pim/todo/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 106 |
1 files changed, 87 insertions, 19 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index b5cace9..883d78c 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -126,2 +126,4 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : QPopupMenu *edit = new QPopupMenu( this ); + QPopupMenu *options = new QPopupMenu(this ); + contextMenu = new QPopupMenu( this ); @@ -137,3 +139,3 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : - a = new QAction( tr( "Edit" ), Resource::loadIconSet( "edit" ), + a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ), QString::null, 0, this, 0 ); @@ -146,4 +148,5 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : editAction = a; + edit->insertSeparator(); - a = new QAction( tr( "Delete" ), Resource::loadIconSet( "trash" ), + a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ), QString::null, 0, this, 0 ); @@ -157,2 +160,22 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : + // delete All in category is missing.... + // set All Done + // set All Done in category + + a = new QAction( QString::null, tr( "Delete all..."), 0, this, 0 ); + connect(a, SIGNAL( activated() ), + this, SLOT( slotDeleteAll() ) ); + a->addTo(edit ); + a->setEnabled( FALSE ); + deleteAllAction = a; + + edit->insertSeparator(); + a = new QAction( QString::null, tr("Duplicate" ), 0, this, 0 ); + connect(a, SIGNAL( activated() ), + this, SLOT( slotDuplicate() ) ); + a->addTo(edit ); + a->setEnabled( FALSE ); + duplicateAction = a; + + edit->insertSeparator(); if ( Ir::supported() ) { @@ -171,3 +194,5 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : a->addTo( bar ); - a->addTo( edit ); + a->addTo( options ); + options->insertSeparator(); + if ( table->numRows() ) @@ -188,5 +213,20 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : - mb->insertItem( tr( "Data" ), edit ); - mb->insertItem( tr( "View" ), catMenu ); + + completedAction->addTo( options ); + completedAction->setOn( table->showCompleted() ); + showdeadlineAction->addTo( options ); + showdeadlineAction->setOn( table->showDeadline() ); + options->insertSeparator( ); + QList<QWidget> list; + list.append(table ); + OFontMenu *menu = new OFontMenu(this, "menu",list ); + menu->forceSize( table->horizontalHeader(), 10 ); + //catMenu->insertItem(tr("Fonts"), menu ); + list.clear(); + options->insertItem( tr("Fonts"), menu ); + + mb->insertItem( tr( "Data" ), edit ); + mb->insertItem( tr( "Category" ), catMenu ); + mb->insertItem( tr( "Options"), options ); resize( 200, 300 ); @@ -281,2 +321,26 @@ void TodoWindow::slotDelete() } +void TodoWindow::slotDeleteAll() +{ + if(syncing) { + QMessageBox::warning(this, tr("Todo"), + tr("Can not edit data, currently syncing")); + return; + } + + //QString strName = table->text( table->currentRow(), 2 ).left( 30 ); + + if ( !QPEMessageBox::confirmDelete( this, tr( "Todo" ), tr("Should I delete all tasks?") ) ) + return; + + + + table->setPaintingEnabled( false ); + table->removeAllEntries(); + table->setPaintingEnabled( true ); + + if ( table->numRows() == 0 ) { + currentEntryChanged( -1, 0 ); + findAction->setEnabled( FALSE ); + } +} @@ -309,3 +373,15 @@ void TodoWindow::slotEdit() } - +void TodoWindow::slotDuplicate() +{ + if(syncing) { + QMessageBox::warning(this, tr("Todo"), + tr("Can not edit data, currently syncing")); + return; + } + ToDoEvent ev = table->currentEntry(); + ToDoEvent ev2 = ToDoEvent( ev ); + table->setPaintingEnabled( false ); + table->addEntry( ev2 ); + table->setPaintingEnabled( true ); +} void TodoWindow::slotShowPopup( const QPoint &p ) @@ -329,2 +405,4 @@ void TodoWindow::currentEntryChanged( int r, int ) deleteAction->setEnabled( TRUE ); + duplicateAction->setEnabled( TRUE ); + deleteAllAction->setEnabled( TRUE ); } else { @@ -332,2 +410,4 @@ void TodoWindow::currentEntryChanged( int r, int ) deleteAction->setEnabled( FALSE ); + duplicateAction->setEnabled( FALSE ); + deleteAllAction->setEnabled( FALSE ); } @@ -360,14 +440,2 @@ void TodoWindow::populateCategories() catMenu->clear(); - - QList<QWidget> list; - list.append(table ); - OFontMenu *menu = new OFontMenu(this, "menu",list ); - menu->forceSize( table->horizontalHeader(), 10 ); - catMenu->insertItem(tr("Fonts"), menu ); - - completedAction->addTo( catMenu ); - completedAction->setOn( table->showCompleted() ); - showdeadlineAction->addTo( catMenu ); - showdeadlineAction->setOn( table->showDeadline() ); - catMenu->insertSeparator(); int id, rememberId; @@ -375,3 +443,3 @@ void TodoWindow::populateCategories() catMenu->insertItem( tr( "All Categories" ), id++ ); -// catMenu->insertSeparator(); + catMenu->insertSeparator(); QStringList categories = table->categories(); |