summaryrefslogtreecommitdiffstats
path: root/kopete/kopete/chatwindow/chatmessagepart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/kopete/chatwindow/chatmessagepart.cpp')
-rw-r--r--kopete/kopete/chatwindow/chatmessagepart.cpp366
1 files changed, 183 insertions, 183 deletions
diff --git a/kopete/kopete/chatwindow/chatmessagepart.cpp b/kopete/kopete/chatwindow/chatmessagepart.cpp
index 3cf70b8a..379ead44 100644
--- a/kopete/kopete/chatwindow/chatmessagepart.cpp
+++ b/kopete/kopete/chatwindow/chatmessagepart.cpp
@@ -26,15 +26,15 @@
#include <ctime>
// Qt includes
-#include <qclipboard.h>
-#include <qtooltip.h>
-#include <qrect.h>
-#include <qcursor.h>
-#include <qptrlist.h>
-#include <qregexp.h>
-#include <qvaluelist.h>
-#include <qtimer.h>
-#include <qstylesheet.h>
+#include <tqclipboard.h>
+#include <tqtooltip.h>
+#include <tqrect.h>
+#include <tqcursor.h>
+#include <tqptrlist.h>
+#include <tqregexp.h>
+#include <tqvaluelist.h>
+#include <tqtimer.h>
+#include <tqstylesheet.h>
// KHTML::DOM includes
#include <dom/dom_doc.h>
@@ -43,7 +43,7 @@
#include <dom/html_base.h>
#include <dom/html_document.h>
#include <dom/html_inline.h>
-#include <qurloperator.h>
+#include <tqurloperator.h>
// KDE includes
@@ -155,32 +155,32 @@ public:
Kopete::Message::MessageType latestType;
// Yep I know it will take memory, but I don't have choice
// to enable on-the-fly style changing.
- QValueList<Kopete::Message> allMessages;
+ TQValueList<Kopete::Message> allMessages;
};
class ChatMessagePart::ToolTip : public QToolTip
{
public:
- ToolTip( ChatMessagePart *c ) : QToolTip( c->view()->viewport() )
+ ToolTip( ChatMessagePart *c ) : TQToolTip( c->view()->viewport() )
{
m_chat = c;
}
- void maybeTip( const QPoint &/*p*/ )
+ void maybeTip( const TQPoint &/*p*/ )
{
// FIXME: it's wrong to look for the node under the mouse - this makes too many
// assumptions about how tooltips work. but there is no nodeAtPoint.
DOM::Node node = m_chat->nodeUnderMouse();
Kopete::Contact *contact = m_chat->contactFromNode( node );
- QString toolTipText;
+ TQString toolTipText;
if(node.isNull())
return;
// this tooltip is attached to the viewport widget, so translate the node's rect
// into its coordinates.
- QRect rect = node.getRect();
- rect = QRect( m_chat->view()->contentsToViewport( rect.topLeft() ),
+ TQRect rect = node.getRect();
+ rect = TQRect( m_chat->view()->contentsToViewport( rect.topLeft() ),
m_chat->view()->contentsToViewport( rect.bottomRight() ) );
if( contact )
@@ -213,7 +213,7 @@ private:
ChatMessagePart *m_chat;
};
-ChatMessagePart::ChatMessagePart( Kopete::ChatSession *mgr, QWidget *parent, const char *name)
+ChatMessagePart::ChatMessagePart( Kopete::ChatSession *mgr, TQWidget *parent, const char *name)
: KHTMLPart( parent, name ), d( new Private )
{
d->manager = mgr;
@@ -231,40 +231,40 @@ ChatMessagePart::ChatMessagePart( Kopete::ChatSession *mgr, QWidget *parent, con
// Write the template to KHTMLPart
writeTemplate();
- view()->setFocusPolicy( QWidget::NoFocus );
+ view()->setFocusPolicy( TQWidget::NoFocus );
d->tt=new ToolTip( this );
// It is not possible to drag and drop on our widget
view()->setAcceptDrops(false);
- connect( KopetePrefs::prefs(), SIGNAL(messageAppearanceChanged()),
- this, SLOT( slotAppearanceChanged() ) );
- connect( KopetePrefs::prefs(), SIGNAL(windowAppearanceChanged()),
- this, SLOT( slotRefreshView() ) );
- connect( KopetePrefs::prefs(), SIGNAL(styleChanged(const QString &)),
- this, SLOT( setStyle(const QString &) ) );
- connect( KopetePrefs::prefs(), SIGNAL(styleVariantChanged(const QString &)),
- this, SLOT( setStyleVariant(const QString &) ) );
+ connect( KopetePrefs::prefs(), TQT_SIGNAL(messageAppearanceChanged()),
+ this, TQT_SLOT( slotAppearanceChanged() ) );
+ connect( KopetePrefs::prefs(), TQT_SIGNAL(windowAppearanceChanged()),
+ this, TQT_SLOT( slotRefreshView() ) );
+ connect( KopetePrefs::prefs(), TQT_SIGNAL(styleChanged(const TQString &)),
+ this, TQT_SLOT( setStyle(const TQString &) ) );
+ connect( KopetePrefs::prefs(), TQT_SIGNAL(styleVariantChanged(const TQString &)),
+ this, TQT_SLOT( setStyleVariant(const TQString &) ) );
// Refresh the style if the display name change.
- connect( d->manager, SIGNAL(displayNameChanged()), this, SLOT(slotUpdateHeaderDisplayName()) );
- connect( d->manager, SIGNAL(photoChanged()), this, SLOT(slotUpdateHeaderPhoto()) );
+ connect( d->manager, TQT_SIGNAL(displayNameChanged()), this, TQT_SLOT(slotUpdateHeaderDisplayName()) );
+ connect( d->manager, TQT_SIGNAL(photoChanged()), this, TQT_SLOT(slotUpdateHeaderPhoto()) );
- connect ( browserExtension(), SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ),
- this, SLOT( slotOpenURLRequest( const KURL &, const KParts::URLArgs & ) ) );
+ connect ( browserExtension(), TQT_SIGNAL( openURLRequestDelayed( const KURL &, const KParts::URLArgs & ) ),
+ this, TQT_SLOT( slotOpenURLRequest( const KURL &, const KParts::URLArgs & ) ) );
- connect( this, SIGNAL(popupMenu(const QString &, const QPoint &)),
- this, SLOT(slotRightClick(const QString &, const QPoint &)) );
- connect( view(), SIGNAL(contentsMoving(int,int)),
- this, SLOT(slotScrollingTo(int,int)) );
+ connect( this, TQT_SIGNAL(popupMenu(const TQString &, const TQPoint &)),
+ this, TQT_SLOT(slotRightClick(const TQString &, const TQPoint &)) );
+ connect( view(), TQT_SIGNAL(contentsMoving(int,int)),
+ this, TQT_SLOT(slotScrollingTo(int,int)) );
//initActions
- d->copyAction = KStdAction::copy( this, SLOT(copy()), actionCollection() );
- d->saveAction = KStdAction::saveAs( this, SLOT(save()), actionCollection() );
- d->printAction = KStdAction::print( this, SLOT(print()),actionCollection() );
- d->closeAction = KStdAction::close( this, SLOT(slotCloseView()),actionCollection() );
- d->importEmoticon = new KAction( i18n( "Import Emoticon"), QString::fromLatin1( "importemot" ), 0, this, SLOT( slotImportEmoticon() ), actionCollection() );
- d->copyURLAction = new KAction( i18n( "Copy Link Address" ), QString::fromLatin1( "editcopy" ), 0, this, SLOT( slotCopyURL() ), actionCollection() );
+ d->copyAction = KStdAction::copy( this, TQT_SLOT(copy()), actionCollection() );
+ d->saveAction = KStdAction::saveAs( this, TQT_SLOT(save()), actionCollection() );
+ d->printAction = KStdAction::print( this, TQT_SLOT(print()),actionCollection() );
+ d->closeAction = KStdAction::close( this, TQT_SLOT(slotCloseView()),actionCollection() );
+ d->importEmoticon = new KAction( i18n( "Import Emoticon"), TQString::fromLatin1( "importemot" ), 0, this, TQT_SLOT( slotImportEmoticon() ), actionCollection() );
+ d->copyURLAction = new KAction( i18n( "Copy Link Address" ), TQString::fromLatin1( "editcopy" ), 0, this, TQT_SLOT( slotCopyURL() ), actionCollection() );
// read formatting override flags
readOverrides();
@@ -288,38 +288,38 @@ void ChatMessagePart::slotScrollingTo( int /*x*/, int y )
void ChatMessagePart::slotImportEmoticon()
{
- QString emoticonString = KInputDialog::getText( i18n("Import Emoticon"),
+ TQString emoticonString = KInputDialog::getText( i18n("Import Emoticon"),
i18n("<qt><img src=\"%1\"><br>Insert the string for the emoticon<br>separated by space if you want multiple strings</qt>").arg( d->activeElement.getAttribute("src").string() ) );
if (emoticonString.isNull() )
return;
- QString emo = d->activeElement.getAttribute("src").string();
- QString themeName = KopetePrefs::prefs()->iconTheme();
+ TQString emo = d->activeElement.getAttribute("src").string();
+ TQString themeName = KopetePrefs::prefs()->iconTheme();
KIO::copy(emo, KGlobal::dirs()->saveLocation( "emoticons", themeName, false ));
- QFile *fp = new QFile(KGlobal::dirs()->saveLocation( "emoticons", themeName, false ) + "/emoticons.xml");
+ TQFile *fp = new TQFile(KGlobal::dirs()->saveLocation( "emoticons", themeName, false ) + "/emoticons.xml");
- QDomDocument themeXml;
+ TQDomDocument themeXml;
if(!fp->exists() || !fp->open( IO_ReadOnly ) || !themeXml.setContent(fp))
return;
fp->close();
- QDomNode lc = themeXml.lastChild();
+ TQDomNode lc = themeXml.lastChild();
if(lc.isNull())
return;
- QDomElement emoticon = themeXml.createElement("emoticon");
- emoticon.setAttribute("file", QFileInfo(emo).baseName());
+ TQDomElement emoticon = themeXml.createElement("emoticon");
+ emoticon.setAttribute("file", TQFileInfo(emo).baseName());
lc.appendChild(emoticon);
- QStringList splitted = QStringList::split(" ", emoticonString);
- QStringList::const_iterator constIterator;
+ TQStringList splitted = TQStringList::split(" ", emoticonString);
+ TQStringList::const_iterator constIterator;
for(constIterator = splitted.begin(); constIterator != splitted.end(); constIterator++)
{
- QDomElement emotext = themeXml.createElement("string");
- QDomText txt = themeXml.createTextNode((*constIterator).stripWhiteSpace());
+ TQDomElement emotext = themeXml.createElement("string");
+ TQDomText txt = themeXml.createTextNode((*constIterator).stripWhiteSpace());
emotext.appendChild(txt);
emoticon.appendChild(emotext);
}
@@ -327,32 +327,32 @@ void ChatMessagePart::slotImportEmoticon()
if(!fp->open( IO_WriteOnly ))
return;
- QTextStream emoStream(fp);
+ TQTextStream emoStream(fp);
emoStream << themeXml.toString(4);
fp->close();
- QTimer::singleShot( 1500, Kopete::Emoticons::self(), SLOT( reload() ) );
+ TQTimer::singleShot( 1500, Kopete::Emoticons::self(), TQT_SLOT( reload() ) );
}
void ChatMessagePart::save()
{
- KFileDialog dlg( QString::null, QString::fromLatin1( "text/html text/plain" ), view(), "fileSaveDialog", false );
+ KFileDialog dlg( TQString::null, TQString::fromLatin1( "text/html text/plain" ), view(), "fileSaveDialog", false );
dlg.setCaption( i18n( "Save Conversation" ) );
dlg.setOperationMode( KFileDialog::Saving );
- if ( dlg.exec() != QDialog::Accepted )
+ if ( dlg.exec() != TQDialog::Accepted )
return;
KURL saveURL = dlg.selectedURL();
KTempFile tempFile;
tempFile.setAutoDelete( true );
- QFile* file = tempFile.file();
+ TQFile* file = tempFile.file();
- QTextStream stream ( file );
- stream.setEncoding(QTextStream::UnicodeUTF8);
+ TQTextStream stream ( file );
+ stream.setEncoding(TQTextStream::UnicodeUTF8);
- if ( dlg.currentFilter() == QString::fromLatin1( "text/plain" ) )
+ if ( dlg.currentFilter() == TQString::fromLatin1( "text/plain" ) )
{
- QValueList<Kopete::Message>::ConstIterator it, itEnd = d->allMessages.constEnd();
+ TQValueList<Kopete::Message>::ConstIterator it, itEnd = d->allMessages.constEnd();
for(it = d->allMessages.constBegin(); it != itEnd; ++it)
{
Kopete::Message tempMessage = *it;
@@ -392,7 +392,7 @@ void ChatMessagePart::pageDown()
void ChatMessagePart::slotOpenURLRequest(const KURL &url, const KParts::URLArgs &/*args*/)
{
kdDebug(14000) << k_funcinfo << "url=" << url.url() << endl;
- if ( url.protocol() == QString::fromLatin1("kopetemessage") )
+ if ( url.protocol() == TQString::fromLatin1("kopetemessage") )
{
Kopete::Contact *contact = d->manager->account()->contacts()[ url.host() ];
if ( contact )
@@ -413,14 +413,14 @@ void ChatMessagePart::readOverrides()
d->rtfOverride = KopetePrefs::prefs()->rtfOverride();
}
-void ChatMessagePart::setStyle( const QString &stylePath )
+void ChatMessagePart::setStyle( const TQString &stylePath )
{
// Create a new ChatWindowStyle
d->currentChatStyle = ChatWindowStyleManager::self()->getStyleFromPool(stylePath);
// Do the actual style switch
// Wait for the event loop before switching the style
- QTimer::singleShot( 0, this, SLOT(changeStyle()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(changeStyle()) );
}
void ChatMessagePart::setStyle( ChatWindowStyle *style )
@@ -430,14 +430,14 @@ void ChatMessagePart::setStyle( ChatWindowStyle *style )
// Do the actual style switch
// Wait for the event loop before switching the style
- QTimer::singleShot( 0, this, SLOT(changeStyle()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(changeStyle()) );
}
-void ChatMessagePart::setStyleVariant( const QString &variantPath )
+void ChatMessagePart::setStyleVariant( const TQString &variantPath )
{
- DOM::HTMLElement variantNode = document().getElementById( QString::fromUtf8("mainStyle") );
+ DOM::HTMLElement variantNode = document().getElementById( TQString::fromUtf8("mainStyle") );
if( !variantNode.isNull() )
- variantNode.setInnerText( QString("@import url(\"%1\");").arg(variantPath) );
+ variantNode.setInnerText( TQString("@import url(\"%1\");").arg(variantPath) );
}
void ChatMessagePart::slotAppearanceChanged()
@@ -459,10 +459,10 @@ void ChatMessagePart::appendMessage( Kopete::Message &message, bool restoring )
message.setBody( message.parsedBody() , Kopete::Message::ParsedHTML );
#ifdef STYLE_TIMETEST
- QTime beforeMessage = QTime::currentTime();
+ TQTime beforeMessage = TQTime::currentTime();
#endif
- QString formattedMessageHtml;
+ TQString formattedMessageHtml;
bool isConsecutiveMessage = false;
uint bufferLen = (uint)KopetePrefs::prefs()->chatViewBufferSize();
@@ -549,11 +549,11 @@ void ChatMessagePart::appendMessage( Kopete::Message &message, bool restoring )
// newMessageNode is common to both code path
// FIXME: Find a better than to create a dummy span.
- DOM::HTMLElement newMessageNode = document().createElement( QString::fromUtf8("span") );
+ DOM::HTMLElement newMessageNode = document().createElement( TQString::fromUtf8("span") );
newMessageNode.setInnerHTML( formattedMessageHtml );
// Find the insert Node
- DOM::HTMLElement insertNode = document().getElementById( QString::fromUtf8("insert") );
+ DOM::HTMLElement insertNode = document().getElementById( TQString::fromUtf8("insert") );
if( isConsecutiveMessage && !insertNode.isNull() )
{
@@ -593,16 +593,16 @@ void ChatMessagePart::appendMessage( Kopete::Message &message, bool restoring )
}
if ( !d->scrollPressed )
- QTimer::singleShot( 1, this, SLOT( slotScrollView() ) );
+ TQTimer::singleShot( 1, this, TQT_SLOT( slotScrollView() ) );
#ifdef STYLE_TIMETEST
- kdDebug(14000) << "Message time: " << beforeMessage.msecsTo( QTime::currentTime()) << endl;
+ kdDebug(14000) << "Message time: " << beforeMessage.msecsTo( TQTime::currentTime()) << endl;
#endif
}
void ChatMessagePart::slotRefreshView()
{
- DOM::HTMLElement kopeteNode = document().getElementById( QString::fromUtf8("KopeteStyle") );
+ DOM::HTMLElement kopeteNode = document().getElementById( TQString::fromUtf8("KopeteStyle") );
if( !kopeteNode.isNull() )
kopeteNode.setInnerText( styleHTML() );
@@ -613,28 +613,28 @@ void ChatMessagePart::slotRefreshView()
void ChatMessagePart::keepScrolledDown()
{
if ( !d->scrollPressed )
- QTimer::singleShot( 1, this, SLOT( slotScrollView() ) );
+ TQTimer::singleShot( 1, this, TQT_SLOT( slotScrollView() ) );
}
-const QString ChatMessagePart::styleHTML() const
+const TQString ChatMessagePart::styleHTML() const
{
KopetePrefs *p = KopetePrefs::prefs();
int fontSize = 0;
- QString fontSizeCss;
- // Use correct font size unit, depending of how the QFont was build.
+ TQString fontSizeCss;
+ // Use correct font size unit, depending of how the TQFont was build.
if( p->fontFace().pointSize() != -1 )
{
fontSize = p->fontFace().pointSize();
- fontSizeCss = QString::fromUtf8("%1pt;").arg(fontSize);
+ fontSizeCss = TQString::fromUtf8("%1pt;").arg(fontSize);
}
else if( p->fontFace().pixelSize() != -1 )
{
fontSize = p->fontFace().pixelSize();
- fontSizeCss = QString::fromUtf8("%1px;").arg(fontSize);
+ fontSizeCss = TQString::fromUtf8("%1px;").arg(fontSize);
}
- QString style = QString::fromLatin1(
+ TQString style = TQString::fromLatin1(
"body{background-color:%1;font-family:%2;font-size:%3;color:%4}"
"td{font-family:%5;font-size:%6;color:%7}"
"a{color:%8}a.visited{color:%9}"
@@ -682,15 +682,15 @@ Kopete::Contact *ChatMessagePart::contactFromNode( const DOM::Node &n ) const
if ( element.hasAttribute( "contactid" ) )
{
- QString contactId = element.getAttribute( "contactid" ).string();
- for ( QPtrListIterator<Kopete::Contact> it ( d->manager->members() ); it.current(); ++it )
+ TQString contactId = element.getAttribute( "contactid" ).string();
+ for ( TQPtrListIterator<Kopete::Contact> it ( d->manager->members() ); it.current(); ++it )
if ( (*it)->contactId() == contactId )
return *it;
}
else
{
- QString nick = element.innerText().string().stripWhiteSpace();
- for ( QPtrListIterator<Kopete::Contact> it ( d->manager->members() ); it.current(); ++it )
+ TQString nick = element.innerText().string().stripWhiteSpace();
+ for ( TQPtrListIterator<Kopete::Contact> it ( d->manager->members() ); it.current(); ++it )
if ( (*it)->property( Kopete::Global::Properties::self()->nickName().key() ).value().toString() == nick )
return *it;
}
@@ -698,7 +698,7 @@ Kopete::Contact *ChatMessagePart::contactFromNode( const DOM::Node &n ) const
return 0;
}
-void ChatMessagePart::slotRightClick( const QString &, const QPoint &point )
+void ChatMessagePart::slotRightClick( const TQString &, const TQPoint &point )
{
// look through parents until we find an Element
DOM::Node activeNode = nodeUnderMouse();
@@ -715,7 +715,7 @@ void ChatMessagePart::slotRightClick( const QString &, const QPoint &point )
if ( Kopete::Contact *contact = contactFromNode( d->activeElement ) )
{
chatWindowPopup = contact->popupMenu( d->manager );
- connect( chatWindowPopup, SIGNAL( aboutToHide() ), chatWindowPopup , SLOT( deleteLater() ) );
+ connect( chatWindowPopup, TQT_SIGNAL( aboutToHide() ), chatWindowPopup , TQT_SLOT( deleteLater() ) );
}
else
{
@@ -727,7 +727,7 @@ void ChatMessagePart::slotRightClick( const QString &, const QPoint &point )
chatWindowPopup->setItemEnabled( 1, false );
chatWindowPopup->insertSeparator();
}
- else if ( d->activeElement.tagName().lower() == QString::fromLatin1( "a" ) )
+ else if ( d->activeElement.tagName().lower() == TQString::fromLatin1( "a" ) )
{
d->copyURLAction->plug( chatWindowPopup );
chatWindowPopup->insertSeparator();
@@ -741,7 +741,7 @@ void ChatMessagePart::slotRightClick( const QString &, const QPoint &point )
chatWindowPopup->insertSeparator();
d->closeAction->plug( chatWindowPopup );
- connect( chatWindowPopup, SIGNAL( aboutToHide() ), chatWindowPopup, SLOT( deleteLater() ) );
+ connect( chatWindowPopup, TQT_SIGNAL( aboutToHide() ), chatWindowPopup, TQT_SLOT( deleteLater() ) );
chatWindowPopup->popup( point );
}
@@ -751,26 +751,26 @@ void ChatMessagePart::slotRightClick( const QString &, const QPoint &point )
chatWindowPopup->popup( point );
}
-QString ChatMessagePart::textUnderMouse()
+TQString ChatMessagePart::textUnderMouse()
{
DOM::Node activeNode = nodeUnderMouse();
if( activeNode.nodeType() != DOM::Node::TEXT_NODE )
- return QString::null;
+ return TQString::null;
DOM::Text textNode = activeNode;
- QString data = textNode.data().string();
+ TQString data = textNode.data().string();
//Ok, we have the whole node. Now, find the text under the mouse.
- int mouseLeft = view()->mapFromGlobal( QCursor::pos() ).x(),
+ int mouseLeft = view()->mapFromGlobal( TQCursor::pos() ).x(),
nodeLeft = activeNode.getRect().x(),
cPos = 0,
dataLen = data.length();
- QFontMetrics metrics( KopetePrefs::prefs()->fontFace() );
- QString buffer;
+ TQFontMetrics metrics( KopetePrefs::prefs()->fontFace() );
+ TQString buffer;
while( cPos < dataLen && nodeLeft < mouseLeft )
{
- QChar c = data[cPos++];
+ TQChar c = data[cPos++];
if( c.isSpace() )
buffer.truncate(0);
else
@@ -781,7 +781,7 @@ QString ChatMessagePart::textUnderMouse()
if( cPos < dataLen )
{
- QChar c = data[cPos++];
+ TQChar c = data[cPos++];
while( cPos < dataLen && !c.isSpace() )
{
buffer += c;
@@ -797,8 +797,8 @@ void ChatMessagePart::slotCopyURL()
DOM::HTMLAnchorElement a = d->activeElement;
if ( !a.isNull() )
{
- QApplication::clipboard()->setText( a.href().string(), QClipboard::Clipboard );
- QApplication::clipboard()->setText( a.href().string(), QClipboard::Selection );
+ TQApplication::clipboard()->setText( a.href().string(), QClipboard::Clipboard );
+ TQApplication::clipboard()->setText( a.href().string(), QClipboard::Selection );
}
}
@@ -818,8 +818,8 @@ void ChatMessagePart::copy(bool justselection /* default false */)
* This also copies the text as type text/html
* RangeImpl::toHTML was not implemented before KDE 3.4
*/
- QString text;
- QString htmltext;
+ TQString text;
+ TQString htmltext;
#if KDE_IS_VERSION(3,3,90)
htmltext = selectedTextAsHTML();
@@ -842,7 +842,7 @@ void ChatMessagePart::copy(bool justselection /* default false */)
{
if(n.nodeType() == DOM::Node::TEXT_NODE /*&& n.handle()->renderer()*/)
{
- QString str = n.nodeValue().string();
+ TQString str = n.nodeValue().string();
hasNewLine = false;
if(n == startNode && n == endNode)
text = str.mid(startOffset, endOffset - startOffset);
@@ -941,29 +941,29 @@ void ChatMessagePart::copy(bool justselection /* default false */)
if(text.isEmpty()) return;
- disconnect( kapp->clipboard(), SIGNAL( selectionChanged()), this, SLOT( slotClearSelection()));
+ disconnect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), this, TQT_SLOT( slotClearSelection()));
#ifndef QT_NO_MIMECLIPBOARD
if(!justselection)
{
- QTextDrag *textdrag = new QTextDrag(text, 0L);
+ TQTextDrag *textdrag = new TQTextDrag(text, 0L);
KMultipleDrag *drag = new KMultipleDrag( );
drag->addDragObject( textdrag );
if(!htmltext.isEmpty()) {
- htmltext.replace( QChar( 0xa0 ), ' ' );
- QTextDrag *htmltextdrag = new QTextDrag(htmltext, 0L);
+ htmltext.replace( TQChar( 0xa0 ), ' ' );
+ TQTextDrag *htmltextdrag = new TQTextDrag(htmltext, 0L);
htmltextdrag->setSubtype("html");
drag->addDragObject( htmltextdrag );
}
- QApplication::clipboard()->setData( drag, QClipboard::Clipboard );
+ TQApplication::clipboard()->setData( drag, QClipboard::Clipboard );
}
- QApplication::clipboard()->setText( text, QClipboard::Selection );
+ TQApplication::clipboard()->setText( text, QClipboard::Selection );
#else
if(!justselection)
- QApplication::clipboard()->setText( text, QClipboard::Clipboard );
- QApplication::clipboard()->setText( text, QClipboard::Selection );
+ TQApplication::clipboard()->setText( text, QClipboard::Clipboard );
+ TQApplication::clipboard()->setText( text, QClipboard::Selection );
#endif
- connect( kapp->clipboard(), SIGNAL( selectionChanged()), SLOT( slotClearSelection()));
+ connect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), TQT_SLOT( slotClearSelection()));
}
@@ -982,17 +982,17 @@ void ChatMessagePart::slotCloseView( bool force )
d->manager->view()->closeView( force );
}
-void ChatMessagePart::emitTooltipEvent( const QString &textUnderMouse, QString &toolTip )
+void ChatMessagePart::emitTooltipEvent( const TQString &textUnderMouse, TQString &toolTip )
{
emit tooltipEvent( textUnderMouse, toolTip );
}
// Style formatting for messages(incoming, outgoing, status)
-QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const Kopete::Message &_message )
+TQString ChatMessagePart::formatStyleKeywords( const TQString &sourceHTML, const Kopete::Message &_message )
{
Kopete::Message message=_message; //we will eventually need to modify it before showing it.
- QString resultHTML = sourceHTML;
- QString nick, contactId, service, protocolIcon, nickLink;
+ TQString resultHTML = sourceHTML;
+ TQString nick, contactId, service, protocolIcon, nickLink;
if( message.from() )
{
@@ -1014,8 +1014,8 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const K
//
// Use default if protocol() and protocol()->displayName() is NULL.
// For preview and unit tests.
- QString iconName = QString::fromUtf8("kopete");
- service = QString::fromUtf8("Kopete");
+ TQString iconName = TQString::fromUtf8("kopete");
+ service = TQString::fromUtf8("Kopete");
if(message.from()->protocol() && !message.from()->protocol()->displayName().isNull())
{
service = message.from()->protocol()->displayName();
@@ -1024,10 +1024,10 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const K
protocolIcon = KGlobal::iconLoader()->iconPath( iconName, KIcon::Small );
- nickLink=QString::fromLatin1("<a href=\"kopetemessage://%1/?protocolId=%2&amp;accountId=%3\" class=\"KopeteDisplayName\">")
- .arg( QStyleSheet::escape(message.from()->contactId()).replace('"',"&quot;"),
- QStyleSheet::escape(message.from()->protocol()->pluginId()).replace('"',"&quot;"),
- QStyleSheet::escape(message.from()->account()->accountId() ).replace('"',"&quot;"));
+ nickLink=TQString::fromLatin1("<a href=\"kopetemessage://%1/?protocolId=%2&amp;accountId=%3\" class=\"KopeteDisplayName\">")
+ .arg( TQStyleSheet::escape(message.from()->contactId()).replace('"',"&quot;"),
+ TQStyleSheet::escape(message.from()->protocol()->pluginId()).replace('"',"&quot;"),
+ TQStyleSheet::escape(message.from()->account()->accountId() ).replace('"',"&quot;"));
}
else
{
@@ -1036,22 +1036,22 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const K
// Replace sender (contact nick)
- resultHTML = resultHTML.replace( QString::fromUtf8("%sender%"), nickLink+nick+"</a>" );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%sender%"), nickLink+nick+"</a>" );
// Replace time, by default display only time and display seconds(that was true means).
- resultHTML = resultHTML.replace( QString::fromUtf8("%time%"), KGlobal::locale()->formatTime(message.timestamp().time(), true) );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%time%"), KGlobal::locale()->formatTime(message.timestamp().time(), true) );
// Replace %screenName% (contact ID)
- resultHTML = resultHTML.replace( QString::fromUtf8("%senderScreenName%"), nickLink+QStyleSheet::escape(contactId)+"</a>" );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%senderScreenName%"), nickLink+TQStyleSheet::escape(contactId)+"</a>" );
// Replace service name (protocol name)
- resultHTML = resultHTML.replace( QString::fromUtf8("%service%"), QStyleSheet::escape(service) );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%service%"), TQStyleSheet::escape(service) );
// Replace protocolIcon (sender statusIcon)
- resultHTML = resultHTML.replace( QString::fromUtf8("%senderStatusIcon%"), QStyleSheet::escape(protocolIcon).replace('"',"&quot;") );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%senderStatusIcon%"), TQStyleSheet::escape(protocolIcon).replace('"',"&quot;") );
// Look for %time{X}%
- QRegExp timeRegExp("%time\\{([^}]*)\\}%");
+ TQRegExp timeRegExp("%time\\{([^}]*)\\}%");
int pos=0;
while( (pos=timeRegExp.search(resultHTML , pos) ) != -1 )
{
- QString timeKeyword = formatTime( timeRegExp.cap(1), message.timestamp() );
+ TQString timeKeyword = formatTime( timeRegExp.cap(1), message.timestamp() );
resultHTML = resultHTML.replace( pos , timeRegExp.cap(0).length() , timeKeyword );
}
@@ -1059,13 +1059,13 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const K
// TODO: use the X value.
// Replace with user-selected highlight color if to be highlighted or
// with "inherit" otherwise to keep CSS clean
- QString bgColor = QString::fromUtf8("inherit");
+ TQString bgColor = TQString::fromUtf8("inherit");
if( message.importance() == Kopete::Message::Highlight && KopetePrefs::prefs()->highlightEnabled() )
{
bgColor = KopetePrefs::prefs()->highlightBackground().name();
}
- QRegExp textBackgroundRegExp("%textbackgroundcolor\\{([^}]*)\\}%");
+ TQRegExp textBackgroundRegExp("%textbackgroundcolor\\{([^}]*)\\}%");
int textPos=0;
while( (textPos=textBackgroundRegExp.search(resultHTML, textPos) ) != -1 )
{
@@ -1075,30 +1075,30 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const K
// Replace userIconPath
if( message.from() )
{
- QString photoPath;
+ TQString photoPath;
#if 0
photoPath = message.from()->property(Kopete::Global::Properties::self()->photo().key()).value().toString();
// If the photo path is empty, set the default buddy icon for the theme
if( photoPath.isEmpty() )
{
if(message.direction() == Kopete::Message::Inbound)
- photoPath = QString::fromUtf8("Incoming/buddy_icon.png");
+ photoPath = TQString::fromUtf8("Incoming/buddy_icon.png");
else if(message.direction() == Kopete::Message::Outbound)
- photoPath = QString::fromUtf8("Outgoing/buddy_icon.png");
+ photoPath = TQString::fromUtf8("Outgoing/buddy_icon.png");
}
#endif
if( !message.from()->metaContact()->picture().isNull() )
{
- photoPath = QString( "data:image/png;base64," ) + message.from()->metaContact()->picture().base64();
+ photoPath = TQString( "data:image/png;base64," ) + message.from()->metaContact()->picture().base64();
}
else
{
if(message.direction() == Kopete::Message::Inbound)
- photoPath = QString::fromUtf8("Incoming/buddy_icon.png");
+ photoPath = TQString::fromUtf8("Incoming/buddy_icon.png");
else if(message.direction() == Kopete::Message::Outbound)
- photoPath = QString::fromUtf8("Outgoing/buddy_icon.png");
+ photoPath = TQString::fromUtf8("Outgoing/buddy_icon.png");
}
- resultHTML = resultHTML.replace(QString::fromUtf8("%userIconPath%"), photoPath);
+ resultHTML = resultHTML.replace(TQString::fromUtf8("%userIconPath%"), photoPath);
}
// Replace messages.
@@ -1107,13 +1107,13 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const K
{
kdDebug(14000) << k_funcinfo << "Map Action message to Status template. " << endl;
- QString boldNick = QString::fromUtf8("%1<b>%2</b></a> ").arg(nickLink,nick);
- QString newBody = boldNick + message.parsedBody();
+ TQString boldNick = TQString::fromUtf8("%1<b>%2</b></a> ").arg(nickLink,nick);
+ TQString newBody = boldNick + message.parsedBody();
message.setBody(newBody, Kopete::Message::ParsedHTML );
}
// Set message direction("rtl"(Right-To-Left) or "ltr"(Left-to-right))
- resultHTML = resultHTML.replace( QString::fromUtf8("%messageDirection%"), message.isRightToLeft() ? "rtl" : "ltr" );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%messageDirection%"), message.isRightToLeft() ? "rtl" : "ltr" );
// These colors are used for coloring nicknames. I tried to use
// colors both visible on light and dark background.
@@ -1131,10 +1131,10 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const K
int hash = 0;
for( uint f = 0; f < contactId.length(); ++f )
hash += contactId[f].unicode() * f;
- const QString colorName = nameColors[ hash % nameColorsLen ];
- QString lightColorName; // Do not initialize, QColor::name() is expensive!
+ const TQString colorName = nameColors[ hash % nameColorsLen ];
+ TQString lightColorName; // Do not initialize, TQColor::name() is expensive!
kdDebug(14000) << k_funcinfo << "Hash " << hash << " has color " << colorName << endl;
- QRegExp senderColorRegExp("%senderColor(?:\\{([^}]*)\\})?%");
+ TQRegExp senderColorRegExp("%senderColor(?:\\{([^}]*)\\})?%");
textPos=0;
while( (textPos=senderColorRegExp.search(resultHTML, textPos) ) != -1 )
{
@@ -1147,14 +1147,14 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const K
// Lazily init light color
if ( doLight && lightColorName.isNull() )
- lightColorName = QColor( colorName ).light( light ).name();
+ lightColorName = TQColor( colorName ).light( light ).name();
resultHTML = resultHTML.replace( textPos , senderColorRegExp.cap(0).length(),
doLight ? lightColorName : colorName );
}
// Replace message at the end, maybe someone could put a Adium keyword in his message :P
- resultHTML = resultHTML.replace( QString::fromUtf8("%message%"), formatMessageBody(message) );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%message%"), formatMessageBody(message) );
// TODO: %status
// resultHTML = addNickLinks( resultHTML );
@@ -1162,16 +1162,16 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML, const K
}
// Style formatting for header and footer.
-QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML )
+TQString ChatMessagePart::formatStyleKeywords( const TQString &sourceHTML )
{
- QString resultHTML = sourceHTML;
+ TQString resultHTML = sourceHTML;
Kopete::Contact *remoteContact = d->manager->members().getFirst();
// Verify that all contacts are not null before doing anything
if( remoteContact && d->manager->myself() )
{
- QString sourceName, destinationName;
+ TQString sourceName, destinationName;
// Use contact nickname for ourselfs, Myself metacontact display name isn't a reliable source.
sourceName = d->manager->myself()->nickName();
if( remoteContact->metaContact() )
@@ -1180,64 +1180,64 @@ QString ChatMessagePart::formatStyleKeywords( const QString &sourceHTML )
destinationName = remoteContact->nickName();
// Replace %chatName%, create a internal span to update it by DOM when asked.
- resultHTML = resultHTML.replace( QString::fromUtf8("%chatName%"), QString("<span id=\"KopeteHeaderChatNameInternal\">%1</span>").arg( formatName(d->manager->displayName()) ) );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%chatName%"), TQString("<span id=\"KopeteHeaderChatNameInternal\">%1</span>").arg( formatName(d->manager->displayName()) ) );
// Replace %sourceName%
- resultHTML = resultHTML.replace( QString::fromUtf8("%sourceName%"), formatName(sourceName) );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%sourceName%"), formatName(sourceName) );
// Replace %destinationName%
- resultHTML = resultHTML.replace( QString::fromUtf8("%destinationName%"), formatName(destinationName) );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%destinationName%"), formatName(destinationName) );
// For %timeOpened%, display the date and time (also the seconds).
- resultHTML = resultHTML.replace( QString::fromUtf8("%timeOpened%"), KGlobal::locale()->formatDateTime( QDateTime::currentDateTime(), true, true ) );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%timeOpened%"), KGlobal::locale()->formatDateTime( TQDateTime::currentDateTime(), true, true ) );
// Look for %timeOpened{X}%
- QRegExp timeRegExp("%timeOpened\\{([^}]*)\\}%");
+ TQRegExp timeRegExp("%timeOpened\\{([^}]*)\\}%");
int pos=0;
while( (pos=timeRegExp.search(resultHTML, pos) ) != -1 )
{
- QString timeKeyword = formatTime( timeRegExp.cap(1), QDateTime::currentDateTime() );
+ TQString timeKeyword = formatTime( timeRegExp.cap(1), TQDateTime::currentDateTime() );
resultHTML = resultHTML.replace( pos , timeRegExp.cap(0).length() , timeKeyword );
}
// Get contact image paths
#if 0
- QString photoIncomingPath, photoOutgoingPath;
+ TQString photoIncomingPath, photoOutgoingPath;
photoIncomingPath = remoteContact->property( Kopete::Global::Properties::self()->photo().key()).value().toString();
photoOutgoingPath = d->manager->myself()->property(Kopete::Global::Properties::self()->photo().key()).value().toString();
if( photoIncomingPath.isEmpty() )
- photoIncomingPath = QString::fromUtf8("Incoming/buddy_icon.png");
+ photoIncomingPath = TQString::fromUtf8("Incoming/buddy_icon.png");
if( photoOutgoingPath.isEmpty() )
- photoOutgoingPath = QString::fromUtf8("Outgoing/buddy_icon.png");
+ photoOutgoingPath = TQString::fromUtf8("Outgoing/buddy_icon.png");
- resultHTML = resultHTML.replace( QString::fromUtf8("%incomingIconPath%"), photoIncomingPath);
- resultHTML = resultHTML.replace( QString::fromUtf8("%outgoingIconPath%"), photoOutgoingPath);
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%incomingIconPath%"), photoIncomingPath);
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%outgoingIconPath%"), photoOutgoingPath);
#endif
- QString photoIncoming, photoOutgoing;
+ TQString photoIncoming, photoOutgoing;
if( remoteContact->metaContact() && !remoteContact->metaContact()->picture().isNull() )
{
- photoIncoming = QString("data:image/png;base64,%1").arg( remoteContact->metaContact()->picture().base64() );
+ photoIncoming = TQString("data:image/png;base64,%1").arg( remoteContact->metaContact()->picture().base64() );
}
else
{
- photoIncoming = QString::fromUtf8("Incoming/buddy_icon.png");
+ photoIncoming = TQString::fromUtf8("Incoming/buddy_icon.png");
}
if( d->manager->myself()->metaContact() && !d->manager->myself()->metaContact()->picture().isNull() )
{
- photoOutgoing = QString("data:image/png;base64,%1").arg( d->manager->myself()->metaContact()->picture().base64() );
+ photoOutgoing = TQString("data:image/png;base64,%1").arg( d->manager->myself()->metaContact()->picture().base64() );
}
else
{
- photoOutgoing = QString::fromUtf8("Outgoing/buddy_icon.png");
+ photoOutgoing = TQString::fromUtf8("Outgoing/buddy_icon.png");
}
- resultHTML = resultHTML.replace( QString::fromUtf8("%incomingIconPath%"), photoIncoming);
- resultHTML = resultHTML.replace( QString::fromUtf8("%outgoingIconPath%"), photoOutgoing );
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%incomingIconPath%"), photoIncoming);
+ resultHTML = resultHTML.replace( TQString::fromUtf8("%outgoingIconPath%"), photoOutgoing );
}
return resultHTML;
}
-QString ChatMessagePart::formatTime(const QString &timeFormat, const QDateTime &dateTime)
+TQString ChatMessagePart::formatTime(const TQString &timeFormat, const TQDateTime &dateTime)
{
char buffer[256];
@@ -1249,12 +1249,12 @@ QString ChatMessagePart::formatTime(const QString &timeFormat, const QDateTime &
loctime = localtime (&timeT);
strftime (buffer, 256, timeFormat.ascii(), loctime);
- return QString(buffer);
+ return TQString(buffer);
}
-QString ChatMessagePart::formatName(const QString &sourceName)
+TQString ChatMessagePart::formatName(const TQString &sourceName)
{
- QString formattedName = sourceName;
+ TQString formattedName = sourceName;
// Escape the name.
formattedName = Kopete::Message::escape(formattedName);
@@ -1267,14 +1267,14 @@ QString ChatMessagePart::formatName(const QString &sourceName)
return formattedName;
}
-QString ChatMessagePart::formatMessageBody(const Kopete::Message &message)
+TQString ChatMessagePart::formatMessageBody(const Kopete::Message &message)
{
- QString formattedBody("<span ");
+ TQString formattedBody("<span ");
formattedBody += message.getHtmlStyleAttribute();
// Affect the parsed body.
- formattedBody += QString::fromUtf8("class=\"KopeteMessageBody\">%1</span>").arg(message.parsedBody());
+ formattedBody += TQString::fromUtf8("class=\"KopeteMessageBody\">%1</span>").arg(message.parsedBody());
return formattedBody;
}
@@ -1282,7 +1282,7 @@ QString ChatMessagePart::formatMessageBody(const Kopete::Message &message)
void ChatMessagePart::slotUpdateHeaderDisplayName()
{
kdDebug(14000) << k_funcinfo << endl;
- DOM::HTMLElement kopeteChatNameNode = document().getElementById( QString::fromUtf8("KopeteHeaderChatNameInternal") );
+ DOM::HTMLElement kopeteChatNameNode = document().getElementById( TQString::fromUtf8("KopeteHeaderChatNameInternal") );
if( !kopeteChatNameNode.isNull() )
kopeteChatNameNode.setInnerText( formatName(d->manager->displayName()) );
}
@@ -1291,13 +1291,13 @@ void ChatMessagePart::slotUpdateHeaderPhoto()
{
// Do the actual style switch
// Wait for the event loop before switching the style
- QTimer::singleShot( 0, this, SLOT(changeStyle()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(changeStyle()) );
}
void ChatMessagePart::changeStyle()
{
#ifdef STYLE_TIMETEST
- QTime beforeChange = QTime::currentTime();
+ TQTime beforeChange = TQTime::currentTime();
#endif
// Make latestContact null to reset consecutives messages.
d->latestContact = 0;
@@ -1306,7 +1306,7 @@ void ChatMessagePart::changeStyle()
writeTemplate();
// Readd all current messages.
- QValueList<Kopete::Message>::ConstIterator it, itEnd = d->allMessages.constEnd();
+ TQValueList<Kopete::Message>::ConstIterator it, itEnd = d->allMessages.constEnd();
for(it = d->allMessages.constBegin(); it != itEnd; ++it)
{
Kopete::Message tempMessage = *it;
@@ -1314,7 +1314,7 @@ void ChatMessagePart::changeStyle()
}
kdDebug(14000) << k_funcinfo << "Finish changing style." << endl;
#ifdef STYLE_TIMETEST
- kdDebug(14000) << "Change time: " << beforeChange.msecsTo( QTime::currentTime()) << endl;
+ kdDebug(14000) << "Change time: " << beforeChange.msecsTo( TQTime::currentTime()) << endl;
#endif
}
@@ -1323,7 +1323,7 @@ void ChatMessagePart::writeTemplate()
kdDebug(14000) << k_funcinfo << endl;
#ifdef STYLE_TIMETEST
- QTime beforeHeader = QTime::currentTime();
+ TQTime beforeHeader = TQTime::currentTime();
#endif
// Clear all the page, and begin a new page.
begin();
@@ -1338,8 +1338,8 @@ void ChatMessagePart::writeTemplate()
// mainStyle: Currrent variant CSS url.
// FIXME: Maybe this string should be load from a file, then parsed for args.
- QString xhtmlBase;
- xhtmlBase += QString("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ TQString xhtmlBase;
+ xhtmlBase += TQString("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\n"
"\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
@@ -1371,7 +1371,7 @@ void ChatMessagePart::writeTemplate()
write(xhtmlBase);
end();
#ifdef STYLE_TIMETEST
- kdDebug(14000) << "Header time: " << beforeHeader.msecsTo( QTime::currentTime()) << endl;
+ kdDebug(14000) << "Header time: " << beforeHeader.msecsTo( TQTime::currentTime()) << endl;
#endif
}