-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 22 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 39 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 16 |
3 files changed, 70 insertions, 7 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index ca21016..b503652 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -1,507 +1,525 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qdragobject.h> | 24 | #include <qdragobject.h> |
25 | #include <qevent.h> | 25 | #include <qevent.h> |
26 | #include <qiconview.h> | 26 | #include <qiconview.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | 31 | ||
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | #include <kabc/addressee.h> | 33 | #include <kabc/addressee.h> |
34 | #include <kconfig.h> | 34 | #include <kconfig.h> |
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #include <klocale.h> | 36 | #include <klocale.h> |
37 | 37 | ||
38 | #include "kabprefs.h" | 38 | #include "kabprefs.h" |
39 | #include "viewmanager.h" | 39 | #include "viewmanager.h" |
40 | 40 | ||
41 | 41 | ||
42 | #include "kaddressbookcardview.h" | 42 | #include "kaddressbookcardview.h" |
43 | 43 | ||
44 | #ifndef KAB_EMBEDDED | 44 | #ifndef KAB_EMBEDDED |
45 | extern "C" { | 45 | extern "C" { |
46 | void *init_libkaddrbk_cardview() | 46 | void *init_libkaddrbk_cardview() |
47 | { | 47 | { |
48 | return ( new CardViewFactory ); | 48 | return ( new CardViewFactory ); |
49 | } | 49 | } |
50 | } | 50 | } |
51 | #endif //KAB_EMBEDDED | 51 | #endif //KAB_EMBEDDED |
52 | 52 | ||
53 | //////////////////////////////// | 53 | //////////////////////////////// |
54 | // AddresseeCardViewItem (internal class) | 54 | // AddresseeCardViewItem (internal class) |
55 | class AddresseeCardViewItem : public CardViewItem | 55 | class AddresseeCardViewItem : public CardViewItem |
56 | { | 56 | { |
57 | public: | 57 | public: |
58 | AddresseeCardViewItem(const KABC::Field::List &fields, | 58 | AddresseeCardViewItem(const KABC::Field::List &fields, |
59 | bool showEmptyFields, | 59 | bool showEmptyFields, |
60 | KABC::AddressBook *doc, const KABC::Addressee &a, | 60 | KABC::AddressBook *doc, const KABC::Addressee &a, |
61 | CardView *parent) | 61 | CardView *parent) |
62 | : CardViewItem(parent, a.realName() ), | 62 | : CardViewItem(parent, a.realName() ), |
63 | mFields( fields ), mShowEmptyFields(showEmptyFields), | 63 | mFields( fields ), mShowEmptyFields(showEmptyFields), |
64 | mDocument(doc), mAddressee(a) | 64 | mDocument(doc), mAddressee(a) |
65 | { | 65 | { |
66 | if ( mFields.isEmpty() ) { | 66 | if ( mFields.isEmpty() ) { |
67 | mFields = KABC::Field::defaultFields(); | 67 | mFields = KABC::Field::defaultFields(); |
68 | } | 68 | } |
69 | refresh(); | 69 | refresh(); |
70 | } | 70 | } |
71 | 71 | ||
72 | const KABC::Addressee &addressee() const { return mAddressee; } | 72 | const KABC::Addressee &addressee() const { return mAddressee; } |
73 | 73 | ||
74 | void refresh() | 74 | void refresh() |
75 | { | 75 | { |
76 | // Update our addressee, since it may have changed elsewhere | 76 | // Update our addressee, since it may have changed elsewhere |
77 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 77 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
78 | 78 | ||
79 | if (!mAddressee.isEmpty()) | 79 | if (!mAddressee.isEmpty()) |
80 | { | 80 | { |
81 | clearFields(); | 81 | clearFields(); |
82 | 82 | ||
83 | // Try all the selected fields until we find one with text. | 83 | // Try all the selected fields until we find one with text. |
84 | // This will limit the number of unlabeled icons in the view | 84 | // This will limit the number of unlabeled icons in the view |
85 | KABC::Field::List::Iterator iter; | 85 | KABC::Field::List::Iterator iter; |
86 | for (iter = mFields.begin(); iter != mFields.end(); ++iter) | 86 | for (iter = mFields.begin(); iter != mFields.end(); ++iter) |
87 | { | 87 | { |
88 | // insert empty fields or not? not doing so saves a bit of memory and CPU | 88 | // insert empty fields or not? not doing so saves a bit of memory and CPU |
89 | // (during geometry calculations), but prevents having equally | 89 | // (during geometry calculations), but prevents having equally |
90 | // wide label columns in all cards, unless CardViewItem/CardView search | 90 | // wide label columns in all cards, unless CardViewItem/CardView search |
91 | // globally for the widest label. (anders) | 91 | // globally for the widest label. (anders) |
92 | //if (mShowEmptyFields || !(*iter)->value( mAddressee ).isEmpty()) | 92 | //if (mShowEmptyFields || !(*iter)->value( mAddressee ).isEmpty()) |
93 | insertField((*iter)->label(), (*iter)->value( mAddressee )); | 93 | insertField((*iter)->label(), (*iter)->value( mAddressee )); |
94 | } | 94 | } |
95 | 95 | ||
96 | // We might want to make this the first field. hmm... -mpilone | 96 | // We might want to make this the first field. hmm... -mpilone |
97 | setCaption( mAddressee.realName() ); | 97 | setCaption( mAddressee.realName() ); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | private: | 101 | private: |
102 | KABC::Field::List mFields; | 102 | KABC::Field::List mFields; |
103 | bool mShowEmptyFields; | 103 | bool mShowEmptyFields; |
104 | KABC::AddressBook *mDocument; | 104 | KABC::AddressBook *mDocument; |
105 | KABC::Addressee mAddressee; | 105 | KABC::Addressee mAddressee; |
106 | }; | 106 | }; |
107 | 107 | ||
108 | /////////////////////////////// | 108 | /////////////////////////////// |
109 | // AddresseeCardView | 109 | // AddresseeCardView |
110 | 110 | ||
111 | AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name) | 111 | AddresseeCardView::AddresseeCardView(QWidget *parent, const char *name) |
112 | : CardView(parent, name) | 112 | : CardView(parent, name) |
113 | { | 113 | { |
114 | setAcceptDrops(true); | 114 | setAcceptDrops(true); |
115 | } | 115 | } |
116 | 116 | ||
117 | AddresseeCardView::~AddresseeCardView() | 117 | AddresseeCardView::~AddresseeCardView() |
118 | { | 118 | { |
119 | } | 119 | } |
120 | void AddresseeCardView::printMe() | 120 | void AddresseeCardView::printMe() |
121 | { | 121 | { |
122 | #ifdef DESKTOP_VERSION | 122 | #ifdef DESKTOP_VERSION |
123 | QPrinter printer; | 123 | QPrinter printer; |
124 | if (!printer.setup() ) | 124 | if (!printer.setup() ) |
125 | return; | 125 | return; |
126 | QPainter p; | 126 | QPainter p; |
127 | p.begin ( &printer ); | 127 | p.begin ( &printer ); |
128 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 128 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
129 | float dx, dy; | 129 | float dx, dy; |
130 | int wid = (m.width() * 9)/10; | 130 | int wid = (m.width() * 9)/10; |
131 | dx = (float) wid/(float)contentsWidth (); | 131 | dx = (float) wid/(float)contentsWidth (); |
132 | dy = (float)(m.height()) / (float)contentsHeight (); | 132 | dy = (float)(m.height()) / (float)contentsHeight (); |
133 | float scale; | 133 | float scale; |
134 | // scale to fit the width or height of the paper | 134 | // scale to fit the width or height of the paper |
135 | if ( dx < dy ) | 135 | if ( dx < dy ) |
136 | scale = dx; | 136 | scale = dx; |
137 | else | 137 | else |
138 | scale = dy; | 138 | scale = dy; |
139 | p.translate( m.width()/10,0 ); | 139 | p.translate( m.width()/10,0 ); |
140 | p.scale( scale, scale ); | 140 | p.scale( scale, scale ); |
141 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 141 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
142 | p.end(); | 142 | p.end(); |
143 | repaint(); | 143 | repaint(); |
144 | #endif | 144 | #endif |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) | 148 | void AddresseeCardView::dragEnterEvent(QDragEnterEvent *e) |
149 | { | 149 | { |
150 | #ifndef KAB_EMBEDDED | 150 | #ifndef KAB_EMBEDDED |
151 | if (QTextDrag::canDecode(e)) | 151 | if (QTextDrag::canDecode(e)) |
152 | e->accept(); | 152 | e->accept(); |
153 | #else //KAB_EMBEDDED | 153 | #else //KAB_EMBEDDED |
154 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); | 154 | qDebug("AddresseeCardView::dragEnterEvent drag&drop is not implemented"); |
155 | #endif //KAB_EMBEDDED | 155 | #endif //KAB_EMBEDDED |
156 | } | 156 | } |
157 | 157 | ||
158 | void AddresseeCardView::dropEvent(QDropEvent *e) | 158 | void AddresseeCardView::dropEvent(QDropEvent *e) |
159 | { | 159 | { |
160 | emit addresseeDropped(e); | 160 | emit addresseeDropped(e); |
161 | } | 161 | } |
162 | 162 | ||
163 | void AddresseeCardView::startDrag() | 163 | void AddresseeCardView::startDrag() |
164 | { | 164 | { |
165 | emit startAddresseeDrag(); | 165 | emit startAddresseeDrag(); |
166 | } | 166 | } |
167 | 167 | ||
168 | 168 | ||
169 | /////////////////////////////// | 169 | /////////////////////////////// |
170 | // KAddressBookCardView | 170 | // KAddressBookCardView |
171 | 171 | ||
172 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, | 172 | KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, |
173 | QWidget *parent, const char *name ) | 173 | QWidget *parent, const char *name ) |
174 | : KAddressBookView( ab, parent, name ) | 174 | : KAddressBookView( ab, parent, name ) |
175 | { | 175 | { |
176 | mShowEmptyFields = false; | 176 | mShowEmptyFields = false; |
177 | 177 | ||
178 | // Init the GUI | 178 | // Init the GUI |
179 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 179 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); |
180 | 180 | ||
181 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); | 181 | mCardView = new AddresseeCardView(viewWidget(), "mCardView"); |
182 | mCardView->setSelectionMode(CardView::Extended); | 182 | mCardView->setSelectionMode(CardView::Extended); |
183 | layout->addWidget(mCardView); | 183 | layout->addWidget(mCardView); |
184 | 184 | ||
185 | // Connect up the signals | 185 | // Connect up the signals |
186 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 186 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
187 | this, SLOT(addresseeExecuted(CardViewItem *))); | 187 | this, SLOT(addresseeExecuted(CardViewItem *))); |
188 | connect(mCardView, SIGNAL(selectionChanged()), | 188 | connect(mCardView, SIGNAL(selectionChanged()), |
189 | this, SLOT(addresseeSelected())); | 189 | this, SLOT(addresseeSelected())); |
190 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), | 190 | connect(mCardView, SIGNAL(addresseeDropped(QDropEvent*)), |
191 | this, SIGNAL(dropped(QDropEvent*))); | 191 | this, SIGNAL(dropped(QDropEvent*))); |
192 | connect(mCardView, SIGNAL(startAddresseeDrag()), | 192 | connect(mCardView, SIGNAL(startAddresseeDrag()), |
193 | this, SIGNAL(startDrag())); | 193 | this, SIGNAL(startDrag())); |
194 | connect(this, SIGNAL(printView()), | 194 | connect(this, SIGNAL(printView()), |
195 | mCardView , SLOT(printMe())); | 195 | mCardView , SLOT(printMe())); |
196 | } | 196 | } |
197 | 197 | ||
198 | KAddressBookCardView::~KAddressBookCardView() | 198 | KAddressBookCardView::~KAddressBookCardView() |
199 | { | 199 | { |
200 | } | 200 | } |
201 | void KAddressBookCardView::setFocusAV() | 201 | void KAddressBookCardView::setFocusAV() |
202 | { | 202 | { |
203 | if ( mCardView ) | 203 | if ( mCardView ) |
204 | mCardView->setFocus(); | 204 | mCardView->setFocus(); |
205 | 205 | ||
206 | } | 206 | } |
207 | void KAddressBookCardView::scrollUP() | 207 | void KAddressBookCardView::scrollUP() |
208 | { | 208 | { |
209 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | 209 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); |
210 | QApplication::postEvent( mCardView, ev ); | 210 | QApplication::postEvent( mCardView, ev ); |
211 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 ); | 211 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 ); |
212 | QApplication::postEvent( mCardView, ev ); | 212 | QApplication::postEvent( mCardView, ev ); |
213 | 213 | ||
214 | } | 214 | } |
215 | void KAddressBookCardView::scrollDOWN() | 215 | void KAddressBookCardView::scrollDOWN() |
216 | { | 216 | { |
217 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 217 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
218 | QApplication::postEvent( mCardView, ev ); | 218 | QApplication::postEvent( mCardView, ev ); |
219 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 ); | 219 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 ); |
220 | QApplication::postEvent( mCardView, ev ); | 220 | QApplication::postEvent( mCardView, ev ); |
221 | } | 221 | } |
222 | void KAddressBookCardView::readConfig(KConfig *config) | 222 | void KAddressBookCardView::readConfig(KConfig *config) |
223 | { | 223 | { |
224 | KAddressBookView::readConfig(config); | 224 | KAddressBookView::readConfig(config); |
225 | 225 | ||
226 | // costum colors? | 226 | // costum colors? |
227 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 227 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
228 | { | 228 | { |
229 | QPalette p( mCardView->palette() ); | 229 | QPalette p( mCardView->palette() ); |
230 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 230 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
231 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 231 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
232 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 232 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
233 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 233 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
234 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 234 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
235 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 235 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
236 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 236 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
237 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 237 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
238 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 238 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
239 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 239 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
240 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 240 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
241 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 241 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
242 | mCardView->viewport()->setPalette( p ); | 242 | mCardView->viewport()->setPalette( p ); |
243 | } | 243 | } |
244 | else | 244 | else |
245 | { | 245 | { |
246 | // needed if turned off during a session. | 246 | // needed if turned off during a session. |
247 | mCardView->viewport()->setPalette( mCardView->palette() ); | 247 | mCardView->viewport()->setPalette( mCardView->palette() ); |
248 | } | 248 | } |
249 | 249 | ||
250 | //custom fonts? | 250 | //custom fonts? |
251 | QFont f( font() ); | 251 | QFont f( font() ); |
252 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | 252 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) |
253 | { | 253 | { |
254 | mCardView->setFont( config->readFontEntry( "TextFont", &f) ); | 254 | mCardView->setFont( config->readFontEntry( "TextFont", &f) ); |
255 | f.setBold( true ); | 255 | f.setBold( true ); |
256 | mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); | 256 | mCardView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); |
257 | } | 257 | } |
258 | else | 258 | else |
259 | { | 259 | { |
260 | mCardView->setFont( f ); | 260 | mCardView->setFont( f ); |
261 | f.setBold( true ); | 261 | f.setBold( true ); |
262 | mCardView->setHeaderFont( f ); | 262 | mCardView->setHeaderFont( f ); |
263 | } | 263 | } |
264 | 264 | ||
265 | mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true)); | 265 | mCardView->setDrawCardBorder(config->readBoolEntry("DrawBorder", true)); |
266 | mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators", | 266 | mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators", |
267 | true)); | 267 | true)); |
268 | mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false)); | 268 | mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false)); |
269 | mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false); | 269 | mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false); |
270 | 270 | ||
271 | mCardView->setShowEmptyFields( mShowEmptyFields ); | 271 | mCardView->setShowEmptyFields( mShowEmptyFields ); |
272 | 272 | ||
273 | mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); | 273 | mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); |
274 | mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); | 274 | mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); |
275 | mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); | 275 | mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); |
276 | mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); | 276 | mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); |
277 | 277 | ||
278 | #if 0 | 278 | #if 0 |
279 | // LR KABPrefs::instance()->mHonorSingleClick is handled and fixed in cardviews contentsMouseDoubleClickEven | 279 | // LR KABPrefs::instance()->mHonorSingleClick is handled and fixed in cardviews contentsMouseDoubleClickEven |
280 | disconnect(mCardView, SIGNAL(executed(CardViewItem *)), | 280 | disconnect(mCardView, SIGNAL(executed(CardViewItem *)), |
281 | this, SLOT(addresseeExecuted(CardViewItem *))); | 281 | this, SLOT(addresseeExecuted(CardViewItem *))); |
282 | 282 | ||
283 | if (KABPrefs::instance()->mHonorSingleClick) | 283 | if (KABPrefs::instance()->mHonorSingleClick) |
284 | connect(mCardView, SIGNAL(executed(CardViewItem *)), | 284 | connect(mCardView, SIGNAL(executed(CardViewItem *)), |
285 | this, SLOT(addresseeExecuted(CardViewItem *))); | 285 | this, SLOT(addresseeExecuted(CardViewItem *))); |
286 | else | 286 | else |
287 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), | 287 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), |
288 | this, SLOT(addresseeExecuted(CardViewItem *))); | 288 | this, SLOT(addresseeExecuted(CardViewItem *))); |
289 | #endif | 289 | #endif |
290 | 290 | ||
291 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), | 291 | connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), |
292 | this, SLOT(addresseeExecuted(CardViewItem *))); | 292 | this, SLOT(addresseeExecuted(CardViewItem *))); |
293 | } | 293 | } |
294 | 294 | ||
295 | void KAddressBookCardView::writeConfig( KConfig *config ) | 295 | void KAddressBookCardView::writeConfig( KConfig *config ) |
296 | { | 296 | { |
297 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); | 297 | config->writeEntry( "ItemWidth", mCardView->itemWidth() ); |
298 | KAddressBookView::writeConfig( config ); | 298 | KAddressBookView::writeConfig( config ); |
299 | } | 299 | } |
300 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | 300 | void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) |
301 | { | 301 | { |
302 | mCardView->clear(); | 302 | mCardView->clear(); |
303 | if ( s.isEmpty() || s == "*" ) { | 303 | if ( s.isEmpty() || s == "*" ) { |
304 | refresh(); | 304 | refresh(); |
305 | return; | 305 | return; |
306 | } | 306 | } |
307 | QRegExp re = getRegExp( s ); | 307 | QRegExp re = getRegExp( s ); |
308 | if (!re.isValid()) | 308 | if (!re.isValid()) |
309 | return; | 309 | return; |
310 | mCardView->viewport()->setUpdatesEnabled( false ); | 310 | mCardView->viewport()->setUpdatesEnabled( false ); |
311 | KABC::Addressee::List addresseeList = addressees(); | 311 | KABC::Addressee::List addresseeList = addressees(); |
312 | KABC::Addressee::List::Iterator it; | 312 | KABC::Addressee::List::Iterator it; |
313 | if ( field ) { | 313 | if ( field ) { |
314 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 314 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
315 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 315 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
316 | continue; | 316 | continue; |
317 | #if QT_VERSION >= 0x030000 | 317 | #if QT_VERSION >= 0x030000 |
318 | if (re.search(field->value( *it ).lower()) == 0) | 318 | if (re.search(field->value( *it ).lower()) == 0) |
319 | #else | 319 | #else |
320 | if (re.match(field->value( *it ).lower()) == 0) | 320 | if (re.match(field->value( *it ).lower()) == 0) |
321 | #endif | 321 | #endif |
322 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 322 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
323 | addressBook(), *it, mCardView); | 323 | addressBook(), *it, mCardView); |
324 | 324 | ||
325 | } | 325 | } |
326 | } else { | 326 | } else { |
327 | KABC::Field::List fieldList = allFields(); | 327 | KABC::Field::List fieldList = allFields(); |
328 | KABC::Field::List::ConstIterator fieldIt; | 328 | KABC::Field::List::ConstIterator fieldIt; |
329 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 329 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
330 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 330 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
331 | continue; | 331 | continue; |
332 | bool match = false; | ||
332 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 333 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
333 | #if QT_VERSION >= 0x030000 | 334 | #if QT_VERSION >= 0x030000 |
334 | if (re.search((*fieldIt)->value( *it ).lower()) == 0) | 335 | if (re.search((*fieldIt)->value( *it ).lower()) == 0) |
335 | #else | 336 | #else |
336 | if (re.match((*fieldIt)->value( *it ).lower()) == 0) | 337 | if (re.match((*fieldIt)->value( *it ).lower()) == 0) |
337 | #endif | 338 | #endif |
338 | { | 339 | { |
339 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | 340 | new AddresseeCardViewItem(fields(), mShowEmptyFields, |
340 | addressBook(), *it, mCardView); | 341 | addressBook(), *it, mCardView); |
342 | match = true; | ||
341 | break; | 343 | break; |
342 | } | 344 | } |
343 | } | 345 | } |
346 | if ( ! match ) { | ||
347 | if ( (*it).matchPhoneNumber( &re ) ) { | ||
348 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | ||
349 | addressBook(), *it, mCardView); | ||
350 | match = true; | ||
351 | break; | ||
352 | } | ||
353 | } | ||
354 | if ( ! match ) { | ||
355 | if ( (*it).matchAddress( &re ) ) { | ||
356 | new AddresseeCardViewItem(fields(), mShowEmptyFields, | ||
357 | addressBook(), *it, mCardView); | ||
358 | match = true; | ||
359 | break; | ||
360 | } | ||
361 | } | ||
344 | } | 362 | } |
345 | } | 363 | } |
346 | mCardView->viewport()->setUpdatesEnabled( true ); | 364 | mCardView->viewport()->setUpdatesEnabled( true ); |
347 | mCardView->viewport()->update(); | 365 | mCardView->viewport()->update(); |
348 | if ( mCardView->firstItem() ) { | 366 | if ( mCardView->firstItem() ) { |
349 | mCardView->setCurrentItem ( mCardView->firstItem() ); | 367 | mCardView->setCurrentItem ( mCardView->firstItem() ); |
350 | mCardView->setSelected ( mCardView->firstItem() , true ); | 368 | mCardView->setSelected ( mCardView->firstItem() , true ); |
351 | } | 369 | } |
352 | else | 370 | else |
353 | emit selected(QString::null); | 371 | emit selected(QString::null); |
354 | } | 372 | } |
355 | QStringList KAddressBookCardView::selectedUids() | 373 | QStringList KAddressBookCardView::selectedUids() |
356 | { | 374 | { |
357 | QStringList uidList; | 375 | QStringList uidList; |
358 | CardViewItem *item; | 376 | CardViewItem *item; |
359 | AddresseeCardViewItem *aItem; | 377 | AddresseeCardViewItem *aItem; |
360 | 378 | ||
361 | for (item = mCardView->firstItem(); item; item = item->nextItem()) | 379 | for (item = mCardView->firstItem(); item; item = item->nextItem()) |
362 | { | 380 | { |
363 | if (item->isSelected()) | 381 | if (item->isSelected()) |
364 | { | 382 | { |
365 | #ifndef KAB_EMBEDDED | 383 | #ifndef KAB_EMBEDDED |
366 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 384 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
367 | #else //KAB_EMBEDDED | 385 | #else //KAB_EMBEDDED |
368 | aItem = (AddresseeCardViewItem*)(item); | 386 | aItem = (AddresseeCardViewItem*)(item); |
369 | #endif //KAB_EMBEDDED | 387 | #endif //KAB_EMBEDDED |
370 | if (aItem) | 388 | if (aItem) |
371 | uidList << aItem->addressee().uid(); | 389 | uidList << aItem->addressee().uid(); |
372 | } | 390 | } |
373 | } | 391 | } |
374 | 392 | ||
375 | return uidList; | 393 | return uidList; |
376 | } | 394 | } |
377 | 395 | ||
378 | void KAddressBookCardView::refresh(QString uid) | 396 | void KAddressBookCardView::refresh(QString uid) |
379 | { | 397 | { |
380 | CardViewItem *item; | 398 | CardViewItem *item; |
381 | AddresseeCardViewItem *aItem; | 399 | AddresseeCardViewItem *aItem; |
382 | 400 | ||
383 | if (uid.isNull()) | 401 | if (uid.isNull()) |
384 | { | 402 | { |
385 | // Rebuild the view | 403 | // Rebuild the view |
386 | mCardView->viewport()->setUpdatesEnabled( false ); | 404 | mCardView->viewport()->setUpdatesEnabled( false ); |
387 | mCardView->clear(); | 405 | mCardView->clear(); |
388 | 406 | ||
389 | KABC::Addressee::List addresseeList = addressees(); | 407 | KABC::Addressee::List addresseeList = addressees(); |
390 | KABC::Addressee::List::Iterator iter; | 408 | KABC::Addressee::List::Iterator iter; |
391 | for (iter = addresseeList.begin(); iter != addresseeList.end(); ++iter) | 409 | for (iter = addresseeList.begin(); iter != addresseeList.end(); ++iter) |
392 | { | 410 | { |
393 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) | 411 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) |
394 | continue; | 412 | continue; |
395 | aItem = new AddresseeCardViewItem(fields(), mShowEmptyFields, | 413 | aItem = new AddresseeCardViewItem(fields(), mShowEmptyFields, |
396 | addressBook(), *iter, mCardView); | 414 | addressBook(), *iter, mCardView); |
397 | } | 415 | } |
398 | mCardView->viewport()->setUpdatesEnabled( true ); | 416 | mCardView->viewport()->setUpdatesEnabled( true ); |
399 | mCardView->viewport()->update(); | 417 | mCardView->viewport()->update(); |
400 | 418 | ||
401 | // by default nothing is selected | 419 | // by default nothing is selected |
402 | emit selected(QString::null); | 420 | emit selected(QString::null); |
403 | } | 421 | } |
404 | else | 422 | else |
405 | { | 423 | { |
406 | // Try to find the one to refresh | 424 | // Try to find the one to refresh |
407 | bool found = false; | 425 | bool found = false; |
408 | for (item = mCardView->firstItem(); item && !found; | 426 | for (item = mCardView->firstItem(); item && !found; |
409 | item = item->nextItem()) | 427 | item = item->nextItem()) |
410 | { | 428 | { |
411 | #ifndef KAB_EMBEDDED | 429 | #ifndef KAB_EMBEDDED |
412 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 430 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
413 | #else //KAB_EMBEDDED | 431 | #else //KAB_EMBEDDED |
414 | aItem = (AddresseeCardViewItem*)(item); | 432 | aItem = (AddresseeCardViewItem*)(item); |
415 | #endif //KAB_EMBEDDED | 433 | #endif //KAB_EMBEDDED |
416 | 434 | ||
417 | if ((aItem) && (aItem->addressee().uid() == uid)) | 435 | if ((aItem) && (aItem->addressee().uid() == uid)) |
418 | { | 436 | { |
419 | aItem->refresh(); | 437 | aItem->refresh(); |
420 | found = true; | 438 | found = true; |
421 | } | 439 | } |
422 | } | 440 | } |
423 | } | 441 | } |
424 | } | 442 | } |
425 | 443 | ||
426 | void KAddressBookCardView::setSelected(QString uid, bool selected) | 444 | void KAddressBookCardView::setSelected(QString uid, bool selected) |
427 | { | 445 | { |
428 | CardViewItem *item; | 446 | CardViewItem *item; |
429 | AddresseeCardViewItem *aItem; | 447 | AddresseeCardViewItem *aItem; |
430 | 448 | ||
431 | if (uid.isNull()) | 449 | if (uid.isNull()) |
432 | { | 450 | { |
433 | mCardView->selectAll(selected); | 451 | mCardView->selectAll(selected); |
434 | } | 452 | } |
435 | else | 453 | else |
436 | { | 454 | { |
437 | bool found = false; | 455 | bool found = false; |
438 | for (item = mCardView->firstItem(); item && !found; | 456 | for (item = mCardView->firstItem(); item && !found; |
439 | item = item->nextItem()) | 457 | item = item->nextItem()) |
440 | { | 458 | { |
441 | #ifndef KAB_EMBEDDED | 459 | #ifndef KAB_EMBEDDED |
442 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 460 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
443 | #else //KAB_EMBEDDED | 461 | #else //KAB_EMBEDDED |
444 | aItem = (AddresseeCardViewItem*)(item); | 462 | aItem = (AddresseeCardViewItem*)(item); |
445 | #endif //KAB_EMBEDDED | 463 | #endif //KAB_EMBEDDED |
446 | 464 | ||
447 | if ((aItem) && (aItem->addressee().uid() == uid)) | 465 | if ((aItem) && (aItem->addressee().uid() == uid)) |
448 | { | 466 | { |
449 | mCardView->setSelected(aItem, selected); | 467 | mCardView->setSelected(aItem, selected); |
450 | mCardView->ensureItemVisible(item); | 468 | mCardView->ensureItemVisible(item); |
451 | found = true; | 469 | found = true; |
452 | } | 470 | } |
453 | } | 471 | } |
454 | } | 472 | } |
455 | } | 473 | } |
456 | 474 | ||
457 | //US added an additional method without parameter | 475 | //US added an additional method without parameter |
458 | void KAddressBookCardView::setSelected() | 476 | void KAddressBookCardView::setSelected() |
459 | { | 477 | { |
460 | setSelected(QString::null, true); | 478 | setSelected(QString::null, true); |
461 | } | 479 | } |
462 | 480 | ||
463 | void KAddressBookCardView::addresseeExecuted(CardViewItem *item) | 481 | void KAddressBookCardView::addresseeExecuted(CardViewItem *item) |
464 | { | 482 | { |
465 | #ifndef KAB_EMBEDDED | 483 | #ifndef KAB_EMBEDDED |
466 | AddresseeCardViewItem *aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 484 | AddresseeCardViewItem *aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
467 | #else //KAB_EMBEDDED | 485 | #else //KAB_EMBEDDED |
468 | AddresseeCardViewItem *aItem = (AddresseeCardViewItem*)(item); | 486 | AddresseeCardViewItem *aItem = (AddresseeCardViewItem*)(item); |
469 | #endif //KAB_EMBEDDED | 487 | #endif //KAB_EMBEDDED |
470 | if (aItem) | 488 | if (aItem) |
471 | { | 489 | { |
472 | //kdDebug()<<"... even has a valid item:)"<<endl; | 490 | //kdDebug()<<"... even has a valid item:)"<<endl; |
473 | emit executed(aItem->addressee().uid()); | 491 | emit executed(aItem->addressee().uid()); |
474 | } | 492 | } |
475 | } | 493 | } |
476 | 494 | ||
477 | void KAddressBookCardView::addresseeSelected() | 495 | void KAddressBookCardView::addresseeSelected() |
478 | { | 496 | { |
479 | CardViewItem *item; | 497 | CardViewItem *item; |
480 | AddresseeCardViewItem *aItem; | 498 | AddresseeCardViewItem *aItem; |
481 | 499 | ||
482 | bool found = false; | 500 | bool found = false; |
483 | for (item = mCardView->firstItem(); item && !found; | 501 | for (item = mCardView->firstItem(); item && !found; |
484 | item = item->nextItem()) | 502 | item = item->nextItem()) |
485 | { | 503 | { |
486 | if (item->isSelected()) | 504 | if (item->isSelected()) |
487 | { | 505 | { |
488 | #ifndef KAB_EMBEDDED | 506 | #ifndef KAB_EMBEDDED |
489 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); | 507 | aItem = dynamic_cast<AddresseeCardViewItem*>(item); |
490 | #else //KAB_EMBEDDED | 508 | #else //KAB_EMBEDDED |
491 | aItem = (AddresseeCardViewItem*)(item); | 509 | aItem = (AddresseeCardViewItem*)(item); |
492 | #endif //KAB_EMBEDDED | 510 | #endif //KAB_EMBEDDED |
493 | if ( aItem ) | 511 | if ( aItem ) |
494 | { | 512 | { |
495 | emit selected(aItem->addressee().uid()); | 513 | emit selected(aItem->addressee().uid()); |
496 | found = true; | 514 | found = true; |
497 | } | 515 | } |
498 | } | 516 | } |
499 | } | 517 | } |
500 | 518 | ||
501 | if (!found) | 519 | if (!found) |
502 | emit selected(QString::null); | 520 | emit selected(QString::null); |
503 | 521 | ||
504 | } | 522 | } |
505 | #ifndef KAB_EMBEDDED | 523 | #ifndef KAB_EMBEDDED |
506 | #include "kaddressbookcardview.moc" | 524 | #include "kaddressbookcardview.moc" |
507 | #endif //KAB_EMBEDDED | 525 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index 4bbdf1d..d6ddec3 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp | |||
@@ -1,452 +1,481 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef KAB_EMBEDDED | 24 | #ifndef KAB_EMBEDDED |
25 | #include <qiconview.h> | 25 | #include <qiconview.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | 27 | ||
28 | #include <kabc/addressee.h> | 28 | #include <kabc/addressee.h> |
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | #include <kdebug.h> | 30 | #include <kdebug.h> |
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kiconloader.h> | 32 | #include <kiconloader.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | #else //KAB_EMBEDDED | 35 | #else //KAB_EMBEDDED |
36 | #endif //KAB_EMBEDDED | 36 | #endif //KAB_EMBEDDED |
37 | 37 | ||
38 | #include <kabc/addressbook.h> | 38 | #include <kabc/addressbook.h> |
39 | #include "kabprefs.h" | 39 | #include "kabprefs.h" |
40 | #include "viewmanager.h" | 40 | #include "viewmanager.h" |
41 | #include "kaddressbookiconview.h" | 41 | #include "kaddressbookiconview.h" |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | #include <qapplication.h> | 44 | #include <qapplication.h> |
45 | #include <kglobal.h> | 45 | #include <kglobal.h> |
46 | /*US transfered to the headerfile | 46 | /*US transfered to the headerfile |
47 | class IconViewFactory : public ViewFactory | 47 | class IconViewFactory : public ViewFactory |
48 | { | 48 | { |
49 | public: | 49 | public: |
50 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) | 50 | KAddressBookView *view( KABC::AddressBook *ab, QWidget *parent, const char *name ) |
51 | { | 51 | { |
52 | return new KAddressBookIconView( ab, parent, name ); | 52 | return new KAddressBookIconView( ab, parent, name ); |
53 | } | 53 | } |
54 | 54 | ||
55 | QString type() const { return "Icon"; } | 55 | QString type() const { return "Icon"; } |
56 | 56 | ||
57 | QString description() const { return i18n( "Icons represent contacts. Very simple view." ); } | 57 | QString description() const { return i18n( "Icons represent contacts. Very simple view." ); } |
58 | }; | 58 | }; |
59 | 59 | ||
60 | */ | 60 | */ |
61 | 61 | ||
62 | extern "C" { | 62 | extern "C" { |
63 | void *init_libkaddrbk_iconview() | 63 | void *init_libkaddrbk_iconview() |
64 | { | 64 | { |
65 | return ( new IconViewFactory ); | 65 | return ( new IconViewFactory ); |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | //////////////////////////////// | 69 | //////////////////////////////// |
70 | // AddresseeIconView (internal class) | 70 | // AddresseeIconView (internal class) |
71 | #ifndef KAB_EMBEDDED | 71 | #ifndef KAB_EMBEDDED |
72 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) | 72 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) |
73 | : KIconView(parent, name) | 73 | : KIconView(parent, name) |
74 | #else //KAB_EMBEDDED | 74 | #else //KAB_EMBEDDED |
75 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) | 75 | AddresseeIconView::AddresseeIconView(QWidget *parent, const char *name) |
76 | : QIconView(parent, name) | 76 | : QIconView(parent, name) |
77 | #endif //KAB_EMBEDDED | 77 | #endif //KAB_EMBEDDED |
78 | 78 | ||
79 | { | 79 | { |
80 | setSelectionMode( QIconView::Extended ); | 80 | setSelectionMode( QIconView::Extended ); |
81 | setResizeMode( QIconView::Adjust ); | 81 | setResizeMode( QIconView::Adjust ); |
82 | setWordWrapIconText( true ); | 82 | setWordWrapIconText( true ); |
83 | setGridX( 100 ); | 83 | setGridX( 100 ); |
84 | setItemsMovable(false); | 84 | setItemsMovable(false); |
85 | setSorting(true, true); | 85 | setSorting(true, true); |
86 | 86 | ||
87 | 87 | ||
88 | //US ??? setMode( KIconView::Select ); | 88 | //US ??? setMode( KIconView::Select ); |
89 | 89 | ||
90 | #ifndef KAB_EMBEDDED | 90 | #ifndef KAB_EMBEDDED |
91 | 91 | ||
92 | connect(this, SIGNAL(dropped(QDropEvent*, const QValueList<QIconDragItem>&)), | 92 | connect(this, SIGNAL(dropped(QDropEvent*, const QValueList<QIconDragItem>&)), |
93 | this, SLOT(itemDropped(QDropEvent*, const QValueList<QIconDragItem>&))); | 93 | this, SLOT(itemDropped(QDropEvent*, const QValueList<QIconDragItem>&))); |
94 | #endif //KAB_EMBEDDED | 94 | #endif //KAB_EMBEDDED |
95 | } | 95 | } |
96 | 96 | ||
97 | AddresseeIconView::~AddresseeIconView() | 97 | AddresseeIconView::~AddresseeIconView() |
98 | { | 98 | { |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | void AddresseeIconView::itemDropped(QDropEvent *e, | 102 | void AddresseeIconView::itemDropped(QDropEvent *e, |
103 | const QValueList<QIconDragItem> &) | 103 | const QValueList<QIconDragItem> &) |
104 | { | 104 | { |
105 | emit addresseeDropped(e); | 105 | emit addresseeDropped(e); |
106 | } | 106 | } |
107 | 107 | ||
108 | QDragObject *AddresseeIconView::dragObject() | 108 | QDragObject *AddresseeIconView::dragObject() |
109 | { | 109 | { |
110 | emit startAddresseeDrag(); | 110 | emit startAddresseeDrag(); |
111 | 111 | ||
112 | // We never want IconView to start the drag | 112 | // We never want IconView to start the drag |
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
115 | //////////////////////////////// | 115 | //////////////////////////////// |
116 | // AddresseeIconViewItem (internal class) | 116 | // AddresseeIconViewItem (internal class) |
117 | #ifndef KAB_EMBEDDED | 117 | #ifndef KAB_EMBEDDED |
118 | class AddresseeIconViewItem : public KIconViewItem | 118 | class AddresseeIconViewItem : public KIconViewItem |
119 | #else //KAB_EMBEDDED | 119 | #else //KAB_EMBEDDED |
120 | class AddresseeIconViewItem : public QIconViewItem | 120 | class AddresseeIconViewItem : public QIconViewItem |
121 | #endif //KAB_EMBEDDED | 121 | #endif //KAB_EMBEDDED |
122 | { | 122 | { |
123 | public: | 123 | public: |
124 | #ifndef KAB_EMBEDDED | 124 | #ifndef KAB_EMBEDDED |
125 | AddresseeIconViewItem(const KABC::Field::List &fields, | 125 | AddresseeIconViewItem(const KABC::Field::List &fields, |
126 | KABC::AddressBook *doc, const KABC::Addressee &a, | 126 | KABC::AddressBook *doc, const KABC::Addressee &a, |
127 | QIconView *parent) | 127 | QIconView *parent) |
128 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 128 | : KIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
129 | #else //KAB_EMBEDDED | 129 | #else //KAB_EMBEDDED |
130 | AddresseeIconViewItem(const KABC::Field::List &fields, | 130 | AddresseeIconViewItem(const KABC::Field::List &fields, |
131 | KABC::AddressBook *doc, const KABC::Addressee &a, | 131 | KABC::AddressBook *doc, const KABC::Addressee &a, |
132 | QIconView *parent) | 132 | QIconView *parent) |
133 | : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) | 133 | : QIconViewItem(parent), mFields( fields ), mDocument(doc), mAddressee(a) |
134 | #endif //KAB_EMBEDDED | 134 | #endif //KAB_EMBEDDED |
135 | { | 135 | { |
136 | if ( mFields.isEmpty() ) { | 136 | if ( mFields.isEmpty() ) { |
137 | mFields = KABC::Field::defaultFields(); | 137 | mFields = KABC::Field::defaultFields(); |
138 | } | 138 | } |
139 | refresh(); | 139 | refresh(); |
140 | } | 140 | } |
141 | 141 | ||
142 | const KABC::Addressee &addressee() const { return mAddressee; } | 142 | const KABC::Addressee &addressee() const { return mAddressee; } |
143 | 143 | ||
144 | void refresh() | 144 | void refresh() |
145 | { | 145 | { |
146 | // Update our addressee, since it may have changed elsewhere | 146 | // Update our addressee, since it may have changed elsewhere |
147 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 147 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
148 | 148 | ||
149 | if (!mAddressee.isEmpty()) | 149 | if (!mAddressee.isEmpty()) |
150 | setText( mAddressee.givenName() + " " + mAddressee.familyName() ); | 150 | setText( mAddressee.givenName() + " " + mAddressee.familyName() ); |
151 | 151 | ||
152 | QPixmap icon; | 152 | QPixmap icon; |
153 | QPixmap defaultIcon( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ) ); | 153 | |
154 | KABC::Picture pic = mAddressee.photo(); | 154 | KABC::Picture pic = mAddressee.photo(); |
155 | if ( pic.data().isNull() ) | 155 | if ( pic.data().isNull() ) |
156 | pic = mAddressee.logo(); | 156 | pic = mAddressee.logo(); |
157 | 157 | ||
158 | if ( pic.isIntern() && !pic.data().isNull() ) { | 158 | if ( pic.isIntern() && !pic.data().isNull() ) { |
159 | QImage img = pic.data(); | 159 | QImage img = pic.data(); |
160 | #ifndef KAB_EMBEDDED | 160 | #ifndef KAB_EMBEDDED |
161 | if ( img.width() > img.height() ) | 161 | if ( img.width() > img.height() ) |
162 | icon = img.scaleWidth( 32 ); | 162 | icon = img.scaleWidth( 32 ); |
163 | else | 163 | else |
164 | icon = img.scaleHeight( 32 ); | 164 | icon = img.scaleHeight( 32 ); |
165 | #else //KAB_EMBEDDED | 165 | #else //KAB_EMBEDDED |
166 | |||
167 | int wid = pic.data().width(); | ||
168 | int hei = pic.data().height(); | ||
169 | int max = 48; | ||
170 | if ( wid > max || hei > max ) { | ||
171 | if ( wid > hei ) { | ||
172 | hei = (hei*max)/wid; | ||
173 | wid = max; | ||
174 | } else { | ||
175 | wid = (wid*max)/hei; | ||
176 | hei = max; | ||
177 | } | ||
178 | } | ||
166 | qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor"); | 179 | qDebug("AddresseeIconViewItem::refresh - scale here dependend of the displaysize and the right factor"); |
167 | icon.convertFromImage(img.smoothScale(32, 32)); | 180 | icon.convertFromImage(img.smoothScale(wid, hei)); |
168 | #endif //KAB_EMBEDDED | 181 | #endif //KAB_EMBEDDED |
169 | 182 | ||
170 | } else | 183 | } else { |
171 | icon = defaultIcon; | 184 | icon = KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop, 128 ); |
172 | 185 | } | |
173 | setPixmap( icon ); | 186 | setPixmap( icon ); |
174 | } | 187 | } |
175 | 188 | ||
176 | private: | 189 | private: |
177 | KABC::Field::List mFields; | 190 | KABC::Field::List mFields; |
178 | KABC::AddressBook *mDocument; | 191 | KABC::AddressBook *mDocument; |
179 | KABC::Addressee mAddressee; | 192 | KABC::Addressee mAddressee; |
180 | }; | 193 | }; |
181 | 194 | ||
182 | /////////////////////////////// | 195 | /////////////////////////////// |
183 | // KAddressBookView | 196 | // KAddressBookView |
184 | 197 | ||
185 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, | 198 | KAddressBookIconView::KAddressBookIconView( KABC::AddressBook *ab, |
186 | QWidget *parent, const char *name) | 199 | QWidget *parent, const char *name) |
187 | : KAddressBookView( ab, parent, name ) | 200 | : KAddressBookView( ab, parent, name ) |
188 | { | 201 | { |
189 | // Init the GUI | 202 | // Init the GUI |
190 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); | 203 | QVBoxLayout *layout = new QVBoxLayout(viewWidget()); |
191 | 204 | ||
192 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); | 205 | mIconView = new AddresseeIconView(viewWidget(), "mIconView"); |
193 | layout->addWidget(mIconView); | 206 | layout->addWidget(mIconView); |
194 | 207 | ||
195 | // Connect up the signals | 208 | // Connect up the signals |
196 | 209 | ||
197 | //US method executed is part of KIconView | 210 | //US method executed is part of KIconView |
198 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 211 | //US connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
199 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 212 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
200 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 213 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
201 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 214 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
202 | 215 | ||
203 | connect(mIconView, SIGNAL(selectionChanged()), | 216 | connect(mIconView, SIGNAL(selectionChanged()), |
204 | this, SLOT(addresseeSelected())); | 217 | this, SLOT(addresseeSelected())); |
205 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), | 218 | connect(mIconView, SIGNAL(addresseeDropped(QDropEvent*)), |
206 | this, SIGNAL(dropped(QDropEvent*))); | 219 | this, SIGNAL(dropped(QDropEvent*))); |
207 | connect(mIconView, SIGNAL(startAddresseeDrag()), | 220 | connect(mIconView, SIGNAL(startAddresseeDrag()), |
208 | this, SIGNAL(startDrag())); | 221 | this, SIGNAL(startDrag())); |
209 | } | 222 | } |
210 | 223 | ||
211 | KAddressBookIconView::~KAddressBookIconView() | 224 | KAddressBookIconView::~KAddressBookIconView() |
212 | { | 225 | { |
213 | } | 226 | } |
214 | void KAddressBookIconView::setFocusAV() | 227 | void KAddressBookIconView::setFocusAV() |
215 | { | 228 | { |
216 | if ( mIconView ) | 229 | if ( mIconView ) |
217 | mIconView->setFocus(); | 230 | mIconView->setFocus(); |
218 | } | 231 | } |
219 | 232 | ||
220 | 233 | ||
221 | void KAddressBookIconView::scrollUP() | 234 | void KAddressBookIconView::scrollUP() |
222 | { | 235 | { |
223 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | 236 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); |
224 | QApplication::postEvent( mIconView, ev ); | 237 | QApplication::postEvent( mIconView, ev ); |
225 | } | 238 | } |
226 | void KAddressBookIconView::scrollDOWN() | 239 | void KAddressBookIconView::scrollDOWN() |
227 | { | 240 | { |
228 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 241 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
229 | QApplication::postEvent( mIconView, ev ); | 242 | QApplication::postEvent( mIconView, ev ); |
230 | } | 243 | } |
231 | void KAddressBookIconView::readConfig(KConfig *config) | 244 | void KAddressBookIconView::readConfig(KConfig *config) |
232 | { | 245 | { |
233 | KAddressBookView::readConfig(config); | 246 | KAddressBookView::readConfig(config); |
234 | 247 | ||
235 | //US method executed is part of KIconView | 248 | //US method executed is part of KIconView |
236 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), | 249 | //US disconnect(mIconView, SIGNAL(executed(QIconViewItem *)), |
237 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); | 250 | //US this, SLOT(addresseeExecuted(QIconViewItem *))); |
238 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 251 | disconnect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
239 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 252 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
240 | 253 | ||
241 | //US method executed is part of KIconView. Use selectionChanged instead | 254 | //US method executed is part of KIconView. Use selectionChanged instead |
242 | /*US | 255 | /*US |
243 | if (KABPrefs::instance()->mHonorSingleClick) | 256 | if (KABPrefs::instance()->mHonorSingleClick) |
244 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), | 257 | connect(mIconView, SIGNAL(executed(QIconViewItem *)), |
245 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 258 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
246 | else | 259 | else |
247 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), | 260 | connect(mIconView, SIGNAL(doubleClicked(QIconViewItem *)), |
248 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 261 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
249 | */ | 262 | */ |
250 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), | 263 | connect(mIconView, SIGNAL(selectionChanged(QIconViewItem *)), |
251 | this, SLOT(addresseeExecuted(QIconViewItem *))); | 264 | this, SLOT(addresseeExecuted(QIconViewItem *))); |
252 | 265 | ||
253 | } | 266 | } |
254 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | 267 | void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) |
255 | { | 268 | { |
256 | mIconView->clear(); | 269 | mIconView->clear(); |
257 | mIconList.clear(); | 270 | mIconList.clear(); |
258 | if ( s.isEmpty() || s == "*" ) { | 271 | if ( s.isEmpty() || s == "*" ) { |
259 | refresh(); | 272 | refresh(); |
260 | return; | 273 | return; |
261 | } | 274 | } |
262 | QRegExp re = getRegExp( s ); | 275 | QRegExp re = getRegExp( s ); |
263 | if (!re.isValid()) | 276 | if (!re.isValid()) |
264 | return; | 277 | return; |
265 | KABC::Addressee::List addresseeList = addressees(); | 278 | KABC::Addressee::List addresseeList = addressees(); |
266 | KABC::Addressee::List::Iterator it; | 279 | KABC::Addressee::List::Iterator it; |
267 | if ( field ) { | 280 | if ( field ) { |
268 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 281 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
269 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 282 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
270 | continue; | 283 | continue; |
271 | #if QT_VERSION >= 0x030000 | 284 | #if QT_VERSION >= 0x030000 |
272 | if (re.search(field->value( *it ).lower()) == 0) | 285 | if (re.search(field->value( *it ).lower()) == 0) |
273 | #else | 286 | #else |
274 | if (re.match(field->value( *it ).lower()) == 0) | 287 | if (re.match(field->value( *it ).lower()) == 0) |
275 | #endif | 288 | #endif |
276 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 289 | mIconList.append(new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
277 | 290 | ||
278 | 291 | ||
279 | } | 292 | } |
280 | } else { | 293 | } else { |
281 | KABC::Field::List fieldList = allFields(); | 294 | KABC::Field::List fieldList = allFields(); |
282 | KABC::Field::List::ConstIterator fieldIt; | 295 | KABC::Field::List::ConstIterator fieldIt; |
283 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 296 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
284 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 297 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
285 | continue; | 298 | continue; |
299 | bool match = false; | ||
286 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 300 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
287 | #if QT_VERSION >= 0x030000 | 301 | #if QT_VERSION >= 0x030000 |
288 | if (re.search((*fieldIt)->value( *it ).lower()) == 0) | 302 | if (re.search((*fieldIt)->value( *it ).lower()) == 0) |
289 | #else | 303 | #else |
290 | if (re.match((*fieldIt)->value( *it ).lower()) == 0) | 304 | if (re.match((*fieldIt)->value( *it ).lower()) == 0) |
291 | #endif | 305 | #endif |
292 | { | 306 | { |
293 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | 307 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); |
308 | match = true; | ||
294 | break; | 309 | break; |
295 | } | 310 | } |
311 | } | ||
312 | if ( ! match ) { | ||
313 | if ( (*it).matchPhoneNumber( &re ) ) { | ||
314 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | ||
315 | match = true; | ||
316 | break; | ||
317 | } | ||
318 | } | ||
319 | if ( ! match ) { | ||
320 | if ( (*it).matchAddress( &re ) ) { | ||
321 | mIconList.append( new AddresseeIconViewItem( fields(), addressBook(), *it, mIconView )); | ||
322 | match = true; | ||
323 | break; | ||
324 | } | ||
296 | } | 325 | } |
297 | } | 326 | } |
298 | } | 327 | } |
299 | mIconView->arrangeItemsInGrid( true ); | 328 | mIconView->arrangeItemsInGrid( true ); |
300 | if ( mIconView->firstItem() ) { | 329 | if ( mIconView->firstItem() ) { |
301 | mIconView->setCurrentItem ( mIconView->firstItem() ); | 330 | mIconView->setCurrentItem ( mIconView->firstItem() ); |
302 | mIconView->setSelected ( mIconView->firstItem() , true ); | 331 | mIconView->setSelected ( mIconView->firstItem() , true ); |
303 | } | 332 | } |
304 | else | 333 | else |
305 | emit selected(QString::null); | 334 | emit selected(QString::null); |
306 | } | 335 | } |
307 | QStringList KAddressBookIconView::selectedUids() | 336 | QStringList KAddressBookIconView::selectedUids() |
308 | { | 337 | { |
309 | QStringList uidList; | 338 | QStringList uidList; |
310 | QIconViewItem *item; | 339 | QIconViewItem *item; |
311 | AddresseeIconViewItem *aItem; | 340 | AddresseeIconViewItem *aItem; |
312 | 341 | ||
313 | for (item = mIconView->firstItem(); item; item = item->nextItem()) | 342 | for (item = mIconView->firstItem(); item; item = item->nextItem()) |
314 | { | 343 | { |
315 | if (item->isSelected()) | 344 | if (item->isSelected()) |
316 | { | 345 | { |
317 | #ifndef KAB_EMBEDDED | 346 | #ifndef KAB_EMBEDDED |
318 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 347 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
319 | #else //KAB_EMBEDDED | 348 | #else //KAB_EMBEDDED |
320 | aItem = (AddresseeIconViewItem*)(item); | 349 | aItem = (AddresseeIconViewItem*)(item); |
321 | #endif //KAB_EMBEDDED | 350 | #endif //KAB_EMBEDDED |
322 | if (aItem) | 351 | if (aItem) |
323 | uidList << aItem->addressee().uid(); | 352 | uidList << aItem->addressee().uid(); |
324 | } | 353 | } |
325 | } | 354 | } |
326 | 355 | ||
327 | return uidList; | 356 | return uidList; |
328 | } | 357 | } |
329 | 358 | ||
330 | void KAddressBookIconView::refresh(QString uid) | 359 | void KAddressBookIconView::refresh(QString uid) |
331 | { | 360 | { |
332 | QIconViewItem *item; | 361 | QIconViewItem *item; |
333 | AddresseeIconViewItem *aItem; | 362 | AddresseeIconViewItem *aItem; |
334 | 363 | ||
335 | if ( uid.isNull() ) { | 364 | if ( uid.isNull() ) { |
336 | // Rebuild the view | 365 | // Rebuild the view |
337 | mIconView->clear(); | 366 | mIconView->clear(); |
338 | mIconList.clear(); | 367 | mIconList.clear(); |
339 | 368 | ||
340 | KABC::Addressee::List addresseeList = addressees(); | 369 | KABC::Addressee::List addresseeList = addressees(); |
341 | KABC::Addressee::List::Iterator iter; | 370 | KABC::Addressee::List::Iterator iter; |
342 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) { | 371 | for ( iter = addresseeList.begin(); iter != addresseeList.end(); ++iter ) { |
343 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) | 372 | if ( (*iter).uid().left(2) == "la" && (*iter).uid().left(19) == QString("last-syncAddressee-") ) |
344 | continue; | 373 | continue; |
345 | aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView ); | 374 | aItem = new AddresseeIconViewItem( fields(), addressBook(), *iter, mIconView ); |
346 | } | 375 | } |
347 | 376 | ||
348 | mIconView->arrangeItemsInGrid( true ); | 377 | mIconView->arrangeItemsInGrid( true ); |
349 | 378 | ||
350 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) | 379 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) |
351 | { | 380 | { |
352 | #ifndef KAB_EMBEDDED | 381 | #ifndef KAB_EMBEDDED |
353 | AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item ); | 382 | AddresseeIconViewItem* aivi = dynamic_cast<AddresseeIconViewItem*>( item ); |
354 | #else //KAB_EMBEDDED | 383 | #else //KAB_EMBEDDED |
355 | AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item ); | 384 | AddresseeIconViewItem* aivi = (AddresseeIconViewItem*)( item ); |
356 | #endif //KAB_EMBEDDED | 385 | #endif //KAB_EMBEDDED |
357 | mIconList.append( aivi ); | 386 | mIconList.append( aivi ); |
358 | } | 387 | } |
359 | 388 | ||
360 | } else { | 389 | } else { |
361 | // Try to find the one to refresh | 390 | // Try to find the one to refresh |
362 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) { | 391 | for ( item = mIconView->firstItem(); item; item = item->nextItem() ) { |
363 | #ifndef KAB_EMBEDDED | 392 | #ifndef KAB_EMBEDDED |
364 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 393 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
365 | #else //KAB_EMBEDDED | 394 | #else //KAB_EMBEDDED |
366 | aItem = (AddresseeIconViewItem*)(item); | 395 | aItem = (AddresseeIconViewItem*)(item); |
367 | #endif //KAB_EMBEDDED | 396 | #endif //KAB_EMBEDDED |
368 | if ((aItem) && (aItem->addressee().uid() == uid)) { | 397 | if ((aItem) && (aItem->addressee().uid() == uid)) { |
369 | aItem->refresh(); | 398 | aItem->refresh(); |
370 | mIconView->arrangeItemsInGrid( true ); | 399 | mIconView->arrangeItemsInGrid( true ); |
371 | return; | 400 | return; |
372 | } | 401 | } |
373 | } | 402 | } |
374 | refresh( QString::null ); | 403 | refresh( QString::null ); |
375 | } | 404 | } |
376 | } | 405 | } |
377 | 406 | ||
378 | void KAddressBookIconView::setSelected(QString uid, bool selected) | 407 | void KAddressBookIconView::setSelected(QString uid, bool selected) |
379 | { | 408 | { |
380 | QIconViewItem *item; | 409 | QIconViewItem *item; |
381 | AddresseeIconViewItem *aItem; | 410 | AddresseeIconViewItem *aItem; |
382 | 411 | ||
383 | if (uid.isNull()) | 412 | if (uid.isNull()) |
384 | { | 413 | { |
385 | mIconView->selectAll(selected); | 414 | mIconView->selectAll(selected); |
386 | } | 415 | } |
387 | else | 416 | else |
388 | { | 417 | { |
389 | bool found = false; | 418 | bool found = false; |
390 | for (item = mIconView->firstItem(); item && !found; | 419 | for (item = mIconView->firstItem(); item && !found; |
391 | item = item->nextItem()) | 420 | item = item->nextItem()) |
392 | { | 421 | { |
393 | #ifndef KAB_EMBEDDED | 422 | #ifndef KAB_EMBEDDED |
394 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 423 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
395 | #else //KAB_EMBEDDED | 424 | #else //KAB_EMBEDDED |
396 | aItem = (AddresseeIconViewItem*)(item); | 425 | aItem = (AddresseeIconViewItem*)(item); |
397 | #endif //KAB_EMBEDDED | 426 | #endif //KAB_EMBEDDED |
398 | 427 | ||
399 | if ((aItem) && (aItem->addressee().uid() == uid)) | 428 | if ((aItem) && (aItem->addressee().uid() == uid)) |
400 | { | 429 | { |
401 | mIconView->setSelected(aItem, selected); | 430 | mIconView->setSelected(aItem, selected); |
402 | mIconView->ensureItemVisible( aItem ); | 431 | mIconView->ensureItemVisible( aItem ); |
403 | found = true; | 432 | found = true; |
404 | } | 433 | } |
405 | } | 434 | } |
406 | } | 435 | } |
407 | } | 436 | } |
408 | 437 | ||
409 | void KAddressBookIconView::addresseeExecuted(QIconViewItem *item) | 438 | void KAddressBookIconView::addresseeExecuted(QIconViewItem *item) |
410 | { | 439 | { |
411 | #ifndef KAB_EMBEDDED | 440 | #ifndef KAB_EMBEDDED |
412 | AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 441 | AddresseeIconViewItem *aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
413 | #else //KAB_EMBEDDED | 442 | #else //KAB_EMBEDDED |
414 | AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item); | 443 | AddresseeIconViewItem *aItem = (AddresseeIconViewItem*)(item); |
415 | #endif //KAB_EMBEDDED | 444 | #endif //KAB_EMBEDDED |
416 | 445 | ||
417 | if (aItem) { | 446 | if (aItem) { |
418 | emit executed(aItem->addressee().uid()); | 447 | emit executed(aItem->addressee().uid()); |
419 | } | 448 | } |
420 | } | 449 | } |
421 | 450 | ||
422 | void KAddressBookIconView::addresseeSelected() | 451 | void KAddressBookIconView::addresseeSelected() |
423 | { | 452 | { |
424 | QIconViewItem *item; | 453 | QIconViewItem *item; |
425 | AddresseeIconViewItem *aItem; | 454 | AddresseeIconViewItem *aItem; |
426 | 455 | ||
427 | bool found = false; | 456 | bool found = false; |
428 | for (item = mIconView->firstItem(); item && !found; | 457 | for (item = mIconView->firstItem(); item && !found; |
429 | item = item->nextItem()) | 458 | item = item->nextItem()) |
430 | { | 459 | { |
431 | if (item->isSelected()) | 460 | if (item->isSelected()) |
432 | { | 461 | { |
433 | #ifndef KAB_EMBEDDED | 462 | #ifndef KAB_EMBEDDED |
434 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); | 463 | aItem = dynamic_cast<AddresseeIconViewItem*>(item); |
435 | #else //KAB_EMBEDDED | 464 | #else //KAB_EMBEDDED |
436 | aItem = (AddresseeIconViewItem*)(item); | 465 | aItem = (AddresseeIconViewItem*)(item); |
437 | #endif //KAB_EMBEDDED | 466 | #endif //KAB_EMBEDDED |
438 | if (aItem) | 467 | if (aItem) |
439 | { | 468 | { |
440 | emit selected(aItem->addressee().uid()); | 469 | emit selected(aItem->addressee().uid()); |
441 | found = true; | 470 | found = true; |
442 | } | 471 | } |
443 | } | 472 | } |
444 | } | 473 | } |
445 | 474 | ||
446 | if (!found) | 475 | if (!found) |
447 | emit selected(QString::null); | 476 | emit selected(QString::null); |
448 | } | 477 | } |
449 | 478 | ||
450 | #ifndef KAB_EMBEDDED | 479 | #ifndef KAB_EMBEDDED |
451 | #include "kaddressbookiconview.moc" | 480 | #include "kaddressbookiconview.moc" |
452 | #endif //KAB_EMBEDDED | 481 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index 348f491..02fc40a 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp | |||
@@ -1,474 +1,490 @@ | |||
1 | // $Id$ | 1 | // $Id$ |
2 | 2 | ||
3 | #include <qvbox.h> | 3 | #include <qvbox.h> |
4 | #include <qlistbox.h> | 4 | #include <qlistbox.h> |
5 | #include <qwidget.h> | 5 | #include <qwidget.h> |
6 | #include <qfile.h> | 6 | #include <qfile.h> |
7 | #include <qimage.h> | 7 | #include <qimage.h> |
8 | #include <qcombobox.h> | 8 | #include <qcombobox.h> |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qdragobject.h> | 10 | #include <qdragobject.h> |
11 | #include <qevent.h> | 11 | #include <qevent.h> |
12 | #include <qurl.h> | 12 | #include <qurl.h> |
13 | #include <qpixmap.h> | 13 | #include <qpixmap.h> |
14 | 14 | ||
15 | #include <kabc/addressbook.h> | 15 | #include <kabc/addressbook.h> |
16 | #include <kapplication.h> | 16 | #include <kapplication.h> |
17 | #include <kconfig.h> | 17 | #include <kconfig.h> |
18 | #include <kcolorbutton.h> | 18 | #include <kcolorbutton.h> |
19 | #include <kdebug.h> | 19 | #include <kdebug.h> |
20 | #include <kglobal.h> | 20 | #include <kglobal.h> |
21 | #include <kiconloader.h> | 21 | #include <kiconloader.h> |
22 | #include <klineedit.h> | 22 | #include <klineedit.h> |
23 | #include <klocale.h> | 23 | #include <klocale.h> |
24 | #include <kmessagebox.h> | 24 | #include <kmessagebox.h> |
25 | #include <kurl.h> | 25 | #include <kurl.h> |
26 | #include <kurlrequester.h> | 26 | #include <kurlrequester.h> |
27 | 27 | ||
28 | //US#include "configuretableviewdialog.h" | 28 | //US#include "configuretableviewdialog.h" |
29 | #include "contactlistview.h" | 29 | #include "contactlistview.h" |
30 | #include "kabprefs.h" | 30 | #include "kabprefs.h" |
31 | #include "undocmds.h" | 31 | #include "undocmds.h" |
32 | #include "viewmanager.h" | 32 | #include "viewmanager.h" |
33 | 33 | ||
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qheader.h> | 35 | #include <qheader.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | 37 | ||
38 | #include "kaddressbooktableview.h" | 38 | #include "kaddressbooktableview.h" |
39 | 39 | ||
40 | 40 | ||
41 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, | 41 | KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, |
42 | QWidget *parent, const char *name ) | 42 | QWidget *parent, const char *name ) |
43 | : KAddressBookView( ab, parent, name ) | 43 | : KAddressBookView( ab, parent, name ) |
44 | { | 44 | { |
45 | mainLayout = new QVBoxLayout( viewWidget(), 2 ); | 45 | mainLayout = new QVBoxLayout( viewWidget(), 2 ); |
46 | 46 | ||
47 | // The list view will be created when the config is read. | 47 | // The list view will be created when the config is read. |
48 | mListView = 0; | 48 | mListView = 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | KAddressBookTableView::~KAddressBookTableView() | 51 | KAddressBookTableView::~KAddressBookTableView() |
52 | { | 52 | { |
53 | } | 53 | } |
54 | void KAddressBookTableView::setFocusAV() | 54 | void KAddressBookTableView::setFocusAV() |
55 | { | 55 | { |
56 | if ( mListView ) | 56 | if ( mListView ) |
57 | mListView->setFocus(); | 57 | mListView->setFocus(); |
58 | 58 | ||
59 | } | 59 | } |
60 | void KAddressBookTableView::scrollUP() | 60 | void KAddressBookTableView::scrollUP() |
61 | { | 61 | { |
62 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | 62 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); |
63 | QApplication::postEvent( mListView, ev ); | 63 | QApplication::postEvent( mListView, ev ); |
64 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 ); | 64 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 ); |
65 | QApplication::postEvent( mListView, ev ); | 65 | QApplication::postEvent( mListView, ev ); |
66 | } | 66 | } |
67 | void KAddressBookTableView::scrollDOWN() | 67 | void KAddressBookTableView::scrollDOWN() |
68 | { | 68 | { |
69 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | 69 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); |
70 | QApplication::postEvent( mListView, ev ); | 70 | QApplication::postEvent( mListView, ev ); |
71 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 ); | 71 | ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 ); |
72 | QApplication::postEvent( mListView, ev ); | 72 | QApplication::postEvent( mListView, ev ); |
73 | } | 73 | } |
74 | void KAddressBookTableView::reconstructListView() | 74 | void KAddressBookTableView::reconstructListView() |
75 | { | 75 | { |
76 | if (mListView) | 76 | if (mListView) |
77 | { | 77 | { |
78 | disconnect(mListView, SIGNAL(selectionChanged()), | 78 | disconnect(mListView, SIGNAL(selectionChanged()), |
79 | this, SLOT(addresseeSelected())); | 79 | this, SLOT(addresseeSelected())); |
80 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), | 80 | disconnect(mListView, SIGNAL(executed(QListViewItem*)), |
81 | this, SLOT(addresseeExecuted(QListViewItem*))); | 81 | this, SLOT(addresseeExecuted(QListViewItem*))); |
82 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 82 | disconnect(mListView, SIGNAL(doubleClicked(QListViewItem*)), |
83 | this, SLOT(addresseeExecuted(QListViewItem*))); | 83 | this, SLOT(addresseeExecuted(QListViewItem*))); |
84 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, | 84 | disconnect(mListView, SIGNAL(startAddresseeDrag()), this, |
85 | SIGNAL(startDrag())); | 85 | SIGNAL(startDrag())); |
86 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 86 | disconnect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
87 | this, SLOT(addresseeExecuted(QListViewItem*))); | 87 | this, SLOT(addresseeExecuted(QListViewItem*))); |
88 | 88 | ||
89 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 89 | disconnect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
90 | SIGNAL(dropped(QDropEvent*))); | 90 | SIGNAL(dropped(QDropEvent*))); |
91 | delete mListView; | 91 | delete mListView; |
92 | } | 92 | } |
93 | 93 | ||
94 | mListView = new ContactListView( this, addressBook(), viewWidget() ); | 94 | mListView = new ContactListView( this, addressBook(), viewWidget() ); |
95 | 95 | ||
96 | connect(this, SIGNAL(printView()), | 96 | connect(this, SIGNAL(printView()), |
97 | mListView , SLOT(printMe())); | 97 | mListView , SLOT(printMe())); |
98 | //US set singleClick manually, because it is no global configparameter in embedded space | 98 | //US set singleClick manually, because it is no global configparameter in embedded space |
99 | mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); | 99 | mListView->setSingleClick(KABPrefs::instance()->mHonorSingleClick); |
100 | 100 | ||
101 | // Add the columns | 101 | // Add the columns |
102 | KABC::Field::List fieldList = fields(); | 102 | KABC::Field::List fieldList = fields(); |
103 | KABC::Field::List::ConstIterator it; | 103 | KABC::Field::List::ConstIterator it; |
104 | 104 | ||
105 | int c = 0; | 105 | int c = 0; |
106 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { | 106 | for( it = fieldList.begin(); it != fieldList.end(); ++it ) { |
107 | mListView->addColumn( (*it)->label() ); | 107 | mListView->addColumn( (*it)->label() ); |
108 | mListView->setColumnWidthMode(c++, QListView::Manual); | 108 | mListView->setColumnWidthMode(c++, QListView::Manual); |
109 | //US | 109 | //US |
110 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); | 110 | // qDebug("KAddressBookTableView::reconstructListView: field %s", (*it)->label().latin1()); |
111 | } | 111 | } |
112 | 112 | ||
113 | connect(mListView, SIGNAL(selectionChanged()), | 113 | connect(mListView, SIGNAL(selectionChanged()), |
114 | this, SLOT(addresseeSelected())); | 114 | this, SLOT(addresseeSelected())); |
115 | connect(mListView, SIGNAL(startAddresseeDrag()), this, | 115 | connect(mListView, SIGNAL(startAddresseeDrag()), this, |
116 | SIGNAL(startDrag())); | 116 | SIGNAL(startDrag())); |
117 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, | 117 | connect(mListView, SIGNAL(addresseeDropped(QDropEvent*)), this, |
118 | SIGNAL(dropped(QDropEvent*))); | 118 | SIGNAL(dropped(QDropEvent*))); |
119 | 119 | ||
120 | if (KABPrefs::instance()->mHonorSingleClick) { | 120 | if (KABPrefs::instance()->mHonorSingleClick) { |
121 | // qDebug("KAddressBookTableView::reconstructListView single"); | 121 | // qDebug("KAddressBookTableView::reconstructListView single"); |
122 | connect(mListView, SIGNAL(executed(QListViewItem*)), | 122 | connect(mListView, SIGNAL(executed(QListViewItem*)), |
123 | this, SLOT(addresseeExecuted(QListViewItem*))); | 123 | this, SLOT(addresseeExecuted(QListViewItem*))); |
124 | } else { | 124 | } else { |
125 | // qDebug("KAddressBookTableView::reconstructListView double"); | 125 | // qDebug("KAddressBookTableView::reconstructListView double"); |
126 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), | 126 | connect(mListView, SIGNAL(doubleClicked(QListViewItem*)), |
127 | this, SLOT(addresseeExecuted(QListViewItem*))); | 127 | this, SLOT(addresseeExecuted(QListViewItem*))); |
128 | } | 128 | } |
129 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), | 129 | connect(mListView, SIGNAL(returnPressed(QListViewItem*)), |
130 | this, SLOT(addresseeExecuted(QListViewItem*))); | 130 | this, SLOT(addresseeExecuted(QListViewItem*))); |
131 | connect(mListView, SIGNAL(signalDelete()), | 131 | connect(mListView, SIGNAL(signalDelete()), |
132 | this, SLOT(addresseeDeleted())); | 132 | this, SLOT(addresseeDeleted())); |
133 | 133 | ||
134 | //US performceimprovement. Refresh is done from the outside | 134 | //US performceimprovement. Refresh is done from the outside |
135 | //US refresh(); | 135 | //US refresh(); |
136 | 136 | ||
137 | mListView->setSorting( 0, true ); | 137 | mListView->setSorting( 0, true ); |
138 | mainLayout->addWidget( mListView ); | 138 | mainLayout->addWidget( mListView ); |
139 | mainLayout->activate(); | 139 | mainLayout->activate(); |
140 | mListView->show(); | 140 | mListView->show(); |
141 | } | 141 | } |
142 | 142 | ||
143 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | 143 | void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) |
144 | { | 144 | { |
145 | mListView->clear(); | 145 | mListView->clear(); |
146 | if ( s.isEmpty() || s == "*" ) { | 146 | if ( s.isEmpty() || s == "*" ) { |
147 | refresh(); | 147 | refresh(); |
148 | return; | 148 | return; |
149 | } | 149 | } |
150 | QRegExp re = getRegExp( s ); | 150 | QRegExp re = getRegExp( s ); |
151 | if (!re.isValid()) | 151 | if (!re.isValid()) |
152 | return; | 152 | return; |
153 | KABC::Addressee::List addresseeList = addressees(); | 153 | KABC::Addressee::List addresseeList = addressees(); |
154 | KABC::Addressee::List::Iterator it; | 154 | KABC::Addressee::List::Iterator it; |
155 | if ( field ) { | 155 | if ( field ) { |
156 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 156 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
157 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 157 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
158 | continue; | 158 | continue; |
159 | #if QT_VERSION >= 0x030000 | 159 | #if QT_VERSION >= 0x030000 |
160 | if (re.search(field->value( *it ).lower()) == 0) | 160 | if (re.search(field->value( *it ).lower()) == 0) |
161 | #else | 161 | #else |
162 | if (re.match(field->value( *it ).lower()) == 0) | 162 | if (re.match(field->value( *it ).lower()) == 0) |
163 | #endif | 163 | #endif |
164 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 164 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
165 | 165 | ||
166 | } | 166 | } |
167 | } else { | 167 | } else { |
168 | KABC::Field::List fieldList = allFields(); | 168 | KABC::Field::List fieldList = allFields(); |
169 | KABC::Field::List::ConstIterator fieldIt; | 169 | KABC::Field::List::ConstIterator fieldIt; |
170 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 170 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
171 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 171 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
172 | continue; | 172 | continue; |
173 | bool match = false; | ||
173 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { | 174 | for ( fieldIt = fieldList.begin(); fieldIt != fieldList.end(); ++fieldIt ) { |
174 | #if QT_VERSION >= 0x030000 | 175 | #if QT_VERSION >= 0x030000 |
175 | if (re.search((*fieldIt)->value( *it ).lower()) == 0) | 176 | if (re.search((*fieldIt)->value( *it ).lower()) == 0) |
176 | #else | 177 | #else |
177 | if (re.match((*fieldIt)->value( *it ).lower()) == 0) | 178 | if (re.match((*fieldIt)->value( *it ).lower()) == 0) |
178 | #endif | 179 | #endif |
179 | { | 180 | { |
180 | //qDebug("match %s %s %s", pattern.latin1(), (*fieldIt)->value( *it ).latin1(), (*fieldIt)->label().latin1() ); | 181 | //qDebug("match %s %s %s", pattern.latin1(), (*fieldIt)->value( *it ).latin1(), (*fieldIt)->label().latin1() ); |
181 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 182 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
183 | match = true; | ||
182 | break; | 184 | break; |
183 | } | 185 | } |
184 | } | 186 | } |
187 | if ( ! match ) { | ||
188 | if ( (*it).matchPhoneNumber( &re ) ) { | ||
189 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | ||
190 | match = true; | ||
191 | break; | ||
192 | } | ||
193 | } | ||
194 | if ( ! match ) { | ||
195 | if ( (*it).matchAddress( &re ) ) { | ||
196 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | ||
197 | match = true; | ||
198 | break; | ||
199 | } | ||
200 | } | ||
185 | } | 201 | } |
186 | } | 202 | } |
187 | // Sometimes the background pixmap gets messed up when we add lots | 203 | // Sometimes the background pixmap gets messed up when we add lots |
188 | // of items. | 204 | // of items. |
189 | //mListView->repaint(); | 205 | //mListView->repaint(); |
190 | if ( mListView->firstChild() ) { | 206 | if ( mListView->firstChild() ) { |
191 | mListView->setCurrentItem ( mListView->firstChild() ); | 207 | mListView->setCurrentItem ( mListView->firstChild() ); |
192 | mListView->setSelected ( mListView->firstChild(), true ); | 208 | mListView->setSelected ( mListView->firstChild(), true ); |
193 | } | 209 | } |
194 | else | 210 | else |
195 | emit selected(QString::null); | 211 | emit selected(QString::null); |
196 | 212 | ||
197 | } | 213 | } |
198 | void KAddressBookTableView::writeConfig(KConfig *config) | 214 | void KAddressBookTableView::writeConfig(KConfig *config) |
199 | { | 215 | { |
200 | KAddressBookView::writeConfig(config); | 216 | KAddressBookView::writeConfig(config); |
201 | 217 | ||
202 | mListView->saveLayout(config, config->group()); | 218 | mListView->saveLayout(config, config->group()); |
203 | } | 219 | } |
204 | 220 | ||
205 | void KAddressBookTableView::readConfig(KConfig *config) | 221 | void KAddressBookTableView::readConfig(KConfig *config) |
206 | { | 222 | { |
207 | KAddressBookView::readConfig( config ); | 223 | KAddressBookView::readConfig( config ); |
208 | // The config could have changed the fields, so we need to reconstruct | 224 | // The config could have changed the fields, so we need to reconstruct |
209 | // the listview. | 225 | // the listview. |
210 | reconstructListView(); | 226 | reconstructListView(); |
211 | 227 | ||
212 | // costum colors? | 228 | // costum colors? |
213 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) | 229 | if ( config->readBoolEntry( "EnableCustomColors", false ) ) |
214 | { | 230 | { |
215 | QPalette p( mListView->palette() ); | 231 | QPalette p( mListView->palette() ); |
216 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); | 232 | QColor c = p.color(QPalette::Normal, QColorGroup::Base ); |
217 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); | 233 | p.setColor( QPalette::Normal, QColorGroup::Base, config->readColorEntry( "BackgroundColor", &c ) ); |
218 | c = p.color(QPalette::Normal, QColorGroup::Text ); | 234 | c = p.color(QPalette::Normal, QColorGroup::Text ); |
219 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); | 235 | p.setColor( QPalette::Normal, QColorGroup::Text, config->readColorEntry( "TextColor", &c ) ); |
220 | c = p.color(QPalette::Normal, QColorGroup::Button ); | 236 | c = p.color(QPalette::Normal, QColorGroup::Button ); |
221 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); | 237 | p.setColor( QPalette::Normal, QColorGroup::Button, config->readColorEntry( "HeaderColor", &c ) ); |
222 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); | 238 | c = p.color(QPalette::Normal, QColorGroup::ButtonText ); |
223 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); | 239 | p.setColor( QPalette::Normal, QColorGroup::ButtonText, config->readColorEntry( "HeaderTextColor", &c ) ); |
224 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); | 240 | c = p.color(QPalette::Normal, QColorGroup::Highlight ); |
225 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); | 241 | p.setColor( QPalette::Normal, QColorGroup::Highlight, config->readColorEntry( "HighlightColor", &c ) ); |
226 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); | 242 | c = p.color(QPalette::Normal, QColorGroup::HighlightedText ); |
227 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); | 243 | p.setColor( QPalette::Normal, QColorGroup::HighlightedText, config->readColorEntry( "HighlightedTextColor", &c ) ); |
228 | #ifndef KAB_EMBEDDED | 244 | #ifndef KAB_EMBEDDED |
229 | c = KGlobalSettings::alternateBackgroundColor(); | 245 | c = KGlobalSettings::alternateBackgroundColor(); |
230 | #else //KAB_EMBEDDED | 246 | #else //KAB_EMBEDDED |
231 | c = QColor(240, 240, 240); | 247 | c = QColor(240, 240, 240); |
232 | #endif //KAB_EMBEDDED | 248 | #endif //KAB_EMBEDDED |
233 | c = config->readColorEntry ("AlternatingBackgroundColor", &c); | 249 | c = config->readColorEntry ("AlternatingBackgroundColor", &c); |
234 | mListView->setAlternateColor(c); | 250 | mListView->setAlternateColor(c); |
235 | 251 | ||
236 | 252 | ||
237 | //US mListView->viewport()->setPalette( p ); | 253 | //US mListView->viewport()->setPalette( p ); |
238 | mListView->setPalette( p ); | 254 | mListView->setPalette( p ); |
239 | } | 255 | } |
240 | else | 256 | else |
241 | { | 257 | { |
242 | // needed if turned off during a session. | 258 | // needed if turned off during a session. |
243 | //US mListView->viewport()->setPalette( mListView->palette() ); | 259 | //US mListView->viewport()->setPalette( mListView->palette() ); |
244 | mListView->setPalette( mListView->palette() ); | 260 | mListView->setPalette( mListView->palette() ); |
245 | } | 261 | } |
246 | 262 | ||
247 | //custom fonts? | 263 | //custom fonts? |
248 | QFont f( font() ); | 264 | QFont f( font() ); |
249 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) | 265 | if ( config->readBoolEntry( "EnableCustomFonts", false ) ) |
250 | { | 266 | { |
251 | mListView->setFont( config->readFontEntry( "TextFont", &f) ); | 267 | mListView->setFont( config->readFontEntry( "TextFont", &f) ); |
252 | f.setBold( true ); | 268 | f.setBold( true ); |
253 | //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); | 269 | //US mListView->setHeaderFont( config->readFontEntry( "HeaderFont", &f ) ); |
254 | mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); | 270 | mListView->header()->setFont( config->readFontEntry( "HeaderFont", &f ) ); |
255 | } | 271 | } |
256 | else | 272 | else |
257 | { | 273 | { |
258 | mListView->setFont( f ); | 274 | mListView->setFont( f ); |
259 | f.setBold( true ); | 275 | f.setBold( true ); |
260 | //US mListView->setHeaderFont( f ); | 276 | //US mListView->setHeaderFont( f ); |
261 | mListView->header()->setFont( f ); | 277 | mListView->header()->setFont( f ); |
262 | } | 278 | } |
263 | 279 | ||
264 | // Set the list view options | 280 | // Set the list view options |
265 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", | 281 | mListView->setAlternateBackgroundEnabled(config->readBoolEntry("ABackground", |
266 | true)); | 282 | true)); |
267 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); | 283 | mListView->setSingleLineEnabled(config->readBoolEntry("SingleLine", false)); |
268 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); | 284 | mListView->setToolTipsEnabled(config->readBoolEntry("ToolTips", true)); |
269 | 285 | ||
270 | if (config->readBoolEntry("Background", false)) | 286 | if (config->readBoolEntry("Background", false)) |
271 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); | 287 | mListView->setBackgroundPixmap(config->readEntry("BackgroundName")); |
272 | 288 | ||
273 | // Restore the layout of the listview | 289 | // Restore the layout of the listview |
274 | mListView->restoreLayout(config, config->group()); | 290 | mListView->restoreLayout(config, config->group()); |
275 | } | 291 | } |
276 | 292 | ||
277 | void KAddressBookTableView::refresh(QString uid) | 293 | void KAddressBookTableView::refresh(QString uid) |
278 | { | 294 | { |
279 | // For now just repopulate. In reality this method should | 295 | // For now just repopulate. In reality this method should |
280 | // check the value of uid, and if valid iterate through | 296 | // check the value of uid, and if valid iterate through |
281 | // the listview to find the entry, then tell it to refresh. | 297 | // the listview to find the entry, then tell it to refresh. |
282 | 298 | ||
283 | if (uid.isNull()) { | 299 | if (uid.isNull()) { |
284 | // Clear the list view | 300 | // Clear the list view |
285 | QString currentUID, nextUID; | 301 | QString currentUID, nextUID; |
286 | #ifndef KAB_EMBEDDED | 302 | #ifndef KAB_EMBEDDED |
287 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); | 303 | ContactListViewItem *currentItem = dynamic_cast<ContactListViewItem*>( mListView->currentItem() ); |
288 | #else //KAB_EMBEDDED | 304 | #else //KAB_EMBEDDED |
289 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); | 305 | ContactListViewItem *currentItem = (ContactListViewItem*)( mListView->currentItem() ); |
290 | #endif //KAB_EMBEDDED | 306 | #endif //KAB_EMBEDDED |
291 | 307 | ||
292 | if ( currentItem ) { | 308 | if ( currentItem ) { |
293 | #ifndef KAB_EMBEDDED | 309 | #ifndef KAB_EMBEDDED |
294 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); | 310 | ContactListViewItem *nextItem = dynamic_cast<ContactListViewItem*>( currentItem->itemBelow() ); |
295 | #else //KAB_EMBEDDED | 311 | #else //KAB_EMBEDDED |
296 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); | 312 | ContactListViewItem *nextItem = (ContactListViewItem*)( currentItem->itemBelow() ); |
297 | #endif //KAB_EMBEDDED | 313 | #endif //KAB_EMBEDDED |
298 | if ( nextItem ) | 314 | if ( nextItem ) |
299 | nextUID = nextItem->addressee().uid(); | 315 | nextUID = nextItem->addressee().uid(); |
300 | currentUID = currentItem->addressee().uid(); | 316 | currentUID = currentItem->addressee().uid(); |
301 | } | 317 | } |
302 | 318 | ||
303 | mListView->clear(); | 319 | mListView->clear(); |
304 | 320 | ||
305 | currentItem = 0; | 321 | currentItem = 0; |
306 | KABC::Addressee::List addresseeList = addressees(); | 322 | KABC::Addressee::List addresseeList = addressees(); |
307 | KABC::Addressee::List::Iterator it; | 323 | KABC::Addressee::List::Iterator it; |
308 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { | 324 | for (it = addresseeList.begin(); it != addresseeList.end(); ++it ) { |
309 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 325 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
310 | continue; | 326 | continue; |
311 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); | 327 | ContactListViewItem *item = new ContactListViewItem(*it, mListView, addressBook(), fields()); |
312 | if ( (*it).uid() == currentUID ) | 328 | if ( (*it).uid() == currentUID ) |
313 | currentItem = item; | 329 | currentItem = item; |
314 | else if ( (*it).uid() == nextUID && !currentItem ) | 330 | else if ( (*it).uid() == nextUID && !currentItem ) |
315 | currentItem = item; | 331 | currentItem = item; |
316 | } | 332 | } |
317 | 333 | ||
318 | // Sometimes the background pixmap gets messed up when we add lots | 334 | // Sometimes the background pixmap gets messed up when we add lots |
319 | // of items. | 335 | // of items. |
320 | mListView->repaint(); | 336 | mListView->repaint(); |
321 | 337 | ||
322 | if ( currentItem ) { | 338 | if ( currentItem ) { |
323 | mListView->setCurrentItem( currentItem ); | 339 | mListView->setCurrentItem( currentItem ); |
324 | mListView->ensureItemVisible( currentItem ); | 340 | mListView->ensureItemVisible( currentItem ); |
325 | } | 341 | } |
326 | } else { | 342 | } else { |
327 | // Only need to update on entry. Iterate through and try to find it | 343 | // Only need to update on entry. Iterate through and try to find it |
328 | ContactListViewItem *ceItem; | 344 | ContactListViewItem *ceItem; |
329 | QListViewItemIterator it( mListView ); | 345 | QListViewItemIterator it( mListView ); |
330 | while ( it.current() ) { | 346 | while ( it.current() ) { |
331 | #ifndef KAB_EMBEDDED | 347 | #ifndef KAB_EMBEDDED |
332 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); | 348 | ceItem = dynamic_cast<ContactListViewItem*>( it.current() ); |
333 | #else //KAB_EMBEDDED | 349 | #else //KAB_EMBEDDED |
334 | ceItem = (ContactListViewItem*)( it.current() ); | 350 | ceItem = (ContactListViewItem*)( it.current() ); |
335 | #endif //KAB_EMBEDDED | 351 | #endif //KAB_EMBEDDED |
336 | 352 | ||
337 | if ( ceItem && ceItem->addressee().uid() == uid ) { | 353 | if ( ceItem && ceItem->addressee().uid() == uid ) { |
338 | ceItem->refresh(); | 354 | ceItem->refresh(); |
339 | return; | 355 | return; |
340 | } | 356 | } |
341 | ++it; | 357 | ++it; |
342 | } | 358 | } |
343 | 359 | ||
344 | refresh( QString::null ); | 360 | refresh( QString::null ); |
345 | } | 361 | } |
346 | } | 362 | } |
347 | 363 | ||
348 | QStringList KAddressBookTableView::selectedUids() | 364 | QStringList KAddressBookTableView::selectedUids() |
349 | { | 365 | { |
350 | QStringList uidList; | 366 | QStringList uidList; |
351 | QListViewItem *item; | 367 | QListViewItem *item; |
352 | ContactListViewItem *ceItem; | 368 | ContactListViewItem *ceItem; |
353 | 369 | ||
354 | for(item = mListView->firstChild(); item; item = item->itemBelow()) | 370 | for(item = mListView->firstChild(); item; item = item->itemBelow()) |
355 | { | 371 | { |
356 | if (mListView->isSelected( item )) | 372 | if (mListView->isSelected( item )) |
357 | { | 373 | { |
358 | #ifndef KAB_EMBEDDED | 374 | #ifndef KAB_EMBEDDED |
359 | ceItem = dynamic_cast<ContactListViewItem*>(item); | 375 | ceItem = dynamic_cast<ContactListViewItem*>(item); |
360 | #else //KAB_EMBEDDED | 376 | #else //KAB_EMBEDDED |
361 | ceItem = (ContactListViewItem*)(item); | 377 | ceItem = (ContactListViewItem*)(item); |
362 | #endif //KAB_EMBEDDED | 378 | #endif //KAB_EMBEDDED |
363 | 379 | ||
364 | if (ceItem != 0L) | 380 | if (ceItem != 0L) |
365 | uidList << ceItem->addressee().uid(); | 381 | uidList << ceItem->addressee().uid(); |
366 | } | 382 | } |
367 | } | 383 | } |
368 | if ( uidList.count() == 0 ) | 384 | if ( uidList.count() == 0 ) |
369 | if ( mListView->currentItem() ) { | 385 | if ( mListView->currentItem() ) { |
370 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; | 386 | ceItem = (ContactListViewItem*)(mListView->currentItem()) ; |
371 | uidList << ceItem->addressee().uid(); | 387 | uidList << ceItem->addressee().uid(); |
372 | } | 388 | } |
373 | 389 | ||
374 | return uidList; | 390 | return uidList; |
375 | } | 391 | } |
376 | 392 | ||
377 | void KAddressBookTableView::setSelected(QString uid, bool selected) | 393 | void KAddressBookTableView::setSelected(QString uid, bool selected) |
378 | { | 394 | { |
379 | QListViewItem *item; | 395 | QListViewItem *item; |
380 | ContactListViewItem *ceItem; | 396 | ContactListViewItem *ceItem; |
381 | 397 | ||
382 | if (uid.isNull()) | 398 | if (uid.isNull()) |
383 | { | 399 | { |
384 | mListView->selectAll(selected); | 400 | mListView->selectAll(selected); |
385 | } | 401 | } |
386 | else | 402 | else |
387 | { | 403 | { |
388 | for(item = mListView->firstChild(); item; item = item->itemBelow()) | 404 | for(item = mListView->firstChild(); item; item = item->itemBelow()) |
389 | { | 405 | { |
390 | #ifndef KAB_EMBEDDED | 406 | #ifndef KAB_EMBEDDED |
391 | ceItem = dynamic_cast<ContactListViewItem*>(item); | 407 | ceItem = dynamic_cast<ContactListViewItem*>(item); |
392 | #else //KAB_EMBEDDED | 408 | #else //KAB_EMBEDDED |
393 | ceItem = (ContactListViewItem*)(item); | 409 | ceItem = (ContactListViewItem*)(item); |
394 | #endif //KAB_EMBEDDED | 410 | #endif //KAB_EMBEDDED |
395 | 411 | ||
396 | 412 | ||
397 | if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) | 413 | if ((ceItem != 0L) && (ceItem->addressee().uid() == uid)) |
398 | { | 414 | { |
399 | mListView->setSelected(item, selected); | 415 | mListView->setSelected(item, selected); |
400 | 416 | ||
401 | if (selected) | 417 | if (selected) |
402 | mListView->ensureItemVisible(item); | 418 | mListView->ensureItemVisible(item); |
403 | } | 419 | } |
404 | } | 420 | } |
405 | } | 421 | } |
406 | } | 422 | } |
407 | 423 | ||
408 | void KAddressBookTableView::addresseeSelected() | 424 | void KAddressBookTableView::addresseeSelected() |
409 | { | 425 | { |
410 | // We need to try to find the first selected item. This might not be the | 426 | // We need to try to find the first selected item. This might not be the |
411 | // last selected item, but when QListView is in multiselection mode, | 427 | // last selected item, but when QListView is in multiselection mode, |
412 | // there is no way to figure out which one was | 428 | // there is no way to figure out which one was |
413 | // selected last. | 429 | // selected last. |
414 | QListViewItem *item; | 430 | QListViewItem *item; |
415 | bool found =false; | 431 | bool found =false; |
416 | for (item = mListView->firstChild(); item && !found; | 432 | for (item = mListView->firstChild(); item && !found; |
417 | item = item->nextSibling()) | 433 | item = item->nextSibling()) |
418 | { | 434 | { |
419 | if (item->isSelected()) | 435 | if (item->isSelected()) |
420 | { | 436 | { |
421 | found = true; | 437 | found = true; |
422 | #ifndef KAB_EMBEDDED | 438 | #ifndef KAB_EMBEDDED |
423 | ContactListViewItem *ceItem | 439 | ContactListViewItem *ceItem |
424 | = dynamic_cast<ContactListViewItem*>(item); | 440 | = dynamic_cast<ContactListViewItem*>(item); |
425 | #else //KAB_EMBEDDED | 441 | #else //KAB_EMBEDDED |
426 | ContactListViewItem *ceItem | 442 | ContactListViewItem *ceItem |
427 | = (ContactListViewItem*)(item); | 443 | = (ContactListViewItem*)(item); |
428 | #endif //KAB_EMBEDDED | 444 | #endif //KAB_EMBEDDED |
429 | 445 | ||
430 | if ( ceItem ) emit selected(ceItem->addressee().uid()); | 446 | if ( ceItem ) emit selected(ceItem->addressee().uid()); |
431 | } | 447 | } |
432 | } | 448 | } |
433 | 449 | ||
434 | if (!found) | 450 | if (!found) |
435 | emit selected(QString::null); | 451 | emit selected(QString::null); |
436 | } | 452 | } |
437 | 453 | ||
438 | void KAddressBookTableView::addresseeExecuted(QListViewItem *item) | 454 | void KAddressBookTableView::addresseeExecuted(QListViewItem *item) |
439 | { | 455 | { |
440 | if (item) | 456 | if (item) |
441 | { | 457 | { |
442 | #ifndef KAB_EMBEDDED | 458 | #ifndef KAB_EMBEDDED |
443 | ContactListViewItem *ceItem | 459 | ContactListViewItem *ceItem |
444 | = dynamic_cast<ContactListViewItem*>(item); | 460 | = dynamic_cast<ContactListViewItem*>(item); |
445 | #else //KAB_EMBEDDED | 461 | #else //KAB_EMBEDDED |
446 | ContactListViewItem *ceItem | 462 | ContactListViewItem *ceItem |
447 | = (ContactListViewItem*)(item); | 463 | = (ContactListViewItem*)(item); |
448 | #endif //KAB_EMBEDDED | 464 | #endif //KAB_EMBEDDED |
449 | 465 | ||
450 | if (ceItem) | 466 | if (ceItem) |
451 | { | 467 | { |
452 | emit executed(ceItem->addressee().uid()); | 468 | emit executed(ceItem->addressee().uid()); |
453 | } | 469 | } |
454 | } | 470 | } |
455 | else | 471 | else |
456 | { | 472 | { |
457 | emit executed(QString::null); | 473 | emit executed(QString::null); |
458 | } | 474 | } |
459 | } | 475 | } |
460 | 476 | ||
461 | void KAddressBookTableView::addresseeDeleted() | 477 | void KAddressBookTableView::addresseeDeleted() |
462 | { | 478 | { |
463 | 479 | ||
464 | emit deleteRequest(); | 480 | emit deleteRequest(); |
465 | 481 | ||
466 | } | 482 | } |
467 | 483 | ||
468 | 484 | ||
469 | 485 | ||
470 | 486 | ||
471 | 487 | ||
472 | #ifndef KAB_EMBEDDED | 488 | #ifndef KAB_EMBEDDED |
473 | #include "kaddressbooktableview.moc" | 489 | #include "kaddressbooktableview.moc" |
474 | #endif //KAB_EMBEDDED | 490 | #endif //KAB_EMBEDDED |