-rw-r--r-- | korganizer/calendarview.cpp | 52 | ||||
-rw-r--r-- | korganizer/calendarview.h | 3 | ||||
-rw-r--r-- | korganizer/koeventviewer.h | 0 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.cpp | 21 | ||||
-rw-r--r-- | korganizer/koeventviewerdialog.h | 6 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 8 | ||||
-rw-r--r-- | korganizer/kolistview.h | 1 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 22 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 1 |
9 files changed, 107 insertions, 7 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 3dac20b..1009956 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -231,3 +231,4 @@ CalendarView::CalendarView( Calendar *calendar, mTodoEditor = 0; - init();} + init(); +} @@ -235,2 +236,5 @@ void CalendarView::init() { + + setFocusPolicy ( WheelFocus ); + mViewerCallerIsSearchDialog = false; mBlockShowDates = false; @@ -2622,2 +2626,3 @@ void CalendarView::cloneIncidence(Incidence * orgInc ) } + setActiveWindow(); } @@ -2679,2 +2684,4 @@ void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) } + mEventEditor->exec(); + setActiveWindow(); } @@ -2715,2 +2722,4 @@ void CalendarView::newTodoDateTime( QDateTime dt, bool allday ) } + mTodoEditor->exec(); + setActiveWindow(); } @@ -2733,2 +2742,4 @@ void CalendarView::newSubTodo(Todo *parentEvent) mTodoEditor->newTodo(QDateTime(),parentEvent,true); + mTodoEditor->exec(); + setActiveWindow(); } @@ -2755,2 +2766,5 @@ void CalendarView::editEvent( Event *event ) mEventEditor->editEvent( event , mFlagEditDescription); + mEventEditor->exec(); + setActiveWindow(); + } @@ -2773,2 +2787,4 @@ void CalendarView::editTodo( Todo *todo ) mTodoEditor->editTodo( todo ,mFlagEditDescription); + mTodoEditor->exec(); + setActiveWindow(); @@ -2786,2 +2802,4 @@ KOEventViewerDialog* CalendarView::getEventViewerDialog() viewManager(), SLOT( showAgendaView( bool ) ) ); + connect( mEventViewerDialog, SIGNAL(signalViewerClosed()), + this, SLOT( slotViewerClosed() ) ); connect( mEventViewerDialog, SIGNAL( todoCompleted(Todo *) ), @@ -3740,2 +3758,3 @@ void CalendarView::showIncidence() { + mViewerCallerIsSearchDialog = false; Incidence *incidence = currentSelection(); @@ -3775,2 +3794,9 @@ 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 ) { @@ -3924 +3950,25 @@ 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; +} diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index e626ea3..664d700 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -458,2 +458,4 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser protected slots: + void resetFocus(); + void slotViewerClosed(); void timerAlarm(); @@ -497,2 +499,3 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser private: + bool mViewerCallerIsSearchDialog; bool mBlockShowDates; diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index d8142ca..2d4a08e 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp index 23e62d3..8bada3b 100644 --- a/korganizer/koeventviewerdialog.cpp +++ b/korganizer/koeventviewerdialog.cpp @@ -22,2 +22,3 @@ #include <libkcal/event.h> +#include <qtimer.h> #include <qpushbutton.h> @@ -41,3 +42,3 @@ KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) { - + sendSignalViewerClosed = true; mEventViewer = new KOEventViewer(this); @@ -191,2 +192,3 @@ void KOEventViewerDialog::editIncidence() { + sendSignalViewerClosed = false; if ( mSyncMode ) { @@ -205,3 +207,3 @@ void KOEventViewerDialog::showIncidence() { - + sendSignalViewerClosed = false; if ( mSyncMode ) { @@ -266 +268,16 @@ void KOEventViewerDialog::keyPressEvent ( QKeyEvent * e ) } +void KOEventViewerDialog::hideEvent ( QHideEvent * e ) +{ + KDialogBase::hideEvent ( e ); + QTimer::singleShot( 1, this, SLOT (slotViewerClosed() ) ); +} + +void KOEventViewerDialog::slotViewerClosed() +{ + if ( sendSignalViewerClosed ) { + //qDebug("KOEventViewerDialog::hideEvent "); + emit signalViewerClosed(); + } + sendSignalViewerClosed = true; +} + diff --git a/korganizer/koeventviewerdialog.h b/korganizer/koeventviewerdialog.h index b6b4103..36431ad 100644 --- a/korganizer/koeventviewerdialog.h +++ b/korganizer/koeventviewerdialog.h @@ -58,7 +58,11 @@ class KOEventViewerDialog : public KDialogBase { void todoCompleted(Todo*); + void signalViewerClosed(); private slots: + void slotViewerClosed(); void editIncidence(); void showIncidence(); - + protected: + void hideEvent ( QHideEvent * e ); private: + bool sendSignalViewerClosed; bool mSyncMode; diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 4a6e17d..6acee75 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -786,3 +786,6 @@ void KOListView::hideDates() } - +void KOListView::resetFocus() +{ + mListView->setFocus(); +} void KOListView::updateView() @@ -1077,3 +1080,3 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) if ( ci ){ - emit showIncidence( ci->data()); + //emit showIncidence( ci->data()); cn = cn->nextSibling(); @@ -1082,2 +1085,3 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) ensureItemVisible ( cn ); + emit showIncidence( ci->data()); } diff --git a/korganizer/kolistview.h b/korganizer/kolistview.h index bd5bd12..c86449d 100644 --- a/korganizer/kolistview.h +++ b/korganizer/kolistview.h @@ -256,2 +256,3 @@ class KOListView : public KOEventView QString getWhatsThisText(QPoint p); + void resetFocus(); signals: diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 3483e95..5e8ea27 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -607,2 +607,7 @@ void KOTodoView::updateView() QFont fo = KOPrefs::instance()->mTodoViewFont; + Incidence* oldInc = 0; + mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); + if (mActiveItem) + oldInc = mActiveItem->todo(); + mTodoListView->clear(); @@ -688,2 +693,19 @@ void KOTodoView::updateView() mTodoListView->setFocus(); + if ( mTodoListView->firstChild () ) { + if ( oldInc ) { + KOTodoViewItem* item = (KOTodoViewItem*)mTodoListView->firstChild (); + while ( item ) { + if ( item->todo() == oldInc ) { + mTodoListView->setCurrentItem( item ); + mTodoListView->ensureItemVisible( item ); + break; + } + item = (KOTodoViewItem*)item->itemBelow(); + } + if ( ! item ) + mTodoListView->setCurrentItem( mTodoListView->firstChild () ); + } else { + mTodoListView->setCurrentItem( mTodoListView->firstChild () ); + } + } processSelectionChange(); diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 4f2cccf..2de7f28 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -289,3 +289,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : //toggleBeamReceive(); - setFocusPolicy ( WheelFocus ); } |