diff options
Diffstat (limited to 'koshell/iconsidepane.cpp')
-rw-r--r-- | koshell/iconsidepane.cpp | 170 |
1 files changed, 85 insertions, 85 deletions
diff --git a/koshell/iconsidepane.cpp b/koshell/iconsidepane.cpp index 8698f9a03..83e8d18d8 100644 --- a/koshell/iconsidepane.cpp +++ b/koshell/iconsidepane.cpp @@ -20,18 +20,18 @@ * Boston, MA 02110-1301, USA. */ -#include <qbitmap.h> -#include <qcursor.h> -#include <qdrawutil.h> -#include <qfontmetrics.h> -#include <qframe.h> -#include <qlabel.h> -#include <qobjectlist.h> -#include <qpainter.h> -#include <qptrlist.h> -#include <qstyle.h> -#include <qtooltip.h> -#include <qwidgetstack.h> +#include <tqbitmap.h> +#include <tqcursor.h> +#include <tqdrawutil.h> +#include <tqfontmetrics.h> +#include <tqframe.h> +#include <tqlabel.h> +#include <tqobjectlist.h> +#include <tqpainter.h> +#include <tqptrlist.h> +#include <tqstyle.h> +#include <tqtooltip.h> +#include <tqwidgetstack.h> #include <kapplication.h> @@ -44,8 +44,8 @@ #include "iconsidepane.h" -EntryItem::EntryItem( Navigator *parent, int _id, const QString &_text, const QString & _pix ) - : QListBoxItem( parent ), +EntryItem::EntryItem( Navigator *tqparent, int _id, const TQString &_text, const TQString & _pix ) + : TQListBoxItem( tqparent ), mPixmapName(_pix), mId(_id), mHasHover( false ), @@ -60,7 +60,7 @@ EntryItem::~EntryItem() { } -void EntryItem::setNewText(const QString &_text) +void EntryItem::setNewText(const TQString &_text) { setText( _text ); } @@ -71,7 +71,7 @@ void EntryItem::reloadPixmap() if ( size != 0 ) mPixmap = KGlobal::iconLoader()->loadIcon( mPixmapName, KIcon::Desktop, size ); else - mPixmap = QPixmap(); + mPixmap = TQPixmap(); } Navigator* EntryItem::navigator() const @@ -79,7 +79,7 @@ Navigator* EntryItem::navigator() const return static_cast<Navigator*>( listBox() ); } -int EntryItem::width( const QListBox *listbox ) const +int EntryItem::width( const TQListBox *listbox ) const { int w = 0; if( navigator()->showIcons() ) { @@ -91,30 +91,30 @@ int EntryItem::width( const QListBox *listbox ) const if ( navigator()->viewMode() == SmallIcons ) w += listbox->fontMetrics().width( text() ); else - w = QMAX( w, listbox->fontMetrics().width( text() ) ); + w = TQMAX( w, listbox->fontMetrics().width( text() ) ); } return w + ( KDialog::marginHint() * 2 ); } -int EntryItem::height( const QListBox *listbox ) const +int EntryItem::height( const TQListBox *listbox ) const { int h = 0; if ( navigator()->showIcons() ) h = (int)navigator()->viewMode() + 4; if ( navigator()->showText() ) { if ( navigator()->viewMode() == SmallIcons || !navigator()->showIcons() ) - h = QMAX( h, listbox->fontMetrics().lineSpacing() ) + KDialog::spacingHint() * 2; + h = TQMAX( h, listbox->fontMetrics().lineSpacing() ) + KDialog::spacingHint() * 2; else h = (int)navigator()->viewMode() + listbox->fontMetrics().lineSpacing() + 4; } return h; } -void EntryItem::paint( QPainter *p ) +void EntryItem::paint( TQPainter *p ) { reloadPixmap(); - QListBox *box = listBox(); + TQListBox *box = listBox(); bool iconAboveText = ( navigator()->viewMode() > SmallIcons ) && navigator()->showIcons(); int w = box->viewport()->width(); @@ -124,15 +124,15 @@ void EntryItem::paint( QPainter *p ) if ( isCurrent() || isSelected() || mHasHover || mPaintActive ) { int h = height( box ); - QBrush brush; + TQBrush brush; if ( isCurrent() || isSelected() || mPaintActive ) - brush = box->colorGroup().brush( QColorGroup::Highlight ); + brush = box->tqcolorGroup().brush( TQColorGroup::Highlight ); else - brush = box->colorGroup().highlight().light( 115 ); + brush = TQBrush(box->tqcolorGroup().highlight().light( 115 )); p->fillRect( 1, 0, w - 2, h - 1, brush ); - QPen pen = p->pen(); - QPen oldPen = pen; - pen.setColor( box->colorGroup().mid() ); + TQPen pen = p->pen(); + TQPen oldPen = pen; + pen.setColor( box->tqcolorGroup().mid() ); p->setPen( pen ); p->drawPoint( 1, 0 ); @@ -149,13 +149,13 @@ void EntryItem::paint( QPainter *p ) p->drawPixmap( x, y, mPixmap ); } - QColor shadowColor = listBox()->colorGroup().background().dark(115); + TQColor shadowColor = listBox()->tqcolorGroup().background().dark(115); if ( isCurrent() || isSelected() ) { - p->setPen( box->colorGroup().highlightedText() ); + p->setPen( box->tqcolorGroup().highlightedText() ); } if ( !text().isEmpty() && navigator()->showText() ) { - QFontMetrics fm = p->fontMetrics(); + TQFontMetrics fm = p->fontMetrics(); int x = 0; if ( iconAboveText ) { @@ -176,13 +176,13 @@ void EntryItem::paint( QPainter *p ) } if ( isCurrent() || isSelected() || mHasHover ) { - p->setPen( box->colorGroup().highlight().dark(115) ); - p->drawText( x + ( QApplication::reverseLayout() ? -1 : 1), + p->setPen( box->tqcolorGroup().highlight().dark(115) ); + p->drawText( x + ( TQApplication::reverseLayout() ? -1 : 1), y + 1, text() ); - p->setPen( box->colorGroup().highlightedText() ); + p->setPen( box->tqcolorGroup().highlightedText() ); } else - p->setPen( box->colorGroup().text() ); + p->setPen( box->tqcolorGroup().text() ); p->drawText( x, y, text() ); } @@ -203,28 +203,28 @@ void EntryItem::setPaintActive( bool paintActive ) // ************************************************ -Navigator::Navigator(bool _selectable, KPopupMenu * menu, IconSidePane *_iconsidepane, QWidget *parent, const char *name ) - : KListBox( parent, name ), mSidePane( _iconsidepane ), mPopupMenu( menu ) +Navigator::Navigator(bool _selectable, KPopupMenu * menu, IconSidePane *_iconsidepane, TQWidget *tqparent, const char *name ) + : KListBox( tqparent, name ), mSidePane( _iconsidepane ), mPopupMenu( menu ) { setSelectionMode( KListBox::Single ); viewport()->setBackgroundMode( PaletteBackground ); - setFrameStyle( QFrame::NoFrame ); - setHScrollBarMode( QScrollView::AlwaysOff ); + setFrameStyle( TQFrame::NoFrame ); + setHScrollBarMode( TQScrollView::AlwaysOff ); //setAcceptDrops( true ); mMinWidth = 0; mSelectable = _selectable; executedItem = 0; mMouseOn = 0; - setFocusPolicy( NoFocus ); + setFocusPolicy( TQ_NoFocus ); - connect( this, SIGNAL( clicked( QListBoxItem* ) ), - SLOT( slotExecuted( QListBoxItem* ) ) ); - connect( this, SIGNAL( onItem( QListBoxItem * ) ), - SLOT( slotMouseOn( QListBoxItem * ) ) ); - connect( this, SIGNAL( onViewport() ), SLOT( slotMouseOff() ) ); + connect( this, TQT_SIGNAL( clicked( TQListBoxItem* ) ), + TQT_SLOT( slotExecuted( TQListBoxItem* ) ) ); + connect( this, TQT_SIGNAL( onItem( TQListBoxItem * ) ), + TQT_SLOT( slotMouseOn( TQListBoxItem * ) ) ); + connect( this, TQT_SIGNAL( onViewport() ), TQT_SLOT( slotMouseOff() ) ); - QToolTip::remove( this ); + TQToolTip::remove( this ); if ( !mSidePane->showText() ) new EntryItemToolTip( this ); } @@ -244,10 +244,10 @@ bool Navigator::showIcons() return mSidePane->showIcons(); } -void Navigator::mouseReleaseEvent(QMouseEvent *e) +void Navigator::mouseReleaseEvent(TQMouseEvent *e) { KListBox::mouseReleaseEvent(e); - if ( e->button() != LeftButton || !mLeftMouseButtonPressed ) + if ( e->button() != Qt::LeftButton || !mLeftMouseButtonPressed ) return; if ( itemAt( e->pos() ) && executedItem == selectedItem() ) emit itemSelected( currentItem() ); @@ -255,12 +255,12 @@ void Navigator::mouseReleaseEvent(QMouseEvent *e) clearSelection(); } -void Navigator::mousePressEvent(QMouseEvent *e) +void Navigator::mousePressEvent(TQMouseEvent *e) { - if ( e->button() != LeftButton || itemAt( e->pos() ) == 0 ) + if ( e->button() != Qt::LeftButton || itemAt( e->pos() ) == 0 ) { mLeftMouseButtonPressed = false; - if (e->button() == RightButton) + if (e->button() == Qt::RightButton) slotShowRMBMenu( 0,mapToGlobal( e->pos() ) ); return; } @@ -269,23 +269,23 @@ void Navigator::mousePressEvent(QMouseEvent *e) KListBox::mousePressEvent(e); } -void Navigator::enterEvent( QEvent *event ) +void Navigator::enterEvent( TQEvent *event ) { - // work around Qt behaviour: onItem is not emmitted in enterEvent() + // work around TQt behaviour: onItem is not emmitted in enterEvent() KListBox::enterEvent( event ); - emit onItem( itemAt( mapFromGlobal( QCursor::pos() ) ) ); + emit onItem( itemAt( mapFromGlobal( TQCursor::pos() ) ) ); } -void Navigator::slotExecuted( QListBoxItem *item ) +void Navigator::slotExecuted( TQListBoxItem *item ) { if ( !item ) return; executedItem = item; } -QSize Navigator::sizeHint() const +TQSize Navigator::tqsizeHint() const { - return QSize( mMinWidth, 100 ); + return TQSize( mMinWidth, 100 ); } void Navigator::calculateMinWidth() @@ -298,37 +298,37 @@ void Navigator::calculateMinWidth() mMinWidth = item->width( this ); } //kdDebug() << "minWidth:" << mMinWidth << endl; - parentWidget()->setFixedWidth( mMinWidth ); + tqparentWidget()->setFixedWidth( mMinWidth ); triggerUpdate(true); } -int Navigator::insertItem(const QString &_text, const QString & _pix) +int Navigator::insertItem(const TQString &_text, const TQString & _pix) { EntryItem *item = new EntryItem( this, count(), _text, _pix ); if (item->width( this ) > mSidePane->minWidth() ) { mMinWidth = item->width( this ); - parentWidget()->setMinimumWidth( mMinWidth ); + tqparentWidget()->setMinimumWidth( mMinWidth ); //kdDebug() << "minWidth:" << mMinWidth << endl; } return item->id(); } -void Navigator::setHoverItem( QListBoxItem* item, bool hover ) +void Navigator::setHoverItem( TQListBoxItem* item, bool hover ) { static_cast<EntryItem*>( item )->setHover( hover ); updateItem( item ); } -void Navigator::setPaintActiveItem( QListBoxItem* item, bool paintActive ) +void Navigator::setPaintActiveItem( TQListBoxItem* item, bool paintActive ) { static_cast<EntryItem*>( item )->setPaintActive( paintActive ); updateItem( item ); } -void Navigator::slotMouseOn( QListBoxItem* newItem ) +void Navigator::slotMouseOn( TQListBoxItem* newItem ) { - QListBoxItem* oldItem = mMouseOn; + TQListBoxItem* oldItem = mMouseOn; if ( oldItem == newItem ) return; @@ -345,13 +345,13 @@ void Navigator::slotMouseOff() slotMouseOn( 0 ); } -void Navigator::resizeEvent( QResizeEvent *event ) +void Navigator::resizeEvent( TQResizeEvent *event ) { - QListBox::resizeEvent( event ); + TQListBox::resizeEvent( event ); triggerUpdate( true ); } -void Navigator::slotShowRMBMenu( QListBoxItem *, const QPoint &pos ) +void Navigator::slotShowRMBMenu( TQListBoxItem *, const TQPoint &pos ) { int choice = mPopupMenu->exec( pos ); @@ -379,7 +379,7 @@ void Navigator::slotShowRMBMenu( QListBoxItem *, const QPoint &pos ) mPopupMenu->setItemEnabled( (int)LargeIcons, mSidePane->showIcons()); KoShellSettings::setSidePaneShowIcons( mSidePane->showIcons() ); - QToolTip::remove( this ); + TQToolTip::remove( this ); } else { mSidePane->toogleText(); mSidePane->resetWidth(); @@ -402,14 +402,14 @@ void Navigator::slotShowRMBMenu( QListBoxItem *, const QPoint &pos ) // ************************************************ -IconSidePane::IconSidePane(QWidget *parent, const char *name ) - : QVBox( parent, name ) +IconSidePane::IconSidePane(TQWidget *tqparent, const char *name ) + : TQVBox( tqparent, name ) { - m_buttongroup = new QButtonGroup(1, QGroupBox::Horizontal, this); + m_buttongroup = new TQButtonGroup(1, Qt::Horizontal, this); m_buttongroup->setExclusive(true); m_buttongroup->hide(); - mWidgetstack = new QWidgetStack(this); - mWidgetstack->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + mWidgetstack = new TQWidgetStack(this); + mWidgetstack->tqsetSizePolicy(TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding)); // setup the popup menu mShowIcons = KoShellSettings::sidePaneShowIcons(); @@ -439,17 +439,17 @@ IconSidePane::~IconSidePane() { } -int IconSidePane::insertItem(int _grp, const QString & _pix, const QString &_text) +int IconSidePane::insertItem(int _grp, const TQString & _pix, const TQString &_text) { return static_cast<Navigator*>( mWidgetstack->widget(_grp))->insertItem( _text, _pix ); } -int IconSidePane::insertItem(const QString & _pix, const QString &_text) +int IconSidePane::insertItem(const TQString & _pix, const TQString &_text) { return mCurrentNavigator->insertItem(_text, _pix); } -void IconSidePane::renameItem( int _grp, int _id, const QString & _text ) +void IconSidePane::renameItem( int _grp, int _id, const TQString & _text ) { Navigator *navigator = static_cast<Navigator*>(mWidgetstack->widget(_grp)); if (!navigator) @@ -482,20 +482,20 @@ void IconSidePane::removeItem( int _grp, int _id ) } } -int IconSidePane::insertGroup(const QString &_text, bool _selectable, QObject *_obj, const char *_slot) +int IconSidePane::insertGroup(const TQString &_text, bool _selectable, TQObject *_obj, const char *_slot) { mCurrentNavigator = new Navigator(_selectable, mPopupMenu, this, mWidgetstack ); - //connect( mCurrentNavigator, SIGNAL( itemSelected( int ) ), this, SLOT( itemSelected( int ) ) ); + //connect( mCurrentNavigator, TQT_SIGNAL( itemSelected( int ) ), this, TQT_SLOT( itemSelected( int ) ) ); if ( _obj != 0L && _slot != 0L ) - connect( mCurrentNavigator, SIGNAL( itemSelected(int ) ), _obj, _slot ); - connect( mCurrentNavigator, SIGNAL( updateAllWidgets() ), this, SLOT(updateAllWidgets()) ); + connect( mCurrentNavigator, TQT_SIGNAL( itemSelected(int ) ), _obj, _slot ); + connect( mCurrentNavigator, TQT_SIGNAL( updateAllWidgets() ), this, TQT_SLOT(updateAllWidgets()) ); int const id = mWidgetstack->addWidget(mCurrentNavigator); mWidgetStackIds.append( id ); KPushButton *b = new KPushButton( _text, m_buttongroup ); m_buttongroup->insert( b, id ); - connect( b, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); + connect( b, TQT_SIGNAL( clicked() ), this, TQT_SLOT( buttonClicked() ) ); b->setToggleButton( true ); - b->setFocusPolicy( NoFocus ); + b->setFocusPolicy( TQ_NoFocus ); if (m_buttongroup->count()==1) { mCurrentNavigator->calculateMinWidth(); @@ -529,7 +529,7 @@ Navigator * IconSidePane::group(int _grp) void IconSidePane::updateAllWidgets() { - QValueList<int>::iterator it; + TQValueList<int>::iterator it; for ( it = mWidgetStackIds.begin(); it != mWidgetStackIds.end(); ++it ) static_cast<Navigator*>(mWidgetstack->widget(*it))->triggerUpdate( true ); } @@ -537,7 +537,7 @@ void IconSidePane::updateAllWidgets() int IconSidePane::minWidth() { int width = 0; - QValueList<int>::iterator it; + TQValueList<int>::iterator it; Navigator *n; for ( it = mWidgetStackIds.begin(); it != mWidgetStackIds.end(); ++it ) { @@ -550,7 +550,7 @@ int IconSidePane::minWidth() void IconSidePane::resetWidth() { - QValueList<int>::iterator it; + TQValueList<int>::iterator it; Navigator *n; for ( it = mWidgetStackIds.begin(); it != mWidgetStackIds.end(); ++it ) { |