-rw-r--r-- | korganizer/calendarview.cpp | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3dac20b..1009956 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -230,8 +230,12 @@ CalendarView::CalendarView( Calendar *calendar, mEventEditor = 0; mTodoEditor = 0; - init();} + init(); +} void CalendarView::init() { + + setFocusPolicy ( WheelFocus ); + mViewerCallerIsSearchDialog = false; mBlockShowDates = false; beamDialog = new KOBeamPrefs(); @@ -2621,4 +2625,5 @@ void CalendarView::cloneIncidence(Incidence * orgInc ) } } + setActiveWindow(); } @@ -2678,4 +2683,6 @@ void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) mEventEditor->setSecrecy( filter->getSecrecy() ); } + mEventEditor->exec(); + setActiveWindow(); } void CalendarView::todoAdded(Todo * t) @@ -2714,4 +2721,6 @@ void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) mTodoEditor->setSecrecy( filter->getSecrecy() ); } + mTodoEditor->exec(); + setActiveWindow(); } @@ -2732,4 +2741,6 @@ void CalendarView::newSubTodo(Todo *parentEvent) showTodoEditor(); mTodoEditor->newTodo(QDateTime(),parentEvent,true); + mTodoEditor->exec(); + setActiveWindow(); } @@ -2754,4 +2765,7 @@ void CalendarView::editEvent( Event *event ) showEventEditor(); mEventEditor->editEvent( event , mFlagEditDescription); + mEventEditor->exec(); + setActiveWindow(); + } void CalendarView::editJournal( Journal *jour ) @@ -2772,4 +2786,6 @@ void CalendarView::editTodo( Todo *todo ) showTodoEditor(); mTodoEditor->editTodo( todo ,mFlagEditDescription); + mTodoEditor->exec(); + setActiveWindow(); } @@ -2785,4 +2801,6 @@ KOEventViewerDialog* CalendarView::getEventViewerDialog() connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), viewManager(), SLOT( showAgendaView( bool ) ) ); + connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), + this, SLOT( slotViewerClosed() ) ); connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), this, SLOT( todoChanged(Todo *) ) ); @@ -3739,4 +3757,5 @@ void CalendarView::dialogClosing(Incidence *in) void CalendarView::showIncidence() { + mViewerCallerIsSearchDialog = false; Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); @@ -3774,4 +3793,11 @@ void CalendarView::deleteIncidence() void CalendarView::showIncidence(Incidence *incidence) { + mViewerCallerIsSearchDialog = false; + //qDebug("%x %x ",sender (), mDialogManager->getSearchDialog() ); + if ( sender() && mDialogManager->getSearchDialog() ) { + if ( sender () == mDialogManager->getSearchDialog()->listview() ) { + mViewerCallerIsSearchDialog = true; + } + } if ( incidence ) { ShowIncidenceVisitor v; @@ -3923,2 +3949,26 @@ void CalendarView::undo_delete() } } + +void CalendarView::slotViewerClosed() +{ + QTimer::singleShot( 50, this, SLOT ( resetFocus() ) ); +} + +void CalendarView::resetFocus() +{ + if ( mViewerCallerIsSearchDialog ) { + if ( mDialogManager->getSearchDialog()->isVisible() ){ + mDialogManager->getSearchDialog()->raise(); + mDialogManager->getSearchDialog()->setActiveWindow(); + mDialogManager->getSearchDialog()->listview()->resetFocus(); + } else + mViewerCallerIsSearchDialog = false; + } + if ( !mViewerCallerIsSearchDialog ) { + //mViewManager->currentView()->setFocus(); + //qDebug("sssssssssssssssset focus "); + setActiveWindow(); + //setFocus(); + } + mViewerCallerIsSearchDialog = false; +} |