Port to KDialogBase, accompanied with code simplifications.

Remaining bugs in the recipienteditor so far:
  - hitting enter to close completing creates new lineedit
  - removing the second-last lineedit results won't free the space it takes
  - tab ordering is foobar'd, since we do not use a layout inside the Scrollview
  - somehow we need to honor the layout outside the scrollview, and align our
    widgets accordingly, otherwise they literally look odd.

Cornelius: Feel free to work on those in case I'm not up when you are.
           I have all my local changes committed this time :)

svn path=/trunk/kdepim/; revision=376407
wilder-work
Daniel Molkentin 22 years ago
parent 8f2654cbe8
commit a3f7b6735d
  1. 50
      recipientspicker.cpp
  2. 2
      recipientspicker.h

@ -26,12 +26,13 @@
#include <klocale.h>
#include <kabc/stdaddressbook.h>
#include <kabc/resource.h>
#include <kdialog.h>
#include <kdialogbase.h>
#include <qlayout.h>
#include <qcombobox.h>
#include <qpushbutton.h>
#include <qlabel.h>
#include <qvbox.h>
RecipientItem::RecipientItem()
{
@ -106,34 +107,26 @@ RecipientItem::List RecipientsCollection::items() const
RecipientsPicker::RecipientsPicker( QWidget *parent )
: QWidget( parent )
: KDialogBase( parent, "RecipientsPicker", true, i18n( "Select Recipient" ),
KDialogBase::Ok|KDialogBase::Cancel, KDialogBase::Ok, true )
{
setCaption( i18n("Select Recipient") );
QVBox *vbox = makeVBoxMainWidget();
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 );
QHBox *hbox = new QHBox( vbox );
QLabel *label = new QLabel( i18n("Addressbook:"), hbox );
mCollectionCombo = new QComboBox( hbox );
connect( mCollectionCombo, SIGNAL( highlighted( int ) ),
SLOT( updateList() ) );
connect( mCollectionCombo, SIGNAL( activated( int ) ),
SLOT( updateList() ) );
QBoxLayout *searchLayout = new QHBoxLayout( topLayout );
label = new QLabel( i18n("Search:"), this );
searchLayout->addWidget( label );
mRecipientList = new KListView( this );
hbox = new QHBox( vbox );
label = new QLabel( i18n("Search:"), hbox );
mSearchLine = new KListViewSearchLine( hbox );
mRecipientList = new KListView( vbox );
mRecipientList->setAllColumnsShowFocus( true );
topLayout->addWidget( mRecipientList );
mRecipientList->addColumn( i18n("->") );
mRecipientList->addColumn( i18n("Name") );
mRecipientList->addColumn( i18n("Email") );
@ -142,20 +135,9 @@ RecipientsPicker::RecipientsPicker( QWidget *parent )
connect( mRecipientList, SIGNAL( returnPressed( QListViewItem * ) ),
SLOT( slotPicked( QListViewItem * ) ) );
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() ) );
mSearchLine->setListView( mRecipientList );
button = new QPushButton( i18n("&Cancel"), this );
buttonLayout->addWidget( button );
connect( button, SIGNAL( clicked() ), SLOT( close() ) );
resize( 460 , 460 );
initCollections();

@ -79,7 +79,7 @@ class RecipientsCollection
RecipientItem::List mItems;
};
class RecipientsPicker : public QWidget
class RecipientsPicker : public KDialogBase
{
Q_OBJECT
public:

Loading…
Cancel
Save