diff options
Diffstat (limited to 'lib/kotext/KoStyleManager.cpp')
-rw-r--r-- | lib/kotext/KoStyleManager.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/lib/kotext/KoStyleManager.cpp b/lib/kotext/KoStyleManager.cpp index 77162a4e..9017d8a1 100644 --- a/lib/kotext/KoStyleManager.cpp +++ b/lib/kotext/KoStyleManager.cpp @@ -28,12 +28,12 @@ #include <kiconloader.h> #include <kdebug.h> -#include <qtabwidget.h> -#include <qpushbutton.h> -#include <qlabel.h> -#include <qcombobox.h> -#include <qcheckbox.h> -#include <qlayout.h> +#include <tqtabwidget.h> +#include <tqpushbutton.h> +#include <tqlabel.h> +#include <tqcombobox.h> +#include <tqcheckbox.h> +#include <tqlayout.h> /******************************************************************/ /* Class: KoStyleManager */ @@ -55,11 +55,11 @@ class KoStyleManagerPrivate { public: KoStylePreview* preview; - QCheckBox* cbIncludeInTOC; + TQCheckBox* cbIncludeInTOC; }; -KoStyleManager::KoStyleManager( QWidget *_parent, KoUnit::Unit unit, - const KoStyleCollection& styles, const QString & activeStyleName, +KoStyleManager::KoStyleManager( TQWidget *_parent, KoUnit::Unit unit, + const KoStyleCollection& styles, const TQString & activeStyleName, int flags ) : KDialogBase( _parent, "Stylist", true, i18n("Style Manager"), @@ -86,7 +86,7 @@ KoStyleManager::KoStyleManager( QWidget *_parent, KoUnit::Unit unit, newTab = new KoStyleParagTab( m_tabs ); KoParagLayoutWidget *decorations = new KoParagDecorationWidget( newTab ); - decorations->layout()->setMargin(KDialog::marginHint()); + decorations->tqlayout()->setMargin(KDialog::marginHint()); newTab->setWidget( decorations ); addTab( newTab ); @@ -98,12 +98,12 @@ KoStyleManager::KoStyleManager( QWidget *_parent, KoUnit::Unit unit, newTab->setWidget( new KoParagTabulatorsWidget( unit, -1, newTab ) ); addTab( newTab ); - QListBoxItem * item = m_stylesList->findItem( activeStyleName ); + TQListBoxItem * item = m_stylesList->tqfindItem( activeStyleName ); m_stylesList->setCurrentItem( item ? m_stylesList->index(item) : 0 ); noSignals=false; switchStyle(); - setInitialSize( QSize( 600, 570 ) ); + setInitialSize( TQSize( 600, 570 ) ); } KoStyleManager::~KoStyleManager() @@ -122,20 +122,20 @@ void KoStyleManager::addTab( KoStyleManagerTab * tab ) { m_tabsList.append( tab ); m_tabs->insertTab( tab, tab->tabName() ); - tab->layout()->activate(); + tab->tqlayout()->activate(); } void KoStyleManager::setupWidget(const KoStyleCollection& styleCollection) { - QFrame * frame1 = makeMainWidget(); - QGridLayout *frame1Layout = new QGridLayout( frame1, 0, 0, // auto + TQFrame * frame1 = makeMainWidget(); + TQGridLayout *frame1Layout = new TQGridLayout( frame1, 0, 0, // auto 0, KDialog::spacingHint() ); numStyles = styleCollection.count(); - m_stylesList = new QListBox( frame1, "stylesList" ); + m_stylesList = new TQListBox( frame1, "stylesList" ); m_stylesList->insertStringList( styleCollection.displayNameList() ); - const QValueList<KoUserStyle*> styleList = styleCollection.styleList(); - for ( QValueList<KoUserStyle *>::const_iterator it = styleList.begin(), end = styleList.end(); + const TQValueList<KoUserStyle*> styleList = styleCollection.styleList(); + for ( TQValueList<KoUserStyle *>::const_iterator it = styleList.begin(), end = styleList.end(); it != end ; ++it ) { KoParagStyle* style = static_cast<KoParagStyle *>( *it ); @@ -147,79 +147,79 @@ void KoStyleManager::setupWidget(const KoStyleCollection& styleCollection) frame1Layout->addMultiCellWidget( m_stylesList, 0, 0, 0, 1 ); - m_moveUpButton = new QPushButton( frame1, "moveUpButton" ); + m_moveUpButton = new TQPushButton( frame1, "moveUpButton" ); m_moveUpButton->setIconSet( SmallIconSet( "up" ) ); - connect( m_moveUpButton, SIGNAL( clicked() ), this, SLOT( moveUpStyle() ) ); + connect( m_moveUpButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( moveUpStyle() ) ); frame1Layout->addWidget( m_moveUpButton, 1, 1 ); - m_moveDownButton = new QPushButton( frame1, "moveDownButton" ); + m_moveDownButton = new TQPushButton( frame1, "moveDownButton" ); m_moveDownButton->setIconSet( SmallIconSet( "down" ) ); - connect( m_moveDownButton, SIGNAL( clicked() ), this, SLOT( moveDownStyle() ) ); + connect( m_moveDownButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( moveDownStyle() ) ); frame1Layout->addWidget( m_moveDownButton, 1, 0 ); - m_deleteButton = new QPushButton( frame1, "deleteButton" ); + m_deleteButton = new TQPushButton( frame1, "deleteButton" ); m_deleteButton->setText( i18n( "&Delete" ) ); - connect( m_deleteButton, SIGNAL( clicked() ), this, SLOT( deleteStyle() ) ); + connect( m_deleteButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( deleteStyle() ) ); frame1Layout->addWidget( m_deleteButton, 2, 1 ); - m_newButton = new QPushButton( frame1, "newButton" ); + m_newButton = new TQPushButton( frame1, "newButton" ); m_newButton->setText( i18n( "New" ) ); - connect( m_newButton, SIGNAL( clicked() ), this, SLOT( addStyle() ) ); + connect( m_newButton, TQT_SIGNAL( clicked() ), this, TQT_SLOT( addStyle() ) ); frame1Layout->addWidget( m_newButton, 2, 0 ); - m_tabs = new QTabWidget( frame1 ); + m_tabs = new TQTabWidget( frame1 ); frame1Layout->addMultiCellWidget( m_tabs, 0, 2, 2, 2 ); - connect( m_stylesList, SIGNAL( selectionChanged() ), this, SLOT( switchStyle() ) ); - connect( m_tabs, SIGNAL( currentChanged ( QWidget * ) ), this, SLOT( switchTabs() ) ); + connect( m_stylesList, TQT_SIGNAL( selectionChanged() ), this, TQT_SLOT( switchStyle() ) ); + connect( m_tabs, TQT_SIGNAL( currentChanged ( TQWidget * ) ), this, TQT_SLOT( switchTabs() ) ); } void KoStyleManager::addGeneralTab( int flags ) { - QWidget *tab = new QWidget( m_tabs ); + TQWidget *tab = new TQWidget( m_tabs ); - QGridLayout *tabLayout = new QGridLayout( tab ); + TQGridLayout *tabLayout = new TQGridLayout( tab ); tabLayout->setSpacing( KDialog::spacingHint() ); tabLayout->setMargin( KDialog::marginHint() ); - m_nameString = new QLineEdit( tab ); - m_nameString->resize(m_nameString->sizeHint() ); - connect( m_nameString, SIGNAL( textChanged( const QString &) ), this, SLOT( renameStyle(const QString &) ) ); + m_nameString = new TQLineEdit( tab ); + m_nameString->resize(m_nameString->tqsizeHint() ); + connect( m_nameString, TQT_SIGNAL( textChanged( const TQString &) ), this, TQT_SLOT( renameStyle(const TQString &) ) ); tabLayout->addWidget( m_nameString, 0, 1 ); - QLabel *nameLabel = new QLabel( tab ); + TQLabel *nameLabel = new TQLabel( tab ); nameLabel->setText( i18n( "Name:" ) ); - nameLabel->resize(nameLabel->sizeHint()); - nameLabel->setAlignment( AlignRight | AlignVCenter ); + nameLabel->resize(nameLabel->tqsizeHint()); + nameLabel->tqsetAlignment( AlignRight | AlignVCenter ); tabLayout->addWidget( nameLabel, 0, 0 ); - m_styleCombo = new QComboBox( FALSE, tab, "styleCombo" ); + m_styleCombo = new TQComboBox( FALSE, tab, "styleCombo" ); tabLayout->addWidget( m_styleCombo, 1, 1 ); - QLabel *nextStyleLabel = new QLabel( tab ); + TQLabel *nextStyleLabel = new TQLabel( tab ); nextStyleLabel->setText( i18n( "Next style:" ) ); - nextStyleLabel->setAlignment( AlignRight | AlignVCenter ); + nextStyleLabel->tqsetAlignment( AlignRight | AlignVCenter ); tabLayout->addWidget( nextStyleLabel, 1, 0 ); - m_inheritCombo = new QComboBox( FALSE, tab, "inheritCombo" ); + m_inheritCombo = new TQComboBox( FALSE, tab, "inheritCombo" ); tabLayout->addWidget( m_inheritCombo, 2, 1 ); - QLabel *inheritStyleLabel = new QLabel( tab ); + TQLabel *inheritStyleLabel = new TQLabel( tab ); inheritStyleLabel->setText( i18n( "Inherit style:" ) ); - inheritStyleLabel->setAlignment( AlignRight | AlignVCenter ); + inheritStyleLabel->tqsetAlignment( AlignRight | AlignVCenter ); tabLayout->addWidget( inheritStyleLabel, 2, 0 ); int row = 3; if ( flags & ShowIncludeInToc ) { - d->cbIncludeInTOC = new QCheckBox( i18n("Include in table of contents"), tab ); + d->cbIncludeInTOC = new TQCheckBox( i18n("Include in table of contents"), tab ); tabLayout->addMultiCellWidget( d->cbIncludeInTOC, row, row, 0, 1 ); ++row; } else { @@ -299,7 +299,7 @@ int KoStyleManager::styleIndex( int pos ) { // Update the GUI so that it shows m_currentStyle void KoStyleManager::updateGUI() { kdDebug(32500) << "KoStyleManager::updateGUI m_currentStyle=" << m_currentStyle << " " << m_currentStyle->name() << endl; - QPtrListIterator<KoStyleManagerTab> it( m_tabsList ); + TQPtrListIterator<KoStyleManagerTab> it( m_tabsList ); for ( ; it.current() ; ++it ) { it.current()->setStyle( m_currentStyle ); @@ -308,7 +308,7 @@ void KoStyleManager::updateGUI() { m_nameString->setText(m_currentStyle->displayName()); - QString followingName = m_currentStyle->followingStyle() ? m_currentStyle->followingStyle()->displayName() : QString::null; + TQString followingName = m_currentStyle->followingStyle() ? m_currentStyle->followingStyle()->displayName() : TQString(); kdDebug(32500) << "KoStyleManager::updateGUI updating combo to " << followingName << endl; for ( int i = 0; i < m_styleCombo->count(); i++ ) { if ( m_styleCombo->text( i ) == followingName ) { @@ -318,7 +318,7 @@ void KoStyleManager::updateGUI() { } } - QString inheritName = m_currentStyle->parentStyle() ? m_currentStyle->parentStyle()->displayName() : QString::null; + TQString inheritName = m_currentStyle->tqparentStyle() ? m_currentStyle->tqparentStyle()->displayName() : TQString(); kdDebug(32500) << "KoStyleManager::updateGUI updating combo to " << inheritName << endl; for ( int i = 0; i < m_inheritCombo->count(); i++ ) { if ( m_inheritCombo->text( i ) == inheritName ) { @@ -345,13 +345,13 @@ void KoStyleManager::updateGUI() { void KoStyleManager::updatePreview() { d->preview->setStyle(m_currentStyle); - d->preview->repaint(true); + d->preview->tqrepaint(true); } void KoStyleManager::save() { if(m_currentStyle) { // save changes from UI to object. - QPtrListIterator<KoStyleManagerTab> it( m_tabsList ); + TQPtrListIterator<KoStyleManagerTab> it( m_tabsList ); for ( ; it.current() ; ++it ) it.current()->save(); @@ -370,11 +370,11 @@ void KoStyleManager::save() { else { int indexParentStyle=styleIndex( m_inheritCombo->currentItem()-1 ); - KoParagStyle *parent=m_origStyles.at(indexParentStyle); - if( parent==0L ) //If not found in the orig list (means its a new Style) look in the changeStyles list - parent=m_changedStyles.at(indexParentStyle); + KoParagStyle *tqparent=m_origStyles.at(indexParentStyle); + if( tqparent==0L ) //If not found in the orig list (means its a new Style) look in the changeStyles list + tqparent=m_changedStyles.at(indexParentStyle); - m_currentStyle->setParentStyle( parent ); + m_currentStyle->setParentStyle( tqparent ); } if ( d->cbIncludeInTOC ) @@ -382,7 +382,7 @@ void KoStyleManager::save() { } } -KoParagStyle * KoStyleManager::style( const QString & _name ) +KoParagStyle * KoStyleManager::style( const TQString & _name ) { for(unsigned int i=0; i < m_changedStyles.count(); i++) { // Skip deleted styles, they're no in m_stylesList anymore @@ -394,12 +394,12 @@ KoParagStyle * KoStyleManager::style( const QString & _name ) return 0; } -QString KoStyleManager::generateUniqueName() +TQString KoStyleManager::generateUniqueName() { int count = 1; - QString name; + TQString name; do { - name = "new" + QString::number( count++ ); + name = "new" + TQString::number( count++ ); } while ( style( name ) ); return name; } @@ -408,7 +408,7 @@ QString KoStyleManager::generateUniqueName() void KoStyleManager::addStyle() { save(); - QString str = i18n( "New Style Template (%1)" ).arg(numStyles++); + TQString str = i18n( "New Style Template (%1)" ).tqarg(numStyles++); if ( m_currentStyle ) { m_currentStyle = new KoParagStyle( *m_currentStyle ); // Create a new style, initializing from the current one @@ -447,9 +447,9 @@ void KoStyleManager::updateInheritStyle( KoParagStyle *s ) for ( KoParagStyle* p = m_changedStyles.first(); p != 0L; p = m_changedStyles.next() ) { //when we remove style, we must replace inherite style to 0L - //when parent style was removed. + //when tqparent style was removed. //##########Laurent change inherited style attribute - if ( p->parentStyle() == s) + if ( p->tqparentStyle() == s) p->setParentStyle(0L); } @@ -459,7 +459,7 @@ void KoStyleManager::deleteStyle() { unsigned int cur = styleIndex( m_stylesList->currentItem() ); unsigned int curItem = m_stylesList->currentItem(); - QString name = m_stylesList->currentText(); + TQString name = m_stylesList->currentText(); KoParagStyle *s = m_changedStyles.at(cur); m_styleOrder.remove( s->name()); updateFollowingStyle( s ); @@ -475,7 +475,7 @@ void KoStyleManager::deleteStyle() { m_stylesList->removeItem(curItem); m_styleCombo->removeItem(curItem); - m_inheritCombo->listBox()->removeItem( m_inheritCombo->listBox()->index(m_inheritCombo->listBox()->findItem(name ))); + m_inheritCombo->listBox()->removeItem( m_inheritCombo->listBox()->index(m_inheritCombo->listBox()->tqfindItem(name ))); numStyles--; m_stylesList->setSelected( m_stylesList->currentItem(), true ); @@ -486,9 +486,9 @@ void KoStyleManager::moveUpStyle() Q_ASSERT( m_currentStyle ); if ( m_currentStyle ) save(); - const QString currentStyleName = m_currentStyle->name(); - const QString currentStyleDisplayName = m_stylesList->currentText(); - int pos2 = m_styleOrder.findIndex( currentStyleName ); + const TQString currentStyleName = m_currentStyle->name(); + const TQString currentStyleDisplayName = m_stylesList->currentText(); + int pos2 = m_styleOrder.tqfindIndex( currentStyleName ); if ( pos2 != -1 ) { m_styleOrder.remove( m_styleOrder.at(pos2)); @@ -514,9 +514,9 @@ void KoStyleManager::moveDownStyle() Q_ASSERT( m_currentStyle ); if ( m_currentStyle ) save(); - const QString currentStyleName = m_currentStyle->name(); - const QString currentStyleDisplayName = m_stylesList->currentText(); - int pos2 = m_styleOrder.findIndex( currentStyleName ); + const TQString currentStyleName = m_currentStyle->name(); + const TQString currentStyleDisplayName = m_stylesList->currentText(); + int pos2 = m_styleOrder.tqfindIndex( currentStyleName ); if ( pos2 != -1 ) { m_styleOrder.remove( m_styleOrder.at(pos2)); @@ -550,7 +550,7 @@ void KoStyleManager::slotApply() { void KoStyleManager::apply() { noSignals=true; KoStyleChangeDefMap styleChanged; - QPtrList<KoParagStyle> removeStyle; + TQPtrList<KoParagStyle> removeStyle; for (unsigned int i =0 ; m_origStyles.count() > i ; i++) { if(m_origStyles.at(i) == 0L && m_changedStyles.at(i)!=0L) { // newly added style kdDebug(32500) << "adding new " << m_changedStyles.at(i)->name() << " (" << i << ")" << endl; @@ -605,7 +605,7 @@ void KoStyleManager::apply() { noSignals=false; } -void KoStyleManager::renameStyle(const QString &theText) { +void KoStyleManager::renameStyle(const TQString &theText) { if(noSignals) return; noSignals=true; @@ -649,10 +649,10 @@ void KoStyleManager::renameStyle(const QString &theText) { ///////////// -KoStyleParagTab::KoStyleParagTab( QWidget * parent ) - : KoStyleManagerTab( parent ) +KoStyleParagTab::KoStyleParagTab( TQWidget * tqparent ) + : KoStyleManagerTab( tqparent ) { - ( new QVBoxLayout( this ) )->setAutoAdd( true ); + ( new TQVBoxLayout( this ) )->setAutoAdd( true ); m_widget = 0L; } @@ -671,17 +671,17 @@ void KoStyleParagTab::setWidget( KoParagLayoutWidget * widget ) m_widget = widget; } -void KoStyleParagTab::resizeEvent( QResizeEvent *e ) +void KoStyleParagTab::resizeEvent( TQResizeEvent *e ) { - QWidget::resizeEvent( e ); + TQWidget::resizeEvent( e ); if ( m_widget ) m_widget->resize( size() ); } -KoStyleFontTab::KoStyleFontTab( QWidget * parent ) - : KoStyleManagerTab( parent ) +KoStyleFontTab::KoStyleFontTab( TQWidget * tqparent ) + : KoStyleManagerTab( tqparent ) { - ( new QVBoxLayout( this ) )->setAutoAdd( true ); - QTabWidget *fontTabContainer = new QTabWidget( this ); + ( new TQVBoxLayout( this ) )->setAutoAdd( true ); + TQTabWidget *fontTabContainer = new TQTabWidget( this ); m_fontTab = new KoFontTab( KFontChooser::SmoothScalableFonts, this ); m_decorationTab = new KoDecorationTab( this ); @@ -720,13 +720,13 @@ void KoStyleFontTab::update() #if 0 bool subScript = m_style->format().vAlign() == KoTextFormat::AlignSubScript; bool superScript = m_style->format().vAlign() == KoTextFormat::AlignSuperScript; - QFont fn = m_style->format().font(); + TQFont fn = m_style->format().font(); kdDebug()<<" fn.bold() :"<<fn.bold()<<" fn.italic():"<<fn.italic()<<endl; kdDebug()<<" fn.family() :"<<fn.family()<<endl; m_chooser->setFont( fn, subScript, superScript ); m_chooser->setColor( m_style->format().color() ); - QColor col=m_style->format().textBackgroundColor(); - col=col.isValid() ? col : QApplication::palette().color( QPalette::Active, QColorGroup::Base ); + TQColor col=m_style->format().textBackgroundColor(); + col=col.isValid() ? col : TQApplication::palette().color( TQPalette::Active, TQColorGroup::Base ); m_chooser->setBackGroundColor(col); m_chooser->setUnderlineColor( m_style->format().textUnderlineColor()); @@ -769,7 +769,7 @@ void KoStyleFontTab::save() /* m_style->format().setFont( m_fontTab->getSelection() ); m_style->format().setColor( m_decorationTab->getTextColor() ); - if( m_decorationTab->getBackGroundColor()!=QApplication::palette().color( QPalette::Active, QColorGroup::Base )) + if( m_decorationTab->getBackGroundColor()!=TQApplication::palette().color( TQPalette::Active, TQColorGroup::Base )) m_style->format().setTextBackgroundColor( m_decorationTab->getBackGroundColor() ); m_style->format().setTextUnderlineColor(m_chooser->underlineColor()); @@ -788,7 +788,7 @@ void KoStyleFontTab::save() m_style->format().setHyphenation( m_chooser->getHyphenation()); */} -QString KoStyleFontTab::tabName() +TQString KoStyleFontTab::tabName() { return i18n("Font"); } |