summaryrefslogtreecommitdiffstats
path: root/kmail/popaccount.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmail/popaccount.cpp')
-rw-r--r--kmail/popaccount.cpp146
1 files changed, 73 insertions, 73 deletions
diff --git a/kmail/popaccount.cpp b/kmail/popaccount.cpp
index ebe8bf48b..94dbf8a5e 100644
--- a/kmail/popaccount.cpp
+++ b/kmail/popaccount.cpp
@@ -47,13 +47,13 @@ using KPIM::BroadcastStatus;
#include <kconfig.h>
using KIO::MetaData;
-#include <qstylesheet.h>
+#include <tqstylesheet.h>
static const unsigned short int pop3DefaultPort = 110;
namespace KMail {
//-----------------------------------------------------------------------------
-PopAccount::PopAccount(AccountManager* aOwner, const QString& aAccountName, uint id)
+PopAccount::PopAccount(AccountManager* aOwner, const TQString& aAccountName, uint id)
: NetworkAccount(aOwner, aAccountName, id),
headerIt(headersOnServer),
processMsgsTimer( 0, "processMsgsTimer" )
@@ -72,10 +72,10 @@ PopAccount::PopAccount(AccountManager* aOwner, const QString& aAccountName, uint
mUidsOfNextSeenMsgsDict.setAutoDelete( false );
headersOnServer.setAutoDelete(true);
- connect(&processMsgsTimer,SIGNAL(timeout()),SLOT(slotProcessPendingMsgs()));
+ connect(&processMsgsTimer,TQT_SIGNAL(timeout()),TQT_SLOT(slotProcessPendingMsgs()));
KIO::Scheduler::connect(
- SIGNAL(slaveError(KIO::Slave *, int, const QString &)),
- this, SLOT(slotSlaveError(KIO::Slave *, int, const QString &)));
+ TQT_SIGNAL(slaveError(KIO::Slave *, int, const TQString &)),
+ this, TQT_SLOT(slotSlaveError(KIO::Slave *, int, const TQString &)));
mHeaderDeleteUids.clear();
mHeaderDownUids.clear();
@@ -96,12 +96,12 @@ PopAccount::~PopAccount()
//-----------------------------------------------------------------------------
-QString PopAccount::type(void) const
+TQString PopAccount::type(void) const
{
return "pop";
}
-QString PopAccount::protocol() const {
+TQString PopAccount::protocol() const {
return useSSL() ? POP_SSL_PROTOCOL : POP_PROTOCOL;
}
@@ -148,12 +148,12 @@ void PopAccount::processNewMail(bool _interactive)
if ( (mAskAgain || passwd().isEmpty() || mLogin.isEmpty()) &&
mAuth != "GSSAPI" ) {
- QString passwd = NetworkAccount::passwd();
+ TQString passwd = NetworkAccount::passwd();
bool b = storePasswd();
if (KIO::PasswordDialog::getNameAndPassword(mLogin, passwd, &b,
i18n("You need to supply a username and a password to access this "
- "mailbox."), false, QString::null, mName, i18n("Account:"))
- != QDialog::Accepted)
+ "mailbox."), false, TQString::null, mName, i18n("Account:"))
+ != TQDialog::Accepted)
{
checkDone( false, CheckAborted );
return;
@@ -166,15 +166,15 @@ void PopAccount::processNewMail(bool _interactive)
}
}
- QString seenUidList = locateLocal( "data", "kmail/" + mLogin + ":" + "@" +
- mHost + ":" + QString("%1").arg(mPort) );
+ TQString seenUidList = locateLocal( "data", "kmail/" + mLogin + ":" + "@" +
+ mHost + ":" + TQString("%1").arg(mPort) );
KConfig config( seenUidList );
- QStringList uidsOfSeenMsgs = config.readListEntry( "seenUidList" );
- QValueList<int> timeOfSeenMsgs = config.readIntListEntry( "seenUidTimeList" );
+ TQStringList uidsOfSeenMsgs = config.readListEntry( "seenUidList" );
+ TQValueList<int> timeOfSeenMsgs = config.readIntListEntry( "seenUidTimeList" );
mUidsOfSeenMsgsDict.clear();
mUidsOfSeenMsgsDict.resize( KMail::nextPrime( ( uidsOfSeenMsgs.count() * 11 ) / 10 ) );
int idx = 1;
- for ( QStringList::ConstIterator it = uidsOfSeenMsgs.begin();
+ for ( TQStringList::ConstIterator it = uidsOfSeenMsgs.begin();
it != uidsOfSeenMsgs.end(); ++it, idx++ ) {
// we use mUidsOfSeenMsgsDict to just provide fast random access to the
// keys, so we can store the index(+1) that corresponds to the index of
@@ -183,7 +183,7 @@ void PopAccount::processNewMail(bool _interactive)
}
mTimeOfSeenMsgsVector.clear();
mTimeOfSeenMsgsVector.reserve( timeOfSeenMsgs.size() );
- for ( QValueList<int>::ConstIterator it = timeOfSeenMsgs.begin();
+ for ( TQValueList<int>::ConstIterator it = timeOfSeenMsgs.begin();
it != timeOfSeenMsgs.end(); ++it) {
mTimeOfSeenMsgsVector.append( *it );
}
@@ -192,8 +192,8 @@ void PopAccount::processNewMail(bool _interactive)
// them all as newly seen by clearing the seen times vector
if ( mTimeOfSeenMsgsVector.count() != mUidsOfSeenMsgsDict.count() )
mTimeOfSeenMsgsVector.clear();
- QStringList downloadLater = config.readListEntry( "downloadLater" );
- for ( QStringList::Iterator it = downloadLater.begin(); it != downloadLater.end(); ++it ) {
+ TQStringList downloadLater = config.readListEntry( "downloadLater" );
+ for ( TQStringList::Iterator it = downloadLater.begin(); it != downloadLater.end(); ++it ) {
mHeaderLaterUids.insert( *it, true );
}
mUidsOfNextSeenMsgsDict.clear();
@@ -286,12 +286,12 @@ void PopAccount::setFilterOnServerCheckSize(unsigned int aSize)
//-----------------------------------------------------------------------------
void PopAccount::connectJob() {
KIO::Scheduler::assignJobToSlave(mSlave, job);
- connect(job, SIGNAL( data( KIO::Job*, const QByteArray &)),
- SLOT( slotData( KIO::Job*, const QByteArray &)));
- connect(job, SIGNAL( result( KIO::Job * ) ),
- SLOT( slotResult( KIO::Job * ) ) );
- connect(job, SIGNAL(infoMessage( KIO::Job*, const QString & )),
- SLOT( slotMsgRetrieved(KIO::Job*, const QString &)));
+ connect(job, TQT_SIGNAL( data( KIO::Job*, const TQByteArray &)),
+ TQT_SLOT( slotData( KIO::Job*, const TQByteArray &)));
+ connect(job, TQT_SIGNAL( result( KIO::Job * ) ),
+ TQT_SLOT( slotResult( KIO::Job * ) ) );
+ connect(job, TQT_SIGNAL(infoMessage( KIO::Job*, const TQString & )),
+ TQT_SLOT( slotMsgRetrieved(KIO::Job*, const TQString &)));
}
@@ -313,9 +313,9 @@ void PopAccount::slotProcessPendingMsgs()
mProcessing = true;
bool addedOk;
- QValueList<KMMessage*>::Iterator cur = msgsAwaitingProcessing.begin();
- QStringList::Iterator curId = msgIdsAwaitingProcessing.begin();
- QStringList::Iterator curUid = msgUidsAwaitingProcessing.begin();
+ TQValueList<KMMessage*>::Iterator cur = msgsAwaitingProcessing.begin();
+ TQStringList::Iterator curId = msgIdsAwaitingProcessing.begin();
+ TQStringList::Iterator curUid = msgUidsAwaitingProcessing.begin();
while (cur != msgsAwaitingProcessing.end()) {
// note we can actually end up processing events in processNewMsg
@@ -353,8 +353,8 @@ void PopAccount::slotAbortRequested()
{
if (stage == Idle) return;
if ( mMailCheckProgressItem )
- disconnect( mMailCheckProgressItem, SIGNAL( progressItemCanceled( KPIM::ProgressItem* ) ),
- this, SLOT( slotAbortRequested() ) );
+ disconnect( mMailCheckProgressItem, TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem* ) ),
+ this, TQT_SLOT( slotAbortRequested() ) );
stage = Quit;
if (job) job->kill();
job = 0;
@@ -397,15 +397,15 @@ void PopAccount::startJob()
indexOfCurrentMsg = -1;
Q_ASSERT( !mMailCheckProgressItem );
- QString escapedName = QStyleSheet::escape( mName );
+ TQString escapedName = TQStyleSheet::escape( mName );
mMailCheckProgressItem = KPIM::ProgressManager::createProgressItem(
"MailCheck" + mName,
escapedName,
i18n("Preparing transmission from \"%1\"...").arg( escapedName ),
true, // can be canceled
useSSL() || useTLS() );
- connect( mMailCheckProgressItem, SIGNAL( progressItemCanceled( KPIM::ProgressItem* ) ),
- this, SLOT( slotAbortRequested() ) );
+ connect( mMailCheckProgressItem, TQT_SIGNAL( progressItemCanceled( KPIM::ProgressItem* ) ),
+ this, TQT_SLOT( slotAbortRequested() ) );
numBytes = 0;
numBytesRead = 0;
@@ -416,7 +416,7 @@ void PopAccount::startJob()
slotSlaveError(0, KIO::ERR_CANNOT_LAUNCH_PROCESS, url.protocol());
return;
}
- url.setPath(QString("/index"));
+ url.setPath(TQString("/index"));
job = KIO::get( url, false, false );
connectJob();
}
@@ -441,7 +441,7 @@ MetaData PopAccount::slaveConfig() const {
//-----------------------------------------------------------------------------
// one message is finished
// add data to a KMMessage
-void PopAccount::slotMsgRetrieved(KIO::Job*, const QString & infoMsg)
+void PopAccount::slotMsgRetrieved(KIO::Job*, const TQString & infoMsg)
{
if (infoMsg != "message complete") return;
KMMessage *msg = new KMMessage;
@@ -474,14 +474,14 @@ void PopAccount::slotMsgRetrieved(KIO::Job*, const QString & infoMsg)
//-----------------------------------------------------------------------------
// finit state machine to cycle trow the stages
void PopAccount::slotJobFinished() {
- QStringList emptyList;
+ TQStringList emptyList;
if (stage == List) {
kdDebug(5006) << k_funcinfo << "stage == List" << endl;
// set the initial size of mUidsOfNextSeenMsgsDict to the number of
// messages on the server + 10%
mUidsOfNextSeenMsgsDict.resize( KMail::nextPrime( ( idsOfMsgs.count() * 11 ) / 10 ) );
KURL url = getUrl();
- url.setPath(QString("/uidl"));
+ url.setPath(TQString("/uidl"));
job = KIO::get( url, false, false );
connectJob();
stage = Uidl;
@@ -503,7 +503,7 @@ void PopAccount::slotJobFinished() {
//check if filter on server
if (mFilterOnServer == true) {
- QMap<QString, int>::Iterator hids;
+ TQMap<TQString, int>::Iterator hids;
for ( hids = mMsgsPendingDownload.begin();
hids != mMsgsPendingDownload.end(); hids++ ) {
kdDebug(5006) << "Length: " << hids.data() << endl;
@@ -535,7 +535,7 @@ void PopAccount::slotJobFinished() {
if ((headersOnServer.count() > 0) && (mFilterOnServer == true)) {
headerIt.toFirst();
KURL url = getUrl();
- QString headerIds;
+ TQString headerIds;
while (headerIt.current())
{
headerIds += headerIt.current()->id();
@@ -543,7 +543,7 @@ void PopAccount::slotJobFinished() {
++headerIt;
}
headerIt.toFirst();
- url.setPath(QString("/headers/") + headerIds);
+ url.setPath(TQString("/headers/") + headerIds);
job = KIO::get( url, false, false );
connectJob();
slotGetNextHdr();
@@ -553,11 +553,11 @@ void PopAccount::slotJobFinished() {
stage = Retr;
numMsgs = mMsgsPendingDownload.count();
numBytesToRead = 0;
- QMap<QString, int>::Iterator len;
+ TQMap<TQString, int>::Iterator len;
for ( len = mMsgsPendingDownload.begin();
len != mMsgsPendingDownload.end(); len++ )
numBytesToRead += len.data();
- idsOfMsgs = QStringList( mMsgsPendingDownload.keys() );
+ idsOfMsgs = TQStringList( mMsgsPendingDownload.keys() );
KURL url = getUrl();
url.setPath( "/download/" + idsOfMsgs.join(",") );
job = KIO::get( url, false, false );
@@ -649,11 +649,11 @@ void PopAccount::slotJobFinished() {
stage = Retr;
numMsgs = mMsgsPendingDownload.count();
numBytesToRead = 0;
- QMap<QString, int>::Iterator len;
+ TQMap<TQString, int>::Iterator len;
for (len = mMsgsPendingDownload.begin();
len != mMsgsPendingDownload.end(); len++)
numBytesToRead += len.data();
- idsOfMsgs = QStringList( mMsgsPendingDownload.keys() );
+ idsOfMsgs = TQStringList( mMsgsPendingDownload.keys() );
KURL url = getUrl();
url.setPath( "/download/" + idsOfMsgs.join(",") );
job = KIO::get( url, false, false );
@@ -673,7 +673,7 @@ void PopAccount::slotJobFinished() {
kmkernel->folderMgr()->syncAllFolders();
KURL url = getUrl();
- QMap< QPair<time_t, QString>, int > idsToSave;
+ TQMap< QPair<time_t, TQString>, int > idsToSave;
idsToSave.clear();
// Check if we want to keep any messages
if ( mLeaveOnServer && !idsOfMsgsToDelete.isEmpty() ) {
@@ -685,14 +685,14 @@ void PopAccount::slotJobFinished() {
else if ( mLeaveOnServerDays > 0 && !mTimeOfNextSeenMsgsMap.isEmpty() ) {
time_t timeLimit = time(0) - (86400 * mLeaveOnServerDays);
kdDebug() << "timeLimit is " << timeLimit << endl;
- QStringList::Iterator cur = idsOfMsgsToDelete.begin();
+ TQStringList::Iterator cur = idsOfMsgsToDelete.begin();
for ( ; cur != idsOfMsgsToDelete.end(); ++cur) {
time_t msgTime = mTimeOfNextSeenMsgsMap[mUidForIdMap[*cur]];
kdDebug() << "id: " << *cur << " msgTime: " << msgTime << endl;
if (msgTime >= timeLimit ||
!mTimeOfNextSeenMsgsMap[mUidForIdMap[*cur]]) {
kdDebug() << "Saving msg id " << *cur << endl;
- QPair<time_t, QString> msg(msgTime, *cur);
+ QPair<time_t, TQString> msg(msgTime, *cur);
idsToSave.insert( msg, 1 );
}
}
@@ -702,7 +702,7 @@ void PopAccount::slotJobFinished() {
int numToDelete = idsToSave.count() - mLeaveOnServerCount;
kdDebug() << "numToDelete is " << numToDelete << endl;
if ( numToDelete > 0 && (unsigned)numToDelete < idsToSave.count() ) {
- QMap< QPair<time_t, QString>, int >::Iterator cur = idsToSave.begin();
+ TQMap< QPair<time_t, TQString>, int >::Iterator cur = idsToSave.begin();
for ( int deleted = 0; deleted < numToDelete && cur != idsToSave.end()
; deleted++, cur++ ) {
kdDebug() << "deleting msg id " << cur.key().second << endl;
@@ -715,7 +715,7 @@ void PopAccount::slotJobFinished() {
// Delete more old messages until we're under mLeaveOnServerSize MBs
if ( mLeaveOnServerSize > 0 ) {
double sizeOnServer = 0;
- QMap< QPair<time_t, QString>, int >::Iterator cur = idsToSave.begin();
+ TQMap< QPair<time_t, TQString>, int >::Iterator cur = idsToSave.begin();
for ( ; cur != idsToSave.end(); cur++ ) {
sizeOnServer +=
*mSizeOfNextSeenMsgsDict[ mUidForIdMap[ cur.key().second ] ];
@@ -730,7 +730,7 @@ void PopAccount::slotJobFinished() {
}
}
// Save msgs from deletion
- QMap< QPair<time_t, QString>, int >::Iterator it = idsToSave.begin();
+ TQMap< QPair<time_t, TQString>, int >::Iterator it = idsToSave.begin();
kdDebug() << "Going to save " << idsToSave.count() << endl;
for ( ; it != idsToSave.end(); ++it ) {
kdDebug() << "saving msg id " << it.key().second << endl;
@@ -762,7 +762,7 @@ void PopAccount::slotJobFinished() {
"Fetched %n messages from %1. Terminating transmission...",
numMsgs )
.arg( mHost ) );
- url.setPath(QString("/commit"));
+ url.setPath(TQString("/commit"));
kdDebug(5006) << "url: " << url.prettyURL() << endl;
}
job = KIO::get( url, false, false );
@@ -771,7 +771,7 @@ void PopAccount::slotJobFinished() {
else if (stage == Dele) {
kdDebug(5006) << k_funcinfo << "stage == Dele" << endl;
// remove the uids of all messages which have been deleted
- for ( QStringList::ConstIterator it = idsOfMsgsToDelete.begin();
+ for ( TQStringList::ConstIterator it = idsOfMsgsToDelete.begin();
it != idsOfMsgsToDelete.end(); ++it ) {
mUidsOfNextSeenMsgsDict.remove( mUidForIdMap[*it] );
}
@@ -783,7 +783,7 @@ void PopAccount::slotJobFinished() {
numMsgs )
.arg( mHost ) );
KURL url = getUrl();
- url.setPath(QString("/commit"));
+ url.setPath(TQString("/commit"));
job = KIO::get( url, false, false );
stage = Quit;
connectJob();
@@ -833,19 +833,19 @@ void PopAccount::saveUidList()
// a new list from the server
if (!mUidlFinished) return;
- QStringList uidsOfNextSeenMsgs;
- QValueList<int> seenUidTimeList;
- QDictIterator<int> it( mUidsOfNextSeenMsgsDict );
+ TQStringList uidsOfNextSeenMsgs;
+ TQValueList<int> seenUidTimeList;
+ TQDictIterator<int> it( mUidsOfNextSeenMsgsDict );
for( ; it.current(); ++it ) {
uidsOfNextSeenMsgs.append( it.currentKey() );
seenUidTimeList.append( mTimeOfNextSeenMsgsMap[it.currentKey()] );
}
- QString seenUidList = locateLocal( "data", "kmail/" + mLogin + ":" + "@" +
- mHost + ":" + QString("%1").arg(mPort) );
+ TQString seenUidList = locateLocal( "data", "kmail/" + mLogin + ":" + "@" +
+ mHost + ":" + TQString("%1").arg(mPort) );
KConfig config( seenUidList );
config.writeEntry( "seenUidList", uidsOfNextSeenMsgs );
config.writeEntry( "seenUidTimeList", seenUidTimeList );
- config.writeEntry( "downloadLater", QStringList( mHeaderLaterUids.keys() ) );
+ config.writeEntry( "downloadLater", TQStringList( mHeaderLaterUids.keys() ) );
config.sync();
}
@@ -853,7 +853,7 @@ void PopAccount::saveUidList()
//-----------------------------------------------------------------------------
void PopAccount::slotGetNextMsg()
{
- QMap<QString, int>::Iterator next = mMsgsPendingDownload.begin();
+ TQMap<TQString, int>::Iterator next = mMsgsPendingDownload.begin();
curMsgData.resize(0);
numMsgBytesRead = 0;
@@ -864,17 +864,17 @@ void PopAccount::slotGetNextMsg()
if ( next != mMsgsPendingDownload.end() ) {
// get the next message
int nextLen = next.data();
- curMsgStrm = new QDataStream( curMsgData, IO_WriteOnly );
+ curMsgStrm = new TQDataStream( curMsgData, IO_WriteOnly );
curMsgLen = nextLen;
++indexOfCurrentMsg;
- kdDebug(5006) << QString("Length of message about to get %1").arg( nextLen ) << endl;
+ kdDebug(5006) << TQString("Length of message about to get %1").arg( nextLen ) << endl;
mMsgsPendingDownload.remove( next.key() );
}
}
//-----------------------------------------------------------------------------
-void PopAccount::slotData( KIO::Job* job, const QByteArray &data)
+void PopAccount::slotData( KIO::Job* job, const TQByteArray &data)
{
if (data.size() == 0) {
kdDebug(5006) << "Data: <End>" << endl;
@@ -899,7 +899,7 @@ void PopAccount::slotData( KIO::Job* job, const QByteArray &data)
( dataCounter % 5 == 0 ||
( indexOfCurrentMsg + 1 == numMsgs && numMsgBytesRead == curMsgLen ) ) )
{
- QString msg;
+ TQString msg;
if (numBytes != numBytesToRead && mLeaveOnServer)
{
msg = i18n("Fetching message %1 of %2 (%3 of %4 KB) for %5@%6 "
@@ -928,16 +928,16 @@ void PopAccount::slotData( KIO::Job* job, const QByteArray &data)
}
// otherwise stage is List Or Uidl
- QString qdata = data;
+ TQString qdata = data;
qdata = qdata.simplifyWhiteSpace(); // Workaround for Maillennium POP3/UNIBOX
int spc = qdata.find( ' ' );
if ( stage == List ) {
if ( spc > 0 ) {
- QString length = qdata.mid(spc+1);
+ TQString length = qdata.mid(spc+1);
if (length.find(' ') != -1) length.truncate(length.find(' '));
int len = length.toInt();
numBytes += len;
- QString id = qdata.left(spc);
+ TQString id = qdata.left(spc);
idsOfMsgs.append( id );
mMsgsPendingDownload.insert( id, len );
}
@@ -954,8 +954,8 @@ void PopAccount::slotData( KIO::Job* job, const QByteArray &data)
else { // stage == Uidl
Q_ASSERT ( stage == Uidl);
- QString id;
- QString uid;
+ TQString id;
+ TQString uid;
if ( spc <= 0 ) {
// an invalid uidl line. we might just need to skip it, but
@@ -972,11 +972,11 @@ void PopAccount::slotData( KIO::Job* job, const QByteArray &data)
}
id.setNum (testid, 10);
- QString datestring, serialstring;
+ TQString datestring, serialstring;
serialstring.setNum ( ++dataCounter, 10 );
datestring.setNum ( time(NULL),10 );
- uid = QString( "uidlgen" ) + datestring + QString( "." ) + serialstring;
+ uid = TQString( "uidlgen" ) + datestring + TQString( "." ) + serialstring;
kdDebug(5006) << "PopAccount::slotData message " << id.ascii()
<< "%d has bad UIDL, cannot keep a copy on server" << endl;
idsOfForcedDeletes.append( id );
@@ -1042,7 +1042,7 @@ void PopAccount::slotResult( KIO::Job* )
//-----------------------------------------------------------------------------
void PopAccount::slotSlaveError(KIO::Slave *aSlave, int error,
- const QString &errorMsg)
+ const TQString &errorMsg)
{
if (aSlave != mSlave) return;
if (error == KIO::ERR_SLAVE_DIED) mSlave = 0;
@@ -1064,7 +1064,7 @@ void PopAccount::slotSlaveError(KIO::Slave *aSlave, int error,
/* We need a timer, otherwise slotSlaveError of the next account is also
executed, if it reuses the slave, because the slave member variable
is changed too early */
- QTimer::singleShot(0, this, SLOT(slotCancel()));
+ TQTimer::singleShot(0, this, TQT_SLOT(slotCancel()));
}
//-----------------------------------------------------------------------------
@@ -1075,7 +1075,7 @@ void PopAccount::slotGetNextHdr(){
delete curMsgStrm;
curMsgStrm = 0;
- curMsgStrm = new QDataStream( curMsgData, IO_WriteOnly );
+ curMsgStrm = new TQDataStream( curMsgData, IO_WriteOnly );
}
void PopAccount::killAllJobs( bool ) {