Go back to QWidget to be more flexible with customizing the window appearance

and give it a proper parent.

svn path=/trunk/kdepim/; revision=376668
wilder-work
Cornelius Schumacher 22 years ago
parent a4927d2b03
commit cfe63f44a6
  1. 4
      recipientseditor.cpp
  2. 57
      recipientspicker.cpp
  3. 4
      recipientspicker.h

@ -438,7 +438,7 @@ void SideWidget::initRecipientPicker()
{
if ( mRecipientPicker ) return;
mRecipientPicker = new RecipientsPicker( 0 );
mRecipientPicker = new RecipientsPicker( this );
connect( mRecipientPicker, SIGNAL( pickedRecipient( const QString & ) ),
SIGNAL( pickedRecipient( const QString & ) ) );
@ -466,8 +466,8 @@ void SideWidget::pickRecipient()
#else
mRecipientPicker->setRecipients( mView->recipients() );
mRecipientPicker->show();
mRecipientPicker->raise();
mPickerPositioner->reposition();
mRecipientPicker->raise();
#endif
}

@ -26,14 +26,13 @@
#include <klocale.h>
#include <kabc/stdaddressbook.h>
#include <kabc/resource.h>
#include <kdialogbase.h>
#include <kiconloader.h>
#include <kdialog.h>
#include <qlayout.h>
#include <qcombobox.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qvbox.h>
RecipientItem::RecipientItem()
{
@ -115,26 +114,34 @@ RecipientItem::List RecipientsCollection::items() const
RecipientsPicker::RecipientsPicker( QWidget *parent )
: KDialogBase( parent, "RecipientsPicker", true, i18n( "Select Recipient" ),
KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true )
: QWidget( parent, "RecipientsPicker", WType_Dialog )
{
QVBox *vbox = makeVBoxMainWidget();
setCaption( i18n("Select Recipient") );
QHBox *hbox = new QHBox( vbox );
QLabel *label = new QLabel( i18n("Addressbook:"), hbox );
mCollectionCombo = new QComboBox( hbox );
QBoxLayout *topLayout = new QVBoxLayout( this );
topLayout->setSpacing( KDialog::spacingHint() );
topLayout->setMargin( KDialog::marginHint() );
QBoxLayout *resLayout = new QHBoxLayout( topLayout );
QLabel *label = new QLabel( i18n("AddressBook:"), this );
resLayout->addWidget( label );
mCollectionCombo = new QComboBox( this );
resLayout->addWidget( mCollectionCombo );
connect( mCollectionCombo, SIGNAL( highlighted( int ) ),
SLOT( updateList() ) );
connect( mCollectionCombo, SIGNAL( activated( int ) ),
SLOT( updateList() ) );
hbox = new QHBox( vbox );
label = new QLabel( i18n("Search:"), hbox );
mSearchLine = new KListViewSearchLine( hbox );
mRecipientList = new KListView( vbox );
QBoxLayout *searchLayout = new QHBoxLayout( topLayout );
label = new QLabel( i18n("Search:"), this );
searchLayout->addWidget( label );
mRecipientList = new KListView( this );
mRecipientList->setAllColumnsShowFocus( true );
topLayout->addWidget( mRecipientList );
mRecipientList->addColumn( i18n("->") );
mRecipientList->addColumn( i18n("Name") );
mRecipientList->addColumn( i18n("Email") );
@ -143,7 +150,20 @@ RecipientsPicker::RecipientsPicker( QWidget *parent )
connect( mRecipientList, SIGNAL( returnPressed( QListViewItem * ) ),
SLOT( slotPicked( QListViewItem * ) ) );
mSearchLine->setListView( mRecipientList );
mSearchLine = new KListViewSearchLine( this, mRecipientList );
searchLayout->addWidget( mSearchLine );
QBoxLayout *buttonLayout = new QHBoxLayout( topLayout );
buttonLayout->addStretch( 1 );
QPushButton *button = new QPushButton( i18n("&Ok"), this );
buttonLayout->addWidget( button );
connect( button, SIGNAL( clicked() ), SLOT( slotOk() ) );
button = new QPushButton( i18n("&Cancel"), this );
buttonLayout->addWidget( button );
connect( button, SIGNAL( clicked() ), SLOT( close() ) );
initCollections();
@ -252,4 +272,11 @@ void RecipientsPicker::slotPicked( QListViewItem *viewItem )
close();
}
void RecipientsPicker::keyPressEvent( QKeyEvent *ev )
{
if ( ev->key() == Key_Escape ) close();
QWidget::keyPressEvent( ev );
}
#include "recipientspicker.moc"

@ -79,7 +79,7 @@ class RecipientsCollection
RecipientItem::List mItems;
};
class RecipientsPicker : public KDialogBase
class RecipientsPicker : public QWidget
{
Q_OBJECT
public:
@ -94,6 +94,8 @@ class RecipientsPicker : public KDialogBase
void initCollections();
void insertCollection( RecipientsCollection *coll, int index );
void keyPressEvent( QKeyEvent *ev );
protected slots:
void updateList();
void slotOk();

Loading…
Cancel
Save