author | zautrix <zautrix> | 2005-07-07 00:03:44 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-07 00:03:44 (UTC) |
commit | cb350dbe9151db2ded62942d29d11d6c8b88eabd (patch) (side-by-side diff) | |
tree | 3ba8d483461e10afddb67f17cd038118d99513ef | |
parent | 93bc4dbbef774e28672c947281291b12d5971803 (diff) | |
download | kdepimpi-cb350dbe9151db2ded62942d29d11d6c8b88eabd.zip kdepimpi-cb350dbe9151db2ded62942d29d11d6c8b88eabd.tar.gz kdepimpi-cb350dbe9151db2ded62942d29d11d6c8b88eabd.tar.bz2 |
fixessss
-rw-r--r-- | korganizer/calendarview.cpp | 27 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 6 |
2 files changed, 26 insertions, 7 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 98e0ac1..bc1c0c7 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -2790,86 +2790,90 @@ void CalendarView::edit_options() void CalendarView::slotSelectPickerDate( QDate d) { mDateFrame->hide(); if ( mDatePickerMode == 1 ) { mNavigator->slotDaySelect( d ); } else if ( mDatePickerMode == 2 ) { if ( mMoveIncidence->typeID() == todoID ) { Todo * to = (Todo *) mMoveIncidence; QTime tim; int len = 0; if ( to->hasStartDate() && to->hasDueDate() ) len = to->dtStart().secsTo( to->dtDue()); if ( to->hasDueDate() ) tim = to->dtDue().time(); else { tim = QTime ( 0,0,0 ); to->setFloats( true ); to->setHasDueDate( true ); } QDateTime dt ( d,tim ); to->setDtDue( dt ); if ( to->hasStartDate() ) { if ( len>0 ) to->setDtStart(to->dtDue().addSecs( -len )); else if (to->dtStart() > to->dtDue() ) to->setDtStart(to->dtDue().addDays( -3 )); } todoChanged( to ); - } else { + } else if ( mMoveIncidence->typeID() == eventID ) { if ( mMoveIncidence->doesRecur() ) { #if 0 // PENDING implement this Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); mCalendar()->addIncidence( newInc ); if ( mMoveIncidence->typeID() == todoID ) 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); + } else if ( mMoveIncidence->typeID() == journalID ) { + QTime tim = mMoveIncidence->dtStart().time(); + QDateTime dt ( d,tim ); + mMoveIncidence->setDtStart( dt ); + updateView(); } - mMoveIncidence->setRevision( mMoveIncidence->revision()+1 ); } } void CalendarView::removeCategories() { QPtrList<Incidence> incList = mCalendar->rawIncidences(); QStringList catList = KOPrefs::instance()->mCustomCategories; QStringList catIncList; QStringList newCatList; Incidence* inc = incList.first(); uint i; while ( inc ) { newCatList.clear(); catIncList = inc->categories() ; for( i = 0; i< catIncList.count(); ++i ) { if ( catList.contains (catIncList[i])) newCatList.append( catIncList[i] ); } newCatList.sort(); inc->setCategories( newCatList.join(",") ); inc = incList.next(); } } int CalendarView::addCategories() { QPtrList<Incidence> incList = mCalendar->rawIncidences(); QStringList catList = KOPrefs::instance()->mCustomCategories; QStringList catIncList; Incidence* inc = incList.first(); uint i; @@ -3156,74 +3160,77 @@ void CalendarView::cloneIncidence(Incidence * orgInc ) if ( newInc->typeID() == todoID ) { Todo* t = (Todo*) newInc; bool cloneSub = false; if ( orgInc->relations().count() ) { int result = KMessageBox::warningYesNoCancel(this, i18n("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( newInc->summary().left ( 25 ) ), i18n("Todo has subtodos"), i18n("Yes"), i18n("No")); if ( result == KMessageBox::Cancel ) { delete t; return; } if (result == KMessageBox::Yes) cloneSub = true; } showTodoEditor(); mTodoEditor->editTodo( t ); if ( mTodoEditor->exec() ) { if ( cloneSub ) { orgInc->cloneRelations( t ); mCalendar->addIncidenceBranch( t ); updateView(); } else { mCalendar->addTodo( t ); updateView(); } } else { delete t; } } - else { + else if ( newInc->typeID() == eventID ) { Event* e = (Event*) newInc; showEventEditor(); mEventEditor->editEvent( e ); if ( mEventEditor->exec() ) { mCalendar->addEvent( e ); updateView(); } else { delete e; } + } if ( newInc->typeID() == journalID ) { + mCalendar->addJournal( (Journal*) newInc ); + editJournal( (Journal*) newInc ); } setActiveWindow(); } void CalendarView::newEvent() { // TODO: Replace this code by a common eventDurationHint of KOBaseView. KOAgendaView *aView = mViewManager->agendaView(); if (aView) { if (aView->selectionStart().isValid()) { if (aView->selectedIsAllDay()) { newEvent(aView->selectionStart(),aView->selectionEnd(),true); } else { newEvent(aView->selectionStart(),aView->selectionEnd()); } return; } } QDate date = mNavigator->selectedDates().first(); QDateTime current = QDateTime::currentDateTime(); if ( date <= current.date() ) { int hour = current.time().hour() +1; newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); } else newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), QDateTime( date, QTime( KOPrefs::instance()->mStartTime + KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); } void CalendarView::newEvent(QDateTime fh) @@ -3469,96 +3476,106 @@ void CalendarView::appointment_delete() } deleteEvent(anEvent); } void CalendarView::todo_resub( Todo * parent, Todo * sub ) { if (!sub) return; if ( sub->relatedTo() == parent ) return; sub->setRelatedTo(parent); sub->updated(); setModified(true); updateView(); } void CalendarView::todo_unsub(Todo *anTodo ) { todo_resub( 0, anTodo ); } void CalendarView::deleteTodo(Todo *todo) { if (!todo) { KNotifyClient::beep(); return; } if (KOPrefs::instance()->mConfirm) { QString text = todo->summary().left(20); if (!todo->relations().isEmpty()) { text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); } - switch (msgItemDelete(text)) { + switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { case KMessageBox::Continue: // OK bool deleteT = false; if (!todo->relations().isEmpty()) { deleteT = removeCompletedSubTodos( todo ); } // deleteT == true: todo already deleted in removeCompletedSubTodos if ( !deleteT ) { checkExternalId( todo ); calendar()->deleteTodo(todo); changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); updateView(); } break; } // switch } else { checkExternalId( todo ); mCalendar->deleteTodo(todo); changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); updateView(); } emit updateSearchDialog(); } void CalendarView::deleteJournal(Journal *jour) { if (!jour) { KNotifyClient::beep(); return; } if (KOPrefs::instance()->mConfirm) { - switch (msgItemDelete( jour->description().left(20))) { + + QString des; + if ( !jour->summary().isEmpty() ) { + des = jour->summary(); + } else { + des = jour->description().left(30); + des = des.simplifyWhiteSpace (); + des.replace (QRegExp ("\\n"),"" ); + des.replace (QRegExp ("\\r"),"" ); + } + switch (msgItemDelete( i18n("Journal:") +"\n"+des.left(20))) { case KMessageBox::Continue: // OK calendar()->deleteJournal(jour); updateView(); break; } // switch } else { calendar()->deleteJournal(jour);; updateView(); } emit updateSearchDialog(); } void CalendarView::deleteEvent(Event *anEvent) { if (!anEvent) { KNotifyClient::beep(); return; } 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().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; diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 5f90dc6..7783dd4 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -942,91 +942,93 @@ void KOListView::showDates(bool show) mListView->setColumnWidth(3, oldColWidth3); } mListView->repaint(); } void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, const QDate &td) { #ifndef KORG_NOPRINTER calPrinter->preview(CalPrinter::Day, fd, td); #endif } void KOListView::showDates() { showDates(true); } void KOListView::hideDates() { showDates(false); } void KOListView::resetFocus() { topLevelWidget()->setActiveWindow(); topLevelWidget()->raise(); mListView->setFocus(); } void KOListView::updateView() { mListView->setFocus(); - if ( mListView->firstChild () ) + if ( mListView->firstChild () ) { mListView->setCurrentItem( mListView->firstChild () ); + } + processSelectionChange( mListView->firstChild () ); } void KOListView::updateConfig() { mListView->setFont ( KOPrefs::instance()->mListViewFont ); updateView(); } void KOListView::setStartDate(const QDate &start) { mStartDate = start; } void KOListView::showDates(const QDate &start, const QDate &end) { clear(); mStartDate = start; QDate date = start; while( date <= end ) { addEvents(calendar()->events(date)); addTodos(calendar()->todos(date)); addJournals( calendar()->journals4Date(date) ); date = date.addDays( 1 ); } - emit incidenceSelected( 0 ); + //emit incidenceSelected( 0 ); updateView(); } void KOListView::addEvents(QPtrList<Event> eventList) { Event *ev; for(ev = eventList.first(); ev; ev = eventList.next()) { addIncidence(ev); } if ( !mListView->currentItem() ){ updateView(); } } void KOListView::addTodos(QPtrList<Todo> eventList) { Todo *ev; for(ev = eventList.first(); ev; ev = eventList.next()) { addIncidence(ev); } if ( !mListView->currentItem() ){ updateView(); } } void KOListView::addJournals(QPtrList<Journal> eventList) { Journal *ev; for(ev = eventList.first(); ev; ev = eventList.next()) { addIncidence(ev); } |