-rw-r--r-- | bin/kdepim/WhatsNew.txt | 13 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 46 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 10 | ||||
-rw-r--r-- | korganizer/komonthview.h | 3 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 3 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 7 | ||||
-rw-r--r-- | libkcal/calendar.cpp | 11 | ||||
-rw-r--r-- | libkcal/calendar.h | 3 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 9 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 14 | ||||
-rw-r--r-- | libkcal/incidence.h | 1 | ||||
-rw-r--r-- | version | 2 |
14 files changed, 119 insertions, 10 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 5021212..46d59a3 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -1,10 +1,23 @@ Info about the changes in new versions of KDE-Pim/Pi +********** VERSION 1.9.15 ************ + +Usebilty enhancements in KO/Pi: +When clicking on the date in a month view cell, the day view is shown. +Old behaviour was, that the "new event" dialog popped up. + +Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). +That means, you can restore the latest +event/todo/journal you have deleted. +A journal is deleted, if you clear all the text of the journal. + + + ********** VERSION 1.9.14 ************ Fixed some problems with the dialog sizes when switching portrait/landscape mode on 640x480 PDA display. Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. Fixed an ugly bug in KOpieMail: diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 543897a..15c5dd9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -486,16 +486,23 @@ CalendarView::~CalendarView() //qDebug("CalendarView::~CalendarView() "); delete mDialogManager; delete mViewManager; delete mStorage; delete mDateFrame ; delete beamDialog; //kdDebug() << "~CalendarView() done" << endl; } + +void CalendarView::showDay( QDate d ) +{ + dateNavigator()->selectDate( d ); + mViewManager->showWeekView(); + dateNavigator()->selectDate( d ); +} void CalendarView::timerAlarm() { //qDebug("CalendarView::timerAlarm() "); computeAlarm(mAlarmNotification ); } void CalendarView::suspendAlarm() { @@ -2204,16 +2211,17 @@ void CalendarView::edit_paste() } void CalendarView::edit_options() { mDialogManager->showOptionsDialog(); //writeSettings(); } + void CalendarView::slotSelectPickerDate( QDate d) { mDateFrame->hide(); if ( mDatePickerMode == 1 ) { mNavigator->slotDaySelect( d ); } else if ( mDatePickerMode == 2 ) { if ( mMoveIncidence->type() == "Todo" ) { Todo * to = (Todo *) mMoveIncidence; @@ -2224,16 +2232,29 @@ void CalendarView::slotSelectPickerDate( QDate d) tim = QTime ( 0,0,0 ); to->setFloats( true ); to->setHasDueDate( true ); } QDateTime dt ( d,tim ); to->setDtDue( dt ); todoChanged( to ); } else { + if ( mMoveIncidence->doesRecur() ) { +#if 0 + // PENDING implement this + Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); + mCalendar()->addIncidence( newInc ); + if ( mMoveIncidence->type() == "Todo" ) + emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); + else + emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); + mMoveIncidence = newInc; + +#endif + } QTime tim = mMoveIncidence->dtStart().time(); int secs = mMoveIncidence->dtStart().secsTo( mMoveIncidence->dtEnd()); QDateTime dt ( d,tim ); mMoveIncidence->setDtStart( dt ); ((Event*)mMoveIncidence)->setDtEnd( dt.addSecs( secs ) ); changeEventDisplay((Event*)mMoveIncidence, KOGlobals::EVENTEDITED); } @@ -2421,16 +2442,18 @@ void CalendarView::moveIncidence(Incidence * inc ) Todo * to = (Todo *) mMoveIncidence; if ( to->hasDueDate() ) da = to->dtDue().date(); else da = QDate::currentDate(); } else { da = mMoveIncidence->dtStart().date(); } + //PENDING set date for recurring incidence to date of recurrence + //mMoveIncidenceOldDate; mDatePicker->setDate( da ); } void CalendarView::showDatePicker( ) { //qDebug("CalendarView::showDatePicker( ) "); if ( mDateFrame->isVisible() ) mDateFrame->hide(); else { @@ -2879,25 +2902,25 @@ void CalendarView::deleteEvent(Event *anEvent) } if (anEvent->recurrence()->doesRecur()) { QDate itemDate = mViewManager->currentSelectionDate(); int km; if (!itemDate.isValid()) { //kdDebug() << "Date Not Valid" << endl; if (KOPrefs::instance()->mConfirm) { - km = KMessageBox::warningContinueCancel(this,anEvent->summary() + + km = KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), i18n("KO/Pi Confirmation"),i18n("Delete All")); if ( km == KMessageBox::Continue ) km = KMessageBox::No; // No = all below } else km = KMessageBox::No; } else { - km = KMessageBox::warningYesNoCancel(this,anEvent->summary() + + km = KMessageBox::warningYesNoCancel(this,anEvent->summary().left(25) + i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), i18n("KO/Pi Confirmation"),i18n("Current"), i18n("All")); } switch(km) { case KMessageBox::No: // Continue // all @@ -2928,17 +2951,17 @@ void CalendarView::deleteEvent(Event *anEvent) } changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); } break; //#endif } // switch } else { if (KOPrefs::instance()->mConfirm) { - switch (KMessageBox::warningContinueCancel(this,anEvent->summary() + + switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + i18n("\nAre you sure you want\nto delete this event?"), i18n("KO/Pi Confirmation"),i18n("Delete"))) { case KMessageBox::Continue: // OK if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) schedule(Scheduler::Cancel,anEvent); checkExternalId( anEvent); mCalendar->deleteEvent(anEvent); changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); @@ -3794,8 +3817,25 @@ void CalendarView::setSyncManager(KSyncManager* manager) } void CalendarView::removeSyncInfo( QString syncProfile) { qDebug("removeSyncInfo for profile %s ", syncProfile.latin1()); mCalendar->removeSyncInfo( syncProfile ); } + +void CalendarView::undo_delete() +{ + //qDebug("undo_delete() "); + Incidence* undo = mCalendar->undoIncidence(); + if ( !undo ) { + KMessageBox::sorry(this,i18n("There is nothing to undo!"), + i18n("KO/Pi")); + return; + } + if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,undo->summary().left(25) + + i18n("\nAre you sure you want\nto restore this?"), + i18n("KO/Pi Confirmation"),i18n("Restore"))) { + mCalendar->undoDeleteIncidence(); + updateView(); + } +} diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index 437a51c..646973d 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -445,16 +445,18 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void beamCalendar() ; void beamFilteredCalendar() ; void beamIncidenceList(QPtrList<Incidence>) ; void manageCategories(); int addCategories(); void removeCategories(); void setSyncDevice( QString ); void setSyncName( QString ); + void showDay( QDate ); + void undo_delete(); protected slots: void timerAlarm(); void suspendAlarm(); void beamDone( Ir *ir ); /** Select a view or adapt the current view to display the specified dates. */ void showDates( const KCal::DateList & ); void selectWeekNum ( int ); @@ -549,16 +551,17 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser // various housekeeping variables. bool mModified; // flag indicating if calendar is modified bool mReadOnly; // flag indicating if calendar is read-only QDate mSaveSingleDate; Incidence *mSelectedIncidence; Incidence *mMoveIncidence; + QDate mMoveIncidenceOldDate; KOTodoView *mTodoList; KOEventEditor * mEventEditor; KOTodoEditor * mTodoEditor; KOEventViewerDialog * mEventViewerDialog; void keyPressEvent ( QKeyEvent *e) ; //QMap<Incidence*,KOIncidenceEditor*> mDialogList; }; diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index f027343..46184ac 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -145,27 +145,29 @@ void KOAgendaItem::init ( Incidence *incidence, QDate qd ) KOAgendaItem::~KOAgendaItem() { // qDebug("deleteKOAgendaItem::~KOAgendaItem( "); } void KOAgendaItem::recreateIncidence() { +#if 0 Incidence* newInc = mIncidence->clone(); newInc->recreate(); if ( mIncidence->doesRecur() ) { mIncidence->addExDate( mDate ); newInc->recurrence()->unsetRecurs(); int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); QTime tim = mIncidence->dtStart().time(); newInc->setDtStart( QDateTime(mDate, tim) ); ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); } - mIncidence = newInc; +#endif + mIncidence = mIncidence->recreateCloneException( mDate ); } bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) { int size = AGENDA_ICON_SIZE; int yOff = 0; int xOff = 0; int x = pos().x() +3; diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 7d1e82f..08232e2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -276,18 +276,18 @@ MonthViewCell::MonthViewCell( KOMonthView *parent) topLayout->addWidget( mItemList ); mLabel->raise(); // QColor( 0,0,255 ) QColor( 160,1600,255 ) mStandardPalette = palette(); mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); enableScrollBars( false ); updateConfig(); - connect( mLabel, SIGNAL( clicked( )), - SLOT( newEvent() )); + //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); + connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), SLOT( defaultAction( QListBoxItem * ) ) ); connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, const QPoint &) ), SLOT( contextMenu( QListBoxItem * ) ) ); connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), SLOT( selection( QListBoxItem * ) ) ); connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), @@ -624,16 +624,20 @@ void MonthViewCell::resizeEvent ( QResizeEvent * ) void MonthViewCell::defaultAction( QListBoxItem *item ) { if ( !item ) return; MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); Incidence *incidence = eventItem->incidence(); if ( incidence ) mMonthView->defaultAction( incidence ); } +void MonthViewCell::showDay() +{ + emit showDaySignal( date() ); +} void MonthViewCell::newEvent() { QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); emit newEventSignal( dt ); } void MonthViewCell::cellClicked( QListBoxItem *item ) { static QListBoxItem * lastClicked = 0; @@ -724,16 +728,18 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) for( col = 0; col < mDaysPerWeek; ++col ) { MonthViewCell *cell = new MonthViewCell( this ); mCells.insert( row * mDaysPerWeek + col, cell ); connect( cell, SIGNAL( defaultAction( Incidence * ) ), SLOT( defaultAction( Incidence * ) ) ); connect( cell, SIGNAL( newEventSignal( QDateTime ) ), SIGNAL( newEventSignal( QDateTime ) ) ); + connect( cell, SIGNAL( showDaySignal( QDate ) ), + SIGNAL( showDaySignal( QDate ) ) ); } } mContextMenu = eventPopup(); // updateConfig(); //useless here emit incidenceSelected( 0 ); } diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index e94952f..5124057 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -138,26 +138,28 @@ class MonthViewCell : public QWidget QDate selectedIncidenceDate(); void deselect(); void select(); signals: void defaultAction( Incidence * ); void newEventSignal( QDateTime ); + void showDaySignal( QDate ); protected: void resizeEvent( QResizeEvent * ); protected slots: void defaultAction( QListBoxItem * ); void contextMenu( QListBoxItem * ); void selection( QListBoxItem * ); void cellClicked( QListBoxItem * ); void newEvent(); + void showDay(); private: KOMonthView *mMonthView; QDate mDate; bool mPrimary; bool mHoliday; QString mHolidayString; @@ -216,16 +218,17 @@ class KOMonthView: public KOEventView void showContextMenu( Incidence * ); void setSelectedCell( MonthViewCell * ); protected slots: void processSelectionChange(); signals: void selectWeekNum ( int ); + void showDaySignal( QDate ); protected: void resizeEvent(QResizeEvent *); void viewChanged(); void updateDayLabels(); private: int mDaysPerWeek; int mNumWeeks; diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 391f98c..6e151f9 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -27,16 +27,17 @@ #include <kconfig.h> #include <kglobal.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #else #include <qapplication.h> #endif +#include <qdatetime.h> #include "calendarview.h" #include "datenavigator.h" #include "kotodoview.h" #include "koagendaview.h" #include "kodialogmanager.h" #include "komonthview.h" #include "kolistview.h" #include "kowhatsnextview.h" @@ -439,16 +440,18 @@ void KOViewManager::showMonthView() mMainView, SLOT ( cancelIncidence( Incidence * ) ) ); connect( mMonthView, SIGNAL( moveIncidenceSignal( Incidence * ) ), mMainView, SLOT ( moveIncidence( Incidence * ) ) ); connect( mMonthView, SIGNAL( beamIncidenceSignal( Incidence * ) ), mMainView, SLOT ( beamIncidence( Incidence * ) ) ); connect( mMonthView, SIGNAL( selectWeekNum( int ) ), mMainView, SLOT ( selectWeekNum( int ) ) ); + connect( mMonthView, SIGNAL( showDaySignal( QDate ) ), + mMainView, SLOT ( showDay( QDate ) ) ); connect(mMainView, SIGNAL(configChanged()), mMonthView, SLOT(updateConfig())); mMonthView->updateConfig(); } globalFlagBlockAgenda = 1; //mFlagShowNextxDays = false; // if(mMonthView == mCurrentView) return; mMainView->dateNavigator()->selectMonth(); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 46ae6a0..a652c05 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -571,16 +571,23 @@ void MainWindow::initActions() //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); icon = loadPixmap( pathString + "configure" ); action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( edit_options() ) ); actionMenu->insertSeparator(); + + action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); + action->addTo( actionMenu ); + connect( action, SIGNAL( activated() ), + mView, SLOT( undo_delete() ) ); + actionMenu->insertSeparator(); + icon = loadPixmap( pathString + "newevent" ); configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); configureToolBarMenu->insertSeparator(); configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); ne_action->addTo( actionMenu ); connect( ne_action, SIGNAL( activated() ), mView, SLOT( newEvent() ) ); diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index 52daaaa..88351eb 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp @@ -47,17 +47,17 @@ Calendar::Calendar( const QString &timeZoneId ) init(); setTimeZoneId(timeZoneId); } void Calendar::init() { mObserver = 0; mNewObserver = false; - + mUndoIncidence = 0; mModified = false; // Setup default filter, which does nothing mDefaultFilter = new CalFilter; mFilter = mDefaultFilter; mFilter->setEnabled(false); // initialize random numbers. This is a hack, and not @@ -104,23 +104,32 @@ void Calendar::init() #endif // KOPrefs::instance()->writeConfig(); } Calendar::~Calendar() { delete mDefaultFilter; + if ( mUndoIncidence ) + delete mUndoIncidence; } const QString &Calendar::getOwner() const { return mOwner; } +bool Calendar::undoDeleteIncidence() +{ + if (!mUndoIncidence) + return false; + addIncidence(mUndoIncidence); + mUndoIncidence = 0; +} void Calendar::setOwner(const QString &os) { int i; mOwner = os; i = mOwner.find(','); if (i != -1) mOwner = mOwner.left(i); diff --git a/libkcal/calendar.h b/libkcal/calendar.h index b7d6a1f..2f2c3aa 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -60,16 +60,18 @@ namespace KCal { class Calendar : public QObject, public CustomProperties, public IncidenceBase::Observer { Q_OBJECT public: Calendar(); Calendar(const QString &timeZoneId); virtual ~Calendar(); + Incidence * undoIncidence() { return mUndoIncidence; }; + bool undoDeleteIncidence(); void deleteIncidence(Incidence *in); void resetTempSyncStat(); void resetPilotStat(int id); /** Clears out the current calendar, freeing all used memory etc. */ virtual void close() = 0; @@ -317,16 +319,17 @@ public: bool sorted = false ) = 0; /** Get events in a range of dates. If inclusive is set to true, only events are returned, which are completely included in the range. */ virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, bool inclusive = false ) = 0; Incidence *mNextAlarmIncidence; + Incidence *mUndoIncidence; private: void init(); QString mOwner; // who the calendar belongs to QString mOwnerEmail; // email address of the owner int mTimeZone; // timezone OFFSET from GMT (MINUTES) bool mLocalTime; // use local time, not UTC or a time zone diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 3f46d53..12294c0 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -147,18 +147,18 @@ bool CalendarLocal::addEvent( Event *event ) setModified( true ); return true; } void CalendarLocal::deleteEvent( Event *event ) { - - + if ( mUndoIncidence ) delete mUndoIncidence; + mUndoIncidence = event->clone(); if ( mEventList.removeRef( event ) ) { setModified( true ); } } Event *CalendarLocal::event( const QString &uid ) { @@ -196,16 +196,18 @@ bool CalendarLocal::addTodo( Todo *todo ) setModified( true ); return true; } void CalendarLocal::deleteTodo( Todo *todo ) { // Handle orphaned children + if ( mUndoIncidence ) delete mUndoIncidence; + mUndoIncidence = todo->clone(); removeRelations( todo ); if ( mTodoList.removeRef( todo ) ) { setModified( true ); } } QPtrList<Todo> CalendarLocal::rawTodos() @@ -682,16 +684,19 @@ bool CalendarLocal::addJournal(Journal *journal) setModified( true ); return true; } void CalendarLocal::deleteJournal( Journal *journal ) { + if ( mUndoIncidence ) delete mUndoIncidence; + mUndoIncidence = journal->clone(); + mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); if ( mJournalList.removeRef(journal) ) { setModified( true ); } } Journal *CalendarLocal::journal( const QDate &date ) { // kdDebug(5800) << "CalendarLocal::journal() " << date.toString() << endl; diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 5a9ef0e..28402ae 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -168,16 +168,30 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) i1.exDates() == i2.exDates() && i1.attachments() == i2.attachments() && i1.resources() == i2.resources() && i1.secrecy() == i2.secrecy() && i1.priority() == i2.priority() && stringCompare( i1.location(), i2.location() ); } +Incidence* Incidence::recreateCloneException( QDate d ) +{ + Incidence* newInc = clone(); + newInc->recreate(); + if ( doesRecur() ) { + addExDate( d ); + newInc->recurrence()->unsetRecurs(); + int len = dtStart().secsTo( ((Event*)this)->dtEnd()); + QTime tim = dtStart().time(); + newInc->setDtStart( QDateTime(d, tim) ); + ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); + } + return newInc; +} void Incidence::recreate() { setCreated(QDateTime::currentDateTime()); setUid(CalFormat::createUniqueId()); setRevision(0); diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 7dc6f10..1807bc4 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -117,16 +117,17 @@ class Incidence : public IncidenceBase void setReadOnly( bool ); /** Recreate event. The event is made a new unique event, but already stored event information is preserved. Sets uniquie id, creation date, last modification date and revision number. */ void recreate(); + Incidence* recreateCloneException(QDate); /** set creation date */ void setCreated(QDateTime); /** return time and date of creation. */ QDateTime created() const; /** set the number of revisions this event has seen */ void setRevision(int rev); @@ -1 +1 @@ -version = "1.9.14"; +version = "1.9.15"; |