summaryrefslogtreecommitdiffstats
path: root/kaddressbook/views/cardview.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-13 00:46:47 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-04-13 00:46:47 +0000
commit67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7 (patch)
tree5f52a9eada2e9f3654fc327d7c14dfef570a6ecb /kaddressbook/views/cardview.cpp
parent2ee4bf4fd5eff93b2fbef0ff8e8063edffc5da5c (diff)
downloadtdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.tar.gz
tdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.zip
Initial conversion of kdepim to TQt
This will probably require some tweaking before it will build under Qt4, however Qt3 builds are OK. Any alterations this commit makes to kdepim behaviour under Qt3 are unintentional and should be fixed. git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1227832 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kaddressbook/views/cardview.cpp')
-rw-r--r--kaddressbook/views/cardview.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp
index 5c8ccf82..9149c653 100644
--- a/kaddressbook/views/cardview.cpp
+++ b/kaddressbook/views/cardview.cpp
@@ -17,8 +17,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
+ with any edition of TQt, and distribute the resulting executable,
+ without including the source code for TQt in the source distribution.
*/
@@ -39,11 +39,11 @@
#define MIN_ITEM_WIDTH 80
-class CardViewTip : public QLabel
+class CardViewTip : public TQLabel
{
public:
- CardViewTip( TQWidget *parent = 0, const char *name = 0 )
- : TQLabel( parent, name )
+ CardViewTip( TQWidget *tqparent = 0, const char *name = 0 )
+ : TQLabel( tqparent, name )
{
setPalette( TQToolTip::palette() );
setFrameStyle( Panel | Plain );
@@ -61,7 +61,7 @@ class CardViewTip : public QLabel
};
//
-// Warning: make sure you use findRef() instead of find() to find an
+// Warning: make sure you use findRef() instead of tqfind() to find an
// item! Only the pointer value is unique in the list.
//
class CardViewItemList : public TQPtrList<CardViewItem>
@@ -136,7 +136,7 @@ class CardViewPrivate
mCurrentItem( 0L ),
mLastClickPos( TQPoint(0, 0) ),
mRubberBandAnchor( 0 ),
- mCompText( TQString::null )
+ mCompText( TQString() )
{};
CardViewItemList mItemList;
@@ -192,8 +192,8 @@ class CardViewItemPrivate
};
-CardViewItem::CardViewItem( CardView *parent, const TQString &caption )
- : d( new CardViewItemPrivate() ), mView( parent )
+CardViewItem::CardViewItem( CardView *tqparent, const TQString &caption )
+ : d( new CardViewItemPrivate() ), mView( tqparent )
{
d->mCaption = caption;
@@ -238,7 +238,7 @@ void CardViewItem::paintCard( TQPainter *p, TQColorGroup &cg )
int h = height() - ( mg * 2 );
const int colonWidth( fm.width( ":" ) );
int labelXPos = 2 + mg;
- int labelWidth = QMIN( w / 2 - 4 - mg, d->maxLabelWidth + colonWidth + 4 );
+ int labelWidth = TQMIN( w / 2 - 4 - mg, d->maxLabelWidth + colonWidth + 4 );
int valueXPos = labelWidth + 4 + mg;
int valueWidth = w - labelWidth - 4 - mg;
@@ -355,7 +355,7 @@ int CardViewItem::height( bool allowCache ) const
for ( iter.toFirst(); iter.current(); ++iter ) {
if ( !sef && (*iter)->second.isEmpty() )
continue;
- lines = QMIN( (*iter)->second.tqcontains( '\n' ) + 1, maxLines );
+ lines = TQMIN( (*iter)->second.tqcontains( '\n' ) + 1, maxLines );
fieldHeight += ( lines * fh ) + 2;
}
@@ -383,7 +383,7 @@ void CardViewItem::insertField( const TQString &label, const TQString &value )
if ( mView ) {
mView->setLayoutDirty( true );
- d->maxLabelWidth = QMAX( mView->d->mFm->width( label ), d->maxLabelWidth );
+ d->maxLabelWidth = TQMAX( mView->d->mFm->width( label ), d->maxLabelWidth );
}
}
@@ -507,7 +507,7 @@ void CardViewItem::showFullString( const TQPoint &itempos, CardViewTip *tip )
Field *_f;
for ( _f = d->mFieldList.first(); _f != f; _f = d->mFieldList.next() )
if ( se || ! _f->second.isEmpty() )
- y += ( QMIN( _f->second.tqcontains( '\n' ) + 1, maxLines ) * fh ) + 2;
+ y += ( TQMIN( _f->second.tqcontains( '\n' ) + 1, maxLines ) * fh ) + 2;
if ( isLabel && itempos.y() > y + fh )
return;
@@ -515,13 +515,13 @@ void CardViewItem::showFullString( const TQPoint &itempos, CardViewTip *tip )
s = isLabel ? f->first : f->second;
int colonWidth = mView->d->mFm->width(":");
- lw = drawLabels ? QMIN( w / 2 - 4 - mrg, d->maxLabelWidth + colonWidth + 4 ) : 0;
+ lw = drawLabels ? TQMIN( w / 2 - 4 - mrg, d->maxLabelWidth + colonWidth + 4 ) : 0;
int mw = isLabel ? lw - colonWidth : w - lw - ( mrg * 2 );
if ( isLabel ) {
trimmed = mView->d->mFm->width( s ) > mw - colonWidth;
} else {
- TQRect r( mView->d->mFm->boundingRect( 0, 0, INT_MAX, INT_MAX, Qt::AlignTop|Qt::AlignLeft, s ) );
- trimmed = r.width() > mw || r.height() / fh > QMIN( s.tqcontains( '\n' ) + 1, maxLines );
+ TQRect r( mView->d->mFm->boundingRect( 0, 0, INT_MAX, INT_MAX, TQt::AlignTop|TQt::AlignLeft, s ) );
+ trimmed = r.width() > mw || r.height() / fh > TQMIN( s.tqcontains( '\n' ) + 1, maxLines );
}
}
@@ -539,7 +539,7 @@ void CardViewItem::showFullString( const TQPoint &itempos, CardViewTip *tip )
if ( pnt.x() + tip->width() > mView->visibleWidth() )
pnt.setX( mView->visibleWidth() - tip->width() );
if ( pnt.y() + tip->height() > mView->visibleHeight() )
- pnt.setY( QMAX( 0, mView->visibleHeight() - tip->height() ) );
+ pnt.setY( TQMAX( 0, mView->visibleHeight() - tip->height() ) );
// show
tip->move( pnt );
tip->show();
@@ -560,7 +560,7 @@ CardViewItem::Field *CardViewItem::fieldAt( const TQPoint & itempos ) const
Field *f;
for ( f = d->mFieldList.first(); f; f = d->mFieldList.next() ) {
if ( showEmpty || !f->second.isEmpty() )
- ypos += (QMIN( f->second.tqcontains( '\n' )+1, maxLines ) * fh) + 2;
+ ypos += (TQMIN( f->second.tqcontains( '\n' )+1, maxLines ) * fh) + 2;
if ( iy <= ypos )
break;
}
@@ -569,8 +569,8 @@ CardViewItem::Field *CardViewItem::fieldAt( const TQPoint & itempos ) const
}
-CardView::CardView( TQWidget *parent, const char *name )
- : TQScrollView( parent, name ),
+CardView::CardView( TQWidget *tqparent, const char *name )
+ : TQScrollView( tqparent, name ),
d( new CardViewPrivate() )
{
d->mItemList.setAutoDelete( true );
@@ -805,7 +805,7 @@ int CardView::childCount() const
}
CardViewItem *CardView::findItem( const TQString &text, const TQString &label,
- Qt::StringComparisonMode compare ) const
+ TQt::StringComparisonMode compare ) const
{
// If the text is empty, we will return null, since empty text will
// match anything!
@@ -813,7 +813,7 @@ CardViewItem *CardView::findItem( const TQString &text, const TQString &label,
return 0;
TQPtrListIterator<CardViewItem> iter( d->mItemList );
- if ( compare & Qt::BeginsWith ) {
+ if ( compare & TQt::BeginsWith ) {
TQString value;
for ( iter.toFirst(); iter.current(); ++iter ) {
value = (*iter)->fieldValue( label ).upper();
@@ -915,7 +915,7 @@ void CardView::calcLayout()
yPos += cardSpacing;
if ( yPos + item->height() + cardSpacing >= height() - horizontalScrollBar()->height() ) {
- maxHeight = QMAX( maxHeight, yPos );
+ maxHeight = TQMAX( maxHeight, yPos );
// Drawing in this column would be greater than the height
// of the scroll view, so move to next column
@@ -936,7 +936,7 @@ void CardView::calcLayout()
item->d->y = yPos;
yPos += item->height();
- maxWidth = QMAX( maxWidth, d->mItemWidth );
+ maxWidth = TQMAX( maxWidth, d->mItemWidth );
}
xPos += maxWidth;
@@ -1022,7 +1022,7 @@ void CardView::contentsMousePressEvent( TQMouseEvent *e )
emit clicked( item );
// The RMB click
- if ( e->button() & Qt::RightButton ) {
+ if ( e->button() & TQt::RightButton ) {
// clear previous selection
bool blocked = signalsBlocked();
blockSignals( true );
@@ -1056,7 +1056,7 @@ void CardView::contentsMousePressEvent( TQMouseEvent *e )
item->tqrepaintCard();
emit selectionChanged();
} else if ( d->mSelectionMode == CardView::Extended ) {
- if ( (e->button() & Qt::LeftButton) && (e->state() & Qt::ShiftButton) ) {
+ if ( (e->button() & TQt::LeftButton) && (e->state() & TQt::ShiftButton) ) {
if ( item == other )
return;
@@ -1083,11 +1083,11 @@ void CardView::contentsMousePressEvent( TQMouseEvent *e )
}
emit selectionChanged();
- } else if ( (e->button() & Qt::LeftButton) && (e->state() & Qt::ControlButton) ) {
+ } else if ( (e->button() & TQt::LeftButton) && (e->state() & TQt::ControlButton) ) {
item->setSelected( !item->isSelected() );
item->tqrepaintCard();
emit selectionChanged();
- } else if ( e->button() & Qt::LeftButton ) {
+ } else if ( e->button() & TQt::LeftButton ) {
bool b = signalsBlocked();
blockSignals( true );
selectAll( false );
@@ -1111,7 +1111,7 @@ void CardView::contentsMouseReleaseEvent( TQMouseEvent *e )
drawRubberBands( 0 );
// we should move to reflect the new position if we are scrolled.
if ( contentsX() ) {
- int newX = QMAX( 0, ( d->mPressed * ( newiw + d->mColspace + d->mSepWidth ) ) - e->x() );
+ int newX = TQMAX( 0, ( d->mPressed * ( newiw + d->mColspace + d->mSepWidth ) ) - e->x() );
setContentsPos( newX, contentsY() );
}
// set new item width
@@ -1123,7 +1123,7 @@ void CardView::contentsMouseReleaseEvent( TQMouseEvent *e )
}
// If there are accel keys, we will not emit signals
- if ( (e->state() & Qt::ShiftButton) || (e->state() & Qt::ControlButton) )
+ if ( (e->state() & TQt::ShiftButton) || (e->state() & TQt::ControlButton) )
return;
// Get the item at this position
@@ -1158,7 +1158,7 @@ void CardView::contentsMouseMoveEvent( TQMouseEvent *e )
return;
}
- if ( d->mLastClickOnItem && (e->state() & Qt::LeftButton) &&
+ if ( d->mLastClickOnItem && (e->state() & TQt::LeftButton) &&
((e->pos() - d->mLastClickPos).manhattanLength() > 4)) {
startDrag();
@@ -1283,7 +1283,7 @@ void CardView::keyPressEvent( TQKeyEvent *e )
if ( contentsX() <= 0 )
return;
int cw = columnWidth();
- int theCol = ( QMAX( 0, ( contentsX() / cw) * cw ) ) + d->mItemSpacing;
+ int theCol = ( TQMAX( 0, ( contentsX() / cw) * cw ) ) + d->mItemSpacing;
aItem = itemAt( TQPoint( theCol + 1, d->mItemSpacing + 1 ) );
if ( aItem )
setCurrentItem( aItem );