author | zautrix <zautrix> | 2004-12-05 11:14:32 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-12-05 11:14:32 (UTC) |
commit | 196365e533c6fd1a8f47aa9579763ef5afcebcda (patch) (unidiff) | |
tree | 3784f0be50b790d9386db1e4ebd29d44317db026 /kaddressbook | |
parent | e4e75984b6cb581d87d436cb6c5140eb57dbdc51 (diff) | |
download | kdepimpi-196365e533c6fd1a8f47aa9579763ef5afcebcda.zip kdepimpi-196365e533c6fd1a8f47aa9579763ef5afcebcda.tar.gz kdepimpi-196365e533c6fd1a8f47aa9579763ef5afcebcda.tar.bz2 |
layout bugfixes
-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 2 | ||||
-rw-r--r-- | kaddressbook/xxportselectdialog.cpp | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index ad43970..23b091c 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp | |||
@@ -1,373 +1,373 @@ | |||
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 <qheader.h> | 24 | #include <qheader.h> |
25 | #include <qiconset.h> | 25 | #include <qiconset.h> |
26 | #include <qimage.h> | 26 | #include <qimage.h> |
27 | #include <qdragobject.h> | 27 | #include <qdragobject.h> |
28 | #include <qcombobox.h> | 28 | #include <qcombobox.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qbrush.h> | 30 | #include <qbrush.h> |
31 | #include <qevent.h> | 31 | #include <qevent.h> |
32 | 32 | ||
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kglobalsettings.h> | 34 | #include <kglobalsettings.h> |
35 | #include <kiconloader.h> | 35 | #include <kiconloader.h> |
36 | #include <kdebug.h> | 36 | #include <kdebug.h> |
37 | #include <kconfig.h> | 37 | #include <kconfig.h> |
38 | #include <kapplication.h> | 38 | #include <kapplication.h> |
39 | #include <kurl.h> | 39 | #include <kurl.h> |
40 | 40 | ||
41 | #include "kaddressbooktableview.h" | 41 | #include "kaddressbooktableview.h" |
42 | 42 | ||
43 | #include "contactlistview.h" | 43 | #include "contactlistview.h" |
44 | 44 | ||
45 | ///////////////////////////////// | 45 | ///////////////////////////////// |
46 | // DynamicTip Methods | 46 | // DynamicTip Methods |
47 | 47 | ||
48 | DynamicTip::DynamicTip( ContactListView *parent) | 48 | DynamicTip::DynamicTip( ContactListView *parent) |
49 | : QToolTip( parent ) | 49 | : QToolTip( parent ) |
50 | { | 50 | { |
51 | } | 51 | } |
52 | 52 | ||
53 | void DynamicTip::maybeTip( const QPoint &pos ) | 53 | void DynamicTip::maybeTip( const QPoint &pos ) |
54 | { | 54 | { |
55 | static bool ishidden = true; | 55 | static bool ishidden = true; |
56 | if (!parentWidget()->inherits( "ContactListView" )) | 56 | if (!parentWidget()->inherits( "ContactListView" )) |
57 | return; | 57 | return; |
58 | 58 | ||
59 | ContactListView *plv = (ContactListView*)parentWidget(); | 59 | ContactListView *plv = (ContactListView*)parentWidget(); |
60 | if (!plv->tooltips()) | 60 | if (!plv->tooltips()) |
61 | return; | 61 | return; |
62 | 62 | ||
63 | QPoint posVp = plv->viewport()->pos(); | 63 | QPoint posVp = plv->viewport()->pos(); |
64 | 64 | ||
65 | QListViewItem *lvi = plv->itemAt( pos - posVp ); | 65 | QListViewItem *lvi = plv->itemAt( pos - posVp ); |
66 | if (!lvi) | 66 | if (!lvi) |
67 | return; | 67 | return; |
68 | 68 | ||
69 | #ifndef KAB_EMBEDDED | 69 | #ifndef KAB_EMBEDDED |
70 | ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi); | 70 | ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi); |
71 | #else //KAB_EMBEDDED | 71 | #else //KAB_EMBEDDED |
72 | ContactListViewItem *plvi = (ContactListViewItem*)(lvi); | 72 | ContactListViewItem *plvi = (ContactListViewItem*)(lvi); |
73 | #endif //KAB_EMBEDDED | 73 | #endif //KAB_EMBEDDED |
74 | 74 | ||
75 | if (!plvi) | 75 | if (!plvi) |
76 | return; | 76 | return; |
77 | 77 | ||
78 | if (ishidden) { | 78 | if (ishidden) { |
79 | QString s; | 79 | QString s; |
80 | QRect r = plv->itemRect( lvi ); | 80 | QRect r = plv->itemRect( lvi ); |
81 | r.moveBy( posVp.x(), posVp.y() ); | 81 | r.moveBy( posVp.x(), posVp.y() ); |
82 | 82 | ||
83 | //kdDebug() << "Tip rec: " << r.x() << "," << r.y() << "," << r.width() | 83 | //kdDebug() << "Tip rec: " << r.x() << "," << r.y() << "," << r.width() |
84 | // << "," << r.height() << endl; | 84 | // << "," << r.height() << endl; |
85 | 85 | ||
86 | KABC::Addressee a = plvi->addressee(); | 86 | KABC::Addressee a = plvi->addressee(); |
87 | if (a.isEmpty()) | 87 | if (a.isEmpty()) |
88 | return; | 88 | return; |
89 | 89 | ||
90 | s += i18n("label: value", "%1: %2").arg(a.formattedNameLabel()) | 90 | s += i18n("label: value", "%1: %2").arg(a.formattedNameLabel()) |
91 | .arg(a.formattedName()); | 91 | .arg(a.formattedName()); |
92 | 92 | ||
93 | s += '\n'; | 93 | s += '\n'; |
94 | s += i18n("label: value", "%1: %2").arg(a.organizationLabel()) | 94 | s += i18n("label: value", "%1: %2").arg(a.organizationLabel()) |
95 | .arg(a.organization()); | 95 | .arg(a.organization()); |
96 | 96 | ||
97 | QString notes = a.note().stripWhiteSpace(); | 97 | QString notes = a.note().stripWhiteSpace(); |
98 | if ( !notes.isEmpty() ) { | 98 | if ( !notes.isEmpty() ) { |
99 | notes += '\n'; | 99 | notes += '\n'; |
100 | s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel()); | 100 | s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel()); |
101 | QFontMetrics fm( font() ); | 101 | QFontMetrics fm( font() ); |
102 | 102 | ||
103 | // Begin word wrap code based on QMultiLineEdit code | 103 | // Begin word wrap code based on QMultiLineEdit code |
104 | int i = 0; | 104 | int i = 0; |
105 | bool doBreak = false; | 105 | bool doBreak = false; |
106 | int linew = 0; | 106 | int linew = 0; |
107 | int lastSpace = -1; | 107 | int lastSpace = -1; |
108 | int a = 0; | 108 | int a = 0; |
109 | int lastw = 0; | 109 | int lastw = 0; |
110 | 110 | ||
111 | while ( i < int(notes.length()) ) { | 111 | while ( i < int(notes.length()) ) { |
112 | doBreak = FALSE; | 112 | doBreak = FALSE; |
113 | if ( notes[i] != '\n' ) | 113 | if ( notes[i] != '\n' ) |
114 | linew += fm.width( notes[i] ); | 114 | linew += fm.width( notes[i] ); |
115 | 115 | ||
116 | if ( lastSpace >= a && notes[i] != '\n' ) | 116 | if ( lastSpace >= a && notes[i] != '\n' ) |
117 | if (linew >= parentWidget()->width()) { | 117 | if (linew >= parentWidget()->width()) { |
118 | doBreak = TRUE; | 118 | doBreak = TRUE; |
119 | if ( lastSpace > a ) { | 119 | if ( lastSpace > a ) { |
120 | i = lastSpace; | 120 | i = lastSpace; |
121 | linew = lastw; | 121 | linew = lastw; |
122 | } | 122 | } |
123 | else | 123 | else |
124 | i = QMAX( a, i-1 ); | 124 | i = QMAX( a, i-1 ); |
125 | } | 125 | } |
126 | 126 | ||
127 | if ( notes[i] == '\n' || doBreak ) { | 127 | if ( notes[i] == '\n' || doBreak ) { |
128 | s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; | 128 | s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; |
129 | 129 | ||
130 | a = i + 1; | 130 | a = i + 1; |
131 | lastSpace = a; | 131 | lastSpace = a; |
132 | linew = 0; | 132 | linew = 0; |
133 | } | 133 | } |
134 | 134 | ||
135 | if ( notes[i].isSpace() ) { | 135 | if ( notes[i].isSpace() ) { |
136 | lastSpace = i; | 136 | lastSpace = i; |
137 | lastw = linew; | 137 | lastw = linew; |
138 | } | 138 | } |
139 | 139 | ||
140 | if ( lastSpace <= a ) { | 140 | if ( lastSpace <= a ) { |
141 | lastw = linew; | 141 | lastw = linew; |
142 | } | 142 | } |
143 | 143 | ||
144 | ++i; | 144 | ++i; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | tip( r, s ); | 148 | tip( r, s ); |
149 | } | 149 | } |
150 | else | 150 | else |
151 | hide(); | 151 | hide(); |
152 | ishidden = !ishidden; | 152 | ishidden = !ishidden; |
153 | 153 | ||
154 | } | 154 | } |
155 | 155 | ||
156 | /////////////////////////// | 156 | /////////////////////////// |
157 | // ContactListViewItem Methods | 157 | // ContactListViewItem Methods |
158 | 158 | ||
159 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, | 159 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, |
160 | ContactListView *parent, | 160 | ContactListView *parent, |
161 | KABC::AddressBook *doc, | 161 | KABC::AddressBook *doc, |
162 | const KABC::Field::List &fields ) | 162 | const KABC::Field::List &fields ) |
163 | : KListViewItem(parent), mAddressee(a), mFields( fields ), | 163 | : KListViewItem(parent), mAddressee(a), mFields( fields ), |
164 | parentListView( parent ), mDocument(doc) | 164 | parentListView( parent ), mDocument(doc) |
165 | { | 165 | { |
166 | refresh(); | 166 | refresh(); |
167 | } | 167 | } |
168 | 168 | ||
169 | QString ContactListViewItem::key(int column, bool ascending) const | 169 | QString ContactListViewItem::key(int column, bool ascending) const |
170 | { | 170 | { |
171 | #ifndef DESKTOP_VERSION | 171 | #ifndef DESKTOP_VERSION |
172 | int lan = KGlobal::locale()->language(); | 172 | int lan = KGlobal::locale()->language(); |
173 | //qDebug("language %d ", lan); | 173 | //qDebug("language %d ", lan); |
174 | if ( lan == 1 ) { //GERMAN | 174 | if ( lan == 1 ) { //GERMAN |
175 | QString ret = QListViewItem::key(column, ascending).lower().utf8(); | 175 | QString ret = QListViewItem::key(column, ascending).lower().utf8(); |
176 | int start = -1; | 176 | int start = -1; |
177 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { | 177 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { |
178 | ret.at(start-1) = 'a'; | 178 | ret.at(start-1) = 'a'; |
179 | } | 179 | } |
180 | start = -1; | 180 | start = -1; |
181 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { | 181 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { |
182 | ret.at(start-1) = 'o'; | 182 | ret.at(start-1) = 'o'; |
183 | } | 183 | } |
184 | start = -1; | 184 | start = -1; |
185 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { | 185 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { |
186 | ret.at(start-1) = 'o'; | 186 | ret.at(start-1) = 'o'; |
187 | } | 187 | } |
188 | start = -1; | 188 | start = -1; |
189 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { | 189 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { |
190 | ret.at(start-1) = 's'; | 190 | ret.at(start-1) = 's'; |
191 | } | 191 | } |
192 | qDebug("conv string %s ", ret.latin1()); | 192 | //qDebug("conv string %s ", ret.latin1()); |
193 | 193 | ||
194 | return ret; | 194 | return ret; |
195 | 195 | ||
196 | } | 196 | } |
197 | else | 197 | else |
198 | #endif | 198 | #endif |
199 | return QListViewItem::key(column, ascending).lower(); | 199 | return QListViewItem::key(column, ascending).lower(); |
200 | } | 200 | } |
201 | 201 | ||
202 | void ContactListViewItem::paintCell(QPainter * p, | 202 | void ContactListViewItem::paintCell(QPainter * p, |
203 | const QColorGroup & cg, | 203 | const QColorGroup & cg, |
204 | int column, | 204 | int column, |
205 | int width, | 205 | int width, |
206 | int align) | 206 | int align) |
207 | { | 207 | { |
208 | KListViewItem::paintCell(p, cg, column, width, align); | 208 | KListViewItem::paintCell(p, cg, column, width, align); |
209 | 209 | ||
210 | if ( !p ) | 210 | if ( !p ) |
211 | return; | 211 | return; |
212 | 212 | ||
213 | if (parentListView->singleLine()) { | 213 | if (parentListView->singleLine()) { |
214 | p->setPen( parentListView->alternateColor() ); | 214 | p->setPen( parentListView->alternateColor() ); |
215 | p->drawLine( 0, height() - 1, width, height() - 1 ); | 215 | p->drawLine( 0, height() - 1, width, height() - 1 ); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | ContactListView *ContactListViewItem::parent() | 220 | ContactListView *ContactListViewItem::parent() |
221 | { | 221 | { |
222 | return parentListView; | 222 | return parentListView; |
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | void ContactListViewItem::refresh() | 226 | void ContactListViewItem::refresh() |
227 | { | 227 | { |
228 | // Update our addressee, since it may have changed else were | 228 | // Update our addressee, since it may have changed else were |
229 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 229 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
230 | if (mAddressee.isEmpty()) | 230 | if (mAddressee.isEmpty()) |
231 | return; | 231 | return; |
232 | 232 | ||
233 | int i = 0; | 233 | int i = 0; |
234 | KABC::Field::List::ConstIterator it; | 234 | KABC::Field::List::ConstIterator it; |
235 | for( it = mFields.begin(); it != mFields.end(); ++it ) { | 235 | for( it = mFields.begin(); it != mFields.end(); ++it ) { |
236 | setText( i++, (*it)->value( mAddressee ) ); | 236 | setText( i++, (*it)->value( mAddressee ) ); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | /////////////////////////////// | 240 | /////////////////////////////// |
241 | // ContactListView | 241 | // ContactListView |
242 | 242 | ||
243 | ContactListView::ContactListView(KAddressBookTableView *view, | 243 | ContactListView::ContactListView(KAddressBookTableView *view, |
244 | KABC::AddressBook* /* doc */, | 244 | KABC::AddressBook* /* doc */, |
245 | QWidget *parent, | 245 | QWidget *parent, |
246 | const char *name ) | 246 | const char *name ) |
247 | : KListView( parent, name ), | 247 | : KListView( parent, name ), |
248 | pabWidget( view ), | 248 | pabWidget( view ), |
249 | oldColumn( 0 ) | 249 | oldColumn( 0 ) |
250 | { | 250 | { |
251 | mABackground = true; | 251 | mABackground = true; |
252 | mSingleLine = false; | 252 | mSingleLine = false; |
253 | mToolTips = true; | 253 | mToolTips = true; |
254 | #ifndef KAB_EMBEDDED | 254 | #ifndef KAB_EMBEDDED |
255 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); | 255 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); |
256 | #else //KAB_EMBEDDED | 256 | #else //KAB_EMBEDDED |
257 | mAlternateColor = QColor(240, 240, 240); | 257 | mAlternateColor = QColor(240, 240, 240); |
258 | #endif //KAB_EMBEDDED | 258 | #endif //KAB_EMBEDDED |
259 | 259 | ||
260 | setAlternateBackgroundEnabled(mABackground); | 260 | setAlternateBackgroundEnabled(mABackground); |
261 | setAcceptDrops( true ); | 261 | setAcceptDrops( true ); |
262 | viewport()->setAcceptDrops( true ); | 262 | viewport()->setAcceptDrops( true ); |
263 | setAllColumnsShowFocus( true ); | 263 | setAllColumnsShowFocus( true ); |
264 | setShowSortIndicator(true); | 264 | setShowSortIndicator(true); |
265 | 265 | ||
266 | setSelectionModeExt( KListView::Extended ); | 266 | setSelectionModeExt( KListView::Extended ); |
267 | setDropVisualizer(false); | 267 | setDropVisualizer(false); |
268 | // setFrameStyle(QFrame::NoFrame); | 268 | // setFrameStyle(QFrame::NoFrame); |
269 | //setLineWidth ( 0 ); | 269 | //setLineWidth ( 0 ); |
270 | //setMidLineWidth ( 0 ); | 270 | //setMidLineWidth ( 0 ); |
271 | //setMargin ( 0 ); | 271 | //setMargin ( 0 ); |
272 | #ifndef KAB_EMBEDDED | 272 | #ifndef KAB_EMBEDDED |
273 | connect(this, SIGNAL(dropped(QDropEvent*)), | 273 | connect(this, SIGNAL(dropped(QDropEvent*)), |
274 | this, SLOT(itemDropped(QDropEvent*))); | 274 | this, SLOT(itemDropped(QDropEvent*))); |
275 | #endif //KAB_EMBEDDED | 275 | #endif //KAB_EMBEDDED |
276 | 276 | ||
277 | 277 | ||
278 | new DynamicTip( this ); | 278 | new DynamicTip( this ); |
279 | } | 279 | } |
280 | 280 | ||
281 | void ContactListView::setAlternateColor(const QColor &m_AlternateColor) | 281 | void ContactListView::setAlternateColor(const QColor &m_AlternateColor) |
282 | { | 282 | { |
283 | mAlternateColor = m_AlternateColor; | 283 | mAlternateColor = m_AlternateColor; |
284 | } | 284 | } |
285 | 285 | ||
286 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) | 286 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) |
287 | { | 287 | { |
288 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); | 288 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); |
289 | 289 | ||
290 | // Get the brush, which will have the background pixmap if there is one. | 290 | // Get the brush, which will have the background pixmap if there is one. |
291 | if (b.pixmap()) | 291 | if (b.pixmap()) |
292 | { | 292 | { |
293 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), | 293 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), |
294 | *(b.pixmap()), | 294 | *(b.pixmap()), |
295 | rect.left() + contentsX(), | 295 | rect.left() + contentsX(), |
296 | rect.top() + contentsY() ); | 296 | rect.top() + contentsY() ); |
297 | } | 297 | } |
298 | 298 | ||
299 | else | 299 | else |
300 | { | 300 | { |
301 | // Do a normal paint | 301 | // Do a normal paint |
302 | KListView::paintEmptyArea(p, rect); | 302 | KListView::paintEmptyArea(p, rect); |
303 | } | 303 | } |
304 | } | 304 | } |
305 | 305 | ||
306 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) | 306 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) |
307 | { | 307 | { |
308 | presspos = e->pos(); | 308 | presspos = e->pos(); |
309 | KListView::contentsMousePressEvent(e); | 309 | KListView::contentsMousePressEvent(e); |
310 | } | 310 | } |
311 | 311 | ||
312 | 312 | ||
313 | // To initiate a drag operation | 313 | // To initiate a drag operation |
314 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) | 314 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) |
315 | { | 315 | { |
316 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { | 316 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { |
317 | emit startAddresseeDrag(); | 317 | emit startAddresseeDrag(); |
318 | } | 318 | } |
319 | else | 319 | else |
320 | KListView::contentsMouseMoveEvent( e ); | 320 | KListView::contentsMouseMoveEvent( e ); |
321 | } | 321 | } |
322 | 322 | ||
323 | bool ContactListView::acceptDrag(QDropEvent *e) const | 323 | bool ContactListView::acceptDrag(QDropEvent *e) const |
324 | { | 324 | { |
325 | #ifndef KAB_EMBEDDED | 325 | #ifndef KAB_EMBEDDED |
326 | return QTextDrag::canDecode(e); | 326 | return QTextDrag::canDecode(e); |
327 | #else //KAB_EMBEDDED | 327 | #else //KAB_EMBEDDED |
328 | qDebug("ContactListView::acceptDrag has to be fixed"); | 328 | qDebug("ContactListView::acceptDrag has to be fixed"); |
329 | return false; | 329 | return false; |
330 | #endif //KAB_EMBEDDED | 330 | #endif //KAB_EMBEDDED |
331 | } | 331 | } |
332 | 332 | ||
333 | void ContactListView::itemDropped(QDropEvent *e) | 333 | void ContactListView::itemDropped(QDropEvent *e) |
334 | { | 334 | { |
335 | contentsDropEvent(e); | 335 | contentsDropEvent(e); |
336 | } | 336 | } |
337 | 337 | ||
338 | void ContactListView::contentsDropEvent( QDropEvent *e ) | 338 | void ContactListView::contentsDropEvent( QDropEvent *e ) |
339 | { | 339 | { |
340 | emit addresseeDropped(e); | 340 | emit addresseeDropped(e); |
341 | } | 341 | } |
342 | 342 | ||
343 | void ContactListView::setAlternateBackgroundEnabled(bool enabled) | 343 | void ContactListView::setAlternateBackgroundEnabled(bool enabled) |
344 | { | 344 | { |
345 | mABackground = enabled; | 345 | mABackground = enabled; |
346 | 346 | ||
347 | if (mABackground) | 347 | if (mABackground) |
348 | { | 348 | { |
349 | setAlternateBackground(mAlternateColor); | 349 | setAlternateBackground(mAlternateColor); |
350 | } | 350 | } |
351 | else | 351 | else |
352 | { | 352 | { |
353 | setAlternateBackground(QColor()); | 353 | setAlternateBackground(QColor()); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | 356 | ||
357 | void ContactListView::setBackgroundPixmap(const QString &filename) | 357 | void ContactListView::setBackgroundPixmap(const QString &filename) |
358 | { | 358 | { |
359 | if (filename.isEmpty()) | 359 | if (filename.isEmpty()) |
360 | { | 360 | { |
361 | unsetPalette(); | 361 | unsetPalette(); |
362 | } | 362 | } |
363 | else | 363 | else |
364 | { | 364 | { |
365 | qDebug("ContactListView::setBackgroundPixmap has to be verified"); | 365 | qDebug("ContactListView::setBackgroundPixmap has to be verified"); |
366 | //US setPaletteBackgroundPixmap(QPixmap(filename)); | 366 | //US setPaletteBackgroundPixmap(QPixmap(filename)); |
367 | KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename)); | 367 | KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename)); |
368 | } | 368 | } |
369 | 369 | ||
370 | } | 370 | } |
371 | #ifndef KAB_EMBEDDED | 371 | #ifndef KAB_EMBEDDED |
372 | #include "contactlistview.moc" | 372 | #include "contactlistview.moc" |
373 | #endif //KAB_EMBEDDED | 373 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/xxportselectdialog.cpp b/kaddressbook/xxportselectdialog.cpp index ab95d5f..6282453 100644 --- a/kaddressbook/xxportselectdialog.cpp +++ b/kaddressbook/xxportselectdialog.cpp | |||
@@ -1,288 +1,294 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> | 3 | Copyright (c) 2002 Anders Lund <anders.lund@lund.tdcadsl.dk> |
4 | Tobias Koenig <tokoe@kde.org> | 4 | Tobias Koenig <tokoe@kde.org> |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or | 8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. | 9 | (at your option) any later version. |
10 | 10 | ||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* | 25 | /* |
26 | Enhanced Version of the file for platform independent KDE tools. | 26 | Enhanced Version of the file for platform independent KDE tools. |
27 | Copyright (c) 2004 Ulf Schenk | 27 | Copyright (c) 2004 Ulf Schenk |
28 | 28 | ||
29 | $Id$ | 29 | $Id$ |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <kcombobox.h> | 34 | #include <kcombobox.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | 37 | ||
38 | #include <qapplication.h> | ||
38 | #include <qbuttongroup.h> | 39 | #include <qbuttongroup.h> |
39 | #include <qcombobox.h> | 40 | #include <qcombobox.h> |
40 | #include <qheader.h> | 41 | #include <qheader.h> |
41 | #include <qlabel.h> | 42 | #include <qlabel.h> |
42 | #include <qlayout.h> | 43 | #include <qlayout.h> |
43 | #include <qlistview.h> | 44 | #include <qlistview.h> |
44 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
45 | #include <qradiobutton.h> | 46 | #include <qradiobutton.h> |
46 | #include <qstringlist.h> | 47 | #include <qstringlist.h> |
47 | #include <qwhatsthis.h> | 48 | #include <qwhatsthis.h> |
48 | 49 | ||
49 | #include "kabcore.h" | 50 | #include "kabcore.h" |
50 | #include "kabprefs.h" | 51 | #include "kabprefs.h" |
51 | 52 | ||
52 | #include "xxportselectdialog.h" | 53 | #include "xxportselectdialog.h" |
53 | 54 | ||
54 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, | 55 | XXPortSelectDialog::XXPortSelectDialog( KABCore *core, bool sort, |
55 | QWidget* parent, const char* name ) | 56 | QWidget* parent, const char* name ) |
56 | : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel, | 57 | : KDialogBase( Plain, i18n( "Choose which contacts to select" ), Help | Ok | Cancel, |
57 | Ok, parent, name, true, true ), mCore( core ), | 58 | Ok, parent, name, true, true ), mCore( core ), |
58 | mUseSorting( sort ) | 59 | mUseSorting( sort ) |
59 | { | 60 | { |
60 | initGUI(); | 61 | initGUI(); |
61 | 62 | ||
62 | connect( mFiltersCombo, SIGNAL( activated( int ) ), | 63 | connect( mFiltersCombo, SIGNAL( activated( int ) ), |
63 | SLOT( filterChanged( int ) ) ); | 64 | SLOT( filterChanged( int ) ) ); |
64 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), | 65 | connect( mCategoriesView, SIGNAL( clicked( QListViewItem* ) ), |
65 | SLOT( categoryClicked( QListViewItem* ) ) ); | 66 | SLOT( categoryClicked( QListViewItem* ) ) ); |
66 | 67 | ||
67 | // setup filters | 68 | // setup filters |
68 | #ifndef KAB_EMBEDDED | 69 | #ifndef KAB_EMBEDDED |
69 | mFilters = Filter::restore( kapp->config(), "Filter" ); | 70 | mFilters = Filter::restore( kapp->config(), "Filter" ); |
70 | Filter::List::iterator filterIt; | 71 | Filter::List::iterator filterIt; |
71 | #else //KAB_EMBEDDED | 72 | #else //KAB_EMBEDDED |
72 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); | 73 | mFilters = Filter::restore( KGlobal::config(), "Filter" ); |
73 | Filter::List::Iterator filterIt; | 74 | Filter::List::Iterator filterIt; |
74 | #endif //KAB_EMBEDDED | 75 | #endif //KAB_EMBEDDED |
75 | QStringList filters; | 76 | QStringList filters; |
76 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 77 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
77 | filters.append( (*filterIt).name() ); | 78 | filters.append( (*filterIt).name() ); |
78 | 79 | ||
79 | mFiltersCombo->insertStringList( filters ); | 80 | mFiltersCombo->insertStringList( filters ); |
80 | mUseFilters->setEnabled( filters.count() > 0 ); | 81 | mUseFilters->setEnabled( filters.count() > 0 ); |
81 | 82 | ||
82 | // setup categories | 83 | // setup categories |
83 | QStringList categories = KABPrefs::instance()->mCustomCategories; | 84 | QStringList categories = KABPrefs::instance()->mCustomCategories; |
84 | QStringList::Iterator it; | 85 | QStringList::Iterator it; |
85 | for ( it = categories.begin(); it != categories.end(); ++it ) | 86 | for ( it = categories.begin(); it != categories.end(); ++it ) |
86 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); | 87 | new QCheckListItem( mCategoriesView, *it, QCheckListItem::CheckBox ); |
87 | mUseCategories->setEnabled( categories.count() > 0 ); | 88 | mUseCategories->setEnabled( categories.count() > 0 ); |
88 | 89 | ||
89 | int count = mCore->selectedUIDs().count(); | 90 | int count = mCore->selectedUIDs().count(); |
90 | mUseSelection->setEnabled( count != 0 ); | 91 | mUseSelection->setEnabled( count != 0 ); |
91 | mUseSelection->setChecked( count > 1 ); | 92 | mUseSelection->setChecked( count > 1 ); |
92 | 93 | ||
93 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); | 94 | mSortTypeCombo->insertItem( i18n( "Ascending" ) ); |
94 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); | 95 | mSortTypeCombo->insertItem( i18n( "Descending" ) ); |
95 | 96 | ||
96 | mFields = mCore->addressBook()->fields( KABC::Field::All ); | 97 | mFields = mCore->addressBook()->fields( KABC::Field::All ); |
97 | KABC::Field::List::Iterator fieldIt; | 98 | KABC::Field::List::Iterator fieldIt; |
98 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) | 99 | for ( fieldIt = mFields.begin(); fieldIt != mFields.end(); ++fieldIt ) |
99 | mFieldCombo->insertItem( (*fieldIt)->label() ); | 100 | mFieldCombo->insertItem( (*fieldIt)->label() ); |
100 | } | 101 | } |
101 | 102 | ||
102 | QStringList XXPortSelectDialog::uids() | 103 | QStringList XXPortSelectDialog::uids() |
103 | { | 104 | { |
104 | QStringList uidlist; | 105 | QStringList uidlist; |
105 | KABC::AddresseeList list = contacts(); | 106 | KABC::AddresseeList list = contacts(); |
106 | KABC::Addressee::List::Iterator it; | 107 | KABC::Addressee::List::Iterator it; |
107 | for ( it = list.begin(); it != list.end(); ++it ) | 108 | for ( it = list.begin(); it != list.end(); ++it ) |
108 | uidlist.append((*it).uid()); | 109 | uidlist.append((*it).uid()); |
109 | return uidlist; | 110 | return uidlist; |
110 | } | 111 | } |
111 | KABC::AddresseeList XXPortSelectDialog::contacts() | 112 | KABC::AddresseeList XXPortSelectDialog::contacts() |
112 | { | 113 | { |
113 | QStringList selection = mCore->selectedUIDs(); | 114 | QStringList selection = mCore->selectedUIDs(); |
114 | 115 | ||
115 | KABC::AddresseeList list; | 116 | KABC::AddresseeList list; |
116 | if ( mUseSelection->isChecked() ) { | 117 | if ( mUseSelection->isChecked() ) { |
117 | QStringList::Iterator it; | 118 | QStringList::Iterator it; |
118 | for ( it = selection.begin(); it != selection.end(); ++it ) { | 119 | for ( it = selection.begin(); it != selection.end(); ++it ) { |
119 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 120 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
120 | if ( !addr.isEmpty() ) | 121 | if ( !addr.isEmpty() ) |
121 | list.append( addr ); | 122 | list.append( addr ); |
122 | } | 123 | } |
123 | } else if ( mUseFilters->isChecked() ) { | 124 | } else if ( mUseFilters->isChecked() ) { |
124 | // find contacts that can pass selected filter | 125 | // find contacts that can pass selected filter |
125 | Filter::List::Iterator filterIt; | 126 | Filter::List::Iterator filterIt; |
126 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) | 127 | for ( filterIt = mFilters.begin(); filterIt != mFilters.end(); ++filterIt ) |
127 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) | 128 | if ( (*filterIt).name() == mFiltersCombo->currentText() ) |
128 | break; | 129 | break; |
129 | 130 | ||
130 | KABC::AddressBook::Iterator it; | 131 | KABC::AddressBook::Iterator it; |
131 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 132 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
132 | if ( (*filterIt).filterAddressee( *it ) ) | 133 | if ( (*filterIt).filterAddressee( *it ) ) |
133 | list.append( *it ); | 134 | list.append( *it ); |
134 | } | 135 | } |
135 | } else if ( mUseCategories->isChecked() ) { | 136 | } else if ( mUseCategories->isChecked() ) { |
136 | QStringList categorieList = categories(); | 137 | QStringList categorieList = categories(); |
137 | KABC::AddressBook::Iterator it; | 138 | KABC::AddressBook::Iterator it; |
138 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { | 139 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { |
139 | QStringList tmp( (*it).categories() ); | 140 | QStringList tmp( (*it).categories() ); |
140 | QStringList::Iterator tmpIt; | 141 | QStringList::Iterator tmpIt; |
141 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) | 142 | for ( tmpIt = tmp.begin(); tmpIt != tmp.end(); ++tmpIt ) |
142 | if ( categorieList.contains( *tmpIt ) ) { | 143 | if ( categorieList.contains( *tmpIt ) ) { |
143 | list.append( *it ); | 144 | list.append( *it ); |
144 | break; | 145 | break; |
145 | } | 146 | } |
146 | } | 147 | } |
147 | } else { | 148 | } else { |
148 | // create a string list of all entries: | 149 | // create a string list of all entries: |
149 | KABC::AddressBook::Iterator it; | 150 | KABC::AddressBook::Iterator it; |
150 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) | 151 | for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) |
151 | list.append( *it ); | 152 | list.append( *it ); |
152 | } | 153 | } |
153 | 154 | ||
154 | if ( mUseSorting ) { | 155 | if ( mUseSorting ) { |
155 | list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); | 156 | list.setReverseSorting( mSortTypeCombo->currentItem() == 1 ); |
156 | uint pos = mFieldCombo->currentItem(); | 157 | uint pos = mFieldCombo->currentItem(); |
157 | if ( pos < mFields.count() ) | 158 | if ( pos < mFields.count() ) |
158 | list.sortByField( mFields[ pos ] ); | 159 | list.sortByField( mFields[ pos ] ); |
159 | } | 160 | } |
160 | 161 | ||
161 | return list; | 162 | return list; |
162 | } | 163 | } |
163 | 164 | ||
164 | QStringList XXPortSelectDialog::categories() const | 165 | QStringList XXPortSelectDialog::categories() const |
165 | { | 166 | { |
166 | QStringList list; | 167 | QStringList list; |
167 | 168 | ||
168 | QListViewItemIterator it( mCategoriesView ); | 169 | QListViewItemIterator it( mCategoriesView ); |
169 | for ( ; it.current(); ++it ) { | 170 | for ( ; it.current(); ++it ) { |
170 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); | 171 | QCheckListItem* qcli = static_cast<QCheckListItem*>(it.current()); |
171 | if ( qcli->isOn() ) | 172 | if ( qcli->isOn() ) |
172 | list.append( it.current()->text( 0 ) ); | 173 | list.append( it.current()->text( 0 ) ); |
173 | } | 174 | } |
174 | 175 | ||
175 | return list; | 176 | return list; |
176 | } | 177 | } |
177 | 178 | ||
178 | void XXPortSelectDialog::filterChanged( int ) | 179 | void XXPortSelectDialog::filterChanged( int ) |
179 | { | 180 | { |
180 | mUseFilters->setChecked( true ); | 181 | mUseFilters->setChecked( true ); |
181 | } | 182 | } |
182 | 183 | ||
183 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) | 184 | void XXPortSelectDialog::categoryClicked( QListViewItem *i ) |
184 | { | 185 | { |
185 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); | 186 | QCheckListItem *qcli = static_cast<QCheckListItem*>( i ); |
186 | if ( qcli->isOn() ) | 187 | if ( qcli->isOn() ) |
187 | mUseCategories->setChecked( true ); | 188 | mUseCategories->setChecked( true ); |
188 | } | 189 | } |
189 | 190 | ||
190 | void XXPortSelectDialog::slotHelp() | 191 | void XXPortSelectDialog::slotHelp() |
191 | { | 192 | { |
192 | #ifndef KAB_EMBEDDED | 193 | #ifndef KAB_EMBEDDED |
193 | kapp->invokeHelp( "import-and-export" ); | 194 | kapp->invokeHelp( "import-and-export" ); |
194 | #else //KAB_EMBEDDED | 195 | #else //KAB_EMBEDDED |
195 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); | 196 | qDebug("XXPortSelectDialog::slotHelp is not implemented yet"); |
196 | #endif //KAB_EMBEDDED | 197 | #endif //KAB_EMBEDDED |
197 | 198 | ||
198 | } | 199 | } |
199 | 200 | ||
200 | void XXPortSelectDialog::initGUI() | 201 | void XXPortSelectDialog::initGUI() |
201 | { | 202 | { |
202 | QFrame *page = plainPage(); | 203 | QFrame *page = plainPage(); |
203 | 204 | ||
204 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(), | 205 | QVBoxLayout *topLayout = new QVBoxLayout( page, KDialog::marginHint(), |
205 | KDialog::spacingHint() ); | 206 | KDialog::spacingHint() ); |
206 | 207 | ||
207 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); | 208 | QLabel *label = new QLabel( i18n( "Which contacts do you want to select?" ), page ); |
208 | topLayout->addWidget( label ); | 209 | topLayout->addWidget( label ); |
209 | 210 | ||
210 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); | 211 | mButtonGroup = new QButtonGroup( i18n( "Contact Selection" ), page ); |
211 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); | 212 | mButtonGroup->setColumnLayout( 0, Qt::Vertical ); |
212 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); | 213 | mButtonGroup->layout()->setSpacing( KDialog::spacingHint() ); |
213 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); | 214 | mButtonGroup->layout()->setMargin( KDialog::marginHint() ); |
214 | 215 | ||
215 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); | 216 | QGridLayout *groupLayout = new QGridLayout( mButtonGroup->layout() ); |
216 | groupLayout->setAlignment( Qt::AlignTop ); | 217 | groupLayout->setAlignment( Qt::AlignTop ); |
217 | 218 | ||
218 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); | 219 | mUseWholeBook = new QRadioButton( i18n( "&All" ), mButtonGroup ); |
219 | mUseWholeBook->setChecked( true ); | 220 | mUseWholeBook->setChecked( true ); |
220 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); | 221 | QWhatsThis::add( mUseWholeBook, i18n( "Select the entire address book" ) ); |
221 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); | 222 | groupLayout->addWidget( mUseWholeBook, 0, 0 ); |
222 | 223 | ||
223 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); | 224 | mUseSelection = new QRadioButton( i18n( "&Selected" ), mButtonGroup ); |
224 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" | 225 | QWhatsThis::add( mUseSelection, i18n( "Only contacts selected in KAddressBook.\n" |
225 | "This option is disabled if no contacts are selected." ) ); | 226 | "This option is disabled if no contacts are selected." ) ); |
226 | groupLayout->addWidget( mUseSelection, 1, 0 ); | 227 | groupLayout->addWidget( mUseSelection, 1, 0 ); |
227 | 228 | ||
228 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); | 229 | mUseFilters = new QRadioButton( i18n( "By matching &filter" ), mButtonGroup ); |
229 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" | 230 | QWhatsThis::add( mUseFilters, i18n( "Only contacts matching the selected filter.\n" |
230 | "This option is disabled if you haven't defined any filters" ) ); | 231 | "This option is disabled if you haven't defined any filters" ) ); |
231 | groupLayout->addWidget( mUseFilters, 2, 0 ); | 232 | groupLayout->addWidget( mUseFilters, 2, 0 ); |
232 | 233 | ||
233 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); | 234 | mUseCategories = new QRadioButton( i18n( "By Cate&gories" ), mButtonGroup ); |
234 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" | 235 | QWhatsThis::add( mUseCategories, i18n( "Only contacts who are members of a category that is checked on the list to the left.\n" |
235 | "This option is disabled if you have no categories." ) ); | 236 | "This option is disabled if you have no categories." ) ); |
236 | groupLayout->addWidget( mUseCategories, 3, 0 ); | 237 | groupLayout->addWidget( mUseCategories, 3, 0 ); |
237 | 238 | ||
238 | mFiltersCombo = new QComboBox( false, mButtonGroup ); | 239 | mFiltersCombo = new QComboBox( false, mButtonGroup ); |
239 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); | 240 | QWhatsThis::add( mFiltersCombo, i18n( "Select a filter to decide which contacts to select." ) ); |
240 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); | 241 | groupLayout->addWidget( mFiltersCombo, 2, 1 ); |
241 | 242 | ||
242 | mCategoriesView = new QListView( mButtonGroup ); | 243 | mCategoriesView = new QListView( mButtonGroup ); |
243 | mCategoriesView->addColumn( "" ); | 244 | mCategoriesView->addColumn( "" ); |
244 | mCategoriesView->header()->hide(); | 245 | mCategoriesView->header()->hide(); |
245 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); | 246 | QWhatsThis::add( mCategoriesView, i18n( "Check the categories whose members you want to select." ) ); |
246 | groupLayout->addWidget( mCategoriesView, 3, 1 ); | 247 | groupLayout->addWidget( mCategoriesView, 3, 1 ); |
247 | 248 | ||
249 | // if (QApplication::desktop()->height() == 480 ) | ||
250 | // mCategoriesView->setMaximumHeight( 240 ); | ||
248 | topLayout->addWidget( mButtonGroup ); | 251 | topLayout->addWidget( mButtonGroup ); |
249 | 252 | ||
250 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); | 253 | QButtonGroup *sortingGroup = new QButtonGroup( i18n( "Sorting" ), page ); |
251 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); | 254 | sortingGroup->setColumnLayout( 0, Qt::Vertical ); |
252 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, | 255 | QGridLayout *sortLayout = new QGridLayout( sortingGroup->layout(), 2, 2, |
253 | KDialog::spacingHint() ); | 256 | KDialog::spacingHint() ); |
254 | sortLayout->setAlignment( Qt::AlignTop ); | 257 | sortLayout->setAlignment( Qt::AlignTop ); |
255 | 258 | ||
256 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); | 259 | label = new QLabel( i18n( "Criterion:" ), sortingGroup ); |
257 | sortLayout->addWidget( label, 0, 0 ); | 260 | sortLayout->addWidget( label, 0, 0 ); |
258 | 261 | ||
259 | #ifndef KAB_EMBEDDED | 262 | #ifndef KAB_EMBEDDED |
260 | mFieldCombo = new KComboBox( false, sortingGroup ); | 263 | mFieldCombo = new KComboBox( false, sortingGroup ); |
261 | #else //KAB_EMBEDDED | 264 | #else //KAB_EMBEDDED |
262 | //US Combobox is not editable anyway | 265 | //US Combobox is not editable anyway |
263 | mFieldCombo = new KComboBox( sortingGroup ); | 266 | mFieldCombo = new KComboBox( sortingGroup ); |
264 | #endif //KAB_EMBEDDED | 267 | #endif //KAB_EMBEDDED |
265 | sortLayout->addWidget( mFieldCombo, 0, 1 ); | 268 | sortLayout->addWidget( mFieldCombo, 0, 1 ); |
266 | 269 | ||
267 | label = new QLabel( i18n( "Order:" ), sortingGroup ); | 270 | label = new QLabel( i18n( "Order:" ), sortingGroup ); |
268 | sortLayout->addWidget( label, 1, 0 ); | 271 | sortLayout->addWidget( label, 1, 0 ); |
269 | 272 | ||
270 | #ifndef KAB_EMBEDDED | 273 | #ifndef KAB_EMBEDDED |
271 | mSortTypeCombo = new KComboBox( false, sortingGroup ); | 274 | mSortTypeCombo = new KComboBox( false, sortingGroup ); |
272 | #else //KAB_EMBEDDED | 275 | #else //KAB_EMBEDDED |
273 | //US Combobox is not editable anyway | 276 | //US Combobox is not editable anyway |
274 | mSortTypeCombo = new KComboBox( sortingGroup ); | 277 | mSortTypeCombo = new KComboBox( sortingGroup ); |
275 | #endif //KAB_EMBEDDED | 278 | #endif //KAB_EMBEDDED |
276 | sortLayout->addWidget( mSortTypeCombo, 1, 1 ); | 279 | sortLayout->addWidget( mSortTypeCombo, 1, 1 ); |
277 | 280 | ||
278 | topLayout->addWidget( sortingGroup ); | 281 | topLayout->addWidget( sortingGroup ); |
279 | 282 | ||
280 | if ( !mUseSorting ) | 283 | if ( !mUseSorting ) |
281 | sortingGroup->hide(); | 284 | sortingGroup->hide(); |
285 | #ifndef DESKTOP_VERSION | ||
286 | hideButtons(); | ||
287 | #endif | ||
282 | } | 288 | } |
283 | 289 | ||
284 | #ifndef KAB_EMBEDDED | 290 | #ifndef KAB_EMBEDDED |
285 | #include "xxportselectdialog.moc" | 291 | #include "xxportselectdialog.moc" |
286 | #endif //KAB_EMBEDDED | 292 | #endif //KAB_EMBEDDED |
287 | 293 | ||
288 | 294 | ||