summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-01-12 20:38:44 (UTC)
committer zautrix <zautrix>2005-01-12 20:38:44 (UTC)
commit7a4a866cded40032766acb4fe8d02b6347b1d12e (patch) (unidiff)
tree14cced6e387842839616cd6727b40a522586c364 /kaddressbook
parentffa81b34b0d7b3c53f46869a05194072a339a69d (diff)
downloadkdepimpi-7a4a866cded40032766acb4fe8d02b6347b1d12e.zip
kdepimpi-7a4a866cded40032766acb4fe8d02b6347b1d12e.tar.gz
kdepimpi-7a4a866cded40032766acb4fe8d02b6347b1d12e.tar.bz2
search fixes
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kaddressbookview.cpp4
-rw-r--r--kaddressbook/kaddressbookview.h2
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp2
-rw-r--r--kaddressbook/views/kaddressbookiconview.cpp2
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp6
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
@@ -35,132 +35,136 @@
35 35
36#include <kabc/distributionlistdialog.h> 36#include <kabc/distributionlistdialog.h>
37#include <kabc/addressbook.h> 37#include <kabc/addressbook.h>
38#include <kdebug.h> 38#include <kdebug.h>
39 39
40#include "kaddressbookview.h" 40#include "kaddressbookview.h"
41 41
42KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, 42KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent,
43 const char *name ) 43 const char *name )
44 : QWidget( parent, name ), mAddressBook( ab ), mFieldList() 44 : QWidget( parent, name ), mAddressBook( ab ), mFieldList()
45{ 45{
46 46
47 initGUI(); 47 initGUI();
48} 48}
49 49
50KAddressBookView::~KAddressBookView() 50KAddressBookView::~KAddressBookView()
51{ 51{
52 kdDebug(5720) << "KAddressBookView::~KAddressBookView: destroying - " 52 kdDebug(5720) << "KAddressBookView::~KAddressBookView: destroying - "
53 << name() << endl; 53 << name() << endl;
54} 54}
55 55
56void KAddressBookView::readConfig( KConfig *config ) 56void KAddressBookView::readConfig( KConfig *config )
57{ 57{
58 mFieldList = KABC::Field::restoreFields( config, "KABCFields" ); 58 mFieldList = KABC::Field::restoreFields( config, "KABCFields" );
59 59
60 if ( mFieldList.isEmpty() ) 60 if ( mFieldList.isEmpty() )
61 mFieldList = KABC::Field::defaultFields(); 61 mFieldList = KABC::Field::defaultFields();
62 62
63 mDefaultFilterType = (DefaultFilterType)config->readNumEntry( "DefaultFilterType", 1 ); 63 mDefaultFilterType = (DefaultFilterType)config->readNumEntry( "DefaultFilterType", 1 );
64 mDefaultFilterName = config->readEntry( "DefaultFilterName", QString::null ); 64 mDefaultFilterName = config->readEntry( "DefaultFilterName", QString::null );
65} 65}
66 66
67void KAddressBookView::writeConfig( KConfig* ) 67void KAddressBookView::writeConfig( KConfig* )
68{ 68{
69 // Most of writing the config is handled by the ConfigureViewDialog 69 // Most of writing the config is handled by the ConfigureViewDialog
70} 70}
71 71
72QString KAddressBookView::selectedEmails() 72QString KAddressBookView::selectedEmails()
73{ 73{
74 bool first = true; 74 bool first = true;
75 QString emailAddrs; 75 QString emailAddrs;
76 QStringList uidList = selectedUids(); 76 QStringList uidList = selectedUids();
77 KABC::Addressee addr; 77 KABC::Addressee addr;
78 QString email; 78 QString email;
79 79
80 QStringList::Iterator it; 80 QStringList::Iterator it;
81 for ( it = uidList.begin(); it != uidList.end(); ++it ) { 81 for ( it = uidList.begin(); it != uidList.end(); ++it ) {
82 addr = mAddressBook->findByUid( *it ); 82 addr = mAddressBook->findByUid( *it );
83 83
84 if ( !addr.isEmpty() ) { 84 if ( !addr.isEmpty() ) {
85 QString m = QString::null; 85 QString m = QString::null;
86 86
87 if ( addr.emails().count() > 1 ) 87 if ( addr.emails().count() > 1 )
88 m = KABC::EmailSelector::getEmail( addr.emails(), addr.preferredEmail(), this ); 88 m = KABC::EmailSelector::getEmail( addr.emails(), addr.preferredEmail(), this );
89 89
90 email = addr.fullEmail( m ); 90 email = addr.fullEmail( m );
91 91
92 if ( !first ) 92 if ( !first )
93 emailAddrs += ", "; 93 emailAddrs += ", ";
94 else 94 else
95 first = false; 95 first = false;
96 96
97 emailAddrs += email; 97 emailAddrs += email;
98 } 98 }
99 } 99 }
100 100
101 return emailAddrs; 101 return emailAddrs;
102} 102}
103 103
104KABC::Addressee::List KAddressBookView::addressees() 104KABC::Addressee::List KAddressBookView::addressees()
105{ 105{
106 KABC::Addressee::List addresseeList; 106 KABC::Addressee::List addresseeList;
107 107
108 KABC::AddressBook::Iterator it; 108 KABC::AddressBook::Iterator it;
109 for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { 109 for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) {
110 if ( mFilter.filterAddressee( *it ) ) 110 if ( mFilter.filterAddressee( *it ) )
111 addresseeList.append( *it ); 111 addresseeList.append( *it );
112 } 112 }
113 113
114 return addresseeList; 114 return addresseeList;
115} 115}
116 116
117void KAddressBookView::initGUI() 117void KAddressBookView::initGUI()
118{ 118{
119 // Create the layout 119 // Create the layout
120 QVBoxLayout *layout = new QVBoxLayout( this ); 120 QVBoxLayout *layout = new QVBoxLayout( this );
121 121
122 // Add the view widget 122 // Add the view widget
123 mViewWidget = new QWidget( this ); 123 mViewWidget = new QWidget( this );
124 layout->addWidget( mViewWidget ); 124 layout->addWidget( mViewWidget );
125} 125}
126 126
127KABC::Field::List KAddressBookView::fields() const 127KABC::Field::List KAddressBookView::fields() const
128{ 128{
129 return mFieldList; 129 return mFieldList;
130} 130}
131KABC::Field::List KAddressBookView::allFields() const
132{
133 return KABC::Field::allFields();
134}
131 135
132void KAddressBookView::setFilter( const Filter &filter ) 136void KAddressBookView::setFilter( const Filter &filter )
133{ 137{
134 mFilter = filter; 138 mFilter = filter;
135} 139}
136 140
137KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const 141KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const
138{ 142{
139 return mDefaultFilterType; 143 return mDefaultFilterType;
140} 144}
141 145
142const QString &KAddressBookView::defaultFilterName() const 146const QString &KAddressBookView::defaultFilterName() const
143{ 147{
144 return mDefaultFilterName; 148 return mDefaultFilterName;
145} 149}
146 150
147KABC::AddressBook *KAddressBookView::addressBook() const 151KABC::AddressBook *KAddressBookView::addressBook() const
148{ 152{
149 return mAddressBook; 153 return mAddressBook;
150} 154}
151 155
152QWidget *KAddressBookView::viewWidget() 156QWidget *KAddressBookView::viewWidget()
153{ 157{
154 return mViewWidget; 158 return mViewWidget;
155} 159}
156 160
157ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, 161ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab,
158 QWidget *parent, 162 QWidget *parent,
159 const char *name ) 163 const char *name )
160{ 164{
161 return new ViewConfigureWidget( ab, parent, name ); 165 return new ViewConfigureWidget( ab, parent, name );
162} 166}
163 167
164#ifndef KAB_EMBEDDED 168#ifndef KAB_EMBEDDED
165#include "kaddressbookview.moc" 169#include "kaddressbookview.moc"
166#endif //KAB_EMBEDDED 170#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index 2e91cbc..8646136 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -29,192 +29,194 @@
29#endif //KAB_EMBEDDED 29#endif //KAB_EMBEDDED
30 30
31class KConfig; 31class KConfig;
32class QDropEvent; 32class QDropEvent;
33 33
34#include <qstringlist.h> 34#include <qstringlist.h>
35#include <kabc/field.h> 35#include <kabc/field.h>
36#include <qwidget.h> 36#include <qwidget.h>
37 37
38#include "viewconfigurewidget.h" 38#include "viewconfigurewidget.h"
39#include "filter.h" 39#include "filter.h"
40 40
41namespace KABC { class AddressBook; } 41namespace KABC { class AddressBook; }
42 42
43/** 43/**
44 Base class for all views in kaddressbook. This class implements 44 Base class for all views in kaddressbook. This class implements
45 all the common methods needed to provide a view to the user. 45 all the common methods needed to provide a view to the user.
46 46
47 To implement a specific view (table, card, etc), just inherit from 47 To implement a specific view (table, card, etc), just inherit from
48 this class and implement all the pure virtuals. 48 this class and implement all the pure virtuals.
49 49
50 @author Mike Pilone <mpilone@slac.com> 50 @author Mike Pilone <mpilone@slac.com>
51 */ 51 */
52class KAddressBookView : public QWidget 52class KAddressBookView : public QWidget
53{ 53{
54 Q_OBJECT 54 Q_OBJECT
55 55
56 public: 56 public:
57 enum DefaultFilterType { None = 0, Active = 1, Specific = 2 }; 57 enum DefaultFilterType { None = 0, Active = 1, Specific = 2 };
58 58
59 KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name ); 59 KAddressBookView( KABC::AddressBook *ab, QWidget *parent, const char *name );
60 virtual ~KAddressBookView(); 60 virtual ~KAddressBookView();
61 61
62 /** 62 /**
63 Must be overloaded in subclasses. Should return a list of 63 Must be overloaded in subclasses. Should return a list of
64 all the uids of selected contacts. 64 all the uids of selected contacts.
65 */ 65 */
66 virtual QStringList selectedUids() = 0; 66 virtual QStringList selectedUids() = 0;
67 virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; 67 virtual void doSearch( const QString& s ,KABC::Field *field ) = 0;
68 virtual void scrollUP() = 0; 68 virtual void scrollUP() = 0;
69 virtual void scrollDOWN() = 0; 69 virtual void scrollDOWN() = 0;
70 virtual void setFocusAV() = 0; 70 virtual void setFocusAV() = 0;
71 71
72 /** 72 /**
73 Called whenever this view should read the config. This can be used 73 Called whenever this view should read the config. This can be used
74 as a sign that the config has changed, therefore the view should 74 as a sign that the config has changed, therefore the view should
75 assume the worst and rebuild itself if necessary. For example, 75 assume the worst and rebuild itself if necessary. For example,
76 in a table view this method may be called when the user adds or 76 in a table view this method may be called when the user adds or
77 removes columns from the view. 77 removes columns from the view.
78 78
79 If overloaded in the subclass, do not forget to call super class's 79 If overloaded in the subclass, do not forget to call super class's
80 method. 80 method.
81 81
82 @param config The KConfig object to read from. The group will already 82 @param config The KConfig object to read from. The group will already
83 be set, so do not change the group. 83 be set, so do not change the group.
84 */ 84 */
85 virtual void readConfig( KConfig *config ); 85 virtual void readConfig( KConfig *config );
86 86
87 /** 87 /**
88 Called whenever this view should write the config. The view should not 88 Called whenever this view should write the config. The view should not
89 write out information handled by the application, such as which fields 89 write out information handled by the application, such as which fields
90 are visible. The view should only write out information specific 90 are visible. The view should only write out information specific
91 to itself (i.e.: All information in the ViewConfigWidget) 91 to itself (i.e.: All information in the ViewConfigWidget)
92 92
93 If overloaded in the subclass, do not forget to call the super class's 93 If overloaded in the subclass, do not forget to call the super class's
94 method. 94 method.
95 95
96 @param config The KConfig object to read from. The group will already 96 @param config The KConfig object to read from. The group will already
97 be set, so do not change the group. 97 be set, so do not change the group.
98 */ 98 */
99 virtual void writeConfig( KConfig *config ); 99 virtual void writeConfig( KConfig *config );
100 100
101 /** 101 /**
102 Returns a QString with all the selected email addresses concatenated 102 Returns a QString with all the selected email addresses concatenated
103 together with a ',' seperator. 103 together with a ',' seperator.
104 */ 104 */
105 virtual QString selectedEmails(); 105 virtual QString selectedEmails();
106 106
107 /** 107 /**
108 Return the type of the view: Icon, Table, etc. Please make sure that 108 Return the type of the view: Icon, Table, etc. Please make sure that
109 this is the same value that ViewWrapper::type() will return for your 109 this is the same value that ViewWrapper::type() will return for your
110 view. 110 view.
111 */ 111 */
112 virtual QString type() const = 0; 112 virtual QString type() const = 0;
113 113
114 /** 114 /**
115 Returns a list of the fields that should be displayed. The list 115 Returns a list of the fields that should be displayed. The list
116 is composed of the fields proper names (ie: Home Address), so 116 is composed of the fields proper names (ie: Home Address), so
117 the view may need to translate them in order to get the 117 the view may need to translate them in order to get the
118 value from the addressee. 118 value from the addressee.
119 119
120 This list is generated from the config file, so it is advisable to call 120 This list is generated from the config file, so it is advisable to call
121 this method whenever a readConfig() is called in order to get the newest 121 this method whenever a readConfig() is called in order to get the newest
122 list of fields. 122 list of fields.
123 */ 123 */
124 KABC::Field::List fields() const; 124 KABC::Field::List fields() const;
125
126 KABC::Field::List allFields() const;
125 127
126 /** 128 /**
127 Sets the active filter. This filter will be used for filtering 129 Sets the active filter. This filter will be used for filtering
128 the list of addressees to display. The view will <b>not</b> 130 the list of addressees to display. The view will <b>not</b>
129 automatically refresh itself, so in most cases you will want to call 131 automatically refresh itself, so in most cases you will want to call
130 KAddressBookView::refresh() after this method. 132 KAddressBookView::refresh() after this method.
131 */ 133 */
132 void setFilter( const Filter& ); 134 void setFilter( const Filter& );
133 135
134 /** 136 /**
135 @return The default filter type selection. If the selection 137 @return The default filter type selection. If the selection
136 is SpecificFilter, the name of the filter can be retrieved with 138 is SpecificFilter, the name of the filter can be retrieved with
137 defaultFilterName() 139 defaultFilterName()
138 */ 140 */
139 DefaultFilterType defaultFilterType() const; 141 DefaultFilterType defaultFilterType() const;
140 142
141 /** 143 /**
142 @return The name of the default filter. This string is 144 @return The name of the default filter. This string is
143 only valid if defaultFilterType() is returning SpecificFilter. 145 only valid if defaultFilterType() is returning SpecificFilter.
144 */ 146 */
145 const QString &defaultFilterName() const; 147 const QString &defaultFilterName() const;
146 148
147 /** 149 /**
148 @return The address book. 150 @return The address book.
149 */ 151 */
150 KABC::AddressBook *addressBook() const; 152 KABC::AddressBook *addressBook() const;
151 153
152 public slots: 154 public slots:
153 /** 155 /**
154 Must be overloaded in subclasses to refresh the view. 156 Must be overloaded in subclasses to refresh the view.
155 Refreshing includes updating the view to ensure that only items 157 Refreshing includes updating the view to ensure that only items
156 in the document are visible. If <i>uid</i> is valid, only the 158 in the document are visible. If <i>uid</i> is valid, only the
157 addressee with uid needs to be refreshed. This is an optimization 159 addressee with uid needs to be refreshed. This is an optimization
158 only. 160 only.
159 */ 161 */
160 virtual void refresh( QString uid = QString::null ) = 0; 162 virtual void refresh( QString uid = QString::null ) = 0;
161 163
162 /** 164 /**
163 This method must be overloaded in subclasses. Select (highlight) 165 This method must be overloaded in subclasses. Select (highlight)
164 the addressee matching <i>uid</i>. If uid 166 the addressee matching <i>uid</i>. If uid
165 is equal to QString::null, then all addressees should be selected. 167 is equal to QString::null, then all addressees should be selected.
166 */ 168 */
167#ifndef KAB_EMBEDDED 169#ifndef KAB_EMBEDDED
168//MOC_SKIP_BEGIN 170//MOC_SKIP_BEGIN
169 virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0; 171 virtual void setSelected( QString uid = QString::null, bool selected = true ) = 0;
170//MOC_SKIP_END 172//MOC_SKIP_END
171#else //KAB_EMBEDDED 173#else //KAB_EMBEDDED
172 //US my moc can not handle the default parameters. Is this a problem ??? 174 //US my moc can not handle the default parameters. Is this a problem ???
173 virtual void setSelected( QString uid, bool selected) = 0; 175 virtual void setSelected( QString uid, bool selected) = 0;
174#endif //KAB_EMBEDDED 176#endif //KAB_EMBEDDED
175 177
176 signals: 178 signals:
177 /** 179 /**
178 This signal should be emitted by a subclass whenever an addressee 180 This signal should be emitted by a subclass whenever an addressee
179 is modified. 181 is modified.
180 */ 182 */
181 void modified(); 183 void modified();
182 184
183 /** 185 /**
184 This signal should be emitted by a subclass whenever an addressee 186 This signal should be emitted by a subclass whenever an addressee
185 is selected. Selected means that the addressee was given the focus. 187 is selected. Selected means that the addressee was given the focus.
186 Some widgets may call this 'highlighted'. The view is responsible for 188 Some widgets may call this 'highlighted'. The view is responsible for
187 emitting this signal multiple times if multiple items are selected, 189 emitting this signal multiple times if multiple items are selected,
188 with the last item selected being the last emit. 190 with the last item selected being the last emit.
189 191
190 @param uid The uid of the selected addressee. 192 @param uid The uid of the selected addressee.
191 193
192 @see KListView 194 @see KListView
193 */ 195 */
194 void selected( const QString &uid ); 196 void selected( const QString &uid );
195 void deleteRequest(); 197 void deleteRequest();
196 /** 198 /**
197 This signal should be emitted by a subclass whenever an addressee 199 This signal should be emitted by a subclass whenever an addressee
198 is executed. This is defined by the KDE system wide config, but it 200 is executed. This is defined by the KDE system wide config, but it
199 either means single or doubleclicked. 201 either means single or doubleclicked.
200 202
201 @param ui The uid of the selected addressee 203 @param ui The uid of the selected addressee
202 204
203 @see KListView 205 @see KListView
204 */ 206 */
205 void executed( const QString &uid ); 207 void executed( const QString &uid );
206 208
207 /** 209 /**
208 This signal is emitted whenever a user attempts to start a drag 210 This signal is emitted whenever a user attempts to start a drag
209 in the view. The slot connected to this signal would usually want 211 in the view. The slot connected to this signal would usually want
210 to create a QDragObject. 212 to create a QDragObject.
211 */ 213 */
212 void startDrag(); 214 void startDrag();
213 215
214 /** 216 /**
215 This signal is emitted whenever the user drops something on the 217 This signal is emitted whenever the user drops something on the
216 view. The individual view should handle checking if the item is 218 view. The individual view should handle checking if the item is
217 droppable (ie: if it is a vcard). 219 droppable (ie: if it is a vcard).
218 */ 220 */
219 void dropped( QDropEvent* ); 221 void dropped( QDropEvent* );
220 222
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
@@ -202,193 +202,193 @@ void KAddressBookCardView::readConfig(KConfig *config)
202 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); 202 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) );
203 c = p.color(QPalette::Normal, QColorGroup::ButtonText ); 203 c = p.color(QPalette::Normal, QColorGroup::ButtonText );
204 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); 204 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) );
205 c = p.color(QPalette::Normal, QColorGroup::Highlight ); 205 c = p.color(QPalette::Normal, QColorGroup::Highlight );
206 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); 206 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) );
207 c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); 207 c = p.color(QPalette::Normal, QColorGroup::HighlightedText );
208 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); 208 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) );
209 mCardView->viewport()->setPalette( p ); 209 mCardView->viewport()->setPalette( p );
210 } 210 }
211 else 211 else
212 { 212 {
213 // needed if turned off during a session. 213 // needed if turned off during a session.
214 mCardView->viewport()->setPalette( mCardView->palette() ); 214 mCardView->viewport()->setPalette( mCardView->palette() );
215 } 215 }
216 216
217 //custom fonts? 217 //custom fonts?
218 QFont f( font() ); 218 QFont f( font() );
219 if ( config->readBoolEntry( "EnableCustomFonts", false ) ) 219 if ( config->readBoolEntry( "EnableCustomFonts", false ) )
220 { 220 {
221 mCardView->setFont( config->readFontEntry( "TextFont", &f) ); 221 mCardView->setFont( config->readFontEntry( "TextFont", &f) );
222 f.setBold( true ); 222 f.setBold( true );
223 mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); 223 mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) );
224 } 224 }
225 else 225 else
226 { 226 {
227 mCardView->setFont( f ); 227 mCardView->setFont( f );
228 f.setBold( true ); 228 f.setBold( true );
229 mCardView->setHeaderFont( f ); 229 mCardView->setHeaderFont( f );
230 } 230 }
231 231
232 mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true)); 232 mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true));
233 mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators", 233 mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators",
234 true)); 234 true));
235 mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false)); 235 mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false));
236 mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false); 236 mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false);
237 237
238 mCardView->setShowEmptyFields( mShowEmptyFields ); 238 mCardView->setShowEmptyFields( mShowEmptyFields );
239 239
240 mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); 240 mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) );
241 mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); 241 mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) );
242 mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); 242 mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) );
243 mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); 243 mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) );
244 244
245#if 0 245#if 0
246 // LR KABPrefs::instance()->mHonorSingleClick is handled and fixed in cardviews contentsMouseDoubleClickEven 246 // LR KABPrefs::instance()->mHonorSingleClick is handled and fixed in cardviews contentsMouseDoubleClickEven
247 disconnect(mCardView, SIGNAL(executed(CardViewItem *)), 247 disconnect(mCardView, SIGNAL(executed(CardViewItem *)),
248 this, SLOT(addresseeExecuted(CardViewItem *))); 248 this, SLOT(addresseeExecuted(CardViewItem *)));
249 249
250 if (KABPrefs::instance()->mHonorSingleClick) 250 if (KABPrefs::instance()->mHonorSingleClick)
251 connect(mCardView, SIGNAL(executed(CardViewItem *)), 251 connect(mCardView, SIGNAL(executed(CardViewItem *)),
252 this, SLOT(addresseeExecuted(CardViewItem *))); 252 this, SLOT(addresseeExecuted(CardViewItem *)));
253 else 253 else
254 connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), 254 connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)),
255 this, SLOT(addresseeExecuted(CardViewItem *))); 255 this, SLOT(addresseeExecuted(CardViewItem *)));
256#endif 256#endif
257 257
258 connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), 258 connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)),
259 this, SLOT(addresseeExecuted(CardViewItem *))); 259 this, SLOT(addresseeExecuted(CardViewItem *)));
260} 260}
261 261
262void KAddressBookCardView::writeConfig( KConfig *config ) 262void KAddressBookCardView::writeConfig( KConfig *config )
263{ 263{
264 config->writeEntry( "ItemWidth", mCardView->itemWidth() ); 264 config->writeEntry( "ItemWidth", mCardView->itemWidth() );
265 KAddressBookView::writeConfig( config ); 265 KAddressBookView::writeConfig( config );
266} 266}
267void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) 267void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field )
268{ 268{
269 mCardView->clear(); 269 mCardView->clear();
270 if ( s.isEmpty() || s == "*" ) { 270 if ( s.isEmpty() || s == "*" ) {
271 refresh(); 271 refresh();
272 return; 272 return;
273 } 273 }
274 QString pattern = s.lower()+"*"; 274 QString pattern = s.lower()+"*";
275 QRegExp re; 275 QRegExp re;
276 re.setWildcard(true); // most people understand these better. 276 re.setWildcard(true); // most people understand these better.
277 re.setCaseSensitive(false); 277 re.setCaseSensitive(false);
278 re.setPattern( pattern ); 278 re.setPattern( pattern );
279 if (!re.isValid()) 279 if (!re.isValid())
280 return; 280 return;
281 mCardView->viewport()->setUpdatesEnabled( false ); 281 mCardView->viewport()->setUpdatesEnabled( false );
282 KABC::Addressee::List addresseeList = addressees(); 282 KABC::Addressee::List addresseeList = addressees();
283 KABC::Addressee::List::Iterator it; 283 KABC::Addressee::List::Iterator it;
284 if ( field ) { 284 if ( field ) {
285 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 285 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
286 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 286 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
287 continue; 287 continue;
288#if QT_VERSION >= 300 288#if QT_VERSION >= 300
289 if (re.search(field->value( *it ).lower()) != -1) 289 if (re.search(field->value( *it ).lower()) != -1)
290#else 290#else
291 if (re.match(field->value( *it ).lower()) != -1) 291 if (re.match(field->value( *it ).lower()) != -1)
292#endif 292#endif
293 new AddresseeCardViewItem(fields(), mShowEmptyFields, 293 new AddresseeCardViewItem(fields(), mShowEmptyFields,
294 addressBook(), *it, mCardView); 294 addressBook(), *it, mCardView);
295 295
296 } 296 }
297 } else { 297 } else {
298 KABC::Field::List fieldList = fields(); 298 KABC::Field::List fieldList = allFields();
299 KABC::Field::List::ConstIterator fieldIt; 299 KABC::Field::List::ConstIterator fieldIt;
300 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 300 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
301 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 301 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
302 continue; 302 continue;
303 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 303 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
304#if QT_VERSION >= 300 304#if QT_VERSION >= 300
305 if (re.search((*fieldIt)->value( *it ).lower()) != -1) 305 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
306#else 306#else
307 if (re.match((*fieldIt)->value( *it ).lower()) != -1) 307 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
308#endif 308#endif
309 { 309 {
310 new AddresseeCardViewItem(fields(), mShowEmptyFields, 310 new AddresseeCardViewItem(fields(), mShowEmptyFields,
311 addressBook(), *it, mCardView); 311 addressBook(), *it, mCardView);
312 continue; 312 continue;
313 } 313 }
314 } 314 }
315 } 315 }
316 } 316 }
317 mCardView->viewport()->setUpdatesEnabled( true ); 317 mCardView->viewport()->setUpdatesEnabled( true );
318 mCardView->viewport()->update(); 318 mCardView->viewport()->update();
319 if ( mCardView->firstItem() ) { 319 if ( mCardView->firstItem() ) {
320 mCardView->setCurrentItem ( mCardView->firstItem() ); 320 mCardView->setCurrentItem ( mCardView->firstItem() );
321 mCardView->setSelected ( mCardView->firstItem() , true ); 321 mCardView->setSelected ( mCardView->firstItem() , true );
322 } 322 }
323 else 323 else
324 emit selected(QString::null); 324 emit selected(QString::null);
325} 325}
326QStringList KAddressBookCardView::selectedUids() 326QStringList KAddressBookCardView::selectedUids()
327{ 327{
328 QStringList uidList; 328 QStringList uidList;
329 CardViewItem *item; 329 CardViewItem *item;
330 AddresseeCardViewItem *aItem; 330 AddresseeCardViewItem *aItem;
331 331
332 for (item = mCardView->firstItem(); item; item = item->nextItem()) 332 for (item = mCardView->firstItem(); item; item = item->nextItem())
333 { 333 {
334 if (item->isSelected()) 334 if (item->isSelected())
335 { 335 {
336#ifndef KAB_EMBEDDED 336#ifndef KAB_EMBEDDED
337 aItem = dynamic_cast<AddresseeCardViewItem*>(item); 337 aItem = dynamic_cast<AddresseeCardViewItem*>(item);
338#else //KAB_EMBEDDED 338#else //KAB_EMBEDDED
339 aItem = (AddresseeCardViewItem*)(item); 339 aItem = (AddresseeCardViewItem*)(item);
340#endif //KAB_EMBEDDED 340#endif //KAB_EMBEDDED
341 if (aItem) 341 if (aItem)
342 uidList << aItem->addressee().uid(); 342 uidList << aItem->addressee().uid();
343 } 343 }
344 } 344 }
345 345
346 return uidList; 346 return uidList;
347} 347}
348 348
349void KAddressBookCardView::refresh(QString uid) 349void KAddressBookCardView::refresh(QString uid)
350{ 350{
351 CardViewItem *item; 351 CardViewItem *item;
352 AddresseeCardViewItem *aItem; 352 AddresseeCardViewItem *aItem;
353 353
354 if (uid.isNull()) 354 if (uid.isNull())
355 { 355 {
356 // Rebuild the view 356 // Rebuild the view
357 mCardView->viewport()->setUpdatesEnabled( false ); 357 mCardView->viewport()->setUpdatesEnabled( false );
358 mCardView->clear(); 358 mCardView->clear();
359 359
360 KABC::Addressee::List addresseeList = addressees(); 360 KABC::Addressee::List addresseeList = addressees();
361 KABC::Addressee::List::Iterator iter; 361 KABC::Addressee::List::Iterator iter;
362 for (iter = addresseeList.begin(); iter != addresseeList.end(); ++iter) 362 for (iter = addresseeList.begin(); iter != addresseeList.end(); ++iter)
363 { 363 {
364 if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) 364 if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") )
365 continue; 365 continue;
366 aItem = new AddresseeCardViewItem(fields(), mShowEmptyFields, 366 aItem = new AddresseeCardViewItem(fields(), mShowEmptyFields,
367 addressBook(), *iter, mCardView); 367 addressBook(), *iter, mCardView);
368 } 368 }
369 mCardView->viewport()->setUpdatesEnabled( true ); 369 mCardView->viewport()->setUpdatesEnabled( true );
370 mCardView->viewport()->update(); 370 mCardView->viewport()->update();
371 371
372 // by default nothing is selected 372 // by default nothing is selected
373 emit selected(QString::null); 373 emit selected(QString::null);
374 } 374 }
375 else 375 else
376 { 376 {
377 // Try to find the one to refresh 377 // Try to find the one to refresh
378 bool found = false; 378 bool found = false;
379 for (item = mCardView->firstItem(); item && !found; 379 for (item = mCardView->firstItem(); item && !found;
380 item = item->nextItem()) 380 item = item->nextItem())
381 { 381 {
382#ifndef KAB_EMBEDDED 382#ifndef KAB_EMBEDDED
383 aItem = dynamic_cast<AddresseeCardViewItem*>(item); 383 aItem = dynamic_cast<AddresseeCardViewItem*>(item);
384#else //KAB_EMBEDDED 384#else //KAB_EMBEDDED
385 aItem = (AddresseeCardViewItem*)(item); 385 aItem = (AddresseeCardViewItem*)(item);
386#endif //KAB_EMBEDDED 386#endif //KAB_EMBEDDED
387 387
388 if ((aItem) && (aItem->addressee().uid() == uid)) 388 if ((aItem) && (aItem->addressee().uid() == uid))
389 { 389 {
390 aItem->refresh(); 390 aItem->refresh();
391 found = true; 391 found = true;
392 } 392 }
393 } 393 }
394 } 394 }
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
@@ -189,193 +189,193 @@ KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab,
189 // Init the GUI 189 // Init the GUI
190 QVBoxLayout *layout = new QVBoxLayout(viewWidget()); 190 QVBoxLayout *layout = new QVBoxLayout(viewWidget());
191 191
192 mIconView = new AddresseeIconView(viewWidget(), "mIconView"); 192 mIconView = new AddresseeIconView(viewWidget(), "mIconView");
193 layout->addWidget(mIconView); 193 layout->addWidget(mIconView);
194 194
195 // Connect up the signals 195 // Connect up the signals
196 196
197//US method executed is part of KIconView 197//US method executed is part of KIconView
198//US connect(mIconView, SIGNAL(executed(QIconViewItem *)), 198//US connect(mIconView, SIGNAL(executed(QIconViewItem *)),
199//US this, SLOT(addresseeExecuted(QIconViewItem *))); 199//US this, SLOT(addresseeExecuted(QIconViewItem *)));
200 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), 200 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
201 this, SLOT(addresseeExecuted(QIconViewItem *))); 201 this, SLOT(addresseeExecuted(QIconViewItem *)));
202 202
203 connect(mIconView, SIGNAL(selectionChanged()), 203 connect(mIconView, SIGNAL(selectionChanged()),
204 this, SLOT(addresseeSelected())); 204 this, SLOT(addresseeSelected()));
205 connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), 205 connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)),
206 this, SIGNAL(dropped(QDropEvent*))); 206 this, SIGNAL(dropped(QDropEvent*)));
207 connect(mIconView, SIGNAL(startAddresseeDrag()), 207 connect(mIconView, SIGNAL(startAddresseeDrag()),
208 this, SIGNAL(startDrag())); 208 this, SIGNAL(startDrag()));
209} 209}
210 210
211KAddressBookIconView::~KAddressBookIconView() 211KAddressBookIconView::~KAddressBookIconView()
212{ 212{
213} 213}
214void KAddressBookIconView::setFocusAV() 214void KAddressBookIconView::setFocusAV()
215{ 215{
216 if ( mIconView ) 216 if ( mIconView )
217 mIconView->setFocus(); 217 mIconView->setFocus();
218} 218}
219 219
220 220
221void KAddressBookIconView::scrollUP() 221void KAddressBookIconView::scrollUP()
222{ 222{
223 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 223 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
224 QApplication::postEvent( mIconView, ev ); 224 QApplication::postEvent( mIconView, ev );
225} 225}
226void KAddressBookIconView::scrollDOWN() 226void KAddressBookIconView::scrollDOWN()
227{ 227{
228 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 228 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
229 QApplication::postEvent( mIconView, ev ); 229 QApplication::postEvent( mIconView, ev );
230} 230}
231void KAddressBookIconView::readConfig(KConfig *config) 231void KAddressBookIconView::readConfig(KConfig *config)
232{ 232{
233 KAddressBookView::readConfig(config); 233 KAddressBookView::readConfig(config);
234 234
235//US method executed is part of KIconView 235//US method executed is part of KIconView
236//US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), 236//US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)),
237//US this, SLOT(addresseeExecuted(QIconViewItem *))); 237//US this, SLOT(addresseeExecuted(QIconViewItem *)));
238 disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), 238 disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
239 this, SLOT(addresseeExecuted(QIconViewItem *))); 239 this, SLOT(addresseeExecuted(QIconViewItem *)));
240 240
241//US method executed is part of KIconView. Use selectionChanged instead 241//US method executed is part of KIconView. Use selectionChanged instead
242/*US 242/*US
243 if (KABPrefs::instance()->mHonorSingleClick) 243 if (KABPrefs::instance()->mHonorSingleClick)
244 connect(mIconView, SIGNAL(executed(QIconViewItem *)), 244 connect(mIconView, SIGNAL(executed(QIconViewItem *)),
245 this, SLOT(addresseeExecuted(QIconViewItem *))); 245 this, SLOT(addresseeExecuted(QIconViewItem *)));
246 else 246 else
247 connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), 247 connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)),
248 this, SLOT(addresseeExecuted(QIconViewItem *))); 248 this, SLOT(addresseeExecuted(QIconViewItem *)));
249*/ 249*/
250 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), 250 connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)),
251 this, SLOT(addresseeExecuted(QIconViewItem *))); 251 this, SLOT(addresseeExecuted(QIconViewItem *)));
252 252
253} 253}
254void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) 254void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field )
255{ 255{
256 mIconView->clear(); 256 mIconView->clear();
257 mIconList.clear(); 257 mIconList.clear();
258 if ( s.isEmpty() || s == "*" ) { 258 if ( s.isEmpty() || s == "*" ) {
259 refresh(); 259 refresh();
260 return; 260 return;
261 } 261 }
262 QString pattern = s.lower()+"*"; 262 QString pattern = s.lower()+"*";
263 QRegExp re; 263 QRegExp re;
264 re.setWildcard(true); // most people understand these better. 264 re.setWildcard(true); // most people understand these better.
265 re.setCaseSensitive(false); 265 re.setCaseSensitive(false);
266 re.setPattern( pattern ); 266 re.setPattern( pattern );
267 if (!re.isValid()) 267 if (!re.isValid())
268 return; 268 return;
269 KABC::Addressee::List addresseeList = addressees(); 269 KABC::Addressee::List addresseeList = addressees();
270 KABC::Addressee::List::Iterator it; 270 KABC::Addressee::List::Iterator it;
271 if ( field ) { 271 if ( field ) {
272 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 272 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
273 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 273 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
274 continue; 274 continue;
275#if QT_VERSION >= 300 275#if QT_VERSION >= 300
276 if (re.search(field->value( *it ).lower()) != -1) 276 if (re.search(field->value( *it ).lower()) != -1)
277#else 277#else
278 if (re.match(field->value( *it ).lower()) != -1) 278 if (re.match(field->value( *it ).lower()) != -1)
279#endif 279#endif
280 mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); 280 mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
281 281
282 282
283 } 283 }
284 } else { 284 } else {
285 KABC::Field::List fieldList = fields(); 285 KABC::Field::List fieldList = allFields();
286 KABC::Field::List::ConstIterator fieldIt; 286 KABC::Field::List::ConstIterator fieldIt;
287 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 287 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
288 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 288 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
289 continue; 289 continue;
290 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 290 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
291#if QT_VERSION >= 300 291#if QT_VERSION >= 300
292 if (re.search((*fieldIt)->value( *it ).lower()) != -1) 292 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
293#else 293#else
294 if (re.match((*fieldIt)->value( *it ).lower()) != -1) 294 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
295#endif 295#endif
296 { 296 {
297 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); 297 mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView ));
298 continue; 298 continue;
299 } 299 }
300 } 300 }
301 } 301 }
302 } 302 }
303 mIconView->arrangeItemsInGrid( true ); 303 mIconView->arrangeItemsInGrid( true );
304 if ( mIconView->firstItem() ) { 304 if ( mIconView->firstItem() ) {
305 mIconView->setCurrentItem ( mIconView->firstItem() ); 305 mIconView->setCurrentItem ( mIconView->firstItem() );
306 mIconView->setSelected ( mIconView->firstItem() , true ); 306 mIconView->setSelected ( mIconView->firstItem() , true );
307 } 307 }
308 else 308 else
309 emit selected(QString::null); 309 emit selected(QString::null);
310} 310}
311QStringList KAddressBookIconView::selectedUids() 311QStringList KAddressBookIconView::selectedUids()
312{ 312{
313 QStringList uidList; 313 QStringList uidList;
314 QIconViewItem *item; 314 QIconViewItem *item;
315 AddresseeIconViewItem *aItem; 315 AddresseeIconViewItem *aItem;
316 316
317 for (item = mIconView->firstItem(); item; item = item->nextItem()) 317 for (item = mIconView->firstItem(); item; item = item->nextItem())
318 { 318 {
319 if (item->isSelected()) 319 if (item->isSelected())
320 { 320 {
321#ifndef KAB_EMBEDDED 321#ifndef KAB_EMBEDDED
322 aItem = dynamic_cast<AddresseeIconViewItem*>(item); 322 aItem = dynamic_cast<AddresseeIconViewItem*>(item);
323#else //KAB_EMBEDDED 323#else //KAB_EMBEDDED
324 aItem = (AddresseeIconViewItem*)(item); 324 aItem = (AddresseeIconViewItem*)(item);
325#endif //KAB_EMBEDDED 325#endif //KAB_EMBEDDED
326 if (aItem) 326 if (aItem)
327 uidList << aItem->addressee().uid(); 327 uidList << aItem->addressee().uid();
328 } 328 }
329 } 329 }
330 330
331 return uidList; 331 return uidList;
332} 332}
333 333
334void KAddressBookIconView::refresh(QString uid) 334void KAddressBookIconView::refresh(QString uid)
335{ 335{
336 QIconViewItem *item; 336 QIconViewItem *item;
337 AddresseeIconViewItem *aItem; 337 AddresseeIconViewItem *aItem;
338 338
339 if ( uid.isNull() ) { 339 if ( uid.isNull() ) {
340 // Rebuild the view 340 // Rebuild the view
341 mIconView->clear(); 341 mIconView->clear();
342 mIconList.clear(); 342 mIconList.clear();
343 343
344 KABC::Addressee::List addresseeList = addressees(); 344 KABC::Addressee::List addresseeList = addressees();
345 KABC::Addressee::List::Iterator iter; 345 KABC::Addressee::List::Iterator iter;
346 for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) { 346 for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) {
347 if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) 347 if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") )
348 continue; 348 continue;
349 aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView ); 349 aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView );
350 } 350 }
351 351
352 mIconView->arrangeItemsInGrid( true ); 352 mIconView->arrangeItemsInGrid( true );
353 353
354 for ( item = mIconView->firstItem(); item; item = item->nextItem() ) 354 for ( item = mIconView->firstItem(); item; item = item->nextItem() )
355 { 355 {
356#ifndef KAB_EMBEDDED 356#ifndef KAB_EMBEDDED
357 AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item ); 357 AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item );
358#else //KAB_EMBEDDED 358#else //KAB_EMBEDDED
359 AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item ); 359 AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item );
360#endif //KAB_EMBEDDED 360#endif //KAB_EMBEDDED
361 mIconList.append( aivi ); 361 mIconList.append( aivi );
362 } 362 }
363 363
364 } else { 364 } else {
365 // Try to find the one to refresh 365 // Try to find the one to refresh
366 for ( item = mIconView->firstItem(); item; item = item->nextItem() ) { 366 for ( item = mIconView->firstItem(); item; item = item->nextItem() ) {
367#ifndef KAB_EMBEDDED 367#ifndef KAB_EMBEDDED
368 aItem = dynamic_cast<AddresseeIconViewItem*>(item); 368 aItem = dynamic_cast<AddresseeIconViewItem*>(item);
369#else //KAB_EMBEDDED 369#else //KAB_EMBEDDED
370 aItem = (AddresseeIconViewItem*)(item); 370 aItem = (AddresseeIconViewItem*)(item);
371#endif //KAB_EMBEDDED 371#endif //KAB_EMBEDDED
372 if ((aItem) && (aItem->addressee().uid() == uid)) { 372 if ((aItem) && (aItem->addressee().uid() == uid)) {
373 aItem->refresh(); 373 aItem->refresh();
374 mIconView->arrangeItemsInGrid( true ); 374 mIconView->arrangeItemsInGrid( true );
375 return; 375 return;
376 } 376 }
377 } 377 }
378 refresh( QString::null ); 378 refresh( QString::null );
379 } 379 }
380} 380}
381 381
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
@@ -70,291 +70,287 @@ void KAddressBookTableView::scrollDOWN()
70void KAddressBookTableView::reconstructListView() 70void KAddressBookTableView::reconstructListView()
71{ 71{
72 if (mListView) 72 if (mListView)
73 { 73 {
74 disconnect(mListView, SIGNAL(selectionChanged()), 74 disconnect(mListView, SIGNAL(selectionChanged()),
75 this, SLOT(addresseeSelected())); 75 this, SLOT(addresseeSelected()));
76 disconnect(mListView, SIGNAL(executed(QListViewItem*)), 76 disconnect(mListView, SIGNAL(executed(QListViewItem*)),
77 this, SLOT(addresseeExecuted(QListViewItem*))); 77 this, SLOT(addresseeExecuted(QListViewItem*)));
78 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 78 disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
79 this, SLOT(addresseeExecuted(QListViewItem*))); 79 this, SLOT(addresseeExecuted(QListViewItem*)));
80 disconnect(mListView, SIGNAL(startAddresseeDrag()), this, 80 disconnect(mListView, SIGNAL(startAddresseeDrag()), this,
81 SIGNAL(startDrag())); 81 SIGNAL(startDrag()));
82 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), 82 disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)),
83 this, SLOT(addresseeExecuted(QListViewItem*))); 83 this, SLOT(addresseeExecuted(QListViewItem*)));
84 84
85 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, 85 disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
86 SIGNAL(dropped(QDropEvent*))); 86 SIGNAL(dropped(QDropEvent*)));
87 delete mListView; 87 delete mListView;
88 } 88 }
89 89
90 mListView = new ContactListView( this, addressBook(), viewWidget() ); 90 mListView = new ContactListView( this, addressBook(), viewWidget() );
91 91
92 //US set singleClick manually, because it is no global configparameter in embedded space 92 //US set singleClick manually, because it is no global configparameter in embedded space
93 mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); 93 mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick);
94 94
95 // Add the columns 95 // Add the columns
96 KABC::Field::List fieldList = fields(); 96 KABC::Field::List fieldList = fields();
97 KABC::Field::List::ConstIterator it; 97 KABC::Field::List::ConstIterator it;
98 98
99 int c = 0; 99 int c = 0;
100 for( it = fieldList.begin(); it != fieldList.end(); ++it ) { 100 for( it = fieldList.begin(); it != fieldList.end(); ++it ) {
101 mListView->addColumn( (*it)->label() ); 101 mListView->addColumn( (*it)->label() );
102 mListView->setColumnWidthMode(c++, QListView::Manual); 102 mListView->setColumnWidthMode(c++, QListView::Manual);
103//US 103//US
104 // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); 104 // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1());
105 } 105 }
106 106
107 connect(mListView, SIGNAL(selectionChanged()), 107 connect(mListView, SIGNAL(selectionChanged()),
108 this, SLOT(addresseeSelected())); 108 this, SLOT(addresseeSelected()));
109 connect(mListView, SIGNAL(startAddresseeDrag()), this, 109 connect(mListView, SIGNAL(startAddresseeDrag()), this,
110 SIGNAL(startDrag())); 110 SIGNAL(startDrag()));
111 connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, 111 connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this,
112 SIGNAL(dropped(QDropEvent*))); 112 SIGNAL(dropped(QDropEvent*)));
113 113
114 if (KABPrefs::instance()->mHonorSingleClick) { 114 if (KABPrefs::instance()->mHonorSingleClick) {
115 // qDebug("KAddressBookTableView::reconstructListView single"); 115 // qDebug("KAddressBookTableView::reconstructListView single");
116 connect(mListView, SIGNAL(executed(QListViewItem*)), 116 connect(mListView, SIGNAL(executed(QListViewItem*)),
117 this, SLOT(addresseeExecuted(QListViewItem*))); 117 this, SLOT(addresseeExecuted(QListViewItem*)));
118 } else { 118 } else {
119 // qDebug("KAddressBookTableView::reconstructListView double"); 119 // qDebug("KAddressBookTableView::reconstructListView double");
120 connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), 120 connect(mListView, SIGNAL(doubleClicked(QListViewItem*)),
121 this, SLOT(addresseeExecuted(QListViewItem*))); 121 this, SLOT(addresseeExecuted(QListViewItem*)));
122 } 122 }
123 connect(mListView, SIGNAL(returnPressed(QListViewItem*)), 123 connect(mListView, SIGNAL(returnPressed(QListViewItem*)),
124 this, SLOT(addresseeExecuted(QListViewItem*))); 124 this, SLOT(addresseeExecuted(QListViewItem*)));
125 connect(mListView, SIGNAL(signalDelete()), 125 connect(mListView, SIGNAL(signalDelete()),
126 this, SLOT(addresseeDeleted())); 126 this, SLOT(addresseeDeleted()));
127 127
128//US performceimprovement. Refresh is done from the outside 128//US performceimprovement. Refresh is done from the outside
129//US refresh(); 129//US refresh();
130 130
131 mListView->setSorting( 0, true ); 131 mListView->setSorting( 0, true );
132 mainLayout->addWidget( mListView ); 132 mainLayout->addWidget( mListView );
133 mainLayout->activate(); 133 mainLayout->activate();
134 mListView->show(); 134 mListView->show();
135} 135}
136 136
137void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) 137void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field )
138{ 138{
139 mListView->clear(); 139 mListView->clear();
140 if ( s.isEmpty() || s == "*" ) { 140 if ( s.isEmpty() || s == "*" ) {
141 refresh(); 141 refresh();
142 return; 142 return;
143 } 143 }
144 QString pattern = s.lower()+"*"; 144 QString pattern = s.lower()+"*";
145 QRegExp re; 145 QRegExp re;
146 re.setWildcard(true); // most people understand these better. 146 re.setWildcard(true); // most people understand these better.
147 re.setCaseSensitive(false); 147 re.setCaseSensitive(false);
148 re.setPattern( pattern ); 148 re.setPattern( pattern );
149 if (!re.isValid()) 149 if (!re.isValid())
150 return; 150 return;
151 KABC::Addressee::List addresseeList = addressees(); 151 KABC::Addressee::List addresseeList = addressees();
152 KABC::Addressee::List::Iterator it; 152 KABC::Addressee::List::Iterator it;
153 if ( field ) { 153 if ( field ) {
154 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 154 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
155 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 155 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
156 continue; 156 continue;
157#if QT_VERSION >= 300 157#if QT_VERSION >= 300
158 if (re.search(field->value( *it ).lower()) != -1) 158 if (re.search(field->value( *it ).lower()) != -1)
159#else 159#else
160 if (re.match(field->value( *it ).lower()) != -1) 160 if (re.match(field->value( *it ).lower()) != -1)
161#endif 161#endif
162 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 162 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
163 163
164 } 164 }
165 } else { 165 } else {
166 KABC::Field::List fieldList = fields(); 166 KABC::Field::List fieldList = allFields();
167 KABC::Field::List::ConstIterator fieldIt; 167 KABC::Field::List::ConstIterator fieldIt;
168 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 168 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
169 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 169 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
170 continue; 170 continue;
171 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { 171 for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) {
172#if QT_VERSION >= 300 172#if QT_VERSION >= 300
173 if (re.search((*fieldIt)->value( *it ).lower()) != -1) 173 if (re.search((*fieldIt)->value( *it ).lower()) != -1)
174#else 174#else
175 if (re.match((*fieldIt)->value( *it ).lower()) != -1) 175 if (re.match((*fieldIt)->value( *it ).lower()) != -1)
176#endif 176#endif
177 { 177 {
178 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 178 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
179 break; 179 break;
180 } 180 }
181 } 181 }
182 } 182 }
183 } 183 }
184 // Sometimes the background pixmap gets messed up when we add lots 184 // Sometimes the background pixmap gets messed up when we add lots
185 // of items. 185 // of items.
186 mListView->repaint(); 186 mListView->repaint();
187 if ( mListView->firstChild() ) { 187 if ( mListView->firstChild() ) {
188 mListView->setCurrentItem ( mListView->firstChild() ); 188 mListView->setCurrentItem ( mListView->firstChild() );
189 mListView->setSelected ( mListView->firstChild(), true ); 189 mListView->setSelected ( mListView->firstChild(), true );
190 } 190 }
191 else 191 else
192 emit selected(QString::null); 192 emit selected(QString::null);
193 193
194} 194}
195void KAddressBookTableView::writeConfig(KConfig *config) 195void KAddressBookTableView::writeConfig(KConfig *config)
196{ 196{
197 KAddressBookView::writeConfig(config); 197 KAddressBookView::writeConfig(config);
198 198
199 mListView->saveLayout(config, config->group()); 199 mListView->saveLayout(config, config->group());
200} 200}
201 201
202void KAddressBookTableView::readConfig(KConfig *config) 202void KAddressBookTableView::readConfig(KConfig *config)
203{ 203{
204 KAddressBookView::readConfig( config ); 204 KAddressBookView::readConfig( config );
205 // The config could have changed the fields, so we need to reconstruct 205 // The config could have changed the fields, so we need to reconstruct
206 // the listview. 206 // the listview.
207 reconstructListView(); 207 reconstructListView();
208 208
209 // costum colors? 209 // costum colors?
210 if ( config->readBoolEntry( "EnableCustomColors", false ) ) 210 if ( config->readBoolEntry( "EnableCustomColors", false ) )
211 { 211 {
212 QPalette p( mListView->palette() ); 212 QPalette p( mListView->palette() );
213 QColor c = p.color(QPalette::Normal, QColorGroup::Base ); 213 QColor c = p.color(QPalette::Normal, QColorGroup::Base );
214 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); 214 p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) );
215 c = p.color(QPalette::Normal, QColorGroup::Text ); 215 c = p.color(QPalette::Normal, QColorGroup::Text );
216 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); 216 p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) );
217 c = p.color(QPalette::Normal, QColorGroup::Button ); 217 c = p.color(QPalette::Normal, QColorGroup::Button );
218 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); 218 p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) );
219 c = p.color(QPalette::Normal, QColorGroup::ButtonText ); 219 c = p.color(QPalette::Normal, QColorGroup::ButtonText );
220 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); 220 p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) );
221 c = p.color(QPalette::Normal, QColorGroup::Highlight ); 221 c = p.color(QPalette::Normal, QColorGroup::Highlight );
222 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); 222 p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) );
223 c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); 223 c = p.color(QPalette::Normal, QColorGroup::HighlightedText );
224 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); 224 p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) );
225#ifndef KAB_EMBEDDED 225#ifndef KAB_EMBEDDED
226 c = KGlobalSettings::alternateBackgroundColor(); 226 c = KGlobalSettings::alternateBackgroundColor();
227#else //KAB_EMBEDDED 227#else //KAB_EMBEDDED
228 c = QColor(240, 240, 240); 228 c = QColor(240, 240, 240);
229#endif //KAB_EMBEDDED 229#endif //KAB_EMBEDDED
230 c = config->readColorEntry ("AlternatingBackgroundColor", &c); 230 c = config->readColorEntry ("AlternatingBackgroundColor", &c);
231 mListView->setAlternateColor(c); 231 mListView->setAlternateColor(c);
232 232
233 233
234 //US mListView->viewport()->setPalette( p ); 234 //US mListView->viewport()->setPalette( p );
235 mListView->setPalette( p ); 235 mListView->setPalette( p );
236 } 236 }
237 else 237 else
238 { 238 {
239 // needed if turned off during a session. 239 // needed if turned off during a session.
240 //US mListView->viewport()->setPalette( mListView->palette() ); 240 //US mListView->viewport()->setPalette( mListView->palette() );
241 mListView->setPalette( mListView->palette() ); 241 mListView->setPalette( mListView->palette() );
242 } 242 }
243 243
244 //custom fonts? 244 //custom fonts?
245 QFont f( font() ); 245 QFont f( font() );
246 if ( config->readBoolEntry( "EnableCustomFonts", false ) ) 246 if ( config->readBoolEntry( "EnableCustomFonts", false ) )
247 { 247 {
248 mListView->setFont( config->readFontEntry( "TextFont", &f) ); 248 mListView->setFont( config->readFontEntry( "TextFont", &f) );
249 f.setBold( true ); 249 f.setBold( true );
250 //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); 250 //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) );
251 mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); 251 mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) );
252 } 252 }
253 else 253 else
254 { 254 {
255 mListView->setFont( f ); 255 mListView->setFont( f );
256 f.setBold( true ); 256 f.setBold( true );
257 //US mListView->setHeaderFont( f ); 257 //US mListView->setHeaderFont( f );
258 mListView->header()->setFont( f ); 258 mListView->header()->setFont( f );
259 } 259 }
260 260
261
262
263
264
265 // Set the list view options 261 // Set the list view options
266 mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", 262 mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground",
267 true)); 263 true));
268 mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); 264 mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false));
269 mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); 265 mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true));
270 266
271 if (config->readBoolEntry("Background", false)) 267 if (config->readBoolEntry("Background", false))
272 mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); 268 mListView->setBackgroundPixmap(config->readEntry("BackgroundName"));
273 269
274 // Restore the layout of the listview 270 // Restore the layout of the listview
275 mListView->restoreLayout(config, config->group()); 271 mListView->restoreLayout(config, config->group());
276} 272}
277 273
278void KAddressBookTableView::refresh(QString uid) 274void KAddressBookTableView::refresh(QString uid)
279{ 275{
280 // For now just repopulate. In reality this method should 276 // For now just repopulate. In reality this method should
281 // check the value of uid, and if valid iterate through 277 // check the value of uid, and if valid iterate through
282 // the listview to find the entry, then tell it to refresh. 278 // the listview to find the entry, then tell it to refresh.
283 279
284 if (uid.isNull()) { 280 if (uid.isNull()) {
285 // Clear the list view 281 // Clear the list view
286 QString currentUID, nextUID; 282 QString currentUID, nextUID;
287#ifndef KAB_EMBEDDED 283#ifndef KAB_EMBEDDED
288 ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); 284 ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() );
289#else //KAB_EMBEDDED 285#else //KAB_EMBEDDED
290 ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); 286 ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() );
291#endif //KAB_EMBEDDED 287#endif //KAB_EMBEDDED
292 288
293 if ( currentItem ) { 289 if ( currentItem ) {
294#ifndef KAB_EMBEDDED 290#ifndef KAB_EMBEDDED
295 ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); 291 ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() );
296#else //KAB_EMBEDDED 292#else //KAB_EMBEDDED
297 ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); 293 ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() );
298#endif //KAB_EMBEDDED 294#endif //KAB_EMBEDDED
299 if ( nextItem ) 295 if ( nextItem )
300 nextUID = nextItem->addressee().uid(); 296 nextUID = nextItem->addressee().uid();
301 currentUID = currentItem->addressee().uid(); 297 currentUID = currentItem->addressee().uid();
302 } 298 }
303 299
304 mListView->clear(); 300 mListView->clear();
305 301
306 currentItem = 0; 302 currentItem = 0;
307 KABC::Addressee::List addresseeList = addressees(); 303 KABC::Addressee::List addresseeList = addressees();
308 KABC::Addressee::List::Iterator it; 304 KABC::Addressee::List::Iterator it;
309 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { 305 for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) {
310 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) 306 if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") )
311 continue; 307 continue;
312 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); 308 ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields());
313 if ( (*it).uid() == currentUID ) 309 if ( (*it).uid() == currentUID )
314 currentItem = item; 310 currentItem = item;
315 else if ( (*it).uid() == nextUID && !currentItem ) 311 else if ( (*it).uid() == nextUID && !currentItem )
316 currentItem = item; 312 currentItem = item;
317 } 313 }
318 314
319 // Sometimes the background pixmap gets messed up when we add lots 315 // Sometimes the background pixmap gets messed up when we add lots
320 // of items. 316 // of items.
321 mListView->repaint(); 317 mListView->repaint();
322 318
323 if ( currentItem ) { 319 if ( currentItem ) {
324 mListView->setCurrentItem( currentItem ); 320 mListView->setCurrentItem( currentItem );
325 mListView->ensureItemVisible( currentItem ); 321 mListView->ensureItemVisible( currentItem );
326 } 322 }
327 } else { 323 } else {
328 // Only need to update on entry. Iterate through and try to find it 324 // Only need to update on entry. Iterate through and try to find it
329 ContactListViewItem *ceItem; 325 ContactListViewItem *ceItem;
330 QListViewItemIterator it( mListView ); 326 QListViewItemIterator it( mListView );
331 while ( it.current() ) { 327 while ( it.current() ) {
332#ifndef KAB_EMBEDDED 328#ifndef KAB_EMBEDDED
333 ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); 329 ceItem = dynamic_cast<ContactListViewItem*>( it.current() );
334#else //KAB_EMBEDDED 330#else //KAB_EMBEDDED
335 ceItem = (ContactListViewItem*)( it.current() ); 331 ceItem = (ContactListViewItem*)( it.current() );
336#endif //KAB_EMBEDDED 332#endif //KAB_EMBEDDED
337 333
338 if ( ceItem && ceItem->addressee().uid() == uid ) { 334 if ( ceItem && ceItem->addressee().uid() == uid ) {
339 ceItem->refresh(); 335 ceItem->refresh();
340 return; 336 return;
341 } 337 }
342 ++it; 338 ++it;
343 } 339 }
344 340
345 refresh( QString::null ); 341 refresh( QString::null );
346 } 342 }
347} 343}
348 344
349QStringList KAddressBookTableView::selectedUids() 345QStringList KAddressBookTableView::selectedUids()
350{ 346{
351 QStringList uidList; 347 QStringList uidList;
352 QListViewItem *item; 348 QListViewItem *item;
353 ContactListViewItem *ceItem; 349 ContactListViewItem *ceItem;
354 350
355 for(item = mListView->firstChild(); item; item = item->itemBelow()) 351 for(item = mListView->firstChild(); item; item = item->itemBelow())
356 { 352 {
357 if (mListView->isSelected( item )) 353 if (mListView->isSelected( item ))
358 { 354 {
359#ifndef KAB_EMBEDDED 355#ifndef KAB_EMBEDDED
360 ceItem = dynamic_cast<ContactListViewItem*>(item); 356 ceItem = dynamic_cast<ContactListViewItem*>(item);