summaryrefslogtreecommitdiffstats
path: root/src/translators/alexandriaexporter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/translators/alexandriaexporter.cpp')
-rw-r--r--src/translators/alexandriaexporter.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/translators/alexandriaexporter.cpp b/src/translators/alexandriaexporter.cpp
index 186b866..c00b54b 100644
--- a/src/translators/alexandriaexporter.cpp
+++ b/src/translators/alexandriaexporter.cpp
@@ -25,7 +25,7 @@
#include <kmessagebox.h>
#include <kapplication.h>
-#include <qdir.h>
+#include <tqdir.h>
namespace {
static const int ALEXANDRIA_MAX_SIZE_SMALL = 60;
@@ -34,12 +34,12 @@ namespace {
using Tellico::Export::AlexandriaExporter;
-QString& AlexandriaExporter::escapeText(QString& str_) {
- str_.replace('"', QString::fromLatin1("\\\""));
+TQString& AlexandriaExporter::escapeText(TQString& str_) {
+ str_.tqreplace('"', TQString::tqfromLatin1("\\\""));
return str_;
}
-QString AlexandriaExporter::formatString() const {
+TQString AlexandriaExporter::formatString() const {
return i18n("Alexandria");
}
@@ -50,10 +50,10 @@ bool AlexandriaExporter::exec() {
return false;
}
- const QString alexDirName = QString::fromLatin1(".alexandria");
+ const TQString alexDirName = TQString::tqfromLatin1(".alexandria");
// create if necessary
- QDir libraryDir = QDir::home();
+ TQDir libraryDir = TQDir::home();
if(!libraryDir.cd(alexDirName)) {
if(!libraryDir.mkdir(alexDirName) || !libraryDir.cd(alexDirName)) {
myLog() << "AlexandriaExporter::exec() - can't locate directory" << endl;
@@ -66,7 +66,7 @@ bool AlexandriaExporter::exec() {
int ret = KMessageBox::warningContinueCancel(Kernel::self()->widget(),
i18n("<qt>An Alexandria library called <i>%1</i> already exists. "
"Any existing books in that library could be overwritten.</qt>")
- .arg(coll->title()));
+ .tqarg(coll->title()));
if(ret == KMessageBox::Cancel) {
return false;
}
@@ -74,10 +74,10 @@ bool AlexandriaExporter::exec() {
return false; // could not create and cd to the dir
}
- ProgressItem& item = ProgressManager::self()->newProgressItem(this, QString::null, false);
+ ProgressItem& item = ProgressManager::self()->newProgressItem(this, TQString(), false);
item.setTotalSteps(entries().count());
ProgressItem::Done done(this);
- const uint stepSize = QMIN(1, entries().count()/100);
+ const uint stepSize = TQMIN(1, entries().count()/100);
const bool showProgress = options() & ExportProgress;
GUI::CursorSaver cs;
@@ -95,15 +95,15 @@ bool AlexandriaExporter::exec() {
// this isn't true YAML export, of course
// everything is put between quotes except for the rating, just to be sure it's interpreted as a string
-bool AlexandriaExporter::writeFile(const QDir& dir_, Data::ConstEntryPtr entry_) {
+bool AlexandriaExporter::writeFile(const TQDir& dir_, Data::ConstEntryPtr entry_) {
// the filename is the isbn without dashes, followed by .yaml
- QString isbn = entry_->field(QString::fromLatin1("isbn"));
+ TQString isbn = entry_->field(TQString::tqfromLatin1("isbn"));
if(isbn.isEmpty()) {
return false; // can't write it since Alexandria uses isbn as name of file
}
isbn.remove('-'); // remove dashes
- QFile file(dir_.absPath() + QDir::separator() + isbn + QString::fromLatin1(".yaml"));
+ TQFile file(dir_.absPath() + TQDir::separator() + isbn + TQString::tqfromLatin1(".yaml"));
if(!file.open(IO_WriteOnly)) {
return false;
}
@@ -111,13 +111,13 @@ bool AlexandriaExporter::writeFile(const QDir& dir_, Data::ConstEntryPtr entry_)
// do we format?
bool format = options() & Export::ExportFormatted;
- QTextStream ts(&file);
+ TQTextStream ts(&file);
// alexandria uses utf-8 all the time
- ts.setEncoding(QTextStream::UnicodeUTF8);
+ ts.setEncoding(TQTextStream::UnicodeUTF8);
ts << "--- !ruby/object:Alexandria::Book\n";
ts << "authors:\n";
- QStringList authors = entry_->fields(QString::fromLatin1("author"), format);
- for(QStringList::Iterator it = authors.begin(); it != authors.end(); ++it) {
+ TQStringList authors = entry_->fields(TQString::tqfromLatin1("author"), format);
+ for(TQStringList::Iterator it = authors.begin(); it != authors.end(); ++it) {
ts << " - " << escapeText(*it) << "\n";
}
// Alexandria crashes when no authors, and uses n/a when none
@@ -125,30 +125,30 @@ bool AlexandriaExporter::writeFile(const QDir& dir_, Data::ConstEntryPtr entry_)
ts << " - n/a\n";
}
- QString tmp = entry_->field(QString::fromLatin1("title"), format);
+ TQString tmp = entry_->field(TQString::tqfromLatin1("title"), format);
ts << "title: \"" << escapeText(tmp) << "\"\n";
// Alexandria refers to the binding as the edition
- tmp = entry_->field(QString::fromLatin1("binding"), format);
+ tmp = entry_->field(TQString::tqfromLatin1("binding"), format);
ts << "edition: \"" << escapeText(tmp) << "\"\n";
// sometimes Alexandria interprets the isbn as a number instead of a string
// I have no idea how to debug ruby, so err on safe side and add quotes
ts << "isbn: \"" << isbn << "\"\n";
- tmp = entry_->field(QString::fromLatin1("comments"), format);
+ tmp = entry_->field(TQString::tqfromLatin1("comments"), format);
ts << "notes: \"" << escapeText(tmp) << "\"\n";
- tmp = entry_->field(QString::fromLatin1("publisher"), format);
+ tmp = entry_->field(TQString::tqfromLatin1("publisher"), format);
// publisher uses n/a when empty
- ts << "publisher: \"" << (tmp.isEmpty() ? QString::fromLatin1("n/a") : escapeText(tmp)) << "\"\n";
+ ts << "publisher: \"" << (tmp.isEmpty() ? TQString::tqfromLatin1("n/a") : escapeText(tmp)) << "\"\n";
- tmp = entry_->field(QString::fromLatin1("pub_year"), format);
+ tmp = entry_->field(TQString::tqfromLatin1("pub_year"), format);
if(!tmp.isEmpty()) {
ts << "publishing_year: \"" << escapeText(tmp) << "\"\n";
}
- tmp = entry_->field(QString::fromLatin1("rating"));
+ tmp = entry_->field(TQString::tqfromLatin1("rating"));
bool ok;
int rating = Tellico::toUInt(tmp, &ok);
if(ok) {
@@ -157,24 +157,24 @@ bool AlexandriaExporter::writeFile(const QDir& dir_, Data::ConstEntryPtr entry_)
file.close();
- QString cover = entry_->field(QString::fromLatin1("cover"));
+ TQString cover = entry_->field(TQString::tqfromLatin1("cover"));
if(cover.isEmpty() || !(options() & Export::ExportImages)) {
return true; // all done
}
- QImage img1(ImageFactory::imageById(cover));
- QImage img2;
- QString filename = dir_.absPath() + QDir::separator() + isbn;
+ TQImage img1(ImageFactory::imageById(cover));
+ TQImage img2;
+ TQString filename = dir_.absPath() + TQDir::separator() + isbn;
if(img1.height() > ALEXANDRIA_MAX_SIZE_SMALL) {
if(img1.height() > ALEXANDRIA_MAX_SIZE_MEDIUM) { // limit maximum size
- img1 = img1.scale(ALEXANDRIA_MAX_SIZE_MEDIUM, ALEXANDRIA_MAX_SIZE_MEDIUM, QImage::ScaleMin);
+ img1 = img1.scale(ALEXANDRIA_MAX_SIZE_MEDIUM, ALEXANDRIA_MAX_SIZE_MEDIUM, TQ_ScaleMin);
}
- img2 = img1.scale(ALEXANDRIA_MAX_SIZE_SMALL, ALEXANDRIA_MAX_SIZE_SMALL, QImage::ScaleMin);
+ img2 = img1.scale(ALEXANDRIA_MAX_SIZE_SMALL, ALEXANDRIA_MAX_SIZE_SMALL, TQ_ScaleMin);
} else {
- img2 = img1.smoothScale(ALEXANDRIA_MAX_SIZE_MEDIUM, ALEXANDRIA_MAX_SIZE_MEDIUM, QImage::ScaleMin); // scale up
+ img2 = img1.smoothScale(ALEXANDRIA_MAX_SIZE_MEDIUM, ALEXANDRIA_MAX_SIZE_MEDIUM, TQ_ScaleMin); // scale up
}
- if(!img1.save(filename + QString::fromLatin1("_medium.jpg"), "JPEG")
- || !img2.save(filename + QString::fromLatin1("_small.jpg"), "JPEG")) {
+ if(!img1.save(filename + TQString::tqfromLatin1("_medium.jpg"), "JPEG")
+ || !img2.save(filename + TQString::tqfromLatin1("_small.jpg"), "JPEG")) {
return false;
}
return true;