-rw-r--r-- | kaddressbook/kaddressbookview.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 6 |
5 files changed, 9 insertions, 7 deletions
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp index 8062354..424d52a 100644 --- a/kaddressbook/kaddressbookview.cpp +++ b/kaddressbook/kaddressbookview.cpp @@ -107,48 +107,52 @@ KABC::Addressee::List KAddressBookView::addressees() KABC::AddressBook::Iterator it; for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { if ( mFilter.filterAddressee( *it ) ) addresseeList.append( *it ); } return addresseeList; } void KAddressBookView::initGUI() { // Create the layout QVBoxLayout *layout = new QVBoxLayout( this ); // Add the view widget mViewWidget = new QWidget( this ); layout->addWidget( mViewWidget ); } KABC::Field::List KAddressBookView::fields() const { return mFieldList; } +KABC::Field::List KAddressBookView::allFields() const +{ + return KABC::Field::allFields(); +} void KAddressBookView::setFilter( const Filter &filter ) { mFilter = filter; } KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const { return mDefaultFilterType; } const QString &KAddressBookView::defaultFilterName() const { return mDefaultFilterName; } KABC::AddressBook *KAddressBookView::addressBook() const { return mAddressBook; } QWidget *KAddressBookView::viewWidget() { return mViewWidget; diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 2e91cbc..8646136 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h @@ -102,48 +102,50 @@ class KAddressBookView : public QWidget Returns a QString with all the selected email addresses concatenated together with a ',' seperator. */ virtual QString selectedEmails(); /** Return the type of the view: Icon, Table, etc. Please make sure that this is the same value that ViewWrapper::type() will return for your view. */ virtual QString type() const = 0; /** Returns a list of the fields that should be displayed. The list is composed of the fields proper names (ie: Home Address), so the view may need to translate them in order to get the value from the addressee. This list is generated from the config file, so it is advisable to call this method whenever a readConfig() is called in order to get the newest list of fields. */ KABC::Field::List fields() const; + KABC::Field::List allFields() const; + /** Sets the active filter. This filter will be used for filtering the list of addressees to display. The view will <b>not</b> automatically refresh itself, so in most cases you will want to call KAddressBookView::refresh() after this method. */ void setFilter( const Filter& ); /** @return The default filter type selection. If the selection is SpecificFilter, the name of the filter can be retrieved with defaultFilterName() */ DefaultFilterType defaultFilterType() const; /** @return The name of the default filter. This string is only valid if defaultFilterType() is returning SpecificFilter. */ const QString &defaultFilterName() const; /** @return The address book. */ diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 2c9b162..2d7ed08 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp @@ -274,49 +274,49 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) QString pattern = s.lower()+"*"; QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); re.setPattern( pattern ); if (!re.isValid()) return; mCardView->viewport()->setUpdatesEnabled( false ); KABC::Addressee::List addresseeList = addressees(); KABC::Addressee::List::Iterator it; if ( field ) { for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; #if QT_VERSION >= 300 if (re.search(field->value( *it ).lower()) != -1) #else if (re.match(field->value( *it ).lower()) != -1) #endif new AddresseeCardViewItem(fields(), mShowEmptyFields, addressBook(), *it, mCardView); } } else { - KABC::Field::List fieldList = fields(); + KABC::Field::List fieldList = allFields(); KABC::Field::List::ConstIterator fieldIt; for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { #if QT_VERSION >= 300 if (re.search((*fieldIt)->value( *it ).lower()) != -1) #else if (re.match((*fieldIt)->value( *it ).lower()) != -1) #endif { new AddresseeCardViewItem(fields(), mShowEmptyFields, addressBook(), *it, mCardView); continue; } } } } mCardView->viewport()->setUpdatesEnabled( true ); mCardView->viewport()->update(); if ( mCardView->firstItem() ) { mCardView->setCurrentItem ( mCardView->firstItem() ); mCardView->setSelected ( mCardView->firstItem() , true ); } diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index 0ce56c8..faeda06 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp @@ -261,49 +261,49 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) } QString pattern = s.lower()+"*"; QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); re.setPattern( pattern ); if (!re.isValid()) return; KABC::Addressee::List addresseeList = addressees(); KABC::Addressee::List::Iterator it; if ( field ) { for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; #if QT_VERSION >= 300 if (re.search(field->value( *it ).lower()) != -1) #else if (re.match(field->value( *it ).lower()) != -1) #endif mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); } } else { - KABC::Field::List fieldList = fields(); + KABC::Field::List fieldList = allFields(); KABC::Field::List::ConstIterator fieldIt; for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { #if QT_VERSION >= 300 if (re.search((*fieldIt)->value( *it ).lower()) != -1) #else if (re.match((*fieldIt)->value( *it ).lower()) != -1) #endif { mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); continue; } } } } mIconView->arrangeItemsInGrid( true ); if ( mIconView->firstItem() ) { mIconView->setCurrentItem ( mIconView->firstItem() ); mIconView->setSelected ( mIconView->firstItem() , true ); } else emit selected(QString::null); diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 89053c2..61703ee 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -142,49 +142,49 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) return; } QString pattern = s.lower()+"*"; QRegExp re; re.setWildcard(true); // most people understand these better. re.setCaseSensitive(false); re.setPattern( pattern ); if (!re.isValid()) return; KABC::Addressee::List addresseeList = addressees(); KABC::Addressee::List::Iterator it; if ( field ) { for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; #if QT_VERSION >= 300 if (re.search(field->value( *it ).lower()) != -1) #else if (re.match(field->value( *it ).lower()) != -1) #endif ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); } } else { - KABC::Field::List fieldList = fields(); + KABC::Field::List fieldList = allFields(); KABC::Field::List::ConstIterator fieldIt; for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) continue; for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { #if QT_VERSION >= 300 if (re.search((*fieldIt)->value( *it ).lower()) != -1) #else if (re.match((*fieldIt)->value( *it ).lower()) != -1) #endif { ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); break; } } } } // Sometimes the background pixmap gets messed up when we add lots // of items. mListView->repaint(); if ( mListView->firstChild() ) { mListView->setCurrentItem ( mListView->firstChild() ); mListView->setSelected ( mListView->firstChild(), true ); } @@ -237,52 +237,48 @@ void KAddressBookTableView::readConfig(KConfig *config) else { // needed if turned off during a session. //US mListView->viewport()->setPalette( mListView->palette() ); mListView->setPalette( mListView->palette() ); } //custom fonts? QFont f( font() ); if ( config->readBoolEntry( "EnableCustomFonts", false ) ) { mListView->setFont( config->readFontEntry( "TextFont", &f) ); f.setBold( true ); //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); } else { mListView->setFont( f ); f.setBold( true ); //US mListView->setHeaderFont( f ); mListView->header()->setFont( f ); } - - - - // Set the list view options mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", true)); mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); if (config->readBoolEntry("Background", false)) mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); // Restore the layout of the listview mListView->restoreLayout(config, config->group()); } void KAddressBookTableView::refresh(QString uid) { // For now just repopulate. In reality this method should // check the value of uid, and if valid iterate through // the listview to find the entry, then tell it to refresh. if (uid.isNull()) { // Clear the list view QString currentUID, nextUID; #ifndef KAB_EMBEDDED ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); |