author | leseb <leseb> | 2002-07-10 17:45:15 (UTC) |
---|---|---|
committer | leseb <leseb> | 2002-07-10 17:45:15 (UTC) |
commit | 6456ddb2be2a874e858ee25d8463e446b7af58d5 (patch) (side-by-side diff) | |
tree | c2354188cea6176ed1959dfd304f701428da1ce7 | |
parent | 46110a78dd0646d972f238e295ee016f3e78fb85 (diff) | |
download | opie-6456ddb2be2a874e858ee25d8463e446b7af58d5.zip opie-6456ddb2be2a874e858ee25d8463e446b7af58d5.tar.gz opie-6456ddb2be2a874e858ee25d8463e446b7af58d5.tar.bz2 |
Fix "view" menu item
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 6 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index d419166..27e76d9 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -129,64 +129,65 @@ TodoWindow::TodoWindow( QWidget *parent, const char *name, WFlags f ) : QPEMenuBar *mb = new QPEMenuBar( bar ); catMenu = new QPopupMenu( this ); QPopupMenu *edit = new QPopupMenu( this ); QPopupMenu *options = new QPopupMenu(this ); contextMenu = new QPopupMenu( this ); bar = new QPEToolBar( this ); QAction *a = new QAction( tr( "New Task" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); a->addTo( bar ); a->addTo( edit ); a = new QAction( tr( "Edit Task" ), Resource::loadIconSet( "edit" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); a->addTo( bar ); a->addTo( edit ); a->addTo( contextMenu ); a->setEnabled( FALSE ); editAction = a; a = new QAction( QString::null, tr("View Task"), 0, this, 0 ); a->addTo( edit ); a->addTo( contextMenu ); connect( a, SIGNAL( activated() ), this, SLOT(slotShowDetails() ) ); + viewAction = a; edit->insertSeparator(); a = new QAction( tr( "Delete..." ), Resource::loadIconSet( "trash" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); a->addTo( bar ); a->addTo( edit ); a->addTo( contextMenu ); a->setEnabled( FALSE ); 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(); @@ -407,69 +408,71 @@ void TodoWindow::slotDuplicate() int uid; { // uid Qtopia::UidGen *uidgen = new Qtopia::UidGen(); uid = uidgen->generate(); delete uidgen; } ev2.setUid( uid ); table->setPaintingEnabled( false ); table->addEntry( ev2 ); table->setPaintingEnabled( true ); mStack->raiseWidget( 1 ); } void TodoWindow::slotShowPopup( const QPoint &p ) { contextMenu->popup( p ); } void TodoWindow::showCompleted( bool s ) { if ( !table->isUpdatesEnabled() ) return; table->setPaintingEnabled( false ); table->setShowCompleted( s ); table->setPaintingEnabled( true ); mStack->raiseWidget( 1 ); } void TodoWindow::currentEntryChanged( int r, int ) { if ( r != -1 && table->rowHeight( r ) > 0 ) { editAction->setEnabled( TRUE ); + viewAction->setEnabled( TRUE ); deleteAction->setEnabled( TRUE ); duplicateAction->setEnabled( TRUE ); deleteAllAction->setEnabled( TRUE ); } else { editAction->setEnabled( FALSE ); + viewAction->setEnabled( FALSE ); deleteAction->setEnabled( FALSE ); duplicateAction->setEnabled( FALSE ); deleteAllAction->setEnabled( FALSE ); } } void TodoWindow::setCategory( int c ) { if ( c <= 0 ) return; if ( !table->isUpdatesEnabled() ) return; table->setPaintingEnabled( false ); for ( unsigned int i = 1; i < catMenu->count(); i++ ) catMenu->setItemChecked( i, c == (int)i ); if ( c == 1 ) { table->setShowCategory( QString::null ); setCaption( tr("Todo") + " - " + tr( "All Categories" ) ); } else if ( c == (int)catMenu->count() - 1 ) { table->setShowCategory( tr( "Unfiled" ) ); setCaption( tr("Todo") + " - " + tr( "Unfiled" ) ); } else { QString cat = table->categories()[c - 2]; table->setShowCategory( cat ); setCaption( tr("Todo") + " - " + cat ); } table->setPaintingEnabled( true ); mStack->raiseWidget( 1 ); } void TodoWindow::populateCategories() { @@ -578,51 +581,54 @@ void TodoWindow::setDocument( const QString &filename ) ToDoDB todoDB(filename, new ToDoVCalResource() ); QValueList<ToDoEvent> tl = todoDB.rawToDos(); for( QValueList<ToDoEvent>::Iterator it = tl.begin(); it != tl.end(); ++it ) { table->addEntry( *it ); } } static const char * beamfile = "/tmp/obex/todo.vcs"; void TodoWindow::slotBeam() { unlink( beamfile ); // delete if exists ToDoEvent c = table->currentEntry(); mkdir("/tmp/obex/", 0755); ToDoDB todoDB( beamfile, new ToDoVCalResource() ); todoDB.addEvent( c ); todoDB.save(); Ir *ir = new Ir( this ); connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); QString description = c.summary(); ir->send( beamfile, description, "text/x-vCalendar" ); } void TodoWindow::beamDone( Ir *ir ) { delete ir; unlink( beamfile ); } void TodoWindow::showDeadline( bool s ) { + if ( !table->isUpdatesEnabled() ) + return; table->setPaintingEnabled( false ); table->setShowDeadline( s ); table->setPaintingEnabled( true ); + mStack->raiseWidget( 1 ); } void TodoWindow::slotShowDetails() { ToDoEvent event = table->currentEntry(); slotShowDetails( event ); } void TodoWindow::slotShowDetails( const ToDoEvent &event ) { if( mView == 0l ){ mView = new TodoLabel(mStack); mStack->addWidget( mView, 2 ); } mView->init( event ); mView->sync(); mStack->raiseWidget( 2); } diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index f62ec6e..7e8445c 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h @@ -50,47 +50,48 @@ public slots: protected slots: void slotNew(); void slotDelete(); void slotEdit(); void slotShowPopup( const QPoint & ); void showCompleted( bool ); void showDeadline( bool ); void slotShowDetails(const ToDoEvent &event ); void slotShowDetails(); void currentEntryChanged( int r, int c ); void setCategory( int ); void slotFind(); void setDocument( const QString & ); void slotBeam(); void beamDone( Ir * ); void slotDeleteAll(); void slotDuplicate(); protected: void closeEvent( QCloseEvent *e ); private: void populateCategories(); //inline void switchToTable(); // move back to the normal view private: TodoTable *table; TodoLabel *mView; QAction *editAction, + *viewAction, *deleteAction, *findAction, *completedAction, *showdeadlineAction, *deleteAllAction, *duplicateAction; QPopupMenu *contextMenu, *catMenu; QWidgetStack *mStack; bool syncing; }; #endif |