diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /koshell | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'koshell')
-rw-r--r-- | koshell/Makefile.am | 2 | ||||
-rw-r--r-- | koshell/iconsidepane.cpp | 170 | ||||
-rw-r--r-- | koshell/iconsidepane.h | 102 | ||||
-rw-r--r-- | koshell/koshell_shell.cc | 128 | ||||
-rw-r--r-- | koshell/koshell_shell.h | 41 |
5 files changed, 223 insertions, 220 deletions
diff --git a/koshell/Makefile.am b/koshell/Makefile.am index e6dceac41..56d71a31d 100644 --- a/koshell/Makefile.am +++ b/koshell/Makefile.am @@ -6,7 +6,7 @@ lib_LTLIBRARIES = kdeinit_LTLIBRARIES = koshell.la bin_PROGRAMS = koshell_la_SOURCES = koshell_main.cc koshell_shell.cc iconsidepane.cpp koshellsettings.kcfgc -koshell_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) +koshell_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(LIB_QT) koshell_la_LIBADD = $(LIB_KOFFICEUI) kde_kcfg_DATA = koshell.kcfg 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 ) { diff --git a/koshell/iconsidepane.h b/koshell/iconsidepane.h index 2382547ae..3838967ab 100644 --- a/koshell/iconsidepane.h +++ b/koshell/iconsidepane.h @@ -25,11 +25,11 @@ #include <kactioncollection.h> #include <klistbox.h> -#include <qbuttongroup.h> -#include <qlayout.h> -#include <qtooltip.h> -#include <qvbox.h> -#include <qwidgetstack.h> +#include <tqbuttongroup.h> +#include <tqlayout.h> +#include <tqtooltip.h> +#include <tqvbox.h> +#include <tqwidgetstack.h> #include "koshellsettings.h" @@ -40,21 +40,21 @@ class IconSidePane; enum IconViewMode { LargeIcons = 48, NormalIcons = 32, SmallIcons = 22, ShowText = 3, ShowIcons = 5 }; /** - A @see QListBoxPixmap Square Box with an optional icon and a text + A @see TQListBoxPixmap Square Box with an optional icon and a text underneath. */ -class EntryItem : public QListBoxItem +class EntryItem : public TQListBoxItem { public: - EntryItem( Navigator *, int _id, const QString &_text, const QString & _pix ); + EntryItem( Navigator *, int _id, const TQString &_text, const TQString & _pix ); ~EntryItem(); - const QPixmap *pixmap() const { return &mPixmap; } + const TQPixmap *pixmap() const { return &mPixmap; } int id() { return mId; } - void setNewText( const QString &_text ); + void setNewText( const TQString &_text ); void setHover( bool ); void setPaintActive( bool ); @@ -63,20 +63,20 @@ class EntryItem : public QListBoxItem /** returns the width of this item. */ - virtual int width( const QListBox * ) const; + virtual int width( const TQListBox * ) const; /** returns the height of this item. */ - virtual int height( const QListBox * ) const; + virtual int height( const TQListBox * ) const; protected: void reloadPixmap(); - virtual void paint( QPainter *p ); + virtual void paint( TQPainter *p ); private: - QPixmap mPixmap; - QString mPixmapName; + TQPixmap mPixmap; + TQString mPixmapName; int const mId; Navigator* navigator() const; bool mHasHover; @@ -85,30 +85,30 @@ class EntryItem : public QListBoxItem /** * Tooltip that changes text depending on the item it is above. - * Compliments of "Practical Qt" by Dalheimer, Petersen et al. + * Compliments of "Practical TQt" by Dalheimer, Petersen et al. */ -class EntryItemToolTip : public QToolTip +class EntryItemToolTip : public TQToolTip { public: - EntryItemToolTip( QListBox* parent ) - : QToolTip( parent->viewport() ), mListBox( parent ) + EntryItemToolTip( TQListBox* tqparent ) + : TQToolTip( tqparent->viewport() ), mListBox( tqparent ) {} protected: - void maybeTip( const QPoint& p ) { + void maybeTip( const TQPoint& p ) { // We only show tooltips when there are no texts shown if ( KoShellSettings::sidePaneShowText() ) return; if ( !mListBox ) return; - QListBoxItem* item = mListBox->itemAt( p ); + TQListBoxItem* item = mListBox->itemAt( p ); if ( !item ) return; - const QRect itemRect = mListBox->itemRect( item ); - if ( !itemRect.isValid() ) return; + const TQRect tqitemRect = mListBox->tqitemRect( item ); + if ( !tqitemRect.isValid() ) return; const EntryItem *entryItem = static_cast<EntryItem*>( item ); - QString tipStr = entryItem->text(); - tip( itemRect, tipStr ); + TQString tipStr = entryItem->text(); + tip( tqitemRect, tipStr ); } private: - QListBox* mListBox; + TQListBox* mListBox; }; /** @@ -117,12 +117,13 @@ class EntryItemToolTip : public QToolTip class Navigator : public KListBox { Q_OBJECT + TQ_OBJECT public: - Navigator(bool _selectable, KPopupMenu*, IconSidePane *, QWidget *parent = 0, const char *name = 0 ); + Navigator(bool _selectable, KPopupMenu*, IconSidePane *, TQWidget *tqparent = 0, const char *name = 0 ); - int insertItem(const QString &_text, const QString &_pix); + int insertItem(const TQString &_text, const TQString &_pix); - QSize sizeHint() const; + TQSize tqsizeHint() const; IconViewMode viewMode(); bool showText(); bool showIcons(); @@ -136,44 +137,45 @@ class Navigator : public KListBox void updateAllWidgets(); protected: - void resizeEvent( QResizeEvent * ); - void enterEvent( QEvent* ); - void mouseReleaseEvent(QMouseEvent *e); - void mousePressEvent(QMouseEvent *e); + void resizeEvent( TQResizeEvent * ); + void enterEvent( TQEvent* ); + void mouseReleaseEvent(TQMouseEvent *e); + void mousePressEvent(TQMouseEvent *e); - void setHoverItem( QListBoxItem*, bool ); - void setPaintActiveItem( QListBoxItem*, bool ); + void setHoverItem( TQListBoxItem*, bool ); + void setPaintActiveItem( TQListBoxItem*, bool ); protected slots: - void slotExecuted( QListBoxItem * ); - void slotMouseOn( QListBoxItem *item ); + void slotExecuted( TQListBoxItem * ); + void slotMouseOn( TQListBoxItem *item ); void slotMouseOff(); - void slotShowRMBMenu( QListBoxItem *, const QPoint& ); + void slotShowRMBMenu( TQListBoxItem *, const TQPoint& ); private: IconSidePane *mSidePane; int mMinWidth; - QListBoxItem *executedItem; + TQListBoxItem *executedItem; bool mLeftMouseButtonPressed; KPopupMenu *mPopupMenu; bool mSelectable; - QListBoxItem* mMouseOn; + TQListBoxItem* mMouseOn; }; -class IconSidePane :public QVBox +class IconSidePane :public TQVBox { Q_OBJECT + TQ_OBJECT public: - IconSidePane( QWidget *parent, const char *name = 0 ); + IconSidePane( TQWidget *tqparent, const char *name = 0 ); ~IconSidePane(); void setActionCollection( KActionCollection *actionCollection ); KActionCollection *actionCollection() const; - int insertItem(const QString & _pix, const QString &_text); - int insertItem(int _grp, const QString & _pix, const QString &_text); - int insertGroup(const QString &_text, bool _selectable, QObject *_obj = 0L, const char *_slot = 0L); - void renameItem( int _grp, int _id, const QString & _text ); + int insertItem(const TQString & _pix, const TQString &_text); + int insertItem(int _grp, const TQString & _pix, const TQString &_text); + int insertGroup(const TQString &_text, bool _selectable, TQObject *_obj = 0L, const char *_slot = 0L); + void renameItem( int _grp, int _id, const TQString & _text ); void removeItem( int _grp, int _id ); void selectGroup(int); Navigator *group(int); @@ -185,7 +187,7 @@ class IconSidePane :public QVBox void toogleText(){mShowText=!mShowText;} bool showIcons() { return mShowIcons; } void toogleIcons(){mShowIcons=!mShowIcons;} - QButtonGroup *buttonGroup() { return m_buttongroup; } + TQButtonGroup *buttonGroup() { return m_buttongroup; } int minWidth(); void resetWidth(); @@ -197,10 +199,10 @@ class IconSidePane :public QVBox void buttonClicked(); private: - QWidgetStack *mWidgetstack; - QValueList<int> mWidgetStackIds; + TQWidgetStack *mWidgetstack; + TQValueList<int> mWidgetStackIds; Navigator *mCurrentNavigator; - QButtonGroup *m_buttongroup; + TQButtonGroup *m_buttongroup; KActionCollection *mActionCollection; KPopupMenu *mPopupMenu; diff --git a/koshell/koshell_shell.cc b/koshell/koshell_shell.cc index 0160f1e19..079988a8a 100644 --- a/koshell/koshell_shell.cc +++ b/koshell/koshell_shell.cc @@ -20,11 +20,11 @@ * Boston, MA 02110-1301, USA. */ -#include <qcursor.h> -#include <qsplitter.h> -#include <qiconview.h> -#include <qlabel.h> -#include <qvbox.h> +#include <tqcursor.h> +#include <tqsplitter.h> +#include <tqiconview.h> +#include <tqlabel.h> +#include <tqvbox.h> #include <assert.h> @@ -62,34 +62,34 @@ KoShellWindow::KoShellWindow() { m_activePage = m_lstPages.end(); - m_pLayout = new QSplitter( centralWidget() ); + m_pLayout = new TQSplitter( centralWidget() ); // Setup the sidebar m_pSidebar = new IconSidePane( m_pLayout ); - m_pSidebar->setSizePolicy( QSizePolicy( QSizePolicy::Maximum, - QSizePolicy::Preferred ) ); + m_pSidebar->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Maximum, + TQSizePolicy::Preferred ) ); m_pSidebar->setActionCollection( actionCollection() ); - m_grpFile = m_pSidebar->insertGroup(i18n("Components"), false, this, SLOT( slotSidebar_Part(int ))); - m_grpDocuments = m_pSidebar->insertGroup(i18n("Documents"), true, this, SLOT(slotSidebar_Document(int))); - m_pLayout->setResizeMode(m_pSidebar,QSplitter::FollowSizeHint); + m_grpFile = m_pSidebar->insertGroup(i18n("Components"), false, TQT_TQOBJECT(this), TQT_SLOT( slotSidebar_Part(int ))); + m_grpDocuments = m_pSidebar->insertGroup(i18n("Documents"), true, TQT_TQOBJECT(this), TQT_SLOT(slotSidebar_Document(int))); + m_pLayout->setResizeMode(m_pSidebar,TQSplitter::FollowSizeHint); // Setup the tabbar m_pFrame = new KTabWidget( m_pLayout ); - m_pFrame->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, - QSizePolicy::Preferred ) ); + m_pFrame->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, + TQSizePolicy::Preferred ) ); m_pFrame->setTabPosition( KTabWidget::Bottom ); - m_tabCloseButton = new QToolButton( m_pFrame ); - connect( m_tabCloseButton, SIGNAL( clicked() ), - this, SLOT( slotFileClose() ) ); + m_tabCloseButton = new TQToolButton( m_pFrame ); + connect( m_tabCloseButton, TQT_SIGNAL( clicked() ), + this, TQT_SLOT( slotFileClose() ) ); m_tabCloseButton->setIconSet( SmallIconSet( "tab_remove" ) ); m_tabCloseButton->adjustSize(); - QToolTip::add(m_tabCloseButton, i18n("Close")); + TQToolTip::add(m_tabCloseButton, i18n("Close")); m_pFrame->setCornerWidget( m_tabCloseButton, BottomRight ); m_tabCloseButton->hide(); - QValueList<KoDocumentEntry> lstComponents = KoDocumentEntry::query(false,QString()); - QValueList<KoDocumentEntry>::Iterator it = lstComponents.begin(); + TQValueList<KoDocumentEntry> lstComponents = KoDocumentEntry::query(false,TQString()); + TQValueList<KoDocumentEntry>::Iterator it = lstComponents.begin(); int id = 0; // Get all available components for( ; it != lstComponents.end(); ++it ) @@ -107,17 +107,17 @@ KoShellWindow::KoShellWindow() m_mapComponents[ id++ ] = *it; } - QValueList<int> list; + TQValueList<int> list; list.append( KoShellSettings::sidebarWidth() ); list.append( this->width() - KoShellSettings::sidebarWidth() ); m_pLayout->setSizes( list ); - connect( this, SIGNAL( documentSaved() ), - this, SLOT( slotNewDocumentName() ) ); + connect( this, TQT_SIGNAL( documentSaved() ), + this, TQT_SLOT( slotNewDocumentName() ) ); - connect( m_pFrame, SIGNAL( currentChanged( QWidget* ) ), - this, SLOT( slotUpdatePart( QWidget* ) ) ); - connect( m_pFrame, SIGNAL( contextMenu(QWidget * ,const QPoint &)), this, SLOT( tab_contextMenu(QWidget * ,const QPoint &)) ); + connect( m_pFrame, TQT_SIGNAL( currentChanged( TQWidget* ) ), + this, TQT_SLOT( slotUpdatePart( TQWidget* ) ) ); + connect( m_pFrame, TQT_SIGNAL( contextMenu(TQWidget * ,const TQPoint &)), this, TQT_SLOT( tab_contextMenu(TQWidget * ,const TQPoint &)) ); m_client = new KoShellGUIClient( this ); createShellGUI(); @@ -133,7 +133,7 @@ KoShellWindow::~KoShellWindow() partManager()->setActivePart(0); // Destroy all documents - queryClose has made sure we saved them first - QValueList<Page>::ConstIterator it = m_lstPages.begin(); + TQValueList<Page>::ConstIterator it = m_lstPages.begin(); for (; it != m_lstPages.end(); ++it ) { (*it).m_pDoc->removeShell( this ); @@ -143,7 +143,7 @@ KoShellWindow::~KoShellWindow() } m_lstPages.clear(); - setRootDocumentDirect( 0L, QPtrList<KoView>() ); // prevent our parent destructor from doing stupid things + setRootDocumentDirect( 0L, TQPtrList<KoView>() ); // prevent our tqparent destructor from doing stupid things saveSettings(); // Now save our settings before exiting } @@ -158,7 +158,7 @@ bool KoShellWindow::openDocumentInternal( const KURL &url, KoDocument* ) /*if (!KIO::NetAccess::exists(url,true,0) ) { - KMessageBox::error(0L, i18n("The file %1 doesn't exist.").arg(url.url()) ); + KMessageBox::error(0L, i18n("The file %1 doesn't exist.").tqarg(url.url()) ); recentAction()->removeURL(url); //remove the file from the recent-opened-file-list saveRecentFiles(); return false; @@ -174,8 +174,8 @@ bool KoShellWindow::openDocumentInternal( const KURL &url, KoDocument* ) tmpFile = new KTempFile; KoFilterManager *manager = new KoFilterManager( url.path() ); - QCString mimetype; // an empty mimetype means, that the "nearest" - KoFilter::ConversionStatus status = manager->exp0rt( tmpFile->name(), mimetype ); // KOffice part will be chosen + TQCString mimetype; // an empty mimetype means, that the "nearest" + KoFilter::ConversiontqStatus status = manager->exp0rt( tmpFile->name(), mimetype ); // KOffice part will be chosen delete manager; if ( status != KoFilter::OK || mimetype.isEmpty() ) { @@ -208,9 +208,9 @@ bool KoShellWindow::openDocumentInternal( const KURL &url, KoDocument* ) return false; } - connect(newdoc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int))); - connect(newdoc, SIGNAL(completed()), this, SLOT(slotKSLoadCompleted())); - connect(newdoc, SIGNAL(canceled( const QString & )), this, SLOT(slotKSLoadCanceled( const QString & ))); + connect(newdoc, TQT_SIGNAL(sigProgress(int)), this, TQT_SLOT(slotProgress(int))); + connect(newdoc, TQT_SIGNAL(completed()), this, TQT_SLOT(slotKSLoadCompleted())); + connect(newdoc, TQT_SIGNAL(canceled( const TQString & )), this, TQT_SLOT(slotKSLoadCanceled( const TQString & ))); newdoc->addShell( this ); // used by openURL bool openRet = (!isImporting ()) ? newdoc->openURL(tmpUrl) : newdoc->import(tmpUrl); if ( !openRet ) @@ -255,7 +255,7 @@ bool KoShellWindow::openDocumentInternal( const KURL &url, KoDocument* ) return true; } -void KoShellWindow::slotSidebarItemClicked( QIconViewItem *item ) +void KoShellWindow::slotSidebarItemClicked( TQIconViewItem *item ) { //kdDebug() << "slotSidebarItemClicked called!" << endl; if( item != 0 ) @@ -292,27 +292,27 @@ void KoShellWindow::slotKSLoadCompleted() partManager()->addPart( newdoc, false ); setRootDocument( newdoc ); - disconnect(newdoc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int))); - disconnect(newdoc, SIGNAL(completed()), this, SLOT(slotKSLoadCompleted())); - disconnect(newdoc, SIGNAL(canceled( const QString & )), this, SLOT(slotKSLoadCanceled( const QString & ))); + disconnect(newdoc, TQT_SIGNAL(sigProgress(int)), this, TQT_SLOT(slotProgress(int))); + disconnect(newdoc, TQT_SIGNAL(completed()), this, TQT_SLOT(slotKSLoadCompleted())); + disconnect(newdoc, TQT_SIGNAL(canceled( const TQString & )), this, TQT_SLOT(slotKSLoadCanceled( const TQString & ))); } -void KoShellWindow::slotKSLoadCanceled( const QString & errMsg ) +void KoShellWindow::slotKSLoadCanceled( const TQString & errMsg ) { KMessageBox::error( this, errMsg ); // ... can't delete the document, it's the one who emitted the signal... // ###### FIXME: This can be done in 3.0 with deleteLater, I assume (Werner) KoDocument* newdoc = (KoDocument *)(sender()); - disconnect(newdoc, SIGNAL(sigProgress(int)), this, SLOT(slotProgress(int))); - disconnect(newdoc, SIGNAL(completed()), this, SLOT(slotKSLoadCompleted())); - disconnect(newdoc, SIGNAL(canceled( const QString & )), this, SLOT(slotKSLoadCanceled( const QString & ))); + disconnect(newdoc, TQT_SIGNAL(sigProgress(int)), this, TQT_SLOT(slotProgress(int))); + disconnect(newdoc, TQT_SIGNAL(completed()), this, TQT_SLOT(slotKSLoadCompleted())); + disconnect(newdoc, TQT_SIGNAL(canceled( const TQString & )), this, TQT_SLOT(slotKSLoadCanceled( const TQString & ))); } void KoShellWindow::saveAll() { KoView *currentView = (*m_activePage).m_pView; - for (QValueList<Page>::iterator it=m_lstPages.begin(); it != m_lstPages.end(); ++it) + for (TQValueList<Page>::iterator it=m_lstPages.begin(); it != m_lstPages.end(); ++it) { if ( (*it).m_pDoc->isModified() ) { @@ -335,11 +335,11 @@ void KoShellWindow::setRootDocument( KoDocument * doc ) if ( doc ) { - if ( !doc->shells().contains( this ) ) + if ( !doc->shells().tqcontains( this ) ) doc->addShell( this ); KoView *v = doc->createView(this); - QPtrList<KoView> views; + TQPtrList<KoView> views; views.append(v); setRootDocumentDirect( doc, views ); @@ -362,7 +362,7 @@ void KoShellWindow::setRootDocument( KoDocument * doc ) mnuSaveAll->setEnabled(true); } else { - setRootDocumentDirect( 0L, QPtrList<KoView>() ); + setRootDocumentDirect( 0L, TQPtrList<KoView>() ); m_activePage = m_lstPages.end(); KoMainWindow::updateCaption(); } @@ -379,14 +379,14 @@ void KoShellWindow::updateCaption() KoMainWindow::updateCaption(); // Let's take this opportunity for setting a correct name for the icon // in koolbar - QValueList<Page>::Iterator it = m_lstPages.begin(); + TQValueList<Page>::Iterator it = m_lstPages.begin(); for( ; it != m_lstPages.end() ; ++it ) { if ( (*it).m_pDoc == rootDocument() ) { //kdDebug() << "updateCaption called for " << rootDocument() << endl; // Get caption from document info (title(), in about page) - QString name; + TQString name; if ( rootDocument()->documentInfo() ) { name = rootDocument()->documentInfo()->title(); @@ -415,7 +415,7 @@ void KoShellWindow::updateCaption() void KoShellWindow::slotSidebar_Part(int _item) { //kdDebug() << "Component part choosed:" << _item << endl; - kapp->setOverrideCursor( QCursor(Qt::WaitCursor) ); + kapp->setOverrideCursor( TQCursor(TQt::WaitCursor) ); m_documentEntry = m_mapComponents[ _item ]; kdDebug() << m_documentEntry.service() << endl; kdDebug() << m_documentEntry.name() << endl; @@ -441,7 +441,7 @@ void KoShellWindow::slotSidebar_Document(int _item) (*m_activePage).m_id == _item ) return; - QValueList<Page>::Iterator it = m_lstPages.begin(); + TQValueList<Page>::Iterator it = m_lstPages.begin(); while( it != m_lstPages.end() ) { if ( (*it).m_id == _item ) @@ -467,12 +467,12 @@ void KoShellWindow::slotShowSidebar() } } -void KoShellWindow::slotUpdatePart( QWidget* widget ) +void KoShellWindow::slotUpdatePart( TQWidget* widget ) { KoView* v = dynamic_cast<KoView*>(widget); if ( v != 0 ) { - QValueList<Page>::Iterator it = m_lstPages.begin(); + TQValueList<Page>::Iterator it = m_lstPages.begin(); for( ; it != m_lstPages.end(); ++it ) { if( (*it).m_pView == v ) @@ -481,7 +481,7 @@ void KoShellWindow::slotUpdatePart( QWidget* widget ) } } -void KoShellWindow::switchToPage( QValueList<Page>::Iterator it ) +void KoShellWindow::switchToPage( TQValueList<Page>::Iterator it ) { // Select new active page (view) m_activePage = it; @@ -491,7 +491,7 @@ void KoShellWindow::switchToPage( QValueList<Page>::Iterator it ) // Make it active (GUI etc.) partManager()->setActivePart( (*m_activePage).m_pDoc, v ); // Change current document - QPtrList<KoView> views; + TQPtrList<KoView> views; views.append(v); setRootDocumentDirect( (*m_activePage).m_pDoc, views ); // Select the item in the sidebar @@ -503,7 +503,7 @@ void KoShellWindow::switchToPage( QValueList<Page>::Iterator it ) v->setFocus(); partSpecificHelpAction->setEnabled(true); - partSpecificHelpAction->setText(i18n("%1 Handbook").arg((*m_activePage).m_pDoc->instance()->aboutData()->programName())); + partSpecificHelpAction->setText(i18n("%1 Handbook").tqarg((*m_activePage).m_pDoc->instance()->aboutData()->programName())); } void KoShellWindow::slotFileNew() @@ -527,7 +527,7 @@ void KoShellWindow::slotFileNew() void KoShellWindow::slotFileOpen() { - KFileDialog *dialog=new KFileDialog(QString::null, QString::null, 0L, "file dialog", true); + KFileDialog *dialog=new KFileDialog(TQString(), TQString(), 0L, "file dialog", true); if (!isImporting()) dialog->setCaption( i18n("Open Document") ); else @@ -535,7 +535,7 @@ void KoShellWindow::slotFileOpen() dialog->setMimeFilter( KoFilterManager::mimeFilter() ); KURL url; - if(dialog->exec()==QDialog::Accepted) { + if(dialog->exec()==TQDialog::Accepted) { url=dialog->selectedURL(); recentAction()->addURL( url ); if ( url.isLocalFile() ) @@ -616,7 +616,7 @@ void KoShellWindow::closeDocument() bool KoShellWindow::queryClose() { // Save current doc and views - QPtrList<KoView> currentViews; + TQPtrList<KoView> currentViews; KoDocument * currentDoc = 0L; bool ok = true; if (m_activePage != m_lstPages.end()) @@ -626,12 +626,12 @@ bool KoShellWindow::queryClose() // This one is called by slotFileQuit and by the X button. // We have to check for unsaved docs... - QValueList<Page>::Iterator it = m_lstPages.begin(); + TQValueList<Page>::Iterator it = m_lstPages.begin(); for( ; it != m_lstPages.end(); ++it ) { // This is quite a HACK // We should ask ourselves, to get a better dialog box - setRootDocumentDirect( (*it).m_pDoc, QPtrList<KoView>() ); + setRootDocumentDirect( (*it).m_pDoc, TQPtrList<KoView>() ); // Test if we can close this doc if ( !KoMainWindow::queryClose() ) { @@ -661,13 +661,13 @@ void KoShellWindow::saveSettings() KoShellSettings::writeConfig(); } -QString KoShellWindow::configFile() const +TQString KoShellWindow::configFile() const { //return readConfigFile( locate( "data", "koshell/koshell_shell.rc" ) ); - return QString::null; // use UI standards only for now + return TQString(); // use UI standards only for now } -void KoShellWindow::tab_contextMenu(QWidget * w,const QPoint &p) +void KoShellWindow::tab_contextMenu(TQWidget * w,const TQPoint &p) { KPopupMenu menu; KIconLoader il; @@ -729,9 +729,9 @@ void KoShellWindow::showPartSpecificHelp() KoShellGUIClient::KoShellGUIClient( KoShellWindow *window ) : KXMLGUIClient() { setXMLFile( "koshellui.rc", true, true ); - window->mnuSaveAll = new KAction( i18n("Save All"), 0, window, SLOT( saveAll() ), actionCollection(), "save_all" ); + window->mnuSaveAll = new KAction( i18n("Save All"), 0, TQT_TQOBJECT(window), TQT_SLOT( saveAll() ), actionCollection(), "save_all" ); window->mnuSaveAll->setEnabled(false); - window->partSpecificHelpAction = new KAction(i18n("Part Handbook"), "contents", 0, window, SLOT(showPartSpecificHelp()), + window->partSpecificHelpAction = new KAction(i18n("Part Handbook"), "contents", 0, TQT_TQOBJECT(window), TQT_SLOT(showPartSpecificHelp()), actionCollection(), "partSpecificHelp"); window->partSpecificHelpAction->setEnabled(false); } diff --git a/koshell/koshell_shell.h b/koshell/koshell_shell.h index dd0f4c7c2..9841f18e4 100644 --- a/koshell/koshell_shell.h +++ b/koshell/koshell_shell.h @@ -25,17 +25,17 @@ #include <KoMainWindow.h> #include <KoQueryTrader.h> #include <ktabwidget.h> -#include <qptrlist.h> -#include <qmap.h> -#include <qtoolbutton.h> -#include <qvaluelist.h> +#include <tqptrlist.h> +#include <tqmap.h> +#include <tqtoolbutton.h> +#include <tqvaluelist.h> #include "iconsidepane.h" -class QVBox; -class QIconView; -class QIconViewItem; -class QSplitter; +class TQVBox; +class TQIconView; +class TQIconViewItem; +class TQSplitter; class KoDocumentEntry; class KoView; class KoShellGUIClient; @@ -45,6 +45,7 @@ class KoShellGUIClient; class KoShellWindow : public KoMainWindow { Q_OBJECT + TQ_OBJECT public: @@ -58,7 +59,7 @@ public: */ virtual void updateCaption(); - virtual QString configFile() const; + virtual TQString configFile() const; KAction *mnuSaveAll; KAction* partSpecificHelpAction; @@ -74,7 +75,7 @@ protected slots: void slotSidebar_Part(int); void slotSidebar_Document(int); - void tab_contextMenu(QWidget * ,const QPoint &); + void tab_contextMenu(TQWidget * ,const TQPoint &); /** Used for showing or hiding the sidebar and the components-label. @@ -85,9 +86,9 @@ protected slots: document which can be edited with the chosen component. @param item The component the user clicked on */ - void slotSidebarItemClicked( QIconViewItem *item ); + void slotSidebarItemClicked( TQIconViewItem *item ); void slotKSLoadCompleted(); - void slotKSLoadCanceled (const QString &); + void slotKSLoadCanceled (const TQString &); void slotNewDocumentName(); /** This slot is called whenever the user clicks on a tab to change the document. It looks for the @@ -95,7 +96,7 @@ protected slots: to the page corresponding to the widget. @param widget The current widget */ - void slotUpdatePart( QWidget* widget ); + void slotUpdatePart( TQWidget* widget ); private: @@ -111,20 +112,20 @@ private: virtual void slotConfigureKeys(); void closeDocument(); void saveSettings(); - void switchToPage( QValueList<Page>::Iterator it ); + void switchToPage( TQValueList<Page>::Iterator it ); - QValueList<Page> m_lstPages; - QValueList<Page>::Iterator m_activePage; + TQValueList<Page> m_lstPages; + TQValueList<Page>::Iterator m_activePage; IconSidePane *m_pSidebar; - QLabel *m_pComponentsLabel; - QSplitter *m_pLayout; + TQLabel *m_pComponentsLabel; + TQSplitter *m_pLayout; KTabWidget *m_pFrame; - QToolButton *m_tabCloseButton; + TQToolButton *m_tabCloseButton; // Map of available parts (the int is the koolbar item id) - QMap<int,KoDocumentEntry> m_mapComponents; + TQMap<int,KoDocumentEntry> m_mapComponents; // Saved between openDocument and setRootDocument KoDocumentEntry m_documentEntry; |