author | zautrix <zautrix> | 2004-10-29 10:53:31 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-29 10:53:31 (UTC) |
commit | 67146a3d92727f6fe3e92eacdb51da58bc7b0adf (patch) (side-by-side diff) | |
tree | 140ab8d70bab73ca75aae64c4d2fdfccd73b388a /kaddressbook/views/cardview.cpp | |
parent | d96b4fd7188145c49120dd159b0ac00c987f4972 (diff) | |
download | kdepimpi-67146a3d92727f6fe3e92eacdb51da58bc7b0adf.zip kdepimpi-67146a3d92727f6fe3e92eacdb51da58bc7b0adf.tar.gz kdepimpi-67146a3d92727f6fe3e92eacdb51da58bc7b0adf.tar.bz2 |
fixed single click in cardview
Diffstat (limited to 'kaddressbook/views/cardview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/cardview.cpp | 6 |
1 files changed, 3 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 @@ -13,48 +13,49 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ //BEGIN Includes #include "cardview.h" #include <limits.h> #include <qpainter.h> #include <qtimer.h> #include <qdatetime.h> #include <qlabel.h> #include <qstyle.h> #include <qcursor.h> #include <qtooltip.h> +#include "kabprefs.h" #include <kdebug.h> #include <kglobalsettings.h> //END includes #define MIN_ITEM_WIDTH 80 //BEGIN Helpers ////////////////////////////////////// // CardViewTip class CardViewTip : public QLabel { public: CardViewTip(QWidget *parent=0, const char *name=0) : QLabel( parent, name ) { setPalette( QToolTip::palette() ); setFrameStyle( Panel|Plain ); setMidLineWidth(0); setIndent(1); } ~CardViewTip() {}; protected: void leaveEvent( QEvent * ) { hide(); @@ -635,49 +636,48 @@ CardViewItem::Field *CardViewItem::fieldAt( const QPoint & itempos ) const //BEGIN CardView CardView::CardView(QWidget *parent, const char *name) : QScrollView(parent, name), d(new CardViewPrivate()) { d->mItemList.setAutoDelete(true); d->mSeparatorList.setAutoDelete(true); QFont f = font(); d->mFm = new QFontMetrics(f); f.setBold(true); d->mHeaderFont = f; d->mBFm = new QFontMetrics(f); d->mTip = ( new CardViewTip( viewport() ) ), d->mTip->hide(); d->mTimer = ( new QTimer(this, "mouseTimer") ), viewport()->setMouseTracking( true ); viewport()->setFocusProxy(this); viewport()->setFocusPolicy(WheelFocus); viewport()->setBackgroundMode(PaletteBase); connect( d->mTimer, SIGNAL(timeout()), this, SLOT(tryShowFullText()) ); - connect( this, SIGNAL(executed(CardViewItem *)), this, SIGNAL( doubleClicked(CardViewItem *)) ); //US setBackgroundMode(PaletteBackground, PaletteBase); setBackgroundMode(PaletteBackground); // no reason for a vertical scrollbar setVScrollBarMode(AlwaysOff); } CardView::~CardView() { delete d->mFm; delete d->mBFm; delete d; d = 0; } void CardView::insertItem(CardViewItem *item) { d->mItemList.inSort(item); setLayoutDirty(true); } void CardView::takeItem(CardViewItem *item) { @@ -1226,66 +1226,66 @@ void CardView::contentsMouseReleaseEvent(QMouseEvent *e) // hide rubber bands int newiw = d->mItemWidth - ((d->mResizeAnchor - d->mRubberBandAnchor)/d->span); drawRubberBands( 0 ); // we should move to reflect the new position if we are scrolled. if ( contentsX() ) { int newX = QMAX( 0, ( d->pressed * ( newiw + d->colspace + d->mSepWidth ) ) - e->x() ); setContentsPos( newX, contentsY() ); } // set new item width setItemWidth( newiw ); // reset anchors d->mResizeAnchor = 0; d->mRubberBandAnchor = 0; return; } // If there are accel keys, we will not emit signals if ((e->state() & Qt::ShiftButton) || (e->state() & Qt::ControlButton)) return; // Get the item at this position CardViewItem *item = itemAt(e->pos()); - if (item && KGlobalSettings::singleClick()) + if (item && KABPrefs::instance()->mHonorSingleClick) { emit executed(item); } } void CardView::contentsMouseDoubleClickEvent(QMouseEvent *e) { QScrollView::contentsMouseDoubleClickEvent(e); CardViewItem *item = itemAt(e->pos()); if (item) { d->mCurrentItem = item; } - if (item && !KGlobalSettings::singleClick()) + if (item && !KABPrefs::instance()->mHonorSingleClick) { emit executed(item); } else emit doubleClicked(item); } void CardView::contentsMouseMoveEvent( QMouseEvent *e ) { // resizing if ( d->mResizeAnchor ) { int x = e->x(); if ( x != d->mRubberBandAnchor ) drawRubberBands( x ); return; } if (d->mLastClickOnItem && (e->state() & Qt::LeftButton) && ((e->pos() - d->mLastClickPos).manhattanLength() > 4)) { startDrag(); return; } |