summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-23 18:47:45 (UTC)
committer zautrix <zautrix>2005-02-23 18:47:45 (UTC)
commit31f24d21cd23bb7e4033e7ffa000e6c979133ce7 (patch) (side-by-side diff)
tree2fa81f67efc6544a3664e6039a9602ef6f3466b9
parentfaedffc5ce8391204e0340a21eaaf582319ac824 (diff)
downloadkdepimpi-31f24d21cd23bb7e4033e7ffa000e6c979133ce7.zip
kdepimpi-31f24d21cd23bb7e4033e7ffa000e6c979133ce7.tar.gz
kdepimpi-31f24d21cd23bb7e4033e7ffa000e6c979133ce7.tar.bz2
many focus fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp54
-rw-r--r--korganizer/calendarview.h3
-rw-r--r--korganizer/koeventviewer.h2
-rw-r--r--korganizer/koeventviewerdialog.cpp21
-rw-r--r--korganizer/koeventviewerdialog.h10
-rw-r--r--korganizer/kolistview.cpp8
-rw-r--r--korganizer/kolistview.h1
-rw-r--r--korganizer/kotodoview.cpp22
-rw-r--r--korganizer/mainwindow.cpp1
9 files changed, 111 insertions, 11 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;
+}
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index e626ea3..664d700 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -456,6 +456,8 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
void showDay( QDate );
void undo_delete();
protected slots:
+ void resetFocus();
+ void slotViewerClosed();
void timerAlarm();
void suspendAlarm();
void beamDone( Ir *ir );
@@ -495,6 +497,7 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
Todo *selectedTodo();
private:
+ bool mViewerCallerIsSearchDialog;
bool mBlockShowDates;
KSyncManager* mSyncManager;
AlarmDialog * mAlarmDialog;
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index d8142ca..2d4a08e 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -70,7 +70,7 @@ class KOEventViewer : public QTextBrowser {
QString mMailSubject;
Incidence* mCurrentIncidence;
signals:
- void launchaddressbook(QString uid);
+ void launchaddressbook(QString uid);
};
#endif
diff --git a/korganizer/koeventviewerdialog.cpp b/korganizer/koeventviewerdialog.cpp
index 23e62d3..8bada3b 100644
--- a/korganizer/koeventviewerdialog.cpp
+++ b/korganizer/koeventviewerdialog.cpp
@@ -20,6 +20,7 @@
#include <klocale.h>
#include <libkcal/event.h>
+#include <qtimer.h>
#include <qpushbutton.h>
#include "koeventviewer.h"
@@ -39,7 +40,7 @@ KOEventViewerDialog::KOEventViewerDialog(QWidget *parent,const char *name)
#endif
i18n("Event Viewer"),Ok|User1|Close,Close, false, i18n("Agenda"))
{
-
+ sendSignalViewerClosed = true;
mEventViewer = new KOEventViewer(this);
mEventViewer->setFont( KOPrefs::instance()->mEventViewFont );
setMainWidget(mEventViewer);
@@ -189,6 +190,7 @@ void KOEventViewerDialog::addText(QString text)
}
void KOEventViewerDialog::editIncidence()
{
+ sendSignalViewerClosed = false;
if ( mSyncMode ) {
mSyncResult = 2;
accept();
@@ -203,7 +205,7 @@ void KOEventViewerDialog::editIncidence()
}
void KOEventViewerDialog::showIncidence()
{
-
+ sendSignalViewerClosed = false;
if ( mSyncMode ) {
mSyncResult = 1;
accept();
@@ -264,3 +266,18 @@ 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
@@ -55,12 +55,16 @@ class KOEventViewerDialog : public KDialogBase {
void editIncidence( Incidence* );
void jumpToTime( const QDate &);
void showAgendaView( bool );
- void todoCompleted(Todo*);
+ void todoCompleted(Todo*);
+ void signalViewerClosed();
private slots:
+ void slotViewerClosed();
void editIncidence();
- void showIncidence();
-
+ void showIncidence();
+ protected:
+ void hideEvent ( QHideEvent * e );
private:
+ bool sendSignalViewerClosed;
bool mSyncMode;
int mSyncResult;
KOEventViewer *mEventViewer;
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index 4a6e17d..6acee75 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -784,7 +784,10 @@ void KOListView::hideDates()
{
showDates(false);
}
-
+void KOListView::resetFocus()
+{
+ mListView->setFocus();
+}
void KOListView::updateView()
{
mListView->setFocus();
@@ -1075,11 +1078,12 @@ void KOListViewListView::keyPressEvent ( QKeyEvent *e)
if ( cn ) {
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
@@ -254,6 +254,7 @@ class KOListView : public KOEventView
void setStartDate(const QDate &start);
int count();
QString getWhatsThisText(QPoint p);
+ void resetFocus();
signals:
void signalNewEvent();
void beamIncidenceList(QPtrList<Incidence>);
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp
index 3483e95..5e8ea27 100644
--- a/korganizer/kotodoview.cpp
+++ b/korganizer/kotodoview.cpp
@@ -605,6 +605,11 @@ void KOTodoView::updateView()
//qDebug("update ");
// 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" ) {
if ( KOPrefs::instance()->mTodoViewUsesSmallFont ) {
@@ -686,6 +691,23 @@ void KOTodoView::updateView()
if( mDocPrefs ) restoreItemState( mTodoListView->firstChild() );
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
@@ -287,7 +287,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
SLOT( updateWeekNum( const KCal::DateList & ) ) );
mBRdisabled = false;
//toggleBeamReceive();
- setFocusPolicy ( WheelFocus );
}
MainWindow::~MainWindow()
{