-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 @@ -125,4 +125,6 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : catMenu = new QPopupMenu( this ); QPopupMenu *edit = new QPopupMenu( this ); + QPopupMenu *options = new QPopupMenu(this ); + contextMenu = new QPopupMenu( this ); @@ -136,5 +138,5 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : a->addTo( edit ); - a = new QAction( tr( "Edit" ), Resource::loadIconSet( "edit" ), + a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), @@ -145,6 +147,7 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : a->setEnabled( FALSE ); 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 ); connect( a, SIGNAL( activated() ), @@ -156,4 +159,24 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : deleteAction = a; + // 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() ) { a = new QAction( tr( "Beam" ), Resource::loadPixmap( "beam" ), @@ -170,5 +193,7 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : this, SLOT( slotFind() ) ); a->addTo( bar ); - a->addTo( edit ); + a->addTo( options ); + options->insertSeparator(); + if ( table->numRows() ) a->setEnabled( TRUE ); @@ -187,7 +212,22 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f = 0 ) : populateCategories(); - 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 ); if ( table->numRows() > 0 ) @@ -280,4 +320,28 @@ 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 ); + } +} void TodoWindow::slotEdit() @@ -308,5 +372,17 @@ 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 ) { @@ -328,7 +404,11 @@ void TodoWindow::currentEntryChanged( int r, int ) editAction->setEnabled( TRUE ); deleteAction->setEnabled( TRUE ); + duplicateAction->setEnabled( TRUE ); + deleteAllAction->setEnabled( TRUE ); } else { editAction->setEnabled( FALSE ); deleteAction->setEnabled( FALSE ); + duplicateAction->setEnabled( FALSE ); + deleteAllAction->setEnabled( FALSE ); } } @@ -359,20 +439,8 @@ 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; id = 1; catMenu->insertItem( tr( "All Categories" ), id++ ); -// catMenu->insertSeparator(); + catMenu->insertSeparator(); QStringList categories = table->categories(); categories.append( tr( "Unfiled" ) ); |