summaryrefslogtreecommitdiffstats
path: root/kmail/kmfoldermbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmail/kmfoldermbox.cpp')
-rw-r--r--kmail/kmfoldermbox.cpp132
1 files changed, 66 insertions, 66 deletions
diff --git a/kmail/kmfoldermbox.cpp b/kmail/kmfoldermbox.cpp
index 92f466a7c..dc35328db 100644
--- a/kmail/kmfoldermbox.cpp
+++ b/kmail/kmfoldermbox.cpp
@@ -18,8 +18,8 @@
*
*/
#include <config.h>
-#include <qfileinfo.h>
-#include <qregexp.h>
+#include <tqfileinfo.h>
+#include <tqregexp.h>
#include "kmfoldermbox.h"
#include "folderstorage.h"
@@ -104,7 +104,7 @@ int KMFolderMbox::open(const char *owner)
assert(!folder()->name().isEmpty());
mFilesLocked = false;
- mStream = fopen(QFile::encodeName(location()), "r+"); // messages file
+ mStream = fopen(TQFile::encodeName(location()), "r+"); // messages file
if (!mStream)
{
KNotifyClient::event( 0, "warning",
@@ -125,7 +125,7 @@ int KMFolderMbox::open(const char *owner)
// only show a warning if the index file exists, otherwise it can be
// silently regenerated
if (KMFolderIndex::IndexTooOld == index_status) {
- QString msg = i18n("<qt><p>The index of folder '%2' seems "
+ TQString msg = i18n("<qt><p>The index of folder '%2' seems "
"to be out of date. To prevent message "
"corruption the index will be "
"regenerated. As a result deleted "
@@ -160,13 +160,13 @@ int KMFolderMbox::open(const char *owner)
KMessageBox::AllowLink );
}
}
- QString str;
+ TQString str;
mIndexStream = 0;
str = i18n("Folder `%1' changed. Recreating index.")
.arg(name());
emit statusMsg(str);
} else {
- mIndexStream = fopen(QFile::encodeName(indexLocation()), "r+"); // index file
+ mIndexStream = fopen(TQFile::encodeName(indexLocation()), "r+"); // index file
if ( mIndexStream ) {
fcntl(fileno(mIndexStream), F_SETFD, FD_CLOEXEC);
updateIndexStreamPtr();
@@ -199,7 +199,7 @@ int KMFolderMbox::canAccess()
{
assert(!folder()->name().isEmpty());
- if (access(QFile::encodeName(location()), R_OK | W_OK) != 0) {
+ if (access(TQFile::encodeName(location()), R_OK | W_OK) != 0) {
kdDebug(5006) << "KMFolderMbox::access call to access function failed" << endl;
return 1;
}
@@ -216,7 +216,7 @@ int KMFolderMbox::create()
assert(mOpenCount == 0);
kdDebug(5006) << "Creating folder " << name() << endl;
- if (access(QFile::encodeName(location()), F_OK) == 0) {
+ if (access(TQFile::encodeName(location()), F_OK) == 0) {
kdDebug(5006) << "KMFolderMbox::create call to access function failed." << endl;
kdDebug(5006) << "File:: " << endl;
kdDebug(5006) << "Error " << endl;
@@ -224,7 +224,7 @@ int KMFolderMbox::create()
}
old_umask = umask(077);
- mStream = fopen(QFile::encodeName(location()), "w+"); //sven; open RW
+ mStream = fopen(TQFile::encodeName(location()), "w+"); //sven; open RW
umask(old_umask);
if (!mStream) return errno;
@@ -234,7 +234,7 @@ int KMFolderMbox::create()
if (!folder()->path().isEmpty())
{
old_umask = umask(077);
- mIndexStream = fopen(QFile::encodeName(indexLocation()), "w+"); //sven; open RW
+ mIndexStream = fopen(TQFile::encodeName(indexLocation()), "w+"); //sven; open RW
updateIndexStreamPtr(true);
umask(old_umask);
@@ -295,7 +295,7 @@ void KMFolderMbox::sync()
if (mOpenCount > 0)
if (!mStream || fsync(fileno(mStream)) ||
!mIndexStream || fsync(fileno(mIndexStream))) {
- kmkernel->emergencyExit( i18n("Could not sync index file <b>%1</b>: %2").arg( indexLocation() ).arg(errno ? QString::fromLocal8Bit(strerror(errno)) : i18n("Internal error. Please copy down the details and report a bug.")));
+ kmkernel->emergencyExit( i18n("Could not sync index file <b>%1</b>: %2").arg( indexLocation() ).arg(errno ? TQString::fromLocal8Bit(strerror(errno)) : i18n("Internal error. Please copy down the details and report a bug.")));
}
}
@@ -309,7 +309,7 @@ int KMFolderMbox::lock()
fl.l_start=0;
fl.l_len=0;
fl.l_pid=-1;
- QCString cmd_str;
+ TQCString cmd_str;
assert(mStream != 0);
mFilesLocked = false;
mReadOnly = false;
@@ -347,9 +347,9 @@ int KMFolderMbox::lock()
case procmail_lockfile:
cmd_str = "lockfile -l20 -r5 ";
if (!mProcmailLockFileName.isEmpty())
- cmd_str += QFile::encodeName(KProcess::quote(mProcmailLockFileName));
+ cmd_str += TQFile::encodeName(KProcess::quote(mProcmailLockFileName));
else
- cmd_str += QFile::encodeName(KProcess::quote(location() + ".lock"));
+ cmd_str += TQFile::encodeName(KProcess::quote(location() + ".lock"));
rc = system( cmd_str.data() );
if( rc != 0 )
@@ -361,7 +361,7 @@ int KMFolderMbox::lock()
}
if( mIndexStream )
{
- cmd_str = "lockfile -l20 -r5 " + QFile::encodeName(KProcess::quote(indexLocation() + ".lock"));
+ cmd_str = "lockfile -l20 -r5 " + TQFile::encodeName(KProcess::quote(indexLocation() + ".lock"));
rc = system( cmd_str.data() );
if( rc != 0 )
{
@@ -374,7 +374,7 @@ int KMFolderMbox::lock()
break;
case mutt_dotlock:
- cmd_str = "mutt_dotlock " + QFile::encodeName(KProcess::quote(location()));
+ cmd_str = "mutt_dotlock " + TQFile::encodeName(KProcess::quote(location()));
rc = system( cmd_str.data() );
if( rc != 0 )
{
@@ -385,7 +385,7 @@ int KMFolderMbox::lock()
}
if( mIndexStream )
{
- cmd_str = "mutt_dotlock " + QFile::encodeName(KProcess::quote(indexLocation()));
+ cmd_str = "mutt_dotlock " + TQFile::encodeName(KProcess::quote(indexLocation()));
rc = system( cmd_str.data() );
if( rc != 0 )
{
@@ -398,7 +398,7 @@ int KMFolderMbox::lock()
break;
case mutt_dotlock_privileged:
- cmd_str = "mutt_dotlock -p " + QFile::encodeName(KProcess::quote(location()));
+ cmd_str = "mutt_dotlock -p " + TQFile::encodeName(KProcess::quote(location()));
rc = system( cmd_str.data() );
if( rc != 0 )
{
@@ -409,7 +409,7 @@ int KMFolderMbox::lock()
}
if( mIndexStream )
{
- cmd_str = "mutt_dotlock -p " + QFile::encodeName(KProcess::quote(indexLocation()));
+ cmd_str = "mutt_dotlock -p " + TQFile::encodeName(KProcess::quote(indexLocation()));
rc = system( cmd_str.data() );
if( rc != 0 )
{
@@ -434,7 +434,7 @@ int KMFolderMbox::lock()
//-------------------------------------------------------------
FolderJob*
KMFolderMbox::doCreateJob( KMMessage *msg, FolderJob::JobType jt,
- KMFolder *folder, QString, const AttachmentStrategy* ) const
+ KMFolder *folder, TQString, const AttachmentStrategy* ) const
{
MboxJob *job = new MboxJob( msg, jt, folder );
job->setParent( this );
@@ -443,7 +443,7 @@ KMFolderMbox::doCreateJob( KMMessage *msg, FolderJob::JobType jt,
//-------------------------------------------------------------
FolderJob*
-KMFolderMbox::doCreateJob( QPtrList<KMMessage>& msgList, const QString& sets,
+KMFolderMbox::doCreateJob( TQPtrList<KMMessage>& msgList, const TQString& sets,
FolderJob::JobType jt, KMFolder *folder ) const
{
MboxJob *job = new MboxJob( msgList, sets, jt, folder );
@@ -460,7 +460,7 @@ int KMFolderMbox::unlock()
fl.l_whence=0;
fl.l_start=0;
fl.l_len=0;
- QCString cmd_str;
+ TQCString cmd_str;
assert(mStream != 0);
mFilesLocked = false;
@@ -476,34 +476,34 @@ int KMFolderMbox::unlock()
case procmail_lockfile:
cmd_str = "rm -f ";
if (!mProcmailLockFileName.isEmpty())
- cmd_str += QFile::encodeName(KProcess::quote(mProcmailLockFileName));
+ cmd_str += TQFile::encodeName(KProcess::quote(mProcmailLockFileName));
else
- cmd_str += QFile::encodeName(KProcess::quote(location() + ".lock"));
+ cmd_str += TQFile::encodeName(KProcess::quote(location() + ".lock"));
rc = system( cmd_str.data() );
if( mIndexStream )
{
- cmd_str = "rm -f " + QFile::encodeName(KProcess::quote(indexLocation() + ".lock"));
+ cmd_str = "rm -f " + TQFile::encodeName(KProcess::quote(indexLocation() + ".lock"));
rc = system( cmd_str.data() );
}
break;
case mutt_dotlock:
- cmd_str = "mutt_dotlock -u " + QFile::encodeName(KProcess::quote(location()));
+ cmd_str = "mutt_dotlock -u " + TQFile::encodeName(KProcess::quote(location()));
rc = system( cmd_str.data() );
if( mIndexStream )
{
- cmd_str = "mutt_dotlock -u " + QFile::encodeName(KProcess::quote(indexLocation()));
+ cmd_str = "mutt_dotlock -u " + TQFile::encodeName(KProcess::quote(indexLocation()));
rc = system( cmd_str.data() );
}
break;
case mutt_dotlock_privileged:
- cmd_str = "mutt_dotlock -p -u " + QFile::encodeName(KProcess::quote(location()));
+ cmd_str = "mutt_dotlock -p -u " + TQFile::encodeName(KProcess::quote(location()));
rc = system( cmd_str.data() );
if( mIndexStream )
{
- cmd_str = "mutt_dotlock -p -u " + QFile::encodeName(KProcess::quote(indexLocation()));
+ cmd_str = "mutt_dotlock -p -u " + TQFile::encodeName(KProcess::quote(indexLocation()));
rc = system( cmd_str.data() );
}
break;
@@ -521,8 +521,8 @@ int KMFolderMbox::unlock()
//-----------------------------------------------------------------------------
KMFolderIndex::IndexStatus KMFolderMbox::indexStatus()
{
- QFileInfo contInfo(location());
- QFileInfo indInfo(indexLocation());
+ TQFileInfo contInfo(location());
+ TQFileInfo indInfo(indexLocation());
if (!contInfo.exists()) return KMFolderIndex::IndexOk;
if (!indInfo.exists()) return KMFolderIndex::IndexMissing;
@@ -541,15 +541,15 @@ int KMFolderMbox::createIndexFromContents()
{
char line[MAX_LINE];
char status[8], xstatus[8];
- QCString subjStr, dateStr, fromStr, toStr, xmarkStr, *lastStr=0;
- QCString replyToIdStr, replyToAuxIdStr, referencesStr, msgIdStr;
- QCString sizeServerStr, uidStr;
- QCString contentTypeStr, charset;
+ TQCString subjStr, dateStr, fromStr, toStr, xmarkStr, *lastStr=0;
+ TQCString replyToIdStr, replyToAuxIdStr, referencesStr, msgIdStr;
+ TQCString sizeServerStr, uidStr;
+ TQCString contentTypeStr, charset;
bool atEof = false;
bool inHeader = true;
KMMsgInfo* mi;
- QString msgStr;
- QRegExp regexp(MSG_SEPERATOR_REGEX);
+ TQString msgStr;
+ TQRegExp regexp(MSG_SEPERATOR_REGEX);
int i, num, numStatus;
short needStatus;
@@ -737,54 +737,54 @@ int KMFolderMbox::createIndexFromContents()
needStatus &= ~2;
}
else if (strncasecmp(line,"X-KMail-Mark:",13)==0)
- xmarkStr = QCString(line+13);
+ xmarkStr = TQCString(line+13);
else if (strncasecmp(line,"In-Reply-To:",12)==0) {
- replyToIdStr = QCString(line+12);
+ replyToIdStr = TQCString(line+12);
lastStr = &replyToIdStr;
}
else if (strncasecmp(line,"References:",11)==0) {
- referencesStr = QCString(line+11);
+ referencesStr = TQCString(line+11);
lastStr = &referencesStr;
}
else if (strncasecmp(line,"Message-Id:",11)==0) {
- msgIdStr = QCString(line+11);
+ msgIdStr = TQCString(line+11);
lastStr = &msgIdStr;
}
else if (strncasecmp(line,"Date:",5)==0)
{
- dateStr = QCString(line+5);
+ dateStr = TQCString(line+5);
lastStr = &dateStr;
}
else if (strncasecmp(line,"From:", 5)==0)
{
- fromStr = QCString(line+5);
+ fromStr = TQCString(line+5);
lastStr = &fromStr;
}
else if (strncasecmp(line,"To:", 3)==0)
{
- toStr = QCString(line+3);
+ toStr = TQCString(line+3);
lastStr = &toStr;
}
else if (strncasecmp(line,"Subject:",8)==0)
{
- subjStr = QCString(line+8);
+ subjStr = TQCString(line+8);
lastStr = &subjStr;
}
else if (strncasecmp(line,"X-Length:",9)==0)
{
- sizeServerStr = QCString(line+9);
+ sizeServerStr = TQCString(line+9);
sizeServer = sizeServerStr.toULong();
lastStr = &sizeServerStr;
}
else if (strncasecmp(line,"X-UID:",6)==0)
{
- uidStr = QCString(line+6);
+ uidStr = TQCString(line+6);
uid = uidStr.toULong();
lastStr = &uidStr;
}
else if (strncasecmp(line, "Content-Type:", 13) == 0)
{
- contentTypeStr = QCString(line+13);
+ contentTypeStr = TQCString(line+13);
lastStr = &contentTypeStr;
}
}
@@ -862,12 +862,12 @@ static size_t unescapeFrom( char* str, size_t strLen ) {
}
//static
-QByteArray KMFolderMbox::escapeFrom( const DwString & str ) {
+TQByteArray KMFolderMbox::escapeFrom( const DwString & str ) {
const unsigned int strLen = str.length();
if ( strLen <= STRDIM("From ") )
return KMail::Util::ByteArray( str );
// worst case: \nFrom_\nFrom_\nFrom_... => grows to 7/6
- QByteArray result( int( strLen + 5 ) / 6 * 7 + 1 );
+ TQByteArray result( int( strLen + 5 ) / 6 * 7 + 1 );
const char * s = str.data();
const char * const e = s + strLen - STRDIM("From ");
@@ -929,7 +929,7 @@ DwString KMFolderMbox::getDwString(int idx)
int KMFolderMbox::addMsg( KMMessage* aMsg, int* aIndex_ret )
{
if (!canAddMsgNow(aMsg, aIndex_ret)) return 0;
- QByteArray msgText;
+ TQByteArray msgText;
char endStr[3];
int idx = -1, rc;
KMFolder* msgParent;
@@ -967,18 +967,18 @@ int KMFolderMbox::addMsg( KMMessage* aMsg, int* aIndex_ret )
if (folderType() != KMFolderTypeImap)
{
/*
-QFile fileD0( "testdat_xx-kmfoldermbox-0" );
+TQFile fileD0( "testdat_xx-kmfoldermbox-0" );
if( fileD0.open( IO_WriteOnly ) ) {
- QDataStream ds( &fileD0 );
+ TQDataStream ds( &fileD0 );
ds.writeRawBytes( aMsg->asString(), aMsg->asString().length() );
fileD0.close(); // If data is 0 we just create a zero length file.
}
*/
aMsg->setStatusFields();
/*
-QFile fileD1( "testdat_xx-kmfoldermbox-1" );
+TQFile fileD1( "testdat_xx-kmfoldermbox-1" );
if( fileD1.open( IO_WriteOnly ) ) {
- QDataStream ds( &fileD1 );
+ TQDataStream ds( &fileD1 );
ds.writeRawBytes( aMsg->asString(), aMsg->asString().length() );
fileD1.close(); // If data is 0 we just create a zero length file.
}
@@ -1020,7 +1020,7 @@ if( fileD1.open( IO_WriteOnly ) ) {
if (error)
return error;
- QCString messageSeparator( aMsg->mboxMessageSeparator() );
+ TQCString messageSeparator( aMsg->mboxMessageSeparator() );
fwrite( messageSeparator.data(), messageSeparator.length(), 1, mStream );
off_t offs = ftell(mStream);
fwrite(msgText.data(), len, 1, mStream);
@@ -1033,9 +1033,9 @@ if( fileD1.open( IO_WriteOnly ) ) {
kdDebug(5006) << "Error: Could not add message to folder: " << strerror(errno) << endl;
if (ftell(mStream) > revert) {
kdDebug(5006) << "Undoing changes" << endl;
- truncate( QFile::encodeName(location()), revert );
+ truncate( TQFile::encodeName(location()), revert );
}
- kmkernel->emergencyExit( i18n("Could not add message to folder: ") + QString::fromLocal8Bit(strerror(errno)));
+ kmkernel->emergencyExit( i18n("Could not add message to folder: ") + TQString::fromLocal8Bit(strerror(errno)));
/* This code is not 100% reliable
bool busy = kmkernel->kbp()->isBusy();
@@ -1113,10 +1113,10 @@ if( fileD1.open( IO_WriteOnly ) ) {
kdWarning(5006) << "Error: Could not add message to folder (No space left on device?)" << endl;
if (ftell(mIndexStream) > revert) {
kdWarning(5006) << "Undoing changes" << endl;
- truncate( QFile::encodeName(indexLocation()), revert );
+ truncate( TQFile::encodeName(indexLocation()), revert );
}
if ( errno )
- kmkernel->emergencyExit( i18n("Could not add message to folder:") + QString::fromLocal8Bit(strerror(errno)));
+ kmkernel->emergencyExit( i18n("Could not add message to folder:") + TQString::fromLocal8Bit(strerror(errno)));
else
kmkernel->emergencyExit( i18n("Could not add message to folder (No space left on device?)") );
@@ -1145,7 +1145,7 @@ if( fileD1.open( IO_WriteOnly ) ) {
int KMFolderMbox::compact( unsigned int startIndex, int nbMessages, FILE* tmpfile, off_t& offs, bool& done )
{
int rc = 0;
- QCString mtext;
+ TQCString mtext;
unsigned int stopIndex = nbMessages == -1 ? mMsgList.count() :
QMIN( mMsgList.count(), startIndex + nbMessages );
//kdDebug(5006) << "KMFolderMbox: compacting from " << startIndex << " to " << stopIndex << endl;
@@ -1230,7 +1230,7 @@ int KMFolderMbox::compact( bool silent )
// If this is the current folder, the changed signal will ultimately call
// KMHeaders::setFolderInfoStatus which will override the message, so save/restore it
- QString statusMsg = BroadcastStatus::instance()->statusMsg();
+ TQString statusMsg = BroadcastStatus::instance()->statusMsg();
emit changed();
BroadcastStatus::instance()->setStatusMsg( statusMsg );
return rc;
@@ -1244,7 +1244,7 @@ void KMFolderMbox::setLockType( LockType ltype )
}
//-----------------------------------------------------------------------------
-void KMFolderMbox::setProcmailLockFileName( const QString &fname )
+void KMFolderMbox::setProcmailLockFileName( const TQString &fname )
{
mProcmailLockFileName = fname;
}
@@ -1253,7 +1253,7 @@ void KMFolderMbox::setProcmailLockFileName( const QString &fname )
int KMFolderMbox::removeContents()
{
int rc = 0;
- rc = unlink(QFile::encodeName(location()));
+ rc = unlink(TQFile::encodeName(location()));
return rc;
}
@@ -1261,7 +1261,7 @@ int KMFolderMbox::removeContents()
int KMFolderMbox::expungeContents()
{
int rc = 0;
- if (truncate(QFile::encodeName(location()), 0))
+ if (truncate(TQFile::encodeName(location()), 0))
rc = errno;
return rc;
}
@@ -1270,7 +1270,7 @@ int KMFolderMbox::expungeContents()
/*virtual*/
Q_INT64 KMFolderMbox::doFolderSize() const
{
- QFileInfo info( location() );
+ TQFileInfo info( location() );
return (Q_INT64)(info.size());
}