diff options
Diffstat (limited to 'kdevdesigner/designer/multilineeditorimpl.cpp')
-rw-r--r-- | kdevdesigner/designer/multilineeditorimpl.cpp | 164 |
1 files changed, 82 insertions, 82 deletions
diff --git a/kdevdesigner/designer/multilineeditorimpl.cpp b/kdevdesigner/designer/multilineeditorimpl.cpp index 3d7f5afc..1d859211 100644 --- a/kdevdesigner/designer/multilineeditorimpl.cpp +++ b/kdevdesigner/designer/multilineeditorimpl.cpp @@ -35,28 +35,28 @@ #include <kiconloader.h> #include "kdevdesigner_part.h" -#include <qtextedit.h> +#include <tqtextedit.h> #include <./private/qrichtext_p.h> -#include <qpushbutton.h> -#include <qlayout.h> -#include <qtoolbutton.h> -#include <qapplication.h> -#include <qaction.h> -#include <qmetaobject.h> +#include <tqpushbutton.h> +#include <tqlayout.h> +#include <tqtoolbutton.h> +#include <tqapplication.h> +#include <tqaction.h> +#include <tqmetaobject.h> #include <klocale.h> -ToolBarItem::ToolBarItem( QWidget *parent, QWidget *toolBar, - const QString &label, const QString &tagstr, - const QIconSet &icon, const QKeySequence &key ) - : QAction( parent ) +ToolBarItem::ToolBarItem( TQWidget *parent, TQWidget *toolBar, + const TQString &label, const TQString &tagstr, + const TQIconSet &icon, const TQKeySequence &key ) + : TQAction( parent ) { setIconSet( icon ); setText( label ); setAccel( key ); addTo( toolBar ); tag = tagstr; - connect( this, SIGNAL( activated() ), this, SLOT( wasActivated() ) ); + connect( this, TQT_SIGNAL( activated() ), this, TQT_SLOT( wasActivated() ) ); } ToolBarItem::~ToolBarItem() @@ -69,21 +69,21 @@ void ToolBarItem::wasActivated() emit clicked( tag ); } -TextEdit::TextEdit( QWidget *parent, const char *name ) - : QTextEdit( parent, name ) +TextEdit::TextEdit( TQWidget *parent, const char *name ) + : TQTextEdit( parent, name ) { setTextFormat( Qt::PlainText ); } QTextParagraph* TextEdit::paragraph() { - QTextCursor *tc = new QTextCursor( QTextEdit::document() ); + QTextCursor *tc = new QTextCursor( TQTextEdit::document() ); return tc->paragraph(); } -MultiLineEditor::MultiLineEditor( bool call_static, bool richtextMode, QWidget *parent, QWidget *editWidget, - FormWindow *fw, const QString &text ) +MultiLineEditor::MultiLineEditor( bool call_static, bool richtextMode, TQWidget *parent, TQWidget *editWidget, + FormWindow *fw, const TQString &text ) : MultiLineEditorBase( parent, 0, WType_Dialog | WShowModal ), formwindow( fw ), doWrap( FALSE ) { callStatic = call_static; @@ -95,149 +95,149 @@ MultiLineEditor::MultiLineEditor( bool call_static, bool richtextMode, QWidget * Layout4->insertWidget( 0, textEdit ); if ( richtextMode ) { - QPopupMenu *stylesMenu = new QPopupMenu( this ); + TQPopupMenu *stylesMenu = new TQPopupMenu( this ); menuBar->insertItem( i18n( "&Styles" ), stylesMenu ); - basicToolBar = new QToolBar( i18n( "Basics" ), this, DockTop ); + basicToolBar = new TQToolBar( i18n( "Basics" ), this, DockTop ); ToolBarItem *it = new ToolBarItem( this, basicToolBar, i18n( "Italic" ), "i", BarIcon( "designer_textitalic.png", KDevDesignerPartFactory::instance() ), CTRL+Key_I ); it->addTo( stylesMenu ); - connect( it, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( it, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *b = new ToolBarItem( this, basicToolBar, i18n( "Bold" ), "b", BarIcon( "designer_textbold.png", KDevDesignerPartFactory::instance() ), CTRL+Key_B ); b->addTo( stylesMenu ); - connect( b, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( b, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *ul = new ToolBarItem( this, basicToolBar, i18n( "Underline" ), "u", BarIcon( "designer_textunderline.png" , KDevDesignerPartFactory::instance()), CTRL+Key_U ); ul->addTo( stylesMenu ); - connect( ul, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( ul, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *tt = new ToolBarItem( this, basicToolBar, i18n( "Typewriter" ), "tt", BarIcon( "designer_textteletext.png", KDevDesignerPartFactory::instance() ) ); tt->addTo( stylesMenu ); - connect( tt, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( tt, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); basicToolBar->addSeparator(); - QPopupMenu *layoutMenu = new QPopupMenu( this ); + TQPopupMenu *layoutMenu = new TQPopupMenu( this ); menuBar->insertItem( i18n( "&Layout" ), layoutMenu ); - QAction *brAction = new QAction( this ); + TQAction *brAction = new TQAction( this ); brAction->setIconSet( BarIcon( "designer_textlinebreak.png", KDevDesignerPartFactory::instance() ) ); brAction->setText( i18n("Break" ) ); brAction->addTo( basicToolBar ); brAction->addTo( layoutMenu ); - connect( brAction, SIGNAL( activated() ) , this, SLOT( insertBR() ) ); + connect( brAction, TQT_SIGNAL( activated() ) , this, TQT_SLOT( insertBR() ) ); ToolBarItem *p = new ToolBarItem( this, basicToolBar, i18n( "Paragraph" ), "p", BarIcon( "designer_textparagraph.png", KDevDesignerPartFactory::instance() ) ); p->addTo( layoutMenu ); - connect( p, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( p, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); layoutMenu->insertSeparator(); basicToolBar->addSeparator(); ToolBarItem *al = new ToolBarItem( this, basicToolBar, i18n( "Align left" ), "p align=\"left\"", BarIcon( "designer_textleft.png", KDevDesignerPartFactory::instance() ) ); al->addTo( layoutMenu ); - connect( al, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( al, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *ac = new ToolBarItem( this, basicToolBar, i18n( "Align center" ), "p align=\"center\"", BarIcon( "designer_textcenter.png", KDevDesignerPartFactory::instance() ) ); ac->addTo( layoutMenu ); - connect( ac, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( ac, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *ar = new ToolBarItem( this, basicToolBar, i18n( "Align right" ), "p align=\"right\"", BarIcon( "designer_textright.png", KDevDesignerPartFactory::instance() ) ); ar->addTo( layoutMenu ); - connect( ar, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( ar, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *block = new ToolBarItem( this, basicToolBar, i18n( "Blockquote" ), "blockquote", BarIcon( "designer_textjustify.png", KDevDesignerPartFactory::instance() ) ); block->addTo( layoutMenu ); - connect( block, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( block, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); - QPopupMenu *fontMenu = new QPopupMenu( this ); + TQPopupMenu *fontMenu = new TQPopupMenu( this ); menuBar->insertItem( i18n( "&Font" ), fontMenu ); - fontToolBar = new QToolBar( "Fonts", this, DockTop ); + fontToolBar = new TQToolBar( "Fonts", this, DockTop ); - QAction *fontAction = new QAction( this ); + TQAction *fontAction = new TQAction( this ); fontAction->setIconSet( BarIcon( "designer_textfont.png", KDevDesignerPartFactory::instance() ) ); fontAction->setText( i18n("Font" ) ); fontAction->addTo( fontToolBar ); fontAction->addTo( fontMenu ); - connect( fontAction, SIGNAL( activated() ) , this, SLOT( showFontDialog() ) ); + connect( fontAction, TQT_SIGNAL( activated() ) , this, TQT_SLOT( showFontDialog() ) ); ToolBarItem *fp1 = new ToolBarItem( this, fontToolBar, i18n( "Fontsize +1" ), "font size=\"+1\"", BarIcon( "designer_textlarger.png", KDevDesignerPartFactory::instance() ) ); - connect( fp1, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( fp1, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *fm1 = new ToolBarItem( this, fontToolBar, i18n( "Fontsize -1" ), "font size=\"-1\"", BarIcon( "designer_textsmaller.png", KDevDesignerPartFactory::instance() ) ); - connect( fm1, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( fm1, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *h1 = new ToolBarItem( this, fontToolBar, i18n( "Headline 1" ), "h1", BarIcon( "designer_texth1.png", KDevDesignerPartFactory::instance() ) ); - connect( h1, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( h1, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *h2 = new ToolBarItem( this, fontToolBar, i18n( "Headline 2" ), "h2", BarIcon( "designer_texth2.png", KDevDesignerPartFactory::instance() ) ); - connect( h2, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( h2, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); ToolBarItem *h3 = new ToolBarItem( this, fontToolBar, i18n( "Headline 3" ), "h3", BarIcon( "designer_texth3.png", KDevDesignerPartFactory::instance() ) ); - connect( h3, SIGNAL( clicked( const QString& ) ), - this, SLOT( insertTags( const QString& ))); + connect( h3, TQT_SIGNAL( clicked( const TQString& ) ), + this, TQT_SLOT( insertTags( const TQString& ))); - QPopupMenu *optionsMenu = new QPopupMenu( this ); + TQPopupMenu *optionsMenu = new TQPopupMenu( this ); menuBar->insertItem( i18n( "O&ptions" ), optionsMenu ); - optionsToolBar = new QToolBar( "Options", this, DockTop ); - wrapAction = new QAction( this ); + optionsToolBar = new TQToolBar( "Options", this, DockTop ); + wrapAction = new TQAction( this ); wrapAction->setToggleAction( TRUE ); wrapAction->setIconSet( BarIcon( "designer_wordwrap.png", KDevDesignerPartFactory::instance() ) ); wrapAction->setText( i18n( "Word Wrapping" ) ); wrapAction->addTo( optionsToolBar ); wrapAction->addTo( optionsMenu ); - connect( wrapAction, SIGNAL( toggled( bool ) ), this, SLOT( changeWrapMode( bool ) ) ); + connect( wrapAction, TQT_SIGNAL( toggled( bool ) ), this, TQT_SLOT( changeWrapMode( bool ) ) ); oldDoWrap = doWrap; wrapAction->setOn( doWrap ); - connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) ); + connect( helpButton, TQT_SIGNAL( clicked() ), MainWindow::self, TQT_SLOT( showDialogHelp() ) ); textEdit->document()->setFormatter( new QTextFormatterBreakInWords ); textEdit->document()->setUseFormatCollection( FALSE ); textEdit->document()->setPreProcessor( new SyntaxHighlighter_HTML ); - if ( !callStatic && ::qt_cast<QTextEdit*>(editWidget) ) { - mlined = (QTextEdit*)editWidget; + if ( !callStatic && ::qt_cast<TQTextEdit*>(editWidget) ) { + mlined = (TQTextEdit*)editWidget; mlined->setReadOnly( TRUE ); - const QMetaProperty *wordWrap = mlined->metaObject()->property( + const TQMetaProperty *wordWrap = mlined->metaObject()->property( mlined->metaObject()->findProperty( "wordWrap", TRUE ), TRUE ); oldWrapMode = 0; oldWrapString = "NoWrap"; if ( wordWrap ) { oldWrapMode = mlined->property( "wordWrap" ); - oldWrapString = QString( wordWrap->valueToKey( oldWrapMode.toInt() ) ); + oldWrapString = TQString( wordWrap->valueToKey( oldWrapMode.toInt() ) ); if ( oldWrapString != "NoWrap" ) doWrap = TRUE; } @@ -282,18 +282,18 @@ void MultiLineEditor::applyClicked() formwindow->commandHistory()->addCommand( cmd ); if ( oldDoWrap != doWrap ) { - QString pn( i18n( "Set 'wordWrap' of '%2'" ).arg( mlined->name() ) ); + TQString pn( i18n( "Set 'wordWrap' of '%2'" ).arg( mlined->name() ) ); SetPropertyCommand *propcmd; if ( doWrap ) propcmd = new SetPropertyCommand( pn, formwindow, mlined, MainWindow::self->propertyeditor(), "wordWrap", WidgetFactory::property( mlined, "wordWrap" ), - QVariant( 1 ), "WidgetWidth", oldWrapString ); + TQVariant( 1 ), "WidgetWidth", oldWrapString ); else propcmd = new SetPropertyCommand( pn, formwindow, mlined, MainWindow::self->propertyeditor(), "wordWrap", WidgetFactory::property( mlined, "wordWrap" ), - QVariant( 0 ), "NoWrap", oldWrapString ); + TQVariant( 0 ), "NoWrap", oldWrapString ); propcmd->execute(); formwindow->commandHistory()->addCommand( propcmd, TRUE ); @@ -311,21 +311,21 @@ void MultiLineEditor::cancelClicked() close(); } -void MultiLineEditor::closeEvent( QCloseEvent *e ) +void MultiLineEditor::closeEvent( TQCloseEvent *e ) { qApp->exit_loop(); MultiLineEditorBase::closeEvent( e ); } -void MultiLineEditor::insertTags( const QString &tag ) +void MultiLineEditor::insertTags( const TQString &tag ) { int pfrom, pto, ifrom, ito; - QString tagend( tag.simplifyWhiteSpace() ); + TQString tagend( tag.simplifyWhiteSpace() ); tagend.remove( tagend.find( ' ', 0 ), tagend.length() ); if ( textEdit->hasSelectedText() ) { textEdit->getSelection( &pfrom, &ifrom, &pto, &ito ); - QString buf = textEdit->selectedText(); - buf = QString( "<%1>%3</%2>" ).arg( tag ).arg( tagend ).arg( buf ); + TQString buf = textEdit->selectedText(); + buf = TQString( "<%1>%3</%2>" ).arg( tag ).arg( tagend ).arg( buf ); textEdit->removeSelectedText(); textEdit->insertAt( buf, pfrom, ifrom ); textEdit->setCursorPosition( pto, ito + 2 + tag.length() ); @@ -333,7 +333,7 @@ void MultiLineEditor::insertTags( const QString &tag ) else { int para, index; textEdit->getCursorPosition( ¶, &index ); - textEdit->insert( QString( "<%1></%2>" ).arg( tag ).arg( tagend ) ); + textEdit->insert( TQString( "<%1></%2>" ).arg( tag ).arg( tagend ) ); index += 2 + tag.length(); textEdit->setCursorPosition( para, index ); } @@ -353,16 +353,16 @@ void MultiLineEditor::showFontDialog() selText = TRUE; } RichTextFontDialog *fd = new RichTextFontDialog( this ); - if ( fd->exec() == QDialog::Accepted ) { - QString size, font; + if ( fd->exec() == TQDialog::Accepted ) { + TQString size, font; if ( fd->getSize() != "0" ) size = "size=\"" + fd->getSize() + "\""; - QString color; + TQString color; if ( !fd->getColor().isEmpty() && fd->getColor() != "#000000" ) color = "color=\"" + fd->getColor() + "\""; if ( fd->getFont() != "default" ) font = "face=\"" + fd->getFont() + "\""; - QString tag( QString( "font %1 %2 %3" ) + TQString tag( TQString( "font %1 %2 %3" ) .arg( color ).arg( size ).arg( font ) ); if ( selText ) @@ -373,21 +373,21 @@ void MultiLineEditor::showFontDialog() textEdit->setSelection( pfrom, ifrom, pto, ito ); } -QString MultiLineEditor::getStaticText() +TQString MultiLineEditor::getStaticText() { return staticText.stripWhiteSpace(); } -QString MultiLineEditor::getText( QWidget *parent, const QString &text, bool richtextMode, bool *useWrap ) +TQString MultiLineEditor::getText( TQWidget *parent, const TQString &text, bool richtextMode, bool *useWrap ) { MultiLineEditor medit( TRUE, richtextMode, parent, 0, 0, text ); if ( richtextMode ) medit.setUseWrapping( *useWrap ); - if ( medit.exec() == QDialog::Accepted ) { + if ( medit.exec() == TQDialog::Accepted ) { *useWrap = medit.useWrapping(); return medit.getStaticText(); } - return QString::null; + return TQString::null; } void MultiLineEditor::changeWrapMode( bool b ) @@ -397,9 +397,9 @@ void MultiLineEditor::changeWrapMode( bool b ) if ( oldDoWrap ) textEdit->setProperty( "wordWrap", oldWrapMode ); else - textEdit->setWordWrap( QTextEdit::WidgetWidth ); + textEdit->setWordWrap( TQTextEdit::WidgetWidth ); } else { - textEdit->setWordWrap( QTextEdit::NoWrap ); + textEdit->setWordWrap( TQTextEdit::NoWrap ); } } |