Diffstat (limited to 'kaddressbook/kaddressbookview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/kaddressbookview.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp index 86898e2..4823b37 100644 --- a/kaddressbook/kaddressbookview.cpp +++ b/kaddressbook/kaddressbookview.cpp | |||
@@ -3,64 +3,66 @@ | |||
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 <qapplication.h> | 25 | #include <qapplication.h> |
26 | 26 | ||
27 | #include <kabc/distributionlistdialog.h> | 27 | #include <kabc/distributionlistdialog.h> |
28 | #include <kconfig.h> | 28 | #include <kconfig.h> |
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | 30 | ||
31 | #include "viewmanager.h" | 31 | #include "viewmanager.h" |
32 | 32 | ||
33 | #endif //KAB_EMBEDDED | 33 | #endif //KAB_EMBEDDED |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3VBoxLayout> | ||
35 | 37 | ||
36 | #include <kabc/distributionlistdialog.h> | 38 | #include <kabc/distributionlistdialog.h> |
37 | #include <kabc/addressbook.h> | 39 | #include <kabc/addressbook.h> |
38 | #include <kdebug.h> | 40 | #include <kdebug.h> |
39 | 41 | ||
40 | #include "kaddressbookview.h" | 42 | #include "kaddressbookview.h" |
41 | 43 | ||
42 | KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, | 44 | KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, |
43 | const char *name ) | 45 | const char *name ) |
44 | : QWidget( parent, name ), mAddressBook( ab ), mFieldList() | 46 | : QWidget( parent, name ), mAddressBook( ab ), mFieldList() |
45 | { | 47 | { |
46 | 48 | ||
47 | initGUI(); | 49 | initGUI(); |
48 | } | 50 | } |
49 | 51 | ||
50 | KAddressBookView::~KAddressBookView() | 52 | KAddressBookView::~KAddressBookView() |
51 | { | 53 | { |
52 | 54 | ||
53 | } | 55 | } |
54 | 56 | ||
55 | QRegExp KAddressBookView::getRegExp( const QString s ) | 57 | QRegExp KAddressBookView::getRegExp( const QString s ) |
56 | { | 58 | { |
57 | QRegExp re; | 59 | QRegExp re; |
58 | 60 | ||
59 | if ( s.length() == 3 && s.mid(1,1) == "-" ) { | 61 | if ( s.length() == 3 && s.mid(1,1) == "-" ) { |
60 | QString pattern = "^[" + s.lower() +"]"; | 62 | QString pattern = "^[" + s.lower() +"]"; |
61 | re.setCaseSensitive(false); | 63 | re.setCaseSensitive(false); |
62 | re.setPattern( pattern ); | 64 | re.setPattern( pattern ); |
63 | } else { | 65 | } else { |
64 | QString pattern = s.lower()+"*"; | 66 | QString pattern = s.lower()+"*"; |
65 | re.setWildcard(true); // most people understand these better. | 67 | re.setWildcard(true); // most people understand these better. |
66 | re.setCaseSensitive(false); | 68 | re.setCaseSensitive(false); |
@@ -104,85 +106,85 @@ QString KAddressBookView::selectedEmails() | |||
104 | m = KABC::EmailSelector::getEmail( addr.emails(), addr.preferredEmail(), this ); | 106 | m = KABC::EmailSelector::getEmail( addr.emails(), addr.preferredEmail(), this ); |
105 | 107 | ||
106 | email = addr.fullEmail( m ); | 108 | email = addr.fullEmail( m ); |
107 | 109 | ||
108 | if ( !first ) | 110 | if ( !first ) |
109 | emailAddrs += ", "; | 111 | emailAddrs += ", "; |
110 | else | 112 | else |
111 | first = false; | 113 | first = false; |
112 | 114 | ||
113 | emailAddrs += email; | 115 | emailAddrs += email; |
114 | } | 116 | } |
115 | } | 117 | } |
116 | 118 | ||
117 | return emailAddrs; | 119 | return emailAddrs; |
118 | } | 120 | } |
119 | 121 | ||
120 | KABC::Addressee::List KAddressBookView::addressees() | 122 | KABC::Addressee::List KAddressBookView::addressees() |
121 | { | 123 | { |
122 | KABC::Addressee::List addresseeList; | 124 | KABC::Addressee::List addresseeList; |
123 | 125 | ||
124 | KABC::AddressBook::Iterator it; | 126 | KABC::AddressBook::Iterator it; |
125 | for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 127 | for (it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
126 | if ( mFilter.filterAddressee( *it ) ) | 128 | if ( mFilter.filterAddressee( *it ) ) |
127 | addresseeList.append( *it ); | 129 | addresseeList.append( *it ); |
128 | } | 130 | } |
129 | 131 | ||
130 | return addresseeList; | 132 | return addresseeList; |
131 | } | 133 | } |
132 | 134 | ||
133 | void KAddressBookView::initGUI() | 135 | void KAddressBookView::initGUI() |
134 | { | 136 | { |
135 | // Create the layout | 137 | // Create the layout |
136 | QVBoxLayout *layout = new QVBoxLayout( this ); | 138 | Q3VBoxLayout *layout = new Q3VBoxLayout( this ); |
137 | 139 | ||
138 | // Add the view widget | 140 | // Add the view widget |
139 | mViewWidget = new QWidget( this ); | 141 | mViewWidget = new QWidget( this ); |
140 | layout->addWidget( mViewWidget ); | 142 | layout->addWidget( mViewWidget ); |
141 | } | 143 | } |
142 | 144 | ||
143 | KABC::Field::List KAddressBookView::fields() const | 145 | KABC::Field::List KAddressBookView::fields() const |
144 | { | 146 | { |
145 | return mFieldList; | 147 | return mFieldList; |
146 | } | 148 | } |
147 | KABC::Field::List KAddressBookView::allFields() const | 149 | KABC::Field::List KAddressBookView::allFields() const |
148 | { | 150 | { |
149 | return KABC::Field::allFields(); | 151 | return KABC::Field::allFields(); |
150 | } | 152 | } |
151 | 153 | ||
152 | void KAddressBookView::setFilter( const Filter &filter ) | 154 | void KAddressBookView::setFilter( const Filter &filter ) |
153 | { | 155 | { |
154 | mFilter = filter; | 156 | mFilter = filter; |
155 | } | 157 | } |
156 | 158 | ||
157 | KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const | 159 | KAddressBookView::DefaultFilterType KAddressBookView::defaultFilterType() const |
158 | { | 160 | { |
159 | return mDefaultFilterType; | 161 | return mDefaultFilterType; |
160 | } | 162 | } |
161 | 163 | ||
162 | const QString &KAddressBookView::defaultFilterName() const | 164 | const QString &KAddressBookView::defaultFilterName() const |
163 | { | 165 | { |
164 | return mDefaultFilterName; | 166 | return mDefaultFilterName; |
165 | } | 167 | } |
166 | 168 | ||
167 | KABC::AddressBook *KAddressBookView::addressBook() const | 169 | KABC::AddressBook *KAddressBookView::addressBook() const |
168 | { | 170 | { |
169 | return mAddressBook; | 171 | return mAddressBook; |
170 | } | 172 | } |
171 | 173 | ||
172 | QWidget *KAddressBookView::viewWidget() | 174 | QWidget *KAddressBookView::viewWidget() |
173 | { | 175 | { |
174 | return mViewWidget; | 176 | return mViewWidget; |
175 | } | 177 | } |
176 | 178 | ||
177 | ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, | 179 | ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab, |
178 | QWidget *parent, | 180 | QWidget *parent, |
179 | const char *name ) | 181 | const char *name ) |
180 | { | 182 | { |
181 | return new ViewConfigureWidget( ab, parent, name ); | 183 | return new ViewConfigureWidget( ab, parent, name ); |
182 | } | 184 | } |
183 | 185 | ||
184 | 186 | ||
185 | 187 | ||
186 | #ifndef KAB_EMBEDDED | 188 | #ifndef KAB_EMBEDDED_ |
187 | #include "kaddressbookview.moc" | 189 | #include "moc_kaddressbookview.cpp" |
188 | #endif //KAB_EMBEDDED | 190 | #endif //KAB_EMBEDDED |