-rw-r--r-- | kabc/addresseedialog.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp index e89584d..3e7b72c 100644 --- a/kabc/addresseedialog.cpp +++ b/kabc/addresseedialog.cpp @@ -43,8 +43,9 @@ AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) : mAddressee( addressee ) { setText( Name,addressee.realName()); setText( Email, addressee.preferredEmail() ); + setText( Category, addressee.categories().join(";") ); } QString AddresseeItem::key( int column, bool ) const { @@ -79,20 +80,24 @@ AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : mAddresseeList = new KListView( listWidget ); mAddresseeList->addColumn( i18n("Name") ); mAddresseeList->addColumn( i18n("Email") ); + mAddresseeList->addColumn( i18n("Category") ); mAddresseeList->setAllColumnsShowFocus( true ); mAddresseeList->setFullWidth( true ); listLayout->addWidget( mAddresseeList ); connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), SLOT( slotOk() ) ); - mAddresseeEdit = new QLineEdit( listWidget ); + QHBox* searchBox = new QHBox ( listWidget ); + mAddresseeEdit = new QLineEdit( searchBox ); connect( mAddresseeEdit, SIGNAL( returnPressed() ), SLOT( loadAddressBook() ) ); mAddresseeEdit->setFocus(); + QPushButton *searchButton = new QPushButton( i18n("Search!"), searchBox ); + connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) ); - listLayout->addWidget( mAddresseeEdit ); + listLayout->addWidget( searchBox ); if ( mMultiple ) { //QBoxLayout *selectedLayout = new QVBoxLayout; //topLayout->addLayout( selectedLayout ); @@ -106,14 +111,20 @@ AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : mSelectedList->addColumn( i18n("Name") ); mSelectedList->addColumn( i18n("Email") ); mSelectedList->setAllColumnsShowFocus( true ); mSelectedList->setFullWidth( true ); - connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), + //connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), + // SLOT( removeSelected() ) ); + connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ), + SLOT( removeSelected() ) ); + connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ), SLOT( removeSelected() ) ); +#if 0 QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); +#endif connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), SLOT( addSelected( QListViewItem * ) ) ); connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), SLOT( selectNextItem( QListViewItem * ) ) ); @@ -163,8 +174,9 @@ void AddresseeDialog::loadAddressBook() if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; QString name = (*it).realName(); name += (*it).preferredEmail(); + name += (*it).categories().join(";"); #if QT_VERSION >= 0x030000 if (re.search(name) != -1) #else if (re.match(name) != -1) |