-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index 09d9c03..9accf78 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp | |||
@@ -209,101 +209,101 @@ void ContactListViewItem::paintCell(QPainter * p, | |||
209 | KListViewItem::paintCell(p, cg, column, width, align); | 209 | KListViewItem::paintCell(p, cg, column, width, align); |
210 | 210 | ||
211 | if ( !p ) | 211 | if ( !p ) |
212 | return; | 212 | return; |
213 | 213 | ||
214 | if (parentListView->singleLine()) { | 214 | if (parentListView->singleLine()) { |
215 | p->setPen( parentListView->alternateColor() ); | 215 | p->setPen( parentListView->alternateColor() ); |
216 | p->drawLine( 0, height() - 1, width, height() - 1 ); | 216 | p->drawLine( 0, height() - 1, width, height() - 1 ); |
217 | } | 217 | } |
218 | } | 218 | } |
219 | 219 | ||
220 | 220 | ||
221 | ContactListView *ContactListViewItem::parent() | 221 | ContactListView *ContactListViewItem::parent() |
222 | { | 222 | { |
223 | return parentListView; | 223 | return parentListView; |
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | void ContactListViewItem::refresh() | 227 | void ContactListViewItem::refresh() |
228 | { | 228 | { |
229 | // Update our addressee, since it may have changed else were | 229 | // Update our addressee, since it may have changed else were |
230 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 230 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
231 | if (mAddressee.isEmpty()) | 231 | if (mAddressee.isEmpty()) |
232 | return; | 232 | return; |
233 | 233 | ||
234 | int i = 0; | 234 | int i = 0; |
235 | KABC::Field::List::ConstIterator it; | 235 | KABC::Field::List::ConstIterator it; |
236 | for( it = mFields.begin(); it != mFields.end(); ++it ) { | 236 | for( it = mFields.begin(); it != mFields.end(); ++it ) { |
237 | setText( i++, (*it)->value( mAddressee ) ); | 237 | setText( i++, (*it)->value( mAddressee ) ); |
238 | } | 238 | } |
239 | } | 239 | } |
240 | 240 | ||
241 | /////////////////////////////// | 241 | /////////////////////////////// |
242 | // ContactListView | 242 | // ContactListView |
243 | 243 | ||
244 | ContactListView::ContactListView(KAddressBookTableView *view, | 244 | ContactListView::ContactListView(KAddressBookTableView *view, |
245 | KABC::AddressBook* /* doc */, | 245 | KABC::AddressBook* /* doc */, |
246 | QWidget *parent, | 246 | QWidget *parent, |
247 | const char *name ) | 247 | const char *name ) |
248 | : KListView( parent, name ), | 248 | : KListView( parent, name ), |
249 | pabWidget( view ), | 249 | pabWidget( view ), |
250 | oldColumn( 0 ) | 250 | oldColumn( 0 ) |
251 | { | 251 | { |
252 | mFlagBlockKeyPressed = false; | 252 | mFlagBlockKeyPressed = false; |
253 | mFlagKeyPressed = false; | 253 | mFlagKeyPressed = false; |
254 | mABackground = true; | 254 | mABackground = true; |
255 | mSingleLine = false; | 255 | mSingleLine = false; |
256 | mToolTips = true; | 256 | mToolTips = true; |
257 | #ifndef KAB_EMBEDDED | 257 | |
258 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); | 258 | mAlternateColor = KGlobalSettings::alternateBackgroundColor(); |
259 | #else //KAB_EMBEDDED | 259 | |
260 | mAlternateColor = QColor(240, 240, 240); | 260 | |
261 | #endif //KAB_EMBEDDED | 261 | |
262 | 262 | ||
263 | setAlternateBackgroundEnabled(mABackground); | 263 | setAlternateBackgroundEnabled(mABackground); |
264 | setAcceptDrops( true ); | 264 | setAcceptDrops( true ); |
265 | viewport()->setAcceptDrops( true ); | 265 | viewport()->setAcceptDrops( true ); |
266 | setAllColumnsShowFocus( true ); | 266 | setAllColumnsShowFocus( true ); |
267 | setShowSortIndicator(true); | 267 | setShowSortIndicator(true); |
268 | 268 | ||
269 | setSelectionModeExt( KListView::Extended ); | 269 | setSelectionModeExt( KListView::Extended ); |
270 | setDropVisualizer(false); | 270 | setDropVisualizer(false); |
271 | // setFrameStyle(QFrame::NoFrame); | 271 | // setFrameStyle(QFrame::NoFrame); |
272 | //setLineWidth ( 0 ); | 272 | //setLineWidth ( 0 ); |
273 | //setMidLineWidth ( 0 ); | 273 | //setMidLineWidth ( 0 ); |
274 | //setMargin ( 0 ); | 274 | //setMargin ( 0 ); |
275 | #ifndef KAB_EMBEDDED | 275 | #ifndef KAB_EMBEDDED |
276 | connect(this, SIGNAL(dropped(QDropEvent*)), | 276 | connect(this, SIGNAL(dropped(QDropEvent*)), |
277 | this, SLOT(itemDropped(QDropEvent*))); | 277 | this, SLOT(itemDropped(QDropEvent*))); |
278 | #endif //KAB_EMBEDDED | 278 | #endif //KAB_EMBEDDED |
279 | 279 | ||
280 | 280 | ||
281 | new DynamicTip( this ); | 281 | new DynamicTip( this ); |
282 | } | 282 | } |
283 | void ContactListView::printMe() | 283 | void ContactListView::printMe() |
284 | { | 284 | { |
285 | #ifdef DESKTOP_VERSION | 285 | #ifdef DESKTOP_VERSION |
286 | QPrinter printer; | 286 | QPrinter printer; |
287 | if (!printer.setup() ) | 287 | if (!printer.setup() ) |
288 | return; | 288 | return; |
289 | QPainter p; | 289 | QPainter p; |
290 | p.begin ( &printer ); | 290 | p.begin ( &printer ); |
291 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 291 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
292 | float dx, dy; | 292 | float dx, dy; |
293 | int wid = (m.width() * 9)/10; | 293 | int wid = (m.width() * 9)/10; |
294 | dx = (float) wid/(float)contentsWidth (); | 294 | dx = (float) wid/(float)contentsWidth (); |
295 | dy = (float)(m.height()) / (float)contentsHeight (); | 295 | dy = (float)(m.height()) / (float)contentsHeight (); |
296 | float scale; | 296 | float scale; |
297 | // scale to fit the width or height of the paper | 297 | // scale to fit the width or height of the paper |
298 | if ( dx < dy ) | 298 | if ( dx < dy ) |
299 | scale = dx; | 299 | scale = dx; |
300 | else | 300 | else |
301 | scale = dy; | 301 | scale = dy; |
302 | p.translate( m.width()/10,0 ); | 302 | p.translate( m.width()/10,0 ); |
303 | p.scale( scale, scale ); | 303 | p.scale( scale, scale ); |
304 | qDebug("scale %f ", scale); | 304 | qDebug("scale %f ", scale); |
305 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 305 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
306 | p.end(); | 306 | p.end(); |
307 | qDebug("Why does it not print??? "); | 307 | qDebug("Why does it not print??? "); |
308 | #endif | 308 | #endif |
309 | } | 309 | } |