summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/history/historylogger.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/plugins/history/historylogger.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/plugins/history/historylogger.cpp')
-rw-r--r--kopete/plugins/history/historylogger.cpp276
1 files changed, 138 insertions, 138 deletions
diff --git a/kopete/plugins/history/historylogger.cpp b/kopete/plugins/history/historylogger.cpp
index 7848136f..96f4d6dc 100644
--- a/kopete/plugins/history/historylogger.cpp
+++ b/kopete/plugins/history/historylogger.cpp
@@ -18,12 +18,12 @@
#include "historylogger.h"
#include "historyconfig.h"
-#include <qregexp.h>
-#include <qfile.h>
-#include <qdir.h>
-#include <qdatetime.h>
-#include <qdom.h>
-#include <qtimer.h>
+#include <tqregexp.h>
+#include <tqfile.h>
+#include <tqdir.h>
+#include <tqdatetime.h>
+#include <tqdom.h>
+#include <tqtimer.h>
#include <kdebug.h>
#include <kstandarddirs.h>
@@ -37,37 +37,37 @@
#include "kopetechatsession.h"
// -----------------------------------------------------------------------------
-HistoryLogger::HistoryLogger( Kopete::MetaContact *m, QObject *parent, const char *name )
- : QObject(parent, name)
+HistoryLogger::HistoryLogger( Kopete::MetaContact *m, TQObject *parent, const char *name )
+ : TQObject(parent, name)
{
m_saveTimer=0L;
m_saveTimerTime=0;
m_metaContact=m;
m_hideOutgoing=false;
m_cachedMonth=-1;
- m_realMonth=QDate::currentDate().month();
+ m_realMonth=TQDate::currentDate().month();
m_oldSens=Default;
//the contact may be destroyed, for example, if the contact changes its metacontact
- connect(m_metaContact , SIGNAL(destroyed(QObject *)) , this , SLOT(slotMCDeleted()));
+ connect(m_metaContact , TQT_SIGNAL(destroyed(TQObject *)) , this , TQT_SLOT(slotMCDeleted()));
setPositionToLast();
}
-HistoryLogger::HistoryLogger( Kopete::Contact *c, QObject *parent, const char *name )
- : QObject(parent, name)
+HistoryLogger::HistoryLogger( Kopete::Contact *c, TQObject *parent, const char *name )
+ : TQObject(parent, name)
{
m_saveTimer=0L;
m_saveTimerTime=0;
m_cachedMonth=-1;
m_metaContact=c->metaContact();
m_hideOutgoing=false;
- m_realMonth=QDate::currentDate().month();
+ m_realMonth=TQDate::currentDate().month();
m_oldSens=Default;
//the contact may be destroyed, for example, if the contact changes its metacontact
- connect(m_metaContact , SIGNAL(destroyed(QObject *)) , this , SLOT(slotMCDeleted()));
+ connect(m_metaContact , TQT_SIGNAL(destroyed(TQObject *)) , this , TQT_SLOT(slotMCDeleted()));
setPositionToLast();
}
@@ -105,16 +105,16 @@ void HistoryLogger::setCurrentMonth(int month)
}
-QDomDocument HistoryLogger::getDocument(const Kopete::Contact *c, unsigned int month , bool canLoad , bool* contain)
+TQDomDocument HistoryLogger::getDocument(const Kopete::Contact *c, unsigned int month , bool canLoad , bool* contain)
{
- if(m_realMonth!=QDate::currentDate().month())
+ if(m_realMonth!=TQDate::currentDate().month())
{ //We changed month, our indice are not correct anymore, clean memory.
// or we will see what i called "the 31 midnight bug"(TM) :-) -Olivier
m_documents.clear();
m_cachedMonth=-1;
m_currentMonth++; //Not usre it's ok, but should work;
m_oldMonth++; // idem
- m_realMonth=QDate::currentDate().month();
+ m_realMonth=TQDate::currentDate().month();
}
if(!m_metaContact)
@@ -122,22 +122,22 @@ QDomDocument HistoryLogger::getDocument(const Kopete::Contact *c, unsigned int m
if(c && c->metaContact())
m_metaContact=c->metaContact();
else
- return QDomDocument();
+ return TQDomDocument();
}
if(!m_metaContact->contacts().contains(c))
{
if(contain)
*contain=false;
- return QDomDocument();
+ return TQDomDocument();
}
- QMap<unsigned int , QDomDocument> documents = m_documents[c];
+ TQMap<unsigned int , TQDomDocument> documents = m_documents[c];
if (documents.contains(month))
return documents[month];
- QDomDocument doc = getDocument(c, QDate::currentDate().addMonths(0-month), canLoad, contain);
+ TQDomDocument doc = getDocument(c, TQDate::currentDate().addMonths(0-month), canLoad, contain);
documents.insert(month, doc);
m_documents[c]=documents;
@@ -146,35 +146,35 @@ QDomDocument HistoryLogger::getDocument(const Kopete::Contact *c, unsigned int m
}
-QDomDocument HistoryLogger::getDocument(const Kopete::Contact *c, const QDate date , bool canLoad , bool* contain)
+TQDomDocument HistoryLogger::getDocument(const Kopete::Contact *c, const TQDate date , bool canLoad , bool* contain)
{
if(!m_metaContact)
{ //this may happen if the contact has been moved, and the MC deleted
if(c && c->metaContact())
m_metaContact=c->metaContact();
else
- return QDomDocument();
+ return TQDomDocument();
}
if(!m_metaContact->contacts().contains(c))
{
if(contain)
*contain=false;
- return QDomDocument();
+ return TQDomDocument();
}
if(!canLoad)
{
if(contain)
*contain=false;
- return QDomDocument();
+ return TQDomDocument();
}
QString FileName = getFileName(c, date);
- QDomDocument doc( "Kopete-History" );
+ TQDomDocument doc( "Kopete-History" );
- QFile file( FileName );
+ TQFile file( FileName );
if ( !file.open( IO_ReadOnly ) )
{
if(contain)
@@ -207,7 +207,7 @@ void HistoryLogger::appendMessage( const Kopete::Message &msg , const Kopete::Co
const Kopete::Contact *c = ct;
if(!c && msg.manager() )
{
- QPtrList<Kopete::Contact> mb=msg.manager()->members() ;
+ TQPtrList<Kopete::Contact> mb=msg.manager()->members() ;
c = mb.first();
}
if(!c) //If the contact is still not initialized, use the message author.
@@ -225,8 +225,8 @@ void HistoryLogger::appendMessage( const Kopete::Message &msg , const Kopete::Co
if(!c || !m_metaContact->contacts().contains(c) )
{
- /*QPtrList<Kopete::Contact> contacts= m_metaContact->contacts();
- QPtrListIterator<Kopete::Contact> it( contacts );
+ /*TQPtrList<Kopete::Contact> contacts= m_metaContact->contacts();
+ TQPtrListIterator<Kopete::Contact> it( contacts );
for( ; it.current(); ++it )
{
if( (*it)->protocol()->pluginId() == msg.from()->protocol()->pluginId() )
@@ -242,36 +242,36 @@ void HistoryLogger::appendMessage( const Kopete::Message &msg , const Kopete::Co
return;
}
- QDomDocument doc=getDocument(c,0);
- QDomElement docElem = doc.documentElement();
+ TQDomDocument doc=getDocument(c,0);
+ TQDomElement docElem = doc.documentElement();
if(docElem.isNull())
{
docElem= doc.createElement( "kopete-history" );
docElem.setAttribute ( "version" , "0.9" );
doc.appendChild( docElem );
- QDomElement headElem = doc.createElement( "head" );
+ TQDomElement headElem = doc.createElement( "head" );
docElem.appendChild( headElem );
- QDomElement dateElem = doc.createElement( "date" );
- dateElem.setAttribute( "year", QString::number(QDate::currentDate().year()) );
- dateElem.setAttribute( "month", QString::number(QDate::currentDate().month()) );
+ TQDomElement dateElem = doc.createElement( "date" );
+ dateElem.setAttribute( "year", TQString::number(TQDate::currentDate().year()) );
+ dateElem.setAttribute( "month", TQString::number(TQDate::currentDate().month()) );
headElem.appendChild(dateElem);
- QDomElement myselfElem = doc.createElement( "contact" );
+ TQDomElement myselfElem = doc.createElement( "contact" );
myselfElem.setAttribute( "type", "myself" );
myselfElem.setAttribute( "contactId", c->account()->myself()->contactId() );
headElem.appendChild(myselfElem);
- QDomElement contactElem = doc.createElement( "contact" );
+ TQDomElement contactElem = doc.createElement( "contact" );
contactElem.setAttribute( "contactId", c->contactId() );
headElem.appendChild(contactElem);
}
- QDomElement msgElem = doc.createElement( "msg" );
+ TQDomElement msgElem = doc.createElement( "msg" );
msgElem.setAttribute( "in", msg.direction()==Kopete::Message::Outbound ? "0" : "1" );
msgElem.setAttribute( "from", msg.from()->contactId() );
msgElem.setAttribute( "nick", msg.from()->property( Kopete::Global::Properties::self()->nickName() ).value().toString() ); //do we have to set this?
msgElem.setAttribute( "time", msg.timestamp().toString("d h:m:s") );
- QDomText msgNode = doc.createTextNode( msg.plainBody() );
+ TQDomText msgNode = doc.createTextNode( msg.plainBody() );
docElem.appendChild( msgElem );
msgElem.appendChild( msgNode );
@@ -280,7 +280,7 @@ void HistoryLogger::appendMessage( const Kopete::Message &msg , const Kopete::Co
// On hight-traffic channel, saving can take lots of CPU. (because the file is big)
// So i wait a time proportional to the time needed to save..
- const QString filename=getFileName(c,QDate::currentDate());
+ const TQString filename=getFileName(c,TQDate::currentDate());
if(!m_toSaveFileName.isEmpty() && m_toSaveFileName != filename)
{ //that mean the contact or the month has changed, save it now.
saveToDisk();
@@ -291,8 +291,8 @@ void HistoryLogger::appendMessage( const Kopete::Message &msg , const Kopete::Co
if(!m_saveTimer)
{
- m_saveTimer=new QTimer(this);
- connect( m_saveTimer, SIGNAL( timeout() ) , this, SLOT(saveToDisk()) );
+ m_saveTimer=new TQTimer(this);
+ connect( m_saveTimer, TQT_SIGNAL( timeout() ) , this, TQT_SLOT(saveToDisk()) );
}
if(!m_saveTimer->isActive())
m_saveTimer->start( m_saveTimerTime, true /*singleshot*/ );
@@ -305,14 +305,14 @@ void HistoryLogger::saveToDisk()
if(m_toSaveFileName.isEmpty() || m_toSaveDocument.isNull())
return;
- QTime t;
+ TQTime t;
t.start(); //mesure the time needed to save.
KSaveFile file( m_toSaveFileName );
if( file.status() == 0 )
{
- QTextStream *stream = file.textStream();
- //stream->setEncoding( QTextStream::UnicodeUTF8 ); //???? oui ou non?
+ TQTextStream *stream = file.textStream();
+ //stream->setEncoding( TQTextStream::UnicodeUTF8 ); //???? oui ou non?
m_toSaveDocument.save( *stream, 1 );
file.close();
@@ -323,36 +323,36 @@ void HistoryLogger::saveToDisk()
// But it may take 500 ms if the file to save becomes too big (1Mb).
kdDebug(14310) << k_funcinfo << m_toSaveFileName << " saved in " << t.elapsed() << " ms " <<endl ;
- m_toSaveFileName=QString::null;
- m_toSaveDocument=QDomDocument();
+ m_toSaveFileName=TQString::null;
+ m_toSaveDocument=TQDomDocument();
}
else
kdError(14310) << k_funcinfo << "impossible to save the history file " << m_toSaveFileName << endl;
}
-QValueList<Kopete::Message> HistoryLogger::readMessages(QDate date)
+TQValueList<Kopete::Message> HistoryLogger::readMessages(TQDate date)
{
- QRegExp rxTime("(\\d+) (\\d+):(\\d+)($|:)(\\d*)"); //(with a 0.7.x compatibility)
- QValueList<Kopete::Message> messages;
+ TQRegExp rxTime("(\\d+) (\\d+):(\\d+)($|:)(\\d*)"); //(with a 0.7.x compatibility)
+ TQValueList<Kopete::Message> messages;
- QPtrList<Kopete::Contact> ct=m_metaContact->contacts();
- QPtrListIterator<Kopete::Contact> it( ct );
+ TQPtrList<Kopete::Contact> ct=m_metaContact->contacts();
+ TQPtrListIterator<Kopete::Contact> it( ct );
for( ; it.current(); ++it )
{
- QDomDocument doc=getDocument(*it,date, true, 0L);
- QDomElement docElem = doc.documentElement();
- QDomNode n = docElem.firstChild();
+ TQDomDocument doc=getDocument(*it,date, true, 0L);
+ TQDomElement docElem = doc.documentElement();
+ TQDomNode n = docElem.firstChild();
while(!n.isNull())
{
- QDomElement msgElem2 = n.toElement();
+ TQDomElement msgElem2 = n.toElement();
if( !msgElem2.isNull() && msgElem2.tagName()=="msg")
{
rxTime.search(msgElem2.attribute("time"));
- QDateTime dt( QDate(date.year() , date.month() , rxTime.cap(1).toUInt()), QTime( rxTime.cap(2).toUInt() , rxTime.cap(3).toUInt(), rxTime.cap(5).toUInt() ) );
+ TQDateTime dt( TQDate(date.year() , date.month() , rxTime.cap(1).toUInt()), TQTime( rxTime.cap(2).toUInt() , rxTime.cap(3).toUInt(), rxTime.cap(5).toUInt() ) );
if (dt.date() != date)
{
@@ -366,7 +366,7 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(QDate date)
if(!m_hideOutgoing || dir != Kopete::Message::Outbound)
{ //parse only if we don't hide it
- QString f=msgElem2.attribute("from" );
+ TQString f=msgElem2.attribute("from" );
const Kopete::Contact *from=f.isNull()? 0L : (*it)->account()->contacts()[f];
if(!from)
@@ -376,13 +376,13 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(QDate date)
to.append( dir==Kopete::Message::Inbound ? (*it)->account()->myself() : *it );
Kopete::Message msg(dt, from, to, msgElem2.text(), dir);
- msg.setBody( QString::fromLatin1("<span title=\"%1\">%2</span>")
+ msg.setBody( TQString::fromLatin1("<span title=\"%1\">%2</span>")
.arg( dt.toString(Qt::LocalDate), msg.escapedBody() ),
Kopete::Message::RichText);
// We insert it at the good place, given its date
- QValueListIterator<Kopete::Message> msgIt;
+ TQValueListIterator<Kopete::Message> msgIt;
for (msgIt = messages.begin(); msgIt != messages.end(); ++msgIt)
{
@@ -400,15 +400,15 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(QDate date)
return messages;
}
-QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
+TQValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
const Kopete::Contact *c, Sens sens, bool reverseOrder, bool colorize)
{
- //QDate dd = QDate::currentDate().addMonths(0-m_currentMonth);
+ //TQDate dd = TQDate::currentDate().addMonths(0-m_currentMonth);
- QValueList<Kopete::Message> messages;
+ TQValueList<Kopete::Message> messages;
// A regexp useful for this function
- QRegExp rxTime("(\\d+) (\\d+):(\\d+)($|:)(\\d*)"); //(with a 0.7.x compatibility)
+ TQRegExp rxTime("(\\d+) (\\d+):(\\d+)($|:)(\\d*)"); //(with a 0.7.x compatibility)
if(!m_metaContact)
{ //this may happen if the contact has been moved, and the MC deleted
@@ -436,7 +436,7 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
m_oldSens=sens;
//getting the color for messages:
- QColor fgColor = HistoryConfig::history_color();
+ TQColor fgColor = HistoryConfig::history_color();
//Hello guest!
@@ -448,7 +448,7 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
// we see what contact we have to read first, and we look at the firt date before another contact
// has a message with a bigger date.
- QDateTime timeLimit;
+ TQDateTime timeLimit;
const Kopete::Contact *currentContact=c;
if(!c && m_metaContact->contacts().count()==1)
currentContact=m_metaContact->contacts().first();
@@ -459,26 +459,26 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
while(messages.count() < lines)
{
- timeLimit=QDateTime();
- QDomElement msgElem; //here is the message element
- QDateTime timestamp; //and the timestamp of this message
+ timeLimit=TQDateTime();
+ TQDomElement msgElem; //here is the message element
+ TQDateTime timestamp; //and the timestamp of this message
if(!c && m_metaContact->contacts().count()>1)
{ //we have to merge the differents subcontact history
- QPtrList<Kopete::Contact> ct=m_metaContact->contacts();
- QPtrListIterator<Kopete::Contact> it( ct );
+ TQPtrList<Kopete::Contact> ct=m_metaContact->contacts();
+ TQPtrListIterator<Kopete::Contact> it( ct );
for( ; it.current(); ++it )
{ //we loop over each contact. we are searching the contact with the next message with the smallest date,
// it will becomes our current contact, and the contact with the mext message with the second smallest
// date, this date will bocomes the limit.
- QDomNode n;
+ TQDomNode n;
if(m_currentElements.contains(*it))
n=m_currentElements[*it];
else //there is not yet "next message" register, so we will take the first (for the current month)
{
- QDomDocument doc=getDocument(*it,m_currentMonth);
- QDomElement docElem = doc.documentElement();
+ TQDomDocument doc=getDocument(*it,m_currentMonth);
+ TQDomElement docElem = doc.documentElement();
n= (sens==Chronological)?docElem.firstChild() : docElem.lastChild();
//i can't drop the root element
@@ -486,12 +486,12 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
}
while(!n.isNull())
{
- QDomElement msgElem2 = n.toElement();
+ TQDomElement msgElem2 = n.toElement();
if( !msgElem2.isNull() && msgElem2.tagName()=="msg")
{
rxTime.search(msgElem2.attribute("time"));
- QDate d=QDate::currentDate().addMonths(0-m_currentMonth);
- QDateTime dt( QDate(d.year() , d.month() , rxTime.cap(1).toUInt()), QTime( rxTime.cap(2).toUInt() , rxTime.cap(3).toUInt(), rxTime.cap(5).toUInt() ) );
+ TQDate d=TQDate::currentDate().addMonths(0-m_currentMonth);
+ TQDateTime dt( TQDate(d.year() , d.month() , rxTime.cap(1).toUInt()), TQTime( rxTime.cap(2).toUInt() , rxTime.cap(3).toUInt(), rxTime.cap(5).toUInt() ) );
if(!timestamp.isValid() || ((sens==Chronological )? dt < timestamp : dt > timestamp) )
{
timeLimit=timestamp;
@@ -516,10 +516,10 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
msgElem=m_currentElements[currentContact];
else
{
- QDomDocument doc=getDocument(currentContact,m_currentMonth);
- QDomElement docElem = doc.documentElement();
- QDomNode n= (sens==Chronological)?docElem.firstChild() : docElem.lastChild();
- msgElem=QDomElement();
+ TQDomDocument doc=getDocument(currentContact,m_currentMonth);
+ TQDomElement docElem = doc.documentElement();
+ TQDomNode n= (sens==Chronological)?docElem.firstChild() : docElem.lastChild();
+ msgElem=TQDomElement();
while(!n.isNull()) //continue until we get a msg
{
msgElem=n.toElement();
@@ -572,9 +572,9 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
if(!m_hideOutgoing || dir != Kopete::Message::Outbound)
{ //parse only if we don't hide it
- if( m_filter.isNull() || ( m_filterRegExp? msgElem.text().contains(QRegExp(m_filter,m_filterCaseSensitive)) : msgElem.text().contains(m_filter,m_filterCaseSensitive) ))
+ if( m_filter.isNull() || ( m_filterRegExp? msgElem.text().contains(TQRegExp(m_filter,m_filterCaseSensitive)) : msgElem.text().contains(m_filter,m_filterCaseSensitive) ))
{
- QString f=msgElem.attribute("from" );
+ TQString f=msgElem.attribute("from" );
const Kopete::Contact *from=(f.isNull() || !currentContact) ? 0L : currentContact->account()->contacts()[f];
if(!from)
@@ -587,14 +587,14 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
{
//parse timestamp only if it was not already parsed
rxTime.search(msgElem.attribute("time"));
- QDate d=QDate::currentDate().addMonths(0-m_currentMonth);
- timestamp=QDateTime( QDate(d.year() , d.month() , rxTime.cap(1).toUInt()), QTime( rxTime.cap(2).toUInt() , rxTime.cap(3).toUInt() , rxTime.cap(5).toUInt() ) );
+ TQDate d=TQDate::currentDate().addMonths(0-m_currentMonth);
+ timestamp=TQDateTime( TQDate(d.year() , d.month() , rxTime.cap(1).toUInt()), TQTime( rxTime.cap(2).toUInt() , rxTime.cap(3).toUInt() , rxTime.cap(5).toUInt() ) );
}
Kopete::Message msg(timestamp, from, to, msgElem.text(), dir);
if (colorize)
{
- msg.setBody( QString::fromLatin1("<span style=\"color:%1\" title=\"%2\">%3</span>")
+ msg.setBody( TQString::fromLatin1("<span style=\"color:%1\" title=\"%2\">%3</span>")
.arg( fgColor.name(), timestamp.toString(Qt::LocalDate), msg.escapedBody() ),
Kopete::Message::RichText
);
@@ -602,7 +602,7 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
}
else
{
- msg.setBody( QString::fromLatin1("<span title=\"%1\">%2</span>")
+ msg.setBody( TQString::fromLatin1("<span title=\"%1\">%2</span>")
.arg( timestamp.toString(Qt::LocalDate), msg.escapedBody() ),
Kopete::Message::RichText
);
@@ -617,10 +617,10 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
//here is the point of workaround. If i drop the root element, this crashes
//get the next message
- QDomNode node = ( (sens==Chronological) ? msgElem.nextSibling() :
+ TQDomNode node = ( (sens==Chronological) ? msgElem.nextSibling() :
msgElem.previousSibling() );
- msgElem = QDomElement(); //n.toElement();
+ msgElem = TQDomElement(); //n.toElement();
while (!node.isNull() && msgElem.isNull())
{
msgElem = node.toElement();
@@ -632,19 +632,19 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
{
// In case of hideoutgoing messages, it is faster to do
// this, so we don't parse the date if it is not needed
- QRegExp rx("(\\d+) (\\d+):(\\d+):(\\d+)");
+ TQRegExp rx("(\\d+) (\\d+):(\\d+):(\\d+)");
rx.search(msgElem.attribute("time"));
- QDate d = QDate::currentDate().addMonths(0-m_currentMonth);
- timestamp = QDateTime(
- QDate(d.year(), d.month(), rx.cap(1).toUInt()),
- QTime( rx.cap(2).toUInt(), rx.cap(3).toUInt() ) );
+ TQDate d = TQDate::currentDate().addMonths(0-m_currentMonth);
+ timestamp = TQDateTime(
+ TQDate(d.year(), d.month(), rx.cap(1).toUInt()),
+ TQTime( rx.cap(2).toUInt(), rx.cap(3).toUInt() ) );
}
else
- timestamp = QDateTime(); //invalid
+ timestamp = TQDateTime(); //invalid
}
else
- msgElem = QDomElement();
+ msgElem = TQDomElement();
}
node = (sens == Chronological) ? node.nextSibling() :
@@ -660,30 +660,30 @@ QValueList<Kopete::Message> HistoryLogger::readMessages(unsigned int lines,
return messages;
}
-QString HistoryLogger::getFileName(const Kopete::Contact* c, QDate date)
+TQString HistoryLogger::getFileName(const Kopete::Contact* c, TQDate date)
{
- QString name = c->protocol()->pluginId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) +
- QString::fromLatin1( "/" ) +
- c->account()->accountId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) +
- QString::fromLatin1( "/" ) +
- c->contactId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) +
+ TQString name = c->protocol()->pluginId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) +
+ TQString::fromLatin1( "/" ) +
+ c->account()->accountId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) +
+ TQString::fromLatin1( "/" ) +
+ c->contactId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) +
date.toString(".yyyyMM");
- QString filename=locateLocal( "data", QString::fromLatin1( "kopete/logs/" ) + name+ QString::fromLatin1( ".xml" ) ) ;
+ TQString filename=locateLocal( "data", TQString::fromLatin1( "kopete/logs/" ) + name+ TQString::fromLatin1( ".xml" ) ) ;
//Check if there is a kopete 0.7.x file
- QFileInfo fi(filename);
+ TQFileInfo fi(filename);
if(!fi.exists())
{
- name = c->protocol()->pluginId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) +
- QString::fromLatin1( "/" ) +
- c->contactId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) +
+ name = c->protocol()->pluginId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) +
+ TQString::fromLatin1( "/" ) +
+ c->contactId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) +
date.toString(".yyyyMM");
- QString filename2=locateLocal( "data", QString::fromLatin1( "kopete/logs/" ) + name+ QString::fromLatin1( ".xml" ) ) ;
+ TQString filename2=locateLocal( "data", TQString::fromLatin1( "kopete/logs/" ) + name+ TQString::fromLatin1( ".xml" ) ) ;
- QFileInfo fi2(filename2);
+ TQFileInfo fi2(filename2);
if(fi2.exists())
return filename2;
}
@@ -697,25 +697,25 @@ unsigned int HistoryLogger::getFirstMonth(const Kopete::Contact *c)
if(!c)
return getFirstMonth();
- QRegExp rx( "\\.(\\d\\d\\d\\d)(\\d\\d)" );
- QFileInfo *fi;
+ TQRegExp rx( "\\.(\\d\\d\\d\\d)(\\d\\d)" );
+ TQFileInfo *fi;
// BEGIN check if there are Kopete 0.7.x
- QDir d1(locateLocal("data",QString("kopete/logs/")+
- c->protocol()->pluginId().replace( QRegExp(QString::fromLatin1("[./~?*]")),QString::fromLatin1("-"))
+ TQDir d1(locateLocal("data",TQString("kopete/logs/")+
+ c->protocol()->pluginId().replace( TQRegExp(TQString::fromLatin1("[./~?*]")),TQString::fromLatin1("-"))
));
- d1.setFilter( QDir::Files | QDir::NoSymLinks );
- d1.setSorting( QDir::Name );
+ d1.setFilter( TQDir::Files | TQDir::NoSymLinks );
+ d1.setSorting( TQDir::Name );
const QFileInfoList *list1 = d1.entryInfoList();
QFileInfoListIterator it1( *list1 );
while ( (fi = it1.current()) != 0 )
{
- if(fi->fileName().contains(c->contactId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) )))
+ if(fi->fileName().contains(c->contactId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) )))
{
rx.search(fi->fileName());
- int result = 12*(QDate::currentDate().year() - rx.cap(1).toUInt()) +QDate::currentDate().month() - rx.cap(2).toUInt();
+ int result = 12*(TQDate::currentDate().year() - rx.cap(1).toUInt()) +TQDate::currentDate().month() - rx.cap(2).toUInt();
if(result < 0)
{
@@ -729,23 +729,23 @@ unsigned int HistoryLogger::getFirstMonth(const Kopete::Contact *c)
// END of kopete 0.7.x check
- QDir d(locateLocal("data",QString("kopete/logs/")+
- c->protocol()->pluginId().replace( QRegExp(QString::fromLatin1("[./~?*]")),QString::fromLatin1("-")) +
- QString::fromLatin1( "/" ) +
- c->account()->accountId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) )
+ TQDir d(locateLocal("data",TQString("kopete/logs/")+
+ c->protocol()->pluginId().replace( TQRegExp(TQString::fromLatin1("[./~?*]")),TQString::fromLatin1("-")) +
+ TQString::fromLatin1( "/" ) +
+ c->account()->accountId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) )
));
- d.setFilter( QDir::Files | QDir::NoSymLinks );
- d.setSorting( QDir::Name );
+ d.setFilter( TQDir::Files | TQDir::NoSymLinks );
+ d.setSorting( TQDir::Name );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
while ( (fi = it.current()) != 0 )
{
- if(fi->fileName().contains(c->contactId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) )))
+ if(fi->fileName().contains(c->contactId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) )))
{
rx.search(fi->fileName());
- int result = 12*(QDate::currentDate().year() - rx.cap(1).toUInt()) +QDate::currentDate().month() - rx.cap(2).toUInt();
+ int result = 12*(TQDate::currentDate().year() - rx.cap(1).toUInt()) +TQDate::currentDate().month() - rx.cap(2).toUInt();
if(result < 0)
{
kdWarning(14310) << k_funcinfo << "Kopete only found log file made in the future. Check your date!" << endl;
@@ -767,8 +767,8 @@ unsigned int HistoryLogger::getFirstMonth()
return 0;
int m=0;
- QPtrList<Kopete::Contact> contacts=m_metaContact->contacts();
- QPtrListIterator<Kopete::Contact> it( contacts );
+ TQPtrList<Kopete::Contact> contacts=m_metaContact->contacts();
+ TQPtrListIterator<Kopete::Contact> it( contacts );
for( ; it.current(); ++it )
{
int m2=getFirstMonth(*it);
@@ -788,14 +788,14 @@ void HistoryLogger::slotMCDeleted()
m_metaContact = 0;
}
-void HistoryLogger::setFilter(const QString& filter, bool caseSensitive , bool isRegExp)
+void HistoryLogger::setFilter(const TQString& filter, bool caseSensitive , bool isRegExp)
{
m_filter=filter;
m_filterCaseSensitive=caseSensitive;
m_filterRegExp=isRegExp;
}
-QString HistoryLogger::filter() const
+TQString HistoryLogger::filter() const
{
return m_filter;
}
@@ -810,26 +810,26 @@ bool HistoryLogger::filterRegExp() const
return m_filterRegExp;
}
-QValueList<int> HistoryLogger::getDaysForMonth(QDate date)
+TQValueList<int> HistoryLogger::getDaysForMonth(TQDate date)
{
- QRegExp rxTime("time=\"(\\d+) \\d+:\\d+(:\\d+)?\""); //(with a 0.7.x compatibility)
+ TQRegExp rxTime("time=\"(\\d+) \\d+:\\d+(:\\d+)?\""); //(with a 0.7.x compatibility)
- QValueList<int> dayList;
+ TQValueList<int> dayList;
- QPtrList<Kopete::Contact> contacts = m_metaContact->contacts();
- QPtrListIterator<Kopete::Contact> it(contacts);
+ TQPtrList<Kopete::Contact> contacts = m_metaContact->contacts();
+ TQPtrListIterator<Kopete::Contact> it(contacts);
int lastDay=0;
for(; it.current(); ++it)
{
// kdDebug() << getFileName(*it, date) << endl;
- QFile file(getFileName(*it, date));
+ TQFile file(getFileName(*it, date));
if(!file.open(IO_ReadOnly))
{
continue;
}
- QTextStream stream(&file);
- QString fullText = stream.read();
+ TQTextStream stream(&file);
+ TQString fullText = stream.read();
file.close();
int pos = 0;