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/ksview.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/ksview.cpp')
-rw-r--r-- | ksirc/ksview.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/ksirc/ksview.cpp b/ksirc/ksview.cpp index 12ac357e..d9cac283 100644 --- a/ksirc/ksview.cpp +++ b/ksirc/ksview.cpp @@ -18,12 +18,12 @@ // $Id$ -#include <qclipboard.h> -#include <qdatetime.h> -#include <qregexp.h> -#include <qdragobject.h> -#include <qvaluestack.h> -#include <qstylesheet.h> +#include <tqclipboard.h> +#include <tqdatetime.h> +#include <tqregexp.h> +#include <tqdragobject.h> +#include <tqvaluestack.h> +#include <tqstylesheet.h> #include <kapplication.h> #include <kdebug.h> @@ -42,17 +42,17 @@ #include "nickColourMaker.h" #include "ksircprocess.h" -KSircView::KSircView(KSircProcess *proc, QWidget *parent, const char *name) +KSircView::KSircView(KSircProcess *proc, TQWidget *parent, const char *name) : KSirc::TextView(parent, name), m_proc(proc) { m_acceptFiles = false; m_timestamps = false; viewport()->setAcceptDrops(true); clear(); - connect( this, SIGNAL( linkClicked( const QMouseEvent *, const QString & ) ), - this, SLOT( anchorClicked( const QMouseEvent *, const QString & ) ) ); + connect( this, TQT_SIGNAL( linkClicked( const TQMouseEvent *, const TQString & ) ), + this, TQT_SLOT( anchorClicked( const TQMouseEvent *, const TQString & ) ) ); - QPixmap background = ksopts->backgroundPixmap(); + TQPixmap background = ksopts->backgroundPixmap(); if ( !background.isNull() ) viewport()->setBackgroundPixmap( background ); @@ -70,21 +70,21 @@ void KSircView::clear() KSirc::TextView::clear(); } -QString KSircView::makeTimeStamp() +TQString KSircView::makeTimeStamp() { - QTime now = QTime::currentTime(); - QString timeStamp = QString::fromLatin1( "[%1:%2:%3] " ) - .arg( QString::number( now.hour() ).rightJustify( 2, '0' ) ) - .arg( QString::number( now.minute() ).rightJustify( 2, '0' ) ) - .arg( QString::number( now.second() ).rightJustify( 2, '0' ) ); + TQTime now = TQTime::currentTime(); + TQString timeStamp = TQString::fromLatin1( "[%1:%2:%3] " ) + .arg( TQString::number( now.hour() ).rightJustify( 2, '0' ) ) + .arg( TQString::number( now.minute() ).rightJustify( 2, '0' ) ) + .arg( TQString::number( now.second() ).rightJustify( 2, '0' ) ); return timeStamp; } -void KSircView::saveURL( const QString &url ) +void KSircView::saveURL( const TQString &url ) { KURL kurl( url ); - KFileDialog *dlg = new KFileDialog( QString::null, QString::null /*filter*/, this /*parent*/, "filedialog" /*name*/, true /*modal*/ ); + KFileDialog *dlg = new KFileDialog( TQString::null, TQString::null /*filter*/, this /*parent*/, "filedialog" /*name*/, true /*modal*/ ); dlg->setKeepLocation( true ); @@ -104,24 +104,24 @@ void KSircView::saveURL( const QString &url ) delete dlg; } -QString KSircView::addLine(const QString &pixmap, const QColor &color, const QString &_text) +TQString KSircView::addLine(const TQString &pixmap, const TQColor &color, const TQString &_text) { //kdDebug(5008) << "Start Text: " << _text << endl; - QString richText( "<font color=\"%1\">" ); + TQString richText( "<font color=\"%1\">" ); richText = richText.arg( color.name() ); if ( !pixmap.isEmpty() ) - richText.prepend( QString::fromLatin1( "<img src=\"%1\"></img>" ).arg( pixmap ) ); + richText.prepend( TQString::fromLatin1( "<img src=\"%1\"></img>" ).arg( pixmap ) ); - QString timeStamp = QString::fromLatin1( "<font color=\"%1\">%2</font>" ) + TQString timeStamp = TQString::fromLatin1( "<font color=\"%1\">%2</font>" ) .arg( ksopts->textColor.name() ) .arg( makeTimeStamp() ); m_timeStamps.append(timeStamp); if ( m_timestamps ) richText.prepend( timeStamp ); - QString text = QStyleSheet::escape(_text); + TQString text = TQStyleSheet::escape(_text); // ### a bit of a hack: turn '<nick> message' into // <span><nick><span> message' . span itself isn't supported but it @@ -130,30 +130,30 @@ QString KSircView::addLine(const QString &pixmap, const QColor &color, const QSt // 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" ) ); - - QRegExp nickCol( "~n(.+)~n" ); + 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" ) ); + + TQRegExp nickCol( "~n(.+)~n" ); nickCol.setMinimal(true); int pos; while( (pos = nickCol.search(text)) >= 0 ){ //kdDebug(5008) << "Found nick: " << nickCol.cap(1) << endl; - QString newText = nickCol.cap(1); + TQString newText = nickCol.cap(1); if( nickCol.cap(1) != m_proc->getNick()){ - QColor col = nickColourMaker::colourMaker()->findFg(nickCol.cap(1)); + TQColor col = nickColourMaker::colourMaker()->findFg(nickCol.cap(1)); - newText.prepend(QString("<font color=\"%1\">").arg(col.name())); + newText.prepend(TQString("<font color=\"%1\">").arg(col.name())); newText.append("</font>"); } else { - QColor col = ksopts->ownNickColor.name(); + TQColor col = ksopts->ownNickColor.name(); if( ! col.isValid()) nickColourMaker::colourMaker()->findFg(nickCol.cap(1)); - newText.prepend(QString("<font color=\"%1\">").arg(col.name())); + newText.prepend(TQString("<font color=\"%1\">").arg(col.name())); newText.append("</font>"); if(ksopts->ownNickBold){ newText.prepend("<b>"); @@ -199,11 +199,11 @@ QString KSircView::addLine(const QString &pixmap, const QColor &color, const QSt } if (parser.beeped()) { - KNotifyClient::event(winId(), QString::fromLatin1("BeepReceived"), + KNotifyClient::event(winId(), TQString::fromLatin1("BeepReceived"), i18n("Beep Received")); } - QString logText = parag.plainText(); + TQString logText = parag.plainText(); // append timestamp if it's not already there if ( ! m_timestamps ) logText.prepend( makeTimeStamp() ); @@ -211,20 +211,20 @@ QString KSircView::addLine(const QString &pixmap, const QColor &color, const QSt return logText + '\n'; } -void KSircView::addRichText(const QString &_text) +void KSircView::addRichText(const TQString &_text) { //kdDebug(5008) << "Start Text: " << _text << endl; - QString text = _text; + TQString text = _text; - QRegExp re("^(<font color=\"[^\"]+\">\\[[0-9:]+\\] </font>)"); - QString timeStamp; + TQRegExp re("^(<font color=\"[^\"]+\">\\[[0-9:]+\\] </font>)"); + TQString timeStamp; if(re.search(text) >= 0){ timeStamp = re.cap(1); } else { - timeStamp = QString::fromLatin1( "<font color=\"%1\">%2</font>" ) + timeStamp = TQString::fromLatin1( "<font color=\"%1\">%2</font>" ) .arg( ksopts->textColor.name() ) .arg( makeTimeStamp() ); if ( m_timestamps ) @@ -254,10 +254,10 @@ void KSircView::enableTimeStamps(bool enable) setUpdatesEnabled( false ); m_timestamps = enable; KSirc::TextParagIterator paragIt = firstParag(); - QStringList::ConstIterator timeStampIt = m_timeStamps.begin(); + TQStringList::ConstIterator timeStampIt = m_timeStamps.begin(); for (; !paragIt.atEnd(); ++paragIt, ++timeStampIt ) { - QString text = paragIt.richText(); + TQString text = paragIt.richText(); if ( enable ) text.prepend( *timeStampIt ); else @@ -268,7 +268,7 @@ void KSircView::enableTimeStamps(bool enable) updateContents(); } -void KSircView::anchorClicked(const QMouseEvent *ev, const QString &url) +void KSircView::anchorClicked(const TQMouseEvent *ev, const TQString &url) { if ( (ev->button() & LeftButton) && (ev->state() & ShiftButton ) ) saveURL( url ); @@ -301,43 +301,43 @@ void KSircView::anchorClicked(const QMouseEvent *ev, const QString &url) } } -void KSircView::openBrowser(const QString &url ) +void KSircView::openBrowser(const TQString &url ) { - (void) new KRun( KURL( url.startsWith("www") ? QString::fromLatin1("http://") + url : url)); + (void) new KRun( KURL( url.startsWith("www") ? TQString::fromLatin1("http://") + url : url)); } -void KSircView::copyLinkToClipboard( const QString &url ) +void KSircView::copyLinkToClipboard( const TQString &url ) { - QApplication::clipboard()->setText( url, QClipboard::Clipboard ); + TQApplication::clipboard()->setText( url, QClipboard::Clipboard ); } -QColor KSircView::ircColor(int code) +TQColor KSircView::ircColor(int code) { if (code >= 0 && code < 16) return ksopts->ircColors[code]; - return QColor(); + return TQColor(); } -void KSircView::contentsDragEnterEvent(QDragEnterEvent* event) +void KSircView::contentsDragEnterEvent(TQDragEnterEvent* event) { - event->accept((QTextDrag::canDecode(event) || + event->accept((TQTextDrag::canDecode(event) || (m_acceptFiles && KURLDrag::canDecode(event))) && (!event->source() || event->source() != viewport())); } -void KSircView::contentsDragMoveEvent(QDragMoveEvent* event) +void KSircView::contentsDragMoveEvent(TQDragMoveEvent* event) { event->accept(!event->source() || event->source() != viewport()); } -void KSircView::contentsDropEvent(QDropEvent* event) +void KSircView::contentsDropEvent(TQDropEvent* event) { - QStringList urls; - QString text; + TQStringList urls; + TQString text; if (m_acceptFiles && KURLDrag::decodeLocalFiles(event, urls)) emit urlsDropped(urls); - else if (QTextDrag::decode(event, text)) + else if (TQTextDrag::decode(event, text)) emit textDropped(text); } |