-rw-r--r-- | korganizer/calendarview.cpp | 35 | ||||
-rw-r--r-- | korganizer/calendarview.h | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 25 | ||||
-rw-r--r-- | korganizer/mainwindow.h | 6 |
4 files changed, 69 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index b1da144..38b55f7 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -2390,24 +2390,59 @@ void CalendarView::showEventEditor() #else mEventEditor->showMaximized(); #endif } void CalendarView::showTodoEditor() { #ifdef DESKTOP_VERSION mTodoEditor->show(); #else mTodoEditor->showMaximized(); #endif } + +void CalendarView::cloneIncidence() +{ + Incidence *incidence = currentSelection(); + if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); + if ( incidence ) { + cloneIncidence(incidence); + } +} +void CalendarView::moveIncidence() +{ + Incidence *incidence = currentSelection(); + if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); + if ( incidence ) { + moveIncidence(incidence); + } +} +void CalendarView::beamIncidence() +{ + Incidence *incidence = currentSelection(); + if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); + if ( incidence ) { + beamIncidence(incidence); + } +} +void CalendarView::toggleCancelIncidence() +{ + Incidence *incidence = currentSelection(); + if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); + if ( incidence ) { + cancelIncidence(incidence); + } +} + + void CalendarView::cancelIncidence(Incidence * inc ) { inc->setCancelled( ! inc->cancelled() ); changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); updateView(); } void CalendarView::cloneIncidence(Incidence * orgInc ) { Incidence * newInc = orgInc->clone(); newInc->recreate(); if ( newInc->type() == "Todo" ) { diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index cd54685..a713c91 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -202,24 +202,28 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser Close calendar. Clear calendar data and reset views to display an empty calendar. */ void closeCalendar(); /** Archive old events of calendar */ void archiveCalendar(); void showIncidence(); void editIncidence(); void editIncidenceDescription(); void deleteIncidence(); + void cloneIncidence(); + void moveIncidence(); + void beamIncidence(); + void toggleCancelIncidence(); /** create an editeventwin with supplied date/time, and if bool is true, * make the event take all day. */ void newEvent(QDateTime, QDateTime, bool allDay = false); void newEvent(QDateTime fh); void newEvent(QDate dt); /** create new event without having a date hint. Takes current date as default hint. */ void newEvent(); void newFloatingEvent(); /** Create a read-only viewer dialog for the supplied incidence. It calls the correct showXXX method*/ diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 6a9a2f1..bd14fbf 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -628,24 +628,42 @@ void MainWindow::initActions() mView, SLOT( showIncidence() ) ); mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); mEditAction->addTo( actionMenu ); connect( mEditAction, SIGNAL( activated() ), mView, SLOT( editIncidence() ) ); mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); mDeleteAction->addTo( actionMenu ); connect( mDeleteAction, SIGNAL( activated() ), mView, SLOT( deleteIncidence() ) ); + + mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); + mCloneAction->addTo( actionMenu ); + connect( mCloneAction, SIGNAL( activated() ), + mView, SLOT( cloneIncidence() ) ); + mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); + mMoveAction->addTo( actionMenu ); + connect( mMoveAction, SIGNAL( activated() ), + mView, SLOT( moveIncidence() ) ); + mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); + mBeamAction->addTo( actionMenu ); + connect( mBeamAction, SIGNAL( activated() ), + mView, SLOT( beamIncidence() ) ); + mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); + mCancelAction->addTo( actionMenu ); + connect( mCancelAction, SIGNAL( activated() ), + mView, SLOT( toggleCancelIncidence() ) ); + actionMenu->insertSeparator(); action = new QAction( "purge_completed", i18n("Purge Completed"), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); icon = loadPixmap( pathString + "search" ); QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); search_action->addTo( actionMenu ); connect( search_action, SIGNAL( activated() ), @@ -1177,25 +1195,25 @@ void MainWindow::exportToPhone( int mode ) inFuture = ex2phone.mWriteBackFutureWeeks->value(); QPtrList<Incidence> delSel; if ( mode == 1 ) delSel = mCalendar->rawIncidences(); if ( mode == 2 ) delSel = mCalendar->incidences(); CalendarLocal* cal = new CalendarLocal(); cal->setLocalTime(); Incidence *incidence = delSel.first(); QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); while ( incidence ) { - if ( incidence->type() != "journal" ) { + if ( incidence->type() != "Journal" ) { bool add = true; if ( inFuture ) { QDateTime dt; if ( incidence->type() == "Todo" ) { Todo * t = (Todo*)incidence; if ( t->hasDueDate() ) dt = t->dtDue(); else dt = cur.addSecs( 62 ); } else { bool ok; @@ -1489,24 +1507,29 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) mShowAction->setText( i18n("Edit...") ); mShowAction->setText( i18n("Delete...") ); mNewSubTodoAction->setEnabled( false ); } } void MainWindow::enableIncidenceActions( bool enabled ) { mShowAction->setEnabled( enabled ); mEditAction->setEnabled( enabled ); mDeleteAction->setEnabled( enabled ); + + mCloneAction->setEnabled( enabled ); + mMoveAction->setEnabled( enabled ); + mBeamAction->setEnabled( enabled ); + mCancelAction->setEnabled( enabled ); } void MainWindow::importOL() { #ifdef _WIN32_ KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); id->exec(); delete id; mView->updateView(); #endif } void MainWindow::importBday() diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h index 74c7f45..4f89e03 100644 --- a/korganizer/mainwindow.h +++ b/korganizer/mainwindow.h @@ -188,23 +188,29 @@ class MainWindow : public QMainWindow void keyReleaseEvent ( QKeyEvent * ) ; QPopupMenu *configureToolBarMenu; QPopupMenu *selectFilterMenu; QPopupMenu *configureAgendaMenu, *syncMenu; CalendarLocal *mCalendar; CalendarView *mView; QString getPassword(); QAction *mNewSubTodoAction; QAction *mShowAction; QAction *mEditAction; QAction *mDeleteAction; + QAction *mCloneAction; + QAction *mMoveAction; + QAction *mBeamAction; + QAction *mCancelAction; + + void closeEvent( QCloseEvent* ce ); SimpleAlarmClient mAlarmClient; QTimer mSaveTimer; bool mBlockSaveFlag; bool mCalendarModifiedFlag; QPixmap loadPixmap( QString ); QDialog * mSyncActionDialog; }; #endif |