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 /kget/kfileio.cpp | |
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 'kget/kfileio.cpp')
-rw-r--r-- | kget/kfileio.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/kget/kfileio.cpp b/kget/kfileio.cpp index bfd03864..63f230bc 100644 --- a/kget/kfileio.cpp +++ b/kget/kfileio.cpp @@ -12,13 +12,13 @@ // Author: Stefan Taferner <[email protected]> -#include <qapplication.h> -#include <qstring.h> +#include <tqapplication.h> +#include <tqstring.h> #include <unistd.h> #include <string.h> #include <assert.h> -#include <qfile.h> -#include <qfileinfo.h> +#include <tqfile.h> +#include <tqfileinfo.h> #include <kdebug.h> #include <klocale.h> @@ -27,14 +27,14 @@ #include "kfileio.h" //----------------------------------------------------------------------------- -QString kFileToString(const QString & aFileName, bool aEnsureNL, bool aVerbose) +TQString kFileToString(const TQString & aFileName, bool aEnsureNL, bool aVerbose) { - QCString result; + TQCString result; - QFileInfo info(aFileName); + TQFileInfo info(aFileName); unsigned int readLen; unsigned int len = info.size(); - QFile file(aFileName); + TQFile file(aFileName); // assert(aFileName!=NULL); if (aFileName == NULL) @@ -43,20 +43,20 @@ QString kFileToString(const QString & aFileName, bool aEnsureNL, bool aVerbose) if (!info.exists()) { if (aVerbose) KMessageBox::error(qApp->mainWidget(), i18n("The specified file does not exist:\n%1").arg(aFileName)); - return QString::null; + return TQString::null; } if (info.isDir()) { if (aVerbose) KMessageBox::error(qApp->mainWidget(), i18n("This is a folder and not a file:\n%1").arg(aFileName)); - return QString::null; + return TQString::null; } if (!info.isReadable()) { if (aVerbose) KMessageBox::error(qApp->mainWidget(), i18n("You do not have read permission for the file:\n%1").arg(aFileName)); - return QString::null; + return TQString::null; } if (len <= 0) - return QString::null; + return TQString::null; if (!file.open(IO_Raw | IO_ReadOnly)) { if (aVerbose) @@ -70,7 +70,7 @@ QString kFileToString(const QString & aFileName, bool aEnsureNL, bool aVerbose) default: KMessageBox::error(qApp->mainWidget(), i18n("Error while reading file:\n%1").arg(aFileName)); } - return QString::null; + return TQString::null; } result.resize(len + (int) aEnsureNL + 1); @@ -82,11 +82,11 @@ QString kFileToString(const QString & aFileName, bool aEnsureNL, bool aVerbose) result[len] = '\0'; if (readLen < len) { - QString msg = i18n("Could only read %1 bytes of %2.").arg(KGlobal::locale()->formatNumber(readLen, + TQString msg = i18n("Could only read %1 bytes of %2.").arg(KGlobal::locale()->formatNumber(readLen, 0)).arg(KGlobal::locale()->formatNumber(len, 0)); KMessageBox::error(qApp->mainWidget(), msg); - return QString::null; + return TQString::null; } kdDebug() << "kFileToString: " << readLen << " bytes read" << endl; @@ -95,10 +95,10 @@ QString kFileToString(const QString & aFileName, bool aEnsureNL, bool aVerbose) //----------------------------------------------------------------------------- -static bool kBytesToFile(const char *aBuffer, int len, const QString & aFileName, bool aAskIfExists, bool aBackup, bool aVerbose) +static bool kBytesToFile(const char *aBuffer, int len, const TQString & aFileName, bool aAskIfExists, bool aBackup, bool aVerbose) { - QFile file(aFileName); - QFileInfo info(aFileName); + TQFile file(aFileName); + TQFileInfo info(aFileName); int writeLen, rc; // assert(aFileName!=NULL); @@ -107,19 +107,19 @@ static bool kBytesToFile(const char *aBuffer, int len, const QString & aFileName if (info.exists()) { if (aAskIfExists) { - QString str = i18n("File %1 exists.\nDo you want to replace it?").arg(aFileName); + TQString str = i18n("File %1 exists.\nDo you want to replace it?").arg(aFileName); - rc = KMessageBox::questionYesNo(qApp->mainWidget(), str, QString::null, i18n("Replace"),KStdGuiItem::cancel()); + rc = KMessageBox::questionYesNo(qApp->mainWidget(), str, TQString::null, i18n("Replace"),KStdGuiItem::cancel()); if (rc != KMessageBox::Yes) return FALSE; } if (aBackup) { // make a backup copy - QString bakName = aFileName; + TQString bakName = aFileName; bakName += '~'; - QFile::remove(bakName); - rc = rename(QFile::encodeName(aFileName), QFile::encodeName(bakName)); + TQFile::remove(bakName); + rc = rename(TQFile::encodeName(aFileName), TQFile::encodeName(bakName)); if (rc) { // failed to rename file if (!aVerbose) @@ -152,7 +152,7 @@ static bool kBytesToFile(const char *aBuffer, int len, const QString & aFileName KMessageBox::error(qApp->mainWidget(), i18n("Could not write to file:\n%1").arg(aFileName)); return FALSE; } else if (writeLen < len) { - QString msg = i18n("Could only write %1 bytes of %2.").arg(KGlobal::locale()->formatNumber(writeLen, + TQString msg = i18n("Could only write %1 bytes of %2.").arg(KGlobal::locale()->formatNumber(writeLen, 0)).arg(KGlobal::locale()->formatNumber(len, 0)); @@ -163,12 +163,12 @@ static bool kBytesToFile(const char *aBuffer, int len, const QString & aFileName return TRUE; } -bool kCStringToFile(const QCString & aBuffer, const QString & aFileName, bool aAskIfExists, bool aBackup, bool aVerbose) +bool kCStringToFile(const TQCString & aBuffer, const TQString & aFileName, bool aAskIfExists, bool aBackup, bool aVerbose) { return kBytesToFile(aBuffer, aBuffer.length(), aFileName, aAskIfExists, aBackup, aVerbose); } -bool kByteArrayToFile(const QByteArray & aBuffer, const QString & aFileName, bool aAskIfExists, bool aBackup, bool aVerbose) +bool kByteArrayToFile(const TQByteArray & aBuffer, const TQString & aFileName, bool aAskIfExists, bool aBackup, bool aVerbose) { return kBytesToFile(aBuffer, aBuffer.size(), aFileName, aAskIfExists, aBackup, aVerbose); } |