diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/plugins/history | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/plugins/history')
-rw-r--r-- | kopete/plugins/history/converter.cpp | 140 | ||||
-rw-r--r-- | kopete/plugins/history/historydialog.cpp | 208 | ||||
-rw-r--r-- | kopete/plugins/history/historydialog.h | 30 | ||||
-rw-r--r-- | kopete/plugins/history/historyguiclient.cpp | 22 | ||||
-rw-r--r-- | kopete/plugins/history/historyguiclient.h | 4 | ||||
-rw-r--r-- | kopete/plugins/history/historylogger.cpp | 276 | ||||
-rw-r--r-- | kopete/plugins/history/historylogger.h | 42 | ||||
-rw-r--r-- | kopete/plugins/history/historyplugin.cpp | 38 | ||||
-rw-r--r-- | kopete/plugins/history/historyplugin.h | 10 | ||||
-rw-r--r-- | kopete/plugins/history/historypreferences.cpp | 24 | ||||
-rw-r--r-- | kopete/plugins/history/historypreferences.h | 6 |
11 files changed, 400 insertions, 400 deletions
diff --git a/kopete/plugins/history/converter.cpp b/kopete/plugins/history/converter.cpp index 22f662bc..d2e4839d 100644 --- a/kopete/plugins/history/converter.cpp +++ b/kopete/plugins/history/converter.cpp @@ -28,9 +28,9 @@ #include <kprogress.h> #include <kapplication.h> #include <ksavefile.h> -#include <qdir.h> -#include <qdom.h> -#include <qregexp.h> +#include <tqdir.h> +#include <tqdom.h> +#include <tqregexp.h> #define CBUFLENGTH 512 // buffer length for fgets() @@ -40,27 +40,27 @@ void HistoryPlugin::convertOldHistory() i18n( "Would you like to remove old history files?" ) , i18n( "History Converter" ), KStdGuiItem::del(), i18n("Keep") ) == KMessageBox::Yes; KProgressDialog *progressDlg=new KProgressDialog(Kopete::UI::Global::mainWidget() , "history_progress_dlg" , i18n( "History converter" ) , - QString::null , true); //modal to make sure the user will not doing stupid things (we have a kapp->processEvents()) + TQString::null , true); //modal to make sure the user will not doing stupid things (we have a kapp->processEvents()) progressDlg->setAllowCancel(false); //because i am too lazy to allow to cancel - QString kopetedir=locateLocal( "data", QString::fromLatin1( "kopete")); - QDir d( kopetedir ); //d should point to ~/.kde/share/apps/kopete/ + TQString kopetedir=locateLocal( "data", TQString::fromLatin1( "kopete")); + TQDir d( kopetedir ); //d should point to ~/.kde/share/apps/kopete/ - d.setFilter( QDir::Dirs ); + d.setFilter( TQDir::Dirs ); const QFileInfoList *list = d.entryInfoList(); QFileInfoListIterator it( *list ); - QFileInfo *fi; + TQFileInfo *fi; while ( (fi = it.current()) != 0 ) { - QString protocolId; - QString accountId; + TQString protocolId; + TQString accountId; if( Kopete::Protocol *p = dynamic_cast<Kopete::Protocol *>( Kopete::PluginManager::self()->plugin( fi->fileName() ) ) ) { protocolId=p->pluginId(); - QDictIterator<Kopete::Account> it(Kopete::AccountManager::self()->accounts(p)); + TQDictIterator<Kopete::Account> it(Kopete::AccountManager::self()->accounts(p)); Kopete::Account *a = it.current(); if(a) accountId=a->accountId(); @@ -103,12 +103,12 @@ void HistoryPlugin::convertOldHistory() if(!protocolId.isEmpty() || !accountId.isEmpty()) { - QDir d2( fi->absFilePath() ); - d2.setFilter( QDir::Files ); + TQDir d2( fi->absFilePath() ); + d2.setFilter( TQDir::Files ); d2.setNameFilter("*.log"); const QFileInfoList *list = d2.entryInfoList(); QFileInfoListIterator it2( *list ); - QFileInfo *fi2; + TQFileInfo *fi2; progressDlg->progressBar()->reset(); progressDlg->progressBar()->setTotalSteps(d2.count()); @@ -118,7 +118,7 @@ void HistoryPlugin::convertOldHistory() while ( (fi2 = it2.current()) != 0 ) { //we assume that all "-" are dots. (like in hotmail.com) - QString contactId=fi2->fileName().replace(".log" , QString::null).replace("-" , "."); + TQString contactId=fi2->fileName().replace(".log" , TQString::null).replace("-" , "."); if(!contactId.isEmpty() ) { @@ -127,48 +127,48 @@ void HistoryPlugin::convertOldHistory() int month=0; int year=0; - QDomDocument doc; - QDomElement docElem; + TQDomDocument doc; + TQDomElement docElem; - QDomElement msgelement; - QDomNode node; - QDomDocument xmllist; + TQDomElement msgelement; + TQDomNode node; + TQDomDocument xmllist; Kopete::Message::MessageDirection dir; - QString body, date, nick; - QString buffer, msgBlock; + TQString body, date, nick; + TQString buffer, msgBlock; char cbuf[CBUFLENGTH]; // buffer for the log file - QString logFileName = fi2->absFilePath(); + TQString logFileName = fi2->absFilePath(); // open the file - FILE *f = fopen(QFile::encodeName(logFileName), "r"); + FILE *f = fopen(TQFile::encodeName(logFileName), "r"); // create a new <message> block while ( ! feof( f ) ) { fgets(cbuf, CBUFLENGTH, f); - buffer = QString::fromUtf8(cbuf); + buffer = TQString::fromUtf8(cbuf); while ( strchr(cbuf, '\n') == NULL && !feof(f) ) { fgets( cbuf, CBUFLENGTH, f ); - buffer += QString::fromUtf8(cbuf); + buffer += TQString::fromUtf8(cbuf); } - if( buffer.startsWith( QString::fromLatin1( "<message " ) ) ) + if( buffer.startsWith( TQString::fromLatin1( "<message " ) ) ) { msgBlock = buffer; // find the end of the message block - while( !feof( f ) && buffer != QString::fromLatin1( "</message>\n" ) /*strcmp("</message>\n", cbuf )*/ ) + while( !feof( f ) && buffer != TQString::fromLatin1( "</message>\n" ) /*strcmp("</message>\n", cbuf )*/ ) { fgets(cbuf, CBUFLENGTH, f); - buffer = QString::fromUtf8(cbuf); + buffer = TQString::fromUtf8(cbuf); while ( strchr(cbuf, '\n') == NULL && !feof(f) ) { fgets( cbuf, CBUFLENGTH, f ); - buffer += QString::fromUtf8(cbuf); + buffer += TQString::fromUtf8(cbuf); } msgBlock.append(buffer); } @@ -178,14 +178,14 @@ void HistoryPlugin::convertOldHistory() msgelement = xmllist.documentElement(); node = msgelement.firstChild(); - if( msgelement.attribute( QString::fromLatin1( "direction" ) ) == QString::fromLatin1( "inbound" ) ) + if( msgelement.attribute( TQString::fromLatin1( "direction" ) ) == TQString::fromLatin1( "inbound" ) ) dir = Kopete::Message::Inbound; else dir = Kopete::Message::Outbound; // Read all the elements. - QString tagname; - QDomElement element; + TQString tagname; + TQDomElement element; while ( ! node.isNull() ) { @@ -194,12 +194,12 @@ void HistoryPlugin::convertOldHistory() element = node.toElement(); tagname = element.tagName(); - if( tagname == QString::fromLatin1( "srcnick" ) ) + if( tagname == TQString::fromLatin1( "srcnick" ) ) nick = element.text(); - else if( tagname == QString::fromLatin1( "date" ) ) + else if( tagname == TQString::fromLatin1( "date" ) ) date = element.text(); - else if( tagname == QString::fromLatin1( "body" ) ) + else if( tagname == TQString::fromLatin1( "body" ) ) body = element.text().stripWhiteSpace(); } @@ -207,21 +207,21 @@ void HistoryPlugin::convertOldHistory() } //FIXME!! The date in logs writed with kopete running with QT 3.0 is Localised. // so QT can't parse it correctly. - QDateTime dt=QDateTime::fromString(date); + TQDateTime dt=TQDateTime::fromString(date); if(dt.date().month() != month || dt.date().year() != year) { if(!docElem.isNull()) { - QDate date(year,month,1); - QString name = protocolId.replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) + - QString::fromLatin1( "/" ) + - contactId.replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) + + TQDate date(year,month,1); + TQString name = protocolId.replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) + + TQString::fromLatin1( "/" ) + + contactId.replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) + date.toString(".yyyyMM"); - KSaveFile file( locateLocal( "data", QString::fromLatin1( "kopete/logs/" ) + name+ QString::fromLatin1( ".xml" ) ) ); + KSaveFile file( locateLocal( "data", TQString::fromLatin1( "kopete/logs/" ) + name+ TQString::fromLatin1( ".xml" ) ) ); 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? doc.save( *stream , 1 ); file.close(); } @@ -230,39 +230,39 @@ void HistoryPlugin::convertOldHistory() month=dt.date().month(); year=dt.date().year(); - docElem=QDomElement(); + docElem=TQDomElement(); } if(docElem.isNull()) { - doc=QDomDocument("Kopete-History"); + doc=TQDomDocument("Kopete-History"); docElem= doc.createElement( "kopete-history" ); docElem.setAttribute ( "version" , "0.7" ); 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(year) ); - dateElem.setAttribute( "month", QString::number(month) ); + TQDomElement dateElem = doc.createElement( "date" ); + dateElem.setAttribute( "year", TQString::number(year) ); + dateElem.setAttribute( "month", TQString::number(month) ); headElem.appendChild(dateElem); - QDomElement myselfElem = doc.createElement( "contact" ); + TQDomElement myselfElem = doc.createElement( "contact" ); myselfElem.setAttribute( "type", "myself" ); myselfElem.setAttribute( "contactId", accountId ); headElem.appendChild(myselfElem); - QDomElement contactElem = doc.createElement( "contact" ); + TQDomElement contactElem = doc.createElement( "contact" ); contactElem.setAttribute( "contactId", contactId ); headElem.appendChild(contactElem); - QDomElement importElem = doc.createElement( "imported" ); + TQDomElement importElem = doc.createElement( "imported" ); importElem.setAttribute( "from", fi->fileName() ); - importElem.setAttribute( "date", QDateTime::currentDateTime().toString() ); + importElem.setAttribute( "date", TQDateTime::currentDateTime().toString() ); headElem.appendChild(importElem); } - QDomElement msgElem = doc.createElement( "msg" ); + TQDomElement msgElem = doc.createElement( "msg" ); msgElem.setAttribute( "in", dir==Kopete::Message::Outbound ? "0" : "1" ); msgElem.setAttribute( "from", dir==Kopete::Message::Outbound ? accountId : contactId ); msgElem.setAttribute( "nick", nick ); //do we have to set this? - msgElem.setAttribute( "time", QString::number(dt.date().day()) + " " + QString::number(dt.time().hour()) + ":" + QString::number(dt.time().minute()) ); - QDomText msgNode = doc.createTextNode( body.stripWhiteSpace() ); + msgElem.setAttribute( "time", TQString::number(dt.date().day()) + " " + TQString::number(dt.time().hour()) + ":" + TQString::number(dt.time().minute()) ); + TQDomText msgNode = doc.createTextNode( body.stripWhiteSpace() ); docElem.appendChild( msgElem ); msgElem.appendChild( msgNode ); } @@ -274,16 +274,16 @@ void HistoryPlugin::convertOldHistory() if(!docElem.isNull()) { - QDate date(year,month,1); - QString name = protocolId.replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) + - QString::fromLatin1( "/" ) + - contactId.replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ) + + TQDate date(year,month,1); + TQString name = protocolId.replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) + + TQString::fromLatin1( "/" ) + + contactId.replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ) + date.toString(".yyyyMM"); - KSaveFile file( locateLocal( "data", QString::fromLatin1( "kopete/logs/" ) + name+ QString::fromLatin1( ".xml" ) ) ); + KSaveFile file( locateLocal( "data", TQString::fromLatin1( "kopete/logs/" ) + name+ TQString::fromLatin1( ".xml" ) ) ); 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? doc.save( *stream ,1 ); file.close(); } @@ -304,22 +304,22 @@ void HistoryPlugin::convertOldHistory() bool HistoryPlugin::detectOldHistory() { KGlobal::config()->setGroup("History Plugin"); - QString version=KGlobal::config()->readEntry( "Version" ,"0.6" ); + TQString version=KGlobal::config()->readEntry( "Version" ,"0.6" ); if(version != "0.6") return false; - QDir d( locateLocal( "data", QString::fromLatin1( "kopete/logs")) ); - d.setFilter( QDir::Dirs ); + TQDir d( locateLocal( "data", TQString::fromLatin1( "kopete/logs")) ); + d.setFilter( TQDir::Dirs ); if(d.count() >= 3) // '.' and '..' are included return false; //the new history already exists - QDir d2( locateLocal( "data", QString::fromLatin1( "kopete")) ); - d2.setFilter( QDir::Dirs ); + TQDir d2( locateLocal( "data", TQString::fromLatin1( "kopete")) ); + d2.setFilter( TQDir::Dirs ); const QFileInfoList *list = d2.entryInfoList(); QFileInfoListIterator it( *list ); - QFileInfo *fi; + TQFileInfo *fi; while ( (fi = it.current()) != 0 ) { if( dynamic_cast<Kopete::Protocol *>( Kopete::PluginManager::self()->plugin( fi->fileName() ) ) ) diff --git a/kopete/plugins/history/historydialog.cpp b/kopete/plugins/history/historydialog.cpp index 4dd98fee..5dc550be 100644 --- a/kopete/plugins/history/historydialog.cpp +++ b/kopete/plugins/history/historydialog.cpp @@ -32,15 +32,15 @@ #include <khtml_part.h> #include <khtmlview.h> -#include <qpushbutton.h> -#include <qlineedit.h> -#include <qcheckbox.h> -#include <qlayout.h> -#include <qdir.h> -#include <qdatetime.h> -#include <qheader.h> -#include <qlabel.h> -#include <qclipboard.h> +#include <tqpushbutton.h> +#include <tqlineedit.h> +#include <tqcheckbox.h> +#include <tqlayout.h> +#include <tqdir.h> +#include <tqdatetime.h> +#include <tqheader.h> +#include <tqlabel.h> +#include <tqclipboard.h> #include <kapplication.h> #include <kdebug.h> @@ -60,30 +60,30 @@ class KListViewDateItem : public KListViewItem { public: - KListViewDateItem(KListView* parent, QDate date, Kopete::MetaContact *mc); - QDate date() { return mDate; } + KListViewDateItem(KListView* parent, TQDate date, Kopete::MetaContact *mc); + TQDate date() { return mDate; } Kopete::MetaContact *metaContact() { return mMetaContact; } public: - int compare(QListViewItem *i, int col, bool ascending) const; + int compare(TQListViewItem *i, int col, bool ascending) const; private: - QDate mDate; + TQDate mDate; Kopete::MetaContact *mMetaContact; }; -KListViewDateItem::KListViewDateItem(KListView* parent, QDate date, Kopete::MetaContact *mc) +KListViewDateItem::KListViewDateItem(KListView* parent, TQDate date, Kopete::MetaContact *mc) : KListViewItem(parent, date.toString(Qt::ISODate), mc->displayName()) { mDate = date; mMetaContact = mc; } -int KListViewDateItem::compare(QListViewItem *i, int col, bool ascending) const +int KListViewDateItem::compare(TQListViewItem *i, int col, bool ascending) const { if (col) - return QListViewItem::compare(i, col, ascending); + return TQListViewItem::compare(i, col, ascending); //compare dates - do NOT use ascending var here KListViewDateItem* item = static_cast<KListViewDateItem*>(i); @@ -93,16 +93,16 @@ int KListViewDateItem::compare(QListViewItem *i, int col, bool ascending) const } -HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent, +HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, TQWidget* parent, const char* name) : KDialogBase(parent, name, false, i18n("History for %1").arg(mc->displayName()), 0), mSearching(false) { - QString fontSize; - QString htmlCode; - QString fontStyle; + TQString fontSize; + TQString htmlCode; + TQString fontStyle; kdDebug(14310) << k_funcinfo << "called." << endl; - setWFlags(Qt::WDestructiveClose); // send SIGNAL(closing()) on quit + setWFlags(Qt::WDestructiveClose); // send TQT_SIGNAL(closing()) on quit // FIXME: Allow to show this dialog for only one contact mMetaContact = mc; @@ -118,7 +118,7 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent, mMainWidget->contactComboBox->insertItem(i18n("All")); mMetaContactList = Kopete::ContactList::self()->metaContacts(); - QPtrListIterator<Kopete::MetaContact> it(mMetaContactList); + TQPtrListIterator<Kopete::MetaContact> it(mMetaContactList); for(; it.current(); ++it) { mMainWidget->contactComboBox->insertItem((*it)->displayName()); @@ -133,8 +133,8 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent, setMainWidget(mMainWidget); // Initializing HTML Part - mMainWidget->htmlFrame->setFrameStyle(QFrame::WinPanel | QFrame::Sunken); - QVBoxLayout *l = new QVBoxLayout(mMainWidget->htmlFrame); + mMainWidget->htmlFrame->setFrameStyle(TQFrame::WinPanel | TQFrame::Sunken); + TQVBoxLayout *l = new TQVBoxLayout(mMainWidget->htmlFrame); mHtmlPart = new KHTMLPart(mMainWidget->htmlFrame, "htmlHistoryView"); //Security settings, we don't need this stuff @@ -149,33 +149,33 @@ HistoryDialog::HistoryDialog(Kopete::MetaContact *mc, QWidget* parent, mHtmlView->setMarginHeight(4); mHtmlView->setFocusPolicy(NoFocus); mHtmlView->setSizePolicy( - QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + TQSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding)); l->addWidget(mHtmlView); - QTextOStream( &fontSize ) << KopetePrefs::prefs()->fontFace().pointSize(); + TQTextOStream( &fontSize ) << KopetePrefs::prefs()->fontFace().pointSize(); fontStyle = "<style>.hf { font-size:" + fontSize + ".0pt; font-family:" + KopetePrefs::prefs()->fontFace().family() + "; color: " + KopetePrefs::prefs()->textColor().name() + "; }</style>"; mHtmlPart->begin(); htmlCode = "<html><head>" + fontStyle + "</head><body class=\"hf\"></body></html>"; - mHtmlPart->write( QString::fromLatin1( htmlCode.latin1() ) ); + mHtmlPart->write( TQString::fromLatin1( htmlCode.latin1() ) ); mHtmlPart->end(); - connect(mHtmlPart->browserExtension(), SIGNAL(openURLRequestDelayed(const KURL &, const KParts::URLArgs &)), - this, SLOT(slotOpenURLRequest(const KURL &, const KParts::URLArgs &))); - connect(mMainWidget->dateListView, SIGNAL(clicked(QListViewItem*)), this, SLOT(dateSelected(QListViewItem*))); - connect(mMainWidget->searchButton, SIGNAL(clicked()), this, SLOT(slotSearch())); - connect(mMainWidget->searchLine, SIGNAL(returnPressed()), this, SLOT(slotSearch())); - connect(mMainWidget->searchLine, SIGNAL(textChanged(const QString&)), this, SLOT(slotSearchTextChanged(const QString&))); - connect(mMainWidget->searchErase, SIGNAL(clicked()), this, SLOT(slotSearchErase())); - connect(mMainWidget->contactComboBox, SIGNAL(activated(int)), this, SLOT(slotContactChanged(int))); - connect(mMainWidget->messageFilterBox, SIGNAL(activated(int)), this, SLOT(slotFilterChanged(int ))); - connect(mHtmlPart, SIGNAL(popupMenu(const QString &, const QPoint &)), this, SLOT(slotRightClick(const QString &, const QPoint &))); + connect(mHtmlPart->browserExtension(), TQT_SIGNAL(openURLRequestDelayed(const KURL &, const KParts::URLArgs &)), + this, TQT_SLOT(slotOpenURLRequest(const KURL &, const KParts::URLArgs &))); + connect(mMainWidget->dateListView, TQT_SIGNAL(clicked(TQListViewItem*)), this, TQT_SLOT(dateSelected(TQListViewItem*))); + connect(mMainWidget->searchButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSearch())); + connect(mMainWidget->searchLine, TQT_SIGNAL(returnPressed()), this, TQT_SLOT(slotSearch())); + connect(mMainWidget->searchLine, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotSearchTextChanged(const TQString&))); + connect(mMainWidget->searchErase, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSearchErase())); + connect(mMainWidget->contactComboBox, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotContactChanged(int))); + connect(mMainWidget->messageFilterBox, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotFilterChanged(int ))); + connect(mHtmlPart, TQT_SIGNAL(popupMenu(const TQString &, const TQPoint &)), this, TQT_SLOT(slotRightClick(const TQString &, const TQPoint &))); //initActions KActionCollection* ac = new KActionCollection(this); - mCopyAct = KStdAction::copy( this, SLOT(slotCopy()), ac ); - mCopyURLAct = new KAction( i18n( "Copy Link Address" ), QString::fromLatin1( "editcopy" ), 0, this, SLOT( slotCopyURL() ), ac ); + mCopyAct = KStdAction::copy( this, TQT_SLOT(slotCopy()), ac ); + mCopyURLAct = new KAction( i18n( "Copy Link Address" ), TQString::fromLatin1( "editcopy" ), 0, this, TQT_SLOT( slotCopyURL() ), ac ); resize(650, 700); centerOnScreen(this); @@ -201,7 +201,7 @@ void HistoryDialog::init() } else { - QPtrListIterator<Kopete::MetaContact> it(mMetaContactList); + TQPtrListIterator<Kopete::MetaContact> it(mMetaContactList); for(; it.current(); ++it) { HistoryLogger logger(*it, this); @@ -211,7 +211,7 @@ void HistoryDialog::init() } initProgressBar(i18n("Loading..."),mInit.dateMCList.count()); - QTimer::singleShot(0,this,SLOT(slotLoadDays())); + TQTimer::singleShot(0,this,TQT_SLOT(slotLoadDays())); } void HistoryDialog::slotLoadDays() @@ -219,7 +219,7 @@ void HistoryDialog::slotLoadDays() if(mInit.dateMCList.isEmpty()) { if (!mMainWidget->searchLine->text().isEmpty()) - QTimer::singleShot(0, this, SLOT(slotSearch())); + TQTimer::singleShot(0, this, TQT_SLOT(slotSearch())); doneProgressBar(); return; } @@ -227,23 +227,23 @@ void HistoryDialog::slotLoadDays() DMPair pair(mInit.dateMCList.first()); mInit.dateMCList.pop_front(); HistoryLogger logger(pair.metaContact(), this); - QValueList<int> dayList = logger.getDaysForMonth(pair.date()); + TQValueList<int> dayList = logger.getDaysForMonth(pair.date()); for (unsigned int i=0; i<dayList.count(); i++) { - QDate c2Date(pair.date().year(),pair.date().month(),dayList[i]); + TQDate c2Date(pair.date().year(),pair.date().month(),dayList[i]); if (mInit.dateMCList.find(pair) == mInit.dateMCList.end()) new KListViewDateItem(mMainWidget->dateListView, c2Date, pair.metaContact()); } mMainWidget->searchProgress->advance(1); - QTimer::singleShot(0,this,SLOT(slotLoadDays())); + TQTimer::singleShot(0,this,TQT_SLOT(slotLoadDays())); } void HistoryDialog::init(Kopete::MetaContact *mc) { - QPtrList<Kopete::Contact> contacts=mc->contacts(); - QPtrListIterator<Kopete::Contact> it( contacts ); + TQPtrList<Kopete::Contact> contacts=mc->contacts(); + TQPtrListIterator<Kopete::Contact> it( contacts ); for( ; it.current(); ++it ) { @@ -254,17 +254,17 @@ void HistoryDialog::init(Kopete::MetaContact *mc) void HistoryDialog::init(Kopete::Contact *c) { // Get year and month list - QRegExp rx( "\\.(\\d\\d\\d\\d)(\\d\\d)" ); - const QString contact_in_filename=c->contactId().replace( QRegExp( QString::fromLatin1( "[./~?*]" ) ), QString::fromLatin1( "-" ) ); - QFileInfo *fi; + TQRegExp rx( "\\.(\\d\\d\\d\\d)(\\d\\d)" ); + const TQString contact_in_filename=c->contactId().replace( TQRegExp( TQString::fromLatin1( "[./~?*]" ) ), TQString::fromLatin1( "-" ) ); + 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(); if ( list1 != 0 ) @@ -276,7 +276,7 @@ void HistoryDialog::init(Kopete::Contact *c) { rx.search(fi->fileName()); - QDate cDate = QDate(rx.cap(1).toInt(), rx.cap(2).toInt(), 1); + TQDate cDate = TQDate(rx.cap(1).toInt(), rx.cap(2).toInt(), 1); DMPair pair(cDate, c->metaContact()); mInit.dateMCList.append(pair); @@ -287,14 +287,14 @@ void HistoryDialog::init(Kopete::Contact *c) } // END of kopete 0.7.x check - QString logDir = 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( "-" ) ) + TQString logDir = 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( "-" ) ) ); - QDir d(logDir); - d.setFilter( QDir::Files | QDir::NoSymLinks ); - d.setSorting( QDir::Name ); + TQDir d(logDir); + d.setFilter( TQDir::Files | TQDir::NoSymLinks ); + d.setSorting( TQDir::Name ); const QFileInfoList *list = d.entryInfoList(); if ( list != 0 ) { @@ -307,7 +307,7 @@ void HistoryDialog::init(Kopete::Contact *c) rx.search(fi->fileName()); // We search for an item in the list view with the same year. If then we add the month - QDate cDate = QDate(rx.cap(1).toInt(), rx.cap(2).toInt(), 1); + TQDate cDate = TQDate(rx.cap(1).toInt(), rx.cap(2).toInt(), 1); DMPair pair(cDate, c->metaContact()); mInit.dateMCList.append(pair); @@ -317,21 +317,21 @@ void HistoryDialog::init(Kopete::Contact *c) } } -void HistoryDialog::dateSelected(QListViewItem* it) +void HistoryDialog::dateSelected(TQListViewItem* it) { KListViewDateItem *item = static_cast<KListViewDateItem*>(it); if (!item) return; - QDate chosenDate = item->date(); + TQDate chosenDate = item->date(); HistoryLogger logger(item->metaContact(), this); - QValueList<Kopete::Message> msgs=logger.readMessages(chosenDate); + TQValueList<Kopete::Message> msgs=logger.readMessages(chosenDate); setMessages(msgs); } -void HistoryDialog::setMessages(QValueList<Kopete::Message> msgs) +void HistoryDialog::setMessages(TQValueList<Kopete::Message> msgs) { // Clear View DOM::HTMLElement htmlBody = mHtmlPart->htmlDocument().body(); @@ -339,16 +339,16 @@ void HistoryDialog::setMessages(QValueList<Kopete::Message> msgs) htmlBody.removeChild(htmlBody.childNodes().item(htmlBody.childNodes().length() - 1)); // ---- - QString dir = (QApplication::reverseLayout() ? QString::fromLatin1("rtl") : - QString::fromLatin1("ltr")); + TQString dir = (TQApplication::reverseLayout() ? TQString::fromLatin1("rtl") : + TQString::fromLatin1("ltr")); - QValueList<Kopete::Message>::iterator it = msgs.begin(); + TQValueList<Kopete::Message>::iterator it = msgs.begin(); - QString accountLabel; - QString resultHTML = "<b><font color=\"red\">" + (*it).timestamp().date().toString() + "</font></b><br/>"; - DOM::HTMLElement newNode = mHtmlPart->document().createElement(QString::fromLatin1("span")); - newNode.setAttribute(QString::fromLatin1("dir"), dir); + TQString accountLabel; + TQString resultHTML = "<b><font color=\"red\">" + (*it).timestamp().date().toString() + "</font></b><br/>"; + DOM::HTMLElement newNode = mHtmlPart->document().createElement(TQString::fromLatin1("span")); + newNode.setAttribute(TQString::fromLatin1("dir"), dir); newNode.setInnerHTML(resultHTML); mHtmlPart->htmlDocument().body().appendChild(newNode); @@ -370,7 +370,7 @@ void HistoryDialog::setMessages(QValueList<Kopete::Message> msgs) } accountLabel = (*it).from()->account()->accountLabel(); - QString body = (*it).parsedBody(); + TQString body = (*it).parsedBody(); if (!mMainWidget->searchLine->text().isEmpty()) // If there is a search, then we hightlight the keywords @@ -384,8 +384,8 @@ void HistoryDialog::setMessages(QValueList<Kopete::Message> msgs) : "<font color=\"" + KopetePrefs::prefs()->textColor().light(200).name() + "\"><b><</b></font> ") + body + "<br/>"; - newNode = mHtmlPart->document().createElement(QString::fromLatin1("span")); - newNode.setAttribute(QString::fromLatin1("dir"), dir); + newNode = mHtmlPart->document().createElement(TQString::fromLatin1("span")); + newNode.setAttribute(TQString::fromLatin1("dir"), dir); newNode.setInnerHTML(resultHTML); mHtmlPart->htmlDocument().body().appendChild(newNode); @@ -405,7 +405,7 @@ void HistoryDialog::slotOpenURLRequest(const KURL &url, const KParts::URLArgs &/ } // Disable search button if there is no search text -void HistoryDialog::slotSearchTextChanged(const QString& searchText) +void HistoryDialog::slotSearchTextChanged(const TQString& searchText) { if (searchText.isEmpty()) { @@ -442,8 +442,8 @@ void HistoryDialog::slotSearchErase() * We do the search respecting the current metacontact filter item. To do this, we iterate over the * elements in the KListView (KListViewDateItems) and, for each one, we iterate over its subcontacts, * manually searching the log files of each one. To avoid searching files twice, the months that have -* been searched already are stored in searchedMonths. The matches are placed in the matches QMap. -* Finally, the current date item is checked in the matches QMap, and if it is present, it is shown. +* been searched already are stored in searchedMonths. The matches are placed in the matches TQMap. +* Finally, the current date item is checked in the matches TQMap, and if it is present, it is shown. * * Keyword highlighting is done in setMessages() : if the search field isn't empty, we highlight the * search keyword. @@ -454,9 +454,9 @@ void HistoryDialog::slotSearch() { if (mMainWidget->dateListView->childCount() == 0) return; - QRegExp rx("^ <msg.*time=\"(\\d+) \\d+:\\d+:\\d+\" >([^<]*)<"); - QMap<QDate, QValueList<Kopete::MetaContact*> > monthsSearched; - QMap<QDate, QValueList<Kopete::MetaContact*> > matches; + TQRegExp rx("^ <msg.*time=\"(\\d+) \\d+:\\d+:\\d+\" >([^<]*)<"); + TQMap<TQDate, TQValueList<Kopete::MetaContact*> > monthsSearched; + TQMap<TQDate, TQValueList<Kopete::MetaContact*> > matches; // cancel button pressed if (mSearching) @@ -480,18 +480,18 @@ void HistoryDialog::slotSearch() qApp->processEvents(); if (!mSearching) return; - QDate month(curItem->date().year(),curItem->date().month(),1); + TQDate month(curItem->date().year(),curItem->date().month(),1); // if we haven't searched the relevant history logs, search them now if (!monthsSearched[month].contains(curItem->metaContact())) { monthsSearched[month].push_back(curItem->metaContact()); - QPtrList<Kopete::Contact> contacts = curItem->metaContact()->contacts(); - for(QPtrListIterator<Kopete::Contact> it( contacts ); it.current(); ++it) + TQPtrList<Kopete::Contact> contacts = curItem->metaContact()->contacts(); + for(TQPtrListIterator<Kopete::Contact> it( contacts ); it.current(); ++it) { // get filename and open file - QString filename(HistoryLogger::getFileName(*it, curItem->date())); - if (!QFile::exists(filename)) continue; - QFile file(filename); + TQString filename(HistoryLogger::getFileName(*it, curItem->date())); + if (!TQFile::exists(filename)) continue; + TQFile file(filename); file.open(IO_ReadOnly); if (!file.isOpen()) { @@ -500,8 +500,8 @@ void HistoryDialog::slotSearch() continue; } - QTextStream stream(&file); - QString textLine; + TQTextStream stream(&file); + TQString textLine; while(!stream.atEnd()) { textLine = stream.readLine(); @@ -511,7 +511,7 @@ void HistoryDialog::slotSearch() { // only match message body if (rx.cap(2).contains(mMainWidget->searchLine->text())) - matches[QDate(curItem->date().year(),curItem->date().month(),rx.cap(1).toInt())].push_back(curItem->metaContact()); + matches[TQDate(curItem->date().year(),curItem->date().month(),rx.cap(1).toInt())].push_back(curItem->metaContact()); } // this will happen when multiline messages are searched, properly // parsing the files would fix this @@ -558,7 +558,7 @@ void HistoryDialog::slotContactChanged(int index) } } -void HistoryDialog::initProgressBar(const QString& text, int nbSteps) +void HistoryDialog::initProgressBar(const TQString& text, int nbSteps) { mMainWidget->searchProgress->setTotalSteps(nbSteps); mMainWidget->searchProgress->setProgress(0); @@ -572,7 +572,7 @@ void HistoryDialog::doneProgressBar() mMainWidget->statusLabel->setText(i18n("Ready")); } -void HistoryDialog::slotRightClick(const QString &url, const QPoint &point) +void HistoryDialog::slotRightClick(const TQString &url, const TQPoint &point) { KPopupMenu *chatWindowPopup = 0L; chatWindowPopup = new KPopupMenu(); @@ -586,28 +586,28 @@ void HistoryDialog::slotRightClick(const QString &url, const QPoint &point) mCopyAct->setEnabled( mHtmlPart->hasSelection() ); mCopyAct->plug( chatWindowPopup ); - connect( chatWindowPopup, SIGNAL( aboutToHide() ), chatWindowPopup, SLOT( deleteLater() ) ); + connect( chatWindowPopup, TQT_SIGNAL( aboutToHide() ), chatWindowPopup, TQT_SLOT( deleteLater() ) ); chatWindowPopup->popup(point); } void HistoryDialog::slotCopy() { - QString qsSelection; + TQString qsSelection; qsSelection = mHtmlPart->selectedText(); if ( qsSelection.isEmpty() ) return; - disconnect( kapp->clipboard(), SIGNAL( selectionChanged()), mHtmlPart, SLOT(slotClearSelection())); - QApplication::clipboard()->setText(qsSelection, QClipboard::Clipboard); - QApplication::clipboard()->setText(qsSelection, QClipboard::Selection); - connect( kapp->clipboard(), SIGNAL( selectionChanged()), mHtmlPart, SLOT(slotClearSelection())); + disconnect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); + TQApplication::clipboard()->setText(qsSelection, QClipboard::Clipboard); + TQApplication::clipboard()->setText(qsSelection, QClipboard::Selection); + connect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); } void HistoryDialog::slotCopyURL() { - disconnect( kapp->clipboard(), SIGNAL( selectionChanged()), mHtmlPart, SLOT(slotClearSelection())); - QApplication::clipboard()->setText( mURL, QClipboard::Clipboard); - QApplication::clipboard()->setText( mURL, QClipboard::Selection); - connect( kapp->clipboard(), SIGNAL( selectionChanged()), mHtmlPart, SLOT(slotClearSelection())); + disconnect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); + TQApplication::clipboard()->setText( mURL, QClipboard::Clipboard); + TQApplication::clipboard()->setText( mURL, QClipboard::Selection); + connect( kapp->clipboard(), TQT_SIGNAL( selectionChanged()), mHtmlPart, TQT_SLOT(slotClearSelection())); } #include "historydialog.moc" diff --git a/kopete/plugins/history/historydialog.h b/kopete/plugins/history/historydialog.h index cf26037d..63b08470 100644 --- a/kopete/plugins/history/historydialog.h +++ b/kopete/plugins/history/historydialog.h @@ -19,8 +19,8 @@ #ifndef _HISTORYDIALOG_H #define _HISTORYDIALOG_H -#include <qfile.h> -#include <qstringlist.h> +#include <tqfile.h> +#include <tqstringlist.h> #include <kdialogbase.h> #include <klistview.h> @@ -45,13 +45,13 @@ class KListViewDateItem; class DMPair { public: - DMPair() {md = QDate(0, 0, 0); mc = 0; } - DMPair(QDate d, Kopete::MetaContact *c) { md = d; mc =c; } - QDate date() const { return md; } + DMPair() {md = TQDate(0, 0, 0); mc = 0; } + DMPair(TQDate d, Kopete::MetaContact *c) { md = d; mc =c; } + TQDate date() const { return md; } Kopete::MetaContact* metaContact() const { return mc; } bool operator==(const DMPair p1) const { return p1.date() == this->date() && p1.metaContact() == this->metaContact(); } private: - QDate md; + TQDate md; Kopete::MetaContact *mc; }; @@ -64,7 +64,7 @@ class HistoryDialog : public KDialogBase Q_OBJECT public: - HistoryDialog(Kopete::MetaContact *mc, QWidget* parent=0, + HistoryDialog(Kopete::MetaContact *mc, TQWidget* parent=0, const char* name="HistoryDialog"); ~HistoryDialog(); @@ -80,20 +80,20 @@ class HistoryDialog : public KDialogBase void slotOpenURLRequest(const KURL &url, const KParts::URLArgs &/*args*/); // Called when a date is selected in the treeview - void dateSelected(QListViewItem *); + void dateSelected(TQListViewItem *); void slotSearch(); // Reinitialise search void slotSearchErase(); - void slotSearchTextChanged(const QString& txt); // To enable/disable search button + void slotSearchTextChanged(const TQString& txt); // To enable/disable search button void slotContactChanged(int index); void slotFilterChanged(int index); void init(); void slotLoadDays(); - void slotRightClick(const QString &url, const QPoint &point); + void slotRightClick(const TQString &url, const TQPoint &point); void slotCopy(); void slotCopyURL(); @@ -101,7 +101,7 @@ class HistoryDialog : public KDialogBase enum Disabled { Prev=1, Next=2 }; void refreshEnabled( /*Disabled*/ uint disabled ); - void initProgressBar(const QString& text, int nbSteps); + void initProgressBar(const TQString& text, int nbSteps); void doneProgressBar(); void init(Kopete::MetaContact *mc); void init(Kopete::Contact *c); @@ -109,7 +109,7 @@ class HistoryDialog : public KDialogBase /** * Show the messages in the HTML View */ - void setMessages(QValueList<Kopete::Message> m); + void setMessages(TQValueList<Kopete::Message> m); void listViewShowElements(bool s); @@ -123,7 +123,7 @@ class HistoryDialog : public KDialogBase */ Kopete::MetaContact *mMetaContact; - QPtrList<Kopete::MetaContact> mMetaContactList; + TQPtrList<Kopete::MetaContact> mMetaContactList; // History View KHTMLView *mHtmlView; @@ -133,14 +133,14 @@ class HistoryDialog : public KDialogBase struct Init { - QValueList<DMPair> dateMCList; // mc for MetaContact + TQValueList<DMPair> dateMCList; // mc for MetaContact } mInit; bool mSearching; KAction *mCopyAct; KAction *mCopyURLAct; - QString mURL; + TQString mURL; }; #endif diff --git a/kopete/plugins/history/historyguiclient.cpp b/kopete/plugins/history/historyguiclient.cpp index 133e50a3..4b1798ae 100644 --- a/kopete/plugins/history/historyguiclient.cpp +++ b/kopete/plugins/history/historyguiclient.cpp @@ -28,7 +28,7 @@ class HistoryPlugin; HistoryGUIClient::HistoryGUIClient(Kopete::ChatSession *parent, const char *name) - : QObject(parent, name), KXMLGUIClient(parent) + : TQObject(parent, name), KXMLGUIClient(parent) { setInstance(KGenericFactory<HistoryPlugin>::instance()); @@ -38,12 +38,12 @@ HistoryGUIClient::HistoryGUIClient(Kopete::ChatSession *parent, const char *name if(!m_manager || m_manager->members().isEmpty()) deleteLater(); - QPtrList<Kopete::Contact> mb=m_manager->members(); + TQPtrList<Kopete::Contact> mb=m_manager->members(); m_logger=new HistoryLogger( mb.first() , this ); - actionLast=new KAction( i18n("History Last" ), QString::fromLatin1( "finish" ), 0, this, SLOT(slotLast()), actionCollection() , "historyLast" ); - actionPrev = KStdAction::back( this, SLOT(slotPrevious()), actionCollection() , "historyPrevious" ); - actionNext = KStdAction::forward( this, SLOT(slotNext()), actionCollection() , "historyNext" ); + actionLast=new KAction( i18n("History Last" ), TQString::fromLatin1( "finish" ), 0, this, TQT_SLOT(slotLast()), actionCollection() , "historyLast" ); + actionPrev = KStdAction::back( this, TQT_SLOT(slotPrevious()), actionCollection() , "historyPrevious" ); + actionNext = KStdAction::forward( this, TQT_SLOT(slotNext()), actionCollection() , "historyNext" ); // we are generally at last when begining actionPrev->setEnabled(true); @@ -64,8 +64,8 @@ void HistoryGUIClient::slotPrevious() KopeteView *m_currentView = m_manager->view(true); m_currentView->clear(); - QPtrList<Kopete::Contact> mb = m_manager->members(); - QValueList<Kopete::Message> msgs = m_logger->readMessages( + TQPtrList<Kopete::Contact> mb = m_manager->members(); + TQValueList<Kopete::Message> msgs = m_logger->readMessages( HistoryConfig::number_ChatWindow(), /*mb.first()*/ 0L, HistoryLogger::AntiChronological, true); @@ -81,9 +81,9 @@ void HistoryGUIClient::slotLast() KopeteView *m_currentView = m_manager->view(true); m_currentView->clear(); - QPtrList<Kopete::Contact> mb = m_manager->members(); + TQPtrList<Kopete::Contact> mb = m_manager->members(); m_logger->setPositionToLast(); - QValueList<Kopete::Message> msgs = m_logger->readMessages( + TQValueList<Kopete::Message> msgs = m_logger->readMessages( HistoryConfig::number_ChatWindow(), /*mb.first()*/ 0L, HistoryLogger::AntiChronological, true); @@ -100,8 +100,8 @@ void HistoryGUIClient::slotNext() KopeteView *m_currentView = m_manager->view(true); m_currentView->clear(); - QPtrList<Kopete::Contact> mb = m_manager->members(); - QValueList<Kopete::Message> msgs = m_logger->readMessages( + TQPtrList<Kopete::Contact> mb = m_manager->members(); + TQValueList<Kopete::Message> msgs = m_logger->readMessages( HistoryConfig::number_ChatWindow(), /*mb.first()*/ 0L, HistoryLogger::Chronological, false); diff --git a/kopete/plugins/history/historyguiclient.h b/kopete/plugins/history/historyguiclient.h index 420795e0..792325fc 100644 --- a/kopete/plugins/history/historyguiclient.h +++ b/kopete/plugins/history/historyguiclient.h @@ -16,7 +16,7 @@ #ifndef HISTORYGUICLIENT_H #define HISTORYGUICLIENT_H -#include <qobject.h> +#include <tqobject.h> #include <kxmlguiclient.h> namespace Kopete { class ChatSession; } @@ -26,7 +26,7 @@ class KAction; /** *@author Olivier Goffart */ -class HistoryGUIClient : public QObject , public KXMLGUIClient +class HistoryGUIClient : public TQObject , public KXMLGUIClient { Q_OBJECT public: 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; diff --git a/kopete/plugins/history/historylogger.h b/kopete/plugins/history/historylogger.h index 85cdbdd7..49e368d9 100644 --- a/kopete/plugins/history/historylogger.h +++ b/kopete/plugins/history/historylogger.h @@ -17,7 +17,7 @@ #ifndef HISTORYLOGGER_H #define HISTORYLOGGER_H -#include <qobject.h> +#include <tqobject.h> #include "kopetemessage.h" //TODO: REMOVE namespace Kopete { class Contact; } @@ -46,8 +46,8 @@ public: /** * Constructor, takes the contact, and the color of messages */ - HistoryLogger( Kopete::MetaContact *m , QObject *parent = 0, const char *name = 0); - HistoryLogger( Kopete::Contact *c , QObject *parent = 0, const char *name = 0); + HistoryLogger( Kopete::MetaContact *m , TQObject *parent = 0, const char *name = 0); + HistoryLogger( Kopete::Contact *c , TQObject *parent = 0, const char *name = 0); ~HistoryLogger(); @@ -62,10 +62,10 @@ public: * set a searching filter * @param filter is the string to search * @param caseSensitive say if the case is important - * @param isRegExp say if the filter is a QRegExp, or a simle string + * @param isRegExp say if the filter is a TQRegExp, or a simle string */ - void setFilter(const QString& filter, bool caseSensitive=false , bool isRegExp=false); - QString filter() const; + void setFilter(const TQString& filter, bool caseSensitive=false , bool isRegExp=false); + TQString filter() const; bool filterCaseSensitive() const ; bool filterRegExp() const; @@ -83,7 +83,7 @@ public: * read @param lines message from the current position * from Kopete::Contact @param c in the given @param sens */ - QValueList<Kopete::Message> readMessages(unsigned int lines, + TQValueList<Kopete::Message> readMessages(unsigned int lines, const Kopete::Contact *c=0, Sens sens=Default, bool reverseOrder=false, bool colorize=true); @@ -92,7 +92,7 @@ public: * because its structure is really different. * Read all the messages for the given @param date */ - QValueList<Kopete::Message> readMessages(QDate date); + TQValueList<Kopete::Message> readMessages(TQDate date); /** @@ -113,40 +113,40 @@ public: /** * @return The list of the days for which there is a log for m_metaContact for month of * @param date (don't care of the day) */ - QValueList<int> getDaysForMonth(QDate date); + TQValueList<int> getDaysForMonth(TQDate date); /** * Get the filename of the xml file which contains the history from the * contact in the specified @param date. Specify @param date in order to get the filename for * the given date.year() date.month(). */ - static QString getFileName(const Kopete::Contact* , QDate date); + static TQString getFileName(const Kopete::Contact* , TQDate date); private: bool m_hideOutgoing; bool m_filterCaseSensitive; bool m_filterRegExp; - QString m_filter; + TQString m_filter; /* - *contais all QDomDocument, for a KC, for a specified Month + *contais all TQDomDocument, for a KC, for a specified Month */ - QMap<const Kopete::Contact*,QMap<unsigned int , QDomDocument> > m_documents; + TQMap<const Kopete::Contact*,TQMap<unsigned int , TQDomDocument> > m_documents; /** * Contains the current message. * in fact, this is the next, still not showed */ - QMap<const Kopete::Contact*, QDomElement> m_currentElements; + TQMap<const Kopete::Contact*, TQDomElement> m_currentElements; /** * Get the document, open it is @param canload is true, contain is set to false if the document * is not already contained */ - QDomDocument getDocument(const Kopete::Contact *c, unsigned int month , bool canLoad=true , bool* contain=0L); + TQDomDocument getDocument(const Kopete::Contact *c, unsigned int month , bool canLoad=true , bool* contain=0L); - QDomDocument getDocument(const Kopete::Contact *c, const QDate date, bool canLoad=true, bool* contain=0L); + TQDomDocument getDocument(const Kopete::Contact *c, const TQDate date, bool canLoad=true, bool* contain=0L); /** * look over files to get the last month for this contact @@ -175,16 +175,16 @@ private: /* * keep the old position in memory, so if we change the sens, we can begin here */ - QMap<const Kopete::Contact*, QDomElement> m_oldElements; + TQMap<const Kopete::Contact*, TQDomElement> m_oldElements; unsigned int m_oldMonth; Sens m_oldSens; /** * the timer used to save the file */ - QTimer *m_saveTimer; - QDomDocument m_toSaveDocument; - QString m_toSaveFileName; + TQTimer *m_saveTimer; + TQDomDocument m_toSaveDocument; + TQString m_toSaveFileName; unsigned int m_saveTimerTime; //time in ms between each save /** @@ -199,7 +199,7 @@ private: * due to a bug in QT, i have to keep the document element in the memory to * prevent crashes */ - QValueList<QDomElement> workaround; + TQValueList<TQDomElement> workaround; private slots: /** diff --git a/kopete/plugins/history/historyplugin.cpp b/kopete/plugins/history/historyplugin.cpp index bf8d70b4..af92fc09 100644 --- a/kopete/plugins/history/historyplugin.cpp +++ b/kopete/plugins/history/historyplugin.cpp @@ -41,22 +41,22 @@ typedef KGenericFactory<HistoryPlugin> HistoryPluginFactory; static const KAboutData aboutdata("kopete_history", I18N_NOOP("History") , "1.0" ); K_EXPORT_COMPONENT_FACTORY( kopete_history, HistoryPluginFactory( &aboutdata ) ) -HistoryPlugin::HistoryPlugin( QObject *parent, const char *name, const QStringList & /* args */ ) +HistoryPlugin::HistoryPlugin( TQObject *parent, const char *name, const TQStringList & /* args */ ) : Kopete::Plugin( HistoryPluginFactory::instance(), parent, name ), m_loggerFactory( this ) { KAction *viewMetaContactHistory = new KAction( i18n("View &History" ), - QString::fromLatin1( "history" ), 0, this, SLOT(slotViewHistory()), + TQString::fromLatin1( "history" ), 0, this, TQT_SLOT(slotViewHistory()), actionCollection(), "viewMetaContactHistory" ); viewMetaContactHistory->setEnabled( Kopete::ContactList::self()->selectedMetaContacts().count() == 1 ); - connect(Kopete::ContactList::self(), SIGNAL(metaContactSelected(bool)), - viewMetaContactHistory, SLOT(setEnabled(bool))); + connect(Kopete::ContactList::self(), TQT_SIGNAL(metaContactSelected(bool)), + viewMetaContactHistory, TQT_SLOT(setEnabled(bool))); - connect(Kopete::ChatSessionManager::self(), SIGNAL(viewCreated(KopeteView*)), - this, SLOT(slotViewCreated(KopeteView*))); + connect(Kopete::ChatSessionManager::self(), TQT_SIGNAL(viewCreated(KopeteView*)), + this, TQT_SLOT(slotViewCreated(KopeteView*))); - connect(this, SIGNAL(settingsChanged()), this, SLOT(slotSettingsChanged())); + connect(this, TQT_SIGNAL(settingsChanged()), this, TQT_SLOT(slotSettingsChanged())); setXMLFile("historyui.rc"); if(detectOldHistory()) @@ -73,14 +73,14 @@ HistoryPlugin::HistoryPlugin( QObject *parent, const char *name, const QStringLi // Add GUI action to all existing kmm objects // (Needed if the plugin is enabled while kopete is already running) - QValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions(); - for (QValueListIterator<Kopete::ChatSession*> it= sessions.begin(); it!=sessions.end() ; ++it) + TQValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions(); + for (TQValueListIterator<Kopete::ChatSession*> it= sessions.begin(); it!=sessions.end() ; ++it) { if(!m_loggers.contains(*it)) { m_loggers.insert(*it, new HistoryGUIClient( *it ) ); - connect( *it, SIGNAL(closing(Kopete::ChatSession*)), - this, SLOT(slotKMMClosed(Kopete::ChatSession*))); + connect( *it, TQT_SIGNAL(closing(Kopete::ChatSession*)), + this, TQT_SLOT(slotKMMClosed(Kopete::ChatSession*))); } } } @@ -105,14 +105,14 @@ void HistoryPlugin::messageDisplayed(const Kopete::Message &m) if(!m_loggers.contains(m.manager())) { m_loggers.insert(m.manager() , new HistoryGUIClient( m.manager() ) ); - connect(m.manager(), SIGNAL(closing(Kopete::ChatSession*)), - this, SLOT(slotKMMClosed(Kopete::ChatSession*))); + connect(m.manager(), TQT_SIGNAL(closing(Kopete::ChatSession*)), + this, TQT_SLOT(slotKMMClosed(Kopete::ChatSession*))); } HistoryLogger *l=m_loggers[m.manager()]->logger(); if(l) { - QPtrList<Kopete::Contact> mb=m.manager()->members(); + TQPtrList<Kopete::Contact> mb=m.manager()->members(); l->appendMessage(m,mb.first()); } @@ -136,7 +136,7 @@ void HistoryPlugin::slotViewHistory() void HistoryPlugin::slotViewCreated( KopeteView* v ) { - if(v->plugin()->pluginInfo()->pluginName() != QString::fromLatin1("kopete_chatwindow") ) + if(v->plugin()->pluginInfo()->pluginName() != TQString::fromLatin1("kopete_chatwindow") ) return; //Email chat windows are not supported. bool autoChatWindow = HistoryConfig::auto_chatwindow(); @@ -144,7 +144,7 @@ void HistoryPlugin::slotViewCreated( KopeteView* v ) KopeteView *m_currentView = v; Kopete::ChatSession *m_currentChatSession = v->msgManager(); - QPtrList<Kopete::Contact> mb = m_currentChatSession->members(); + TQPtrList<Kopete::Contact> mb = m_currentChatSession->members(); if(!m_currentChatSession) return; //i am sorry @@ -152,8 +152,8 @@ void HistoryPlugin::slotViewCreated( KopeteView* v ) if(!m_loggers.contains(m_currentChatSession)) { m_loggers.insert(m_currentChatSession , new HistoryGUIClient( m_currentChatSession ) ); - connect( m_currentChatSession, SIGNAL(closing(Kopete::ChatSession*)), - this , SLOT(slotKMMClosed(Kopete::ChatSession*))); + connect( m_currentChatSession, TQT_SIGNAL(closing(Kopete::ChatSession*)), + this , TQT_SLOT(slotKMMClosed(Kopete::ChatSession*))); } if(!autoChatWindow || nbAutoChatWindow == 0) @@ -163,7 +163,7 @@ void HistoryPlugin::slotViewCreated( KopeteView* v ) logger->setPositionToLast(); - QValueList<Kopete::Message> msgs = logger->readMessages(nbAutoChatWindow, + TQValueList<Kopete::Message> msgs = logger->readMessages(nbAutoChatWindow, /*mb.first()*/ 0L, HistoryLogger::AntiChronological, true, true); // make sure the last message is not the one which will be appened right diff --git a/kopete/plugins/history/historyplugin.h b/kopete/plugins/history/historyplugin.h index 63e2c87b..8c0f553d 100644 --- a/kopete/plugins/history/historyplugin.h +++ b/kopete/plugins/history/historyplugin.h @@ -18,9 +18,9 @@ #ifndef HISTORYPLUGIN_H #define HISTORYPLUGIN_H -#include <qobject.h> -#include <qmap.h> -#include <qstring.h> +#include <tqobject.h> +#include <tqmap.h> +#include <tqstring.h> #include "kopeteplugin.h" @@ -75,7 +75,7 @@ class HistoryPlugin : public Kopete::Plugin { Q_OBJECT public: - HistoryPlugin( QObject *parent, const char *name, const QStringList &args ); + HistoryPlugin( TQObject *parent, const char *name, const TQStringList &args ); ~HistoryPlugin(); /** @@ -97,7 +97,7 @@ class HistoryPlugin : public Kopete::Plugin private: HistoryMessageLoggerFactory m_loggerFactory; - QMap<Kopete::ChatSession*,HistoryGUIClient*> m_loggers; + TQMap<Kopete::ChatSession*,HistoryGUIClient*> m_loggers; Kopete::Message m_lastmessage; }; diff --git a/kopete/plugins/history/historypreferences.cpp b/kopete/plugins/history/historypreferences.cpp index 61fce469..370e6721 100644 --- a/kopete/plugins/history/historypreferences.cpp +++ b/kopete/plugins/history/historypreferences.cpp @@ -20,29 +20,29 @@ #include "historyprefsui.h" #include <kgenericfactory.h> -#include <qlayout.h> -#include <qgroupbox.h> +#include <tqlayout.h> +#include <tqgroupbox.h> #include <kcolorbutton.h> #include <knuminput.h> -#include <qcheckbox.h> +#include <tqcheckbox.h> typedef KGenericFactory<HistoryPreferences> HistoryConfigFactory; K_EXPORT_COMPONENT_FACTORY( kcm_kopete_history, HistoryConfigFactory( "kcm_kopete_history" ) ) -HistoryPreferences::HistoryPreferences(QWidget *parent, const char*/*name*/, const QStringList &args) +HistoryPreferences::HistoryPreferences(TQWidget *parent, const char*/*name*/, const TQStringList &args) : KCModule(HistoryConfigFactory::instance(), parent, args) { kdDebug(14310) << k_funcinfo << "called." << endl; - (new QVBoxLayout(this))->setAutoAdd(true); + (new TQVBoxLayout(this))->setAutoAdd(true); p = new HistoryPrefsUI(this); - connect(p->chkShowPrevious, SIGNAL(toggled(bool)), this, SLOT(slotShowPreviousChanged(bool))); - connect(p->Number_Auto_chatwindow, SIGNAL(valueChanged(int)), - this, SLOT(slotModified())); - connect(p->Number_ChatWindow, SIGNAL(valueChanged(int)), - this, SLOT(slotModified())); - connect(p->History_color, SIGNAL(changed(const QColor&)), - this, SLOT(slotModified())); + connect(p->chkShowPrevious, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotShowPreviousChanged(bool))); + connect(p->Number_Auto_chatwindow, TQT_SIGNAL(valueChanged(int)), + this, TQT_SLOT(slotModified())); + connect(p->Number_ChatWindow, TQT_SIGNAL(valueChanged(int)), + this, TQT_SLOT(slotModified())); + connect(p->History_color, TQT_SIGNAL(changed(const TQColor&)), + this, TQT_SLOT(slotModified())); load(); } diff --git a/kopete/plugins/history/historypreferences.h b/kopete/plugins/history/historypreferences.h index 247e2bc8..bed6de7b 100644 --- a/kopete/plugins/history/historypreferences.h +++ b/kopete/plugins/history/historypreferences.h @@ -19,7 +19,7 @@ #define HISTORYPREFERENCES_H #include <kcmodule.h> -#include <qstring.h> +#include <tqstring.h> class HistoryPrefsUI; @@ -30,8 +30,8 @@ class HistoryPreferences : public KCModule { Q_OBJECT public: - HistoryPreferences(QWidget *parent=0, const char* name=0, - const QStringList &args = QStringList()); + HistoryPreferences(TQWidget *parent=0, const char* name=0, + const TQStringList &args = TQStringList()); ~HistoryPreferences(); virtual void save(); |