From 0ad4dd1f533c43c175d5592fbd2dc5f48d24dff5 Mon Sep 17 00:00:00 2001 From: Cornelius Schumacher Date: Sat, 8 Jan 2005 13:51:29 +0000 Subject: [PATCH] Fix positioning of picker. Give initial focus to search line. svn path=/trunk/kdepim/; revision=376466 --- kwindowpositioner.cpp | 11 ++++++++--- kwindowpositioner.h | 2 ++ recipientseditor.cpp | 5 +++-- recipientseditor.h | 6 ++++-- recipientspicker.cpp | 4 ++-- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/kwindowpositioner.cpp b/kwindowpositioner.cpp index a1325cd12..181628dd2 100644 --- a/kwindowpositioner.cpp +++ b/kwindowpositioner.cpp @@ -34,12 +34,17 @@ KWindowPositioner::KWindowPositioner( QWidget *master, QWidget *slave ) bool KWindowPositioner::eventFilter( QObject *, QEvent *e ) { if ( e->type() == QEvent::Move ) { - QPoint pos = mMaster->mapToGlobal( QPoint( mMaster->width(), -100 ) ); - mSlave->move( pos ); - mSlave->raise(); + reposition(); } return false; } +void KWindowPositioner::reposition() +{ + QPoint pos = mMaster->mapToGlobal( QPoint( mMaster->width(), -100 ) ); + mSlave->move( pos ); + mSlave->raise(); +} + #include "kwindowpositioner.moc" diff --git a/kwindowpositioner.h b/kwindowpositioner.h index 0e59462c7..9c33dc37a 100644 --- a/kwindowpositioner.h +++ b/kwindowpositioner.h @@ -32,6 +32,8 @@ class KWindowPositioner : public QObject KWindowPositioner( QWidget *master, QWidget *slave ); bool eventFilter( QObject *watched, QEvent *e ); + + void reposition(); private: QWidget *mMaster; diff --git a/recipientseditor.cpp b/recipientseditor.cpp index 24e881973..daf05ed1b 100644 --- a/recipientseditor.cpp +++ b/recipientseditor.cpp @@ -423,7 +423,7 @@ SideWidget::SideWidget( RecipientsView *view, QWidget *parent ) topLayout->addWidget( mTotalLabel, 1 ); mTotalLabel->hide(); - QPushButton *button = new QPushButton( "Select...", this ); + QPushButton *button = new QPushButton( "&Select...", this ); topLayout->addWidget( button ); connect( button, SIGNAL( clicked() ), SLOT( pickRecipient() ) ); @@ -438,7 +438,7 @@ void SideWidget::initRecipientPicker() connect( mRecipientPicker, SIGNAL( pickedRecipient( const QString & ) ), SIGNAL( pickedRecipient( const QString & ) ) ); - new KWindowPositioner( this, mRecipientPicker ); + mPickerPositioner = new KWindowPositioner( this, mRecipientPicker ); } void SideWidget::setTotal( int recipients, int lines ) @@ -463,6 +463,7 @@ void SideWidget::pickRecipient() mRecipientPicker->setRecipients( mView->recipients() ); mRecipientPicker->show(); mRecipientPicker->raise(); + mPickerPositioner->reposition(); #endif } diff --git a/recipientseditor.h b/recipientseditor.h index c94306744..a91be0ba2 100644 --- a/recipientseditor.h +++ b/recipientseditor.h @@ -32,6 +32,8 @@ class RecipientsPicker; +class KWindowPositioner; + class QComboBox; class QLabel; @@ -55,8 +57,7 @@ class Recipient static int typeToId( Type ); static Type idToType( int ); - QString typeLabel() const; - static QString typeLabel( Type ); + QString typeLabel() const; static QString typeLabel( Type ); static QStringList allTypeLabels(); private: @@ -188,6 +189,7 @@ class SideWidget : public QWidget RecipientsView *mView; QLabel *mTotalLabel; RecipientsPicker *mRecipientPicker; + KWindowPositioner *mPickerPositioner; }; class RecipientsEditor : public QWidget diff --git a/recipientspicker.cpp b/recipientspicker.cpp index 509188b6f..8900c1b68 100644 --- a/recipientspicker.cpp +++ b/recipientspicker.cpp @@ -137,13 +137,13 @@ RecipientsPicker::RecipientsPicker( QWidget *parent ) mSearchLine->setListView( mRecipientList ); - resize( 460 , 460 ); - initCollections(); mCollectionCombo->setCurrentItem( 0 ); updateList(); + + mSearchLine->setFocus(); } void RecipientsPicker::initCollections()