-rw-r--r-- | bin/kdepim/WhatsNew.txt | 2 | ||||
-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 14 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 80 | ||||
-rw-r--r-- | korganizer/calendarview.h | 4 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 71 |
5 files changed, 142 insertions, 29 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 79de197..814c541 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt @@ -2,12 +2,14 @@ Info about the changes in new versions of KDE-Pim/Pi ********** VERSION 2.1.14 ************ Added some buttons to the KO/Pi Quick-todo line to make it possible to quickly access some todo view layout settings like display all flat/open/close and hide/show running/done. Added a button to add a subtodo quickly. +Added a possibility to search for conflicting events. (In the Action menu. Keyboard shortcut "q" ). + ********** VERSION 2.1.13 ************ Fixed a problem in KA/Pi search. Fixed some minor problems in KO/Pi. Added calendar selection possibility to the todo view popup and to the event/todo/journal editor. diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index bcc23dc..b225594 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1491,12 +1491,26 @@ { "Journal viewer","Journal Anzeige" }, { "Configure Calendar Files...","Konfiguriere Kalenderdateien..." }, { "You can use and display <b>more than one</b> calendar file in KO/Pi. A calendar file is called a <b>resource</b>. To add a calendar or change calendar settings please use menu: <b>View -> Toggle Resource View</b>.","Sie können <b>mehr als eine</b> Kalenderdatei in KO/Pi darstellen und benutzen. Eine Kalenderdatei wird <b>Resource</b> genannt. Um einen Kalender hinzuzufügen oder die Kalendereinstellungen zu ändern benutzen Sie bitte das Menu: <b>Ansicht -> Resourcenansicht umschalten</b>." }, { "Hide Completed","Verstecke erledigte Todos" }, { "Show not Running","Zeige nicht Laufende" }, { "Click to add new Todo","Klick für neues Todo!" }, +{ "Show next conflict for","Zeige nächsten Konflikt für" }, +{ "All events","Alle Termine" }, +{ "Allday events","Ganztagestermine" }, +{ "Events with time","Termine mit Zeit" }, +{ "No conflict found within the next two years","Kein Konflikt innerhalb der nächsten zwei Jahre gefunden" }, +{ "Conflict %1 <-> %2","Konflikt %1 <-> %2" }, +{ "<p><b>Q</b>: Show next date with conflicting events\n ","<p><b>Q</b>: Zeige nächstes Datum mit Terminen im Konflikt\n " }, +{ "","" }, +{ "","" }, +{ "","" }, +{ "","" }, +{ "","" }, +{ "","" }, +{ "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, { "","" }, diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index bc1c0c7..9a114d0 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -651,12 +651,78 @@ CalendarView::~CalendarView() delete mViewManager; delete mStorage; delete mDateFrame ; delete mEventViewerDialog; //kdDebug() << "~CalendarView() done" << endl; } +void CalendarView::nextConflict( bool all, bool allday ) +{ + QDate start = mNavigator->selectedDates().first().addDays(1); + QDate end = start.addDays( 365*2); + while ( start < end ) { + QPtrList<Event> eventList = calendar()->events( start ); + Event * ev = eventList.first(); + QPtrList<Event> test = eventList; + while ( ev ) { + //qDebug("found %d on %s ", eventList.count(), start.toString().latin1()); + Event * t_ev = test.first(); + QDateTime es = ev->dtStart(); + QDateTime ee = ev->dtEnd(); + if ( ev->doesFloat() ) + ee = ee.addDays( 1 ); + if ( ! all ) { + if ( ev->doesFloat() != allday ) + t_ev = 0; + } + while ( t_ev ) { + bool skip = false; + if ( ! all ) { + if ( t_ev->doesFloat() != allday ) + skip = true; + } + if ( !skip && ev != t_ev ) { + QDateTime ets = t_ev->dtStart(); + QDateTime ete = t_ev->dtEnd(); + if ( t_ev->doesFloat() ) + ete = ete.addDays( 1 ); + //qDebug("test %s -- %s -------- %s -- %s ", es.toString().latin1() , ee.toString().latin1(), ets.toString().latin1() , ete.toString().latin1() ); + if ( es < ete && ets < ee ) { + if ( mViewManager->currentView() != mViewManager->agendaView() || mNavigator->selectedDates().count() > 1 ) + mViewManager->showDayView(); + mNavigator->slotDaySelect( start ); + int hour = es.time().hour(); + if ( ets > es ) + hour = ets.time().hour(); + mViewManager->agendaView()->setStartHour( hour ); + topLevelWidget()->setCaption( i18n("Conflict %1 <-> %2"). arg( ev->summary().left( 20 ) ).arg( t_ev->summary().left( 20 ) ) ); + return; + } + } + t_ev = test.next(); + } + ev = eventList.next(); + } + start = start.addDays( 1 ); + } + topLevelWidget()->setCaption( i18n("No conflict found within the next two years") ); + qDebug("No conflict found "); +} + +void CalendarView::conflictAll() +{ + nextConflict ( true, true ); +} +void CalendarView::conflictAllday() +{ + nextConflict ( false, true ); +} +void CalendarView::conflictNotAll() +{ + nextConflict ( false, false ); +} + void CalendarView::setCalReadOnly( int id, bool readO ) { if ( readO ) { emit save(); } mCalendar->setReadOnly( id, readO ); @@ -3159,13 +3225,13 @@ 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("The todo\n%1\nwill be cloned!\nIt has subtodos!\nDo you want to clone\nall subtodos as well?").arg( KGlobal::formatMessage ( newInc->summary(),0 ) ), i18n("Todo has subtodos"), i18n("Yes"), i18n("No")); if ( result == KMessageBox::Cancel ) { delete t; @@ -3497,13 +3563,13 @@ void CalendarView::deleteTodo(Todo *todo) { if (!todo) { KNotifyClient::beep(); return; } if (KOPrefs::instance()->mConfirm) { - QString text = todo->summary().left(20); + QString text = KGlobal::formatMessage ( todo->summary(),0 ); if (!todo->relations().isEmpty()) { text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); } switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { case KMessageBox::Continue: // OK @@ -3543,13 +3609,13 @@ void CalendarView::deleteJournal(Journal *jour) } 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))) { + switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { case KMessageBox::Continue: // OK calendar()->deleteJournal(jour); updateView(); break; } // switch } else { @@ -3569,21 +3635,21 @@ 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().left(25) + + km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + 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().left(25) + + km = KMessageBox::warningYesNoCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + 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) { @@ -3618,13 +3684,13 @@ void CalendarView::deleteEvent(Event *anEvent) } break; //#endif } // switch } else { if (KOPrefs::instance()->mConfirm) { - switch (KMessageBox::warningContinueCancel(this,anEvent->summary().left(25) + + switch (KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + 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); @@ -4577,13 +4643,13 @@ void CalendarView::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) + + if ( KMessageBox::Continue ==KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( undo->summary(),0 ) + 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 a5f230a..51eb1d4 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -197,12 +197,16 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void calendarViewExpanded( bool ); void updateSearchDialog(); void filtersUpdated(); public slots: + void nextConflict( bool all, bool allday ); + void conflictAll(); + void conflictAllday(); + void conflictNotAll(); void setCalReadOnly( int id, bool readO ); void checkAlarms(); void checkFiles(); void slotprintSelInc(); void showNextAlarms(); void showOpenError(); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 9c2ac82..bfae1b5 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -656,12 +656,13 @@ void MainWindow::initActions() KOPrefs *p = KOPrefs::instance(); //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); QPopupMenu *viewMenu = new QPopupMenu( this ); QPopupMenu *actionMenu = new QPopupMenu( this ); mCurrentItemMenu = new QPopupMenu ( this ); + QPopupMenu *nextConflictMenu = new QPopupMenu ( this ); QPopupMenu *importMenu = new QPopupMenu( this ); QPopupMenu *importMenu_X = new QPopupMenu( this ); QPopupMenu *exportMenu_X = new QPopupMenu( this ); QPopupMenu *beamMenu_X = new QPopupMenu( this ); selectFilterMenu = new QPopupMenu( this ); selectFilterMenu->setCheckable( true ); @@ -786,21 +787,48 @@ void MainWindow::initActions() icon = loadPixmap( pathString + "search" ); QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); search_action->addTo( actionMenu ); connect( search_action, SIGNAL( activated() ), mView->dialogManager(), SLOT( showSearchDialog() ) ); + actionMenu->insertItem( i18n("Show next conflict for"), nextConflictMenu ); + action = new QAction( "Undo Delete", i18n("All events"), 0, this ); + action->addTo( nextConflictMenu ); + connect( action, SIGNAL( activated() ), + mView, SLOT( conflictAll() ) ); + + action = new QAction( "Undo Delete", i18n("Allday events"), 0, this ); + action->addTo( nextConflictMenu ); + connect( action, SIGNAL( activated() ), + mView, SLOT( conflictAllday() ) ); + + action = new QAction( "Undo Delete", i18n("Events with time"), 0, this ); + action->addTo( nextConflictMenu ); + connect( action, SIGNAL( activated() ), + mView, SLOT( conflictNotAll() ) ); + actionMenu->insertSeparator(); + icon = loadPixmap( pathString + "newevent" ); + QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); + ne_action->addTo( mCurrentItemMenu ); + connect( ne_action, SIGNAL( activated() ), + mView, SLOT( newEvent() ) ); + icon = loadPixmap( pathString + "newtodo" ); + configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); + QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); + nt_action->addTo( mCurrentItemMenu ); + connect( nt_action, SIGNAL( activated() ), + mView, SLOT( newTodo() ) ); + mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, + this ); + mNewSubTodoAction->addTo( mCurrentItemMenu ); + connect( mNewSubTodoAction, SIGNAL( activated() ), + mView, SLOT( newSubTodo() ) ); - - action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); - action->addTo( mCurrentItemMenu ); - connect( action, SIGNAL( activated() ), - mView, SLOT( undo_delete() ) ); mCurrentItemMenu->insertSeparator(); icon = loadPixmap( pathString + "newevent" ); configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); configureToolBarMenu->insertSeparator(); configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); @@ -841,24 +869,18 @@ void MainWindow::initActions() #endif mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); mCancelAction->addTo( mCurrentItemMenu ); connect( mCancelAction, SIGNAL( activated() ), mView, SLOT( toggleCancelIncidence() ) ); - 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() ) ); - icon = loadPixmap( pathString + "newtodo" ); - configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); - QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); - nt_action->addTo( actionMenu ); - connect( nt_action, SIGNAL( activated() ), - mView, SLOT( newTodo() ) ); - - + + mCurrentItemMenu->insertSeparator(); + action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); + action->addTo( mCurrentItemMenu ); + connect( action, SIGNAL( activated() ), + mView, SLOT( undo_delete() ) ); // *********************** if ( KOPrefs::instance()->mVerticalScreen ) { icon = SmallIcon( "1updownarrow" ); } else { icon = SmallIcon("1leftrightarrow" ); @@ -993,17 +1015,13 @@ void MainWindow::initActions() action = new QAction( "view_timespan", "Time Span", 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView->viewManager(), SLOT( showTimeSpanView() ) ); #endif - mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, - this ); - mNewSubTodoAction->addTo( actionMenu ); - connect( mNewSubTodoAction, SIGNAL( activated() ), - mView, SLOT( newSubTodo() ) ); + action = new QAction( "purge_completed", i18n("Purge Completed..."), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); @@ -1562,12 +1580,13 @@ void MainWindow::keyBindings() i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ i18n("<p><b>R</b>: Toggle Resource View |<b>F</b>: Edit filter </p>\n")+ i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ + i18n("<p><b>Q</b>: Show next date with conflicting events\n ")+ i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ @@ -2096,12 +2115,20 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) mView->newTodo(); else { mView->goToday(); showSelectedDates = true; } break; + case Qt::Key_Q: + if ( e->state() == Qt::ControlButton ) + mView->conflictNotAll(); + else if ( e->state() == Qt::ShiftButton ) + mView->conflictAllday(); + else + mView->conflictAll(); + break; case Qt::Key_J: mView->viewManager()->showJournalView(); break; case Qt::Key_B: mView->editIncidenceDescription();; break; |