summaryrefslogtreecommitdiffstats
path: root/kopete/kopete/chatwindow/chattexteditpart.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/kopete/chatwindow/chattexteditpart.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-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 'kopete/kopete/chatwindow/chattexteditpart.cpp')
-rw-r--r--kopete/kopete/chatwindow/chattexteditpart.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/kopete/kopete/chatwindow/chattexteditpart.cpp b/kopete/kopete/chatwindow/chattexteditpart.cpp
index bac31bcf..e284903d 100644
--- a/kopete/kopete/chatwindow/chattexteditpart.cpp
+++ b/kopete/kopete/chatwindow/chattexteditpart.cpp
@@ -28,10 +28,10 @@
#include <ktextedit.h>
#include <ksyntaxhighlighter.h>
-#include <qtimer.h>
-#include <qregexp.h>
+#include <tqtimer.h>
+#include <tqregexp.h>
-ChatTextEditPart::ChatTextEditPart( Kopete::ChatSession *session, QWidget *parent, const char *name )
+ChatTextEditPart::ChatTextEditPart( Kopete::ChatSession *session, TQWidget *parent, const char *name )
: KopeteRichTextEditPart( parent, name, session->protocol()->capabilities() ), m_session(session)
{
historyPos = -1;
@@ -43,30 +43,30 @@ ChatTextEditPart::ChatTextEditPart( Kopete::ChatSession *session, QWidget *paren
mComplete->setOrder( KCompletion::Weighted );
// set params on the edit widget
- edit()->setMinimumSize( QSize( 75, 20 ) );
- edit()->setWordWrap( QTextEdit::WidgetWidth );
- edit()->setWrapPolicy( QTextEdit::AtWhiteSpace );
- edit()->setAutoFormatting( QTextEdit::AutoNone );
+ edit()->setMinimumSize( TQSize( 75, 20 ) );
+ edit()->setWordWrap( TQTextEdit::WidgetWidth );
+ edit()->setWrapPolicy( TQTextEdit::AtWhiteSpace );
+ edit()->setAutoFormatting( TQTextEdit::AutoNone );
// some signals and slots connections
- connect( edit(), SIGNAL( textChanged()), this, SLOT( slotTextChanged() ) );
+ connect( edit(), TQT_SIGNAL( textChanged()), this, TQT_SLOT( slotTextChanged() ) );
// timers for typing notifications
- m_typingRepeatTimer = new QTimer(this, "m_typingRepeatTimer");
- m_typingStopTimer = new QTimer(this, "m_typingStopTimer");
-
- connect( m_typingRepeatTimer, SIGNAL( timeout() ), this, SLOT( slotRepeatTypingTimer() ) );
- connect( m_typingStopTimer, SIGNAL( timeout() ), this, SLOT( slotStoppedTypingTimer() ) );
-
- connect( session, SIGNAL( contactAdded(const Kopete::Contact*, bool) ),
- this, SLOT( slotContactAdded(const Kopete::Contact*) ) );
- connect( session, SIGNAL( contactRemoved(const Kopete::Contact*, const QString&, Kopete::Message::MessageFormat, bool) ),
- this, SLOT( slotContactRemoved(const Kopete::Contact*) ) );
- connect( session, SIGNAL( onlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus & , const Kopete::OnlineStatus &) ),
- this, SLOT( slotContactStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ) );
+ m_typingRepeatTimer = new TQTimer(this, "m_typingRepeatTimer");
+ m_typingStopTimer = new TQTimer(this, "m_typingStopTimer");
+
+ connect( m_typingRepeatTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotRepeatTypingTimer() ) );
+ connect( m_typingStopTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( slotStoppedTypingTimer() ) );
+
+ connect( session, TQT_SIGNAL( contactAdded(const Kopete::Contact*, bool) ),
+ this, TQT_SLOT( slotContactAdded(const Kopete::Contact*) ) );
+ connect( session, TQT_SIGNAL( contactRemoved(const Kopete::Contact*, const TQString&, Kopete::Message::MessageFormat, bool) ),
+ this, TQT_SLOT( slotContactRemoved(const Kopete::Contact*) ) );
+ connect( session, TQT_SIGNAL( onlineStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus & , const Kopete::OnlineStatus &) ),
+ this, TQT_SLOT( slotContactStatusChanged( Kopete::Contact *, const Kopete::OnlineStatus &, const Kopete::OnlineStatus & ) ) );
slotContactAdded( session->myself() );
- for ( QPtrListIterator<Kopete::Contact> it( session->members() ); it.current(); ++it )
+ for ( TQPtrListIterator<Kopete::Contact> it( session->members() ); it.current(); ++it )
slotContactAdded( *it );
}
@@ -101,7 +101,7 @@ bool ChatTextEditPart::autoSpellCheckEnabled() const
KDictSpellingHighlighter* ChatTextEditPart::spellHighlighter()
{
- QSyntaxHighlighter *qsh = edit()->syntaxHighlighter();
+ TQSyntaxHighlighter *qsh = edit()->syntaxHighlighter();
KDictSpellingHighlighter* kdsh = dynamic_cast<KDictSpellingHighlighter*>( qsh );
return kdsh;
}
@@ -112,9 +112,9 @@ class EvilTextEdit : public KTextEdit
{
public:
// grab the paragraph as plain text - very very evil.
- QString plainText( int para )
+ TQString plainText( int para )
{
- QString str = document()->paragAt( para )->string()->toString();
+ TQString str = document()->paragAt( para )->string()->toString();
// str includes an extra space on the end (from the newline character?) - remove it
return str.left( str.length() - 1 );
}
@@ -126,24 +126,24 @@ void ChatTextEditPart::complete()
edit()->getCursorPosition( &para, &parIdx);
// FIXME: strips out all formatting
- QString txt = static_cast<EvilTextEdit*>(edit())->plainText( para );
+ TQString txt = static_cast<EvilTextEdit*>(edit())->plainText( para );
if ( parIdx > 0 )
{
- int firstSpace = txt.findRev( QRegExp( QString::fromLatin1("\\s\\S+") ), parIdx - 1 ) + 1;
- int lastSpace = txt.find( QRegExp( QString::fromLatin1("[\\s\\:]") ), firstSpace );
+ int firstSpace = txt.findRev( TQRegExp( TQString::fromLatin1("\\s\\S+") ), parIdx - 1 ) + 1;
+ int lastSpace = txt.find( TQRegExp( TQString::fromLatin1("[\\s\\:]") ), firstSpace );
if( lastSpace == -1 )
lastSpace = txt.length();
- QString word = txt.mid( firstSpace, lastSpace - firstSpace );
- QString match;
+ TQString word = txt.mid( firstSpace, lastSpace - firstSpace );
+ TQString match;
kdDebug(14000) << k_funcinfo << word << " from '" << txt << "'" << endl;
if ( word != m_lastMatch )
{
match = mComplete->makeCompletion( word );
- m_lastMatch = QString::null;
+ m_lastMatch = TQString::null;
parIdx -= word.length();
}
else
@@ -154,11 +154,11 @@ void ChatTextEditPart::complete()
if ( !match.isNull() && !match.isEmpty() )
{
- QString rightText = txt.right( txt.length() - lastSpace );
+ TQString rightText = txt.right( txt.length() - lastSpace );
- if ( para == 0 && firstSpace == 0 && rightText[0] != QChar(':') )
+ if ( para == 0 && firstSpace == 0 && rightText[0] != TQChar(':') )
{
- rightText = match + QString::fromLatin1(": ") + rightText;
+ rightText = match + TQString::fromLatin1(": ") + rightText;
parIdx += 2;
}
else
@@ -172,7 +172,7 @@ void ChatTextEditPart::complete()
edit()->removeParagraph( para + 1 );
edit()->setCursorPosition( para, parIdx + match.length() );
edit()->setUpdatesEnabled( true );
- // must call this rather than update because QTextEdit is broken :(
+ // must call this rather than update because TQTextEdit is broken :(
edit()->updateContents();
m_lastMatch = match;
}
@@ -183,8 +183,8 @@ void ChatTextEditPart::complete()
}
}
-void ChatTextEditPart::slotPropertyChanged( Kopete::Contact*, const QString &key,
- const QVariant& oldValue, const QVariant &newValue )
+void ChatTextEditPart::slotPropertyChanged( Kopete::Contact*, const TQString &key,
+ const TQVariant& oldValue, const TQVariant &newValue )
{
if ( key == Kopete::Global::Properties::self()->nickName().key() )
{
@@ -195,19 +195,19 @@ void ChatTextEditPart::slotPropertyChanged( Kopete::Contact*, const QString &key
void ChatTextEditPart::slotContactAdded( const Kopete::Contact *contact )
{
- connect( contact, SIGNAL( propertyChanged( Kopete::Contact *, const QString &, const QVariant &, const QVariant & ) ),
- this, SLOT( slotPropertyChanged( Kopete::Contact *, const QString &, const QVariant &, const QVariant & ) ) ) ;
+ connect( contact, TQT_SIGNAL( propertyChanged( Kopete::Contact *, const TQString &, const TQVariant &, const TQVariant & ) ),
+ this, TQT_SLOT( slotPropertyChanged( Kopete::Contact *, const TQString &, const TQVariant &, const TQVariant & ) ) ) ;
- QString contactName = contact->property(Kopete::Global::Properties::self()->nickName()).value().toString();
+ TQString contactName = contact->property(Kopete::Global::Properties::self()->nickName()).value().toString();
mComplete->addItem( contactName );
}
void ChatTextEditPart::slotContactRemoved( const Kopete::Contact *contact )
{
- disconnect( contact, SIGNAL( propertyChanged( Kopete::Contact *, const QString &, const QVariant &, const QVariant & ) ),
- this, SLOT( slotPropertyChanged( Kopete::Contact *, const QString &, const QVariant &, const QVariant & ) ) ) ;
+ disconnect( contact, TQT_SIGNAL( propertyChanged( Kopete::Contact *, const TQString &, const TQVariant &, const TQVariant & ) ),
+ this, TQT_SLOT( slotPropertyChanged( Kopete::Contact *, const TQString &, const TQVariant &, const TQVariant & ) ) ) ;
- QString contactName = contact->property(Kopete::Global::Properties::self()->nickName()).value().toString();
+ TQString contactName = contact->property(Kopete::Global::Properties::self()->nickName()).value().toString();
mComplete->removeItem( contactName );
}
@@ -227,7 +227,7 @@ bool ChatTextEditPart::canSend()
bool reachableContactFound = false;
//TODO: does this perform badly in large / busy IRC channels? - no, doesn't seem to
- QPtrListIterator<Kopete::Contact> it ( members );
+ TQPtrListIterator<Kopete::Contact> it ( members );
for( ; it.current(); ++it )
{
if ( (*it)->isReachable() )
@@ -257,17 +257,17 @@ void ChatTextEditPart::slotContactStatusChanged( Kopete::Contact *, const Kopete
void ChatTextEditPart::sendMessage()
{
- QString txt = text( Qt::PlainText );
+ TQString txt = text( Qt::PlainText );
// avoid sending emtpy messages or enter keys (see bug 100334)
if ( txt.isEmpty() || txt == "\n" )
return;
- if ( m_lastMatch.isNull() && ( txt.find( QRegExp( QString::fromLatin1("^\\w+:\\s") ) ) > -1 ) )
+ if ( m_lastMatch.isNull() && ( txt.find( TQRegExp( TQString::fromLatin1("^\\w+:\\s") ) ) > -1 ) )
{ //no last match and it finds something of the form of "word:" at the start of a line
- QString search = txt.left( txt.find(':') );
+ TQString search = txt.left( txt.find(':') );
if( !search.isEmpty() )
{
- QString match = mComplete->makeCompletion( search );
+ TQString match = mComplete->makeCompletion( search );
if( !match.isNull() )
edit()->setText( txt.replace(0,search.length(),match) );
}
@@ -277,7 +277,7 @@ void ChatTextEditPart::sendMessage()
{
//FIXME: what is the next line for?
mComplete->addItem( m_lastMatch );
- m_lastMatch = QString::null;
+ m_lastMatch = TQString::null;
}
slotStoppedTypingTimer();
@@ -291,9 +291,9 @@ void ChatTextEditPart::sendMessage()
bool ChatTextEditPart::isTyping()
{
- QString txt = text( Qt::PlainText );
+ TQString txt = text( Qt::PlainText );
- //Make sure the message is empty. QString::isEmpty()
+ //Make sure the message is empty. TQString::isEmpty()
//returns false if a message contains just whitespace
//which is the reason why we strip the whitespace
return !txt.stripWhiteSpace().isEmpty();
@@ -322,7 +322,7 @@ void ChatTextEditPart::historyUp()
if ( historyList.empty() || historyPos == historyList.count() - 1 )
return;
- QString text = edit()->text();
+ TQString text = edit()->text();
bool empty = text.stripWhiteSpace().isEmpty();
// got text? save it
@@ -341,12 +341,12 @@ void ChatTextEditPart::historyUp()
historyPos++;
- QString newText = historyList[historyPos];
+ TQString newText = historyList[historyPos];
TextFormat format=edit()->textFormat();
edit()->setTextFormat(AutoText); //workaround bug 115690
edit()->setText( newText );
edit()->setTextFormat(format);
- edit()->moveCursor( QTextEdit::MoveEnd, false );
+ edit()->moveCursor( TQTextEdit::MoveEnd, false );
}
void ChatTextEditPart::historyDown()
@@ -354,7 +354,7 @@ void ChatTextEditPart::historyDown()
if ( historyList.empty() || historyPos == -1 )
return;
- QString text = edit()->text();
+ TQString text = edit()->text();
bool empty = text.stripWhiteSpace().isEmpty();
// got text? save it
@@ -365,7 +365,7 @@ void ChatTextEditPart::historyDown()
historyPos--;
- QString newText = ( historyPos >= 0 ? historyList[historyPos] : QString::null );
+ TQString newText = ( historyPos >= 0 ? historyList[historyPos] : TQString::null );
TextFormat format=edit()->textFormat();
@@ -375,10 +375,10 @@ void ChatTextEditPart::historyDown()
- edit()->moveCursor( QTextEdit::MoveEnd, false );
+ edit()->moveCursor( TQTextEdit::MoveEnd, false );
}
-void ChatTextEditPart::addText( const QString &text )
+void ChatTextEditPart::addText( const TQString &text )
{
edit()->insert( text );
}