author | zautrix <zautrix> | 2004-12-07 09:55:57 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-12-07 09:55:57 (UTC) |
commit | 17b25691f0332e648dd1d800e89ccf4e1da8955d (patch) (side-by-side diff) | |
tree | b7bc28e6c57c043fc49328a7ebd86e1b5cd0f17a | |
parent | dcd2bbbc8d3064b35f268a831c567feaafea5fd8 (diff) | |
download | kdepimpi-17b25691f0332e648dd1d800e89ccf4e1da8955d.zip kdepimpi-17b25691f0332e648dd1d800e89ccf4e1da8955d.tar.gz kdepimpi-17b25691f0332e648dd1d800e89ccf4e1da8955d.tar.bz2 |
some kopi usebility fixes
-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 | 17 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 14 | ||||
-rw-r--r-- | libkcal/incidence.h | 1 | ||||
-rw-r--r-- | version | 2 |
14 files changed, 123 insertions, 14 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,5 +1,18 @@ 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 diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 543897a..15c5dd9 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -491,6 +491,13 @@ CalendarView::~CalendarView() 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() "); @@ -2209,6 +2216,7 @@ void CalendarView::edit_options() //writeSettings(); } + void CalendarView::slotSelectPickerDate( QDate d) { mDateFrame->hide(); @@ -2229,6 +2237,19 @@ void CalendarView::slotSelectPickerDate( QDate d) 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 ); @@ -2426,6 +2447,8 @@ void CalendarView::moveIncidence(Incidence * inc ) } else { da = mMoveIncidence->dtStart().date(); } + //PENDING set date for recurring incidence to date of recurrence + //mMoveIncidenceOldDate; mDatePicker->setDate( da ); } void CalendarView::showDatePicker( ) @@ -2884,7 +2907,7 @@ void CalendarView::deleteEvent(Event *anEvent) 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 ) @@ -2892,7 +2915,7 @@ void CalendarView::deleteEvent(Event *anEvent) } 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"), @@ -2933,7 +2956,7 @@ void CalendarView::deleteEvent(Event *anEvent) } // 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 @@ -3799,3 +3822,20 @@ void CalendarView::removeSyncInfo( QString syncProfile) 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 @@ -450,6 +450,8 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void removeCategories(); void setSyncDevice( QString ); void setSyncName( QString ); + void showDay( QDate ); + void undo_delete(); protected slots: void timerAlarm(); void suspendAlarm(); @@ -554,6 +556,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser Incidence *mSelectedIncidence; Incidence *mMoveIncidence; + QDate mMoveIncidenceOldDate; KOTodoView *mTodoList; KOEventEditor * mEventEditor; KOTodoEditor * mTodoEditor; diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index f027343..46184ac 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -150,6 +150,7 @@ KOAgendaItem::~KOAgendaItem() void KOAgendaItem::recreateIncidence() { +#if 0 Incidence* newInc = mIncidence->clone(); newInc->recreate(); if ( mIncidence->doesRecur() ) { @@ -160,7 +161,8 @@ void KOAgendaItem::recreateIncidence() 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) { diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 7d1e82f..08232e2 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -281,8 +281,8 @@ MonthViewCell::MonthViewCell( KOMonthView *parent) 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 *, @@ -629,6 +629,10 @@ void MonthViewCell::defaultAction( QListBoxItem *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 ) ); @@ -729,6 +733,8 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) SLOT( defaultAction( Incidence * ) ) ); connect( cell, SIGNAL( newEventSignal( QDateTime ) ), SIGNAL( newEventSignal( QDateTime ) ) ); + connect( cell, SIGNAL( showDaySignal( QDate ) ), + SIGNAL( showDaySignal( QDate ) ) ); } } diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h index e94952f..5124057 100644 --- a/korganizer/komonthview.h +++ b/korganizer/komonthview.h @@ -143,6 +143,7 @@ class MonthViewCell : public QWidget signals: void defaultAction( Incidence * ); void newEventSignal( QDateTime ); + void showDaySignal( QDate ); protected: void resizeEvent( QResizeEvent * ); @@ -153,6 +154,7 @@ class MonthViewCell : public QWidget void selection( QListBoxItem * ); void cellClicked( QListBoxItem * ); void newEvent(); + void showDay(); private: KOMonthView *mMonthView; @@ -221,6 +223,7 @@ class KOMonthView: public KOEventView void processSelectionChange(); signals: void selectWeekNum ( int ); + void showDaySignal( QDate ); protected: void resizeEvent(QResizeEvent *); void viewChanged(); diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index 391f98c..6e151f9 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -32,6 +32,7 @@ #else #include <qapplication.h> #endif +#include <qdatetime.h> #include "calendarview.h" #include "datenavigator.h" #include "kotodoview.h" @@ -444,6 +445,8 @@ void KOViewManager::showMonthView() 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(); } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 46ae6a0..a652c05 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -576,6 +576,13 @@ void MainWindow::initActions() 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(); diff --git a/libkcal/calendar.cpp b/libkcal/calendar.cpp index 52daaaa..88351eb 100644 --- a/libkcal/calendar.cpp +++ b/libkcal/calendar.cpp @@ -52,7 +52,7 @@ void Calendar::init() { mObserver = 0; mNewObserver = false; - + mUndoIncidence = 0; mModified = false; // Setup default filter, which does nothing @@ -109,6 +109,8 @@ void Calendar::init() Calendar::~Calendar() { delete mDefaultFilter; + if ( mUndoIncidence ) + delete mUndoIncidence; } const QString &Calendar::getOwner() const @@ -116,6 +118,13 @@ 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; diff --git a/libkcal/calendar.h b/libkcal/calendar.h index b7d6a1f..2f2c3aa 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h @@ -65,6 +65,8 @@ public: Calendar(); Calendar(const QString &timeZoneId); virtual ~Calendar(); + Incidence * undoIncidence() { return mUndoIncidence; }; + bool undoDeleteIncidence(); void deleteIncidence(Incidence *in); void resetTempSyncStat(); void resetPilotStat(int id); @@ -322,6 +324,7 @@ public: virtual QPtrList<Event> rawEvents( const QDate &start, const QDate &end, bool inclusive = false ) = 0; Incidence *mNextAlarmIncidence; + Incidence *mUndoIncidence; private: void init(); diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 3f46d53..12294c0 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp @@ -152,11 +152,11 @@ bool CalendarLocal::addEvent( Event *event ) void CalendarLocal::deleteEvent( Event *event ) { - - - if ( mEventList.removeRef( event ) ) { - setModified( true ); - } + if ( mUndoIncidence ) delete mUndoIncidence; + mUndoIncidence = event->clone(); + if ( mEventList.removeRef( event ) ) { + setModified( true ); + } } @@ -201,7 +201,9 @@ bool CalendarLocal::addTodo( Todo *todo ) void CalendarLocal::deleteTodo( Todo *todo ) { // Handle orphaned children - removeRelations( todo ); + if ( mUndoIncidence ) delete mUndoIncidence; + mUndoIncidence = todo->clone(); + removeRelations( todo ); if ( mTodoList.removeRef( todo ) ) { setModified( true ); @@ -687,6 +689,9 @@ bool CalendarLocal::addJournal(Journal *journal) void CalendarLocal::deleteJournal( Journal *journal ) { + if ( mUndoIncidence ) delete mUndoIncidence; + mUndoIncidence = journal->clone(); + mUndoIncidence->setSummary( mUndoIncidence->description().left(25)); if ( mJournalList.removeRef(journal) ) { setModified( true ); } diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 5a9ef0e..28402ae 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -173,6 +173,20 @@ bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) 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() { diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 7dc6f10..1807bc4 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -122,6 +122,7 @@ class Incidence : public IncidenceBase modification date and revision number. */ void recreate(); + Incidence* recreateCloneException(QDate); /** set creation date */ void setCreated(QDateTime); @@ -1 +1 @@ -version = "1.9.14"; +version = "1.9.15"; |