diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /ksirc/topic.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirc/topic.cpp')
-rw-r--r-- | ksirc/topic.cpp | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/ksirc/topic.cpp b/ksirc/topic.cpp index 9e0d8f3e..49334f43 100644 --- a/ksirc/topic.cpp +++ b/ksirc/topic.cpp @@ -8,12 +8,12 @@ #include "topic.h" -#include <qapplication.h> -#include <qtimer.h> -#include <qregexp.h> -#include <qlayout.h> -#include <qtextedit.h> -#include <qtooltip.h> +#include <tqapplication.h> +#include <tqtimer.h> +#include <tqregexp.h> +#include <tqlayout.h> +#include <tqtextedit.h> +#include <tqtooltip.h> #include <kapplication.h> #include <kdebug.h> @@ -28,27 +28,27 @@ #include "ksparser.h" -KSircTopic::KSircTopic( QWidget *parent, const char *name ) +KSircTopic::KSircTopic( TQWidget *parent, const char *name ) : KActiveLabel( parent, name ) { m_editor = 0; m_doEdit = false; m_height = 0; // setBackgroundColor( colorGroup().light() ); - setFrameStyle( QFrame::Panel | QFrame::Sunken ); - setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + setFrameStyle( TQFrame::Panel | TQFrame::Sunken ); + setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Fixed ) ); setTextFormat( RichText ); - setWordWrap(QTextEdit::NoWrap); + setWordWrap(TQTextEdit::NoWrap); doResize(); // setAlignment( alignment() | WordBreak ); } -void KSircTopic::setText( const QString &_text) +void KSircTopic::setText( const TQString &_text) { m_text = _text; /* save a raw copy for us */ - QString text = _text; + TQString text = _text; - QString richText( "<font color=\"%1\">" ); + TQString richText( "<font color=\"%1\">" ); richText = richText.arg( ksopts->textColor.name() ); text.replace('&', "&"); @@ -64,12 +64,12 @@ void KSircTopic::setText( const QString &_text) // according to UV Kochavi <[email protected]> , to prevent output like // '<nick message<' , which is supposedly a bug in Qt's reordering. The // same is done for [nick] and >nick< to catch queries. - QRegExp bidiRe( "^(<\\S+>)(.+)$" ); - text.replace( bidiRe, QString::fromLatin1( "<span>\\1</span>\\2" ) ); - QRegExp bidiRe2( "^(\\[\\S+\\])(.+)$" ); - text.replace( bidiRe2, QString::fromLatin1( "<span>\\1</span>\\2" ) ); - QRegExp bidiRe3( "^(>\\S+<)(.+)$" ); - text.replace( bidiRe3, QString::fromLatin1( "<span>\\1</span>\\2" ) ); + TQRegExp bidiRe( "^(<\\S+>)(.+)$" ); + text.replace( bidiRe, TQString::fromLatin1( "<span>\\1</span>\\2" ) ); + TQRegExp bidiRe2( "^(\\[\\S+\\])(.+)$" ); + text.replace( bidiRe2, TQString::fromLatin1( "<span>\\1</span>\\2" ) ); + TQRegExp bidiRe3( "^(>\\S+<)(.+)$" ); + text.replace( bidiRe3, TQString::fromLatin1( "<span>\\1</span>\\2" ) ); KSParser parser; richText += parser.parse( text ); @@ -82,12 +82,12 @@ void KSircTopic::setText( const QString &_text) } -void KSircTopic::contentsMouseDoubleClickEvent( QMouseEvent * ) +void KSircTopic::contentsMouseDoubleClickEvent( TQMouseEvent * ) { m_doEdit = true; } -void KSircTopic::contentsMouseReleaseEvent( QMouseEvent *e ) +void KSircTopic::contentsMouseReleaseEvent( TQMouseEvent *e ) { if ( m_doEdit ) { m_doEdit = false; @@ -99,12 +99,12 @@ void KSircTopic::contentsMouseReleaseEvent( QMouseEvent *e ) m_editor = new KSircTopicEditor( this ); - connect( m_editor, SIGNAL( returnPressed() ), - this, SLOT( setNewTopic() ) ); - connect( m_editor, SIGNAL( resized() ), - this, SLOT( slotEditResized() ) ); - connect( m_editor, SIGNAL( destroyed() ), - this, SLOT( doResize() ) ); + connect( m_editor, TQT_SIGNAL( returnPressed() ), + this, TQT_SLOT( setNewTopic() ) ); + connect( m_editor, TQT_SIGNAL( resized() ), + this, TQT_SLOT( slotEditResized() ) ); + connect( m_editor, TQT_SIGNAL( destroyed() ), + this, TQT_SLOT( doResize() ) ); /* * If you don't do this order @@ -116,7 +116,7 @@ void KSircTopic::contentsMouseReleaseEvent( QMouseEvent *e ) m_editor->show(); m_editor->setText( m_text ); - QToolTip::remove(this); + TQToolTip::remove(this); } KActiveLabel::contentsMouseReleaseEvent(e); @@ -124,7 +124,7 @@ void KSircTopic::contentsMouseReleaseEvent( QMouseEvent *e ) void KSircTopic::setNewTopic() { - QString topic = m_editor->text().stripWhiteSpace(); + TQString topic = m_editor->text().stripWhiteSpace(); /* * don't change the channel display @@ -132,9 +132,9 @@ void KSircTopic::setNewTopic() * from the server. If we can't set the topic * don't make it look like it was set */ - QTimer::singleShot( 0, m_editor, SLOT( close() ) ); - disconnect( m_editor, SIGNAL( resized() ), - this, SLOT( slotEditResized() ) ); + TQTimer::singleShot( 0, m_editor, TQT_SLOT( close() ) ); + disconnect( m_editor, TQT_SIGNAL( resized() ), + this, TQT_SLOT( slotEditResized() ) ); doResize(); emit topicChange( topic ); } @@ -149,18 +149,18 @@ void KSircTopic::doResize() { int h; - QFontMetrics metrics( currentFont() ); + TQFontMetrics metrics( currentFont() ); h = metrics.lineSpacing()+8; m_height = h; setFixedHeight( h ); - QToolTip::remove(this); - QStringList sep = QStringList::split(" ", m_text); + TQToolTip::remove(this); + TQStringList sep = TQStringList::split(" ", m_text); int len = 0; - QString brok; - QStringList::Iterator it = sep.begin(); + TQString brok; + TQStringList::Iterator it = sep.begin(); for(; it != sep.end(); ++it) { brok += *it + " "; len += (*it).length(); @@ -170,30 +170,30 @@ void KSircTopic::doResize() } } - QToolTip::add(this, brok); + TQToolTip::add(this, brok); } -void KSircTopic::fontChange(QFont &f) +void KSircTopic::fontChange(TQFont &f) { KActiveLabel::fontChange(f); doResize(); } -KSircTopicEditor::KSircTopicEditor( QWidget *parent, const char *name ) - : QTextEdit( parent, name ) +KSircTopicEditor::KSircTopicEditor( TQWidget *parent, const char *name ) + : TQTextEdit( parent, name ) { setWFlags( WDestructiveClose ); - setFocusPolicy( QWidget::ClickFocus ); - connect( this, SIGNAL( textChanged () ), this, SLOT( slotMaybeResize() ) ); + setFocusPolicy( TQWidget::ClickFocus ); + connect( this, TQT_SIGNAL( textChanged () ), this, TQT_SLOT( slotMaybeResize() ) ); } -void KSircTopicEditor::keyPressEvent( QKeyEvent *ev ) +void KSircTopicEditor::keyPressEvent( TQKeyEvent *ev ) { if ( ev->key() == Key_Escape ) { ev->accept(); - QTimer::singleShot( 0, this, SLOT( close() ) ); + TQTimer::singleShot( 0, this, TQT_SLOT( close() ) ); return; } else if ( ev->key() == Key_Return ) @@ -202,26 +202,26 @@ void KSircTopicEditor::keyPressEvent( QKeyEvent *ev ) emit returnPressed(); return; } - QTextEdit::keyPressEvent( ev ); + TQTextEdit::keyPressEvent( ev ); } -void KSircTopicEditor::focusOutEvent( QFocusEvent * ) +void KSircTopicEditor::focusOutEvent( TQFocusEvent * ) { // we don't want to quit editing when someone brings up QLE's popup // menu - if ( QFocusEvent::reason() == QFocusEvent::Popup ) + if ( TQFocusEvent::reason() == TQFocusEvent::Popup ) { - QWidget *focusw = qApp->focusWidget(); + TQWidget *focusw = qApp->focusWidget(); if ( focusw && m_popup && focusw == m_popup ) return; } - QTimer::singleShot( 0, this, SLOT( close() ) ); + TQTimer::singleShot( 0, this, TQT_SLOT( close() ) ); } -QPopupMenu *KSircTopicEditor::createPopupMenu( const QPoint &pos ) +TQPopupMenu *KSircTopicEditor::createPopupMenu( const TQPoint &pos ) { - QPopupMenu *popup = QTextEdit::createPopupMenu( pos ); + TQPopupMenu *popup = TQTextEdit::createPopupMenu( pos ); m_popup = popup; return popup; } @@ -229,13 +229,13 @@ QPopupMenu *KSircTopicEditor::createPopupMenu( const QPoint &pos ) void KSircTopicEditor::slotMaybeResize() { if(text().contains("\n")){ - QString s = text(); + TQString s = text(); s.replace('\n', " "); setText(s); setCursorPosition(0, s.length()); } - QFontMetrics metrics( currentFont() ); + TQFontMetrics metrics( currentFont() ); int h = metrics.lineSpacing() * lines()+8; setFixedHeight( h ); |