summaryrefslogtreecommitdiffstats
path: root/ksirc/kstextview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ksirc/kstextview.cpp')
-rw-r--r--ksirc/kstextview.cpp314
1 files changed, 157 insertions, 157 deletions
diff --git a/ksirc/kstextview.cpp b/ksirc/kstextview.cpp
index deb7d6c4..2589e59a 100644
--- a/ksirc/kstextview.cpp
+++ b/ksirc/kstextview.cpp
@@ -20,12 +20,12 @@
#include "kstextview.h"
#include "stringparserstate.h"
-#include <qpainter.h>
-#include <qvaluestack.h>
-#include <qdragobject.h>
-#include <qtimer.h>
-#include <qclipboard.h>
-#include <qdict.h>
+#include <tqpainter.h>
+#include <tqvaluestack.h>
+#include <tqdragobject.h>
+#include <tqtimer.h>
+#include <tqclipboard.h>
+#include <tqdict.h>
#include <kcharsets.h>
#include <kapplication.h>
#include <kmimesourcefactory.h>
@@ -36,37 +36,37 @@
using namespace KSirc;
-typedef StringParserState<QChar> ParsingState;
+typedef StringParserState<TQChar> ParsingState;
static const int PaintBufferExtend = 128;
// temporary(!)
-static QDict<QPixmap> *ksTextViewPixmapDict = 0;
+static TQDict<TQPixmap> *ksTextViewPixmapDict = 0;
static void cleanupKSTextViewPixmapDict()
{
delete ksTextViewPixmapDict;
ksTextViewPixmapDict = 0;
}
-QPixmap ksTextViewLoadPixmap( const QString &icon )
+TQPixmap ksTextViewLoadPixmap( const TQString &icon )
{
if ( !ksTextViewPixmapDict )
{
- ksTextViewPixmapDict = new QDict<QPixmap>;
+ ksTextViewPixmapDict = new TQDict<TQPixmap>;
ksTextViewPixmapDict->setAutoDelete( true );
qAddPostRoutine( cleanupKSTextViewPixmapDict );
}
- QPixmap *pix = ksTextViewPixmapDict->find( icon );
+ TQPixmap *pix = ksTextViewPixmapDict->find( icon );
if ( !pix )
{
- QImage img;
+ TQImage img;
- const QMimeSource *src = kapp->mimeSourceFactory()->data( icon, QString::null );
- if ( !src || !QImageDrag::decode( src, img ) || img.isNull() )
- return QPixmap();
+ const TQMimeSource *src = kapp->mimeSourceFactory()->data( icon, TQString::null );
+ if ( !src || !TQImageDrag::decode( src, img ) || img.isNull() )
+ return TQPixmap();
- pix = new QPixmap( img );
+ pix = new TQPixmap( img );
ksTextViewPixmapDict->insert( icon, pix );
}
return *pix;
@@ -153,11 +153,11 @@ Item *Item::create( TextParag *parag, const Token &tok, const ItemProperties &pr
if ( tok.value == "img" )
{
- QString url = CONSTSTRING( tok.attributes[ "src" ] );
+ TQString url = CONSTSTRING( tok.attributes[ "src" ] );
if ( url.isEmpty() )
return 0;
- QPixmap pixmap = ksTextViewLoadPixmap( url );
+ TQPixmap pixmap = ksTextViewLoadPixmap( url );
if ( pixmap.isNull() )
return 0;
@@ -178,7 +178,7 @@ TextChunk::TextChunk( TextParag *parag, const StringPtr &text, const ItemPropert
{
}
-void TextChunk::paint( QPainter &p )
+void TextChunk::paint( TQPainter &p )
{
p.setFont( m_props.font );
@@ -276,8 +276,8 @@ int TextChunk::calcSelectionOffset( int x )
{
// ### how to optimize?
- QConstString tmp( m_text.ptr, m_text.len );
- const QString &s = tmp.string();
+ TQConstString tmp( m_text.ptr, m_text.len );
+ const TQString &s = tmp.string();
uint i = 0;
int px = 0;
@@ -302,13 +302,13 @@ StringPtr TextChunk::text() const
void TextChunk::setProps( const ItemProperties &props )
{
Item::setProps( props );
- m_metrics = QFontMetrics( props.font );
+ m_metrics = TQFontMetrics( props.font );
}
void TextChunk::calcExtends() const
{
- QConstString tmp( m_text.ptr, m_text.len );
- const QString &text = tmp.string();
+ TQConstString tmp( m_text.ptr, m_text.len );
+ const TQString &text = tmp.string();
m_width = m_metrics.width( text );
m_height = m_metrics.lineSpacing();
@@ -334,8 +334,8 @@ void TextChunk::calcExtends() const
StringPtr TextChunk::breakInTheMiddle( int width )
{
- QConstString tmp( m_text.ptr, m_text.len );
- const QString &s = tmp.string();
+ TQConstString tmp( m_text.ptr, m_text.len );
+ const TQString &s = tmp.string();
uint i = 0;
for (; i < m_text.len; ++i )
@@ -396,7 +396,7 @@ Item *TextChunk::hardBreak( const StringPtr &rightHandSide )
return chunk;
}
-void TextChunk::paintSelection( QPainter &p )
+void TextChunk::paintSelection( TQPainter &p )
{
int selectionStart = 0;
int selectionEnd = 0;
@@ -426,14 +426,14 @@ void TextChunk::paintSelection( QPainter &p )
}
}
-int TextChunk::paintSelection( QPainter &p, int x, const StringPtr &text )
+int TextChunk::paintSelection( TQPainter &p, int x, const StringPtr &text )
{
- QConstString constString( text.ptr, text.len );
- const QString &str = constString.string();
+ TQConstString constString( text.ptr, text.len );
+ const TQString &str = constString.string();
const int width = m_metrics.width( str );
- const QColorGroup &cg = m_parag->textView()->colorGroup();
+ const TQColorGroup &cg = m_parag->textView()->colorGroup();
if (m_props.bgSelColor.isValid())
p.fillRect( x, 0, width, height(), m_props.bgSelColor );
@@ -450,10 +450,10 @@ int TextChunk::paintSelection( QPainter &p, int x, const StringPtr &text )
return width;
}
-int TextChunk::paintText( QPainter &p, int x, const StringPtr &text )
+int TextChunk::paintText( TQPainter &p, int x, const StringPtr &text )
{
- QConstString constString( text.ptr, text.len );
- const QString &str = constString.string();
+ TQConstString constString( text.ptr, text.len );
+ const TQString &str = constString.string();
const int width = m_metrics.width( str );
@@ -489,12 +489,12 @@ void TextChunk::mergeSelection( TextChunk *child, SelectionPoint *selection )
m_selection = child->selectionStatus();
}
-ImageItem::ImageItem( TextParag *parag, const QPixmap &pixmap )
+ImageItem::ImageItem( TextParag *parag, const TQPixmap &pixmap )
: Item( parag ), m_pixmap( pixmap )
{
}
-void ImageItem::paint( QPainter &painter )
+void ImageItem::paint( TQPainter &painter )
{
int y = 0;
if(m_line) {
@@ -512,7 +512,7 @@ void ImageItem::paint( QPainter &painter )
if (m_props.bgSelColor.isValid())
painter.fillRect( 0, 0, width(), h, m_props.bgSelColor );
else {
- const QColorGroup &cg = m_parag->textView()->colorGroup();
+ const TQColorGroup &cg = m_parag->textView()->colorGroup();
painter.fillRect( 0, 0, width(), h, cg.highlight() );
}
}
@@ -549,7 +549,7 @@ Tokenizer::Tokenizer( PString &text )
}
}
-Tokenizer::PString Tokenizer::preprocess( const QString &richText )
+Tokenizer::PString Tokenizer::preprocess( const TQString &richText )
{
PString result;
result.data = richText;
@@ -558,12 +558,12 @@ Tokenizer::PString Tokenizer::preprocess( const QString &richText )
return result;
}
-QString Tokenizer::convertToRichText( const PString &ptext )
+TQString Tokenizer::convertToRichText( const PString &ptext )
{
if ( ptext.tags.isEmpty() )
return ptext.data;
- QString result = ptext.data;
+ TQString result = ptext.data;
uint i = 0;
TagIndexList tags = ptext.tags;
TagIndexList::Iterator it = tags.begin();
@@ -578,13 +578,13 @@ QString Tokenizer::convertToRichText( const PString &ptext )
}
unsigned short indexAdjustment = 0;
- const QChar ch = result[ i ];
+ const TQChar ch = result[ i ];
// ### incomplete!
/* this doesn't work quite right (when resolving back
* KCharSet's fromEntity breaks)
if ( ch == '<' || ch == '>' || ch == '&' )
{
- QString entity = KGlobal::charsets()->toEntity( ch );
+ TQString entity = KGlobal::charsets()->toEntity( ch );
indexAdjustment = entity.length() - 1;
result.replace( i, 1, entity );
}
@@ -676,7 +676,7 @@ bool Tokenizer::parseNextToken( Token &tok )
if ( lastType == TagIndex::Open &&
type == TagIndex::Close )
{
- const QChar *tagStart = m_text.unicode() + lastIndex + 1;
+ const TQChar *tagStart = m_text.unicode() + lastIndex + 1;
uint tagLen = ( index - 1 ) - ( lastIndex + 1 ) + 1;
// </bleh> ?
if ( *tagStart == '/' )
@@ -713,11 +713,11 @@ bool Tokenizer::parseNextToken( Token &tok )
return false;
}
-Tokenizer::TagIndexList Tokenizer::scanTagIndices( const QString &text )
+Tokenizer::TagIndexList Tokenizer::scanTagIndices( const TQString &text )
{
- const QChar *start = text.unicode();
- const QChar *p = start;
- const QChar *endP = p + text.length();
+ const TQChar *start = text.unicode();
+ const TQChar *p = start;
+ const TQChar *endP = p + text.length();
bool quoted = false;
bool inTag = false;
@@ -725,7 +725,7 @@ Tokenizer::TagIndexList Tokenizer::scanTagIndices( const QString &text )
for (; p < endP; ++p )
{
- const QChar ch = *p;
+ const TQChar ch = *p;
if ( ch == '"' && inTag )
{
quoted = quoted ? false : true;
@@ -752,13 +752,13 @@ Tokenizer::TagIndexList Tokenizer::scanTagIndices( const QString &text )
return tags;
}
-void Tokenizer::resolveEntities( QString &text, TagIndexList &tags )
+void Tokenizer::resolveEntities( TQString &text, TagIndexList &tags )
{
- const QChar *p = text.unicode();
- const QChar *endP = p + text.length();
+ const TQChar *p = text.unicode();
+ const TQChar *endP = p + text.length();
uint i = 0;
bool scanForSemicolon = false;
- const QChar *ampersand = 0;
+ const TQChar *ampersand = 0;
TagIndexList::Iterator tagInfoIt = tags.begin();
TagIndexList::Iterator tagsEnd = tags.end();
@@ -768,7 +768,7 @@ void Tokenizer::resolveEntities( QString &text, TagIndexList &tags )
i > (*tagInfoIt).index )
++tagInfoIt;
- const QChar ch = *p;
+ const TQChar ch = *p;
if ( ch == '&' ) {
ampersand = p;
@@ -783,13 +783,13 @@ void Tokenizer::resolveEntities( QString &text, TagIndexList &tags )
scanForSemicolon = false;
- const QChar *entityBegin = ampersand + 1;
+ const TQChar *entityBegin = ampersand + 1;
const uint entityLength = p - entityBegin;
if ( entityLength == 0 )
continue;
- const QChar entityValue = KCharsets::fromEntity( QConstString( entityBegin, entityLength ).string() );
+ const TQChar entityValue = KCharsets::fromEntity( TQConstString( entityBegin, entityLength ).string() );
if ( entityValue.isNull() )
continue;
@@ -818,9 +818,9 @@ void Tokenizer::parseTag( const StringPtr &text,
attributes.clear();
tag = StringPtr();
- const QChar *p = text.ptr;
- const QChar *endP = p + text.len;
- const QChar *start = p;
+ const TQChar *p = text.ptr;
+ const TQChar *endP = p + text.len;
+ const TQChar *start = p;
int state = ScanForName;
@@ -828,7 +828,7 @@ void Tokenizer::parseTag( const StringPtr &text,
while ( p < endP )
{
- const QChar ch = *p;
+ const TQChar ch = *p;
if ( ch == ' ' )
{
@@ -889,7 +889,7 @@ void Tokenizer::parseTag( const StringPtr &text,
continue;
}
- const QChar *valueEnd = p;
+ const TQChar *valueEnd = p;
StringPtr value = StringPtr( start, valueEnd - start );
attributes[ key ] = value;
@@ -934,7 +934,7 @@ ItemProperties::ItemProperties()
{
}
-ItemProperties::ItemProperties( const QFont &defaultFont )
+ItemProperties::ItemProperties( const TQFont &defaultFont )
: font( defaultFont ), reversed( false )
{
}
@@ -975,7 +975,7 @@ ItemProperties::ItemProperties( const ItemProperties &other,
StringPtr colAttr = attributes[ "color" ];
if ( !colAttr.isNull() )
{
- QColor col( CONSTSTRING( colAttr ) );
+ TQColor col( CONSTSTRING( colAttr ) );
if ( col.isValid() ){
if(!reversed)
color = col;
@@ -986,7 +986,7 @@ ItemProperties::ItemProperties( const ItemProperties &other,
colAttr = attributes[ "bgcolor" ];
if ( !colAttr.isNull() )
{
- QColor col( CONSTSTRING( colAttr ) );
+ TQColor col( CONSTSTRING( colAttr ) );
if ( col.isValid() ) {
if(!reversed)
bgColor = col;
@@ -1019,9 +1019,9 @@ ItemProperties &ItemProperties::operator=( const ItemProperties &rhs )
return *this;
}
-void ItemProperties::updateFont( const QFont &newFont )
+void ItemProperties::updateFont( const TQFont &newFont )
{
- QFont f = newFont;
+ TQFont f = newFont;
f.setUnderline( font.underline() );
f.setBold( font.bold() );
f.setItalic( font.italic() );
@@ -1034,25 +1034,25 @@ TextLine::TextLine()
m_items.setAutoDelete( true );
}
-TextLine::TextLine( const QPtrList<Item> &items )
+TextLine::TextLine( const TQPtrList<Item> &items )
: m_maxHeight( 0 )
{
m_items.setAutoDelete( true );
assert( !items.autoDelete() );
- QPtrListIterator<Item> it( items );
+ TQPtrListIterator<Item> it( items );
for (; it.current(); ++it )
appendItem( it.current(), UpdateMaxHeight );
}
-QString TextLine::updateSelection( const SelectionPoint &start, const SelectionPoint &end )
+TQString TextLine::updateSelection( const SelectionPoint &start, const SelectionPoint &end )
{
- QString selectedText;
+ TQString selectedText;
// fixes a crash where because of an empty list i becomes null
if ( m_items.isEmpty() )
- return QString::null;
+ return TQString::null;
if ( start.line == this )
{
@@ -1085,7 +1085,7 @@ QString TextLine::updateSelection( const SelectionPoint &start, const SelectionP
StringPtr txt = i->text();
if ( !txt.isNull() )
- selectedText += QString( txt.ptr + start.offset,
+ selectedText += TQString( txt.ptr + start.offset,
txt.len - start.offset );
}
else if ( i == end.item )
@@ -1094,7 +1094,7 @@ QString TextLine::updateSelection( const SelectionPoint &start, const SelectionP
StringPtr txt = i->text();
if ( !txt.isNull() )
- selectedText += QString( txt.ptr, end.offset + 1 );
+ selectedText += TQString( txt.ptr, end.offset + 1 );
}
else
{
@@ -1123,13 +1123,13 @@ void TextLine::appendItem( Item *i, int layoutUpdatePolicy )
m_maxHeight = kMax( m_maxHeight, i->height() );
}
-Item *TextLine::resetLayout( QPtrList<Item> &remainingItems)
+Item *TextLine::resetLayout( TQPtrList<Item> &remainingItems)
{
Item *lastLineItem = m_items.getLast();
Item *it = m_items.first();
// We have to use the tobeDel structure or we call resetLayout on the Item
// twice for each item we want to delete
- QPtrList<Item> tobeDel;
+ TQPtrList<Item> tobeDel;
while ( it )
{
if ( it->resetLayout() == Item::KeepItem )
@@ -1143,9 +1143,9 @@ Item *TextLine::resetLayout( QPtrList<Item> &remainingItems)
return lastLineItem;
}
-void TextLine::paint( QPainter &p, int y )
+void TextLine::paint( TQPainter &p, int y )
{
- QPtrListIterator<Item> it( m_items );
+ TQPtrListIterator<Item> it( m_items );
int x = 0;
for (; it.current(); ++it )
{
@@ -1159,7 +1159,7 @@ void TextLine::paint( QPainter &p, int y )
Item *TextLine::itemAt( int px, SelectionPoint *selectionInfo,
Item::SelectionAccuracy accuracy )
{
- QPtrListIterator<Item> it( m_items );
+ TQPtrListIterator<Item> it( m_items );
int x = 0;
int width = 0;
for (; it.current(); ++it )
@@ -1193,18 +1193,18 @@ Item *TextLine::itemAt( int px, SelectionPoint *selectionInfo,
return 0;
}
-QString TextLine::plainText() const
+TQString TextLine::plainText() const
{
- QString res;
- QPtrListIterator<Item> it( m_items );
+ TQString res;
+ TQPtrListIterator<Item> it( m_items );
for (; it.current(); ++it )
res += it.current()->text().toQString();
return res;
}
-void TextLine::fontChange( const QFont &newFont )
+void TextLine::fontChange( const TQFont &newFont )
{
- QPtrListIterator<Item> it( m_items );
+ TQPtrListIterator<Item> it( m_items );
for (; it.current(); ++it )
{
ItemProperties props = it.current()->props();
@@ -1213,7 +1213,7 @@ void TextLine::fontChange( const QFont &newFont )
}
}
-TextParag::TextParag( TextView *textView, const QString &richText )
+TextParag::TextParag( TextView *textView, const TQString &richText )
: m_layouted( false ), m_height( 0 ), m_minWidth( 0 ),
m_textView( textView )
{
@@ -1227,7 +1227,7 @@ TextParag::~TextParag()
void TextParag::layout( int width )
{
- QPtrList<Item> items;
+ TQPtrList<Item> items;
TextLine *row = m_lines.first();
@@ -1249,7 +1249,7 @@ void TextParag::layout( int width )
SelectionPoint *selEnd = m_textView->selectionEnd();
assert( selStart && selEnd );
- QPtrListIterator<Item> it( items );
+ TQPtrListIterator<Item> it( items );
while ( it.current() )
{
m_minWidth = kMax( m_minWidth, it.current()->minWidth() );
@@ -1313,7 +1313,7 @@ void TextParag::layout( int width )
selEnd->parag == this )
{
// ### move to TextLine?
- QPtrListIterator<Item> it( line->iterator() );
+ TQPtrListIterator<Item> it( line->iterator() );
for (; it.current(); ++it )
{
if ( selStart->item == it.current() )
@@ -1327,7 +1327,7 @@ void TextParag::layout( int width )
m_layouted = true;
}
-void TextParag::paint( QPainter &p, int y, int maxY )
+void TextParag::paint( TQPainter &p, int y, int maxY )
{
TextLine *row = m_lines.first();
for (; row; row = m_lines.next() )
@@ -1374,9 +1374,9 @@ Item *TextParag::itemAt( int px, int py, SelectionPoint *selectionInfo,
return 0;
}
-QString TextParag::updateSelection( const SelectionPoint &start, const SelectionPoint &end )
+TQString TextParag::updateSelection( const SelectionPoint &start, const SelectionPoint &end )
{
- QString selectedText;
+ TQString selectedText;
// sanity check
// (don't put it lower because it changes the current list item)
@@ -1415,7 +1415,7 @@ void TextParag::clearSelection()
line->clearSelection();
}
-void TextParag::setRichText( const QString &richText )
+void TextParag::setRichText( const TQString &richText )
{
m_layouted = false;
m_height = 0;
@@ -1434,7 +1434,7 @@ void TextParag::setRichText( const QString &richText )
Token tok;
Token lastTextToken;
- QValueStack<Tag> tagStack;
+ TQValueStack<Tag> tagStack;
TextLine *line = new TextLine;
@@ -1500,25 +1500,25 @@ void TextParag::setRichText( const QString &richText )
m_lines.append( line );
}
-QString TextParag::plainText() const
+TQString TextParag::plainText() const
{
- QString result;
- QPtrListIterator<TextLine> it( m_lines );
+ TQString result;
+ TQPtrListIterator<TextLine> it( m_lines );
for (; it.current(); ++it )
result += it.current()->plainText();
return result;
}
-void TextParag::fontChange( const QFont &newFont )
+void TextParag::fontChange( const TQFont &newFont )
{
- QPtrListIterator<TextLine> it( m_lines );
+ TQPtrListIterator<TextLine> it( m_lines );
for (; it.current(); ++it )
it.current()->fontChange( newFont );
}
-ContentsPaintAlgorithm::ContentsPaintAlgorithm( const QPtrListIterator<TextParag> &paragIt,
- QWidget *viewport, QPixmap &paintBuffer,
- QPainter &painter, int clipX, int clipY,
+ContentsPaintAlgorithm::ContentsPaintAlgorithm( const TQPtrListIterator<TextParag> &paragIt,
+ TQWidget *viewport, TQPixmap &paintBuffer,
+ TQPainter &painter, int clipX, int clipY,
int clipHeight )
: m_paragIt( paragIt ), m_viewport( viewport ), m_paintBuffer( paintBuffer ),
m_painter( painter ), m_clipX( clipX ), m_clipY( clipY ), m_clipHeight( clipHeight ),
@@ -1539,7 +1539,7 @@ int ContentsPaintAlgorithm::goToFirstVisibleParagraph()
return y;
}
-int ContentsPaintAlgorithm::paint( QPainter &bufferedPainter, int currentY )
+int ContentsPaintAlgorithm::paint( TQPainter &bufferedPainter, int currentY )
{
const int startY = currentY;
@@ -1600,7 +1600,7 @@ void ContentsPaintAlgorithm::paint()
while ( y < yEnd )
{
m_paintBuffer.fill( m_viewport, 0, y );
- QPainter bufferedPainter( &m_paintBuffer );
+ TQPainter bufferedPainter( &m_paintBuffer );
bufferedPainter.translate( -m_clipX, -y );
int nextY = paint( bufferedPainter, y );
@@ -1613,8 +1613,8 @@ void ContentsPaintAlgorithm::paint()
}
}
-TextView::TextView( QWidget *parent, const char *name )
- : QScrollView( parent, name, WRepaintNoErase ),
+TextView::TextView( TQWidget *parent, const char *name )
+ : TQScrollView( parent, name, WRepaintNoErase ),
m_paintBuffer( PaintBufferExtend, PaintBufferExtend ),
m_selectionEndBeforeStart( false ), m_mousePressed( false ),
m_mmbPressed( false ),
@@ -1624,9 +1624,9 @@ TextView::TextView( QWidget *parent, const char *name )
m_parags.setAutoDelete( true );
viewport()->setBackgroundMode( PaletteBase );
viewport()->setMouseTracking( true );
- m_autoScrollTimer = new QTimer( this );
- connect(verticalScrollBar(), SIGNAL(valueChanged( int ) ),
- this, SLOT(scrolling( int )));
+ m_autoScrollTimer = new TQTimer( this );
+ connect(verticalScrollBar(), TQT_SIGNAL(valueChanged( int ) ),
+ this, TQT_SLOT(scrolling( int )));
setDragAutoScroll( false );
@@ -1637,7 +1637,7 @@ TextView::~TextView()
{
}
-void TextView::drawContents( QPainter *painter, int clipX, int clipY, int , int clipHeight )
+void TextView::drawContents( TQPainter *painter, int clipX, int clipY, int , int clipHeight )
{
if ( m_parags.isEmpty() )
return;
@@ -1645,7 +1645,7 @@ void TextView::drawContents( QPainter *painter, int clipX, int clipY, int , int
if ( m_paintBuffer.width() != visibleWidth() )
m_paintBuffer.resize( visibleWidth(), PaintBufferExtend );
- QPtrListIterator<TextParag> paragIt( m_parags );
+ TQPtrListIterator<TextParag> paragIt( m_parags );
ContentsPaintAlgorithm( paragIt,
viewport(), m_paintBuffer, *painter, clipX, clipY,
@@ -1653,9 +1653,9 @@ void TextView::drawContents( QPainter *painter, int clipX, int clipY, int , int
.paint();
}
-void TextView::viewportResizeEvent( QResizeEvent *ev )
+void TextView::viewportResizeEvent( TQResizeEvent *ev )
{
- QScrollView::viewportResizeEvent(ev);
+ TQScrollView::viewportResizeEvent(ev);
if ( ev->size().width() != ev->oldSize().width() )
layout();
@@ -1724,13 +1724,13 @@ void TextView::clear()
viewport()->erase();
}
-TextParagIterator TextView::appendParag( const QString &richText )
+TextParagIterator TextView::appendParag( const TQString &richText )
{
TextParag *parag = new TextParag( this, richText );
m_parags.append( parag );
layout( false );
scrollToBottom();
- QPtrListIterator<TextParag> it( m_parags );
+ TQPtrListIterator<TextParag> it( m_parags );
it.toLast();
return TextParagIterator( it );
}
@@ -1773,7 +1773,7 @@ void TextView::clearSelection( bool repaint )
m_selectionStart = SelectionPoint();
m_selectionEnd = SelectionPoint();
m_selectionEndBeforeStart = false;
- m_selectedText = QString::null;
+ m_selectedText = TQString::null;
clearSelectionInternal();
if ( repaint )
updateContents();
@@ -1781,16 +1781,16 @@ void TextView::clearSelection( bool repaint )
TextParagIterator TextView::firstParag() const
{
- return TextParagIterator( QPtrListIterator<TextParag>( m_parags ) );
+ return TextParagIterator( TQPtrListIterator<TextParag>( m_parags ) );
}
-QString TextView::plainText() const
+TQString TextView::plainText() const
{
if ( m_parags.isEmpty() )
- return QString::null;
+ return TQString::null;
- QString result;
- QPtrListIterator<TextParag> paragIt( m_parags );
+ TQString result;
+ TQPtrListIterator<TextParag> paragIt( m_parags );
while ( paragIt.current() )
{
result += paragIt.current()->plainText();
@@ -1802,19 +1802,19 @@ QString TextView::plainText() const
return result;
}
-QColor TextView::linkColor() const
+TQColor TextView::linkColor() const
{
return m_linkColor;
}
-void TextView::setLinkColor( const QColor &linkColor )
+void TextView::setLinkColor( const TQColor &linkColor )
{
m_linkColor = linkColor;
}
void TextView::copy()
{
- QApplication::clipboard()->setText( m_selectedText );
+ TQApplication::clipboard()->setText( m_selectedText );
}
void TextView::clearSelectionInternal()
@@ -1825,7 +1825,7 @@ void TextView::clearSelectionInternal()
p->clearSelection();
}
-void TextView::contentsMousePressEvent( QMouseEvent *ev )
+void TextView::contentsMousePressEvent( TQMouseEvent *ev )
{
if ( ev->button() & RightButton ) {
emitLinkClickedForMouseEvent( ev );
@@ -1855,7 +1855,7 @@ void TextView::contentsMousePressEvent( QMouseEvent *ev )
}
}
-void TextView::contentsMouseMoveEvent( QMouseEvent *ev )
+void TextView::contentsMouseMoveEvent( TQMouseEvent *ev )
{
if ( m_mousePressed && ev->state() == NoButton )
{
@@ -1864,14 +1864,14 @@ void TextView::contentsMouseMoveEvent( QMouseEvent *ev )
}
if ( m_mousePressed && !m_dragURL.isEmpty() &&
- ( m_dragStartPos - ev->pos() ).manhattanLength() > QApplication::startDragDistance() ) {
+ ( m_dragStartPos - ev->pos() ).manhattanLength() > TQApplication::startDragDistance() ) {
m_mousePressed = false;
- m_dragStartPos = QPoint();
+ m_dragStartPos = TQPoint();
startDrag();
- m_dragURL = QString::null;
+ m_dragURL = TQString::null;
return;
}
@@ -1934,26 +1934,26 @@ void TextView::contentsMouseMoveEvent( QMouseEvent *ev )
}
}
- QCursor c = KCursor::arrowCursor();
+ TQCursor c = KCursor::arrowCursor();
if ( viewport()->cursor().handle() != c.handle() )
viewport()->setCursor( c );
}
-void TextView::contentsMouseReleaseEvent( QMouseEvent *ev )
+void TextView::contentsMouseReleaseEvent( TQMouseEvent *ev )
{
stopAutoScroll();
bool clicked = (m_mousePressed || m_mmbPressed) &&
- (m_dragStartPos - ev->pos()).manhattanLength() < QApplication::startDragDistance();
+ (m_dragStartPos - ev->pos()).manhattanLength() < TQApplication::startDragDistance();
m_mousePressed = false;
m_mmbPressed = false;
- m_dragStartPos = QPoint();
- m_dragURL = QString::null;
+ m_dragStartPos = TQPoint();
+ m_dragURL = TQString::null;
m_selectionMaybeStart = SelectionPoint();
if ( (ev->button() & Qt::LeftButton) && !m_selectedText.isEmpty() )
- QApplication::clipboard()->setText( m_selectedText, QClipboard::Selection );
+ TQApplication::clipboard()->setText( m_selectedText, QClipboard::Selection );
if ( clicked ) {
emitLinkClickedForMouseEvent( ev );
@@ -1967,9 +1967,9 @@ void TextView::contentsMouseReleaseEvent( QMouseEvent *ev )
}
}
-void TextView::fontChange( const QFont & )
+void TextView::fontChange( const TQFont & )
{
- QPtrListIterator<TextParag> it( m_parags );
+ TQPtrListIterator<TextParag> it( m_parags );
for (; it.current(); ++it )
it.current()->fontChange( font() );
@@ -1978,7 +1978,7 @@ void TextView::fontChange( const QFont & )
void TextView::startDrag()
{
- QDragObject *dragObj = dragObject( m_dragURL );
+ TQDragObject *dragObj = dragObject( m_dragURL );
if ( !dragObj )
return;
@@ -1987,7 +1987,7 @@ void TextView::startDrag()
dragObj->drag();
}
-QDragObject *TextView::dragObject( const QString &dragURL )
+TQDragObject *TextView::dragObject( const TQString &dragURL )
{
#if KDE_IS_VERSION(3,1,92)
return new KURLDrag( KURL( dragURL ), viewport() );
@@ -1998,9 +1998,9 @@ QDragObject *TextView::dragObject( const QString &dragURL )
void TextView::autoScroll()
{
- QPoint cursor = viewport()->mapFromGlobal( QCursor::pos() );
+ TQPoint cursor = viewport()->mapFromGlobal( TQCursor::pos() );
- QPoint contentsPos = viewportToContents( cursor );
+ TQPoint contentsPos = viewportToContents( cursor );
cursor.rx() -= viewport()->x();
cursor.ry() -= viewport()->y();
@@ -2012,7 +2012,7 @@ void TextView::autoScroll()
}
}
-void TextView::emitLinkClickedForMouseEvent( QMouseEvent *ev )
+void TextView::emitLinkClickedForMouseEvent( TQMouseEvent *ev )
{
TextChunk *text = dynamic_cast<TextChunk *>( itemAt( ev->pos() ) );
if ( !text )
@@ -2028,16 +2028,16 @@ void TextView::emitLinkClickedForMouseEvent( QMouseEvent *ev )
void TextView::startAutoScroll()
{
if(m_autoScrollTimer->isActive() == false){
- connect( m_autoScrollTimer, SIGNAL( timeout() ),
- this, SLOT( autoScroll() ) );
+ connect( m_autoScrollTimer, TQT_SIGNAL( timeout() ),
+ this, TQT_SLOT( autoScroll() ) );
m_autoScrollTimer->start( 75, false );
}
}
void TextView::stopAutoScroll()
{
- disconnect( m_autoScrollTimer, SIGNAL( timeout() ),
- this, SLOT( autoScroll() ) );
+ disconnect( m_autoScrollTimer, TQT_SIGNAL( timeout() ),
+ this, TQT_SLOT( autoScroll() ) );
m_autoScrollTimer->stop();
}
@@ -2090,9 +2090,9 @@ SelectionPoint *TextView::selectionEnd()
return m_selectionEndBeforeStart ? &m_selectionStart : &m_selectionEnd;
}
-QString TextView::updateSelection( const SelectionPoint &start, const SelectionPoint &end )
+TQString TextView::updateSelection( const SelectionPoint &start, const SelectionPoint &end )
{
- QString selectedText;
+ TQString selectedText;
if ( start.item == end.item )
{
@@ -2104,7 +2104,7 @@ QString TextView::updateSelection( const SelectionPoint &start, const SelectionP
if ( start.pos.x() == end.pos.x() )
{
i->setSelectionStatus( Item::NoSelection );
- return QString::null;
+ return TQString::null;
}
i->setSelectionStatus( Item::SelectionBoth );
@@ -2114,7 +2114,7 @@ QString TextView::updateSelection( const SelectionPoint &start, const SelectionP
if ( t )
{
StringPtr text = t->text();
- selectedText = QString( text.ptr + start.offset, 1 );
+ selectedText = TQString( text.ptr + start.offset, 1 );
}
}
else
@@ -2127,10 +2127,10 @@ QString TextView::updateSelection( const SelectionPoint &start, const SelectionP
{
StringPtr text = t->text();
if (end.offset > start.offset)
- selectedText = QString( text.ptr + start.offset,
+ selectedText = TQString( text.ptr + start.offset,
end.offset - start.offset + 1 );
else
- selectedText = QString( text.ptr + end.offset,
+ selectedText = TQString( text.ptr + end.offset,
start.offset - end.offset + 1 );
}
@@ -2162,7 +2162,7 @@ void TextView::layout( bool force )
int contentsWidth = visibleWidth();
int width = contentsWidth;
- QPtrListIterator<TextParag> it( m_parags );
+ TQPtrListIterator<TextParag> it( m_parags );
for (; it.current(); ++it )
{
if ( !it.current()->isLayouted() || force )
@@ -2195,7 +2195,7 @@ void TextView::contentsChange(int heightChange, bool force)
}
-Item *TextView::itemAt( const QPoint &pos, SelectionPoint *selectionInfo,
+Item *TextView::itemAt( const TQPoint &pos, SelectionPoint *selectionInfo,
Item::SelectionAccuracy accuracy )
{
int px = pos.x();
@@ -2203,7 +2203,7 @@ Item *TextView::itemAt( const QPoint &pos, SelectionPoint *selectionInfo,
int y = 0;
int height = 0;
- QPtrListIterator<TextParag> it( m_parags );
+ TQPtrListIterator<TextParag> it( m_parags );
for (; it.current(); ++it )
{
height = it.current()->height();
@@ -2232,15 +2232,15 @@ Item *TextView::itemAt( const QPoint &pos, SelectionPoint *selectionInfo,
return 0;
}
-QString TextParagIterator::richText() const
+TQString TextParagIterator::richText() const
{
if ( atEnd() )
- return QString::null;
+ return TQString::null;
return Tokenizer::convertToRichText( m_paragIt.current()->processedRichText() );
}
-void TextParagIterator::setRichText( const QString &richText )
+void TextParagIterator::setRichText( const TQString &richText )
{
if ( atEnd() )
return;
@@ -2254,10 +2254,10 @@ void TextParagIterator::setRichText( const QString &richText )
textView->updateContents();
}
-QString TextParagIterator::plainText() const
+TQString TextParagIterator::plainText() const
{
if ( atEnd() )
- return QString::null;
+ return TQString::null;
return m_paragIt.current()->plainText();
}