-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 2b40909..cce68b9 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp | |||
@@ -1,126 +1,126 @@ | |||
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.formattedName()), | 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; |