diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:53:50 +0000 |
commit | 7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch) | |
tree | 8474f9b444b2756228600050f07a7ff25de532b2 /kaddressbook/jumpbuttonbar.cpp | |
parent | f587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff) | |
download | tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kaddressbook/jumpbuttonbar.cpp')
-rw-r--r-- | kaddressbook/jumpbuttonbar.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/kaddressbook/jumpbuttonbar.cpp b/kaddressbook/jumpbuttonbar.cpp index 1c8eddbad..baa84ce23 100644 --- a/kaddressbook/jumpbuttonbar.cpp +++ b/kaddressbook/jumpbuttonbar.cpp @@ -21,13 +21,13 @@ without including the source code for Qt in the source distribution. */ -#include <qapplication.h> -#include <qbuttongroup.h> -#include <qevent.h> -#include <qlayout.h> -#include <qpushbutton.h> -#include <qstring.h> -#include <qstyle.h> +#include <tqapplication.h> +#include <tqbuttongroup.h> +#include <tqevent.h> +#include <tqlayout.h> +#include <tqpushbutton.h> +#include <tqstring.h> +#include <tqstyle.h> #include <kabc/addressbook.h> #include <kabc/field.h> @@ -42,41 +42,41 @@ class JumpButton : public QPushButton { public: - JumpButton( const QString &firstChar, const QString &lastChar, - QWidget *parent ); + JumpButton( const TQString &firstChar, const TQString &lastChar, + TQWidget *parent ); - QString firstChar() const { return mChar; } + TQString firstChar() const { return mChar; } private: - QString mChar; + TQString mChar; }; -JumpButton::JumpButton( const QString &firstChar, const QString &lastChar, - QWidget *parent ) - : QPushButton( "", parent ), mChar( firstChar ) +JumpButton::JumpButton( const TQString &firstChar, const TQString &lastChar, + TQWidget *parent ) + : TQPushButton( "", parent ), mChar( firstChar ) { setToggleButton( true ); if ( !lastChar.isEmpty() ) - setText( QString( "%1 - %2" ).arg( firstChar.upper() ).arg( lastChar.upper() ) ); + setText( TQString( "%1 - %2" ).arg( firstChar.upper() ).arg( lastChar.upper() ) ); else setText( firstChar.upper() ); } -JumpButtonBar::JumpButtonBar( KAB::Core *core, QWidget *parent, const char *name ) - : QWidget( parent, name ), mCore( core ) +JumpButtonBar::JumpButtonBar( KAB::Core *core, TQWidget *parent, const char *name ) + : TQWidget( parent, name ), mCore( core ) { setMinimumSize( 1, 1 ); - QVBoxLayout *layout = new QVBoxLayout( this, 0, 0 ); + TQVBoxLayout *layout = new TQVBoxLayout( this, 0, 0 ); layout->setAlignment( Qt::AlignTop ); layout->setAutoAdd( true ); - layout->setResizeMode( QLayout::FreeResize ); + layout->setResizeMode( TQLayout::FreeResize ); - mGroupBox = new QButtonGroup( 1, Qt::Horizontal, this ); + mGroupBox = new TQButtonGroup( 1, Qt::Horizontal, this ); mGroupBox->setExclusive( true ); mGroupBox->layout()->setSpacing( 0 ); mGroupBox->layout()->setMargin( 0 ); - mGroupBox->setFrameStyle( QFrame::NoFrame ); + mGroupBox->setFrameStyle( TQFrame::NoFrame ); } JumpButtonBar::~JumpButtonBar() @@ -92,21 +92,21 @@ void JumpButtonBar::updateButtons() mButtons.clear(); mButtons.setAutoDelete( false ); - QStringList characters; + TQStringList characters; // calculate how many buttons are possible - QFontMetrics fm = fontMetrics(); - QPushButton *btn = new QPushButton( "", this ); + TQFontMetrics fm = fontMetrics(); + TQPushButton *btn = new TQPushButton( "", this ); btn->hide(); - QSize buttonSize = style().sizeFromContents( QStyle::CT_PushButton, btn, + TQSize buttonSize = style().sizeFromContents( TQStyle::CT_PushButton, btn, fm.size( ShowPrefix, "X - X") ). - expandedTo( QApplication::globalStrut() ); + expandedTo( TQApplication::globalStrut() ); delete btn; int buttonHeight = buttonSize.height() + 8; uint possibleButtons = (height() / buttonHeight) - 1; - QString character; + TQString character; KABC::AddressBook *ab = mCore->addressBook(); KABC::AddressBook::Iterator it; for ( it = ab->begin(); it != ab->end(); ++it ) { @@ -130,9 +130,9 @@ void JumpButtonBar::updateButtons() if ( characters.count() <= possibleButtons ) { // at first the easy case: all buttons fits in window for ( uint i = 0; i < characters.count(); ++i ) { - JumpButton *button = new JumpButton( characters[ i ], QString::null, + JumpButton *button = new JumpButton( characters[ i ], TQString::null, mGroupBox ); - connect( button, SIGNAL( clicked() ), this, SLOT( letterClicked() ) ); + connect( button, TQT_SIGNAL( clicked() ), this, TQT_SLOT( letterClicked() ) ); mButtons.append( button ); button->show(); } @@ -150,20 +150,20 @@ void JumpButtonBar::updateButtons() continue; if ( characters.count() - current <= possibleButtons - i ) { JumpButton *button = new JumpButton( characters[ current ], - QString::null, mGroupBox ); - connect( button, SIGNAL( clicked() ), this, SLOT( letterClicked() ) ); + TQString::null, mGroupBox ); + connect( button, TQT_SIGNAL( clicked() ), this, TQT_SLOT( letterClicked() ) ); mButtons.append( button ); button->show(); current++; } else { int pos = ( current + offset >= (int)characters.count() ? characters.count() - 1 : current + offset - 1 ); - QString range; + TQString range; for ( int j = current; j < pos + 1; ++j ) range.append( characters[ j ] ); JumpButton *button = new JumpButton( characters[ current ], characters[ pos ], mGroupBox ); - connect( button, SIGNAL( clicked() ), this, SLOT( letterClicked() ) ); + connect( button, TQT_SIGNAL( clicked() ), this, TQT_SLOT( letterClicked() ) ); mButtons.append( button ); button->show(); current = ( i + 1 ) * offset; @@ -177,7 +177,7 @@ void JumpButtonBar::updateButtons() mGroupBox->setButton( 0 ); int maxWidth = 0; - QPushButton *button; + TQPushButton *button; for ( button = mButtons.first(); button; button = mButtons.next() ) maxWidth = QMAX( maxWidth, button->sizeHint().width() ); @@ -187,12 +187,12 @@ void JumpButtonBar::updateButtons() void JumpButtonBar::letterClicked() { JumpButton *button = (JumpButton*)sender(); - QString character = button->firstChar(); + TQString character = button->firstChar(); emit jumpToLetter( character ); } -void JumpButtonBar::resizeEvent( QResizeEvent* ) +void JumpButtonBar::resizeEvent( TQResizeEvent* ) { updateButtons(); } @@ -201,37 +201,37 @@ class SortContainer { public: SortContainer() {} - SortContainer( const QString &string ) + SortContainer( const TQString &string ) : mString( string ) { } bool operator< ( const SortContainer &cnt ) { - return ( QString::localeAwareCompare( mString, cnt.mString ) < 0 ); + return ( TQString::localeAwareCompare( mString, cnt.mString ) < 0 ); } - QString data() const + TQString data() const { return mString; } private: - QString mString; + TQString mString; }; -void JumpButtonBar::sortListLocaleAware( QStringList &list ) +void JumpButtonBar::sortListLocaleAware( TQStringList &list ) { - QValueList<SortContainer> sortList; + TQValueList<SortContainer> sortList; - QStringList::ConstIterator it; + TQStringList::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) sortList.append( SortContainer( *it ) ); qHeapSort( sortList ); list.clear(); - QValueList<SortContainer>::ConstIterator sortIt; + TQValueList<SortContainer>::ConstIterator sortIt; for ( sortIt = sortList.begin(); sortIt != sortList.end(); ++sortIt ) list.append( (*sortIt).data() ); } |