summaryrefslogtreecommitdiffstats
path: root/src/gvcore/documentloadedimpl.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 21:04:57 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-26 21:04:57 +0000
commitbf7f88413be3831a9372d323d02fc0335b9f9188 (patch)
tree516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/gvcore/documentloadedimpl.cpp
parente238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff)
downloadgwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz
gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gvcore/documentloadedimpl.cpp')
-rw-r--r--src/gvcore/documentloadedimpl.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/gvcore/documentloadedimpl.cpp b/src/gvcore/documentloadedimpl.cpp
index 04fef67..35a07b0 100644
--- a/src/gvcore/documentloadedimpl.cpp
+++ b/src/gvcore/documentloadedimpl.cpp
@@ -1,7 +1,7 @@
// vim: set tabstop=4 shiftwidth=4 noexpandtab:
/*
Gwenview - A simple image viewer for KDE
-Copyright 2000-2004 Aurélien Gâteau
+Copyright 2000-2004 Aur�lien G�teau
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -25,10 +25,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <unistd.h>
#include <sys/stat.h>
-// Qt
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qtimer.h>
+// TQt
+#include <tqdir.h>
+#include <tqfileinfo.h>
+#include <tqtimer.h>
// KDE
#include <kapplication.h>
@@ -54,7 +54,7 @@ namespace Gwenview {
class DocumentLoadedImplPrivate {
int mSize;
- QDateTime mModified;
+ TQDateTime mModified;
};
DocumentLoadedImpl::DocumentLoadedImpl(Document* document)
@@ -78,12 +78,12 @@ void DocumentLoadedImpl::transform(ImageUtils::Orientation orientation) {
}
-QString DocumentLoadedImpl::save(const KURL& _url, const QCString& format) const {
- if (!QImageIO::outputFormats().contains(format)) {
+TQString DocumentLoadedImpl::save(const KURL& _url, const TQCString& format) const {
+ if (!TQImageIO::outputFormats().tqcontains(format)) {
return i18n("Gwenview cannot write files in this format.");
}
- QString msg;
+ TQString msg;
KURL url(_url);
// Use the umask to determine default mode (will be used if the dest file
@@ -95,17 +95,17 @@ QString DocumentLoadedImpl::save(const KURL& _url, const QCString& format) const
if (url.isLocalFile()) {
// If the file is a link, dereference it but take care of circular
// links
- QFileInfo info(url.path());
+ TQFileInfo info(url.path());
if (info.isSymLink()) {
- QStringList links;
+ TQStringList links;
while (info.isSymLink()) {
links.append(info.filePath());
- QString path=info.readLink();
+ TQString path=info.readLink();
if (path[0]!='/') {
path=info.dirPath(true) + '/' + path;
}
- path=QDir::cleanDirPath(path);
- if (links.contains(path)) {
+ path=TQDir::cleanDirPath(path);
+ if (links.tqcontains(path)) {
return i18n("This is a circular link.");
}
info.setFile(path);
@@ -122,7 +122,7 @@ QString DocumentLoadedImpl::save(const KURL& _url, const QCString& format) const
if (info.exists()) {
// Get current file mode
KDE_struct_stat st;
- if (KDE_stat(QFile::encodeName(info.filePath()), &st)==0) {
+ if (KDE_stat(TQFile::encodeName(info.filePath()), &st)==0) {
mode=st.st_mode & 07777;
} else {
// This should not happen
@@ -130,17 +130,17 @@ QString DocumentLoadedImpl::save(const KURL& _url, const QCString& format) const
}
} else {
- QFileInfo parent=QFileInfo(info.dirPath());
- if (!parent.isWritable()) {
+ TQFileInfo tqparent=TQFileInfo(info.dirPath());
+ if (!tqparent.isWritable()) {
return
i18n("The %1 folder is read-only.")
- .arg(parent.filePath());
+ .tqarg(tqparent.filePath());
}
}
}
// Save the file to a tmp file
- QString prefix;
+ TQString prefix;
if (url.isLocalFile()) {
// We set the prefix to url.path() so that the temp file is on the
// same partition as the destination file. If we don't do this, rename
@@ -150,48 +150,48 @@ QString DocumentLoadedImpl::save(const KURL& _url, const QCString& format) const
KTempFile tmp(prefix, "gwenview", mode);
tmp.setAutoDelete(true);
if (tmp.status()!=0) {
- QString reason( strerror(tmp.status()) );
+ TQString reason( strerror(tmp.status()) );
return i18n("Could not create a temporary file.\nReason: %1.")
- .arg(reason);
+ .tqarg(reason);
}
- QFile* file=tmp.file();
+ TQFile* file=tmp.file();
msg=localSave(file, format);
if (!msg.isNull()) return msg;
file->close();
if (tmp.status()!=0) {
- QString reason( strerror(tmp.status()) );
+ TQString reason( strerror(tmp.status()) );
return i18n("Saving image to a temporary file failed.\nReason: %1.")
- .arg(reason);
+ .tqarg(reason);
}
- QString tmpName=tmp.name();
- int tmpSize=QFileInfo(tmpName).size();
+ TQString tmpName=tmp.name();
+ int tmpSize=TQFileInfo(tmpName).size();
setFileSize(tmpSize);
// Move the tmp file to the final dest
if (url.isLocalFile()) {
- if( ::rename( QFile::encodeName(tmpName), QFile::encodeName( url.path())) < 0 ) {
- return i18n("Could not write to %1.").arg(url.path());
+ if( ::rename( TQFile::encodeName(tmpName), TQFile::encodeName( url.path())) < 0 ) {
+ return i18n("Could not write to %1.").tqarg(url.path());
}
} else {
if (!KIO::NetAccess::upload(tmp.name(), url, KApplication::kApplication()->mainWidget() )) {
- return i18n("Could not upload the file to %1.").arg(url.prettyURL());
+ return i18n("Could not upload the file to %1.").tqarg(url.prettyURL());
}
}
- return QString::null;
+ return TQString();
}
-QString DocumentLoadedImpl::localSave(QFile* file, const QCString& format) const {
- QImageIO iio(file, format);
+TQString DocumentLoadedImpl::localSave(TQFile* file, const TQCString& format) const {
+ TQImageIO iio(file, format);
iio.setImage(mDocument->image());
if (!iio.write()) {
return
i18n("An error happened while saving.");
}
- return QString::null;
+ return TQString();
}