Again QT_NO_ASCII_CAST fixes and two charset related fixes for bugs I found on

the way.

svn path=/trunk/kdenetwork/kmail/; revision=101586
wilder-work
Michael Haeckel 25 years ago
parent b6f894a55c
commit 79103e2e17
  1. 14
      kfileio.cpp
  2. 2
      kfileio.h
  3. 11
      kmfldsearch.cpp
  4. 3
      kmidentity.cpp
  5. 18
      kmkernel.cpp

@ -22,7 +22,7 @@ static void msgDialog(const QString &msg)
//-----------------------------------------------------------------------------
QString kFileToString(const QString &aFileName, bool aEnsureNL, bool aVerbose)
QCString kFileToString(const QString &aFileName, bool aEnsureNL, bool aVerbose)
{
QCString result;
QFileInfo info(aFileName);
@ -38,22 +38,22 @@ QString kFileToString(const QString &aFileName, bool aEnsureNL, bool aVerbose)
{
if (aVerbose)
msgDialog(i18n("The specified file does not exist:\n%1").arg(aFileName));
return QString::null;
return QCString();
}
if (info.isDir())
{
if (aVerbose)
msgDialog(i18n("This is a directory and not a file:\n%1").arg(aFileName));
return QString::null;
return QCString();
}
if (!info.isReadable())
{
if (aVerbose)
msgDialog(i18n("You do not have read permissions "
"to the file:\n%1").arg(aFileName));
return QString::null;
return QCString();
}
if (len <= 0) return QString::null;
if (len <= 0) return QCString();
if (!file.open(IO_Raw|IO_ReadOnly))
{
@ -68,7 +68,7 @@ QString kFileToString(const QString &aFileName, bool aEnsureNL, bool aVerbose)
default:
msgDialog(i18n("Error while reading file:\n%1").arg(aFileName));
}
return QString::null;
return QCString();
}
result.resize(len + (int)aEnsureNL + 1);
@ -85,7 +85,7 @@ QString kFileToString(const QString &aFileName, bool aEnsureNL, bool aVerbose)
QString msg = i18n("Could only read %1 bytes of %2.")
.arg(readLen).arg(len);
msgDialog(msg);
return QString::null;
return QCString();
}
return result;

@ -16,7 +16,7 @@
* byte longer than the file itself.
* If ensureNewline is TRUE the string will always have a trailing newline.
*/
QString kFileToString(const QString &fileName, bool ensureNewline=TRUE,
QCString kFileToString(const QString &fileName, bool ensureNewline=TRUE,
bool withDialogs=TRUE);
QByteArray kFileToBytes(const QString &fileName, bool withDialogs=TRUE);

@ -1,4 +1,3 @@
#undef QT_NO_ASCII_CAST
// kmfldsearch.cpp
// TODO: Add search in subfolder checkbox
// TODO: Use msgIdMD5 in MSGID_COLUMN
@ -250,12 +249,12 @@ void KMFldSearch::searchInFolder(QGuardedPtr<KMFolder> aFld, int fldNum)
assert(!aFld.isNull());
if (aFld->isSystemFolder()) mSearchFolder = i18n(aFld->name());
if (aFld->isSystemFolder()) mSearchFolder = i18n(aFld->name().utf8());
else mSearchFolder = aFld->name();
kapp->processEvents();
if (aFld->open() != 0)
{
kdDebug() << "Cannot open folder '" << (const char*)aFld->name() << "'" << endl;
kdDebug() << "Cannot open folder '" << aFld->name() << "'" << endl;
return;
}
@ -553,7 +552,7 @@ void KMFldSearchRule::prepare(void)
{
mFieldIdx = mCbxField->currentItem();
mField = mCbxField->currentText();
mHeaderField = "\n" + mField + ": ";
mHeaderField = QString("\n" + mField + ": ").latin1();
mFieldLength = mField.length() + 3;
mFunc = mCbxFunc->currentItem();
mValue = mEdtValue->text();
@ -613,9 +612,9 @@ bool KMFldSearchRule::matches(const KMMessage* aMsg, const QCString& aMsgStr)
switch(mFunc)
{
case Equal:
return (qstricmp(value, mValue) == 0);
return (value == mValue);
case NotEqual:
return (qstricmp(value, mValue) != 0);
return (value != mValue);
case Contains:
return value.contains(mValue, FALSE);
case NotContains:

@ -1,4 +1,3 @@
#undef QT_NO_ASCII_CAST
#undef QT_NO_COMPAT
// kmidentity.cpp
@ -245,7 +244,7 @@ QString KMIdentity::signature(void) const
sigcmd = mSignatureFile.left(mSignatureFile.length()-1);
sigcmd += " >";
sigcmd += tmpf.name();
rc = system(sigcmd);
rc = system(sigcmd.local8Bit());
if (rc != 0)
{

@ -1,4 +1,3 @@
#undef QT_NO_ASCII_CAST
#undef QT_NO_COMPAT
#include <sys/types.h>
#include <dirent.h>
@ -131,7 +130,7 @@ int KMKernel::openComposer (const QString &to, const QString &cc,
if (!to.isEmpty()) msg->setTo(to);
if (!messageFile.isEmpty() && messageFile.isLocalFile())
msg->setBody( kFileToString( messageFile.path(), true, false ).local8Bit() );
msg->setBody( kFileToString( messageFile.path(), true, false ) );
if (!body.isEmpty()) msg->setBody(body.local8Bit() );
@ -376,7 +375,7 @@ void KMKernel::recoverDeadLetters(void)
rc = folder.open();
if (rc)
{
perror("cannot open file "+fname);
perror(QString("cannot open file "+fname).latin1());
return;
}
@ -395,7 +394,7 @@ void KMKernel::recoverDeadLetters(void)
}
}
folder.close();
unlink(fname);
QFile::remove(fname);
}
void KMKernel::initFolders(KConfig* cfg)
@ -461,12 +460,13 @@ void KMKernel::init()
the_firstStart = cfg->readBoolEntry("first-start", true);
the_previousVersion = cfg->readEntry("previous-version", "");
cfg->writeEntry("previous-version", KMAIL_VERSION);
foldersPath = cfg->readEntry("folders", "");
acctPath = cfg->readEntry("accounts", foldersPath + "/.kmail-accounts");
foldersPath = cfg->readEntry("folders", "").local8Bit();
acctPath = cfg->readEntry("accounts", foldersPath + "/.kmail-accounts")
.local8Bit();
if (foldersPath.isEmpty())
{
foldersPath = QDir::homeDirPath() + QString("/Mail");
foldersPath = QString(QDir::homeDirPath() + QString("/Mail")).local8Bit();
transferMail();
}
@ -599,7 +599,7 @@ void KMKernel::cleanup(void)
// left behind.
if (!KMReaderWin::attachDir().isEmpty())
{
cmd.sprintf("rm -rf '%s'", (const char*)KMReaderWin::attachDir());
cmd.sprintf("rm -rf '%s'", KMReaderWin::attachDir().local8Bit());
system (cmd.data()); // delete your owns only
}
//--- Sven's save attachments to /tmp end ---
@ -671,7 +671,7 @@ void KMKernel::kmailMsgHandler(QtMsgType aType, const char* aMsg)
case QtFatalMsg:
ungrabPtrKb();
fprintf(stderr, appName+" "+i18n("fatal error")+": %s\n", msg.data());
kdDebug() << appName << " " << i18n("fatal error") << " " << msg.data() << endl;
KMessageBox::error(0, aMsg);
abort();
}

Loading…
Cancel
Save