-rw-r--r-- | korganizer/calendarview.cpp | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3dac20b..1009956 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -229,10 +229,14 @@ CalendarView::CalendarView( Calendar *calendar, mEventEditor = 0; mTodoEditor = 0; - init();} + init(); +} void CalendarView::init() { + + setFocusPolicy ( WheelFocus ); + mViewerCallerIsSearchDialog = false; mBlockShowDates = false; beamDialog = new KOBeamPrefs(); mDatePickerMode = 0; @@ -2620,6 +2624,7 @@ void CalendarView::cloneIncidence(Incidence * orgInc ) delete e; } } + setActiveWindow(); } void CalendarView::newEvent() @@ -2677,6 +2682,8 @@ void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) if ( filter ) mEventEditor->setSecrecy( filter->getSecrecy() ); } + mEventEditor->exec(); + setActiveWindow(); } void CalendarView::todoAdded(Todo * t) { @@ -2713,6 +2720,8 @@ void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) if ( filter ) mTodoEditor->setSecrecy( filter->getSecrecy() ); } + mTodoEditor->exec(); + setActiveWindow(); } void CalendarView::newTodo() @@ -2730,7 +2739,9 @@ void CalendarView::newSubTodo(Todo *parentEvent) { showTodoEditor(); - mTodoEditor->newTodo(QDateTime(),parentEvent,true); + mTodoEditor->newTodo(QDateTime(),parentEvent,true); + mTodoEditor->exec(); + setActiveWindow(); } void CalendarView::newFloatingEvent() @@ -2753,6 +2764,9 @@ void CalendarView::editEvent( Event *event ) } showEventEditor(); mEventEditor->editEvent( event , mFlagEditDescription); + mEventEditor->exec(); + setActiveWindow(); + } void CalendarView::editJournal( Journal *jour ) { @@ -2771,6 +2785,8 @@ void CalendarView::editTodo( Todo *todo ) } showTodoEditor(); mTodoEditor->editTodo( todo ,mFlagEditDescription); + mTodoEditor->exec(); + setActiveWindow(); } @@ -2784,6 +2800,8 @@ KOEventViewerDialog* CalendarView::getEventViewerDialog() dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); 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 *) ) ); mEventViewerDialog->resize( 640, 480 ); @@ -3738,6 +3756,7 @@ void CalendarView::dialogClosing(Incidence *in) void CalendarView::showIncidence() { + mViewerCallerIsSearchDialog = false; Incidence *incidence = currentSelection(); if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); if ( incidence ) { @@ -3773,6 +3792,13 @@ 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; v.act( incidence, this ); @@ -3922,3 +3948,27 @@ void CalendarView::undo_delete() updateView(); } } + +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; +} |