summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views
Unidiff
Diffstat (limited to 'kaddressbook/views') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/cardview.cpp6
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp5
2 files changed, 8 insertions, 3 deletions
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp
index 6351c11..da552c3 100644
--- a/kaddressbook/views/cardview.cpp
+++ b/kaddressbook/views/cardview.cpp
@@ -25,24 +25,25 @@
25#include "cardview.h" 25#include "cardview.h"
26 26
27#include <limits.h> 27#include <limits.h>
28 28
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qstyle.h> 33#include <qstyle.h>
34#include <qcursor.h> 34#include <qcursor.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36 36
37#include "kabprefs.h"
37#include <kdebug.h> 38#include <kdebug.h>
38#include <kglobalsettings.h> 39#include <kglobalsettings.h>
39//END includes 40//END includes
40 41
41#define MIN_ITEM_WIDTH 80 42#define MIN_ITEM_WIDTH 80
42 43
43//BEGIN Helpers 44//BEGIN Helpers
44////////////////////////////////////// 45//////////////////////////////////////
45// CardViewTip 46// CardViewTip
46class CardViewTip : public QLabel { 47class CardViewTip : public QLabel {
47 public: 48 public:
48 CardViewTip(QWidget *parent=0, const char *name=0) : QLabel( parent, name ) 49 CardViewTip(QWidget *parent=0, const char *name=0) : QLabel( parent, name )
@@ -647,25 +648,24 @@ CardView::CardView(QWidget *parent, const char *name)
647 d->mHeaderFont = f; 648 d->mHeaderFont = f;
648 d->mBFm = new QFontMetrics(f); 649 d->mBFm = new QFontMetrics(f);
649 d->mTip = ( new CardViewTip( viewport() ) ), 650 d->mTip = ( new CardViewTip( viewport() ) ),
650 d->mTip->hide(); 651 d->mTip->hide();
651 d->mTimer = ( new QTimer(this, "mouseTimer") ), 652 d->mTimer = ( new QTimer(this, "mouseTimer") ),
652 653
653 viewport()->setMouseTracking( true ); 654 viewport()->setMouseTracking( true );
654 viewport()->setFocusProxy(this); 655 viewport()->setFocusProxy(this);
655 viewport()->setFocusPolicy(WheelFocus); 656 viewport()->setFocusPolicy(WheelFocus);
656 viewport()->setBackgroundMode(PaletteBase); 657 viewport()->setBackgroundMode(PaletteBase);
657 658
658 connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) ); 659 connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) );
659 connect( this, SIGNAL(executed(CardViewItem *)), this, SIGNAL( doubleClicked(CardViewItem *)) );
660 660
661//US setBackgroundMode(PaletteBackground, PaletteBase); 661//US setBackgroundMode(PaletteBackground, PaletteBase);
662 setBackgroundMode(PaletteBackground); 662 setBackgroundMode(PaletteBackground);
663 663
664 // no reason for a vertical scrollbar 664 // no reason for a vertical scrollbar
665 setVScrollBarMode(AlwaysOff); 665 setVScrollBarMode(AlwaysOff);
666} 666}
667 667
668CardView::~CardView() 668CardView::~CardView()
669{ 669{
670 delete d->mFm; 670 delete d->mFm;
671 delete d->mBFm; 671 delete d->mBFm;
@@ -1238,42 +1238,42 @@ void CardView::contentsMouseReleaseEvent(QMouseEvent *e)
1238 d->mResizeAnchor = 0; 1238 d->mResizeAnchor = 0;
1239 d->mRubberBandAnchor = 0; 1239 d->mRubberBandAnchor = 0;
1240 return; 1240 return;
1241 } 1241 }
1242 1242
1243 // If there are accel keys, we will not emit signals 1243 // If there are accel keys, we will not emit signals
1244 if ((e->state() & Qt::ShiftButton) || (e->state() & Qt::ControlButton)) 1244 if ((e->state() & Qt::ShiftButton) || (e->state() & Qt::ControlButton))
1245 return; 1245 return;
1246 1246
1247 // Get the item at this position 1247 // Get the item at this position
1248 CardViewItem *item = itemAt(e->pos()); 1248 CardViewItem *item = itemAt(e->pos());
1249 1249
1250 if (item && KGlobalSettings::singleClick()) 1250 if (item && KABPrefs::instance()->mHonorSingleClick)
1251 { 1251 {
1252 emit executed(item); 1252 emit executed(item);
1253 } 1253 }
1254} 1254}
1255 1255
1256void CardView::contentsMouseDoubleClickEvent(QMouseEvent *e) 1256void CardView::contentsMouseDoubleClickEvent(QMouseEvent *e)
1257{ 1257{
1258 QScrollView::contentsMouseDoubleClickEvent(e); 1258 QScrollView::contentsMouseDoubleClickEvent(e);
1259 1259
1260 CardViewItem *item = itemAt(e->pos()); 1260 CardViewItem *item = itemAt(e->pos());
1261 1261
1262 if (item) 1262 if (item)
1263 { 1263 {
1264 d->mCurrentItem = item; 1264 d->mCurrentItem = item;
1265 } 1265 }
1266 1266
1267 if (item && !KGlobalSettings::singleClick()) 1267 if (item && !KABPrefs::instance()->mHonorSingleClick)
1268 { 1268 {
1269 emit executed(item); 1269 emit executed(item);
1270 } else 1270 } else
1271 emit doubleClicked(item); 1271 emit doubleClicked(item);
1272} 1272}
1273 1273
1274void CardView::contentsMouseMoveEvent( QMouseEvent *e ) 1274void CardView::contentsMouseMoveEvent( QMouseEvent *e )
1275{ 1275{
1276 // resizing 1276 // resizing
1277 if ( d->mResizeAnchor ) 1277 if ( d->mResizeAnchor )
1278 { 1278 {
1279 int x = e->x(); 1279 int x = e->x();
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index 7f33bb4..15f154e 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -233,34 +233,39 @@ void KAddressBookCardView::readConfig(KConfig *config)
233 mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators", 233 mCardView->setDrawColSeparators(config->readBoolEntry("DrawSeparators",
234 true)); 234 true));
235 mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false)); 235 mCardView->setDrawFieldLabels(config->readBoolEntry("DrawFieldLabels",false));
236 mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false); 236 mShowEmptyFields = config->readBoolEntry("ShowEmptyFields", false);
237 237
238 mCardView->setShowEmptyFields( mShowEmptyFields ); 238 mCardView->setShowEmptyFields( mShowEmptyFields );
239 239
240 mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) ); 240 mCardView->setItemWidth( config->readNumEntry( "ItemWidth", 200 ) );
241 mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) ); 241 mCardView->setItemMargin( config->readNumEntry( "ItemMargin", 0 ) );
242 mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) ); 242 mCardView->setItemSpacing( config->readNumEntry( "ItemSpacing", 10 ) );
243 mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) ); 243 mCardView->setSeparatorWidth( config->readNumEntry( "SeparatorWidth", 2 ) );
244 244
245#if 0
246 // LR KABPrefs::instance()->mHonorSingleClick is handled and fixed in cardviews contentsMouseDoubleClickEven
245 disconnect(mCardView, SIGNAL(executed(CardViewItem *)), 247 disconnect(mCardView, SIGNAL(executed(CardViewItem *)),
246 this, SLOT(addresseeExecuted(CardViewItem *))); 248 this, SLOT(addresseeExecuted(CardViewItem *)));
247 249
248 if (KABPrefs::instance()->mHonorSingleClick) 250 if (KABPrefs::instance()->mHonorSingleClick)
249 connect(mCardView, SIGNAL(executed(CardViewItem *)), 251 connect(mCardView, SIGNAL(executed(CardViewItem *)),
250 this, SLOT(addresseeExecuted(CardViewItem *))); 252 this, SLOT(addresseeExecuted(CardViewItem *)));
251 else 253 else
252 connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)), 254 connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)),
253 this, SLOT(addresseeExecuted(CardViewItem *))); 255 this, SLOT(addresseeExecuted(CardViewItem *)));
256#endif
254 257
258 connect(mCardView, SIGNAL(doubleClicked(CardViewItem *)),
259 this, SLOT(addresseeExecuted(CardViewItem *)));
255} 260}
256 261
257void KAddressBookCardView::writeConfig( KConfig *config ) 262void KAddressBookCardView::writeConfig( KConfig *config )
258{ 263{
259 config->writeEntry( "ItemWidth", mCardView->itemWidth() ); 264 config->writeEntry( "ItemWidth", mCardView->itemWidth() );
260 KAddressBookView::writeConfig( config ); 265 KAddressBookView::writeConfig( config );
261} 266}
262void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) 267void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field )
263{ 268{
264 mCardView->clear(); 269 mCardView->clear();
265 if ( s.isEmpty() || s == "*" ) { 270 if ( s.isEmpty() || s == "*" ) {
266 refresh(); 271 refresh();