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 /lib/kofficeui/KoCommandHistory.cpp | |
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 'lib/kofficeui/KoCommandHistory.cpp')
-rw-r--r-- | lib/kofficeui/KoCommandHistory.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/lib/kofficeui/KoCommandHistory.cpp b/lib/kofficeui/KoCommandHistory.cpp index 79f0a14f..22e8599b 100644 --- a/lib/kofficeui/KoCommandHistory.cpp +++ b/lib/kofficeui/KoCommandHistory.cpp @@ -18,9 +18,9 @@ * Boston, MA 02110-1301, USA. */ -#include <qlabel.h> -#include <qlayout.h> -#include <qlistbox.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqlistbox.h> #include <kaction.h> #include <kcommand.h> @@ -33,15 +33,15 @@ #include "KoCommandHistory.h" -KoListBox::KoListBox( QWidget *parent , const char *name , WFlags f) - : QListBox( parent, name, f) +KoListBox::KoListBox( TQWidget *tqparent , const char *name , WFlags f) + : TQListBox( tqparent, name, f) { setVScrollBarMode( AlwaysOn ); } -void KoListBox::contentsMouseMoveEvent ( QMouseEvent * e) +void KoListBox::contentsMouseMoveEvent ( TQMouseEvent * e) { - QListBoxItem *item_p = itemAt( contentsToViewport(e->pos())); + TQListBoxItem *item_p = itemAt( contentsToViewport(e->pos())); if ( item_p ) { int itemIndex = index( item_p ); @@ -53,10 +53,10 @@ void KoListBox::contentsMouseMoveEvent ( QMouseEvent * e) } } -QSize KoListBox::sizeHint() const +TQSize KoListBox::tqsizeHint() const { - return QSize(QMIN(maxItemWidth() + verticalScrollBar()->width() + 4, 400), - QMIN(count() * itemHeight() + horizontalScrollBar()->height() + 4,300)); + return TQSize(TQMIN(maxItemWidth() + verticalScrollBar()->width() + 4, 400), + TQMIN(count() * itemHeight() + horizontalScrollBar()->height() + 4,300)); } class KoCommandHistory::KoCommandHistoryPrivate { @@ -70,8 +70,8 @@ public: KCommand *m_present; KoListBox *m_undoListBox; KoListBox *m_redoListBox; - QLabel *m_undoLabel; - QLabel *m_redoLabel; + TQLabel *m_undoLabel; + TQLabel *m_redoLabel; }; //////////// @@ -91,49 +91,49 @@ KoCommandHistory::KoCommandHistory(KActionCollection * actionCollection, bool wi if (withMenus) { KToolBarPopupAction * undo = new KToolBarPopupAction( i18n("&Undo"), "undo", - KStdAccel::undo(), this, SLOT( undo() ), + KStdAccel::undo(), this, TQT_SLOT( undo() ), actionCollection, /*KStdAction::stdName( KStdAction::Undo )*/"koffice_undo" ); - connect( undo->popupMenu(), SIGNAL( aboutToShow() ), this, SLOT( slotUndoAboutToShow() ) ); - connect( undo->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotUndoActivated( int ) ) ); + connect( undo->popupMenu(), TQT_SIGNAL( aboutToShow() ), this, TQT_SLOT( slotUndoAboutToShow() ) ); + connect( undo->popupMenu(), TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( slotUndoActivated( int ) ) ); m_undo = undo; m_undoPopup = undo->popupMenu(); d->m_undoListBox = new KoListBox( m_undoPopup ); - d->m_undoListBox->setSelectionMode( QListBox::Multi ); + d->m_undoListBox->setSelectionMode( TQListBox::Multi ); m_undoPopup->insertItem(d->m_undoListBox); - d->m_undoLabel = new QLabel( m_undoPopup); + d->m_undoLabel = new TQLabel( m_undoPopup); m_undoPopup->insertItem(d->m_undoLabel); - connect( d->m_undoListBox, SIGNAL( selected( int ) ), this, SLOT( slotUndoActivated( int ) ) ); - connect( d->m_undoListBox, SIGNAL(clicked ( QListBoxItem *)), this, SLOT( slotUndoActivated( QListBoxItem * ) ) ); + connect( d->m_undoListBox, TQT_SIGNAL( selected( int ) ), this, TQT_SLOT( slotUndoActivated( int ) ) ); + connect( d->m_undoListBox, TQT_SIGNAL(clicked ( TQListBoxItem *)), this, TQT_SLOT( slotUndoActivated( TQListBoxItem * ) ) ); - connect( d->m_undoListBox, SIGNAL( changeNumberOfSelectedItem( int )), this, SLOT( slotChangeUndoNumberOfSelectedItem( int ))); + connect( d->m_undoListBox, TQT_SIGNAL( changeNumberOfSelectedItem( int )), this, TQT_SLOT( slotChangeUndoNumberOfSelectedItem( int ))); KToolBarPopupAction * redo = new KToolBarPopupAction( i18n("&Redo"), "redo", - KStdAccel::redo(), this, SLOT( redo() ), + KStdAccel::redo(), this, TQT_SLOT( redo() ), actionCollection, /*KStdAction::stdName( KStdAction::Redo )*/ "koffice_redo"); - connect( redo->popupMenu(), SIGNAL( aboutToShow() ), this, SLOT( slotRedoAboutToShow() ) ); - connect( redo->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotRedoActivated( int ) ) ); + connect( redo->popupMenu(), TQT_SIGNAL( aboutToShow() ), this, TQT_SLOT( slotRedoAboutToShow() ) ); + connect( redo->popupMenu(), TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( slotRedoActivated( int ) ) ); m_redo = redo; m_redoPopup = redo->popupMenu(); d->m_redoListBox = new KoListBox( m_redoPopup ); - d->m_redoListBox->setSelectionMode( QListBox::Multi ); + d->m_redoListBox->setSelectionMode( TQListBox::Multi ); m_redoPopup->insertItem(d->m_redoListBox); - d->m_redoLabel = new QLabel( m_redoPopup); + d->m_redoLabel = new TQLabel( m_redoPopup); m_redoPopup->insertItem(d->m_redoLabel); - connect( d->m_redoListBox, SIGNAL( selected( int ) ), this, SLOT( slotRedoActivated( int ) ) ); - connect( d->m_redoListBox, SIGNAL(clicked ( QListBoxItem *)), this, SLOT( slotRedoActivated( QListBoxItem * ) ) ); - connect( d->m_redoListBox, SIGNAL( changeNumberOfSelectedItem( int )), this, SLOT( slotChangeRedoNumberOfSelectedItem( int ))); + connect( d->m_redoListBox, TQT_SIGNAL( selected( int ) ), this, TQT_SLOT( slotRedoActivated( int ) ) ); + connect( d->m_redoListBox, TQT_SIGNAL(clicked ( TQListBoxItem *)), this, TQT_SLOT( slotRedoActivated( TQListBoxItem * ) ) ); + connect( d->m_redoListBox, TQT_SIGNAL( changeNumberOfSelectedItem( int )), this, TQT_SLOT( slotChangeRedoNumberOfSelectedItem( int ))); } else { - m_undo = KStdAction::undo( this, SLOT( undo() ), actionCollection, "koffice_undo"); - m_redo = KStdAction::redo( this, SLOT( redo() ), actionCollection, "koffice_redo"); + m_undo = KStdAction::undo( this, TQT_SLOT( undo() ), actionCollection, "koffice_undo"); + m_redo = KStdAction::redo( this, TQT_SLOT( redo() ), actionCollection, "koffice_redo"); m_undoPopup = 0L; m_redoPopup = 0L; d->m_redoListBox = 0L; @@ -173,7 +173,7 @@ void KoCommandHistory::addCommand(KCommand *command, bool execute) { return; int index; - if(d->m_present!=0L && (index=m_commands.findRef(d->m_present))!=-1) { + if(d->m_present!=0L && (index=m_commands.tqfindRef(d->m_present))!=-1) { if (m_first) --index; m_commands.insert(index+1, command); @@ -188,7 +188,7 @@ void KoCommandHistory::addCommand(KCommand *command, bool execute) { m_first=false; if (m_undo != 0) { m_undo->setEnabled(true); - m_undo->setText(i18n("&Undo: %1").arg(d->m_present->name())); + m_undo->setText(i18n("&Undo: %1").tqarg(d->m_present->name())); } if((m_redo != 0) && m_redo->isEnabled()) { m_redo->setEnabled(false); @@ -203,7 +203,7 @@ void KoCommandHistory::addCommand(KCommand *command, bool execute) { d->m_present=command; if (m_undo != 0) { m_undo->setEnabled(true); - m_undo->setText(i18n("&Undo: %1").arg(d->m_present->name())); + m_undo->setText(i18n("&Undo: %1").tqarg(d->m_present->name())); } if (m_redo != 0) { m_redo->setEnabled(false); @@ -229,16 +229,16 @@ void KoCommandHistory::undo() { if (m_redo != 0) { m_redo->setEnabled(true); - m_redo->setText(i18n("&Redo: %1").arg(d->m_present->name())); + m_redo->setText(i18n("&Redo: %1").tqarg(d->m_present->name())); } int index; - if((index=m_commands.findRef(d->m_present))!=-1 && m_commands.prev()!=0) { + if((index=m_commands.tqfindRef(d->m_present))!=-1 && m_commands.prev()!=0) { d->m_present=m_commands.current(); emit commandExecuted(); emit commandExecuted(commandUndone); if (m_undo != 0) { m_undo->setEnabled(true); - m_undo->setText(i18n("&Undo: %1").arg(d->m_present->name())); + m_undo->setText(i18n("&Undo: %1").tqarg(d->m_present->name())); } --index; if(index==d->m_savedAt) @@ -270,7 +270,7 @@ void KoCommandHistory::redo() { if(d->m_savedAt==0) emit documentRestored(); } - else if((index=m_commands.findRef(d->m_present))!=-1 && m_commands.next()!=0) { + else if((index=m_commands.tqfindRef(d->m_present))!=-1 && m_commands.next()!=0) { d->m_present=m_commands.current(); d->m_present->execute(); emit commandExecuted(); @@ -282,13 +282,13 @@ void KoCommandHistory::redo() { if (m_undo != 0) { m_undo->setEnabled(true); - m_undo->setText(i18n("&Undo: %1").arg(d->m_present->name())); + m_undo->setText(i18n("&Undo: %1").tqarg(d->m_present->name())); } if(m_commands.next()!=0) { if (m_redo != 0) { m_redo->setEnabled(true); - m_redo->setText(i18n("&Redo: %1").arg(m_commands.current()->name())); + m_redo->setText(i18n("&Redo: %1").tqarg(m_commands.current()->name())); } } else { @@ -301,7 +301,7 @@ void KoCommandHistory::redo() { void KoCommandHistory::documentSaved() { if(d->m_present!=0 && !m_first) - d->m_savedAt=m_commands.findRef(d->m_present); + d->m_savedAt=m_commands.tqfindRef(d->m_present); else if(d->m_present==0 && !m_first) d->m_savedAt=-42; // this value signals that the document has // been saved with an empty history. @@ -331,7 +331,7 @@ void KoCommandHistory::clipCommands() { if(count<=m_undoLimit && count<=m_redoLimit) return; - int index=m_commands.findRef(d->m_present); + int index=m_commands.tqfindRef(d->m_present); if(index>=m_undoLimit) { for(int i=0; i<=(index-m_undoLimit); ++i) { m_commands.removeFirst(); @@ -339,7 +339,7 @@ void KoCommandHistory::clipCommands() { if(d->m_savedAt==-1) d->m_savedAt=-42; } - index=m_commands.findRef(d->m_present); // calculate the new + index=m_commands.tqfindRef(d->m_present); // calculate the new count=m_commands.count(); // values (for the redo-branch :) // make it easier for us... d->m_savedAt==-1 -> invalid if(d->m_savedAt!=-42 && d->m_savedAt<-1) @@ -361,11 +361,11 @@ void KoCommandHistory::slotUndoAboutToShow() d->m_undoListBox->clear(); slotChangeUndoNumberOfSelectedItem( -1 ); int i = 0; - QStringList lst; - if (m_commands.findRef(d->m_present)!=-1) + TQStringList lst; + if (m_commands.tqfindRef(d->m_present)!=-1) while ( m_commands.current() && i<10 ) // TODO make number of items configurable ? { - lst.append(i18n("Undo: %1").arg(m_commands.current()->name())); + lst.append(i18n("Undo: %1").tqarg(m_commands.current()->name())); m_commands.prev(); } d->m_undoListBox->insertStringList( lst ); @@ -379,13 +379,13 @@ void KoCommandHistory::slotUndoActivated( int pos ) m_undoPopup->hide(); } -void KoCommandHistory::slotUndoActivated( QListBoxItem * item) +void KoCommandHistory::slotUndoActivated( TQListBoxItem * item) { if ( item ) slotUndoActivated( item->listBox()->index(item)); } -void KoCommandHistory::slotRedoActivated( QListBoxItem * item) +void KoCommandHistory::slotRedoActivated( TQListBoxItem * item) { if ( item ) slotRedoActivated( item->listBox()->index(item)); @@ -406,17 +406,17 @@ void KoCommandHistory::slotRedoAboutToShow() { d->m_redoListBox->clear(); slotChangeRedoNumberOfSelectedItem( -1 ); - QStringList lst; + TQStringList lst; int i = 0; if (m_first) { d->m_present = m_commands.first(); - lst.append(i18n("Redo: %1").arg(d->m_present->name())); + lst.append(i18n("Redo: %1").tqarg(d->m_present->name())); } - if (m_commands.findRef(d->m_present)!=-1 && m_commands.next()) + if (m_commands.tqfindRef(d->m_present)!=-1 && m_commands.next()) while ( m_commands.current() && i<10 ) // TODO make number of items configurable ? { - lst.append(i18n("Redo: %1").arg(m_commands.current()->name())); + lst.append(i18n("Redo: %1").tqarg(m_commands.current()->name())); m_commands.next(); } d->m_redoListBox->insertStringList( lst ); @@ -436,7 +436,7 @@ void KoCommandHistory::updateActions() if ( m_undo && m_redo ) { m_undo->setEnabled( !m_first && ( d->m_present != 0L ) ); - m_redo->setEnabled(m_first || (m_commands.findRef(d->m_present)!=-1 && m_commands.next()!=0)); + m_redo->setEnabled(m_first || (m_commands.tqfindRef(d->m_present)!=-1 && m_commands.next()!=0)); } } |