-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 8 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 3 | ||||
-rw-r--r-- | microkde/kglobalsettings.cpp | 9 | ||||
-rw-r--r-- | microkde/kglobalsettings.h | 1 |
4 files changed, 15 insertions, 6 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 | |||
@@ -161,197 +161,197 @@ ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, | |||
161 | ContactListView *parent, | 161 | ContactListView *parent, |
162 | KABC::AddressBook *doc, | 162 | KABC::AddressBook *doc, |
163 | const KABC::Field::List &fields ) | 163 | const KABC::Field::List &fields ) |
164 | : KListViewItem(parent), mAddressee(a), mFields( fields ), | 164 | : KListViewItem(parent), mAddressee(a), mFields( fields ), |
165 | parentListView( parent ), mDocument(doc) | 165 | parentListView( parent ), mDocument(doc) |
166 | { | 166 | { |
167 | refresh(); | 167 | refresh(); |
168 | } | 168 | } |
169 | 169 | ||
170 | QString ContactListViewItem::key(int column, bool ascending) const | 170 | QString ContactListViewItem::key(int column, bool ascending) const |
171 | { | 171 | { |
172 | #ifndef DESKTOP_VERSION | 172 | #ifndef DESKTOP_VERSION |
173 | int lan = KGlobal::locale()->language(); | 173 | int lan = KGlobal::locale()->language(); |
174 | //qDebug("language %d ", lan); | 174 | //qDebug("language %d ", lan); |
175 | if ( lan == 1 ) { //GERMAN | 175 | if ( lan == 1 ) { //GERMAN |
176 | QString ret = QListViewItem::key(column, ascending).lower().utf8(); | 176 | QString ret = QListViewItem::key(column, ascending).lower().utf8(); |
177 | int start = -1; | 177 | int start = -1; |
178 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { | 178 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { |
179 | ret.at(start-1) = 'a'; | 179 | ret.at(start-1) = 'a'; |
180 | } | 180 | } |
181 | start = -1; | 181 | start = -1; |
182 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { | 182 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { |
183 | ret.at(start-1) = 'o'; | 183 | ret.at(start-1) = 'o'; |
184 | } | 184 | } |
185 | start = -1; | 185 | start = -1; |
186 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { | 186 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { |
187 | ret.at(start-1) = 'o'; | 187 | ret.at(start-1) = 'o'; |
188 | } | 188 | } |
189 | start = -1; | 189 | start = -1; |
190 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { | 190 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { |
191 | ret.at(start-1) = 's'; | 191 | ret.at(start-1) = 's'; |
192 | } | 192 | } |
193 | //qDebug("conv string %s ", ret.latin1()); | 193 | //qDebug("conv string %s ", ret.latin1()); |
194 | 194 | ||
195 | return ret; | 195 | return ret; |
196 | 196 | ||
197 | } | 197 | } |
198 | else | 198 | else |
199 | #endif | 199 | #endif |
200 | return QListViewItem::key(column, ascending).lower(); | 200 | return QListViewItem::key(column, ascending).lower(); |
201 | } | 201 | } |
202 | 202 | ||
203 | void ContactListViewItem::paintCell(QPainter * p, | 203 | void ContactListViewItem::paintCell(QPainter * p, |
204 | const QColorGroup & cg, | 204 | const QColorGroup & cg, |
205 | int column, | 205 | int column, |
206 | int width, | 206 | int width, |
207 | int align) | 207 | int align) |
208 | { | 208 | { |
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 | } |
310 | 310 | ||
311 | void ContactListView::setAlternateColor(const QColor &m_AlternateColor) | 311 | void ContactListView::setAlternateColor(const QColor &m_AlternateColor) |
312 | { | 312 | { |
313 | mAlternateColor = m_AlternateColor; | 313 | mAlternateColor = m_AlternateColor; |
314 | } | 314 | } |
315 | 315 | ||
316 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) | 316 | void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) |
317 | { | 317 | { |
318 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); | 318 | QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); |
319 | 319 | ||
320 | // Get the brush, which will have the background pixmap if there is one. | 320 | // Get the brush, which will have the background pixmap if there is one. |
321 | if (b.pixmap()) | 321 | if (b.pixmap()) |
322 | { | 322 | { |
323 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), | 323 | p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), |
324 | *(b.pixmap()), | 324 | *(b.pixmap()), |
325 | rect.left() + contentsX(), | 325 | rect.left() + contentsX(), |
326 | rect.top() + contentsY() ); | 326 | rect.top() + contentsY() ); |
327 | } | 327 | } |
328 | 328 | ||
329 | else | 329 | else |
330 | { | 330 | { |
331 | // Do a normal paint | 331 | // Do a normal paint |
332 | KListView::paintEmptyArea(p, rect); | 332 | KListView::paintEmptyArea(p, rect); |
333 | } | 333 | } |
334 | } | 334 | } |
335 | 335 | ||
336 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) | 336 | void ContactListView::contentsMousePressEvent(QMouseEvent* e) |
337 | { | 337 | { |
338 | presspos = e->pos(); | 338 | presspos = e->pos(); |
339 | KListView::contentsMousePressEvent(e); | 339 | KListView::contentsMousePressEvent(e); |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
343 | // To initiate a drag operation | 343 | // To initiate a drag operation |
344 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) | 344 | void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) |
345 | { | 345 | { |
346 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { | 346 | if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { |
347 | emit startAddresseeDrag(); | 347 | emit startAddresseeDrag(); |
348 | } | 348 | } |
349 | else | 349 | else |
350 | KListView::contentsMouseMoveEvent( e ); | 350 | KListView::contentsMouseMoveEvent( e ); |
351 | } | 351 | } |
352 | 352 | ||
353 | bool ContactListView::acceptDrag(QDropEvent *e) const | 353 | bool ContactListView::acceptDrag(QDropEvent *e) const |
354 | { | 354 | { |
355 | #ifndef KAB_EMBEDDED | 355 | #ifndef KAB_EMBEDDED |
356 | return QTextDrag::canDecode(e); | 356 | return QTextDrag::canDecode(e); |
357 | #else //KAB_EMBEDDED | 357 | #else //KAB_EMBEDDED |
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 31e2053..25327aa 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -366,194 +366,193 @@ void KListViewLineEdit::terminate(bool commit) | |||
366 | //kdDebug() << "KListViewLineEdit::terminate " << commit << endl; | 366 | //kdDebug() << "KListViewLineEdit::terminate " << commit << endl; |
367 | if (commit) | 367 | if (commit) |
368 | item->setText(col, text()); | 368 | item->setText(col, text()); |
369 | int c=col; | 369 | int c=col; |
370 | QListViewItem *i=item; | 370 | QListViewItem *i=item; |
371 | col=0; | 371 | col=0; |
372 | item=0; | 372 | item=0; |
373 | hide(); // will call focusOutEvent, that's why we set item=0 before | 373 | hide(); // will call focusOutEvent, that's why we set item=0 before |
374 | emit done(i,c); | 374 | emit done(i,c); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
378 | void KListViewLineEdit::focusOutEvent(QFocusEvent *ev) | 378 | void KListViewLineEdit::focusOutEvent(QFocusEvent *ev) |
379 | { | 379 | { |
380 | QFocusEvent * focusEv = static_cast<QFocusEvent*>(ev); | 380 | QFocusEvent * focusEv = static_cast<QFocusEvent*>(ev); |
381 | // Don't let a RMB close the editor | 381 | // Don't let a RMB close the editor |
382 | if (focusEv->reason() != QFocusEvent::Popup && focusEv->reason() != QFocusEvent::ActiveWindow) | 382 | if (focusEv->reason() != QFocusEvent::Popup && focusEv->reason() != QFocusEvent::ActiveWindow) |
383 | terminate(true); | 383 | terminate(true); |
384 | } | 384 | } |
385 | 385 | ||
386 | void KListViewLineEdit::paintEvent( QPaintEvent *e ) | 386 | void KListViewLineEdit::paintEvent( QPaintEvent *e ) |
387 | { | 387 | { |
388 | KLineEdit::paintEvent( e ); | 388 | KLineEdit::paintEvent( e ); |
389 | 389 | ||
390 | if ( !frame() ) { | 390 | if ( !frame() ) { |
391 | QPainter p( this ); | 391 | QPainter p( this ); |
392 | p.setClipRegion( e->region() ); | 392 | p.setClipRegion( e->region() ); |
393 | p.drawRect( rect() ); | 393 | p.drawRect( rect() ); |
394 | } | 394 | } |
395 | } | 395 | } |
396 | 396 | ||
397 | // selection changed -> terminate. As our "item" can be already deleted, | 397 | // selection changed -> terminate. As our "item" can be already deleted, |
398 | // we can't call terminate(false), because that would emit done() with | 398 | // we can't call terminate(false), because that would emit done() with |
399 | // a dangling pointer to "item". | 399 | // a dangling pointer to "item". |
400 | void KListViewLineEdit::slotSelectionChanged() | 400 | void KListViewLineEdit::slotSelectionChanged() |
401 | { | 401 | { |
402 | item = 0; | 402 | item = 0; |
403 | col = 0; | 403 | col = 0; |
404 | hide(); | 404 | hide(); |
405 | } | 405 | } |
406 | */ | 406 | */ |
407 | 407 | ||
408 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) | 408 | KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse ) |
409 | : QListView( parent, name ), | 409 | : QListView( parent, name ), |
410 | d (new KListViewPrivate (this)) | 410 | d (new KListViewPrivate (this)) |
411 | { | 411 | { |
412 | #ifndef DESKTOP_VERSION | 412 | #ifndef DESKTOP_VERSION |
413 | if ( emulateRightMouse ) | 413 | if ( emulateRightMouse ) |
414 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); | 414 | QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); |
415 | #endif | 415 | #endif |
416 | //US setDragAutoScroll(true); | 416 | //US setDragAutoScroll(true); |
417 | 417 | ||
418 | connect( this, SIGNAL( onViewport() ), | 418 | connect( this, SIGNAL( onViewport() ), |
419 | this, SLOT( slotOnViewport() ) ); | 419 | this, SLOT( slotOnViewport() ) ); |
420 | connect( this, SIGNAL( onItem( QListViewItem * ) ), | 420 | connect( this, SIGNAL( onItem( QListViewItem * ) ), |
421 | this, SLOT( slotOnItem( QListViewItem * ) ) ); | 421 | this, SLOT( slotOnItem( QListViewItem * ) ) ); |
422 | 422 | ||
423 | connect (this, SIGNAL(contentsMoving(int,int)), | 423 | connect (this, SIGNAL(contentsMoving(int,int)), |
424 | this, SLOT(cleanDropVisualizer())); | 424 | this, SLOT(cleanDropVisualizer())); |
425 | connect (this, SIGNAL(contentsMoving(int,int)), | 425 | connect (this, SIGNAL(contentsMoving(int,int)), |
426 | this, SLOT(cleanItemHighlighter())); | 426 | this, SLOT(cleanItemHighlighter())); |
427 | 427 | ||
428 | /*US | 428 | /*US |
429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); | 429 | slotSettingsChanged(KApplication::SETTINGS_MOUSE); |
430 | 430 | ||
431 | if (kapp) | 431 | if (kapp) |
432 | { | 432 | { |
433 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); | 433 | connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) ); |
434 | kapp->addKipcEventMask( KIPC::SettingsChanged ); | 434 | kapp->addKipcEventMask( KIPC::SettingsChanged ); |
435 | } | 435 | } |
436 | */ | 436 | */ |
437 | slotSettingsChanged(1); //US do this to initialize the connections | 437 | slotSettingsChanged(1); //US do this to initialize the connections |
438 | 438 | ||
439 | 439 | ||
440 | connect(&d->autoSelect, SIGNAL( timeout() ), | 440 | connect(&d->autoSelect, SIGNAL( timeout() ), |
441 | this, SLOT( slotAutoSelect() ) ); | 441 | this, SLOT( slotAutoSelect() ) ); |
442 | connect(&d->dragExpand, SIGNAL( timeout() ), | 442 | connect(&d->dragExpand, SIGNAL( timeout() ), |
443 | this, SLOT( slotDragExpand() ) ); | 443 | this, SLOT( slotDragExpand() ) ); |
444 | 444 | ||
445 | // context menu handling | 445 | // context menu handling |
446 | if (d->showContextMenusOnPress) | 446 | if (d->showContextMenusOnPress) |
447 | { | 447 | { |
448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), | 448 | connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)), |
449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 449 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
450 | } | 450 | } |
451 | else | 451 | else |
452 | { | 452 | { |
453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), | 453 | connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)), |
454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); | 454 | this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int))); |
455 | } | 455 | } |
456 | 456 | ||
457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), | 457 | connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)), |
458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); | 458 | this, SLOT (emitContextMenu (KListView*, QListViewItem*))); |
459 | 459 | ||
460 | 460 | ||
461 | //qDebug("KListView::KListView make alternate color configurable"); | 461 | //qDebug("KListView::KListView make alternate color configurable"); |
462 | //US d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); | 462 | d->alternateBackground = KGlobalSettings::alternateBackgroundColor(); |
463 | d->alternateBackground = QColor(240, 240, 240); | ||
464 | } | 463 | } |
465 | 464 | ||
466 | 465 | ||
467 | 466 | ||
468 | KListView::~KListView() | 467 | KListView::~KListView() |
469 | { | 468 | { |
470 | delete d; | 469 | delete d; |
471 | } | 470 | } |
472 | 471 | ||
473 | bool KListView::isExecuteArea( const QPoint& point ) | 472 | bool KListView::isExecuteArea( const QPoint& point ) |
474 | { | 473 | { |
475 | if ( itemAt( point ) ) | 474 | if ( itemAt( point ) ) |
476 | return isExecuteArea( point.x() ); | 475 | return isExecuteArea( point.x() ); |
477 | 476 | ||
478 | return false; | 477 | return false; |
479 | } | 478 | } |
480 | 479 | ||
481 | bool KListView::isExecuteArea( int x ) | 480 | bool KListView::isExecuteArea( int x ) |
482 | { | 481 | { |
483 | if( allColumnsShowFocus() ) | 482 | if( allColumnsShowFocus() ) |
484 | return true; | 483 | return true; |
485 | else { | 484 | else { |
486 | int offset = 0; | 485 | int offset = 0; |
487 | int width = columnWidth( 0 ); | 486 | int width = columnWidth( 0 ); |
488 | int pos = header()->mapToIndex( 0 ); | 487 | int pos = header()->mapToIndex( 0 ); |
489 | 488 | ||
490 | for ( int index = 0; index < pos; index++ ) | 489 | for ( int index = 0; index < pos; index++ ) |
491 | offset += columnWidth( header()->mapToSection( index ) ); | 490 | offset += columnWidth( header()->mapToSection( index ) ); |
492 | 491 | ||
493 | x += contentsX(); // in case of a horizontal scrollbar | 492 | x += contentsX(); // in case of a horizontal scrollbar |
494 | return ( x > offset && x < ( offset + width ) ); | 493 | return ( x > offset && x < ( offset + width ) ); |
495 | } | 494 | } |
496 | } | 495 | } |
497 | 496 | ||
498 | void KListView::slotOnItem( QListViewItem *item ) | 497 | void KListView::slotOnItem( QListViewItem *item ) |
499 | { | 498 | { |
500 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); | 499 | QPoint vp = viewport()->mapFromGlobal( QCursor::pos() ); |
501 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { | 500 | if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) { |
502 | d->autoSelect.start( d->autoSelectDelay, true ); | 501 | d->autoSelect.start( d->autoSelectDelay, true ); |
503 | d->pCurrentItem = item; | 502 | d->pCurrentItem = item; |
504 | } | 503 | } |
505 | } | 504 | } |
506 | 505 | ||
507 | void KListView::slotOnViewport() | 506 | void KListView::slotOnViewport() |
508 | { | 507 | { |
509 | if ( d->bChangeCursorOverItem ) | 508 | if ( d->bChangeCursorOverItem ) |
510 | viewport()->unsetCursor(); | 509 | viewport()->unsetCursor(); |
511 | 510 | ||
512 | d->autoSelect.stop(); | 511 | d->autoSelect.stop(); |
513 | d->pCurrentItem = 0L; | 512 | d->pCurrentItem = 0L; |
514 | } | 513 | } |
515 | 514 | ||
516 | void KListView::slotSettingsChanged(int category) | 515 | void KListView::slotSettingsChanged(int category) |
517 | { | 516 | { |
518 | //qDebug("KListView::slotSettingsChanged has to be verified"); | 517 | //qDebug("KListView::slotSettingsChanged has to be verified"); |
519 | 518 | ||
520 | 519 | ||
521 | switch (category) | 520 | switch (category) |
522 | { | 521 | { |
523 | //US I create my private category (=1) to set the settings | 522 | //US I create my private category (=1) to set the settings |
524 | case 1: | 523 | case 1: |
525 | d->dragDelay = 2; | 524 | d->dragDelay = 2; |
526 | //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); | 525 | //US set explicitly d->bUseSingle = KGlobalSettings::singleClick(); |
527 | // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); | 526 | // qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle); |
528 | 527 | ||
529 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 528 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
530 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 529 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); |
531 | 530 | ||
532 | if( d->bUseSingle ) | 531 | if( d->bUseSingle ) |
533 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 532 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
534 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 533 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); |
535 | 534 | ||
536 | //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | 535 | //US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); |
537 | //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | 536 | //US d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); |
538 | 537 | ||
539 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | 538 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) |
540 | viewport()->unsetCursor(); | 539 | viewport()->unsetCursor(); |
541 | 540 | ||
542 | break; | 541 | break; |
543 | 542 | ||
544 | /*US | 543 | /*US |
545 | case KApplication::SETTINGS_MOUSE: | 544 | case KApplication::SETTINGS_MOUSE: |
546 | d->dragDelay = KGlobalSettings::dndEventDelay(); | 545 | d->dragDelay = KGlobalSettings::dndEventDelay(); |
547 | d->bUseSingle = KGlobalSettings::singleClick(); | 546 | d->bUseSingle = KGlobalSettings::singleClick(); |
548 | 547 | ||
549 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 548 | disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
550 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); | 549 | this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int))); |
551 | 550 | ||
552 | if( d->bUseSingle ) | 551 | if( d->bUseSingle ) |
553 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), | 552 | connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)), |
554 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); | 553 | this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int))); |
555 | 554 | ||
556 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); | 555 | d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon(); |
557 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); | 556 | d->autoSelectDelay = KGlobalSettings::autoSelectDelay(); |
558 | 557 | ||
559 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) | 558 | if( !d->bUseSingle || !d->bChangeCursorOverItem ) |
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp index b65ce66..92a2b48 100644 --- a/microkde/kglobalsettings.cpp +++ b/microkde/kglobalsettings.cpp | |||
@@ -1,77 +1,86 @@ | |||
1 | #include "kglobalsettings.h" | 1 | #include "kglobalsettings.h" |
2 | #include "kconfig.h" | 2 | #include "kconfig.h" |
3 | #include "kglobal.h" | 3 | #include "kglobal.h" |
4 | #include "kconfigbase.h" | 4 | #include "kconfigbase.h" |
5 | 5 | ||
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | 7 | ||
8 | QFont KGlobalSettings::generalFont() | 8 | QFont KGlobalSettings::generalFont() |
9 | { | 9 | { |
10 | int size = 12; | 10 | int size = 12; |
11 | if (QApplication::desktop()->width() < 480 ) { | 11 | if (QApplication::desktop()->width() < 480 ) { |
12 | size = 10; | 12 | size = 10; |
13 | } | 13 | } |
14 | #ifndef DESKTOP_VERSION | 14 | #ifndef DESKTOP_VERSION |
15 | else | 15 | else |
16 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 16 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
17 | size = 18; | 17 | size = 18; |
18 | #endif | 18 | #endif |
19 | QFont f = QApplication::font(); | 19 | QFont f = QApplication::font(); |
20 | //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1()); | 20 | //qDebug("pointsize %d %s", f.pointSize(),f.family().latin1()); |
21 | f.setPointSize( size ); | 21 | f.setPointSize( size ); |
22 | return f; | 22 | return f; |
23 | } | 23 | } |
24 | QFont KGlobalSettings::generalMaxFont() | 24 | QFont KGlobalSettings::generalMaxFont() |
25 | { | 25 | { |
26 | int size = 12; | 26 | int size = 12; |
27 | if (QApplication::desktop()->width() < 480 ) { | 27 | if (QApplication::desktop()->width() < 480 ) { |
28 | size = 10; | 28 | size = 10; |
29 | } | 29 | } |
30 | #ifndef DESKTOP_VERSION | 30 | #ifndef DESKTOP_VERSION |
31 | else | 31 | else |
32 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 32 | if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
33 | size = 18; | 33 | size = 18; |
34 | #endif | 34 | #endif |
35 | QFont f = QApplication::font(); | 35 | QFont f = QApplication::font(); |
36 | if ( f.pointSize() > size ) | 36 | if ( f.pointSize() > size ) |
37 | f.setPointSize( size ); | 37 | f.setPointSize( size ); |
38 | return f; | 38 | return f; |
39 | } | 39 | } |
40 | 40 | ||
41 | QString KGlobalSettings::timeTrackerDir() | 41 | QString KGlobalSettings::timeTrackerDir() |
42 | { | 42 | { |
43 | static QString dir; | 43 | static QString dir; |
44 | if ( dir.isEmpty() ) { | 44 | if ( dir.isEmpty() ) { |
45 | dir = locateLocal( "data", "timetrackerdir/d.ttl" ); | 45 | dir = locateLocal( "data", "timetrackerdir/d.ttl" ); |
46 | dir = dir.left ( dir.length() - 5); | 46 | dir = dir.left ( dir.length() - 5); |
47 | } | 47 | } |
48 | return dir; | 48 | return dir; |
49 | } | 49 | } |
50 | 50 | ||
51 | QFont KGlobalSettings::toolBarFont() | 51 | QFont KGlobalSettings::toolBarFont() |
52 | { | 52 | { |
53 | return QApplication::font(); | 53 | return QApplication::font(); |
54 | } | 54 | } |
55 | 55 | ||
56 | QColor KGlobalSettings::toolBarHighlightColor() | 56 | QColor KGlobalSettings::toolBarHighlightColor() |
57 | { | 57 | { |
58 | return QColor( "black" ); | 58 | return QColor( "black" ); |
59 | } | 59 | } |
60 | 60 | ||
61 | QColor KGlobalSettings::alternateBackgroundColor() | ||
62 | { | ||
63 | #ifdef DESKTOP_VERSION | ||
64 | return QColor( 235, 235, 235 ); | ||
65 | #else | ||
66 | return QColor( 220, 220, 220 ); | ||
67 | #endif | ||
68 | } | ||
69 | |||
61 | QRect KGlobalSettings::desktopGeometry( QWidget * ) | 70 | QRect KGlobalSettings::desktopGeometry( QWidget * ) |
62 | { | 71 | { |
63 | return QApplication::desktop()->rect(); | 72 | return QApplication::desktop()->rect(); |
64 | } | 73 | } |
65 | 74 | ||
66 | /** | 75 | /** |
67 | * Returns whether KDE runs in single (default) or double click | 76 | * Returns whether KDE runs in single (default) or double click |
68 | * mode. | 77 | * mode. |
69 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html | 78 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html |
70 | * @return true if single click mode, or false if double click mode. | 79 | * @return true if single click mode, or false if double click mode. |
71 | **/ | 80 | **/ |
72 | bool KGlobalSettings::singleClick() | 81 | bool KGlobalSettings::singleClick() |
73 | { | 82 | { |
74 | KConfig *c = KGlobal::config(); | 83 | KConfig *c = KGlobal::config(); |
75 | KConfigGroupSaver cgs( c, "KDE" ); | 84 | KConfigGroupSaver cgs( c, "KDE" ); |
76 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); | 85 | return c->readBoolEntry("SingleClick", KDE_DEFAULT_SINGLECLICK); |
77 | } | 86 | } |
diff --git a/microkde/kglobalsettings.h b/microkde/kglobalsettings.h index 3eeda35..e2620b3 100644 --- a/microkde/kglobalsettings.h +++ b/microkde/kglobalsettings.h | |||
@@ -1,32 +1,33 @@ | |||
1 | #ifndef MICROKDE_KGLOBALSETTINGS_H | 1 | #ifndef MICROKDE_KGLOBALSETTINGS_H |
2 | #define MICROKDE_KGLOBALSETTINGS_H | 2 | #define MICROKDE_KGLOBALSETTINGS_H |
3 | 3 | ||
4 | #include <qfont.h> | 4 | #include <qfont.h> |
5 | #include <qrect.h> | 5 | #include <qrect.h> |
6 | 6 | ||
7 | 7 | ||
8 | #define KDE_DEFAULT_SINGLECLICK true | 8 | #define KDE_DEFAULT_SINGLECLICK true |
9 | 9 | ||
10 | 10 | ||
11 | class KGlobalSettings | 11 | class KGlobalSettings |
12 | { | 12 | { |
13 | public: | 13 | public: |
14 | static QFont generalFont(); | 14 | static QFont generalFont(); |
15 | static QFont generalMaxFont(); | 15 | static QFont generalMaxFont(); |
16 | static QFont toolBarFont(); | 16 | static QFont toolBarFont(); |
17 | 17 | ||
18 | static QColor toolBarHighlightColor(); | 18 | static QColor toolBarHighlightColor(); |
19 | static QColor alternateBackgroundColor(); | ||
19 | static QRect desktopGeometry( QWidget * ); | 20 | static QRect desktopGeometry( QWidget * ); |
20 | static QString timeTrackerDir(); | 21 | static QString timeTrackerDir(); |
21 | 22 | ||
22 | /** | 23 | /** |
23 | * Returns whether KDE runs in single (default) or double click | 24 | * Returns whether KDE runs in single (default) or double click |
24 | * mode. | 25 | * mode. |
25 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html | 26 | * see http://developer.kde.org/documentation/standards/kde/style/mouse/index.html |
26 | * @return true if single click mode, or false if double click mode. | 27 | * @return true if single click mode, or false if double click mode. |
27 | **/ | 28 | **/ |
28 | static bool singleClick(); | 29 | static bool singleClick(); |
29 | 30 | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | #endif | 33 | #endif |