author | zautrix <zautrix> | 2005-02-23 18:47:45 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-23 18:47:45 (UTC) |
commit | 31f24d21cd23bb7e4033e7ffa000e6c979133ce7 (patch) (side-by-side diff) | |
tree | 2fa81f67efc6544a3664e6039a9602ef6f3466b9 | |
parent | faedffc5ce8391204e0340a21eaaf582319ac824 (diff) | |
download | kdepimpi-31f24d21cd23bb7e4033e7ffa000e6c979133ce7.zip kdepimpi-31f24d21cd23bb7e4033e7ffa000e6c979133ce7.tar.gz kdepimpi-31f24d21cd23bb7e4033e7ffa000e6c979133ce7.tar.bz2 |
many focus fixes
-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 @@ -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; +} diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h index e626ea3..664d700 100644 --- a/korganizer/calendarview.h +++ b/korganizer/calendarview.h @@ -457,4 +457,6 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser void undo_delete(); protected slots: + void resetFocus(); + void slotViewerClosed(); void timerAlarm(); void suspendAlarm(); @@ -496,4 +498,5 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser private: + bool mViewerCallerIsSearchDialog; bool mBlockShowDates; KSyncManager* mSyncManager; 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 @@ -21,4 +21,5 @@ #include <libkcal/event.h> +#include <qtimer.h> #include <qpushbutton.h> @@ -40,5 +41,5 @@ KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name) i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda")) { - + sendSignalViewerClosed = true; mEventViewer = new KOEventViewer(this); mEventViewer->setFont( KOPrefs::instance()->mEventViewFont ); @@ -190,4 +191,5 @@ void KOEventViewerDialog::addText(QString text) void KOEventViewerDialog::editIncidence() { + sendSignalViewerClosed = false; if ( mSyncMode ) { mSyncResult = 2; @@ -204,5 +206,5 @@ void KOEventViewerDialog::editIncidence() void KOEventViewerDialog::showIncidence() { - + sendSignalViewerClosed = false; if ( mSyncMode ) { mSyncResult = 1; @@ -265,2 +267,17 @@ 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 @@ -57,9 +57,13 @@ class KOEventViewerDialog : public KDialogBase { void showAgendaView( bool ); void todoCompleted(Todo*); + void signalViewerClosed(); private slots: + void slotViewerClosed(); void editIncidence(); void showIncidence(); - + protected: + void hideEvent ( QHideEvent * e ); private: + bool sendSignalViewerClosed; bool mSyncMode; int mSyncResult; diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 4a6e17d..6acee75 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -785,5 +785,8 @@ void KOListView::hideDates() showDates(false); } - +void KOListView::resetFocus() +{ + mListView->setFocus(); +} void KOListView::updateView() { @@ -1076,9 +1079,10 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e) KOListViewItem* ci = (KOListViewItem*)( cn ); if ( ci ){ - emit showIncidence( ci->data()); + //emit showIncidence( ci->data()); cn = cn->nextSibling(); if ( cn ) { setCurrentItem ( cn ); 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 @@ -255,4 +255,5 @@ class KOListView : public KOEventView int count(); QString getWhatsThisText(QPoint p); + void resetFocus(); signals: void signalNewEvent(); diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 3483e95..5e8ea27 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -606,4 +606,9 @@ void KOTodoView::updateView() // kdDebug() << "KOTodoView::updateView()" << endl; QFont fo = KOPrefs::instance()->mTodoViewFont; + Incidence* oldInc = 0; + mActiveItem = (KOTodoViewItem*)mTodoListView->currentItem(); + if (mActiveItem) + oldInc = mActiveItem->todo(); + mTodoListView->clear(); if ( mName == "todolistsmall" ) { @@ -687,4 +692,21 @@ void KOTodoView::updateView() mTodoListView->blockSignals( false ); 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 @@ -288,5 +288,4 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : mBRdisabled = false; //toggleBeamReceive(); - setFocusPolicy ( WheelFocus ); } MainWindow::~MainWindow() |