summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp54
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
@@ -226,16 +226,20 @@ CalendarView::CalendarView( Calendar *calendar,
mCalendar( calendar ),
mResourceManager( 0 )
{
mEventEditor = 0;
mTodoEditor = 0;
- init();}
+ init();
+}
void CalendarView::init()
{
+
+ setFocusPolicy ( WheelFocus );
+ mViewerCallerIsSearchDialog = false;
mBlockShowDates = false;
beamDialog = new KOBeamPrefs();
mDatePickerMode = 0;
mCurrentSyncDevice = "";
writeLocale();
mViewManager = new KOViewManager( this );
@@ -2617,12 +2621,13 @@ void CalendarView::cloneIncidence(Incidence * orgInc )
mCalendar->addEvent( e );
updateView();
} else {
delete e;
}
}
+ setActiveWindow();
}
void CalendarView::newEvent()
{
// TODO: Replace this code by a common eventDurationHint of KOBaseView.
KOAgendaView *aView = mViewManager->agendaView();
@@ -2674,12 +2679,14 @@ void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay)
if (filter && filter->showCategories()) {
mEventEditor->setCategories(filter->categoryList().join(",") );
}
if ( filter )
mEventEditor->setSecrecy( filter->getSecrecy() );
}
+ mEventEditor->exec();
+ setActiveWindow();
}
void CalendarView::todoAdded(Todo * t)
{
changeTodoDisplay ( t ,KOGlobals::EVENTADDED);
updateTodoViews();
@@ -2710,12 +2717,14 @@ void CalendarView::newTodoDateTime( QDateTime dt, bool allday )
if (filter && filter->showCategories()) {
mTodoEditor->setCategories(filter->categoryList().join(",") );
}
if ( filter )
mTodoEditor->setSecrecy( filter->getSecrecy() );
}
+ mTodoEditor->exec();
+ setActiveWindow();
}
void CalendarView::newTodo()
{
newTodoDateTime( QDateTime(),true );
}
@@ -2727,13 +2736,15 @@ void CalendarView::newSubTodo()
}
void CalendarView::newSubTodo(Todo *parentEvent)
{
showTodoEditor();
- mTodoEditor->newTodo(QDateTime(),parentEvent,true);
+ mTodoEditor->newTodo(QDateTime(),parentEvent,true);
+ mTodoEditor->exec();
+ setActiveWindow();
}
void CalendarView::newFloatingEvent()
{
DateList tmpList = mNavigator->selectedDates();
QDate date = tmpList.first();
@@ -2750,12 +2761,15 @@ void CalendarView::editEvent( Event *event )
if ( event->isReadOnly() ) {
showEvent( event );
return;
}
showEventEditor();
mEventEditor->editEvent( event , mFlagEditDescription);
+ mEventEditor->exec();
+ setActiveWindow();
+
}
void CalendarView::editJournal( Journal *jour )
{
if ( !jour ) return;
mDialogManager->hideSearchDialog();
mViewManager->showJournalView();
@@ -2768,12 +2782,14 @@ void CalendarView::editTodo( Todo *todo )
if ( todo->isReadOnly() ) {
showTodo( todo );
return;
}
showTodoEditor();
mTodoEditor->editTodo( todo ,mFlagEditDescription);
+ mTodoEditor->exec();
+ setActiveWindow();
}
KOEventViewerDialog* CalendarView::getEventViewerDialog()
{
if ( !mEventViewerDialog ) {
@@ -2781,12 +2797,14 @@ KOEventViewerDialog* CalendarView::getEventViewerDialog()
connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) );
connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig()));
connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)),
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 );
}
return mEventViewerDialog;
@@ -3735,12 +3753,13 @@ void CalendarView::dialogClosing(Incidence *in)
{
// mDialogList.remove(in);
}
void CalendarView::showIncidence()
{
+ mViewerCallerIsSearchDialog = false;
Incidence *incidence = currentSelection();
if ( !incidence ) incidence = mTodoList->selectedIncidences().first();
if ( incidence ) {
ShowIncidenceVisitor v;
v.act( incidence, this );
}
@@ -3770,12 +3789,19 @@ void CalendarView::deleteIncidence()
deleteIncidence(incidence);
}
}
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 );
}
}
@@ -3919,6 +3945,30 @@ void CalendarView::undo_delete()
i18n("\nAre you sure you want\nto restore this?"),
i18n("KO/Pi Confirmation"),i18n("Restore"))) {
mCalendar->undoDeleteIncidence();
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;
+}