[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [tellico/frameworks] src: Convert KUrl to QUrl
From: Robby Stephenson <robby () periapsis ! org>
Date: 2015-05-01 1:57:04
Message-ID: E1Yo0CO-0005S8-S9 () scm ! kde ! org
[Download RAW message or body]
Git commit cc04d97c70ba68525f20bea09d27d196b4624a0a by Robby Stephenson.
Committed on 01/05/2015 at 01:56.
Pushed by rstephenson into branch 'frameworks'.
Convert KUrl to QUrl
M +2 -3 src/commands/collectioncommand.h
M +1 -1 src/configdialog.cpp
M +17 -19 src/core/filehandler.cpp
M +14 -13 src/core/filehandler.h
M +4 -5 src/core/netaccess.cpp
M +4 -3 src/core/netaccess.h
M +2 -2 src/dbusinterface.cpp
M +12 -12 src/dbusinterface.h
M +3 -3 src/detailedlistview.cpp
M +6 -8 src/document.cpp
M +7 -8 src/document.h
M +8 -8 src/entrycomparison.cpp
M +3 -3 src/entrycomparison.h
M +8 -8 src/entryview.cpp
M +3 -3 src/entryview.h
M +2 -2 src/exportdialog.cpp
M +3 -3 src/exportdialog.h
M +7 -5 src/fetch/allocinefetcher.cpp
M +13 -14 src/fetch/amazonfetcher.cpp
M +2 -2 src/fetch/amazonfetcher.h
M +3 -3 src/fetch/amazonrequest.cpp
M +4 -4 src/fetch/amazonrequest.h
M +7 -7 src/fetch/animenfofetcher.cpp
M +3 -3 src/fetch/animenfofetcher.h
M +6 -12 src/fetch/arxivfetcher.cpp
M +2 -2 src/fetch/arxivfetcher.h
M +6 -6 src/fetch/bibliosharefetcher.cpp
M +1 -1 src/fetch/bibliosharefetcher.h
M +5 -5 src/fetch/bibsonomyfetcher.cpp
M +1 -1 src/fetch/bibsonomyfetcher.h
M +4 -4 src/fetch/boardgamegeekfetcher.cpp
M +1 -1 src/fetch/boardgamegeekfetcher.h
M +5 -10 src/fetch/citebasefetcher.cpp
M +2 -2 src/fetch/citebasefetcher.h
M +7 -13 src/fetch/crossreffetcher.cpp
M +2 -2 src/fetch/crossreffetcher.h
M +4 -4 src/fetch/dblpfetcher.cpp
M +1 -1 src/fetch/dblpfetcher.h
M +2 -2 src/fetch/discogsfetcher.cpp
M +13 -13 src/fetch/doubanfetcher.cpp
M +1 -1 src/fetch/doubanfetcher.h
M +4 -14 src/fetch/dvdfrfetcher.cpp
M +1 -1 src/fetch/dvdfrfetcher.h
M +12 -25 src/fetch/entrezfetcher.cpp
M +3 -4 src/fetch/execexternalfetcher.cpp
M +3 -3 src/fetch/fetcher.cpp
M +2 -2 src/fetch/fetcher.h
M +4 -4 src/fetch/fetchmanager.cpp
M +1 -1 src/fetch/fetchmanager.h
M +8 -8 src/fetch/filmasterfetcher.cpp
M +10 -10 src/fetch/freebasefetcher.cpp
M +4 -4 src/fetch/gcstarpluginfetcher.cpp
M +4 -4 src/fetch/giantbombfetcher.cpp
M +1 -1 src/fetch/giantbombfetcher.h
M +1 -1 src/fetch/googlebookfetcher.cpp
M +5 -5 src/fetch/googlescholarfetcher.cpp
M +5 -7 src/fetch/hathitrustfetcher.cpp
M +11 -20 src/fetch/ibsfetcher.cpp
M +2 -2 src/fetch/ibsfetcher.h
M +30 -50 src/fetch/imdbfetcher.cpp
M +8 -8 src/fetch/imdbfetcher.h
M +8 -9 src/fetch/isbndbfetcher.cpp
M +2 -2 src/fetch/masfetcher.cpp
M +4 -4 src/fetch/moviemeterfetcher.cpp
M +1 -1 src/fetch/mrlookupfetcher.cpp
M +6 -6 src/fetch/musicbrainzfetcher.cpp
M +5 -5 src/fetch/openlibraryfetcher.cpp
M +4 -4 src/fetch/springerfetcher.cpp
M +1 -1 src/fetch/springerfetcher.h
M +6 -9 src/fetch/srufetcher.cpp
M +6 -6 src/fetch/thegamesdbfetcher.cpp
M +1 -1 src/fetch/thegamesdbfetcher.h
M +6 -5 src/fetch/themoviedbfetcher.cpp
M +2 -3 src/fetch/winecomfetcher.cpp
M +2 -3 src/fetch/xmlfetcher.cpp
M +2 -2 src/fetch/xmlfetcher.h
M +7 -7 src/fetch/yahoofetcher.cpp
M +3 -6 src/fetch/z3950fetcher.cpp
M +1 -1 src/fetchdialog.cpp
M +7 -7 src/gui/drophandler.cpp
M +1 -3 src/gui/drophandler.h
M +8 -8 src/gui/imagewidget.cpp
M +4 -4 src/gui/imagewidget.h
M +14 -7 src/gui/urlfieldwidget.cpp
M +5 -6 src/images/imagedirectory.cpp
M +10 -10 src/images/imagefactory.cpp
M +6 -6 src/images/imagefactory.h
M +6 -7 src/importdialog.cpp
M +4 -4 src/importdialog.h
M +30 -30 src/mainwindow.cpp
M +8 -8 src/mainwindow.h
M +3 -3 src/reportdialog.cpp
M +1 -1 src/tellico_kernel.cpp
M +2 -2 src/tellico_kernel.h
M +0 -1 src/tests/CMakeLists.txt
M +2 -2 src/tests/adstest.cpp
M +1 -1 src/tests/alexandriatest.cpp
M +1 -1 src/tests/amctest.cpp
M +1 -1 src/tests/bibtexmltest.cpp
M +2 -2 src/tests/bibtextest.cpp
M +2 -2 src/tests/ciwtest.cpp
M +7 -7 src/tests/delicioustest.cpp
M +9 -9 src/tests/gcstartest.cpp
M +1 -1 src/tests/griffithtest.cpp
M +2 -2 src/tests/imagetest.cpp
M +1 -1 src/tests/referencertest.cpp
M +2 -2 src/tests/ristest.cpp
M +5 -5 src/tests/tellicoreadtest.cpp
M +1 -1 src/tests/vinoxmltest.cpp
M +3 -3 src/translators/adsimporter.cpp
M +2 -2 src/translators/adsimporter.h
M +1 -1 src/translators/alexandriaexporter.cpp
M +1 -2 src/translators/alexandriaimporter.cpp
M +1 -1 src/translators/amcimporter.cpp
M +1 -1 src/translators/amcimporter.h
M +2 -2 src/translators/audiofileimporter.cpp
M +1 -1 src/translators/audiofileimporter.h
M +4 -5 src/translators/bibteximporter.cpp
M +3 -3 src/translators/bibteximporter.h
M +1 -1 src/translators/bibtexmlimporter.cpp
M +1 -1 src/translators/bibtexmlimporter.h
M +3 -3 src/translators/boardgamegeekimporter.cpp
M +1 -1 src/translators/boardgamegeekimporter.h
M +4 -4 src/translators/ciwimporter.cpp
M +3 -3 src/translators/ciwimporter.h
M +1 -1 src/translators/csvimporter.cpp
M +1 -1 src/translators/csvimporter.h
M +1 -1 src/translators/dataimporter.cpp
M +2 -2 src/translators/dataimporter.h
M +4 -5 src/translators/deliciousimporter.cpp
M +2 -2 src/translators/deliciousimporter.h
M +4 -4 src/translators/exporter.h
M +4 -3 src/translators/filelistingimporter.cpp
M +1 -1 src/translators/filelistingimporter.h
M +8 -9 src/translators/gcstarexporter.cpp
M +4 -4 src/translators/gcstarimporter.cpp
M +1 -1 src/translators/gcstarimporter.h
M +3 -3 src/translators/goodreadsimporter.cpp
M +1 -1 src/translators/goodreadsimporter.h
M +2 -3 src/translators/griffithimporter.cpp
M +1 -1 src/translators/griffithimporter.h
M +39 -34 src/translators/htmlexporter.cpp
M +4 -4 src/translators/htmlexporter.h
M +3 -2 src/translators/importer.cpp
M +6 -6 src/translators/importer.h
M +5 -6 src/translators/onixexporter.cpp
M +7 -8 src/translators/pdfimporter.cpp
M +1 -1 src/translators/pdfimporter.h
M +2 -3 src/translators/referencerimporter.cpp
M +2 -2 src/translators/referencerimporter.h
M +4 -4 src/translators/risimporter.cpp
M +3 -3 src/translators/risimporter.h
M +3 -3 src/translators/tellicoimporter.cpp
M +2 -2 src/translators/tellicoimporter.h
M +4 -2 src/translators/tellicoxmlexporter.cpp
M +1 -1 src/translators/textimporter.cpp
M +1 -1 src/translators/textimporter.h
M +2 -3 src/translators/vinoxmlimporter.cpp
M +2 -2 src/translators/vinoxmlimporter.h
M +3 -3 src/translators/xmlimporter.cpp
M +1 -1 src/translators/xmlimporter.h
M +1 -1 src/translators/xmlstatehandler.cpp
M +1 -1 src/translators/xsltexporter.cpp
M +1 -1 src/translators/xsltexporter.h
M +4 -4 src/translators/xslthandler.cpp
M +2 -2 src/translators/xslthandler.h
M +2 -2 src/translators/xsltimporter.cpp
M +3 -3 src/translators/xsltimporter.h
M +2 -3 src/utils/bibtexhandler.cpp
http://commits.kde.org/tellico/cc04d97c70ba68525f20bea09d27d196b4624a0a
diff --git a/src/commands/collectioncommand.h b/src/commands/collectioncommand.h
index d38d9b4..d47c60a 100644
--- a/src/commands/collectioncommand.h
+++ b/src/commands/collectioncommand.h
@@ -27,9 +27,8 @@
#include "../datavectors.h"
-#include <kurl.h>
-
#include <QUndoCommand>
+#include <QUrl>
namespace Tellico {
namespace Command {
@@ -58,7 +57,7 @@ private:
Data::CollPtr m_origColl;
Data::CollPtr m_newColl;
- KUrl m_origURL;
+ QUrl m_origURL;
Data::FieldList m_origFields;
Data::MergePair m_mergePair;
// for the Replace case, the collection that got replaced needs to be cleared
diff --git a/src/configdialog.cpp b/src/configdialog.cpp
index 3ae7402..1b74ad4 100644
--- a/src/configdialog.cpp
+++ b/src/configdialog.cpp
@@ -1144,7 +1144,7 @@ void ConfigDialog::slotInstallTemplate() {
filter += i18n("*.tar.gz *.tgz|Template Packages (*.tar.gz)") + QLatin1Char('\n');
filter += i18n("*|All Files");
- QString f = KFileDialog::getOpenFileName(KUrl(), filter, this);
+ QString f = KFileDialog::getOpenFileName(QUrl(), filter, this);
if(f.isEmpty()) {
return;
}
diff --git a/src/core/filehandler.cpp b/src/core/filehandler.cpp
index b530fc8..c57dcfb 100644
--- a/src/core/filehandler.cpp
+++ b/src/core/filehandler.cpp
@@ -31,7 +31,6 @@
#include "../utils/xmlhandler.h"
#include "../tellico_debug.h"
-#include <kurl.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kio/netaccess.h>
@@ -44,6 +43,7 @@
#include <kicon.h>
#include <kiconloader.h>
+#include <QUrl>
#include <QDomDocument>
#include <QFile>
#include <QTextStream>
@@ -51,7 +51,7 @@
using Tellico::FileHandler;
-FileHandler::FileRef::FileRef(const KUrl& url_, bool quiet_) : m_device(0), \
m_isValid(false) { +FileHandler::FileRef::FileRef(const QUrl& url_, bool quiet_) : \
m_device(0), m_isValid(false) { if(url_.isEmpty()) {
return;
}
@@ -90,8 +90,7 @@ bool FileHandler::FileRef::open(bool quiet_) {
}
if(!m_device || !m_device->open(QIODevice::ReadOnly)) {
if(!quiet_) {
- KUrl u;
- u.setPath(fileName());
+ QUrl u = QUrl::fromLocalFile(fileName());
GUI::Proxy::sorry(i18n(errorLoad, u.fileName()));
}
delete m_device;
@@ -102,11 +101,11 @@ bool FileHandler::FileRef::open(bool quiet_) {
return true;
}
-FileHandler::FileRef* FileHandler::fileRef(const KUrl& url_, bool quiet_) {
+FileHandler::FileRef* FileHandler::fileRef(const QUrl& url_, bool quiet_) {
return new FileRef(url_, quiet_);
}
-QString FileHandler::readTextFile(const KUrl& url_, bool quiet_/*=false*/, bool \
useUTF8_ /*false*/) { +QString FileHandler::readTextFile(const QUrl& url_, bool \
quiet_/*=false*/, bool useUTF8_ /*false*/) { FileRef f(url_, quiet_);
if(!f.isValid()) {
return QString();
@@ -122,7 +121,7 @@ QString FileHandler::readTextFile(const KUrl& url_, bool \
quiet_/*=false*/, bool return QString();
}
-QString FileHandler::readXMLFile(const KUrl& url_, bool quiet_/*=false*/) {
+QString FileHandler::readXMLFile(const QUrl& url_, bool quiet_/*=false*/) {
FileRef f(url_, quiet_);
if(!f.isValid()) {
return QString();
@@ -134,7 +133,7 @@ QString FileHandler::readXMLFile(const KUrl& url_, bool \
quiet_/*=false*/) { return QString();
}
-QDomDocument FileHandler::readXMLDocument(const KUrl& url_, bool processNamespace_, \
bool quiet_) { +QDomDocument FileHandler::readXMLDocument(const QUrl& url_, bool \
processNamespace_, bool quiet_) { FileRef f(url_, quiet_);
if(!f.isValid()) {
return QDomDocument();
@@ -162,7 +161,7 @@ QDomDocument FileHandler::readXMLDocument(const KUrl& url_, bool \
processNamespac return doc;
}
-QByteArray FileHandler::readDataFile(const KUrl& url_, bool quiet_) {
+QByteArray FileHandler::readDataFile(const QUrl& url_, bool quiet_) {
FileRef f(url_, quiet_);
if(!f.isValid()) {
return QByteArray();
@@ -172,7 +171,7 @@ QByteArray FileHandler::readDataFile(const KUrl& url_, bool \
quiet_) { return f.file()->readAll();
}
-Tellico::Data::Image* FileHandler::readImageFile(const KUrl& url_, const QString& \
id_, bool quiet_, const KUrl& referrer_) { +Tellico::Data::Image* \
FileHandler::readImageFile(const QUrl& url_, const QString& id_, bool quiet_, const \
QUrl& referrer_) { if(referrer_.isEmpty() || url_.isLocalFile()) {
return readImageFile(url_, id_, quiet_);
}
@@ -180,8 +179,7 @@ Tellico::Data::Image* FileHandler::readImageFile(const KUrl& \
url_, const QString KTemporaryFile tempFile;
tempFile.open();
tempFile.setAutoRemove(true);
- KUrl tempURL;
- tempURL.setPath(tempFile.fileName());
+ QUrl tempURL = QUrl::fromLocalFile(tempFile.fileName());
KIO::JobFlags flags = KIO::Overwrite;
if(quiet_) {
@@ -193,7 +191,7 @@ Tellico::Data::Image* FileHandler::readImageFile(const KUrl& \
url_, const QString
if(!KIO::NetAccess::synchronousRun(job, GUI::Proxy::widget())) {
if(!quiet_) {
- QString str = i18n("Tellico is unable to load the image - %1.", \
url_.prettyUrl()); + QString str = i18n("Tellico is unable to load the image - \
%1.", url_.toDisplayString()); GUI::Proxy::sorry(str);
}
return 0;
@@ -201,7 +199,7 @@ Tellico::Data::Image* FileHandler::readImageFile(const KUrl& \
url_, const QString return readImageFile(tempURL, id_, quiet_);
}
-Tellico::Data::Image* FileHandler::readImageFile(const KUrl& url_, const QString& \
id_, bool quiet_) { +Tellico::Data::Image* FileHandler::readImageFile(const QUrl& \
url_, const QString& id_, bool quiet_) { FileRef f(url_, quiet_);
if(!f.isValid()) {
return 0;
@@ -217,7 +215,7 @@ Tellico::Data::Image* FileHandler::readImageFile(const KUrl& \
url_, const QString
// really, this should be decoupled from the writeBackupFile() function
// but every other function that calls it would need to be updated
-bool FileHandler::queryExists(const KUrl& url_) {
+bool FileHandler::queryExists(const QUrl& url_) {
if(url_.isEmpty() || !KIO::NetAccess::exists(url_, KIO::NetAccess::SourceSide, \
GUI::Proxy::widget())) { return true;
}
@@ -241,7 +239,7 @@ bool FileHandler::queryExists(const KUrl& url_) {
return writeBackupFile(url_);
}
-bool FileHandler::writeBackupFile(const KUrl& url_) {
+bool FileHandler::writeBackupFile(const QUrl& url_) {
bool success = true;
if(url_.isLocalFile()) {
// KDE bug 178640, for versions prior to KDE 4.2RC1, backup file was not deleted \
first @@ -255,7 +253,7 @@ bool FileHandler::writeBackupFile(const KUrl& url_) {
success = true; // ignore error for old version because of bug
}
} else {
- KUrl backup(url_);
+ QUrl backup(url_);
backup.setPath(backup.path() + QLatin1Char('~'));
KIO::NetAccess::del(backup, GUI::Proxy::widget()); // might fail if backup \
doesn't exist, that's ok
KIO::FileCopyJob* job = KIO::file_copy(url_, backup, -1, KIO::Overwrite);
@@ -267,7 +265,7 @@ bool FileHandler::writeBackupFile(const KUrl& url_) {
return success;
}
-bool FileHandler::writeTextURL(const KUrl& url_, const QString& text_, bool \
encodeUTF8_, bool force_, bool quiet_) { +bool FileHandler::writeTextURL(const QUrl& \
url_, const QString& text_, bool encodeUTF8_, bool force_, bool quiet_) { \
if((!force_ && !queryExists(url_)) || text_.isNull()) { if(text_.isNull()) {
myDebug() << "null string for" << url_;
@@ -332,7 +330,7 @@ bool FileHandler::writeTextFile(KSaveFile& file_, const QString& \
text_, bool enc return success;
}
-bool FileHandler::writeDataURL(const KUrl& url_, const QByteArray& data_, bool \
force_, bool quiet_) { +bool FileHandler::writeDataURL(const QUrl& url_, const \
QByteArray& data_, bool force_, bool quiet_) { if(!force_ && !queryExists(url_)) {
return false;
}
diff --git a/src/core/filehandler.h b/src/core/filehandler.h
index dad96f5..b406e3a 100644
--- a/src/core/filehandler.h
+++ b/src/core/filehandler.h
@@ -28,7 +28,8 @@
#include <QString>
#include <QByteArray>
-class KUrl;
+class QUrl;
+
class KSaveFile;
namespace KIO {
class Job;
@@ -69,7 +70,7 @@ public:
private:
friend class FileHandler;
- explicit FileRef(const KUrl& url, bool quiet=false);
+ explicit FileRef(const QUrl& url, bool quiet=false);
QIODevice* m_device;
QString m_filename;
bool m_isValid;
@@ -84,7 +85,7 @@ public:
* @param quiet Whether error messages should be shown
* @return The fileref
*/
- static FileRef* fileRef(const KUrl& url, bool quiet=false);
+ static FileRef* fileRef(const QUrl& url, bool quiet=false);
/**
* Read contents of a file into a string.
*
@@ -93,7 +94,7 @@ public:
* @param useUTF8 Whether the file should be read as UTF8 or use user locale
* @return A string containing the contents of a file
*/
- static QString readTextFile(const KUrl& url, bool quiet=false, bool \
useUTF8=false); + static QString readTextFile(const QUrl& url, bool quiet=false, \
bool useUTF8=false); /**
* Read contents of an XML file into a string, checking for encoding.
*
@@ -101,7 +102,7 @@ public:
* @param quiet whether the importer should report errors or not
* @return A string containing the contents of a file
*/
- static QString readXMLFile(const KUrl& url, bool quiet=false);
+ static QString readXMLFile(const QUrl& url, bool quiet=false);
/**
* Read contents of an XML file into a QDomDocument.
*
@@ -110,7 +111,7 @@ public:
* @param quiet Whether error messages should be shown
* @return A QDomDocument containing the contents of a file
*/
- static QDomDocument readXMLDocument(const KUrl& url, bool processNamespace, bool \
quiet=false); + static QDomDocument readXMLDocument(const QUrl& url, bool \
processNamespace, bool quiet=false); /**
* Read contents of a data file into a QByteArray.
*
@@ -118,7 +119,7 @@ public:
* @param quiet Whether error messages should be shown
* @return A QByteArray of the file's contents
*/
- static QByteArray readDataFile(const KUrl& url, bool quiet=false);
+ static QByteArray readDataFile(const QUrl& url, bool quiet=false);
/**
* Writes the contents of a string to a url. If the file already exists, a "~" is \
appended
* and the existing file is moved. If the file is remote, a temporary file is \
written and @@ -130,7 +131,7 @@ public:
* @param force Whether to force the write
* @return A boolean indicating success
*/
- static bool writeTextURL(const KUrl& url, const QString& text, bool encodeUTF8, \
bool force=false, bool quiet=false); + static bool writeTextURL(const QUrl& url, \
const QString& text, bool encodeUTF8, bool force=false, bool quiet=false); /**
* Writes data to a url. If the file already exists, a "~" is appended
* and the existing file is moved. If the file is remote, a temporary file is \
written and @@ -141,20 +142,20 @@ public:
* @param force Whether to force the write
* @return A boolean indicating success
*/
- static bool writeDataURL(const KUrl& url, const QByteArray& data, bool \
force=false, bool quiet=false); + static bool writeDataURL(const QUrl& url, const \
QByteArray& data, bool force=false, bool quiet=false); /**
* Checks to see if a URL exists already, and if so, queries the user.
*
* @param url The target URL
* @return True if it is ok to continue, false otherwise.
*/
- static bool queryExists(const KUrl& url);
+ static bool queryExists(const QUrl& url);
/**
* Write a backup file with '~' extension
*
* Returns true on success
*/
- static bool writeBackupFile(const KUrl& url);
+ static bool writeBackupFile(const QUrl& url);
private:
/**
@@ -165,8 +166,8 @@ private:
* @param quiet If errors should be quiet
* @return The image
*/
- static Data::Image* readImageFile(const KUrl& url, const QString& id = QString(), \
bool quiet=false);
- static Data::Image* readImageFile(const KUrl& url, const QString& id, bool quiet, \
const KUrl& referrer); + static Data::Image* readImageFile(const QUrl& url, const \
QString& id = QString(), bool quiet=false); + static Data::Image* \
readImageFile(const QUrl& url, const QString& id, bool quiet, const QUrl& referrer); \
/**
* Writes the contents of a string to a file.
*
diff --git a/src/core/netaccess.cpp b/src/core/netaccess.cpp
index 9c767fb..a1c0a32 100644
--- a/src/core/netaccess.cpp
+++ b/src/core/netaccess.cpp
@@ -33,8 +33,8 @@
#include <kio/jobuidelegate.h>
#include <ktemporaryfile.h>
#include <klocale.h>
-#include <kurl.h>
+#include <QUrl>
#include <QEventLoop>
#include <unistd.h>
@@ -45,7 +45,7 @@ QString Tellico::NetAccess::s_lastErrorMessage;
using Tellico::NetAccess;
-bool NetAccess::download(const KUrl& url_, QString& target_, QWidget* window_, bool \
quiet_) { +bool NetAccess::download(const QUrl& url_, QString& target_, QWidget* \
window_, bool quiet_) { if(url_.isLocalFile()) {
return KIO::NetAccess::download(url_, target_, window_);
}
@@ -62,8 +62,7 @@ bool NetAccess::download(const KUrl& url_, QString& target_, \
QWidget* window_, b tmpfiles->append(target_);
}
- KUrl dest;
- dest.setPath(target_);
+ QUrl dest = QUrl::fromLocalFile(target_);
KIO::JobFlags flags = KIO::Overwrite;
if(quiet_) {
flags |= KIO::HideProgressInfo;
@@ -96,7 +95,7 @@ bool NetAccess::download(const KUrl& url_, QString& target_, \
QWidget* window_, b return false;
}
-QPixmap NetAccess::filePreview(const KUrl& url, int size) {
+QPixmap NetAccess::filePreview(const QUrl& url, int size) {
NetAccess netaccess;
KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, url, true);
diff --git a/src/core/netaccess.h b/src/core/netaccess.h
index 390e590..9cdd60e 100644
--- a/src/core/netaccess.h
+++ b/src/core/netaccess.h
@@ -28,7 +28,8 @@
#include <QObject>
#include <QPixmap>
-class KUrl;
+class QUrl;
+
class KFileItem;
namespace Tellico {
@@ -37,8 +38,8 @@ class NetAccess : public QObject {
Q_OBJECT
public:
- static bool download(const KUrl& u, QString& target, QWidget* window, bool \
quiet=false);
- static QPixmap filePreview(const KUrl& fileName, int size=196);
+ static bool download(const QUrl& u, QString& target, QWidget* window, bool \
quiet=false); + static QPixmap filePreview(const QUrl& fileName, int size=196);
static QPixmap filePreview(const KFileItem& item, int size=196);
static void removeTempFile(const QString& name);
diff --git a/src/dbusinterface.cpp b/src/dbusinterface.cpp
index 7c851c4..a9d011e 100644
--- a/src/dbusinterface.cpp
+++ b/src/dbusinterface.cpp
@@ -78,11 +78,11 @@ bool ApplicationInterface::showEntry(int id) {
return m_mainWindow->showEntry(id);
}
-bool ApplicationInterface::importFile(Tellico::Import::Format format, const KUrl& \
url, Tellico::Import::Action action) { +bool \
ApplicationInterface::importFile(Tellico::Import::Format format, const QUrl& url, \
Tellico::Import::Action action) { return m_mainWindow->importFile(format, url, \
action); }
-bool ApplicationInterface::exportCollection(Tellico::Export::Format format, const \
KUrl& url) { +bool ApplicationInterface::exportCollection(Tellico::Export::Format \
format, const QUrl& url) { return m_mainWindow->exportCollection(format, url);
}
diff --git a/src/dbusinterface.h b/src/dbusinterface.h
index ddb988e..0a223d8 100644
--- a/src/dbusinterface.h
+++ b/src/dbusinterface.h
@@ -27,7 +27,7 @@
#include "../translators/translators.h"
-#include <kurl.h>
+#include <QUrl>
#include <QStringList>
@@ -46,24 +46,24 @@ public:
public slots:
Q_SCRIPTABLE bool importTellico(const QString& file, const QString& action)
- { return importFile(Import::TellicoXML, KUrl::fromPath(file), \
actionType(action)); } + { return importFile(Import::TellicoXML, \
QUrl::fromUserInput(file), actionType(action)); } Q_SCRIPTABLE bool \
importBibtex(const QString& file, const QString& action)
- { return importFile(Import::Bibtex, KUrl::fromPath(file), actionType(action)); }
+ { return importFile(Import::Bibtex, QUrl::fromUserInput(file), \
actionType(action)); } Q_SCRIPTABLE bool importMODS(const QString& file, const \
QString& action)
- { return importFile(Import::MODS, KUrl::fromPath(file), actionType(action)); }
+ { return importFile(Import::MODS, QUrl::fromUserInput(file), \
actionType(action)); } Q_SCRIPTABLE bool importRIS(const QString& file, const \
QString& action)
- { return importFile(Import::RIS, KUrl::fromPath(file), actionType(action)); }
+ { return importFile(Import::RIS, QUrl::fromUserInput(file), actionType(action)); \
}
Q_SCRIPTABLE bool exportXML(const QString& file)
- { return exportCollection(Export::TellicoXML, KUrl::fromPath(file)); }
+ { return exportCollection(Export::TellicoXML, QUrl::fromUserInput(file)); }
Q_SCRIPTABLE bool exportZip(const QString& file)
- { return exportCollection(Export::TellicoZip, KUrl::fromPath(file)); }
+ { return exportCollection(Export::TellicoZip, QUrl::fromUserInput(file)); }
Q_SCRIPTABLE bool exportBibtex(const QString& file)
- { return exportCollection(Export::Bibtex, KUrl::fromPath(file)); }
+ { return exportCollection(Export::Bibtex, QUrl::fromUserInput(file)); }
Q_SCRIPTABLE bool exportHTML(const QString& file)
- { return exportCollection(Export::HTML, KUrl::fromPath(file)); }
+ { return exportCollection(Export::HTML, QUrl::fromUserInput(file)); }
Q_SCRIPTABLE bool exportCSV(const QString& file)
- { return exportCollection(Export::CSV, KUrl::fromPath(file)); }
+ { return exportCollection(Export::CSV, QUrl::fromUserInput(file)); }
Q_SCRIPTABLE QList<int> selectedEntries() const;
Q_SCRIPTABLE QList<int> filteredEntries() const;
@@ -73,8 +73,8 @@ public slots:
Q_SCRIPTABLE virtual bool showEntry(int id);
private:
- virtual bool importFile(Import::Format format, const KUrl& url, Import::Action \
action);
- virtual bool exportCollection(Export::Format format, const KUrl& url);
+ virtual bool importFile(Import::Format format, const QUrl& url, Import::Action \
action); + virtual bool exportCollection(Export::Format format, const QUrl& url);
Import::Action actionType(const QString& actionName);
diff --git a/src/detailedlistview.cpp b/src/detailedlistview.cpp
index 6738579..d86e411 100644
--- a/src/detailedlistview.cpp
+++ b/src/detailedlistview.cpp
@@ -129,9 +129,9 @@ void DetailedListView::addCollection(Tellico::Data::CollPtr \
coll_) {
QString configN;
if(coll_->type() == Data::Collection::Base) {
- KUrl url = Kernel::self()->URL();
+ QUrl url = Kernel::self()->URL();
for(int i = 0; i < Config::maxCustomURLSettings(); ++i) {
- KUrl u = config.readEntry(QString::fromLatin1("URL_%1").arg(i), QUrl());
+ QUrl u = config.readEntry(QString::fromLatin1("URL_%1").arg(i), QUrl());
if(u == url) {
configN = QString::fromLatin1("_%1").arg(i);
break;
@@ -426,7 +426,7 @@ void DetailedListView::saveConfig(Tellico::Data::CollPtr coll_, \
int configIndex_ if(coll_->type() == Data::Collection::Base) {
QList<ConfigInfo> info;
for(int i = 0; i < Config::maxCustomURLSettings(); ++i) {
- KUrl u = config.readEntry(QString::fromLatin1("URL_%1").arg(i));
+ QUrl u = config.readEntry(QString::fromLatin1("URL_%1").arg(i));
if(!u.isEmpty() && i != configIndex_) {
configN = QString::fromLatin1("_%1").arg(i);
ConfigInfo ci;
diff --git a/src/document.cpp b/src/document.cpp
index d6e5697..6f1ce76 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -72,7 +72,7 @@ Tellico::Data::CollPtr Document::collection() const {
return m_coll;
}
-void Document::setURL(const KUrl& url_) {
+void Document::setURL(const QUrl& url_) {
m_url = url_;
if(m_url.fileName() != i18n(Tellico::untitledFilename)) {
ImageFactory::setLocalDirectory(m_url);
@@ -106,8 +106,7 @@ bool Document::newDocument(int type_) {
emit signalCollectionAdded(m_coll);
slotSetModified(false);
- KUrl url;
- url.setFileName(i18n(Tellico::untitledFilename));
+ QUrl url = QUrl::fromLocalFile(i18n(Tellico::untitledFilename));
setURL(url);
m_validFile = false;
m_fileFormat = Import::TellicoImporter::Unknown;
@@ -115,7 +114,7 @@ bool Document::newDocument(int type_) {
return true;
}
-bool Document::openDocument(const KUrl& url_) {
+bool Document::openDocument(const QUrl& url_) {
MARK;
m_loadAllImages = false;
// delayed image loading only works for local files
@@ -175,7 +174,7 @@ bool Document::openDocument(const KUrl& url_) {
return true;
}
-bool Document::saveDocument(const KUrl& url_) {
+bool Document::saveDocument(const QUrl& url_) {
// FileHandler::queryExists calls FileHandler::writeBackupFile
// so the only reason to check queryExists() is if the url to write to is \
different than the current one if(url_ == m_url) {
@@ -334,8 +333,7 @@ void Document::replaceCollection(Tellico::Data::CollPtr coll_) {
return;
}
- KUrl url;
- url.setFileName(i18n(Tellico::untitledFilename));
+ QUrl url = QUrl::fromLocalFile(i18n(Tellico::untitledFilename));
setURL(url);
m_validFile = false;
@@ -523,7 +521,7 @@ void Document::slotLoadAllImages() {
m_importer = 0;
}
-void Document::writeAllImages(int cacheDir_, const KUrl& localDir_) {
+void Document::writeAllImages(int cacheDir_, const QUrl& localDir_) {
// images get 80 steps in saveDocument()
const uint stepSize = 1 + qMax(1, m_coll->entryCount()/80); // add 1 since it \
could round off uint j = 1;
diff --git a/src/document.h b/src/document.h
index 99dac36..98658b9 100644
--- a/src/document.h
+++ b/src/document.h
@@ -28,10 +28,9 @@
#include "datavectors.h"
#include "filter.h"
-#include <kurl.h>
-
#include <QObject>
#include <QPointer>
+#include <QUrl>
namespace Tellico {
namespace Import {
@@ -69,7 +68,7 @@ public:
*
* @param url The URL
*/
- void setURL(const KUrl& url);
+ void setURL(const QUrl& url);
/**
* Checks the modified flag, which indicates if the document has changed since the
* last save.
@@ -86,7 +85,7 @@ public:
*
* @return The url
*/
- const KUrl& URL() const { return m_url; }
+ const QUrl& URL() const { return m_url; }
/**
* Initializes a new document. The signalNewDoc() signal is emitted. The return
* value is currently always true, but should indicate whether or not a new \
document @@ -104,14 +103,14 @@ public:
* @param url The location to open
* @return A boolean indicating success
*/
- bool openDocument(const KUrl& url);
+ bool openDocument(const QUrl& url);
/**
* Saves the document contents to a file.
*
* @param url The location to save the file
* @return A boolean indicating success
*/
- bool saveDocument(const KUrl& url);
+ bool saveDocument(const QUrl& url);
/**
* Closes the document, deleting the contents. The return value is presently \
always true.
*
@@ -226,7 +225,7 @@ private:
* Writes all images in the current collection to the cache directory
* if cacheDir = LocalDir, then url will be used and must not be empty
*/
- void writeAllImages(int cacheDir, const KUrl& url=KUrl());
+ void writeAllImages(int cacheDir, const QUrl& url=QUrl());
bool pruneImages();
// make all constructors private
@@ -238,7 +237,7 @@ private:
CollPtr m_coll;
bool m_isModified;
bool m_loadAllImages;
- KUrl m_url;
+ QUrl m_url;
bool m_validFile;
QPointer<Import::TellicoImporter> m_importer;
bool m_cancelImageWriting;
diff --git a/src/entrycomparison.cpp b/src/entrycomparison.cpp
index a26aea1..5f1fb97 100644
--- a/src/entrycomparison.cpp
+++ b/src/entrycomparison.cpp
@@ -32,9 +32,9 @@
using Tellico::EntryComparison;
-KUrl EntryComparison::s_documentUrl;
+QUrl EntryComparison::s_documentUrl;
-void EntryComparison::setDocumentUrl(const KUrl& url_) {
+void EntryComparison::setDocumentUrl(const QUrl& url_) {
s_documentUrl = url_;
}
@@ -67,18 +67,18 @@ int EntryComparison::score(Tellico::Data::EntryPtr e1, \
Tellico::Data::EntryPtr e }
if(f->name() == QLatin1String("url") && e1->collection() && \
e1->collection()->type() == Data::Collection::File) {
// versions before 1.2.7 could have saved the url without the protocol
- if(KUrl(s1) == KUrl(s2) ||
+ if(QUrl(s1) == QUrl(s2) ||
(f->property(QLatin1String("relative")) == QLatin1String("true") &&
- KUrl(s_documentUrl, s1) == KUrl(s_documentUrl, s2))) {
+ s_documentUrl.resolved(s1) == s_documentUrl.resolved(s2))) {
return 5;
}
}
if (f->name() == QLatin1String("imdb")) {
// imdb might be a different host since we query akas.imdb.com and normally it \
is www.imdb.com
- KUrl us1 = KUrl(s1);
- KUrl us2 = KUrl(s2);
- us1.setHost(QLatin1String(""));
- us2.setHost(QLatin1String(""));
+ QUrl us1 = QUrl::fromUserInput(s1);
+ QUrl us2 = QUrl::fromUserInput(s2);
+ us1.setHost(QString());
+ us2.setHost(QString());
if(us1 == us2) {
return 5;
}
diff --git a/src/entrycomparison.h b/src/entrycomparison.h
index da0f3b2..fac8a98 100644
--- a/src/entrycomparison.h
+++ b/src/entrycomparison.h
@@ -27,7 +27,7 @@
#include "datavectors.h"
-#include <kurl.h>
+#include <QUrl>
namespace Tellico {
@@ -38,7 +38,7 @@ public:
* this is totally not the way the comparison should be done, but it's too \
expensive to include
* a connection to document.h here
*/
- static void setDocumentUrl(const KUrl& url);
+ static void setDocumentUrl(const QUrl& url);
static int score(Data::EntryPtr entry1, Data::EntryPtr entry2, Data::FieldPtr \
field); static int score(Data::EntryPtr entry1, Data::EntryPtr entry2, const \
QString& field, const Data::Collection* coll); @@ -51,7 +51,7 @@ public:
};
private:
- static KUrl s_documentUrl;
+ static QUrl s_documentUrl;
};
} // namespace
diff --git a/src/entryview.cpp b/src/entryview.cpp
index 1c0f326..94c7e35 100644
--- a/src/entryview.cpp
+++ b/src/entryview.cpp
@@ -78,8 +78,8 @@ EntryView::EntryView(QWidget* parent_) : KHTMLPart(new \
EntryViewWidget(this, par DropHandler* drophandler = new DropHandler(this);
view()->installEventFilter(drophandler);
- connect(browserExtension(), SIGNAL(openUrlRequestDelayed(const KUrl&, const \
KParts::OpenUrlArguments&, const KParts::BrowserArguments&)),
- SLOT(slotOpenURL(const KUrl&)));
+ connect(browserExtension(), SIGNAL(openUrlRequestDelayed(const QUrl&, const \
KParts::OpenUrlArguments&, const KParts::BrowserArguments&)), + \
SLOT(slotOpenURL(const QUrl&))); connect(KGlobalSettings::self(), \
SIGNAL(kdisplayPaletteChanged()), SLOT(slotResetColors()));
view()->setWhatsThis(i18n("<qt>The <i>Entry View</i> shows a formatted view of the \
entry's contents.</qt>")); @@ -136,7 +136,7 @@ void \
EntryView::showEntry(Tellico::Data::EntryPtr entry_) {
// by setting the xslt file as the URL, any images referenced in the xslt "theme" \
can be found // by simply using a relative path in the xslt file
- KUrl u;
+ QUrl u;
u.setPath(m_xsltFile);
begin(u);
@@ -311,20 +311,20 @@ void EntryView::slotRefresh() {
// need to interpret it relative to document URL instead of xslt file
// the current node under the mouse vould be the text node inside
// the anchor node, so iterate up the parents
-void EntryView::slotOpenURL(const KUrl& url_) {
- if(url_.protocol() == QLatin1String("tc")) {
+void EntryView::slotOpenURL(const QUrl& url_) {
+ if(url_.scheme() == QLatin1String("tc")) {
// handle this internally
emit signalAction(url_);
return;
}
- KUrl u = url_;
+ QUrl u = url_;
for(DOM::Node node = nodeUnderMouse(); !node.isNull(); node = node.parentNode()) {
if(node.nodeType() == DOM::Node::ELEMENT_NODE && \
static_cast<DOM::Element>(node).tagName() == "a") {
QString href = static_cast<DOM::Element>(node).getAttribute("href").string();
- if(!href.isEmpty() && KUrl::isRelativeUrl(href)) {
+ if(!href.isEmpty() && QUrl::fromUserInput(href).isRelative()) {
// interpet url relative to document url
- u = KUrl(Kernel::self()->URL(), href);
+ u = Kernel::self()->URL().resolved(href);
}
break;
}
diff --git a/src/entryview.h b/src/entryview.h
index 612041e..4463373 100644
--- a/src/entryview.h
+++ b/src/entryview.h
@@ -29,7 +29,7 @@
#include <khtml_part.h>
#include <khtmlview.h>
-#include <KUrl>
+#include <QUrl>
#include <QPointer>
@@ -82,7 +82,7 @@ public:
void setUseGradientImages(bool b) { m_useGradientImages = b; }
signals:
- void signalAction(const KUrl& url);
+ void signalAction(const QUrl& url);
public slots:
/**
@@ -97,7 +97,7 @@ private slots:
*
* @param url The URL to open
*/
- void slotOpenURL(const KUrl& url);
+ void slotOpenURL(const QUrl& url);
void slotReloadEntry();
void slotResetColors();
diff --git a/src/exportdialog.cpp b/src/exportdialog.cpp
index 996b5b6..e6062a6 100644
--- a/src/exportdialog.cpp
+++ b/src/exportdialog.cpp
@@ -225,7 +225,7 @@ Tellico::Export::Exporter* \
ExportDialog::exporter(Tellico::Export::Format format return exporter;
}
-bool ExportDialog::exportURL(const KUrl& url_/*=KUrl()*/) const {
+bool ExportDialog::exportURL(const QUrl& url_/*=QUrl()*/) const {
if(!m_exporter) {
return false;
}
@@ -281,7 +281,7 @@ Tellico::Export::Target \
ExportDialog::exportTarget(Tellico::Export::Format forma }
// static
-bool ExportDialog::exportCollection(Tellico::Export::Format format_, const KUrl& \
url_) { +bool ExportDialog::exportCollection(Tellico::Export::Format format_, const \
QUrl& url_) { Export::Exporter* exp = exporter(format_, \
Data::Document::self()->collection());
exp->setURL(url_);
diff --git a/src/exportdialog.h b/src/exportdialog.h
index fc2c009..2350dd7 100644
--- a/src/exportdialog.h
+++ b/src/exportdialog.h
@@ -29,7 +29,7 @@
#include "datavectors.h"
#include <kdialog.h>
-#include <kurl.h>
+#include <QUrl>
class QCheckBox;
class QRadioButton;
@@ -50,10 +50,10 @@ public:
~ExportDialog();
QString fileFilter();
- bool exportURL(const KUrl& url=KUrl()) const;
+ bool exportURL(const QUrl& url=QUrl()) const;
static Export::Target exportTarget(Export::Format format);
- static bool exportCollection(Export::Format format, const KUrl& url);
+ static bool exportCollection(Export::Format format, const QUrl& url);
private slots:
void slotSaveOptions();
diff --git a/src/fetch/allocinefetcher.cpp b/src/fetch/allocinefetcher.cpp
index dee8e7d..226df03 100644
--- a/src/fetch/allocinefetcher.cpp
+++ b/src/fetch/allocinefetcher.cpp
@@ -38,7 +38,7 @@
#include <KLineEdit>
#include <KIntSpinBox>
#include <KCodecs>
-#include <KUrl>
+#include <QUrl>
#include <QLabel>
#include <QFile>
@@ -98,8 +98,9 @@ void AbstractAllocineFetcher::search() {
m_started = true;
#ifdef HAVE_QJSON
- KUrl u(m_baseUrl);
- u.addPath(QLatin1String("search"));
+ QUrl u(m_baseUrl);
+ u = u.adjusted(QUrl::StripTrailingSlash);
+ u.setPath(u.path() + QLatin1Char('/') + QLatin1String("search"));
// the order of the parameters appears to matter
QList<QPair<QString, QString> > params;
@@ -169,8 +170,9 @@ Tellico::Data::EntryPtr \
AbstractAllocineFetcher::fetchEntryHook(uint uid_) { return entry;
}
- KUrl u(m_baseUrl);
- u.addPath(QLatin1String("movie"));
+ QUrl u(m_baseUrl);
+ u = u.adjusted(QUrl::StripTrailingSlash);
+ u.setPath(u.path() + QLatin1Char('/') + QLatin1String("movie"));
// the order of the parameters appears to matter
QList<QPair<QString, QString> > params;
diff --git a/src/fetch/amazonfetcher.cpp b/src/fetch/amazonfetcher.cpp
index 81b1056..1763b70 100644
--- a/src/fetch/amazonfetcher.cpp
+++ b/src/fetch/amazonfetcher.cpp
@@ -77,31 +77,31 @@ const AmazonFetcher::SiteData& AmazonFetcher::siteData(int site_) \
{ static SiteData dataVector[9] = {
{
i18n("Amazon (US)"),
- KUrl("http://webservices.amazon.com/onca/xml")
+ QUrl(QLatin1String("http://webservices.amazon.com/onca/xml"))
}, {
i18n("Amazon (UK)"),
- KUrl("http://webservices.amazon.co.uk/onca/xml")
+ QUrl(QLatin1String("http://webservices.amazon.co.uk/onca/xml"))
}, {
i18n("Amazon (Germany)"),
- KUrl("http://webservices.amazon.de/onca/xml")
+ QUrl(QLatin1String("http://webservices.amazon.de/onca/xml"))
}, {
i18n("Amazon (Japan)"),
- KUrl("http://webservices.amazon.co.jp/onca/xml")
+ QUrl(QLatin1String("http://webservices.amazon.co.jp/onca/xml"))
}, {
i18n("Amazon (France)"),
- KUrl("http://webservices.amazon.fr/onca/xml")
+ QUrl(QLatin1String("http://webservices.amazon.fr/onca/xml"))
}, {
i18n("Amazon (Canada)"),
- KUrl("http://webservices.amazon.ca/onca/xml")
+ QUrl(QLatin1String("http://webservices.amazon.ca/onca/xml"))
}, {
i18n("Amazon (China)"),
- KUrl("http://webservices.amazon.cn/onca/xml")
+ QUrl(QLatin1String("http://webservices.amazon.cn/onca/xml"))
}, {
i18n("Amazon (Spain)"),
- KUrl("http://webservices.amazon.es/onca/xml")
+ QUrl(QLatin1String("http://webservices.amazon.es/onca/xml"))
}, {
i18n("Amazon (Italy)"),
- KUrl("http://webservices.amazon.it/onca/xml")
+ QUrl(QLatin1String("http://webservices.amazon.it/onca/xml"))
}
};
@@ -380,7 +380,7 @@ void AmazonFetcher::doSearch() {
}
AmazonRequest request(siteData(m_site).url, m_amazonKey);
- KUrl newUrl = request.signedRequest(params);
+ QUrl newUrl = request.signedRequest(params);
// myDebug() << newUrl;
m_job = KIO::storedGet(newUrl, KIO::NoReload, KIO::HideProgressInfo);
@@ -730,7 +730,7 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntryHook(uint uid_) \
{ }
}
- KUrl imageURL;
+ QUrl imageURL;
switch(m_imageSize) {
case SmallImage:
imageURL = entry->field(QLatin1String("small-image"));
@@ -745,7 +745,7 @@ Tellico::Data::EntryPtr AmazonFetcher::fetchEntryHook(uint uid_) \
{ default:
break;
}
-// myDebug() << "grabbing " << imageURL.prettyUrl();
+// myDebug() << "grabbing " << imageURL.toDisplayString();
if(!imageURL.isEmpty()) {
QString id = ImageFactory::addImage(imageURL, true);
if(id.isEmpty()) {
@@ -770,8 +770,7 @@ void AmazonFetcher::initXSLTHandler() {
return;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
delete m_xsltHandler;
m_xsltHandler = new XSLTHandler(u);
diff --git a/src/fetch/amazonfetcher.h b/src/fetch/amazonfetcher.h
index d221ea1..704bce2 100644
--- a/src/fetch/amazonfetcher.h
+++ b/src/fetch/amazonfetcher.h
@@ -29,7 +29,7 @@
#include "configwidget.h"
#include "../datavectors.h"
-#include <kurl.h>
+#include <QUrl>
#include <QPointer>
#include <QLabel>
@@ -98,7 +98,7 @@ public:
struct SiteData {
QString title;
- KUrl url;
+ QUrl url;
};
static const SiteData& siteData(int site);
diff --git a/src/fetch/amazonrequest.cpp b/src/fetch/amazonrequest.cpp
index 48cfc3a..dbb8e22 100644
--- a/src/fetch/amazonrequest.cpp
+++ b/src/fetch/amazonrequest.cpp
@@ -32,10 +32,10 @@
using Tellico::Fetch::AmazonRequest;
-AmazonRequest::AmazonRequest(const KUrl& site_, const QByteArray& key_) : \
m_siteUrl(site_), m_key(key_) { +AmazonRequest::AmazonRequest(const QUrl& site_, \
const QByteArray& key_) : m_siteUrl(site_), m_key(key_) { }
-KUrl AmazonRequest::signedRequest(const QMap<QString, QString>& params_) const {
+QUrl AmazonRequest::signedRequest(const QMap<QString, QString>& params_) const {
QMap<QString, QString> allParams = params_;
allParams.insert(QLatin1String("Timestamp"),
QDateTime::currentDateTime().toUTC().toString(QLatin1String("yyyy-MM-dd'T'hh:mm:ss'Z'")));
@@ -66,7 +66,7 @@ KUrl AmazonRequest::signedRequest(const QMap<QString, QString>& \
params_) const { const QByteArray sig = \
KCodecs::base64Encode(hmac_buffer).toPercentEncoding(); // myDebug() << sig;
- KUrl url = m_siteUrl;
+ QUrl url = m_siteUrl;
url.setEncodedQuery(query + "&Signature=" + sig);
return url;
}
diff --git a/src/fetch/amazonrequest.h b/src/fetch/amazonrequest.h
index 070ed87..aa6013a 100644
--- a/src/fetch/amazonrequest.h
+++ b/src/fetch/amazonrequest.h
@@ -25,7 +25,7 @@
#ifndef TELLICO_FETCH_AMAZONREQUEST_H
#define TELLICO_FETCH_AMAZONREQUEST_H
-#include <KUrl>
+#include <QUrl>
#include <QMap>
@@ -37,12 +37,12 @@ namespace Tellico {
*/
class AmazonRequest {
public:
- AmazonRequest(const KUrl& site, const QByteArray& key);
+ AmazonRequest(const QUrl& site, const QByteArray& key);
- KUrl signedRequest(const QMap<QString, QString>& params) const;
+ QUrl signedRequest(const QMap<QString, QString>& params) const;
private:
- KUrl m_siteUrl;
+ QUrl m_siteUrl;
QByteArray m_key;
};
diff --git a/src/fetch/animenfofetcher.cpp b/src/fetch/animenfofetcher.cpp
index 3f29810..9a38f7d 100644
--- a/src/fetch/animenfofetcher.cpp
+++ b/src/fetch/animenfofetcher.cpp
@@ -37,13 +37,13 @@
#include <kconfig.h>
#include <kio/job.h>
#include <kio/jobuidelegate.h>
+#include <KJobWidgets/KJobWidgets>
#include <QRegExp>
#include <QLabel>
#include <QFile>
#include <QTextStream>
#include <QVBoxLayout>
-#include <KJobWidgets/KJobWidgets>
namespace {
static const char* ANIMENFO_BASE_URL = "http://www.animenfo.com/search.php";
@@ -77,7 +77,7 @@ void AnimeNfoFetcher::search() {
m_started = true;
m_matches.clear();
- KUrl u(ANIMENFO_BASE_URL);
+ QUrl u(QString::fromLatin1(ANIMENFO_BASE_URL));
u.addQueryItem(QLatin1String("action"), QLatin1String("Go"));
u.addQueryItem(QLatin1String("option"), QLatin1String("keywords"));
@@ -161,7 +161,7 @@ void AnimeNfoFetcher::slotComplete(KJob*) {
for(int pos = infoRx.indexIn(s); m_started && pos > -1; pos = infoRx.indexIn(s, \
pos+1)) { if(n == 0 && !u.isEmpty()) {
FetchResult* r = new FetchResult(Fetcher::Ptr(this), t, y);
- KUrl url(KUrl(ANIMENFO_BASE_URL), u);
+ QUrl url = QUrl(QString::fromLatin1(ANIMENFO_BASE_URL)).resolved(u);
url.setQuery(QString());
m_matches.insert(r->uid, url);
// don't emit signal until after putting url in matches hash
@@ -196,7 +196,7 @@ void AnimeNfoFetcher::slotComplete(KJob*) {
// grab last response
if(!u.isEmpty()) {
FetchResult* r = new FetchResult(Fetcher::Ptr(this), t, y, QString());
- KUrl url(KUrl(ANIMENFO_BASE_URL), u);
+ QUrl url = QUrl(QString::fromLatin1(ANIMENFO_BASE_URL)).resolved(u);
url.setQuery(QString());
m_matches.insert(r->uid, url);
// don't emit signal until after putting url in matches hash
@@ -213,7 +213,7 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::fetchEntryHook(uint \
uid_) { return entry;
}
- KUrl url = m_matches[uid_];
+ QUrl url = m_matches[uid_];
if(url.isEmpty()) {
myWarning() << "no url in map";
return Data::EntryPtr();
@@ -245,7 +245,7 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::fetchEntryHook(uint \
uid_) { return entry;
}
-Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const QString& str_, const KUrl& \
url_) { +Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const QString& str_, \
const QUrl& url_) { // myDebug();
// class might be anime_info_top
QRegExp infoRx(QLatin1String("<td\\s+[^>]*class\\s*=\\s*[\"']anime_info[^>]*>(.*)</td>"), \
Qt::CaseInsensitive); @@ -403,7 +403,7 @@ Tellico::Data::EntryPtr \
AnimeNfoFetcher::parseEntry(const QString& str_, const K imgRx.setMinimal(true);
int pos = imgRx.indexIn(s);
if(pos > -1) {
- KUrl imgURL(KUrl(ANIMENFO_BASE_URL), imgRx.cap(1));
+ QUrl imgURL = QUrl(QLatin1String(ANIMENFO_BASE_URL)).resolved(imgRx.cap(1));
QString id = ImageFactory::addImage(imgURL, true);
if(!id.isEmpty()) {
entry->setField(QLatin1String("cover"), id);
diff --git a/src/fetch/animenfofetcher.h b/src/fetch/animenfofetcher.h
index dc2e249..5959d84 100644
--- a/src/fetch/animenfofetcher.h
+++ b/src/fetch/animenfofetcher.h
@@ -30,7 +30,7 @@
#include <QPointer>
-class KUrl;
+class QUrl;
class KJob;
namespace KIO {
class StoredTransferJob;
@@ -81,12 +81,12 @@ private slots:
private:
virtual void search();
virtual FetchRequest updateRequest(Data::EntryPtr entry);
- Data::EntryPtr parseEntry(const QString& str, const KUrl& url);
+ Data::EntryPtr parseEntry(const QString& str, const QUrl& url);
QByteArray m_data;
int m_total;
QHash<int, Data::EntryPtr> m_entries;
- QHash<int, KUrl> m_matches;
+ QHash<int, QUrl> m_matches;
QPointer<KIO::StoredTransferJob> m_job;
bool m_started;
diff --git a/src/fetch/arxivfetcher.cpp b/src/fetch/arxivfetcher.cpp
index 323bb96..e2657d8 100644
--- a/src/fetch/arxivfetcher.cpp
+++ b/src/fetch/arxivfetcher.cpp
@@ -38,6 +38,7 @@
#include <kio/job.h>
#include <kio/jobuidelegate.h>
#include <KConfigGroup>
+#include <KJobWidgets/KJobWidgets>
#include <QDomDocument>
#include <QLabel>
@@ -45,9 +46,6 @@
#include <QPixmap>
#include <QVBoxLayout>
#include <QFile>
-#include <KJobWidgets/KJobWidgets>
-
-//#define ARXIV_TEST
namespace {
static const int ARXIV_RETURNS_PER_REQUEST = 20;
@@ -91,7 +89,7 @@ void ArxivFetcher::continueSearch() {
}
void ArxivFetcher::doSearch() {
- KUrl u = searchURL(request().key, request().value);
+ QUrl u = searchURL(request().key, request().value);
if(u.isEmpty()) {
stop();
return;
@@ -232,8 +230,7 @@ void ArxivFetcher::initXSLTHandler() {
return;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
delete m_xsltHandler;
m_xsltHandler = new XSLTHandler(u);
@@ -245,8 +242,8 @@ void ArxivFetcher::initXSLTHandler() {
}
}
-KUrl ArxivFetcher::searchURL(FetchKey key_, const QString& value_) const {
- KUrl u(ARXIV_BASE_URL);
+QUrl ArxivFetcher::searchURL(FetchKey key_, const QString& value_) const {
+ QUrl u(QString::fromLatin1(ARXIV_BASE_URL));
u.addQueryItem(QLatin1String("start"), QString::number(m_start));
u.addQueryItem(QLatin1String("max_results"), \
QString::number(ARXIV_RETURNS_PER_REQUEST));
@@ -283,13 +280,10 @@ KUrl ArxivFetcher::searchURL(FetchKey key_, const QString& \
value_) const {
default:
myWarning() << "key not recognized: " << request().key;
- return KUrl();
+ return QUrl();
}
u.addQueryItem(QLatin1String("search_query"), query);
-#ifdef ARXIV_TEST
- u = KUrl::fromPathOrUrl("/home/robby/arxiv.xml");
-#endif
// myDebug() << "url: " << u;
return u;
}
diff --git a/src/fetch/arxivfetcher.h b/src/fetch/arxivfetcher.h
index e88e8e5..394e7ca 100644
--- a/src/fetch/arxivfetcher.h
+++ b/src/fetch/arxivfetcher.h
@@ -30,7 +30,7 @@
#include <QPointer>
-class KUrl;
+class QUrl;
class KJob;
namespace KIO {
class StoredTransferJob;
@@ -84,7 +84,7 @@ private:
virtual void search();
virtual FetchRequest updateRequest(Data::EntryPtr entry);
void initXSLTHandler();
- KUrl searchURL(FetchKey key, const QString& value) const;
+ QUrl searchURL(FetchKey key, const QString& value) const;
void doSearch();
XSLTHandler* m_xsltHandler;
diff --git a/src/fetch/bibliosharefetcher.cpp b/src/fetch/bibliosharefetcher.cpp
index 8a7bf33..1c08173 100644
--- a/src/fetch/bibliosharefetcher.cpp
+++ b/src/fetch/bibliosharefetcher.cpp
@@ -69,9 +69,9 @@ void BiblioShareFetcher::readConfigHook(const KConfigGroup& \
config_) { }
}
-KUrl BiblioShareFetcher::searchUrl() {
- KUrl u(BIBLIOSHARE_BASE_URL);
- u.addPath(QLatin1String("BiblioSimple"));
+QUrl BiblioShareFetcher::searchUrl() {
+ QUrl u(QString::fromLatin1(BIBLIOSHARE_BASE_URL));
+ u.setPath(u.path() + QLatin1String("BiblioSimple"));
u.addQueryItem(QLatin1String("Token"), m_token);
switch(request().key) {
@@ -86,7 +86,7 @@ KUrl BiblioShareFetcher::searchUrl() {
break;
default:
- return KUrl();
+ return QUrl();
}
// myDebug() << "url:" << u.url();
return u;
@@ -108,8 +108,8 @@ Tellico::Data::EntryPtr \
BiblioShareFetcher::fetchEntryHookData(Data::EntryPtr en isbn = \
ISBNValidator::isbn13(isbn); isbn.remove(QLatin1Char('-'));
- KUrl imageUrl(BIBLIOSHARE_BASE_URL);
- imageUrl.addPath(QLatin1String("Images"));
+ QUrl imageUrl(QString::fromLatin1(BIBLIOSHARE_BASE_URL));
+ imageUrl.setPath(imageUrl.path() + QLatin1String("Images"));
imageUrl.addQueryItem(QLatin1String("Token"), m_token);
imageUrl.addQueryItem(QLatin1String("SAN"), QString());
imageUrl.addQueryItem(QLatin1String("Thumbnail"), QString());
diff --git a/src/fetch/bibliosharefetcher.h b/src/fetch/bibliosharefetcher.h
index ab84317..a1699c4 100644
--- a/src/fetch/bibliosharefetcher.h
+++ b/src/fetch/bibliosharefetcher.h
@@ -68,7 +68,7 @@ public:
private:
virtual FetchRequest updateRequest(Data::EntryPtr entry);
virtual void resetSearch() {}
- virtual KUrl searchUrl();
+ virtual QUrl searchUrl();
virtual void parseData(QByteArray&) {}
virtual Data::EntryPtr fetchEntryHookData(Data::EntryPtr entry);
diff --git a/src/fetch/bibsonomyfetcher.cpp b/src/fetch/bibsonomyfetcher.cpp
index 15f6a2b..3840f2f 100644
--- a/src/fetch/bibsonomyfetcher.cpp
+++ b/src/fetch/bibsonomyfetcher.cpp
@@ -35,14 +35,14 @@
#include <klocale.h>
#include <kio/job.h>
#include <kio/jobuidelegate.h>
+#include <KJobWidgets/KJobWidgets>
#include <QLabel>
#include <QVBoxLayout>
-#include <KJobWidgets/KJobWidgets>
namespace {
// always bibtex
- static const char* BIBSONOMY_BASE_URL = "http://bibsonomy.org";
+ static const char* BIBSONOMY_BASE_URL = "http://bibsonomy.org/";
static const int BIBSONOMY_MAX_RESULTS = 20;
}
@@ -72,16 +72,16 @@ void BibsonomyFetcher::search() {
// myDebug() << "value = " << value_;
- KUrl u(BIBSONOMY_BASE_URL);
+ QUrl u(QString::fromLatin1(BIBSONOMY_BASE_URL));
u.setPath(QLatin1String("/bib/"));
switch(request().key) {
case Person:
- u.addPath(QString::fromLatin1("author/%1").arg(request().value));
+ u.setPath(u.path() + QString::fromLatin1("author/%1").arg(request().value));
break;
case Keyword:
- u.addPath(QString::fromLatin1("search/%1").arg(request().value));
+ u.setPath(u.path() + QString::fromLatin1("search/%1").arg(request().value));
break;
default:
diff --git a/src/fetch/bibsonomyfetcher.h b/src/fetch/bibsonomyfetcher.h
index 80ec80a..c3c7f0f 100644
--- a/src/fetch/bibsonomyfetcher.h
+++ b/src/fetch/bibsonomyfetcher.h
@@ -31,7 +31,7 @@
#include <QPointer>
-class KUrl;
+class QUrl;
class KJob;
namespace KIO {
class StoredTransferJob;
diff --git a/src/fetch/boardgamegeekfetcher.cpp b/src/fetch/boardgamegeekfetcher.cpp
index 99f7d42..6f38e04 100644
--- a/src/fetch/boardgamegeekfetcher.cpp
+++ b/src/fetch/boardgamegeekfetcher.cpp
@@ -65,8 +65,8 @@ bool BoardGameGeekFetcher::canFetch(int type) const {
return type == Data::Collection::BoardGame;
}
-KUrl BoardGameGeekFetcher::searchUrl() {
- KUrl u(BGG_SEARCH_URL);
+QUrl BoardGameGeekFetcher::searchUrl() {
+ QUrl u(QString::fromLatin1(BGG_SEARCH_URL));
switch(request().key) {
case Title:
@@ -88,7 +88,7 @@ KUrl BoardGameGeekFetcher::searchUrl() {
default:
myWarning() << "key not recognized: " << request().key;
- return KUrl();
+ return QUrl();
}
// myDebug() << "url: " << u.url();
@@ -104,7 +104,7 @@ Tellico::Data::EntryPtr \
BoardGameGeekFetcher::fetchEntryHookData(Data::EntryPtr return entry_;
}
- KUrl u(BGG_THING_URL);
+ QUrl u(QString::fromLatin1(BGG_THING_URL));
u.addQueryItem(QLatin1String("id"), id);
u.addQueryItem(QLatin1String("type"), \
QLatin1String("boardgame,boardgameexpansion")); // myDebug() << "url: " << u;
diff --git a/src/fetch/boardgamegeekfetcher.h b/src/fetch/boardgamegeekfetcher.h
index 0463c74..e544dd2 100644
--- a/src/fetch/boardgamegeekfetcher.h
+++ b/src/fetch/boardgamegeekfetcher.h
@@ -77,7 +77,7 @@ public:
private:
virtual FetchRequest updateRequest(Data::EntryPtr entry);
virtual void resetSearch() {}
- virtual KUrl searchUrl();
+ virtual QUrl searchUrl();
virtual void parseData(QByteArray&) {}
virtual Data::EntryPtr fetchEntryHookData(Data::EntryPtr entry);
};
diff --git a/src/fetch/citebasefetcher.cpp b/src/fetch/citebasefetcher.cpp
index 4803771..768768b 100644
--- a/src/fetch/citebasefetcher.cpp
+++ b/src/fetch/citebasefetcher.cpp
@@ -34,14 +34,12 @@
#include <klocale.h>
#include <kio/job.h>
#include <kio/jobuidelegate.h>
+#include <KJobWidgets/KJobWidgets>
#include <QLabel>
#include <QTextStream>
#include <QVBoxLayout>
#include <QFile>
-#include <KJobWidgets/KJobWidgets>
-
-// #define CITEBASE_TEST
namespace {
// always bibtex
@@ -75,7 +73,7 @@ void CitebaseFetcher::search() {
// myDebug() << "value = " << value_;
- KUrl u = searchURL(request().key, request().value);
+ QUrl u = searchURL(request().key, request().value);
if(u.isEmpty()) {
stop();
return;
@@ -180,8 +178,8 @@ Tellico::Data::EntryPtr CitebaseFetcher::fetchEntryHook(uint \
uid_) { return entry;
}
-KUrl CitebaseFetcher::searchURL(FetchKey key_, const QString& value_) const {
- KUrl u(CITEBASE_BASE_URL);
+QUrl CitebaseFetcher::searchURL(FetchKey key_, const QString& value_) const {
+ QUrl u(QString::fromLatin1(CITEBASE_BASE_URL));
switch(key_) {
case ArxivID:
@@ -196,12 +194,9 @@ KUrl CitebaseFetcher::searchURL(FetchKey key_, const QString& \
value_) const {
default:
myWarning() << "key not recognized: " << key_;
- return KUrl();
+ return QUrl();
}
-#ifdef CITEBASE_TEST
- u = KUrl("/home/robby/citebase.bib");
-#endif
// myDebug() << "url: " << u.url();
return u;
}
diff --git a/src/fetch/citebasefetcher.h b/src/fetch/citebasefetcher.h
index 14a2188..8ec2f06 100644
--- a/src/fetch/citebasefetcher.h
+++ b/src/fetch/citebasefetcher.h
@@ -31,7 +31,7 @@
#include <QPointer>
-class KUrl;
+class QUrl;
class KJob;
namespace KIO {
class StoredTransferJob;
@@ -80,7 +80,7 @@ private slots:
private:
virtual void search();
virtual FetchRequest updateRequest(Data::EntryPtr entry);
- KUrl searchURL(FetchKey key, const QString& value) const;
+ QUrl searchURL(FetchKey key, const QString& value) const;
QHash<int, Data::EntryPtr> m_entries;
QPointer<KIO::StoredTransferJob> m_job;
diff --git a/src/fetch/crossreffetcher.cpp b/src/fetch/crossreffetcher.cpp
index aada454..1b957cb 100644
--- a/src/fetch/crossreffetcher.cpp
+++ b/src/fetch/crossreffetcher.cpp
@@ -40,6 +40,7 @@
#include <kio/job.h>
#include <kio/jobuidelegate.h>
#include <KConfigGroup>
+#include <KJobWidgets/KJobWidgets>
#include <QLabel>
#include <QFile>
@@ -47,9 +48,6 @@
#include <QGridLayout>
#include <QPixmap>
#include <QTextCodec>
-#include <KJobWidgets/KJobWidgets>
-
-// #define CROSSREF_TEST
#define CROSSREF_USE_UNIXREF
@@ -96,7 +94,7 @@ void CrossRefFetcher::search() {
// myDebug() << "value = " << value_;
- KUrl u = searchURL(request().key, request().value);
+ QUrl u = searchURL(request().key, request().value);
if(u.isEmpty()) {
stop();
return;
@@ -220,8 +218,7 @@ void CrossRefFetcher::initXSLTHandler() {
return;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
delete m_xsltHandler;
m_xsltHandler = new XSLTHandler(u);
@@ -233,8 +230,8 @@ void CrossRefFetcher::initXSLTHandler() {
}
}
-KUrl CrossRefFetcher::searchURL(FetchKey key_, const QString& value_) const {
- KUrl u(CROSSREF_BASE_URL);
+QUrl CrossRefFetcher::searchURL(FetchKey key_, const QString& value_) const {
+ QUrl u(QString::fromLatin1(CROSSREF_BASE_URL));
u.addQueryItem(QLatin1String("noredirect"), QLatin1String("true"));
u.addQueryItem(QLatin1String("multihit"), QLatin1String("true"));
#ifdef CROSSREF_USE_UNIXREF
@@ -253,13 +250,10 @@ KUrl CrossRefFetcher::searchURL(FetchKey key_, const QString& \
value_) const {
default:
myWarning() << "key not recognized: " << key_;
- return KUrl();
+ return QUrl();
}
-#ifdef CROSSREF_TEST
- u = KUrl("/home/robby/crossref.xml");
-#endif
- myDebug() << "url: " << u.url();
+// myDebug() << "url: " << u.url();
return u;
}
diff --git a/src/fetch/crossreffetcher.h b/src/fetch/crossreffetcher.h
index e0d5fdd..508ef15 100644
--- a/src/fetch/crossreffetcher.h
+++ b/src/fetch/crossreffetcher.h
@@ -31,7 +31,7 @@
#include <QPointer>
-class KUrl;
+class QUrl;
class KLineEdit;
class KJob;
namespace KIO {
@@ -89,7 +89,7 @@ private:
virtual void search();
virtual FetchRequest updateRequest(Data::EntryPtr entry);
void initXSLTHandler();
- KUrl searchURL(FetchKey key, const QString& value) const;
+ QUrl searchURL(FetchKey key, const QString& value) const;
void readWallet() const;
XSLTHandler* m_xsltHandler;
diff --git a/src/fetch/dblpfetcher.cpp b/src/fetch/dblpfetcher.cpp
index b6dc14f..15a7d18 100644
--- a/src/fetch/dblpfetcher.cpp
+++ b/src/fetch/dblpfetcher.cpp
@@ -27,7 +27,7 @@
#include <KLocale>
#include <KConfigGroup>
-#include <KUrl>
+#include <QUrl>
#include <QLabel>
#include <QVBoxLayout>
@@ -59,8 +59,8 @@ bool DBLPFetcher::canFetch(int type) const {
void DBLPFetcher::readConfigHook(const KConfigGroup&) {
}
-KUrl DBLPFetcher::searchUrl() {
- KUrl u(DBLP_API_URL);
+QUrl DBLPFetcher::searchUrl() {
+ QUrl u(QString::fromLatin1(DBLP_API_URL));
switch(request().key) {
case Keyword:
@@ -71,7 +71,7 @@ KUrl DBLPFetcher::searchUrl() {
default:
myWarning() << "key not recognized:" << request().key;
- return KUrl();
+ return QUrl();
}
// has to be after query
u.addQueryItem(QLatin1String("format"), QLatin1String("xml"));
diff --git a/src/fetch/dblpfetcher.h b/src/fetch/dblpfetcher.h
index 9a44a5b..623c71c 100644
--- a/src/fetch/dblpfetcher.h
+++ b/src/fetch/dblpfetcher.h
@@ -77,7 +77,7 @@ public:
private:
virtual FetchRequest updateRequest(Data::EntryPtr entry);
virtual void resetSearch();
- virtual KUrl searchUrl();
+ virtual QUrl searchUrl();
virtual void parseData(QByteArray& data);
virtual Data::EntryPtr fetchEntryHookData(Data::EntryPtr entry);
};
diff --git a/src/fetch/discogsfetcher.cpp b/src/fetch/discogsfetcher.cpp
index 9c9d226..1e66fd6 100644
--- a/src/fetch/discogsfetcher.cpp
+++ b/src/fetch/discogsfetcher.cpp
@@ -100,7 +100,7 @@ void DiscogsFetcher::search() {
return;
}
- KUrl u(DISCOGS_API_URL);
+ QUrl u(QString::fromLatin1(DISCOGS_API_URL));
switch(request().key) {
case Title:
@@ -168,7 +168,7 @@ Tellico::Data::EntryPtr DiscogsFetcher::fetchEntryHook(uint uid_) \
{ QString id = entry->field(QLatin1String("discogs-id"));
if(!id.isEmpty()) {
// quiet
- KUrl u(DISCOGS_API_URL);
+ QUrl u(QString::fromLatin1(DISCOGS_API_URL));
u.setPath(QString::fromLatin1("/releases/%1").arg(id));
QByteArray data = FileHandler::readDataFile(u, true);
diff --git a/src/fetch/doubanfetcher.cpp b/src/fetch/doubanfetcher.cpp
index 134c1cd..40095f3 100644
--- a/src/fetch/doubanfetcher.cpp
+++ b/src/fetch/doubanfetcher.cpp
@@ -81,49 +81,49 @@ void DoubanFetcher::readConfigHook(const KConfigGroup& config_) {
}
}
-KUrl DoubanFetcher::searchUrl() {
- KUrl u(DOUBAN_API_URL);
+QUrl DoubanFetcher::searchUrl() {
+ QUrl u(QString::fromLatin1(DOUBAN_API_URL));
switch(request().collectionType) {
case Data::Collection::Book:
case Data::Collection::Bibtex:
- u.addPath(QString::fromLatin1("book/"));
+ u.setPath(u.path() + QLatin1String("book/"));
break;
case Data::Collection::Video:
- u.addPath(QString::fromLatin1("movie/"));
+ u.setPath(u.path() + QLatin1String("movie/"));
break;
case Data::Collection::Album:
- u.addPath(QString::fromLatin1("music/"));
+ u.setPath(u.path() + QLatin1String("music/"));
break;
default:
myWarning() << "bad collection type:" << request().collectionType;
- return KUrl();
+ return QUrl();
}
switch(request().key) {
case ISBN:
- u.addPath(QLatin1String("subject/isbn/"));
+ u.setPath(u.path() + QLatin1String("subject/isbn/"));
{
QStringList isbns = FieldFormat::splitValue(request().value);
if(isbns.isEmpty()) {
- return KUrl();
+ return QUrl();
} else {
- u.addPath(ISBNValidator::cleanValue(isbns.front()));
+ u.setPath(u.path() + ISBNValidator::cleanValue(isbns.front()));
}
}
break;
case Keyword:
- u.addPath(QLatin1String("subjects"));
+ u.setPath(u.path() + QLatin1String("subjects"));
u.addQueryItem(QLatin1String("q"), request().value);
break;
default:
myWarning() << "key not recognized:" << request().key;
- return KUrl();
+ return QUrl();
}
if(!m_apiKey.isEmpty()) {
@@ -141,7 +141,7 @@ Tellico::Data::EntryPtr \
DoubanFetcher::fetchEntryHookData(Data::EntryPtr entry_)
const QString image = entry_->field(QLatin1String("cover"));
if(image.contains(QLatin1Char('/'))) {
- const QString id = ImageFactory::addImage(KUrl(image), true /* quiet */);
+ const QString id = ImageFactory::addImage(QUrl(image), true /* quiet */);
if(!id.isEmpty()) {
entry_->setField(QLatin1String("cover"), id);
}
@@ -163,7 +163,7 @@ Tellico::Data::EntryPtr \
DoubanFetcher::fetchEntryHookData(Data::EntryPtr entry_) // myDebug() << id;
// quiet
- const QString output = FileHandler::readXMLFile(KUrl(id), true /* true */);
+ const QString output = FileHandler::readXMLFile(QUrl(id), true /* true */);
Import::TellicoImporter imp(xsltHandler()->applyStylesheet(output));
// be quiet when loading images
imp.setOptions(imp.options() ^ Import::ImportShowImageErrors);
diff --git a/src/fetch/doubanfetcher.h b/src/fetch/doubanfetcher.h
index dd7c0d3..453af4f 100644
--- a/src/fetch/doubanfetcher.h
+++ b/src/fetch/doubanfetcher.h
@@ -85,7 +85,7 @@ public:
private:
virtual FetchRequest updateRequest(Data::EntryPtr entry);
virtual void resetSearch() {}
- virtual KUrl searchUrl();
+ virtual QUrl searchUrl();
virtual void parseData(QByteArray&) {}
virtual Data::EntryPtr fetchEntryHookData(Data::EntryPtr entry);
diff --git a/src/fetch/dvdfrfetcher.cpp b/src/fetch/dvdfrfetcher.cpp
index e68d785..b505a9e 100644
--- a/src/fetch/dvdfrfetcher.cpp
+++ b/src/fetch/dvdfrfetcher.cpp
@@ -38,8 +38,6 @@
#include <QTextCodec>
#include <QDomDocument>
-//#define DVDFR_TEST
-
namespace {
static const int DVDFR_MAX_RETURNS_TOTAL = 20;
static const char* DVDFR_SEARCH_API_URL = "http://www.dvdfr.com/api/search.php";
@@ -66,12 +64,8 @@ bool DVDFrFetcher::canFetch(int type) const {
return type == Data::Collection::Video;
}
-KUrl DVDFrFetcher::searchUrl() {
-#ifdef DVDFR_TEST
- return KUrl("/home/robby/kde/src/tellico/src/fetch/dvdfr_search2.xml");
-#endif
-
- KUrl u(DVDFR_SEARCH_API_URL);
+QUrl DVDFrFetcher::searchUrl() {
+ QUrl u(QString::fromLatin1(DVDFR_SEARCH_API_URL));
switch(request().key) {
case Title:
@@ -89,7 +83,7 @@ KUrl DVDFrFetcher::searchUrl() {
default:
myWarning() << "key not recognized: " << request().key;
- return KUrl();
+ return QUrl();
}
// myDebug() << "url: " << u.url();
@@ -105,14 +99,10 @@ Tellico::Data::EntryPtr \
DVDFrFetcher::fetchEntryHookData(Data::EntryPtr entry_) return entry_;
}
- KUrl u(DVDFR_DETAIL_API_URL);
+ QUrl u(QString::fromLatin1(DVDFR_DETAIL_API_URL));
u.addQueryItem(QLatin1String("id"), id);
// myDebug() << "url: " << u;
-#ifdef DVDFR_TEST
- u = KUrl("/home/robby/kde/src/tellico/src/fetch/dvdfr_detail2.xml");
-#endif
-
// quiet
QString output = FileHandler::readXMLFile(u, true);
diff --git a/src/fetch/dvdfrfetcher.h b/src/fetch/dvdfrfetcher.h
index 163c69c..7837f18 100644
--- a/src/fetch/dvdfrfetcher.h
+++ b/src/fetch/dvdfrfetcher.h
@@ -77,7 +77,7 @@ public:
private:
virtual FetchRequest updateRequest(Data::EntryPtr entry);
virtual void resetSearch() {}
- virtual KUrl searchUrl();
+ virtual QUrl searchUrl();
virtual void parseData(QByteArray&) {}
virtual Data::EntryPtr fetchEntryHookData(Data::EntryPtr entry);
};
diff --git a/src/fetch/entrezfetcher.cpp b/src/fetch/entrezfetcher.cpp
index df2d526..3e8f3ee 100644
--- a/src/fetch/entrezfetcher.cpp
+++ b/src/fetch/entrezfetcher.cpp
@@ -37,15 +37,13 @@
#include <kio/job.h>
#include <kio/jobuidelegate.h>
#include <KConfigGroup>
+#include <KJobWidgets/KJobWidgets>
#include <QDomDocument>
#include <QLabel>
#include <QFile>
#include <QTextStream>
#include <QVBoxLayout>
-#include <KJobWidgets/KJobWidgets>
-
-//#define ENTREZ_TEST
namespace {
static const int ENTREZ_MAX_RETURNS_TOTAL = 25;
@@ -96,11 +94,8 @@ void EntrezFetcher::search() {
m_dbname = QLatin1String(ENTREZ_DEFAULT_DATABASE);
}
-#ifdef ENTREZ_TEST
- KUrl u = KUrl("/home/robby/esearch.xml");
-#else
- KUrl u(ENTREZ_BASE_URL);
- u.addPath(QLatin1String(ENTREZ_SEARCH_CGI));
+ QUrl u(QString::fromLatin1(ENTREZ_BASE_URL));
+ u.setPath(u.path() + QLatin1String(ENTREZ_SEARCH_CGI));
u.addQueryItem(QLatin1String("tool"), QLatin1String("Tellico"));
u.addQueryItem(QLatin1String("retmode"), QLatin1String("xml"));
u.addQueryItem(QLatin1String("usehistory"), QLatin1String("y"));
@@ -135,7 +130,6 @@ void EntrezFetcher::search() {
stop();
return;
}
-#endif
m_step = Search;
// myLog() << "url: " << u.url();
@@ -241,11 +235,8 @@ void EntrezFetcher::searchResults(const QByteArray& data_) {
}
void EntrezFetcher::doSummary() {
-#ifdef ENTREZ_TEST
- KUrl u = KUrl(QLatin1String("/home/robby/esummary.xml"));
-#else
- KUrl u(ENTREZ_BASE_URL);
- u.addPath(QLatin1String(ENTREZ_SUMMARY_CGI));
+ QUrl u(QString::fromLatin1(ENTREZ_BASE_URL));
+ u.setPath(u.path() + QLatin1String(ENTREZ_SUMMARY_CGI));
u.addQueryItem(QLatin1String("tool"), QLatin1String("Tellico"));
u.addQueryItem(QLatin1String("retmode"), QLatin1String("xml"));
if(m_start > 1) {
@@ -256,7 +247,6 @@ void EntrezFetcher::doSummary() {
u.addQueryItem(QLatin1String("db"), m_dbname);
u.addQueryItem(QLatin1String("query_key"), m_queryKey);
u.addQueryItem(QLatin1String("WebEnv"), m_webEnv);
-#endif
m_step = Summary;
// myLog() << "url:" << u.url();
@@ -336,17 +326,15 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntryHook(uint \
uid_) { }
int id = m_matches[uid_];
-#ifdef ENTREZ_TEST
- KUrl u = KUrl(QLatin1String("/home/robby/pubmed.xml"));
-#else
- KUrl u(ENTREZ_BASE_URL);
- u.addPath(QLatin1String(ENTREZ_FETCH_CGI));
+
+ QUrl u(QString::fromLatin1(ENTREZ_BASE_URL));
+ u.setPath(u.path() + QLatin1String(ENTREZ_FETCH_CGI));
u.addQueryItem(QLatin1String("tool"), QLatin1String("Tellico"));
u.addQueryItem(QLatin1String("retmode"), QLatin1String("xml"));
u.addQueryItem(QLatin1String("rettype"), QLatin1String("abstract"));
u.addQueryItem(QLatin1String("db"), m_dbname);
u.addQueryItem(QLatin1String("id"), QString::number(id));
-#endif
+
// now it's sychronous
QString xmlOutput = FileHandler::readXMLFile(u, true /*quiet*/);
if(xmlOutput.isEmpty()) {
@@ -381,8 +369,8 @@ Tellico::Data::EntryPtr EntrezFetcher::fetchEntryHook(uint uid_) \
{
// try to get a link, but only if necessary
if(optionalFields().contains(QLatin1String("url"))) {
- KUrl link(ENTREZ_BASE_URL);
- link.addPath(QLatin1String(ENTREZ_LINK_CGI));
+ QUrl link(QString::fromLatin1(ENTREZ_BASE_URL));
+ link.setPath(link.path() + QLatin1String(ENTREZ_LINK_CGI));
link.addQueryItem(QLatin1String("tool"), QLatin1String("Tellico"));
link.addQueryItem(QLatin1String("cmd"), QLatin1String("llinks"));
link.addQueryItem(QLatin1String("db"), m_dbname);
@@ -422,8 +410,7 @@ void EntrezFetcher::initXSLTHandler() {
return;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
if(!m_xsltHandler) {
m_xsltHandler = new XSLTHandler(u);
diff --git a/src/fetch/execexternalfetcher.cpp b/src/fetch/execexternalfetcher.cpp
index a97745d..038987b 100644
--- a/src/fetch/execexternalfetcher.cpp
+++ b/src/fetch/execexternalfetcher.cpp
@@ -251,8 +251,7 @@ void ExecExternalFetcher::slotProcessExited() {
{
QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("mods2tellico.xsl")); \
if(!xsltFile.isEmpty()) {
- KUrl u;
- u.setPath(xsltFile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
static_cast<Import::XSLTImporter*>(imp)->setXSLTURL(u);
} else {
myWarning() << "unable to find mods2tellico.xml!";
@@ -454,7 +453,7 @@ ExecExternalFetcher::ConfigWidget::~ConfigWidget() {
}
void ExecExternalFetcher::ConfigWidget::readConfig(const KConfigGroup& config_) {
- m_pathEdit->setUrl(KUrl(config_.readPathEntry("ExecPath", QString())));
+ m_pathEdit->setUrl(QUrl::fromLocalFile(config_.readPathEntry("ExecPath", \
QString()))); QList<int> argKeys = config_.readEntry("ArgumentKeys", QList<int>());
QStringList argValues = config_.readEntry("Arguments", QStringList());
if(argKeys.count() != argValues.count()) {
@@ -506,7 +505,7 @@ void ExecExternalFetcher::ConfigWidget::readConfig(const \
KConfigGroup& config_) }
void ExecExternalFetcher::ConfigWidget::saveConfigHook(KConfigGroup& config_) {
- KUrl u = m_pathEdit->url();
+ QUrl u = m_pathEdit->url();
if(!u.isEmpty()) {
config_.writePathEntry("ExecPath", u.path());
}
diff --git a/src/fetch/fetcher.cpp b/src/fetch/fetcher.cpp
index a2ba5bb..8105313 100644
--- a/src/fetch/fetcher.cpp
+++ b/src/fetch/fetcher.cpp
@@ -33,8 +33,8 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include <kmimetype.h>
-#include <KUrl>
+#include <QUrl>
#include <QDBusInterface>
#include <QDBusReply>
#include <QUuid>
@@ -157,10 +157,10 @@ void Fetcher::infoList(const QString& message_, const \
QStringList& list_) const }
QString Fetcher::favIcon(const char* url_) {
- return favIcon(KUrl(url_));
+ return favIcon(QUrl(QString::fromLatin1(url_)));
}
-QString Fetcher::favIcon(const KUrl& url_) {
+QString Fetcher::favIcon(const QUrl& url_) {
QDBusInterface kded(QLatin1String("org.kde.kded"),
QLatin1String("/modules/favicons"),
QLatin1String("org.kde.FavIcon"));
diff --git a/src/fetch/fetcher.h b/src/fetch/fetcher.h
index d085c25..7415fa1 100644
--- a/src/fetch/fetcher.h
+++ b/src/fetch/fetcher.h
@@ -36,7 +36,7 @@
#include <QStringList>
class KConfigGroup;
-class KUrl;
+class QUrl;
namespace Tellico {
namespace Fetch {
@@ -134,7 +134,7 @@ public:
virtual ConfigWidget* configWidget(QWidget* parent) const = 0;
static QString favIcon(const char* url);
- static QString favIcon(const KUrl& url);
+ static QString favIcon(const QUrl& url);
signals:
// void signalStatus(const QString& status);
diff --git a/src/fetch/fetchmanager.cpp b/src/fetch/fetchmanager.cpp
index ce108fd..1e579bf 100644
--- a/src/fetch/fetchmanager.cpp
+++ b/src/fetch/fetchmanager.cpp
@@ -425,7 +425,7 @@ Tellico::Fetch::ConfigWidget* Manager::configWidget(QWidget* \
parent_, Tellico::F KTemporaryFile tmpFile;
tmpFile.setAutoRemove(true);
tmpFile.open();
- KUrl from, to;
+ QUrl from, to;
from.setPath(m_scriptMap[name_]);
to.setPath(tmpFile.fileName());
// have to overwrite since KTemporaryFile already created it
@@ -460,8 +460,8 @@ QPixmap Manager::fetcherIcon(Tellico::Fetch::Fetcher::Ptr \
fetcher_, int group_, #ifdef HAVE_YAZ
if(fetcher_->type() == Fetch::Z3950) {
const Fetch::Z3950Fetcher* f = static_cast<const \
Fetch::Z3950Fetcher*>(fetcher_.data());
- KUrl u;
- u.setProtocol(QLatin1String("http"));
+ QUrl u;
+ u.setScheme(QLatin1String("http"));
u.setHost(f->host());
QString icon = Fetcher::favIcon(u);
if(u.isValid() && !icon.isEmpty()) {
@@ -472,7 +472,7 @@ QPixmap Manager::fetcherIcon(Tellico::Fetch::Fetcher::Ptr \
fetcher_, int group_, if(fetcher_->type() == Fetch::ExecExternal) {
const Fetch::ExecExternalFetcher* f = static_cast<const \
Fetch::ExecExternalFetcher*>(fetcher_.data()); const QString p = f->execPath();
- KUrl u;
+ QUrl u;
if(p.contains(QLatin1String("allocine"))) {
u = QLatin1String("http://www.allocine.fr");
} else if(p.contains(QLatin1String("ministerio_de_cultura"))) {
diff --git a/src/fetch/fetchmanager.h b/src/fetch/fetchmanager.h
index 8cec1ae..0cb2f22 100644
--- a/src/fetch/fetchmanager.h
+++ b/src/fetch/fetchmanager.h
@@ -34,7 +34,7 @@
#include <QList>
#include <QPixmap>
-class KUrl;
+class QUrl;
namespace Tellico {
namespace Fetch {
diff --git a/src/fetch/filmasterfetcher.cpp b/src/fetch/filmasterfetcher.cpp
index ccabda9..c78149a 100644
--- a/src/fetch/filmasterfetcher.cpp
+++ b/src/fetch/filmasterfetcher.cpp
@@ -35,6 +35,7 @@
#include <klocale.h>
#include <kio/job.h>
#include <kio/jobuidelegate.h>
+#include <KJobWidgets/KJobWidgets>
#include <QLabel>
#include <QFile>
@@ -44,7 +45,6 @@
#ifdef HAVE_QJSON
#include <qjson/parser.h>
-#include <KJobWidgets/KJobWidgets>
#endif
namespace {
@@ -90,15 +90,15 @@ void FilmasterFetcher::search() {
m_started = true;
#ifdef HAVE_QJSON
- KUrl u(FILMASTER_QUERY_URL);
+ QUrl u(QString::fromLatin1(FILMASTER_QUERY_URL));
switch(request().key) {
case Title:
- u.addPath(QLatin1String("film/"));
+ u.setPath(u.path() + QLatin1String("film/"));
break;
case Person:
- u.addPath(QLatin1String("person/"));
+ u.setPath(u.path() + QLatin1String("person/"));
break;
default:
@@ -137,8 +137,8 @@ Tellico::Data::EntryPtr FilmasterFetcher::fetchEntryHook(uint \
uid_) {
const QString image = entry->field(QLatin1String("cover"));
if(image.contains(QLatin1Char('/'))) {
- KUrl imageUrl(FILMASTER_API_URL);
- imageUrl.addPath(image);
+ QUrl imageUrl(QString::fromLatin1(FILMASTER_API_URL));
+ imageUrl.setPath(imageUrl.path() + image);
const QString id = ImageFactory::addImage(imageUrl, true);
if(!id.isEmpty()) {
entry->setField(QLatin1String("cover"), id);
@@ -208,7 +208,7 @@ void FilmasterFetcher::slotComplete(KJob* job_) {
uris << value(personMap, "films_directed_uri");
}
foreach(const QString& uri, uris) {
- KUrl u(FILMASTER_API_URL);
+ QUrl u(QString::fromLatin1(FILMASTER_API_URL));
u.setPath(uri);
// myDebug() << u;
QString output = FileHandler::readTextFile(u, false /*quiet*/, true \
/*utf8*/); @@ -276,7 +276,7 @@ void FilmasterFetcher::populateEntry(Data::EntryPtr \
entry_, const QVariantMap& r const QString castUri = value(result_, \
"characters_uri"); if(!castUri.isEmpty()) {
QJson::Parser parser;
- KUrl u(FILMASTER_API_URL);
+ QUrl u(QString::fromLatin1(FILMASTER_API_URL));
u.setPath(castUri);
QString output = FileHandler::readTextFile(u, false /*quiet*/, true /*utf8*/);
const QVariantList castList = \
parser.parse(output.toUtf8()).toMap().value(QLatin1String("objects")).toList();
diff --git a/src/fetch/freebasefetcher.cpp b/src/fetch/freebasefetcher.cpp
index f13330d..60e59d6 100644
--- a/src/fetch/freebasefetcher.cpp
+++ b/src/fetch/freebasefetcher.cpp
@@ -39,6 +39,7 @@
#include <kio/jobuidelegate.h>
#include <KLineEdit>
#include <KConfigGroup>
+#include <KJobWidgets/KJobWidgets>
#include <QLabel>
#include <QFile>
@@ -49,14 +50,13 @@
#ifdef HAVE_QJSON
#include <qjson/serializer.h>
#include <qjson/parser.h>
-#include <KJobWidgets/KJobWidgets>
#endif
namespace {
- static const char* FREEBASE_QUERY_URL = \
"https://www.googleapis.com/freebase/v1/mqlread";
- static const char* FREEBASE_IMAGE_URL = \
"https://usercontent.googleapis.com/freebase/v1/image";
- static const char* FREEBASE_BLURB_URL = \
"https://www.googleapis.com/freebase/v1/topic";
- static const char* FREEBASE_VIEW_URL = "http://www.freebase.com/view";
+ static const char* FREEBASE_QUERY_URL = \
"https://www.googleapis.com/freebase/v1/mqlread/"; + static const char* \
FREEBASE_IMAGE_URL = "https://usercontent.googleapis.com/freebase/v1/image/"; + \
static const char* FREEBASE_BLURB_URL = \
"https://www.googleapis.com/freebase/v1/topic/"; + static const char* \
FREEBASE_VIEW_URL = "http://www.freebase.com/view/"; static const char* \
FREEBASE_API_KEY = "AIzaSyBdsa_DEGpDQ6PzZyYHHHokRIBY8thOdUQ"; static const int \
FREEBASE_RETURNS_PER_REQUEST = 25; }
@@ -179,7 +179,7 @@ void FreebaseFetcher::doSearch() {
const QByteArray query_string = serializer.serialize(QVariantList() << query);
// myDebug() << "query:" << query_string;
- KUrl url(FREEBASE_QUERY_URL);
+ QUrl url(QString::fromLatin1(FREEBASE_QUERY_URL));
url.addQueryItem(QLatin1String("key"), QLatin1String(FREEBASE_API_KEY));
if(cursor.type() == QVariant::String) {
url.addQueryItem(QLatin1String("cursor"), cursor.toString());
@@ -237,8 +237,8 @@ Tellico::Data::EntryPtr FreebaseFetcher::fetchEntryHook(uint \
uid_) { // if it's still a freebase id, then it starts with a slash
if(image_id.startsWith(QLatin1Char('/'))) {
// let's set max image size to 200x200
- KUrl imageUrl(FREEBASE_IMAGE_URL);
- imageUrl.addPath(image_id);
+ QUrl imageUrl(QString::fromLatin1(FREEBASE_IMAGE_URL));
+ imageUrl.setPath(imageUrl.path() + image_id);
imageUrl.addQueryItem(QLatin1String("maxwidth"), QLatin1String("200"));
imageUrl.addQueryItem(QLatin1String("maxheight"), QLatin1String("200"));
// myDebug() << "image url:" << imageUrl;
@@ -269,8 +269,8 @@ Tellico::Data::EntryPtr FreebaseFetcher::fetchEntryHook(uint \
uid_) { const QString article_id = entry->field(article_field);
// if it's still a freebase id, then it starts with a slash
if(article_id.startsWith(QLatin1Char('/'))) {
- KUrl articleUrl(FREEBASE_BLURB_URL);
- articleUrl.addPath(article_id);
+ QUrl articleUrl(QString::fromLatin1(FREEBASE_BLURB_URL));
+ articleUrl.setPath(articleUrl.path() + article_id);
articleUrl.addQueryItem(QLatin1String("limit"), QLatin1String("1"));
articleUrl.addQueryItem(QLatin1String("filter"), \
QLatin1String("/common/document/text"));
articleUrl.addQueryItem(QLatin1String("key"), \
QLatin1String(FREEBASE_API_KEY));
diff --git a/src/fetch/gcstarpluginfetcher.cpp b/src/fetch/gcstarpluginfetcher.cpp
index dfae7fd..bbff61d 100644
--- a/src/fetch/gcstarpluginfetcher.cpp
+++ b/src/fetch/gcstarpluginfetcher.cpp
@@ -165,8 +165,7 @@ void GCstarPluginFetcher::readPluginsOld(int collType_, const \
QString& gcstar_) }
foreach(const QString& file, dir.entryList()) {
- KUrl u;
- u.setPath(dir.filePath(file));
+ QUrl u = QUrl::fromLocalFile(dir.filePath(file));
PluginInfo info;
QString text = FileHandler::readTextFile(u);
for(int pos = rx.indexIn(text); pos > -1; pos = rx.indexIn(text, \
pos+rx.matchedLength())) { @@ -335,8 +334,9 @@ void \
GCstarPluginFetcher::slotProcessExited() { }
}
- KUrl gcsUrl(tempDir.name());
- gcsUrl.addPath(QLatin1String("collection.gcs"));
+ QUrl gcsUrl = QUrl::fromLocalFile(tempDir.name());
+ gcsUrl = gcsUrl.adjusted(QUrl::StripTrailingSlash);
+ gcsUrl.setPath(gcsUrl.path() + QLatin1Char('/') + \
(QLatin1String("collection.gcs")));
Import::GCstarImporter imp(gcsUrl);
imp.setHasRelativeImageLinks(true);
diff --git a/src/fetch/giantbombfetcher.cpp b/src/fetch/giantbombfetcher.cpp
index da15867..8e500ca 100644
--- a/src/fetch/giantbombfetcher.cpp
+++ b/src/fetch/giantbombfetcher.cpp
@@ -77,8 +77,8 @@ void GiantBombFetcher::resetSearch() {
m_total = -1;
}
-KUrl GiantBombFetcher::searchUrl() {
- KUrl u(GIANTBOMB_API_URL);
+QUrl GiantBombFetcher::searchUrl() {
+ QUrl u(QString::fromLatin1(GIANTBOMB_API_URL));
u.addQueryItem(QLatin1String("format"), QLatin1String("xml"));
u.addQueryItem(QLatin1String("api_key"), m_apiKey);
@@ -91,7 +91,7 @@ KUrl GiantBombFetcher::searchUrl() {
default:
myWarning() << "key not recognized: " << request().key;
- return KUrl();
+ return QUrl();
}
// myDebug() << "url: " << u.url();
@@ -131,7 +131,7 @@ Tellico::Data::EntryPtr \
GiantBombFetcher::fetchEntryHookData(Data::EntryPtr entr return entry_;
}
- KUrl u(GIANTBOMB_API_URL);
+ QUrl u(QString::fromLatin1(GIANTBOMB_API_URL));
u.setPath(QString::fromLatin1("/game/%1/").arg(id));
u.addQueryItem(QLatin1String("format"), QLatin1String("xml"));
u.addQueryItem(QLatin1String("api_key"), m_apiKey);
diff --git a/src/fetch/giantbombfetcher.h b/src/fetch/giantbombfetcher.h
index c155025..fc8afa6 100644
--- a/src/fetch/giantbombfetcher.h
+++ b/src/fetch/giantbombfetcher.h
@@ -81,7 +81,7 @@ public:
private:
virtual FetchRequest updateRequest(Data::EntryPtr entry);
virtual void resetSearch();
- virtual KUrl searchUrl();
+ virtual QUrl searchUrl();
virtual void parseData(QByteArray& data);
virtual Data::EntryPtr fetchEntryHookData(Data::EntryPtr entry);
diff --git a/src/fetch/googlebookfetcher.cpp b/src/fetch/googlebookfetcher.cpp
index d3dbdf3..e2b5957 100644
--- a/src/fetch/googlebookfetcher.cpp
+++ b/src/fetch/googlebookfetcher.cpp
@@ -115,7 +115,7 @@ void GoogleBookFetcher::continueSearch() {
void GoogleBookFetcher::doSearch(const QString& term_) {
#ifdef HAVE_QJSON
- KUrl u(GOOGLEBOOK_API_URL);
+ QUrl u(QString::fromLatin1(GOOGLEBOOK_API_URL));
u.addQueryItem(QLatin1String("maxResults"), \
QString::number(GOOGLEBOOK_MAX_RETURNS)); \
u.addQueryItem(QLatin1String("startIndex"), \
QString::number(m_start));
diff --git a/src/fetch/googlescholarfetcher.cpp b/src/fetch/googlescholarfetcher.cpp
index 5826c57..a1f4b0b 100644
--- a/src/fetch/googlescholarfetcher.cpp
+++ b/src/fetch/googlescholarfetcher.cpp
@@ -34,12 +34,12 @@
#include <KConfigGroup>
#include <kio/job.h>
#include <kio/jobuidelegate.h>
+#include <KJobWidgets/KJobWidgets>
#include <QLabel>
#include <QVBoxLayout>
#include <QFile>
#include <QTextCodec>
-#include <KJobWidgets/KJobWidgets>
namespace {
static const int GOOGLE_MAX_RETURNS_TOTAL = 20;
@@ -91,7 +91,7 @@ void GoogleScholarFetcher::continueSearch() {
void GoogleScholarFetcher::doSearch() {
// myDebug() << "value = " << value_;
- KUrl u(SCHOLAR_BASE_URL);
+ QUrl u(QString::fromLatin1(SCHOLAR_BASE_URL));
u.addQueryItem(QLatin1String("start"), QString::number(m_start));
switch(request().key) {
@@ -169,7 +169,7 @@ void GoogleScholarFetcher::slotComplete(KJob*) {
for(int pos = m_bibtexRx.indexIn(text); count < m_limit && pos > -1; pos = \
m_bibtexRx.indexIn(text, pos+m_bibtexRx.matchedLength()), ++count) {
// for some reason, KIO and google don't return bibtex when '&' is escaped
QString url = m_bibtexRx.cap(1).replace(QLatin1String("&"), \
QLatin1String("&"));
- KUrl bibtexUrl(KUrl(SCHOLAR_BASE_URL), url);
+ QUrl bibtexUrl = QUrl(QString::fromLatin1(SCHOLAR_BASE_URL)).resolved(url);
// myDebug() << bibtexUrl;
bibtex += FileHandler::readTextFile(bibtexUrl, true);
}
@@ -234,7 +234,7 @@ QString GoogleScholarFetcher::defaultIcon() {
void GoogleScholarFetcher::setBibtexCookie() {
// have to set preferences to have bibtex output
- const QString text = FileHandler::readTextFile(KUrl(SCHOLAR_SET_BIBTEX_URL), \
true); + const QString text = \
FileHandler::readTextFile(QUrl(QString::fromLatin1(SCHOLAR_SET_BIBTEX_URL)), true); \
// find hidden input variables QRegExp \
inputRx(QLatin1String("<input\\s+[^>]*\\s*type\\s*=\\s*\"hidden\"\\s+[^>]+>")); \
inputRx.setMinimal(true); @@ -258,7 +258,7 @@ void \
GoogleScholarFetcher::setBibtexCookie() { for(QHash<QString, \
QString>::const_iterator i = nameValues.constBegin(); i != nameValues.constEnd(); \
++i) { newUrl += QLatin1Char('&') + i.key() + QLatin1Char('=') + i.value();
}
- FileHandler::readTextFile(KUrl(newUrl), true);
+ FileHandler::readTextFile(QUrl(newUrl), true);
m_cookieIsSet = true;
}
diff --git a/src/fetch/hathitrustfetcher.cpp b/src/fetch/hathitrustfetcher.cpp
index 5c4a829..82e9a1a 100644
--- a/src/fetch/hathitrustfetcher.cpp
+++ b/src/fetch/hathitrustfetcher.cpp
@@ -95,7 +95,7 @@ void HathiTrustFetcher::search() {
}
void HathiTrustFetcher::doSearch() {
- KUrl u(HATHITRUST_QUERY_URL);
+ QUrl u(QString::fromLatin1(HATHITRUST_QUERY_URL));
QStringList searchValues;
// we split ISBN and LCCN values, which are the only ones we accept anyway
@@ -107,9 +107,9 @@ void HathiTrustFetcher::doSearch() {
searchValues += \
QString::fromLatin1("lccn:%1").arg(LCCNValidator::formalize(searchTerm)); }
}
- u.addPath(searchValues.join(QLatin1String("|")));
+ u.setPath(u.path() + searchValues.join(QLatin1String("|")));
- myDebug() << "url:" << u.url();
+// myDebug() << "url:" << u;
m_job = KIO::storedGet(u, KIO::NoReload, KIO::HideProgressInfo);
KJobWidgets::setWindow(m_job, GUI::Proxy::widget());
@@ -138,8 +138,7 @@ bool HathiTrustFetcher::initMARC21Handler() {
return false;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
m_MARC21XMLHandler = new XSLTHandler(u);
if(!m_MARC21XMLHandler->isValid()) {
@@ -162,8 +161,7 @@ bool HathiTrustFetcher::initMODSHandler() {
return false;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
m_MODSHandler = new XSLTHandler(u);
if(!m_MODSHandler->isValid()) {
diff --git a/src/fetch/ibsfetcher.cpp b/src/fetch/ibsfetcher.cpp
index 9f97de8..d7efcf2 100644
--- a/src/fetch/ibsfetcher.cpp
+++ b/src/fetch/ibsfetcher.cpp
@@ -36,15 +36,13 @@
#include <kconfig.h>
#include <kio/job.h>
#include <kio/jobuidelegate.h>
+#include <KJobWidgets/KJobWidgets>
#include <QRegExp>
#include <QLabel>
#include <QFile>
#include <QTextStream>
#include <QVBoxLayout>
-#include <KJobWidgets/KJobWidgets>
-
-//#define IBS_TEST
namespace {
static const char* IBS_BASE_URL = "http://www.internetbookshop.it/ser/serpge.asp";
@@ -81,10 +79,7 @@ void IBSFetcher::search() {
m_started = true;
m_matches.clear();
-#ifdef IBS_TEST
- KUrl u = KUrl(QLatin1String("/home/robby/ibs.html"));
-#else
- KUrl u(IBS_BASE_URL);
+ QUrl u(QString::fromLatin1(IBS_BASE_URL));
switch(request().key) {
case Title:
@@ -99,11 +94,13 @@ void IBSFetcher::search() {
case ISBN:
{
+ u = u.adjusted(QUrl::RemoveFilename);
+ u.setPath(u.path() + QLatin1String("serdsp.asp"));
+
QString s = request().value;
s.remove(QLatin1Char('-'));
// limit to first isbn
s = s.section(QLatin1Char(';'), 0, 0);
- u.setFileName(QLatin1String("serdsp.asp"));
u.addQueryItem(QLatin1String("isbn"), s);
}
break;
@@ -118,7 +115,6 @@ void IBSFetcher::search() {
stop();
return;
}
-#endif
// myDebug() << "url: " << u.url();
m_job = KIO::storedGet(u, KIO::NoReload, KIO::HideProgressInfo);
@@ -175,12 +171,8 @@ void IBSFetcher::slotComplete(KJob*) {
int pos2;
for(int pos = anchorRx.indexIn(s); m_started && pos > -1; pos = \
anchorRx.indexIn(s, pos+anchorRx.matchedLength())) { if(!u.isEmpty()) {
-#ifdef IBS_TEST
- KUrl url = KUrl(QLatin1String("/home/robby/ibs2.html"));
-#else
// the url probable contains & so be careful
- KUrl url = u.replace(QLatin1String("&"), QLatin1String("&"));
-#endif
+ QUrl url = u.replace(QLatin1String("&"), QLatin1String("&"));
FetchResult* r = new FetchResult(Fetcher::Ptr(this), t, d);
m_matches.insert(r->uid, url);
emit signalResultFound(r);
@@ -199,13 +191,12 @@ void IBSFetcher::slotComplete(KJob*) {
}
}
}
-#ifndef IBS_TEST
+
if(!u.isEmpty()) {
FetchResult* r = new FetchResult(Fetcher::Ptr(this), t, d);
m_matches.insert(r->uid, u.replace(QLatin1String("&"), QLatin1String("&")));
emit signalResultFound(r);
}
-#endif
stop();
}
@@ -251,7 +242,7 @@ Tellico::Data::EntryPtr IBSFetcher::fetchEntryHook(uint uid_) {
return entry;
}
- KUrl url = m_matches[uid_];
+ QUrl url = m_matches[uid_];
if(url.isEmpty()) {
myWarning() << "no url in map";
return Data::EntryPtr();
@@ -356,9 +347,9 @@ Tellico::Data::EntryPtr IBSFetcher::parseEntry(const QString& \
str_) { if(!isbn.isEmpty()) {
entry->setField(QLatin1String("isbn"), isbn);
#if 1
- KUrl imgURL = QString::fromLatin1("http://giotto.ibs.it/cop/copt13.asp?f=%1").arg(isbn);
+ QUrl imgURL = QString::fromLatin1("http://giotto.ibs.it/cop/copt13.asp?f=%1").arg(isbn);
// myLog() << "cover = " << imgURL;
- QString id = ImageFactory::addImage(imgURL, true, \
KUrl("http://internetbookshop.it")); + QString id = ImageFactory::addImage(imgURL, \
true, QUrl(QString::fromLatin1("http://internetbookshop.it"))); if(!id.isEmpty()) {
entry->setField(QLatin1String("cover"), id);
}
@@ -368,7 +359,7 @@ Tellico::Data::EntryPtr IBSFetcher::parseEntry(const QString& \
str_) { pos = imgRx.indexIn(str_);
if(pos > -1) {
// myLog() << "cover = " << imgRx.cap(1);
- QString id = ImageFactory::addImage(imgRx.cap(1), true, \
KUrl("http://internetbookshop.it")); + QString id = \
ImageFactory::addImage(imgRx.cap(1), true, QUrl("http://internetbookshop.it")); \
if(!id.isEmpty()) { entry->setField(QLatin1String("cover"), id);
}
diff --git a/src/fetch/ibsfetcher.h b/src/fetch/ibsfetcher.h
index b523da1..8a8b71a 100644
--- a/src/fetch/ibsfetcher.h
+++ b/src/fetch/ibsfetcher.h
@@ -30,7 +30,7 @@
#include <QPointer>
-class KUrl;
+class QUrl;
class KJob;
namespace KIO {
class StoredTransferJob;
@@ -85,7 +85,7 @@ private:
int m_total;
QHash<int, Data::EntryPtr> m_entries;
- QHash<int, KUrl> m_matches;
+ QHash<int, QUrl> m_matches;
QPointer<KIO::StoredTransferJob> m_job;
bool m_started;
diff --git a/src/fetch/imdbfetcher.cpp b/src/fetch/imdbfetcher.cpp
index 8d5501b..44fa73d 100644
--- a/src/fetch/imdbfetcher.cpp
+++ b/src/fetch/imdbfetcher.cpp
@@ -45,6 +45,7 @@
#include <kio/job.h>
#include <kio/jobuidelegate.h>
#include <kacceleratormanager.h>
+#include <KJobWidgets/KJobWidgets>
#include <QRegExp>
#include <QFile>
@@ -53,9 +54,6 @@
#include <QCheckBox>
#include <QGroupBox>
#include <QGridLayout>
-#include <KJobWidgets/KJobWidgets>
-
-//#define IMDB_TEST
namespace {
static const uint IMDB_MAX_RESULTS = 20;
@@ -322,17 +320,8 @@ void IMDBFetcher::search() {
m_currentTitleBlock = Unknown;
m_countOffset = 0;
-#ifdef IMDB_TEST
- if(request().key == Title) {
- m_url = KUrl(QLatin1String("/home/robby/imdb-title.html"));
- m_redirected = false;
- } else {
- m_url = KUrl(QLatin1String("/home/robby/imdb-name.html"));
- m_redirected = true;
- }
-#else
- m_url = KUrl();
- m_url.setProtocol(QLatin1String("http"));
+ m_url = QUrl();
+ m_url.setScheme(QLatin1String("http"));
m_url.setHost(m_host);
m_url.setPath(QLatin1String("/find"));
@@ -359,14 +348,13 @@ void IMDBFetcher::search() {
}
// myDebug() << m_url;
-#endif
m_job = KIO::storedGet(m_url, KIO::NoReload, KIO::HideProgressInfo);
KJobWidgets::setWindow(m_job, GUI::Proxy::widget());
connect(m_job, SIGNAL(result(KJob*)),
SLOT(slotComplete(KJob*)));
- connect(m_job, SIGNAL(redirection(KIO::Job*, const KUrl&)),
- SLOT(slotRedirection(KIO::Job*, const KUrl&)));
+ connect(m_job, SIGNAL(redirection(KIO::Job*, const QUrl&)),
+ SLOT(slotRedirection(KIO::Job*, const QUrl&)));
}
void IMDBFetcher::continueSearch() {
@@ -418,7 +406,7 @@ void IMDBFetcher::stop() {
emit signalDone(this);
}
-void IMDBFetcher::slotRedirection(KIO::Job*, const KUrl& toURL_) {
+void IMDBFetcher::slotRedirection(KIO::Job*, const QUrl& toURL_) {
m_url = toURL_;
if(m_url.path().contains(QRegExp(QLatin1String("/tt\\d+/$")))) {
m_url.setPath(m_url.path() + QLatin1String("combined"));
@@ -493,7 +481,7 @@ void IMDBFetcher::parseSingleTitleResult() {
pPos == -1 ? QString() : cap1.mid(pPos));
// IMDB returns different HTML for single title results and has a query in the url
// clear the query so we download the "canonical" page for the title
- KUrl url(m_url);
+ QUrl url(m_url);
url.setEncodedQuery(QByteArray());
m_matches.insert(r->uid, url);
m_allMatches.insert(r->uid, url);
@@ -638,7 +626,7 @@ void IMDBFetcher::parseTitleBlock(const QString& str_) {
}
FetchResult* r = new FetchResult(Fetcher::Ptr(this), pPos == -1 ? cap2 : \
cap2.left(pPos), desc);
- KUrl u(m_url, cap1);
+ QUrl u = QUrl(m_url).resolved(cap1);
u.setQuery(QString());
m_matches.insert(r->uid, u);
m_allMatches.insert(r->uid, u);
@@ -718,7 +706,7 @@ void IMDBFetcher::parseSingleNameResult() {
// FIXME: maybe remove parentheses here?
FetchResult* r = new FetchResult(Fetcher::Ptr(this), pPos == -1 ? cap2 : \
cap2.left(pPos), desc, QString());
- KUrl u(m_url, s_anchorTitleRx->cap(1)); // relative URL constructor
+ QUrl u = QUrl(m_url).resolved(s_anchorTitleRx->cap(1)); // relative URL
u.setQuery(QString());
m_matches.insert(r->uid, u);
m_allMatches.insert(r->uid, u);
@@ -757,7 +745,7 @@ void IMDBFetcher::parseMultipleNameResults() {
}
}
- QMap<QString, KUrl> map;
+ QMap<QString, QUrl> map;
QHash<QString, int> nameMap;
QString s;
@@ -765,13 +753,13 @@ void IMDBFetcher::parseMultipleNameResults() {
if(pos > -1) {
pos = s_anchorNameRx->indexIn(output, pos+13);
while(pos > -1 && pos < end && m_matches.size() < m_limit) {
- KUrl u(m_url, s_anchorNameRx->cap(1));
+ QUrl u = QUrl(m_url).resolved(s_anchorNameRx->cap(1));
s = s_anchorNameRx->cap(2).trimmed() + QLatin1Char(' ');
// if more than one exact, add parentheses
if(nameMap.contains(s) && nameMap[s] > 0) {
// fix the first one that didn't have a number
if(nameMap[s] == 1) {
- KUrl u2 = map[s];
+ QUrl u2 = map[s];
map.remove(s);
map.insert(s + QLatin1String("(1) "), u2);
}
@@ -789,12 +777,12 @@ void IMDBFetcher::parseMultipleNameResults() {
// go ahead and search for partial matches
pos = s_anchorNameRx->indexIn(output, end);
while(pos > -1 && m_matches.size() < m_limit) {
- KUrl u(m_url, s_anchorNameRx->cap(1)); // relative URL
+ QUrl u = QUrl(m_url).resolved(s_anchorNameRx->cap(1)); // relative URL
s = s_anchorNameRx->cap(2).trimmed();
if(nameMap.contains(s) && nameMap[s] > 0) {
// fix the first one that didn't have a number
if(nameMap[s] == 1) {
- KUrl u2 = map[s];
+ QUrl u2 = map[s];
map.remove(s);
map.insert(s + QLatin1String(" (1)"), u2);
}
@@ -827,7 +815,7 @@ void IMDBFetcher::parseMultipleNameResults() {
listWidget->setMinimumWidth(400);
listWidget->setWrapping(true);
- QMapIterator<QString, KUrl> i(map);
+ QMapIterator<QString, QUrl> i(map);
while(i.hasNext()) {
i.next();
const QString& value = i.key();
@@ -868,8 +856,8 @@ void IMDBFetcher::parseMultipleNameResults() {
KJobWidgets::setWindow(m_job, GUI::Proxy::widget());
connect(m_job, SIGNAL(result(KJob*)),
SLOT(slotComplete(KJob*)));
- connect(m_job, SIGNAL(redirection(KIO::Job *, const KUrl&)),
- SLOT(slotRedirection(KIO::Job*, const KUrl&)));
+ connect(m_job, SIGNAL(redirection(KIO::Job *, const QUrl&)),
+ SLOT(slotRedirection(KIO::Job*, const QUrl&)));
// do not stop() here
}
@@ -885,13 +873,13 @@ Tellico::Data::EntryPtr IMDBFetcher::fetchEntryHook(uint uid_) \
{ myLog() << "no url found";
return Data::EntryPtr();
}
- KUrl url = m_matches.contains(uid_) ? m_matches[uid_]
+ QUrl url = m_matches.contains(uid_) ? m_matches[uid_]
: m_allMatches[uid_];
if(url.path().contains(QRegExp(QLatin1String("/tt\\d+/$")))) {
url.setPath(url.path() + QLatin1String("combined"));
}
- KUrl origURL = m_url; // keep to switch back
+ QUrl origURL = m_url; // keep to switch back
QString results;
// if the url matches the current one, no need to redownload it
if(url == m_url) {
@@ -899,10 +887,6 @@ Tellico::Data::EntryPtr IMDBFetcher::fetchEntryHook(uint uid_) {
results = Tellico::decodeHTML(m_text);
} else {
// now it's sychronous
-#ifdef IMDB_TEST
- KUrl u(QLatin1String("/home/robby/imdb-title-result.html"));
- results = Tellico::fromHtmlData(FileHandler::readDataFile(u));
-#else
// be quiet about failure
results = Tellico::fromHtmlData(FileHandler::readDataFile(url, true));
m_url = url; // needed for processing
@@ -916,7 +900,6 @@ Tellico::Data::EntryPtr IMDBFetcher::fetchEntryHook(uint uid_) {
f.close();
#endif
results = Tellico::decodeHTML(results);
-#endif
}
if(results.isEmpty()) {
myLog() << "no text results";
@@ -969,7 +952,7 @@ Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const QString& \
str_) { // we want to strip the "/combined" from the url
QString url = m_url.url();
if(url.endsWith(QLatin1String("/combined"))) {
- url = m_url.upUrl().url();
+ url = m_url.resolved(QUrl(QLatin1String(".."))).url();
}
entry->setField(imdb, url);
}
@@ -1075,7 +1058,7 @@ void IMDBFetcher::doAlsoKnownAs(const QString& str_, \
Tellico::Data::EntryPtr ent }
}
-void IMDBFetcher::doPlot(const QString& str_, Tellico::Data::EntryPtr entry_, const \
KUrl& baseURL_) { +void IMDBFetcher::doPlot(const QString& str_, \
Tellico::Data::EntryPtr entry_, const QUrl& baseURL_) { // plot summaries provided \
by users are on a separate page // should those be preferred?
@@ -1104,7 +1087,7 @@ void IMDBFetcher::doPlot(const QString& str_, \
Tellico::Data::EntryPtr entry_, co if(useUserSummary) {
QRegExp idRx(QLatin1String("title/(tt\\d+)"));
idRx.indexIn(baseURL_.path());
- KUrl plotURL = baseURL_;
+ QUrl plotURL = baseURL_;
plotURL.setPath(QLatin1String("/title/") + idRx.cap(1) + \
QLatin1String("/plotsummary")); // be quiet about failure
QString plotPage = Tellico::fromHtmlData(FileHandler::readDataFile(plotURL, \
true)); @@ -1190,19 +1173,16 @@ void IMDBFetcher::doPerson(const QString& str_, \
Tellico::Data::EntryPtr entry_, }
}
-void IMDBFetcher::doCast(const QString& str_, Tellico::Data::EntryPtr entry_, const \
KUrl& baseURL_) { +void IMDBFetcher::doCast(const QString& str_, \
Tellico::Data::EntryPtr entry_, const QUrl& baseURL_) { // the extended cast list is \
on a separate page // that's usually a lot of people
// but since it can be in billing order, the main actors might not
// be in the short list
QRegExp idRx(QLatin1String("title/(tt\\d+)"));
idRx.indexIn(baseURL_.path());
-#ifdef IMDB_TEST
- KUrl castURL(QLatin1String("/home/robby/imdb-title-fullcredits.html"));
-#else
- KUrl castURL = baseURL_;
+ QUrl castURL = baseURL_;
castURL.setPath(QLatin1String("/title/") + idRx.cap(1) + \
QLatin1String("/fullcredits"));
-#endif
+
// be quiet about failure and be sure to translate entities
const QString castPage = Tellico::decodeHTML(FileHandler::readTextFile(castURL, \
true)); #if 0
@@ -1352,7 +1332,7 @@ void IMDBFetcher::doRating(const QString& str_, \
Tellico::Data::EntryPtr entry_) }
}
-void IMDBFetcher::doCover(const QString& str_, Tellico::Data::EntryPtr entry_, const \
KUrl& baseURL_) { +void IMDBFetcher::doCover(const QString& str_, \
Tellico::Data::EntryPtr entry_, const QUrl& baseURL_) { QRegExp \
imgRx(QLatin1String("<img\\s+[^>]*src\\s*=\\s*\"([^\"]*)\"[^>]*>"), \
Qt::CaseInsensitive); imgRx.setMinimal(true);
@@ -1364,7 +1344,7 @@ void IMDBFetcher::doCover(const QString& str_, \
Tellico::Data::EntryPtr entry_, c int pos = posterRx.indexIn(str_);
while(pos > -1) {
if(posterRx.cap(1).contains(imgRx)) {
- KUrl u(baseURL_, imgRx.cap(1));
+ QUrl u = QUrl(baseURL_).resolved(imgRx.cap(1));
QString id = ImageFactory::addImage(u, true);
if(!id.isEmpty()) {
entry_->setField(cover, id);
@@ -1381,7 +1361,7 @@ void IMDBFetcher::doCover(const QString& str_, \
Tellico::Data::EntryPtr entry_, c while(pos > -1) {
const QString url = imgRx.cap(0).toLower();
if(url.contains(cover)) {
- KUrl u(baseURL_, imgRx.cap(1));
+ QUrl u = QUrl(baseURL_).resolved(imgRx.cap(1));
QString id = ImageFactory::addImage(u, true);
if(!id.isEmpty()) {
entry_->setField(cover, id);
@@ -1404,7 +1384,7 @@ void IMDBFetcher::doCover(const QString& str_, \
Tellico::Data::EntryPtr entry_, c
QRegExp hrefRx(QLatin1String("href=['\"](.*)['\"]"), Qt::CaseInsensitive);
hrefRx.setMinimal(true);
if(hrefRx.indexIn(tag) > -1) {
- KUrl u(baseURL_, hrefRx.cap(1));
+ QUrl u = QUrl(baseURL_).resolved(hrefRx.cap(1));
QString id = ImageFactory::addImage(u, true);
if(!id.isEmpty()) {
entry_->setField(cover, id);
@@ -1582,7 +1562,7 @@ void IMDBFetcher::doLists(const QString& str_, \
Tellico::Data::EntryPtr entry_) {
Tellico::Fetch::FetchRequest IMDBFetcher::updateRequest(Data::EntryPtr entry_) {
const QString t = entry_->field(QLatin1String("title"));
- KUrl link = entry_->field(QLatin1String("imdb"));
+ QUrl link = entry_->field(QLatin1String("imdb"));
if(!link.isEmpty() && link.isValid()) {
if(link.host() != m_host) {
diff --git a/src/fetch/imdbfetcher.h b/src/fetch/imdbfetcher.h
index 00203eb..eef620e 100644
--- a/src/fetch/imdbfetcher.h
+++ b/src/fetch/imdbfetcher.h
@@ -28,7 +28,7 @@
#include "fetcher.h"
#include "configwidget.h"
-#include <KUrl>
+#include <QUrl>
#include <QPointer>
@@ -122,7 +122,7 @@ public:
private slots:
void slotComplete(KJob* job);
- void slotRedirection(KIO::Job* job, const KUrl& toURL);
+ void slotRedirection(KIO::Job* job, const QUrl& toURL);
private:
virtual void search();
@@ -138,15 +138,15 @@ private:
void doRunningTime(const QString& s, Data::EntryPtr e);
void doAspectRatio(const QString& s, Data::EntryPtr e);
void doAlsoKnownAs(const QString& s, Data::EntryPtr e);
- void doPlot(const QString& s, Data::EntryPtr e, const KUrl& baseURL_);
+ void doPlot(const QString& s, Data::EntryPtr e, const QUrl& baseURL_);
void doStudio(const QString& s, Data::EntryPtr e);
void doPerson(const QString& s, Data::EntryPtr e,
const QString& imdbHeader, const QString& fieldName);
- void doCast(const QString& s, Data::EntryPtr e, const KUrl& baseURL_);
+ void doCast(const QString& s, Data::EntryPtr e, const QUrl& baseURL_);
void doLists(const QString& s, Data::EntryPtr e);
void doLists2(const QString& s, Data::EntryPtr e);
void doRating(const QString& s, Data::EntryPtr e);
- void doCover(const QString& s, Data::EntryPtr e, const KUrl& baseURL);
+ void doCover(const QString& s, Data::EntryPtr e, const QUrl& baseURL);
void parseSingleTitleResult();
void parseSingleNameResult();
@@ -157,10 +157,10 @@ private:
QString m_text;
QHash<int, Data::EntryPtr> m_entries;
- QHash<int, KUrl> m_matches;
+ QHash<int, QUrl> m_matches;
// if a new search is started, m_matches is cleared
// but we might still need to recover an entry by uid
- QHash<int, KUrl> m_allMatches;
+ QHash<int, QUrl> m_allMatches;
QPointer<KIO::StoredTransferJob> m_job;
bool m_started;
@@ -168,7 +168,7 @@ private:
QString m_host;
int m_numCast;
- KUrl m_url;
+ QUrl m_url;
bool m_redirected;
int m_limit;
Lang m_lang;
diff --git a/src/fetch/isbndbfetcher.cpp b/src/fetch/isbndbfetcher.cpp
index bcf472d..abe4bea 100644
--- a/src/fetch/isbndbfetcher.cpp
+++ b/src/fetch/isbndbfetcher.cpp
@@ -104,34 +104,34 @@ void ISBNdbFetcher::continueSearch() {
void ISBNdbFetcher::doSearch() {
// myDebug() << "value = " << value_;
- KUrl u(ISBNDB_BASE_URL);
- u.addPath(m_apiKey);
+ QUrl u(QString::fromLatin1(ISBNDB_BASE_URL));
+ u.setPath(u.path() + m_apiKey);
switch(request().key) {
case Title:
- u.addPath(QLatin1String("books"));
+ u.setPath(u.path() + QLatin1String("books"));
u.addQueryItem(QLatin1String("q"), request().value);
break;
case Person:
- u.addPath(QLatin1String("books"));
+ u.setPath(u.path() + QLatin1String("books"));
u.addQueryItem(QLatin1String("i"), QLatin1String("author_name"));
u.addQueryItem(QLatin1String("q"), request().value);
break;
case Keyword:
- u.addPath(QLatin1String("books"));
+ u.setPath(u.path() + QLatin1String("books"));
u.addQueryItem(QLatin1String("i"), QLatin1String("full"));
u.addQueryItem(QLatin1String("q"), request().value);
break;
case ISBN:
- u.addPath(QLatin1String("book"));
+ u.setPath(u.path() + QLatin1String("book"));
{
// can only grab first value
QString v = request().value.section(QLatin1Char(';'), 0);
v.remove(QLatin1Char('-'));
- u.addPath(v);
+ u.setPath(u.path() + v);
}
break;
@@ -308,8 +308,7 @@ void ISBNdbFetcher::initXSLTHandler() {
return;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
delete m_xsltHandler;
m_xsltHandler = new XSLTHandler(u);
diff --git a/src/fetch/masfetcher.cpp b/src/fetch/masfetcher.cpp
index b93863b..0eb19fb 100644
--- a/src/fetch/masfetcher.cpp
+++ b/src/fetch/masfetcher.cpp
@@ -105,7 +105,7 @@ void MASFetcher::continueSearch() {
void MASFetcher::doSearch() {
#ifdef HAVE_QJSON
- KUrl u(MAS_API_URL);
+ QUrl u(QString::fromLatin1(MAS_API_URL));
u.addQueryItem(QLatin1String("Version"), QLatin1String("1.2"));
u.addQueryItem(QLatin1String("AppId"), QLatin1String(MAS_API_ID));
u.addQueryItem(QLatin1String("StartIdx"), QString::number(m_start+1));
@@ -280,7 +280,7 @@ void MASFetcher::populateEntry(Data::EntryPtr entry_, const \
QVariantMap& result_ }
// finally, look it up with a new query
- KUrl ku(MAS_API_URL);
+ QUrl ku(MAS_API_URL);
ku.addQueryItem(QLatin1String("Version"), QLatin1String("1.2"));
ku.addQueryItem(QLatin1String("AppId"), QLatin1String(MAS_API_ID));
ku.addQueryItem(QLatin1String("StartIdx"), QLatin1String("1"));
diff --git a/src/fetch/moviemeterfetcher.cpp b/src/fetch/moviemeterfetcher.cpp
index 1d55d3a..9c66daf 100644
--- a/src/fetch/moviemeterfetcher.cpp
+++ b/src/fetch/moviemeterfetcher.cpp
@@ -33,6 +33,7 @@
#include <KLocale>
#include <kio/job.h>
#include <kio/jobuidelegate.h>
+#include <KJobWidgets/KJobWidgets>
#include <QLabel>
#include <QFile>
@@ -43,7 +44,6 @@
#ifdef HAVE_QJSON
#include <qjson/serializer.h>
#include <qjson/parser.h>
-#include <KJobWidgets/KJobWidgets>
#endif
namespace {
@@ -89,7 +89,7 @@ void MovieMeterFetcher::search() {
#ifdef HAVE_QJSON
m_started = true;
- KUrl u(MOVIEMETER_API_URL);
+ QUrl u(QString::fromLatin1(MOVIEMETER_API_URL));
u.addQueryItem(QLatin1String("api_key"), QLatin1String(MOVIEMETER_API_KEY));
switch(request().key) {
@@ -140,8 +140,8 @@ Tellico::Data::EntryPtr MovieMeterFetcher::fetchEntryHook(uint \
uid_) { #ifdef HAVE_QJSON
QString id = entry->field(QLatin1String("moviemeter-id"));
if(!id.isEmpty()) {
- KUrl u(MOVIEMETER_API_URL);
- u.addPath(id);
+ QUrl u(QString::fromLatin1(MOVIEMETER_API_URL));
+ u.setPath(u.path() + id);
u.addQueryItem(QLatin1String("api_key"), QLatin1String(MOVIEMETER_API_KEY));
// quiet
QByteArray data = FileHandler::readDataFile(u, true);
diff --git a/src/fetch/mrlookupfetcher.cpp b/src/fetch/mrlookupfetcher.cpp
index 6b4c9e5..363ddcb 100644
--- a/src/fetch/mrlookupfetcher.cpp
+++ b/src/fetch/mrlookupfetcher.cpp
@@ -74,7 +74,7 @@ void MRLookupFetcher::readConfigHook(const KConfigGroup& config_) {
void MRLookupFetcher::search() {
m_started = true;
- KUrl u(MRLOOKUP_URL);
+ QUrl u(QString::fromLatin1(MRLOOKUP_URL));
switch(request().key) {
case Title:
diff --git a/src/fetch/musicbrainzfetcher.cpp b/src/fetch/musicbrainzfetcher.cpp
index 8a1443f..572436a 100644
--- a/src/fetch/musicbrainzfetcher.cpp
+++ b/src/fetch/musicbrainzfetcher.cpp
@@ -89,7 +89,7 @@ void MusicBrainzFetcher::continueSearch() {
}
void MusicBrainzFetcher::doSearch() {
- KUrl u(MUSICBRAINZ_API_URL);
+ QUrl u(QString::fromLatin1(MUSICBRAINZ_API_URL));
u.addQueryItem(QLatin1String("type"), QLatin1String("xml"));
u.addQueryItem(QLatin1String("limit"), QString::number(m_limit));
u.addQueryItem(QLatin1String("offset"), QString::number(m_offset));
@@ -125,7 +125,8 @@ void MusicBrainzFetcher::doSearch() {
return;
}
- u.addPath(queryPath);
+ u = u.adjusted(QUrl::StripTrailingSlash);
+ u.setPath(u.path() + QLatin1Char('/') + queryPath);
// myDebug() << "url: " << u.url();
@@ -245,8 +246,8 @@ Tellico::Data::EntryPtr MusicBrainzFetcher::fetchEntryHook(uint \
uid_) { return entry;
}
- KUrl u(MUSICBRAINZ_API_URL);
- u.addPath(QLatin1String("/release/") + mbid);
+ QUrl u(QString::fromLatin1(MUSICBRAINZ_API_URL));
+ u.setPath(u.path() + QLatin1String("/release/") + mbid);
u.addQueryItem(QLatin1String("type"), QLatin1String("xml"));
u.addQueryItem(QLatin1String("inc"), QLatin1String("artist tracks release-events \
release-groups labels tags url-rels"));
@@ -292,8 +293,7 @@ void MusicBrainzFetcher::initXSLTHandler() {
return;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
delete m_xsltHandler;
m_xsltHandler = new XSLTHandler(u);
diff --git a/src/fetch/openlibraryfetcher.cpp b/src/fetch/openlibraryfetcher.cpp
index bdb24ad..f61f871 100644
--- a/src/fetch/openlibraryfetcher.cpp
+++ b/src/fetch/openlibraryfetcher.cpp
@@ -103,7 +103,7 @@ void OpenLibraryFetcher::doSearch(const QString& term_) {
#ifndef HAVE_QJSON
doCoverOnly(term_);
#else
- KUrl u(OPENLIBRARY_QUERY_URL);
+ QUrl u(QString::fromLatin1(OPENLIBRARY_QUERY_URL));
// books are type/edition
u.addQueryItem(QLatin1String("type"), QLatin1String("/type/edition"));
@@ -214,7 +214,7 @@ Tellico::Data::EntryPtr OpenLibraryFetcher::fetchEntryHook(uint \
uid_) { if(entry->field(QLatin1String("cover")).isEmpty()) {
const QString isbn = \
ISBNValidator::cleanValue(entry->field(QLatin1String("isbn"))); if(!isbn.isEmpty()) \
{
- KUrl imageUrl = \
QString::fromLatin1("http://covers.openlibrary.org/b/isbn/%1-M.jpg?default=false").arg(isbn);
+ QUrl imageUrl = \
QString::fromLatin1("http://covers.openlibrary.org/b/isbn/%1-M.jpg?default=false").arg(isbn);
const QString id = ImageFactory::addImage(imageUrl, true);
if(!id.isEmpty()) {
entry->setField(QLatin1String("cover"), id);
@@ -335,7 +335,7 @@ void OpenLibraryFetcher::slotComplete(KJob* job_) {
foreach(const QVariant& authorMap, \
resultMap.value(QLatin1String("authors")).toList()) { const QString key = \
value(authorMap.toMap(), "key"); if(!key.isEmpty()) {
- KUrl authorUrl(OPENLIBRARY_QUERY_URL);
+ QUrl authorUrl(OPENLIBRARY_QUERY_URL);
authorUrl.addQueryItem(QLatin1String("type"), \
QLatin1String("/type/author")); authorUrl.addQueryItem(QLatin1String("key"), key);
authorUrl.addQueryItem(QLatin1String("name"), QString());
@@ -357,7 +357,7 @@ void OpenLibraryFetcher::slotComplete(KJob* job_) {
foreach(const QVariant& langMap, \
resultMap.value(QLatin1String("languages")).toList()) { const QString key = \
value(langMap.toMap(), "key"); if(!key.isEmpty()) {
- KUrl langUrl(OPENLIBRARY_QUERY_URL);
+ QUrl langUrl(OPENLIBRARY_QUERY_URL);
langUrl.addQueryItem(QLatin1String("type"), \
QLatin1String("/type/language")); langUrl.addQueryItem(QLatin1String("key"), key);
langUrl.addQueryItem(QLatin1String("name"), QString());
@@ -389,7 +389,7 @@ void OpenLibraryFetcher::slotComplete(KJob* job_) {
QString OpenLibraryFetcher::getAuthorKeys(const QString& term_) {
#ifdef HAVE_QJSON
- KUrl u(OPENLIBRARY_QUERY_URL);
+ QUrl u(QString::fromLatin1(OPENLIBRARY_QUERY_URL));
u.addQueryItem(QLatin1String("type"), QLatin1String("/type/author"));
u.addQueryItem(QLatin1String("name"), term_);
diff --git a/src/fetch/springerfetcher.cpp b/src/fetch/springerfetcher.cpp
index 338e649..5f302cf 100644
--- a/src/fetch/springerfetcher.cpp
+++ b/src/fetch/springerfetcher.cpp
@@ -29,7 +29,7 @@
#include <KLocale>
#include <KConfigGroup>
-#include <KUrl>
+#include <QUrl>
#include <QLabel>
#include <QVBoxLayout>
@@ -78,8 +78,8 @@ void SpringerFetcher::resetSearch() {
m_total = -1;
}
-KUrl SpringerFetcher::searchUrl() {
- KUrl u(SPRINGER_BASE_URL);
+QUrl SpringerFetcher::searchUrl() {
+ QUrl u(QString::fromLatin1(SPRINGER_BASE_URL));
u.addQueryItem(QLatin1String("api_key"), QLatin1String(SPRINGER_API_KEY));
u.addQueryItem(QLatin1String("s"), QString::number(m_start + 1));
u.addQueryItem(QLatin1String("p"), QString::number(SPRINGER_QUERY_COUNT));
@@ -115,7 +115,7 @@ KUrl SpringerFetcher::searchUrl() {
break;
default:
- return KUrl();
+ return QUrl();
}
// myDebug() << "url:" << u.url();
diff --git a/src/fetch/springerfetcher.h b/src/fetch/springerfetcher.h
index 549b611..9113cbf 100644
--- a/src/fetch/springerfetcher.h
+++ b/src/fetch/springerfetcher.h
@@ -65,7 +65,7 @@ public:
private:
virtual FetchRequest updateRequest(Data::EntryPtr entry);
virtual void resetSearch();
- virtual KUrl searchUrl();
+ virtual QUrl searchUrl();
virtual void parseData(QByteArray&);
virtual void checkMoreResults(int count);
virtual Data::EntryPtr fetchEntryHookData(Data::EntryPtr entry) { return entry; }
diff --git a/src/fetch/srufetcher.cpp b/src/fetch/srufetcher.cpp
index f37efde..8edcad3 100644
--- a/src/fetch/srufetcher.cpp
+++ b/src/fetch/srufetcher.cpp
@@ -115,8 +115,8 @@ void SRUFetcher::search() {
m_started = true;
- KUrl u;
- u.setProtocol(QLatin1String("http"));
+ QUrl u;
+ u.setScheme(QLatin1String("http"));
u.setHost(m_host);
u.setPort(m_port);
u.setPath(m_path);
@@ -386,8 +386,7 @@ bool SRUFetcher::initMARCXMLHandler() {
return false;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
m_MARCXMLHandler = new XSLTHandler(u);
if(!m_MARCXMLHandler->isValid()) {
@@ -410,8 +409,7 @@ bool SRUFetcher::initMODSHandler() {
return false;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
m_MODSHandler = new XSLTHandler(u);
if(!m_MODSHandler->isValid()) {
@@ -434,8 +432,7 @@ bool SRUFetcher::initSRWHandler() {
return false;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
m_SRWHandler = new XSLTHandler(u);
if(!m_SRWHandler->isValid()) {
@@ -570,7 +567,7 @@ void SRUFetcher::ConfigWidget::slotCheckHost() {
QString s = m_hostEdit->text();
// someone might be pasting a full URL, check that
if(s.indexOf(QLatin1Char(':')) > -1 || s.indexOf(QLatin1Char('/')) > -1) {
- KUrl u(s);
+ QUrl u(s);
if(u.isValid()) {
m_hostEdit->setText(u.host());
if(u.port() > 0) {
diff --git a/src/fetch/thegamesdbfetcher.cpp b/src/fetch/thegamesdbfetcher.cpp
index 46acc33..94177f5 100644
--- a/src/fetch/thegamesdbfetcher.cpp
+++ b/src/fetch/thegamesdbfetcher.cpp
@@ -61,23 +61,23 @@ bool TheGamesDBFetcher::canFetch(int type) const {
return type == Data::Collection::Game;
}
-KUrl TheGamesDBFetcher::searchUrl() {
- KUrl u;
+QUrl TheGamesDBFetcher::searchUrl() {
+ QUrl u;
switch(request().key) {
case Title:
- u = KUrl(THEGAMESDB_DETAIL_API_URL);
+ u = QUrl(QString::fromLatin1(THEGAMESDB_DETAIL_API_URL));
u.addQueryItem(QLatin1String("name"), request().value);
break;
case Keyword:
- u = KUrl(THEGAMESDB_SEARCH_API_URL);
+ u = QUrl(QString::fromLatin1(THEGAMESDB_SEARCH_API_URL));
u.addQueryItem(QLatin1String("name"), request().value);
break;
default:
myWarning() << "key not recognized: " << request().key;
- return KUrl();
+ return QUrl();
}
// myDebug() << "url: " << u.url();
@@ -93,7 +93,7 @@ Tellico::Data::EntryPtr \
TheGamesDBFetcher::fetchEntryHookData(Data::EntryPtr ent return entry_;
}
- KUrl u(THEGAMESDB_DETAIL_API_URL);
+ QUrl u(QString::fromLatin1(THEGAMESDB_DETAIL_API_URL));
u.addQueryItem(QLatin1String("id"), id);
// myDebug() << "url: " << u;
diff --git a/src/fetch/thegamesdbfetcher.h b/src/fetch/thegamesdbfetcher.h
index bab0d69..8de4d91 100644
--- a/src/fetch/thegamesdbfetcher.h
+++ b/src/fetch/thegamesdbfetcher.h
@@ -77,7 +77,7 @@ public:
private:
virtual FetchRequest updateRequest(Data::EntryPtr entry);
virtual void resetSearch() {}
- virtual KUrl searchUrl();
+ virtual QUrl searchUrl();
virtual void parseData(QByteArray&) {}
virtual Data::EntryPtr fetchEntryHookData(Data::EntryPtr entry);
};
diff --git a/src/fetch/themoviedbfetcher.cpp b/src/fetch/themoviedbfetcher.cpp
index 9d9320b..df991a8 100644
--- a/src/fetch/themoviedbfetcher.cpp
+++ b/src/fetch/themoviedbfetcher.cpp
@@ -35,6 +35,7 @@
#include <kio/job.h>
#include <kio/jobuidelegate.h>
#include <KConfigGroup>
+#include <KJobWidgets/KJobWidgets>
#include <QLabel>
#include <QFile>
@@ -45,7 +46,6 @@
#ifdef HAVE_QJSON
#include <qjson/serializer.h>
#include <qjson/parser.h>
-#include <KJobWidgets/KJobWidgets>
#endif
namespace {
@@ -131,12 +131,13 @@ void TheMovieDBFetcher::continueSearch() {
return;
}
- KUrl u(THEMOVIEDB_API_URL);
+ QUrl u(QString::fromLatin1(THEMOVIEDB_API_URL));
u.setPath(QLatin1String(THEMOVIEDB_API_VERSION));
switch(request().key) {
case Title:
- u.addPath(QLatin1String("/search/movie"));
+ u = u.adjusted(QUrl::StripTrailingSlash);
+ u.setPath(u.path() + QLatin1Char('/') + (QLatin1String("/search/movie")));
u.addQueryItem(QLatin1String("api_key"), m_apiKey);
u.addQueryItem(QLatin1String("language"), m_locale);
u.addQueryItem(QLatin1String("query"), request().value);
@@ -179,7 +180,7 @@ Tellico::Data::EntryPtr TheMovieDBFetcher::fetchEntryHook(uint \
uid_) { QString id = entry->field(QLatin1String("tmdb-id"));
if(!id.isEmpty()) {
// quiet
- KUrl u(THEMOVIEDB_API_URL);
+ QUrl u(QString::fromLatin1(THEMOVIEDB_API_URL));
u.setPath(QString::fromLatin1("%1/movie/%2")
.arg(QLatin1String(THEMOVIEDB_API_VERSION), id));
u.addQueryItem(QLatin1String("api_key"), m_apiKey);
@@ -390,7 +391,7 @@ void TheMovieDBFetcher::populateEntry(Data::EntryPtr entry_, \
const QVariantMap&
void TheMovieDBFetcher::readConfiguration() {
#ifdef HAVE_QJSON
- KUrl u(THEMOVIEDB_API_URL);
+ QUrl u(QString::fromLatin1(THEMOVIEDB_API_URL));
u.setPath(QString::fromLatin1("%1/configuration").arg(QLatin1String(THEMOVIEDB_API_VERSION)));
u.addQueryItem(QLatin1String("api_key"), m_apiKey);
diff --git a/src/fetch/winecomfetcher.cpp b/src/fetch/winecomfetcher.cpp
index 6fdb924..41d22f4 100644
--- a/src/fetch/winecomfetcher.cpp
+++ b/src/fetch/winecomfetcher.cpp
@@ -106,7 +106,7 @@ void WineComFetcher::doSearch() {
// myDebug() << "value = " << value_;
- KUrl u(WINECOM_BASE_URL);
+ QUrl u(QString::fromLatin1(WINECOM_BASE_URL));
u.setPath(QLatin1String("/api/beta2/service.svc/XML/catalog"));
u.addQueryItem(QLatin1String("apikey"), m_apiKey);
u.addQueryItem(QLatin1String("offset"), QString::number((m_page-1) * \
WINECOM_RETURNS_PER_REQUEST)); @@ -254,8 +254,7 @@ void \
WineComFetcher::initXSLTHandler() { return;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
delete m_xsltHandler;
m_xsltHandler = new XSLTHandler(u);
diff --git a/src/fetch/xmlfetcher.cpp b/src/fetch/xmlfetcher.cpp
index cbbab62..e8730a0 100644
--- a/src/fetch/xmlfetcher.cpp
+++ b/src/fetch/xmlfetcher.cpp
@@ -64,7 +64,7 @@ void XMLFetcher::continueSearch() {
}
void XMLFetcher::doSearch() {
- const KUrl u = searchUrl();
+ const QUrl u = searchUrl();
Q_ASSERT(!u.isEmpty());
if(u.isEmpty()) {
stop();
@@ -193,8 +193,7 @@ void XMLFetcher::initXSLTHandler() {
return;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
delete m_xsltHandler;
m_xsltHandler = new XSLTHandler(u);
diff --git a/src/fetch/xmlfetcher.h b/src/fetch/xmlfetcher.h
index dfc7173..750f6a5 100644
--- a/src/fetch/xmlfetcher.h
+++ b/src/fetch/xmlfetcher.h
@@ -31,7 +31,7 @@
#include <QPointer>
#include <QHash>
-class KUrl;
+class QUrl;
class KJob;
namespace KIO {
class StoredTransferJob;
@@ -74,7 +74,7 @@ private slots:
private:
virtual void search();
virtual void resetSearch() = 0;
- virtual KUrl searchUrl() = 0;
+ virtual QUrl searchUrl() = 0;
virtual void parseData(QByteArray& data) = 0;
virtual void checkMoreResults(int count) { Q_UNUSED(count); }
virtual Data::EntryPtr fetchEntryHookData(Data::EntryPtr entry) = 0;
diff --git a/src/fetch/yahoofetcher.cpp b/src/fetch/yahoofetcher.cpp
index 92061ea..8b34220 100644
--- a/src/fetch/yahoofetcher.cpp
+++ b/src/fetch/yahoofetcher.cpp
@@ -38,13 +38,13 @@
#include <KConfigGroup>
#include <kio/job.h>
#include <kio/jobuidelegate.h>
+#include <KJobWidgets/KJobWidgets>
#include <QDomDocument>
#include <QLabel>
#include <QFile>
#include <QTextStream>
#include <QVBoxLayout>
-#include <KJobWidgets/KJobWidgets>
namespace {
static const int YAHOO_MAX_RETURNS_TOTAL = 20;
@@ -92,7 +92,7 @@ void YahooFetcher::continueSearch() {
void YahooFetcher::doSearch() {
// myDebug() << "value = " << value_;
- KUrl u(YAHOO_BASE_URL);
+ QUrl u(QString::fromLatin1(YAHOO_BASE_URL));
u.addQueryItem(QLatin1String("appid"), QLatin1String(YAHOO_APP_ID));
u.addQueryItem(QLatin1String("type"), QLatin1String("all"));
u.addQueryItem(QLatin1String("output"), QLatin1String("xml"));
@@ -231,7 +231,7 @@ Tellico::Data::EntryPtr YahooFetcher::fetchEntryHook(uint uid_) {
return Data::EntryPtr();
}
- KUrl imageURL = entry->field(QLatin1String("image"));
+ QUrl imageURL = entry->field(QLatin1String("image"));
if(!imageURL.isEmpty()) {
QString id = ImageFactory::addImage(imageURL, true);
if(id.isEmpty()) {
@@ -260,8 +260,7 @@ void YahooFetcher::initXSLTHandler() {
return;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
delete m_xsltHandler;
m_xsltHandler = new XSLTHandler(u);
@@ -281,8 +280,9 @@ void YahooFetcher::getTracks(Tellico::Data::EntryPtr entry_) {
const QString albumid = entry_->field(QLatin1String("yahoo"));
- KUrl u(YAHOO_BASE_URL);
- u.setFileName(QLatin1String("songSearch"));
+ QUrl u(QString::fromLatin1(YAHOO_BASE_URL));
+ u = u.adjusted(QUrl::RemoveFilename);
+ u.setPath(u.path() + QLatin1String("songSearch"));
u.addQueryItem(QLatin1String("appid"), QLatin1String(YAHOO_APP_ID));
u.addQueryItem(QLatin1String("type"), QLatin1String("all"));
u.addQueryItem(QLatin1String("output"), QLatin1String("xml"));
diff --git a/src/fetch/z3950fetcher.cpp b/src/fetch/z3950fetcher.cpp
index 8099276..9c1ecdc 100644
--- a/src/fetch/z3950fetcher.cpp
+++ b/src/fetch/z3950fetcher.cpp
@@ -305,8 +305,7 @@ bool Z3950Fetcher::initMARC21Handler() {
return false;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
m_MARC21XMLHandler = new XSLTHandler(u);
if(!m_MARC21XMLHandler->isValid()) {
@@ -329,8 +328,7 @@ bool Z3950Fetcher::initUNIMARCHandler() {
return false;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
m_UNIMARCXMLHandler = new XSLTHandler(u);
if(!m_UNIMARCXMLHandler->isValid()) {
@@ -353,8 +351,7 @@ bool Z3950Fetcher::initMODSHandler() {
return false;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltfile);
m_MODSHandler = new XSLTHandler(u);
if(!m_MODSHandler->isValid()) {
diff --git a/src/fetchdialog.cpp b/src/fetchdialog.cpp
index 57bdbec..d7d97c4 100644
--- a/src/fetchdialog.cpp
+++ b/src/fetchdialog.cpp
@@ -719,7 +719,7 @@ void FetchDialog::slotLoadISBNList() {
if(!m_isbnTextEdit) {
return;
}
- KUrl u = KFileDialog::getOpenUrl(KUrl(), QString(), this);
+ QUrl u = KFileDialog::getOpenUrl(QUrl(), QString(), this);
if(u.isValid()) {
m_isbnTextEdit->setText(m_isbnTextEdit->toPlainText() + \
FileHandler::readTextFile(u)); m_isbnTextEdit->moveCursor(QTextCursor::End);
diff --git a/src/gui/drophandler.cpp b/src/gui/drophandler.cpp
index ad4c418..93a42ef 100644
--- a/src/gui/drophandler.cpp
+++ b/src/gui/drophandler.cpp
@@ -60,7 +60,7 @@ bool DropHandler::eventFilter(QObject* obj_, QEvent* ev_) {
}
bool DropHandler::dragEnter(QDragEnterEvent* event_) {
- bool accept = KUrl::List::canDecode(event_->mimeData()) || \
event_->mimeData()->hasText(); + bool accept = event_->mimeData()->hasUrls() || \
event_->mimeData()->hasText(); if(accept) {
event_->acceptProposedAction();
}
@@ -68,10 +68,10 @@ bool DropHandler::dragEnter(QDragEnterEvent* event_) {
}
bool DropHandler::drop(QDropEvent* event_) {
- KUrl::List urls = KUrl::List::fromMimeData(event_->mimeData());
+ QList<QUrl> urls = event_->mimeData()->urls();
if(urls.isEmpty() && event_->mimeData()->hasText()) {
- KUrl u(event_->mimeData()->text());
+ QUrl u(event_->mimeData()->text());
if(!u.isRelative() && (u.isLocalFile() || !u.host().isEmpty())) {
urls << u;
} else {
@@ -81,14 +81,14 @@ bool DropHandler::drop(QDropEvent* event_) {
return !urls.isEmpty() && handleURL(urls);
}
-bool DropHandler::handleURL(const KUrl::List& urls_) {
+bool DropHandler::handleURL(const QList<QUrl>& urls_) {
bool hasUnknown = false;
- KUrl::List tc, pdf, bib, ris, ciw;
- foreach(const KUrl& url, urls_) {
+ QList<QUrl> tc, pdf, bib, ris, ciw;
+ foreach(const QUrl& url, urls_) {
KMimeType::Ptr ptr;
// findByURL doesn't work for http, so actually query
// the url itself
- if(url.protocol() != QLatin1String("http")) {
+ if(url.scheme() != QLatin1String("http")) {
ptr = KMimeType::findByUrl(url);
} else {
KIO::MimetypeJob* job = KIO::mimetype(url, KIO::HideProgressInfo);
diff --git a/src/gui/drophandler.h b/src/gui/drophandler.h
index 9d3797f..dc8d568 100644
--- a/src/gui/drophandler.h
+++ b/src/gui/drophandler.h
@@ -25,8 +25,6 @@
#ifndef TELLICO_DROPHANDLER_H
#define TELLICO_DROPHANDLER_H
-#include <KUrl>
-
#include <QObject>
#include <QEvent>
#include <QDropEvent>
@@ -47,7 +45,7 @@ protected:
private:
bool dragEnter(QDragEnterEvent* event);
bool drop(QDropEvent* event);
- bool handleURL(const KUrl::List& urls);
+ bool handleURL(const QList<QUrl>& urls);
bool handleText(const QString& text);
};
diff --git a/src/gui/imagewidget.cpp b/src/gui/imagewidget.cpp
index 1a60e39..bc8f9e2 100644
--- a/src/gui/imagewidget.cpp
+++ b/src/gui/imagewidget.cpp
@@ -178,7 +178,7 @@ void ImageWidget::setImage(const QString& id_) {
m_cbLinkOnly->setChecked(link);
m_cbLinkOnly->setEnabled(link); // user can't make a non;-linked image a linked \
image, so disable if not linked // if we're using a link, then the original URL _is_ \
the id
- m_originalURL = link ? KUrl(id_) : KUrl();
+ m_originalURL = link ? QUrl(id_) : QUrl();
m_scaled = QPixmap();
scale();
@@ -241,7 +241,7 @@ void ImageWidget::resizeEvent(QResizeEvent *) {
}
void ImageWidget::slotGetImage() {
- KUrl url = KFileDialog::getImageOpenUrl(KUrl(), this);
+ QUrl url = KFileDialog::getImageOpenUrl(QUrl(), this);
if(url.isEmpty() || !url.isValid()) {
return;
}
@@ -316,7 +316,7 @@ void ImageWidget::slotEditImage() {
const Data::Image& img = ImageFactory::imageById(m_imageID);
img.save(m_img);
m_editedFileDateTime = QFileInfo(m_img).lastModified();
- m_editProcess->setProgram(KRun::processDesktopExec(*m_editor, QList<QUrl>() << \
m_img)); + m_editProcess->setProgram(KRun::processDesktopExec(*m_editor, \
QList<QUrl>() << QUrl::fromLocalFile(m_img))); m_editProcess->start();
if(!m_waitDlg) {
m_waitDlg = new KProgressDialog(this);
@@ -331,7 +331,7 @@ void ImageWidget::slotEditImage() {
void ImageWidget::slotFinished() {
if(m_editedFileDateTime != QFileInfo(m_img).lastModified()) {
- loadImage(KUrl(m_img));
+ loadImage(QUrl::fromLocalFile(m_img));
}
m_waitDlg->close();
}
@@ -360,7 +360,7 @@ void ImageWidget::slotLinkOnlyClicked() {
// so it needs to be added to the cache all over again
// probably could do this without downloading the image all over again,
// but I'm not going to do that right now
- const QString& id = ImageFactory::addImage(m_originalURL, false, KUrl(), link);
+ const QString& id = ImageFactory::addImage(m_originalURL, false, QUrl(), link);
// same image, so no need to call setImage
m_imageID = id;
emit signalModified();
@@ -417,7 +417,7 @@ void ImageWidget::dropEvent(QDropEvent* event_) {
}
event_->acceptProposedAction();
} else if(event_->mimeData()->hasText()) {
- KUrl url(event_->mimeData()->text());
+ QUrl url = QUrl::fromUserInput(event_->mimeData()->text());
if(!url.isEmpty() && url.isValid()) {
loadImage(url);
event_->acceptProposedAction();
@@ -425,12 +425,12 @@ void ImageWidget::dropEvent(QDropEvent* event_) {
}
}
-void ImageWidget::loadImage(const KUrl& url_) {
+void ImageWidget::loadImage(const QUrl& url_) {
const bool link = m_cbLinkOnly->isChecked();
GUI::CursorSaver cs;
// if we're linking only, then we want the image id to be the same as the url
- const QString& id = ImageFactory::addImage(url_, false, KUrl(), link);
+ const QString& id = ImageFactory::addImage(url_, false, QUrl(), link);
if(id != m_imageID) {
setImage(id);
emit signalModified();
diff --git a/src/gui/imagewidget.h b/src/gui/imagewidget.h
index fe4b24f..aeb86b4 100644
--- a/src/gui/imagewidget.h
+++ b/src/gui/imagewidget.h
@@ -25,15 +25,15 @@
#ifndef TELLICO_IMAGEWIDGET_H
#define TELLICO_IMAGEWIDGET_H
-#include <KUrl>
#include <KDialog>
+#include <KService>
#include <QWidget>
#include <QPixmap>
#include <QPoint>
-#include <KService>
#include <QDateTime>
#include <QPointer>
+#include <QUrl>
#include <config.h>
@@ -94,14 +94,14 @@ private slots:
private:
void scale();
- void loadImage(const KUrl& url);
+ void loadImage(const QUrl& url);
QString m_imageID;
QPixmap m_pixmap;
QPixmap m_scaled;
QLabel* m_label;
QCheckBox* m_cbLinkOnly;
- KUrl m_originalURL;
+ QUrl m_originalURL;
QPoint m_dragStart;
QMenu* m_editMenu;
QToolButton* m_edit;
diff --git a/src/gui/urlfieldwidget.cpp b/src/gui/urlfieldwidget.cpp
index 5f0be1f..828bbe2 100644
--- a/src/gui/urlfieldwidget.cpp
+++ b/src/gui/urlfieldwidget.cpp
@@ -29,7 +29,8 @@
#include <klineedit.h>
#include <kurlrequester.h>
#include <kurllabel.h>
-#include <KUrl>
+
+#include <QUrl>
using Tellico::GUI::URLFieldWidget;
@@ -39,7 +40,7 @@ using Tellico::GUI::URLFieldWidget;
QString URLFieldWidget::URLCompletion::makeCompletion(const QString& text_) {
// KUrlCompletion::makeCompletion() uses an internal variable instead
// of calling KUrlCompletion::dir() so need to set the base dir before completing
- setDir(Kernel::self()->URL().directory());
+ setDir(Kernel::self()->URL().adjusted(QUrl::PreferLocalFile | \
QUrl::RemoveFilename)); return KUrlCompletion::makeCompletion(text_);
}
@@ -65,13 +66,19 @@ URLFieldWidget::~URLFieldWidget() {
}
QString URLFieldWidget::text() const {
- if(m_isRelative) {
- return KUrl::relativeUrl(Kernel::self()->URL(), m_requester->url());
+ if(m_isRelative && Kernel::self()->URL().isLocalFile()) {
+ //KURl::relativeUrl() has no QUrl analog
+ QUrl base_url = Kernel::self()->URL();
+ QUrl url = m_requester->url();
+ //return Kernel::self()->URL().resolved(m_requester->url());
+ return QDir(base_url.path()).relativeFilePath(url.path());
}
// for comparison purposes and to be consistent with the file listing importer
// I want the full url here, including the protocol
- // the requester only returns the path, so create a KUrl
- return KUrl(m_requester->url()).url();
+ // the requester only returns the path, so create a QUrl
+ // TODO: 2015-04-30 no longer necessary in KF5/Qt5?
+ //return QUrl(m_requester->url()).url();
+ return m_requester->url().url();
}
void URLFieldWidget::setTextImpl(const QString& text_) {
@@ -93,7 +100,7 @@ void URLFieldWidget::slotOpenURL(const QString& url_) {
return;
}
// just in case, interpret string relative to document url
- m_run = new KRun(KUrl(Kernel::self()->URL(), url_), this);
+ m_run = new KRun(Kernel::self()->URL().resolved(url_), this);
}
QWidget* URLFieldWidget::widget() {
diff --git a/src/images/imagedirectory.cpp b/src/images/imagedirectory.cpp
index 32dac40..1952d2b 100644
--- a/src/images/imagedirectory.cpp
+++ b/src/images/imagedirectory.cpp
@@ -27,12 +27,12 @@
#include "filehandler.h"
#include "../tellico_debug.h"
-#include <kurl.h>
#include <ktempdir.h>
#include <kzip.h>
#include <QFile>
#include <QDir>
+#include <QUrl>
using namespace Tellico;
using Tellico::ImageStorage;
@@ -78,8 +78,7 @@ Tellico::Data::Image* ImageDirectory::imageById(const QString& id_) \
{ return 0;
}
- KUrl imgUrl;
- imgUrl.setPath(path() + id_);
+ QUrl imgUrl = QUrl::fromLocalFile(path() + id_);
Data::Image* img = FileHandler::readImageFile(imgUrl, id_, true /* quiet */);
if(!img) {
myLog() << "image not found:" << imgUrl.url();
@@ -112,9 +111,9 @@ bool ImageDirectory::writeImage(const Data::Image& img_) {
}
m_pathExists = true;
}
- KUrl target;
- target.setPath(path);
- target.setFileName(img_.id());
+ QUrl target = QUrl::fromLocalFile(path);
+ target = target.adjusted(QUrl::RemoveFilename);
+ target.setPath(target.path() + img_.id());
return FileHandler::writeDataURL(target, img_.byteArray(), true /* force */);
}
diff --git a/src/images/imagefactory.cpp b/src/images/imagefactory.cpp
index 03a9f6b..a77aef2 100644
--- a/src/images/imagefactory.cpp
+++ b/src/images/imagefactory.cpp
@@ -119,23 +119,23 @@ Tellico::ImageFactory::CacheDir ImageFactory::cacheDir() {
return TempDir;
}
-QString ImageFactory::addImage(const KUrl& url_, bool quiet_, const KUrl& refer_, \
bool link_) { +QString ImageFactory::addImage(const QUrl& url_, bool quiet_, const \
QUrl& refer_, bool link_) { Q_ASSERT(factory && "ImageFactory is not initialized!");
return factory->addImageImpl(url_, quiet_, refer_, link_).id();
}
-const Tellico::Data::Image& ImageFactory::addImageImpl(const KUrl& url_, bool \
quiet_, const KUrl& refer_, bool link_) { +const Tellico::Data::Image& \
ImageFactory::addImageImpl(const QUrl& url_, bool quiet_, const QUrl& refer_, bool \
link_) { if(url_.isEmpty() || !url_.isValid()) {
return Data::Image::null;
}
-// myLog() << url_.prettyUrl();
+// myLog() << url_.toDisplayString();
Data::Image* img = FileHandler::readImageFile(url_, QString(), quiet_, refer_);
if(!img) {
- myLog() << "image not found:" << url_.prettyUrl();
+ myLog() << "image not found:" << url_.toDisplayString();
return Data::Image::null;
}
if(img->isNull()) {
- myLog() << "null image:" << url_.prettyUrl();
+ myLog() << "null image:" << url_.toDisplayString();
delete img;
return Data::Image::null;
}
@@ -338,10 +338,10 @@ const Tellico::Data::Image& ImageFactory::imageById(const \
QString& id_) { // also, the image info cache might not have it so check if the
// id is a valid absolute url
// yeah, it's probably slow
- if((s_imageInfoMap.contains(id_) && s_imageInfoMap[id_].linkOnly) || \
!KUrl::isRelativeUrl(id_)) {
- KUrl u(id_);
+ if((s_imageInfoMap.contains(id_) && s_imageInfoMap[id_].linkOnly) || \
!QUrl::fromUserInput(id_).isRelative()) { + QUrl u(id_);
if(u.isValid()) {
- return factory->addImageImpl(u, true, KUrl(), true);
+ return factory->addImageImpl(u, true, QUrl(), true);
}
}
@@ -601,7 +601,7 @@ void ImageFactory::emitImageMismatch() {
emit imageLocationMismatch();
}
-void ImageFactory::setLocalDirectory(const KUrl& url_) {
+void ImageFactory::setLocalDirectory(const QUrl& url_) {
if(url_.isEmpty()) {
return;
}
@@ -609,7 +609,7 @@ void ImageFactory::setLocalDirectory(const KUrl& url_) {
myWarning() << "Tellico can only save images to local disk";
myWarning() << "unable to save to " << url_.url();
} else {
- QString dir = url_.directory(KUrl::AppendTrailingSlash);
+ QString dir = url_.path() + QLatin1Char('/');
// could have already been set once
if(!url_.fileName().contains(QLatin1String("_files"))) {
dir += url_.fileName().section(QLatin1Char('.'), 0, 0) + \
QLatin1String("_files/");
diff --git a/src/images/imagefactory.h b/src/images/imagefactory.h
index 3151c94..679ba12 100644
--- a/src/images/imagefactory.h
+++ b/src/images/imagefactory.h
@@ -27,7 +27,7 @@
#include "../utils/stringset.h"
-#include <kurl.h>
+#include <QUrl>
#include <QObject>
#include <QColor>
@@ -93,8 +93,8 @@ public:
* @param quiet If any error should not be reported.
* @return The image id, empty if null
*/
- static QString addImage(const KUrl& url, bool quiet=false,
- const KUrl& referrer = KUrl(), bool linkOnly=false);
+ static QString addImage(const QUrl& url, bool quiet=false,
+ const QUrl& referrer = QUrl(), bool linkOnly=false);
/**
* Add an image, reading it from a regular QImage, which is the case when dragging \
and dropping
* an image in the @ref ImageWidget. The format has to be included, since the \
QImage doesn't @@ -149,7 +149,7 @@ public:
static void removeImage(const QString& id_, bool deleteImage);
static StringSet imagesNotInCache();
- static void setLocalDirectory(const KUrl& url);
+ static void setLocalDirectory(const QUrl& url);
static void setZipArchive(KZip* zip);
static ImageFactory* self();
@@ -166,8 +166,8 @@ private:
* @param quiet If any error should not be reported.
* @return The image
*/
- const Data::Image& addImageImpl(const KUrl& url, bool quiet=false,
- const KUrl& referrer = KUrl(), bool linkOnly = \
false); + const Data::Image& addImageImpl(const QUrl& url, bool quiet=false,
+ const QUrl& referrer = QUrl(), bool linkOnly = \
false); /**
* Add an image, reading it from a regular QImage, which is the case when dragging \
and dropping
* an image in the @ref ImageWidget. The format has to be included, since the \
QImage doesn't
diff --git a/src/importdialog.cpp b/src/importdialog.cpp
index 92d5f1e..9aadf8b 100644
--- a/src/importdialog.cpp
+++ b/src/importdialog.cpp
@@ -64,7 +64,7 @@
using Tellico::ImportDialog;
-ImportDialog::ImportDialog(Tellico::Import::Format format_, const KUrl::List& urls_, \
QWidget* parent_) +ImportDialog::ImportDialog(Tellico::Import::Format format_, const \
QList<QUrl>& urls_, QWidget* parent_) : KDialog(parent_),
m_importer(importer(format_, urls_)) {
setModal(true);
@@ -165,9 +165,9 @@ Tellico::Import::Action ImportDialog::action() const {
}
// static
-Tellico::Import::Importer* ImportDialog::importer(Tellico::Import::Format format_, \
const KUrl::List& urls_) { +Tellico::Import::Importer* \
ImportDialog::importer(Tellico::Import::Format format_, const QList<QUrl>& urls_) { \
#define CHECK_SIZE if(urls_.size() > 1) myWarning() << "only \
importing first URL"
- KUrl firstURL = urls_.isEmpty() ? KUrl() : urls_[0];
+ QUrl firstURL = urls_.isEmpty() ? QUrl() : urls_[0];
Import::Importer* importer = 0;
switch(format_) {
case Import::TellicoXML:
@@ -200,8 +200,7 @@ Tellico::Import::Importer* \
ImportDialog::importer(Tellico::Import::Format format {
QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("mods2tellico.xsl")); \
if(!xsltFile.isEmpty()) {
- KUrl u;
- u.setPath(xsltFile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
static_cast<Import::XSLTImporter*>(importer)->setXSLTURL(u);
} else {
myWarning() << "unable to find mods2tellico.xml!";
@@ -425,8 +424,8 @@ void ImportDialog::slotUpdateAction() {
}
// static
-Tellico::Data::CollPtr ImportDialog::importURL(Tellico::Import::Format format_, \
const KUrl& url_) {
- Import::Importer* imp = importer(format_, url_);
+Tellico::Data::CollPtr ImportDialog::importURL(Tellico::Import::Format format_, \
const QUrl& url_) { + Import::Importer* imp = importer(format_, QList<QUrl>() << \
url_); if(!imp) {
return Data::CollPtr();
}
diff --git a/src/importdialog.h b/src/importdialog.h
index 2cbe9f5..e52917b 100644
--- a/src/importdialog.h
+++ b/src/importdialog.h
@@ -29,7 +29,7 @@
#include "datavectors.h"
#include <kdialog.h>
-#include <kurl.h>
+#include <QUrl>
#include <QShowEvent>
@@ -50,7 +50,7 @@ class ImportDialog : public KDialog {
Q_OBJECT
public:
- ImportDialog(Import::Format format, const KUrl::List& urls, QWidget* parent);
+ ImportDialog(Import::Format format, const QList<QUrl>& urls, QWidget* parent);
~ImportDialog();
Data::CollPtr collection();
@@ -61,8 +61,8 @@ public:
static Import::Target importTarget(Import::Format format);
static QString startDir(Import::Format format);
- static Import::Importer* importer(Import::Format format, const KUrl::List& urls);
- static Data::CollPtr importURL(Import::Format format, const KUrl& url);
+ static Import::Importer* importer(Import::Format format, const QList<QUrl>& urls);
+ static Data::CollPtr importURL(Import::Format format, const QUrl& url);
static Data::CollPtr importText(Import::Format format, const QString& text);
private slots:
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c3c7c7b..3bbdac5 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -301,7 +301,7 @@ void MainWindow::initActions() {
*************************************************/
action = KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection());
action->setToolTip(i18n("Open an existing document"));
- m_fileOpenRecent = KStandardAction::openRecent(this, SLOT(slotFileOpenRecent(const \
KUrl&)), actionCollection()); + m_fileOpenRecent = KStandardAction::openRecent(this, \
SLOT(slotFileOpenRecent(const QUrl&)), actionCollection()); \
m_fileOpenRecent->setToolTip(i18n("Open a recently used file")); m_fileSave = \
KStandardAction::save(this, SLOT(slotFileSave()), actionCollection()); \
m_fileSave->setToolTip(i18n("Save the document")); @@ -740,8 +740,8 @@ void \
MainWindow::initView() { "for each entry.</qt>"));
m_entryView = new EntryView(m_rightSplit);
- connect(m_entryView, SIGNAL(signalAction(const KUrl&)),
- SLOT(slotURLAction(const KUrl&)));
+ connect(m_entryView, SIGNAL(signalAction(const QUrl&)),
+ SLOT(slotURLAction(const QUrl&)));
setMinimumWidth(MAIN_WINDOW_MIN_WIDTH);
@@ -780,7 +780,7 @@ void MainWindow::initFileOpen(bool nofile_) {
bool happyStart = false;
if(!nofile_ && Config::reopenLastFile()) {
// Config::lastOpenFile() is the full URL, protocol included
- KUrl lastFile(Config::lastOpenFile()); // empty string is actually ok, it gets \
handled + QUrl lastFile(Config::lastOpenFile()); // empty string is actually ok, \
it gets handled if(!lastFile.isEmpty() && lastFile.isValid()) {
slotFileOpen(lastFile);
happyStart = true;
@@ -875,9 +875,9 @@ void MainWindow::readCollectionOptions(Tellico::Data::CollPtr \
coll_) { if(coll_->type() != Data::Collection::Base) {
entryGroup = group.readEntry("Group By", defaultGroup);
} else {
- KUrl url = Kernel::self()->URL();
+ QUrl url = Kernel::self()->URL();
for(int i = 0; i < Config::maxCustomURLSettings(); ++i) {
- KUrl u = group.readEntry(QString::fromLatin1("URL_%1").arg(i));
+ QUrl u = group.readEntry(QString::fromLatin1("URL_%1").arg(i));
if(url == u) {
entryGroup = group.readEntry(QString::fromLatin1("Group By_%1").arg(i), \
defaultGroup); break;
@@ -928,11 +928,11 @@ void MainWindow::saveCollectionOptions(Tellico::Data::CollPtr \
coll_) {
if(coll_->type() == Data::Collection::Base) {
// all of this is to have custom settings on a per file basis
- KUrl url = Kernel::self()->URL();
- QList<KUrl> urls = QList<KUrl>() << url;
+ QUrl url = Kernel::self()->URL();
+ QList<QUrl> urls = QList<QUrl>() << url;
QStringList groupBys = QStringList() << groupName;
for(int i = 0; i < Config::maxCustomURLSettings(); ++i) {
- KUrl u = config.readEntry(QString::fromLatin1("URL_%1").arg(i), QUrl());
+ QUrl u = config.readEntry(QString::fromLatin1("URL_%1").arg(i), QUrl());
QString g = config.readEntry(QString::fromLatin1("Group By_%1").arg(i), \
QString()); if(!u.isEmpty() && url != u) {
urls.append(u);
@@ -1078,7 +1078,7 @@ void MainWindow::slotFileOpen() {
filter += QLatin1String("\n");
filter += i18n("*|All Files");
// keyword 'open'
- KUrl url = KFileDialog::getOpenUrl(KUrl(QLatin1String("kfiledialog:///open")), \
filter, + QUrl url = \
KFileDialog::getOpenUrl(QUrl(QLatin1String("kfiledialog:///open")), filter, this, \
i18n("Open File")); if(!url.isEmpty() && url.isValid()) {
slotFileOpen(url);
@@ -1087,7 +1087,7 @@ void MainWindow::slotFileOpen() {
StatusBar::self()->clearStatus();
}
-void MainWindow::slotFileOpen(const KUrl& url_) {
+void MainWindow::slotFileOpen(const QUrl& url_) {
slotStatusMsg(i18n("Opening file..."));
// close the fields dialog
@@ -1105,7 +1105,7 @@ void MainWindow::slotFileOpen(const KUrl& url_) {
StatusBar::self()->clearStatus();
}
-void MainWindow::slotFileOpenRecent(const KUrl& url_) {
+void MainWindow::slotFileOpenRecent(const QUrl& url_) {
slotStatusMsg(i18n("Opening file..."));
// close the fields dialog
@@ -1125,13 +1125,13 @@ void MainWindow::slotFileOpenRecent(const KUrl& url_) {
}
void MainWindow::openFile(const QString& file_) {
- KUrl url(file_);
+ QUrl url(file_);
if(!url.isEmpty() && url.isValid()) {
slotFileOpen(url);
}
}
-bool MainWindow::openURL(const KUrl& url_) {
+bool MainWindow::openURL(const QUrl& url_) {
MARK;
// try to open document
GUI::CursorSaver cs(Qt::WaitCursor);
@@ -1244,7 +1244,7 @@ bool MainWindow::fileSaveAs() {
filter += i18n("*|All Files");
// keyword 'open'
- KUrl url = KFileDialog::getSaveUrl(KUrl(QLatin1String("kfiledialog:///open")), \
filter, this, i18n("Save As")); + QUrl url = \
KFileDialog::getSaveUrl(QUrl(QLatin1String("kfiledialog:///open")), filter, this, \
i18n("Save As"));
if(url.isEmpty()) {
StatusBar::self()->clearStatus();
@@ -1722,10 +1722,10 @@ void MainWindow::slotFileImport(int format_) {
Import::Format format = static_cast<Import::Format>(format_);
bool checkURL = true;
- KUrl url;
+ QUrl url;
switch(ImportDialog::importTarget(format)) {
case Import::File:
- url = KFileDialog::getOpenUrl(KUrl(ImportDialog::startDir(format)), \
ImportDialog::fileFilter(format), + url = \
KFileDialog::getOpenUrl(QUrl(ImportDialog::startDir(format)), \
ImportDialog::fileFilter(format), this, i18n("Import File"));
break;
@@ -1748,7 +1748,7 @@ void MainWindow::slotFileImport(int format_) {
return;
}
}
- importFile(format, url);
+ importFile(format, QList<QUrl>() << url);
StatusBar::self()->clearStatus();
}
@@ -1774,7 +1774,7 @@ void MainWindow::slotFileExport(int format_) {
case Export::File:
{
- KUrl url = KFileDialog::getSaveUrl(KUrl(QLatin1String("kfiledialog:///export")),
+ QUrl url = KFileDialog::getSaveUrl(QUrl(QLatin1String("kfiledialog:///export")),
dlg.fileFilter(), this, i18n("Export As"));
if(url.isEmpty()) {
StatusBar::self()->clearStatus();
@@ -1913,7 +1913,7 @@ void MainWindow::slotHideFetchDialog() {
}
}
-bool MainWindow::importFile(Tellico::Import::Format format_, const KUrl& url_, \
Tellico::Import::Action action_) { +bool \
MainWindow::importFile(Tellico::Import::Format format_, const QUrl& url_, \
Tellico::Import::Action action_) { // try to open document
GUI::CursorSaver cs(Qt::WaitCursor);
@@ -1953,7 +1953,7 @@ bool MainWindow::importFile(Tellico::Import::Format format_, \
const KUrl& url_, T return !failed; // return true means success
}
-bool MainWindow::exportCollection(Tellico::Export::Format format_, const KUrl& url_) \
{ +bool MainWindow::exportCollection(Tellico::Export::Format format_, const QUrl& \
url_) { if(!url_.isValid()) {
myDebug() << "invalid URL:" << url_;
return false;
@@ -2041,7 +2041,7 @@ void MainWindow::updateCaption(bool modified_) {
if(!caption.isEmpty()) {
caption += QLatin1String(" - ");
}
- KUrl u = Data::Document::self()->URL();
+ QUrl u = Data::Document::self()->URL();
if(u.isLocalFile()) {
// for new files, the filename is set to Untitled in Data::Document
if(u.fileName() == i18n(Tellico::untitledFilename)) {
@@ -2050,7 +2050,7 @@ void MainWindow::updateCaption(bool modified_) {
caption += u.path();
}
} else {
- caption += u.prettyUrl();
+ caption += u.toDisplayString();
}
}
setCaption(caption, modified_);
@@ -2142,20 +2142,20 @@ void MainWindow::updateEntrySources() {
plugActionList(QLatin1String("update_entry_actions"), m_fetchActions);
}
-void MainWindow::importFile(Tellico::Import::Format format_, const KUrl::List& \
urls_) {
- KUrl::List urls = urls_;
+void MainWindow::importFile(Tellico::Import::Format format_, const QList<QUrl>& \
urls_) { + QList<QUrl> urls = urls_;
// update as DropHandler and Importer classes are updated
if(urls_.count() > 1 &&
format_ != Import::Bibtex &&
format_ != Import::RIS &&
format_ != Import::CIW &&
format_ != Import::PDF) {
- KUrl u = urls_.front();
- QString url = u.isLocalFile() ? u.path() : u.prettyUrl();
+ QUrl u = urls_.front();
+ QString url = u.isLocalFile() ? u.path() : u.toDisplayString();
Kernel::self()->sorry(i18n("Tellico can only import one file of this type at a \
time. " "Only %1 will be imported.", url));
urls.clear();
- urls = u;
+ urls += u;
}
ImportDialog dlg(format_, urls, this);
@@ -2232,8 +2232,8 @@ bool MainWindow::importCollection(Tellico::Data::CollPtr coll_, \
Tellico::Import: return !failed;
}
-void MainWindow::slotURLAction(const KUrl& url_) {
- Q_ASSERT(url_.protocol() == QLatin1String("tc"));
+void MainWindow::slotURLAction(const QUrl& url_) {
+ Q_ASSERT(url_.scheme() == QLatin1String("tc"));
QString actionName = url_.fileName();
QAction* action = this->action(actionName.toLatin1());
if(action) {
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 0b9614b..751b028 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -32,7 +32,7 @@
#include "datavectors.h"
#include <kxmlguiwindow.h>
-#include <kurl.h>
+#include <QUrl>
#include <QList>
@@ -127,11 +127,11 @@ public:
* @param format The file format
* @param url The url
*/
- virtual bool importFile(Import::Format format, const KUrl& url, Import::Action \
action); + virtual bool importFile(Import::Format format, const QUrl& url, \
Import::Action action); /**
* Used by DCOP to export to a file.
*/
- virtual bool exportCollection(Export::Format format, const KUrl& url);
+ virtual bool exportCollection(Export::Format format, const QUrl& url);
/**
* Used by DCOP
*/
@@ -161,13 +161,13 @@ public slots:
*
* @param url The url to open
*/
- void slotFileOpen(const KUrl& url);
+ void slotFileOpen(const QUrl& url);
/**
* Opens a file from the recent files menu
*
* @param url The url sent by the RecentFilesAction
*/
- void slotFileOpenRecent(const KUrl& url);
+ void slotFileOpenRecent(const QUrl& url);
/**
* Saves the document
*/
@@ -304,7 +304,7 @@ public slots:
/**
* Handle a url that indicates some actino should be taken
*/
- void slotURLAction(const KUrl& url);
+ void slotURLAction(const QUrl& url);
private:
/**
@@ -355,7 +355,7 @@ private:
*
* @param url The url to open
*/
- bool openURL(const KUrl& url);
+ bool openURL(const QUrl& url);
/*
* Helper method to handle the printing duties.
*
@@ -469,7 +469,7 @@ private slots:
void slotToggleMenuBarVisibility();
private:
- void importFile(Import::Format format, const KUrl::List& kurls);
+ void importFile(Import::Format format, const QList<QUrl>& kurls);
void importText(Import::Format format, const QString& text);
bool importCollection(Data::CollPtr coll, Import::Action action);
diff --git a/src/reportdialog.cpp b/src/reportdialog.cpp
index 94ff858..26ba368 100644
--- a/src/reportdialog.cpp
+++ b/src/reportdialog.cpp
@@ -191,7 +191,7 @@ void ReportDialog::slotRefresh() {
// by setting the xslt file as the URL, any images referenced in the xslt "theme" \
can be found // by simply using a relative path in the xslt file
- KUrl u;
+ QUrl u;
u.setPath(m_xsltFile);
m_HTMLPart->begin(u);
m_HTMLPart->write(m_exporter->text());
@@ -215,7 +215,7 @@ void ReportDialog::slotPrint() {
void ReportDialog::slotSaveAs() {
QString filter = i18n("*.html|HTML Files (*.html)") + QLatin1Char('\n') + \
i18n("*|All Files");
- KUrl u = KFileDialog::getSaveUrl(KUrl(), filter, this);
+ QUrl u = KFileDialog::getSaveUrl(QUrl(), filter, this);
if(!u.isEmpty() && u.isValid()) {
KConfigGroup config(KGlobal::config(), "ExportOptions");
bool encode = config.readEntry("EncodeUTF8", true);
@@ -228,7 +228,7 @@ void ReportDialog::slotSaveAs() {
options |= Export::ExportUTF8;
}
- KUrl oldURL = m_exporter->url();
+ QUrl oldURL = m_exporter->url();
m_exporter->setOptions(options);
m_exporter->setURL(u);
diff --git a/src/tellico_kernel.cpp b/src/tellico_kernel.cpp
index d1ad324..5396a46 100644
--- a/src/tellico_kernel.cpp
+++ b/src/tellico_kernel.cpp
@@ -59,7 +59,7 @@ Kernel::Kernel(Tellico::MainWindow* parent) : m_widget(parent)
, m_commandHistory(new KUndoStack(parent)) {
}
-KUrl Kernel::URL() const {
+QUrl Kernel::URL() const {
return Data::Document::self()->URL();
}
diff --git a/src/tellico_kernel.h b/src/tellico_kernel.h
index ca5f252..907fb4f 100644
--- a/src/tellico_kernel.h
+++ b/src/tellico_kernel.h
@@ -28,13 +28,13 @@
#include "datavectors.h"
#include "borrower.h"
-class KUrl;
class KUndoStack;
class QWidget;
class QString;
class QStringList;
class QUndoCommand;
+class QUrl;
namespace Tellico {
class MainWindow;
@@ -67,7 +67,7 @@ public:
*
* @return The URL
*/
- KUrl URL() const;
+ QUrl URL() const;
/**
* Returns a list of the field titles, wraps the call to the collection itself.
*
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 369b6f4..b366200 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -100,7 +100,6 @@ TARGET_LINK_LIBRARIES(translatorstest
Qt5::Xml
KF5::I18n
KF5::Codecs
- KF5::KDELibs4Support # remove when BibtexHandler is clean of KUrl
${LIBXML2_LIBRARIES}
${LIBXSLT_LIBRARIES}
${LIBXSLT_EXSLT_LIBRARIES}
diff --git a/src/tests/adstest.cpp b/src/tests/adstest.cpp
index 9c80ca2..e156746 100644
--- a/src/tests/adstest.cpp
+++ b/src/tests/adstest.cpp
@@ -35,8 +35,8 @@
QTEST_APPLESS_MAIN( AdsTest )
void AdsTest::testImport() {
- KUrl url(QFINDTESTDATA("data/test.ads"));
- KUrl::List urls;
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test.ads"));
+ QList<QUrl> urls;
urls << url;
Tellico::Import::ADSImporter importer(urls);
Tellico::Data::CollPtr coll = importer.collection();
diff --git a/src/tests/alexandriatest.cpp b/src/tests/alexandriatest.cpp
index f59fbb7..2524a70 100644
--- a/src/tests/alexandriatest.cpp
+++ b/src/tests/alexandriatest.cpp
@@ -79,7 +79,7 @@ void AlexandriaTest::testImport() {
Tellico::Export::AlexandriaExporter exporter(coll);
exporter.setEntries(coll->entries());
- exporter.setURL(outputDir.path());
+ exporter.setURL(QUrl::fromLocalFile(outputDir.path()));
QVERIFY(exporter.exec());
importer.setLibraryPath(outputDir.path() + "/.alexandria/" + coll->title());
diff --git a/src/tests/amctest.cpp b/src/tests/amctest.cpp
index 3c66ab2..505f1b8 100644
--- a/src/tests/amctest.cpp
+++ b/src/tests/amctest.cpp
@@ -35,7 +35,7 @@ QTEST_GUILESS_MAIN( AmcTest )
// this is a real basic test right now, AMC doesn't run real well under wine
void AmcTest::testImport() {
- KUrl url(QFINDTESTDATA("data/test.amc"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test.amc"));
Tellico::Import::AMCImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
diff --git a/src/tests/bibtexmltest.cpp b/src/tests/bibtexmltest.cpp
index c5876d5..f28562d 100644
--- a/src/tests/bibtexmltest.cpp
+++ b/src/tests/bibtexmltest.cpp
@@ -37,7 +37,7 @@ QTEST_GUILESS_MAIN( BibtexmlTest )
#define QL1(x) QString::fromLatin1(x)
void BibtexmlTest::testImport() {
- KUrl url(QFINDTESTDATA("data/test.bibtexml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test.bibtexml"));
Tellico::Import::BibtexmlImporter importer(url);
// shut the importer up about current collection
diff --git a/src/tests/bibtextest.cpp b/src/tests/bibtextest.cpp
index 0b52150..6777774 100644
--- a/src/tests/bibtextest.cpp
+++ b/src/tests/bibtextest.cpp
@@ -49,8 +49,8 @@ void BibtexTest::initTestCase() {
void BibtexTest::testImport() {
KSharedConfigPtr config = \
KSharedConfig::openConfig(QFINDTESTDATA("tellicotest.config"), \
KConfig::SimpleConfig);
- KUrl::List urls;
- urls << KUrl(QFINDTESTDATA("data/test.bib"));
+ QList<QUrl> urls;
+ urls << QUrl::fromLocalFile(QFINDTESTDATA("data/test.bib"));
Tellico::Import::BibtexImporter importer(urls);
// shut the importer up about current collection
diff --git a/src/tests/ciwtest.cpp b/src/tests/ciwtest.cpp
index 3627936..9adbae5 100644
--- a/src/tests/ciwtest.cpp
+++ b/src/tests/ciwtest.cpp
@@ -35,8 +35,8 @@
QTEST_APPLESS_MAIN( CiwTest )
void CiwTest::testImport() {
- KUrl url(QFINDTESTDATA("/data/test.ciw"));
- KUrl::List urls;
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("/data/test.ciw"));
+ QList<QUrl> urls;
urls << url;
Tellico::Import::CIWImporter importer(urls);
Tellico::Data::CollPtr coll = importer.collection();
diff --git a/src/tests/delicioustest.cpp b/src/tests/delicioustest.cpp
index db57ac4..3a9c16f 100644
--- a/src/tests/delicioustest.cpp
+++ b/src/tests/delicioustest.cpp
@@ -53,7 +53,7 @@ void DeliciousTest::initTestCase() {
}
void DeliciousTest::testBooks1() {
- KUrl url(QFINDTESTDATA("data/delicious1_books.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/delicious1_books.xml"));
Tellico::Import::DeliciousImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -78,7 +78,7 @@ void DeliciousTest::testBooks1() {
}
void DeliciousTest::testBooks2() {
- KUrl url(QFINDTESTDATA("data/delicious2_books.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/delicious2_books.xml"));
Tellico::Import::DeliciousImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -106,7 +106,7 @@ void DeliciousTest::testBooks2() {
}
void DeliciousTest::testMovies1() {
- KUrl url(QFINDTESTDATA("data/delicious1_movies.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/delicious1_movies.xml"));
Tellico::Import::DeliciousImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -158,7 +158,7 @@ void DeliciousTest::testMovies1() {
}
void DeliciousTest::testMovies2() {
- KUrl url(QFINDTESTDATA("data/delicious2_movies.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/delicious2_movies.xml"));
Tellico::Import::DeliciousImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -191,7 +191,7 @@ void DeliciousTest::testMovies2() {
}
void DeliciousTest::testMusic1() {
- KUrl url(QFINDTESTDATA("data/delicious1_music.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/delicious1_music.xml"));
Tellico::Import::DeliciousImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -215,7 +215,7 @@ void DeliciousTest::testMusic1() {
}
void DeliciousTest::testMusic2() {
- KUrl url(QFINDTESTDATA("data/delicious2_music.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/delicious2_music.xml"));
Tellico::Import::DeliciousImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -237,7 +237,7 @@ void DeliciousTest::testMusic2() {
}
void DeliciousTest::testGames1() {
- KUrl url(QFINDTESTDATA("data/delicious1_games.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/delicious1_games.xml"));
Tellico::Import::DeliciousImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
diff --git a/src/tests/gcstartest.cpp b/src/tests/gcstartest.cpp
index a2f3336..35fff48 100644
--- a/src/tests/gcstartest.cpp
+++ b/src/tests/gcstartest.cpp
@@ -49,7 +49,7 @@ void GCstarTest::initTestCase() {
}
void GCstarTest::testBook() {
- KUrl url(QFINDTESTDATA("data/test-book.gcs"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-book.gcs"));
Tellico::Import::GCstarImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -101,7 +101,7 @@ void GCstarTest::testBook() {
}
void GCstarTest::testComicBook() {
- KUrl url(QFINDTESTDATA("data/test-comicbook.gcs"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-comicbook.gcs"));
Tellico::Import::GCstarImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -159,7 +159,7 @@ void GCstarTest::testComicBook() {
}
void GCstarTest::testVideo() {
- KUrl url(QFINDTESTDATA("data/test-video.gcs"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-video.gcs"));
Tellico::Import::GCstarImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -228,7 +228,7 @@ void GCstarTest::testVideo() {
}
void GCstarTest::testMusic() {
- KUrl url(QFINDTESTDATA("data/test-music.gcs"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-music.gcs"));
Tellico::Import::GCstarImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -279,7 +279,7 @@ void GCstarTest::testMusic() {
}
void GCstarTest::testVideoGame() {
- KUrl url(QFINDTESTDATA("data/test-videogame.gcs"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-videogame.gcs"));
Tellico::Import::GCstarImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -324,7 +324,7 @@ void GCstarTest::testVideoGame() {
}
void GCstarTest::testBoardGame() {
- KUrl url(QFINDTESTDATA("data/test-boardgame.gcs"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-boardgame.gcs"));
Tellico::Import::GCstarImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -370,7 +370,7 @@ void GCstarTest::testBoardGame() {
}
void GCstarTest::testWine() {
- KUrl url(QFINDTESTDATA("data/test-wine.gcs"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-wine.gcs"));
Tellico::Import::GCstarImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -423,7 +423,7 @@ void GCstarTest::testWine() {
}
void GCstarTest::testCoin() {
- KUrl url(QFINDTESTDATA("data/test-coin.gcs"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-coin.gcs"));
Tellico::Import::GCstarImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -469,7 +469,7 @@ void GCstarTest::testCoin() {
}
void GCstarTest::testCustomFields() {
- KUrl url(QFINDTESTDATA("data/test-book.gcs"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-book.gcs"));
Tellico::Import::GCstarImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
diff --git a/src/tests/griffithtest.cpp b/src/tests/griffithtest.cpp
index 2d84ceb..06753d2 100644
--- a/src/tests/griffithtest.cpp
+++ b/src/tests/griffithtest.cpp
@@ -48,7 +48,7 @@ void GriffithTest::initTestCase() {
}
void GriffithTest::testMovies() {
- KUrl url(QFINDTESTDATA("data/griffith.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/griffith.xml"));
Tellico::Import::GriffithImporter importer(url);
// can't import images for local test
importer.setOptions(importer.options() & ~Tellico::Import::ImportShowImageErrors);
diff --git a/src/tests/imagetest.cpp b/src/tests/imagetest.cpp
index 45d108c..ec2abb1 100644
--- a/src/tests/imagetest.cpp
+++ b/src/tests/imagetest.cpp
@@ -37,8 +37,8 @@ void ImageTest::initTestCase() {
}
void ImageTest::testLinkOnly() {
- KUrl u(QFINDTESTDATA("../../icons/hi128-app-tellico.png"));
+ QUrl u = QUrl::fromLocalFile(QFINDTESTDATA("../../icons/hi128-app-tellico.png"));
// addImage(url, quiet, referer, link)
- QString id = Tellico::ImageFactory::addImage(u, false, KUrl(), true);
+ QString id = Tellico::ImageFactory::addImage(u, false, QUrl(), true);
QCOMPARE(id, u.url());
}
diff --git a/src/tests/referencertest.cpp b/src/tests/referencertest.cpp
index 263e5fe..814b29f 100644
--- a/src/tests/referencertest.cpp
+++ b/src/tests/referencertest.cpp
@@ -45,7 +45,7 @@ void ReferencerTest::initTestCase() {
}
void ReferencerTest::testImport() {
- KUrl url(QFINDTESTDATA("data/test.reflib"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test.reflib"));
Tellico::Import::ReferencerImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
diff --git a/src/tests/ristest.cpp b/src/tests/ristest.cpp
index f4bd351..a2565f4 100644
--- a/src/tests/ristest.cpp
+++ b/src/tests/ristest.cpp
@@ -35,8 +35,8 @@
QTEST_APPLESS_MAIN( RisTest )
void RisTest::testImport() {
- KUrl url(QFINDTESTDATA("data/test.ris"));
- KUrl::List urls;
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test.ris"));
+ QList<QUrl> urls;
urls << url;
Tellico::Import::RISImporter importer(urls);
// shut the importer up about current collection
diff --git a/src/tests/tellicoreadtest.cpp b/src/tests/tellicoreadtest.cpp
index ef97abe..b1da249 100644
--- a/src/tests/tellicoreadtest.cpp
+++ b/src/tests/tellicoreadtest.cpp
@@ -48,7 +48,7 @@ void TellicoReadTest::initTestCase() {
Tellico::RegisterCollection<Tellico::Data::Collection> \
registerBase(Tellico::Data::Collection::Base, "entry");
for(int i = 1; i < TELLICOREAD_NUMBER_OF_CASES; ++i) {
- KUrl url(QFINDTESTDATA(QL1("data/books-format%1.bc").arg(i)));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA(QL1("data/books-format%1.bc").arg(i)));
Tellico::Import::TellicoImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -112,7 +112,7 @@ void TellicoReadTest::testEntries_data() {
}
void TellicoReadTest::testCoinCollection() {
- KUrl url(QFINDTESTDATA("data/coins-format9.tc"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/coins-format9.tc"));
Tellico::Import::TellicoImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -133,7 +133,7 @@ void TellicoReadTest::testCoinCollection() {
}
void TellicoReadTest::testTableData() {
- KUrl url(QFINDTESTDATA("/data/tabletest.tc"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("/data/tabletest.tc"));
Tellico::Import::TellicoImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -182,7 +182,7 @@ void TellicoReadTest::testTableData() {
}
void TellicoReadTest::testDuplicateLoans() {
- KUrl url(QFINDTESTDATA("/data/duplicate_loan.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("/data/duplicate_loan.xml"));
Tellico::Import::TellicoImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
@@ -198,7 +198,7 @@ void TellicoReadTest::testDuplicateLoans() {
}
void TellicoReadTest::testDuplicateBorrowers() {
- KUrl url(QFINDTESTDATA("/data/duplicate_borrower.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("/data/duplicate_borrower.xml"));
Tellico::Import::TellicoImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
diff --git a/src/tests/vinoxmltest.cpp b/src/tests/vinoxmltest.cpp
index 352f5f0..36ec972 100644
--- a/src/tests/vinoxmltest.cpp
+++ b/src/tests/vinoxmltest.cpp
@@ -46,7 +46,7 @@ void VinoXMLTest::initTestCase() {
}
void VinoXMLTest::testImport() {
- KUrl url(QFINDTESTDATA("data/test-vinoxml.xml"));
+ QUrl url = QUrl::fromLocalFile(QFINDTESTDATA("data/test-vinoxml.xml"));
Tellico::Import::VinoXMLImporter importer(url);
Tellico::Data::CollPtr coll = importer.collection();
diff --git a/src/translators/adsimporter.cpp b/src/translators/adsimporter.cpp
index 2b19bdd..c2aaa52 100644
--- a/src/translators/adsimporter.cpp
+++ b/src/translators/adsimporter.cpp
@@ -55,7 +55,7 @@ void ADSImporter::initTagMap() {
}
}
-ADSImporter::ADSImporter(const KUrl::List& urls_) : \
Tellico::Import::Importer(urls_), m_coll(0), m_cancelled(false) { \
+ADSImporter::ADSImporter(const QList<QUrl>& urls_) : \
Tellico::Import::Importer(urls_), m_coll(0), m_cancelled(false) { initTagMap();
}
@@ -77,7 +77,7 @@ Tellico::Data::CollPtr ADSImporter::collection() {
if(text().isEmpty()) {
int count = 0;
- foreach(const KUrl& url, urls()) {
+ foreach(const QUrl& url, urls()) {
if(m_cancelled) {
break;
}
@@ -94,7 +94,7 @@ Tellico::Data::CollPtr ADSImporter::collection() {
return m_coll;
}
-void ADSImporter::readURL(const KUrl& url_, int n) {
+void ADSImporter::readURL(const QUrl& url_, int n) {
QString str = FileHandler::readTextFile(url_);
if(str.isEmpty()) {
return;
diff --git a/src/translators/adsimporter.h b/src/translators/adsimporter.h
index 6129bef..ae53c59 100644
--- a/src/translators/adsimporter.h
+++ b/src/translators/adsimporter.h
@@ -43,7 +43,7 @@ Q_OBJECT
public:
/**
*/
- ADSImporter(const KUrl::List& urls);
+ ADSImporter(const QList<QUrl>& urls);
ADSImporter(const QString& text);
/**
@@ -62,7 +62,7 @@ private:
static void initTagMap();
Data::FieldPtr fieldByTag(const QString& tag);
- void readURL(const KUrl& url, int n);
+ void readURL(const QUrl& url, int n);
void readText(const QString& text, int n);
Data::CollPtr m_coll;
diff --git a/src/translators/alexandriaexporter.cpp \
b/src/translators/alexandriaexporter.cpp index 2d9fabb..f3e06e1 100644
--- a/src/translators/alexandriaexporter.cpp
+++ b/src/translators/alexandriaexporter.cpp
@@ -69,7 +69,7 @@ bool AlexandriaExporter::exec() {
const QString alexDirName = QLatin1String(".alexandria");
// create if necessary
- const KUrl u = url();
+ const QUrl u = url();
QDir libraryDir;
if(u.isEmpty()) {
libraryDir = QDir::home();
diff --git a/src/translators/alexandriaimporter.cpp \
b/src/translators/alexandriaimporter.cpp index d319724..f3fcd5c 100644
--- a/src/translators/alexandriaimporter.cpp
+++ b/src/translators/alexandriaimporter.cpp
@@ -168,10 +168,9 @@ Tellico::Data::CollPtr AlexandriaImporter::collection() {
entry->setField(isbn, alexValue);
// now find cover image
- KUrl u;
alexValue.remove(QLatin1Char('-'));
for(QStringList::Iterator ext = covers.begin(); ext != covers.end(); ++ext) \
{
- u.setPath(dataDir.absoluteFilePath(alexValue + *ext));
+ QUrl u = QUrl::fromLocalFile(dataDir.absoluteFilePath(alexValue + *ext));
if(!QFile::exists(u.path())) {
continue;
}
diff --git a/src/translators/amcimporter.cpp b/src/translators/amcimporter.cpp
index 0bfab2a..3502939 100644
--- a/src/translators/amcimporter.cpp
+++ b/src/translators/amcimporter.cpp
@@ -48,7 +48,7 @@ namespace {
using Tellico::Import::AMCImporter;
-AMCImporter::AMCImporter(const KUrl& url_) : DataImporter(url_), m_cancelled(false), \
m_failed(false) { +AMCImporter::AMCImporter(const QUrl& url_) : DataImporter(url_), \
m_cancelled(false), m_failed(false) { }
AMCImporter::~AMCImporter() {
diff --git a/src/translators/amcimporter.h b/src/translators/amcimporter.h
index 237ed04..f5f614f 100644
--- a/src/translators/amcimporter.h
+++ b/src/translators/amcimporter.h
@@ -36,7 +36,7 @@ namespace Tellico {
class AMCImporter : public DataImporter {
Q_OBJECT
public:
- AMCImporter(const KUrl& url);
+ AMCImporter(const QUrl& url);
virtual ~AMCImporter();
virtual Data::CollPtr collection();
diff --git a/src/translators/audiofileimporter.cpp \
b/src/translators/audiofileimporter.cpp index 3274de8..e0224f7 100644
--- a/src/translators/audiofileimporter.cpp
+++ b/src/translators/audiofileimporter.cpp
@@ -58,7 +58,7 @@
using Tellico::Import::AudioFileImporter;
-AudioFileImporter::AudioFileImporter(const KUrl& url_) : \
Tellico::Import::Importer(url_) +AudioFileImporter::AudioFileImporter(const QUrl& \
url_) : Tellico::Import::Importer(url_) , m_widget(0)
, m_cancelled(false) {
}
@@ -358,7 +358,7 @@ Tellico::Data::CollPtr AudioFileImporter::collection() {
if(!entry) {
continue;
}
- KUrl u;
+ QUrl u;
u.setPath(fi.absoluteFilePath());
QString id = ImageFactory::addImage(u, true);
if(!id.isEmpty()) {
diff --git a/src/translators/audiofileimporter.h \
b/src/translators/audiofileimporter.h index d644ea4..9b353b5 100644
--- a/src/translators/audiofileimporter.h
+++ b/src/translators/audiofileimporter.h
@@ -48,7 +48,7 @@ Q_OBJECT
public:
/**
*/
- AudioFileImporter(const KUrl& url);
+ AudioFileImporter(const QUrl& url);
/**
*/
diff --git a/src/translators/bibteximporter.cpp b/src/translators/bibteximporter.cpp
index b922b50..6d61519 100644
--- a/src/translators/bibteximporter.cpp
+++ b/src/translators/bibteximporter.cpp
@@ -47,7 +47,7 @@ using Tellico::Import::BibtexImporter;
int BibtexImporter::s_initCount = 0;
-BibtexImporter::BibtexImporter(const KUrl::List& urls_) : Importer(urls_)
+BibtexImporter::BibtexImporter(const QList<QUrl>& urls_) : Importer(urls_)
, m_widget(0), m_readUTF8(0), m_readLocale(0), m_cancelled(false) {
init();
}
@@ -102,8 +102,7 @@ Tellico::Data::CollPtr BibtexImporter::collection() {
}
}
- const KUrl::List urls = this->urls();
- foreach(const KUrl& url, urls) {
+ foreach(const QUrl& url, urls()) {
if(m_cancelled) {
return Data::CollPtr();
}
@@ -355,7 +354,7 @@ QWidget* BibtexImporter::widget(QWidget* parent_) {
return m_widget;
}
-bool BibtexImporter::maybeBibtex(const KUrl& url_) {
+bool BibtexImporter::maybeBibtex(const QUrl& url_) {
QString text = FileHandler::readTextFile(url_, true /*quiet*/);
if(text.isEmpty()) {
return false;
@@ -363,7 +362,7 @@ bool BibtexImporter::maybeBibtex(const KUrl& url_) {
return maybeBibtex(text, url_);
}
-bool BibtexImporter::maybeBibtex(const QString& text, const KUrl& url_) {
+bool BibtexImporter::maybeBibtex(const QString& text, const QUrl& url_) {
bt_initialize();
QRegExp rx(QLatin1String("[{}]"));
diff --git a/src/translators/bibteximporter.h b/src/translators/bibteximporter.h
index c58b0b2..6748fdd 100644
--- a/src/translators/bibteximporter.h
+++ b/src/translators/bibteximporter.h
@@ -63,7 +63,7 @@ public:
*
* @param url The url of the bibtex file
*/
- BibtexImporter(const KUrl::List& urls);
+ BibtexImporter(const QList<QUrl>& urls);
BibtexImporter(const QString& text);
/*
* Some cleanup is done for the btparse library
@@ -80,8 +80,8 @@ public:
virtual QWidget* widget(QWidget* parent);
virtual bool canImport(int type) const;
- static bool maybeBibtex(const KUrl& url);
- static bool maybeBibtex(const QString& text, const KUrl& url = KUrl());
+ static bool maybeBibtex(const QUrl& url);
+ static bool maybeBibtex(const QString& text, const QUrl& url = QUrl());
public slots:
void slotCancel();
diff --git a/src/translators/bibtexmlimporter.cpp \
b/src/translators/bibtexmlimporter.cpp index 90a19e0..7f3fe49 100644
--- a/src/translators/bibtexmlimporter.cpp
+++ b/src/translators/bibtexmlimporter.cpp
@@ -35,7 +35,7 @@
using Tellico::Import::BibtexmlImporter;
-BibtexmlImporter::BibtexmlImporter(const KUrl& url) : Import::XMLImporter(url), \
m_cancelled(false) { +BibtexmlImporter::BibtexmlImporter(const QUrl& url) : \
Import::XMLImporter(url), m_cancelled(false) { }
BibtexmlImporter::BibtexmlImporter(const QString& text) : Import::XMLImporter(text), \
m_cancelled(false) {
diff --git a/src/translators/bibtexmlimporter.h b/src/translators/bibtexmlimporter.h
index 406fafe..2cb2521 100644
--- a/src/translators/bibtexmlimporter.h
+++ b/src/translators/bibtexmlimporter.h
@@ -42,7 +42,7 @@ Q_OBJECT
public:
/**
*/
- BibtexmlImporter(const KUrl& url);
+ BibtexmlImporter(const QUrl& url);
BibtexmlImporter(const QString& text);
/**
diff --git a/src/translators/boardgamegeekimporter.cpp \
b/src/translators/boardgamegeekimporter.cpp index d93e030..bbf975c 100644
--- a/src/translators/boardgamegeekimporter.cpp
+++ b/src/translators/boardgamegeekimporter.cpp
@@ -54,7 +54,7 @@ using Tellico::Import::BoardGameGeekImporter;
BoardGameGeekImporter::BoardGameGeekImporter() : Import::Importer(), \
m_cancelled(false), m_widget(0) { QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("boardgamegeek2tellico.xsl")); \
if(!xsltFile.isEmpty()) {
- m_xsltURL.setPath(xsltFile);
+ m_xsltURL = QUrl::fromLocalFile(xsltFile);
} else {
myWarning() << "unable to find boardgamegeek2tellico.xsl!";
}
@@ -98,7 +98,7 @@ Tellico::Data::CollPtr BoardGameGeekImporter::collection() {
m_ownedOnly = m_checkOwned->isChecked();
// first get the bgg id list
- KUrl u(BGG_COLLECTION_URL);
+ QUrl u(QString::fromLatin1(BGG_COLLECTION_URL));
u.addQueryItem(QLatin1String("username"), m_user);
u.addQueryItem(QLatin1String("subtype"), QLatin1String("boardgame"));
u.addQueryItem(QLatin1String("brief"), QLatin1String("1"));
@@ -228,7 +228,7 @@ QWidget* BoardGameGeekImporter::widget(QWidget* parent_) {
QString BoardGameGeekImporter::text(const QStringList& idList_) const {
// myDebug() << idList_;
- KUrl u(BGG_THING_URL);
+ QUrl u(QString::fromLatin1(BGG_THING_URL));
u.addQueryItem(QLatin1String("id"), idList_.join(QLatin1String(",")));
u.addQueryItem(QLatin1String("type"), \
QLatin1String("boardgame,boardgameexpansion")); // myDebug() << u;
diff --git a/src/translators/boardgamegeekimporter.h \
b/src/translators/boardgamegeekimporter.h index 0764a69..166cdb6 100644
--- a/src/translators/boardgamegeekimporter.h
+++ b/src/translators/boardgamegeekimporter.h
@@ -63,7 +63,7 @@ private:
KLineEdit* m_userEdit;
QCheckBox* m_checkOwned;
- KUrl m_xsltURL;
+ QUrl m_xsltURL;
QString m_user;
bool m_ownedOnly;
};
diff --git a/src/translators/ciwimporter.cpp b/src/translators/ciwimporter.cpp
index 2e74be0..acec635 100644
--- a/src/translators/ciwimporter.cpp
+++ b/src/translators/ciwimporter.cpp
@@ -65,7 +65,7 @@ void CIWImporter::initTagMap() {
}
}
-CIWImporter::CIWImporter(const KUrl::List& urls_) : \
Tellico::Import::Importer(urls_), m_coll(0), m_cancelled(false) { \
+CIWImporter::CIWImporter(const QList<QUrl>& urls_) : \
Tellico::Import::Importer(urls_), m_coll(0), m_cancelled(false) { initTagMap();
}
@@ -88,7 +88,7 @@ Tellico::Data::CollPtr CIWImporter::collection() {
if(text().isEmpty()) {
int count = 0;
- foreach(const KUrl& url, urls()) {
+ foreach(const QUrl& url, urls()) {
if(m_cancelled) {
break;
}
@@ -105,7 +105,7 @@ Tellico::Data::CollPtr CIWImporter::collection() {
return m_coll;
}
-void CIWImporter::readURL(const KUrl& url_, int n) {
+void CIWImporter::readURL(const QUrl& url_, int n) {
QString str = FileHandler::readTextFile(url_);
if(str.isEmpty()) {
return;
@@ -250,7 +250,7 @@ void CIWImporter::slotCancel() {
m_cancelled = true;
}
-bool CIWImporter::maybeCIW(const KUrl& url_) {
+bool CIWImporter::maybeCIW(const QUrl& url_) {
QString text = FileHandler::readTextFile(url_, true /*quiet*/);
if(text.isEmpty()) {
return false;
diff --git a/src/translators/ciwimporter.h b/src/translators/ciwimporter.h
index 250cc6d..79091af 100644
--- a/src/translators/ciwimporter.h
+++ b/src/translators/ciwimporter.h
@@ -43,7 +43,7 @@ Q_OBJECT
public:
/**
*/
- CIWImporter(const KUrl::List& urls);
+ CIWImporter(const QList<QUrl>& urls);
CIWImporter(const QString& text);
/**
@@ -55,7 +55,7 @@ public:
virtual QWidget* widget(QWidget*) { return 0; }
virtual bool canImport(int type) const;
- static bool maybeCIW(const KUrl& url);
+ static bool maybeCIW(const QUrl& url);
public slots:
void slotCancel();
@@ -64,7 +64,7 @@ private:
static void initTagMap();
Data::FieldPtr fieldByTag(const QString& tag);
- void readURL(const KUrl& url, int n);
+ void readURL(const QUrl& url, int n);
void readText(const QString& text, int n);
Data::CollPtr m_coll;
diff --git a/src/translators/csvimporter.cpp b/src/translators/csvimporter.cpp
index b61fd33..c0c42e8 100644
--- a/src/translators/csvimporter.cpp
+++ b/src/translators/csvimporter.cpp
@@ -57,7 +57,7 @@
using Tellico::Import::CSVImporter;
-CSVImporter::CSVImporter(const KUrl& url_) : Tellico::Import::TextImporter(url_),
+CSVImporter::CSVImporter(const QUrl& url_) : Tellico::Import::TextImporter(url_),
m_existingCollection(0),
m_firstRowHeader(false),
m_delimiter(QLatin1String(",")),
diff --git a/src/translators/csvimporter.h b/src/translators/csvimporter.h
index c31707b..d4a72e6 100644
--- a/src/translators/csvimporter.h
+++ b/src/translators/csvimporter.h
@@ -55,7 +55,7 @@ Q_OBJECT
public:
/**
*/
- CSVImporter(const KUrl& url);
+ CSVImporter(const QUrl& url);
~CSVImporter();
/**
diff --git a/src/translators/dataimporter.cpp b/src/translators/dataimporter.cpp
index 4203f3e..cec2b3d 100644
--- a/src/translators/dataimporter.cpp
+++ b/src/translators/dataimporter.cpp
@@ -26,7 +26,7 @@
using Tellico::Import::DataImporter;
-DataImporter::DataImporter(const KUrl& url) : Importer(url), m_source(URL) {
+DataImporter::DataImporter(const QUrl& url) : Importer(url), m_source(URL) {
m_fileRef = FileHandler::fileRef(url);
}
diff --git a/src/translators/dataimporter.h b/src/translators/dataimporter.h
index 561fd2a..2aeb65a 100644
--- a/src/translators/dataimporter.h
+++ b/src/translators/dataimporter.h
@@ -43,8 +43,8 @@ public:
/**
* @param url The URL of the file to import
*/
-// DataImporter(const KUrl& url) : Importer(url), \
m_data(FileHandler::readDataFile(url)), m_source(URL) {}
- DataImporter(const KUrl& url);
+// DataImporter(const QUrl& url) : Importer(url), \
m_data(FileHandler::readDataFile(url)), m_source(URL) {} + DataImporter(const QUrl& \
url); /**
* Since the conversion to a QCString appends a \0 character at the end, remove \
it.
*
diff --git a/src/translators/deliciousimporter.cpp \
b/src/translators/deliciousimporter.cpp index c52d802..3ad7ee4 100644
--- a/src/translators/deliciousimporter.cpp
+++ b/src/translators/deliciousimporter.cpp
@@ -34,11 +34,10 @@
using Tellico::Import::DeliciousImporter;
-DeliciousImporter::DeliciousImporter(const KUrl& url_) : XSLTImporter(url_) {
+DeliciousImporter::DeliciousImporter(const QUrl& url_) : XSLTImporter(url_) {
QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("delicious2tellico.xsl")); \
if(!xsltFile.isEmpty()) {
- KUrl u;
- u.setPath(xsltFile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
XSLTImporter::setXSLTURL(u);
} else {
myWarning() << "unable to find delicious2tellico.xml!";
@@ -58,8 +57,8 @@ Tellico::Data::CollPtr DeliciousImporter::collection() {
return Data::CollPtr();
}
- KUrl libraryDir = url();
- libraryDir.setPath(url().directory() + QLatin1String("Images/"));
+ QUrl libraryDir = url();
+ libraryDir.setPath(url().adjusted(QUrl::StripTrailingSlash|QUrl::RemoveFilename).path() \
+ QLatin1String("Images/")); const QStringList imageDirs = QStringList()
<< QLatin1String("Large Covers/")
<< QLatin1String("Medium Covers/")
diff --git a/src/translators/deliciousimporter.h \
b/src/translators/deliciousimporter.h index c0d2faf..e3018e1 100644
--- a/src/translators/deliciousimporter.h
+++ b/src/translators/deliciousimporter.h
@@ -40,7 +40,7 @@ Q_OBJECT
public:
/**
*/
- DeliciousImporter(const KUrl& url);
+ DeliciousImporter(const QUrl& url);
/**
*/
@@ -52,7 +52,7 @@ public:
private:
// private so it can't be changed accidently
- void setXSLTURL(const KUrl& url);
+ void setXSLTURL(const QUrl& url);
};
} // end namespace
diff --git a/src/translators/exporter.h b/src/translators/exporter.h
index bce631d..3abea95 100644
--- a/src/translators/exporter.h
+++ b/src/translators/exporter.h
@@ -28,7 +28,7 @@
#include "../entry.h"
#include "../datavectors.h"
-#include <kurl.h>
+#include <QUrl>
#include <ksharedconfig.h>
#include <QObject>
@@ -64,14 +64,14 @@ public:
Data::CollPtr collection() const;
- void setURL(const KUrl& url_) { m_url = url_; }
+ void setURL(const QUrl& url_) { m_url = url_; }
void setEntries(const Data::EntryList& entries) { m_entries = entries; }
void setFields(const Data::FieldList& fields) { m_fields = fields; }
void setOptions(long options) { m_options = options; reset(); }
virtual QString formatString() const = 0;
virtual QString fileFilter() const = 0;
- const KUrl& url() const { return m_url; }
+ const QUrl& url() const { return m_url; }
const Data::EntryList& entries() const { return m_entries; }
const Data::FieldList& fields() const;
long options() const { return m_options; }
@@ -95,7 +95,7 @@ private:
Data::CollPtr m_coll;
Data::EntryList m_entries;
Data::FieldList m_fields;
- KUrl m_url;
+ QUrl m_url;
};
} // end namespace
diff --git a/src/translators/filelistingimporter.cpp \
b/src/translators/filelistingimporter.cpp index 2eafbd9..33b1b71 100644
--- a/src/translators/filelistingimporter.cpp
+++ b/src/translators/filelistingimporter.cpp
@@ -51,6 +51,7 @@
#include <Nepomuk/ResourceManager>
#endif
+#include <QDir>
#include <QCheckBox>
#include <QGroupBox>
#include <QFile>
@@ -63,7 +64,7 @@ namespace {
using Tellico::Import::FileListingImporter;
-FileListingImporter::FileListingImporter(const KUrl& url_) : Importer(url_), \
m_coll(0), m_widget(0), +FileListingImporter::FileListingImporter(const QUrl& url_) : \
Importer(url_), m_coll(0), m_widget(0), m_job(0), m_cancelled(false) {
}
@@ -137,12 +138,12 @@ Tellico::Data::CollPtr FileListingImporter::collection() {
Data::EntryPtr entry(new Data::Entry(m_coll));
- const KUrl u = item.url();
+ const QUrl u = item.url();
entry->setField(title, u.fileName());
entry->setField(url, u.url());
entry->setField(desc, item.mimeComment());
entry->setField(vol, volume);
- tmp = KUrl::relativePath(this->url().toLocalFile(), u.directory());
+ tmp = QDir(this->url().toLocalFile()).relativeFilePath(u.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path());
// remove "./" from the string
entry->setField(folder, tmp.right(tmp.length()-2));
entry->setField(type, item.mimetype());
diff --git a/src/translators/filelistingimporter.h \
b/src/translators/filelistingimporter.h index d7d85e9..6dd7c0b 100644
--- a/src/translators/filelistingimporter.h
+++ b/src/translators/filelistingimporter.h
@@ -49,7 +49,7 @@ class FileListingImporter : public Importer {
Q_OBJECT
public:
- FileListingImporter(const KUrl& url);
+ FileListingImporter(const QUrl& url);
/**
* @return A pointer to a @ref Data::Collection, or 0 if none can be created.
diff --git a/src/translators/gcstarexporter.cpp b/src/translators/gcstarexporter.cpp
index a4e5dbf..a1f3539 100644
--- a/src/translators/gcstarexporter.cpp
+++ b/src/translators/gcstarexporter.cpp
@@ -86,9 +86,9 @@ bool GCstarExporter::exec() {
break;
}
- KUrl target;
- target.setPath(imgDir);
- target.setFileName(img.id());
+ QUrl target = QUrl::fromLocalFile(imgDir);
+ target = target.adjusted(QUrl::RemoveFilename);
+ target.setPath(target.path() + img.id());
// myDebug() << "Writing" << target.url();
success &= FileHandler::writeDataURL(target, img.byteArray(), true /* force \
*/); }
@@ -105,8 +105,8 @@ bool GCstarExporter::exec() {
}
QString GCstarExporter::text() {
- QString xsltfile = DataFileRegistry::self()->locate(m_xsltFile);
- if(xsltfile.isNull()) {
+ QString xsltFile = DataFileRegistry::self()->locate(m_xsltFile);
+ if(xsltFile.isNull()) {
myDebug() << "no xslt file for " << m_xsltFile;
return QString();
}
@@ -121,14 +121,13 @@ QString GCstarExporter::text() {
// all params should be passed to XSLTHandler in utf8
// input string to XSLTHandler should be in utf-8, EVEN IF DOM STRING SAYS \
OTHERWISE
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
// do NOT do namespace processing, it messes up the XSL declaration since
// QDom thinks there are no elements in the Tellico namespace and as a result
// removes the namespace declaration
QDomDocument dom = FileHandler::readXMLDocument(u, false);
if(dom.isNull()) {
- myDebug() << "error loading xslt file: " << xsltfile;
+ myDebug() << "error loading xslt file: " << xsltFile;
return QString();
}
@@ -139,7 +138,7 @@ QString GCstarExporter::text() {
}
delete m_handler;
- m_handler = new XSLTHandler(dom, QFile::encodeName(xsltfile));
+ m_handler = new XSLTHandler(dom, QFile::encodeName(xsltFile));
if(!m_handler || !m_handler->isValid()) {
myDebug() << "bad handler";
return QString();
diff --git a/src/translators/gcstarimporter.cpp b/src/translators/gcstarimporter.cpp
index 77acd55..67938bf 100644
--- a/src/translators/gcstarimporter.cpp
+++ b/src/translators/gcstarimporter.cpp
@@ -39,7 +39,7 @@
using Tellico::Import::GCstarImporter;
-GCstarImporter::GCstarImporter(const KUrl& url_) : TextImporter(url_, true), \
m_cancelled(false), m_relativeImageLinks(false) { \
+GCstarImporter::GCstarImporter(const QUrl& url_) : TextImporter(url_, true), \
m_cancelled(false), m_relativeImageLinks(false) { }
GCstarImporter::GCstarImporter(const QString& text_) : TextImporter(text_), \
m_cancelled(false), m_relativeImageLinks(false) { @@ -158,7 +158,7 @@ void \
GCstarImporter::readGCfilms(const QString& text_) {
entry->setField(QLatin1String("director"), splitJoin(rx, values[4]));
entry->setField(QLatin1String("nationality"), splitJoin(rx, values[5]));
entry->setField(QLatin1String("genre"), splitJoin(rx, values[6]));
- KUrl u = KUrl(values[7]);
+ QUrl u = QUrl(values[7]);
if(!u.isEmpty()) {
QString id = ImageFactory::addImage(u, true /* quiet */);
if(!id.isEmpty()) {
@@ -254,14 +254,14 @@ void GCstarImporter::readGCfilms(const QString& text_) {
void GCstarImporter::readGCstar(const QString& text_) {
QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("gcstar2tellico.xsl"));
- XSLTHandler handler(xsltFile);
+ XSLTHandler handler(QUrl::fromLocalFile(xsltFile));
if(!handler.isValid()) {
setStatusMessage(i18n("Tellico encountered an error in XSLT processing."));
return;
}
if(m_relativeImageLinks) {
- handler.addStringParam("baseDir", \
url().directory(KUrl::AppendTrailingSlash).toLocal8Bit()); + \
handler.addStringParam("baseDir", \
url().adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path().toLocal8Bit()); \
}
const QString str = handler.applyStylesheet(text_);
diff --git a/src/translators/gcstarimporter.h b/src/translators/gcstarimporter.h
index 2cfea18..ada1a12 100644
--- a/src/translators/gcstarimporter.h
+++ b/src/translators/gcstarimporter.h
@@ -42,7 +42,7 @@ Q_OBJECT
public:
/**
*/
- GCstarImporter(const KUrl& url);
+ GCstarImporter(const QUrl& url);
GCstarImporter(const QString& text);
/**
diff --git a/src/translators/goodreadsimporter.cpp \
b/src/translators/goodreadsimporter.cpp index 4d75625..1545d59 100644
--- a/src/translators/goodreadsimporter.cpp
+++ b/src/translators/goodreadsimporter.cpp
@@ -50,7 +50,7 @@ using Tellico::Import::GoodreadsImporter;
GoodreadsImporter::GoodreadsImporter() : Import::Importer(), m_widget(0) {
QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("goodreads2tellico.xsl")); \
if(!xsltFile.isEmpty()) {
- m_xsltURL.setPath(xsltFile);
+ m_xsltURL = QUrl::fromLocalFile(xsltFile);
} else {
myWarning() << "unable to find goodreads2tellico.xsl!";
}
@@ -137,7 +137,7 @@ QWidget* GoodreadsImporter::widget(QWidget* parent_) {
}
QString GoodreadsImporter::text() const {
- KUrl u(GOODREADS_LIST_URL);
+ QUrl u(QString::fromLatin1(GOODREADS_LIST_URL));
u.addQueryItem(QLatin1String("v"), QLatin1String("2"));
u.addQueryItem(QLatin1String("id"), m_user);
u.addQueryItem(QLatin1String("key"), m_key);
@@ -146,7 +146,7 @@ QString GoodreadsImporter::text() const {
}
QString GoodreadsImporter::idFromName(const QString& name_) const {
- KUrl u(GOODREADS_USER_URL);
+ QUrl u(QString::fromLatin1(GOODREADS_USER_URL));
u.addQueryItem(QLatin1String("username"), name_);
u.addQueryItem(QLatin1String("key"), m_key);
// myDebug() << u;
diff --git a/src/translators/goodreadsimporter.h \
b/src/translators/goodreadsimporter.h index 7f96e40..371c4cf 100644
--- a/src/translators/goodreadsimporter.h
+++ b/src/translators/goodreadsimporter.h
@@ -59,7 +59,7 @@ private:
QWidget* m_widget;
KLineEdit* m_userEdit;
- KUrl m_xsltURL;
+ QUrl m_xsltURL;
QString m_user;
QString m_key;
};
diff --git a/src/translators/griffithimporter.cpp \
b/src/translators/griffithimporter.cpp index 1d96b50..1d12235 100644
--- a/src/translators/griffithimporter.cpp
+++ b/src/translators/griffithimporter.cpp
@@ -33,11 +33,10 @@
using Tellico::Import::GriffithImporter;
-GriffithImporter::GriffithImporter(const KUrl& url_) : XSLTImporter(url_) {
+GriffithImporter::GriffithImporter(const QUrl& url_) : XSLTImporter(url_) {
QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("griffith2tellico.xsl")); \
if(!xsltFile.isEmpty()) {
- KUrl u;
- u.setPath(xsltFile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
setXSLTURL(u);
} else {
myWarning() << "unable to find griffith2tellico.xsl!";
diff --git a/src/translators/griffithimporter.h b/src/translators/griffithimporter.h
index 8e59b13..937a3d3 100644
--- a/src/translators/griffithimporter.h
+++ b/src/translators/griffithimporter.h
@@ -45,7 +45,7 @@ Q_OBJECT
public:
/**
*/
- GriffithImporter(const KUrl& url);
+ GriffithImporter(const QUrl& url);
/**
*/
virtual ~GriffithImporter();
diff --git a/src/translators/htmlexporter.cpp b/src/translators/htmlexporter.cpp
index 17b92c9..987bda2 100644
--- a/src/translators/htmlexporter.cpp
+++ b/src/translators/htmlexporter.cpp
@@ -49,6 +49,7 @@
#include <klocale.h>
#include <kuser.h>
+#include <QDir>
#include <QDomDocument>
#include <QGroupBox>
#include <QCheckBox>
@@ -161,20 +162,19 @@ bool HTMLExporter::exec() {
}
bool HTMLExporter::loadXSLTFile() {
- QString xsltfile = DataFileRegistry::self()->locate(m_xsltFile);
- if(xsltfile.isEmpty()) {
+ QString xsltFile = DataFileRegistry::self()->locate(m_xsltFile);
+ if(xsltFile.isEmpty()) {
myDebug() << "no xslt file for " << m_xsltFile;
return false;
}
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
// do NOT do namespace processing, it messes up the XSL declaration since
// QDom thinks there are no elements in the Tellico namespace and as a result
// removes the namespace declaration
QDomDocument dom = FileHandler::readXMLDocument(u, false);
if(dom.isNull()) {
- myDebug() << "error loading xslt file: " << xsltfile;
+ myDebug() << "error loading xslt file: " << xsltFile;
return false;
}
@@ -189,12 +189,12 @@ bool HTMLExporter::loadXSLTFile() {
}
delete m_handler;
- m_handler = new XSLTHandler(dom, QFile::encodeName(xsltfile), true /*translate*/);
+ m_handler = new XSLTHandler(dom, QFile::encodeName(xsltFile), true /*translate*/);
if(m_checkCommonFile && !m_handler->isValid()) {
Tellico::checkCommonXSLFile();
m_checkCommonFile = false;
delete m_handler;
- m_handler = new XSLTHandler(dom, QFile::encodeName(xsltfile), true \
/*translate*/); + m_handler = new XSLTHandler(dom, QFile::encodeName(xsltFile), \
true /*translate*/); }
if(!m_handler->isValid()) {
delete m_handler;
@@ -207,7 +207,7 @@ bool HTMLExporter::loadXSLTFile() {
if(m_exportEntryFiles) {
// export entries to same place as all the other date files
- m_handler->addStringParam("entrydir", QFile::encodeName(fileDir().fileName())+ \
'/'); + m_handler->addStringParam("entrydir", \
QFile::encodeName(fileDir().fileName()) + '/'); // be sure to link all the entries
m_handler->addParam("link-entries", "true()");
}
@@ -418,7 +418,7 @@ void HTMLExporter::writeImages(Tellico::Data::CollPtr coll_) {
// all of them are going to get written to tmp file
bool useTemp = url().isEmpty();
- KUrl imgDir;
+ QUrl imgDir;
QString imgDirRelative;
// really some convoluted logic here
// basically, four cases. 1) we're writing to a tmp file, for printing probably
@@ -429,7 +429,7 @@ void HTMLExporter::writeImages(Tellico::Data::CollPtr coll_) {
// probably an image in the entry template. 4) we're exporting HTML, and this is \
not the // first entry file, in which case, we want to refer directly to the target \
dir if(useTemp) { // everything goes in the tmp dir
- imgDir.setPath(ImageFactory::tempDir());
+ imgDir = QUrl::fromLocalFile(ImageFactory::tempDir());
imgDirRelative = imgDir.path();
} else if(m_parseDOM) {
imgDir = fileDir(); // copy to fileDir
@@ -437,7 +437,7 @@ void HTMLExporter::writeImages(Tellico::Data::CollPtr coll_) {
createDir();
} else {
imgDir = fileDir();
- imgDirRelative = KUrl::relativeUrl(url(), imgDir);
+ imgDirRelative = QDir(url().toLocalFile()).relativeFilePath(imgDir.path());
createDir();
}
m_handler->addStringParam("imgdir", QFile::encodeName(imgDirRelative));
@@ -461,8 +461,9 @@ void HTMLExporter::writeImages(Tellico::Data::CollPtr coll_) {
success = ImageFactory::imageInfo(id).linkOnly || \
ImageFactory::writeCachedImage(id, ImageFactory::TempDir); } else {
const Data::Image& img = ImageFactory::imageById(id);
- KUrl target = imgDir;
- target.addPath(id);
+ QUrl target = imgDir;
+ target = target.adjusted(QUrl::StripTrailingSlash);
+ target.setPath(target.path() + QLatin1Char('/') + (id));
success = !img.isNull() && FileHandler::writeDataURL(target, \
img.byteArray(), true); }
if(!success) {
@@ -544,14 +545,15 @@ void HTMLExporter::setXSLTFile(const QString& filename_) {
reset();
}
-KUrl HTMLExporter::fileDir() const {
+QUrl HTMLExporter::fileDir() const {
if(url().isEmpty()) {
- return KUrl();
+ return QUrl();
}
- KUrl fileDir = url();
+ QUrl fileDir = url();
// cd to directory of target URL
- fileDir.cd(QLatin1String(".."));
- fileDir.addPath(fileDirName());
+ fileDir = fileDir.resolved(QUrl(QLatin1String("..")));
+ fileDir = fileDir.adjusted(QUrl::StripTrailingSlash);
+ fileDir.setPath(fileDir.path() + QLatin1Char('/') + (fileDirName()));
return fileDir;
}
@@ -572,7 +574,7 @@ QString HTMLExporter::handleLink(const QString& link_) {
return m_links[link_];
}
// assume that if the link_ is not relative, then we don't need to copy it
- if(!KUrl::isRelativeUrl(link_)) {
+ if(!QUrl::fromUserInput(link_).isRelative()) {
return link_;
}
@@ -583,9 +585,8 @@ QString HTMLExporter::handleLink(const QString& link_) {
}
}
- KUrl u;
- u.setPath(m_xsltFilePath);
- u = KUrl(u, link_);
+ QUrl u = QUrl::fromLocalFile(m_xsltFilePath);
+ u = QUrl(u).resolved(link_);
// one of the "quirks" of the html export is that img src urls are set to point to
// the tmpDir() when exporting entry files from a collection, but those images
@@ -644,7 +645,7 @@ void HTMLExporter::createDir() {
if(!m_checkCreateDir) {
return;
}
- KUrl dir = fileDir();
+ QUrl dir = fileDir();
if(dir.isEmpty()) {
myDebug() << "called on empty URL!";
return;
@@ -666,8 +667,8 @@ bool HTMLExporter::copyFiles() {
int j = 0;
createDir();
- KUrl target;
- for(KUrl::List::ConstIterator it = m_files.constBegin(); it != m_files.constEnd() \
&& !m_cancelled; ++it, ++j) { + QUrl target;
+ for(QList<QUrl>::ConstIterator it = m_files.constBegin(); it != m_files.constEnd() \
&& !m_cancelled; ++it, ++j) { if(m_copiedFiles.has((*it).url())) {
continue;
}
@@ -675,7 +676,8 @@ bool HTMLExporter::copyFiles() {
if(target.isEmpty()) {
target = fileDir();
}
- target.setFileName((*it).fileName());
+ target = target.adjusted(QUrl::RemoveFilename);
+ target.setPath(target.path() + (*it).fileName());
KIO::FileCopyJob* job = KIO::file_copy(*it, target, -1, KIO::Overwrite);
bool success = KIO::NetAccess::synchronousRun(job, m_widget);
if(success) {
@@ -713,7 +715,7 @@ bool HTMLExporter::writeEntryFiles() {
FieldFormat::ForceFormat :
FieldFormat::AsIsFormat);
- KUrl outputFile = fileDir();
+ QUrl outputFile = fileDir();
GUI::CursorSaver cs(Qt::WaitCursor);
@@ -739,7 +741,8 @@ bool HTMLExporter::writeEntryFiles() {
}
file.replace(badChars, QLatin1String("_"));
file += QLatin1Char('-') + QString::number(entryIt->id()) + html;
- outputFile.setFileName(file);
+ outputFile = outputFile.adjusted(QUrl::RemoveFilename);
+ outputFile.setPath(outputFile.path() + file);
exporter.setEntries(Data::EntryList() << entryIt);
exporter.setURL(outputFile);
@@ -771,14 +774,16 @@ bool HTMLExporter::writeEntryFiles() {
for(uint i = 1; i <= 10; ++i) {
dataImages << QString::fromLatin1("stars%1.png").arg(i);
}
- KUrl dataDir;
- dataDir.setPath(KGlobal::dirs()->findResourceDir("appdata", \
QLatin1String("pics/tellico.png")) + QLatin1String("pics/"));
- KUrl target = fileDir();
- target.addPath(QLatin1String("pics/"));
+ QUrl dataDir = QUrl::fromLocalFile(KGlobal::dirs()->findResourceDir("appdata", \
QLatin1String("pics/tellico.png")) + QLatin1String("pics/")); + QUrl target = \
fileDir(); + target = target.adjusted(QUrl::StripTrailingSlash);
+ target.setPath(target.path() + QLatin1Char('/') + (QLatin1String("pics/")));
KIO::NetAccess::mkdir(target, m_widget);
foreach(const QString& dataImage, dataImages) {
- dataDir.setFileName(dataImage);
- target.setFileName(dataImage);
+ dataDir = dataDir.adjusted(QUrl::RemoveFilename);
+ dataDir.setPath(dataDir.path() + dataImage);
+ target = target.adjusted(QUrl::RemoveFilename);
+ target.setPath(target.path() + dataImage);
KIO::NetAccess::file_copy(dataDir, target, m_widget);
}
diff --git a/src/translators/htmlexporter.h b/src/translators/htmlexporter.h
index d3c1a8f..92b64a6 100644
--- a/src/translators/htmlexporter.h
+++ b/src/translators/htmlexporter.h
@@ -66,7 +66,7 @@ public:
virtual void readOptions(KSharedConfigPtr);
virtual void saveOptions(KSharedConfigPtr);
- void setCollectionURL(const KUrl& url) { m_collectionURL = url; m_links.clear(); }
+ void setCollectionURL(const QUrl& url) { m_collectionURL = url; m_links.clear(); }
void setXSLTFile(const QString& filename);
void setPrintHeaders(bool printHeaders) { m_printHeaders = printHeaders; }
void setPrintGrouped(bool printGrouped) { m_printGrouped = printGrouped; }
@@ -86,7 +86,7 @@ private:
void setFormattingOptions(Data::CollPtr coll);
void writeImages(Data::CollPtr coll);
bool writeEntryFiles();
- KUrl fileDir() const;
+ QUrl fileDir() const;
QString fileDirName() const;
void parseDOM(_xmlNode* node);
@@ -115,7 +115,7 @@ private:
QCheckBox* m_checkExportEntryFiles;
QCheckBox* m_checkExportImages;
- KUrl m_collectionURL;
+ QUrl m_collectionURL;
QString m_xsltFile;
QString m_xsltFilePath;
QString m_dataDir;
@@ -126,7 +126,7 @@ private:
QStringList m_columns;
QString m_entryXSLTFile;
- KUrl::List m_files;
+ QList<QUrl> m_files;
QHash<QString, QString> m_links;
StringSet m_copiedFiles;
};
diff --git a/src/translators/importer.cpp b/src/translators/importer.cpp
index 0b4c722..7a538b9 100644
--- a/src/translators/importer.cpp
+++ b/src/translators/importer.cpp
@@ -35,10 +35,11 @@ const unsigned Importer::s_stepSize = 20;
Importer::Importer() : QObject(), m_options(ImportProgress | ImportShowImageErrors) \
{ }
-Importer::Importer(const KUrl& url) : QObject(), m_options(ImportProgress | \
ImportShowImageErrors), m_urls(url) { +Importer::Importer(const QUrl& url) : \
QObject(), m_options(ImportProgress | ImportShowImageErrors) { + m_urls << url;
}
-Importer::Importer(const KUrl::List& urls) : QObject(), m_options(ImportProgress | \
ImportShowImageErrors), m_urls(urls) { +Importer::Importer(const QList<QUrl>& urls) : \
QObject(), m_options(ImportProgress | ImportShowImageErrors), m_urls(urls) { }
Importer::Importer(const QString& text) : QObject(), m_options(ImportProgress | \
ImportShowImageErrors), m_text(text) {
diff --git a/src/translators/importer.h b/src/translators/importer.h
index ce1853e..81593e5 100644
--- a/src/translators/importer.h
+++ b/src/translators/importer.h
@@ -28,7 +28,7 @@
#include "../datavectors.h"
#include "../collection.h"
-#include <kurl.h>
+#include <QUrl>
#include <klocale.h>
#include <QObject>
@@ -63,8 +63,8 @@ public:
*
* @param url The URL of the file to import
*/
- Importer(const KUrl& url);
- Importer(const KUrl::List& urls);
+ Importer(const QUrl& url);
+ Importer(const QList<QUrl>& urls);
Importer(const QString& text);
/**
*/
@@ -131,8 +131,8 @@ protected:
*
* @return the file URL
*/
- KUrl url() const { return m_urls.isEmpty() ? KUrl() : m_urls[0]; }
- KUrl::List urls() const { return m_urls; }
+ QUrl url() const { return m_urls.isEmpty() ? QUrl() : m_urls[0]; }
+ QList<QUrl> urls() const { return m_urls; }
QString text() const { return m_text; }
Data::CollPtr currentCollection() const;
/**
@@ -146,7 +146,7 @@ protected:
private:
long m_options;
- KUrl::List m_urls;
+ QList<QUrl> m_urls;
QString m_text;
QString m_statusMsg;
Data::CollPtr m_currentCollection;
diff --git a/src/translators/onixexporter.cpp b/src/translators/onixexporter.cpp
index 80fcac5..ad9c352 100644
--- a/src/translators/onixexporter.cpp
+++ b/src/translators/onixexporter.cpp
@@ -108,8 +108,8 @@ bool ONIXExporter::exec() {
}
QString ONIXExporter::text() {
- QString xsltfile = DataFileRegistry::self()->locate(m_xsltFile);
- if(xsltfile.isNull()) {
+ QString xsltFile = DataFileRegistry::self()->locate(m_xsltFile);
+ if(xsltFile.isNull()) {
myDebug() << "no xslt file for " << m_xsltFile;
return QString();
}
@@ -124,14 +124,13 @@ QString ONIXExporter::text() {
// all params should be passed to XSLTHandler in utf8
// input string to XSLTHandler should be in utf-8, EVEN IF DOM STRING SAYS \
OTHERWISE
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
// do NOT do namespace processing, it messes up the XSL declaration since
// QDom thinks there are no elements in the Tellico namespace and as a result
// removes the namespace declaration
QDomDocument dom = FileHandler::readXMLDocument(u, false);
if(dom.isNull()) {
- myDebug() << "error loading xslt file: " << xsltfile;
+ myDebug() << "error loading xslt file: " << xsltFile;
return QString();
}
@@ -142,7 +141,7 @@ QString ONIXExporter::text() {
}
delete m_handler;
- m_handler = new XSLTHandler(dom, QFile::encodeName(xsltfile));
+ m_handler = new XSLTHandler(dom, QFile::encodeName(xsltFile));
QDateTime now = QDateTime::currentDateTime();
m_handler->addStringParam("sentDate", \
now.toString(QLatin1String("yyyyMMddhhmm")).toUtf8());
diff --git a/src/translators/pdfimporter.cpp b/src/translators/pdfimporter.cpp
index 4e7957a..b8ca3cc 100644
--- a/src/translators/pdfimporter.cpp
+++ b/src/translators/pdfimporter.cpp
@@ -57,7 +57,7 @@ namespace {
using Tellico::Import::PDFImporter;
-PDFImporter::PDFImporter(const KUrl::List& urls_) : Importer(urls_), \
m_cancelled(false) { +PDFImporter::PDFImporter(const QList<QUrl>& urls_) : \
Importer(urls_), m_cancelled(false) { }
bool PDFImporter::canImport(int type_) const {
@@ -65,8 +65,8 @@ bool PDFImporter::canImport(int type_) const {
}
Tellico::Data::CollPtr PDFImporter::collection() {
- QString xsltfile = \
DataFileRegistry::self()->locate(QLatin1String("xmp2tellico.xsl"));
- if(xsltfile.isEmpty()) {
+ QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("xmp2tellico.xsl")); + \
if(xsltFile.isEmpty()) { myWarning() << "can not locate xmp2tellico.xsl";
return Data::CollPtr();
}
@@ -77,8 +77,7 @@ Tellico::Data::CollPtr PDFImporter::collection() {
ProgressItem::Done done(this);
const bool showProgress = options() & ImportProgress;
- KUrl u;
- u.setPath(xsltfile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
XSLTHandler xsltHandler(u);
if(!xsltHandler.isValid()) {
@@ -93,8 +92,8 @@ Tellico::Data::CollPtr PDFImporter::collection() {
Data::CollPtr coll;
XMPHandler xmpHandler;
- KUrl::List list = urls();
- for(KUrl::List::Iterator it = list.begin(); it != list.end() && !m_cancelled; \
++it, ++j) { + QList<QUrl> list = urls();
+ for(QList<QUrl>::Iterator it = list.begin(); it != list.end() && !m_cancelled; \
++it, ++j) {
const std::auto_ptr<FileHandler::FileRef> ref(FileHandler::fileRef(*it));
if(!ref->isValid()) {
continue;
@@ -285,7 +284,7 @@ Tellico::Data::CollPtr PDFImporter::collection() {
foreach(Data::EntryPtr entry, coll->entries()) {
if(entry->title().isEmpty()) {
// use file name
- KUrl u = entry->field(QLatin1String("url"));
+ QUrl u = entry->field(QLatin1String("url"));
entry->setField(QLatin1String("title"), u.fileName());
}
}
diff --git a/src/translators/pdfimporter.h b/src/translators/pdfimporter.h
index f356b26..1bfd061 100644
--- a/src/translators/pdfimporter.h
+++ b/src/translators/pdfimporter.h
@@ -34,7 +34,7 @@ class PDFImporter : public Importer {
Q_OBJECT
public:
- PDFImporter(const KUrl::List& urls);
+ PDFImporter(const QList<QUrl>& urls);
virtual bool canImport(int type) const;
diff --git a/src/translators/referencerimporter.cpp \
b/src/translators/referencerimporter.cpp index 57726c8..a0c7a79 100644
--- a/src/translators/referencerimporter.cpp
+++ b/src/translators/referencerimporter.cpp
@@ -33,11 +33,10 @@
using Tellico::Import::ReferencerImporter;
-ReferencerImporter::ReferencerImporter(const KUrl& url_) : XSLTImporter(url_) {
+ReferencerImporter::ReferencerImporter(const QUrl& url_) : XSLTImporter(url_) {
QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("referencer2tellico.xsl")); \
if(!xsltFile.isEmpty()) {
- KUrl u;
- u.setPath(xsltFile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
XSLTImporter::setXSLTURL(u);
} else {
myWarning() << "unable to find referencer2tellico.xsl!";
diff --git a/src/translators/referencerimporter.h \
b/src/translators/referencerimporter.h index 3aae092..cc8e4d1 100644
--- a/src/translators/referencerimporter.h
+++ b/src/translators/referencerimporter.h
@@ -40,7 +40,7 @@ Q_OBJECT
public:
/**
*/
- ReferencerImporter(const KUrl& url);
+ ReferencerImporter(const QUrl& url);
/**
*/
@@ -52,7 +52,7 @@ public:
private:
// private so it can't be changed accidently
- void setXSLTURL(const KUrl& url);
+ void setXSLTURL(const QUrl& url);
};
} // end namespace
diff --git a/src/translators/risimporter.cpp b/src/translators/risimporter.cpp
index 8aac387..1dee376 100644
--- a/src/translators/risimporter.cpp
+++ b/src/translators/risimporter.cpp
@@ -118,7 +118,7 @@ void RISImporter::initTypeMap() {
}
}
-RISImporter::RISImporter(const KUrl::List& urls_) : \
Tellico::Import::Importer(urls_), m_coll(0), m_cancelled(false) { \
+RISImporter::RISImporter(const QList<QUrl>& urls_) : \
Tellico::Import::Importer(urls_), m_coll(0), m_cancelled(false) { initTagMap();
initTypeMap();
}
@@ -165,7 +165,7 @@ Tellico::Data::CollPtr RISImporter::collection() {
if(text().isEmpty()) {
int count = 0;
- foreach(const KUrl& url, urls()) {
+ foreach(const QUrl& url, urls()) {
if(m_cancelled) {
break;
}
@@ -182,7 +182,7 @@ Tellico::Data::CollPtr RISImporter::collection() {
return m_coll;
}
-void RISImporter::readURL(const KUrl& url_, int n, const QHash<QString, \
Tellico::Data::FieldPtr>& risFields_) { +void RISImporter::readURL(const QUrl& url_, \
int n, const QHash<QString, Tellico::Data::FieldPtr>& risFields_) { QString str = \
FileHandler::readTextFile(url_); if(str.isEmpty()) {
return;
@@ -345,7 +345,7 @@ void RISImporter::slotCancel() {
m_cancelled = true;
}
-bool RISImporter::maybeRIS(const KUrl& url_) {
+bool RISImporter::maybeRIS(const QUrl& url_) {
QString text = FileHandler::readTextFile(url_, true /*quiet*/);
if(text.isEmpty()) {
return false;
diff --git a/src/translators/risimporter.h b/src/translators/risimporter.h
index 24f42d8..2c8f912 100644
--- a/src/translators/risimporter.h
+++ b/src/translators/risimporter.h
@@ -43,7 +43,7 @@ Q_OBJECT
public:
/**
*/
- RISImporter(const KUrl::List& urls);
+ RISImporter(const QList<QUrl>& urls);
RISImporter(const QString& text);
/**
@@ -55,7 +55,7 @@ public:
virtual QWidget* widget(QWidget*) { return 0; }
virtual bool canImport(int type) const;
- static bool maybeRIS(const KUrl& url);
+ static bool maybeRIS(const QUrl& url);
public slots:
void slotCancel();
@@ -65,7 +65,7 @@ private:
static void initTypeMap();
Data::FieldPtr fieldByTag(const QString& tag);
- void readURL(const KUrl& url, int n, const QHash<QString, Data::FieldPtr>& \
risFields); + void readURL(const QUrl& url, int n, const QHash<QString, \
Data::FieldPtr>& risFields); void readText(const QString& text, int n, const \
QHash<QString, Data::FieldPtr>& risFields);
Data::CollPtr m_coll;
diff --git a/src/translators/tellicoimporter.cpp \
b/src/translators/tellicoimporter.cpp index b0c8346..0da21db 100644
--- a/src/translators/tellicoimporter.cpp
+++ b/src/translators/tellicoimporter.cpp
@@ -46,7 +46,7 @@
using Tellico::Import::TellicoImporter;
-TellicoImporter::TellicoImporter(const KUrl& url_, bool loadAllImages_) : \
DataImporter(url_), +TellicoImporter::TellicoImporter(const QUrl& url_, bool \
loadAllImages_) : DataImporter(url_),
m_loadAllImages(loadAllImages_), m_format(Unknown), m_modified(false),
m_cancelled(false), m_hasImages(false), m_buffer(0), m_zip(0), m_imgDir(0) {
}
@@ -295,7 +295,7 @@ void TellicoImporter::slotCancel() {
}
// static
-bool TellicoImporter::loadAllImages(const KUrl& url_) {
+bool TellicoImporter::loadAllImages(const QUrl& url_) {
// only local files are allowed
if(url_.isEmpty() || !url_.isValid() || !url_.isLocalFile()) {
// myDebug() << "returning";
@@ -303,7 +303,7 @@ bool TellicoImporter::loadAllImages(const KUrl& url_) {
}
// keep track of url for error reporting
- static KUrl u;
+ static QUrl u;
KZip zip(url_.path());
if(!zip.open(QIODevice::ReadOnly)) {
diff --git a/src/translators/tellicoimporter.h b/src/translators/tellicoimporter.h
index 9126e56..7a87abe 100644
--- a/src/translators/tellicoimporter.h
+++ b/src/translators/tellicoimporter.h
@@ -48,7 +48,7 @@ public:
/**
* @param url The tellico data file.
*/
- explicit TellicoImporter(const KUrl& url, bool loadAllImages=true);
+ explicit TellicoImporter(const QUrl& url, bool loadAllImages=true);
/**
* Constructor used to convert arbitrary text to a @ref Collection
*
@@ -73,7 +73,7 @@ public:
// take ownership of zip object with images
KZip* takeImages();
- static bool loadAllImages(const KUrl& url);
+ static bool loadAllImages(const QUrl& url);
public slots:
void slotCancel();
diff --git a/src/translators/tellicoxmlexporter.cpp \
b/src/translators/tellicoxmlexporter.cpp index 29cd459..07d1224 100644
--- a/src/translators/tellicoxmlexporter.cpp
+++ b/src/translators/tellicoxmlexporter.cpp
@@ -46,6 +46,7 @@
#include <KGlobal>
#include <kcalendarsystem.h>
+#include <QDir>
#include <QGroupBox>
#include <QCheckBox>
#include <QDomDocument>
@@ -343,8 +344,9 @@ void TellicoXMLExporter::exportEntryXML(QDomDocument& dom_, \
QDomElement& parent_
fIt->property(QLatin1String("relative")) == QLatin1String("true") &&
!url().isEmpty()) {
// if a relative URL and url() is not empty, change the value!
- KUrl old_url(Data::Document::self()->URL(), fieldValue);
- fieldElem.appendChild(dom_.createTextNode(KUrl::relativeUrl(url(), \
old_url))); + QUrl old_url = \
Data::Document::self()->URL().resolved(fieldValue); + QString relPath = \
QDir(url().toLocalFile()).relativeFilePath(old_url.path()); + \
fieldElem.appendChild(dom_.createTextNode(relPath)); } else {
fieldElem.appendChild(dom_.createTextNode(fieldValue));
}
diff --git a/src/translators/textimporter.cpp b/src/translators/textimporter.cpp
index bd4d9c5..8eab80d 100644
--- a/src/translators/textimporter.cpp
+++ b/src/translators/textimporter.cpp
@@ -38,7 +38,7 @@ namespace {
using Tellico::Import::TextImporter;
-TextImporter::TextImporter(const KUrl& url_, bool useUTF8_)
+TextImporter::TextImporter(const QUrl& url_, bool useUTF8_)
: Import::Importer(url_) {
if(url_.isValid()) {
setText(cleanXml(FileHandler::readTextFile(url_, false, useUTF8_)));
diff --git a/src/translators/textimporter.h b/src/translators/textimporter.h
index 57d5d22..c1e0a87 100644
--- a/src/translators/textimporter.h
+++ b/src/translators/textimporter.h
@@ -44,7 +44,7 @@ public:
*
* @param url The file to be imported
*/
- explicit TextImporter(const KUrl& url, bool useUTF8_=false);
+ explicit TextImporter(const QUrl& url, bool useUTF8_=false);
explicit TextImporter(const QString& text);
};
diff --git a/src/translators/vinoxmlimporter.cpp \
b/src/translators/vinoxmlimporter.cpp index b25cce3..14b72fe 100644
--- a/src/translators/vinoxmlimporter.cpp
+++ b/src/translators/vinoxmlimporter.cpp
@@ -30,11 +30,10 @@
using Tellico::Import::VinoXMLImporter;
-VinoXMLImporter::VinoXMLImporter(const KUrl& url_) : XSLTImporter(url_) {
+VinoXMLImporter::VinoXMLImporter(const QUrl& url_) : XSLTImporter(url_) {
QString xsltFile = \
DataFileRegistry::self()->locate(QLatin1String("vinoxml2tellico.xsl")); \
if(!xsltFile.isEmpty()) {
- KUrl u;
- u.setPath(xsltFile);
+ QUrl u = QUrl::fromLocalFile(xsltFile);
XSLTImporter::setXSLTURL(u);
} else {
myWarning() << "unable to find vinoxml2tellico.xsl!";
diff --git a/src/translators/vinoxmlimporter.h b/src/translators/vinoxmlimporter.h
index 0bbb8eb..636dfbc 100644
--- a/src/translators/vinoxmlimporter.h
+++ b/src/translators/vinoxmlimporter.h
@@ -40,7 +40,7 @@ Q_OBJECT
public:
/**
*/
- VinoXMLImporter(const KUrl& url);
+ VinoXMLImporter(const QUrl& url);
/**
*/
@@ -52,7 +52,7 @@ public:
private:
// private so it can't be changed accidently
- void setXSLTURL(const KUrl& url);
+ void setXSLTURL(const QUrl& url);
};
} // end namespace
diff --git a/src/translators/xmlimporter.cpp b/src/translators/xmlimporter.cpp
index 0a1032c..e3d035c 100644
--- a/src/translators/xmlimporter.cpp
+++ b/src/translators/xmlimporter.cpp
@@ -30,7 +30,7 @@
using Tellico::Import::XMLImporter;
-XMLImporter::XMLImporter(const KUrl& url_) : Import::Importer(url_) {
+XMLImporter::XMLImporter(const QUrl& url_) : Import::Importer(url_) {
if(!url_.isEmpty() && url_.isValid()) {
m_dom = FileHandler::readXMLDocument(url_, true);
}
@@ -43,7 +43,7 @@ XMLImporter::XMLImporter(const QString& text_) : \
Import::Importer(text_) { setText(text_);
}
-XMLImporter::XMLImporter(const QByteArray& data_) : Import::Importer(KUrl()) {
+XMLImporter::XMLImporter(const QByteArray& data_) : Import::Importer(QUrl()) {
if(data_.isEmpty()) {
return;
}
@@ -60,7 +60,7 @@ XMLImporter::XMLImporter(const QByteArray& data_) : \
Import::Importer(KUrl()) { }
}
-XMLImporter::XMLImporter(const QDomDocument& dom_) : Import::Importer(KUrl()), \
m_dom(dom_) { +XMLImporter::XMLImporter(const QDomDocument& dom_) : \
Import::Importer(QUrl()), m_dom(dom_) { }
void XMLImporter::setText(const QString& text_) {
diff --git a/src/translators/xmlimporter.h b/src/translators/xmlimporter.h
index 1a19e86..78d2cbc 100644
--- a/src/translators/xmlimporter.h
+++ b/src/translators/xmlimporter.h
@@ -46,7 +46,7 @@ public:
*
* @param url The file to be imported
*/
- XMLImporter(const KUrl& url);
+ XMLImporter(const QUrl& url);
/**
* Imports xml text.
*
diff --git a/src/translators/xmlstatehandler.cpp \
b/src/translators/xmlstatehandler.cpp index fd428d6..4fd3990 100644
--- a/src/translators/xmlstatehandler.cpp
+++ b/src/translators/xmlstatehandler.cpp
@@ -198,7 +198,7 @@ bool CollectionHandler::end(const QString&, const QString&, const \
QString&) { // if not, then there was no <image> in the XML
// so it's a url, but maybe link only
if(!ImageFactory::hasImageInfo(value)) {
- KUrl u(value);
+ QUrl u = QUrl::fromUserInput(value);
// the image file name is a valid URL, but I want it to be a local URL or \
non empty remote one if(u.isValid() && (u.isLocalFile() || !u.host().isEmpty())) {
QString result = ImageFactory::addImage(u, !d->showImageLoadErrors || \
imageWarnings >= maxImageWarnings /* quiet */);
diff --git a/src/translators/xsltexporter.cpp b/src/translators/xsltexporter.cpp
index 6489a9e..121bea9 100644
--- a/src/translators/xsltexporter.cpp
+++ b/src/translators/xsltexporter.cpp
@@ -56,7 +56,7 @@ QString XSLTExporter::fileFilter() const {
bool XSLTExporter::exec() {
- KUrl u = m_URLRequester->url();
+ QUrl u = m_URLRequester->url();
if(u.isEmpty() || !u.isValid()) {
return false;
}
diff --git a/src/translators/xsltexporter.h b/src/translators/xsltexporter.h
index 404833b..3fb8680 100644
--- a/src/translators/xsltexporter.h
+++ b/src/translators/xsltexporter.h
@@ -51,7 +51,7 @@ public:
private:
QWidget* m_widget;
KUrlRequester* m_URLRequester;
- KUrl m_xsltFile;
+ QUrl m_xsltFile;
};
} // end namespace
diff --git a/src/translators/xslthandler.cpp b/src/translators/xslthandler.cpp
index 9c884af..c8c137c 100644
--- a/src/translators/xslthandler.cpp
+++ b/src/translators/xslthandler.cpp
@@ -26,7 +26,7 @@
#include "../tellico_debug.h"
#include "../utils/string_utils.h"
-#include <kurl.h>
+#include <QUrl>
#include <QDomDocument>
#include <QTextCodec>
@@ -94,17 +94,17 @@ XSLTHandler::XSLTHandler(const QByteArray& xsltFile_) :
}
}
-XSLTHandler::XSLTHandler(const KUrl& xsltURL_) :
+XSLTHandler::XSLTHandler(const QUrl& xsltURL_) :
m_stylesheet(0) {
init();
if(xsltURL_.isValid() && xsltURL_.isLocalFile()) {
- xmlDocPtr xsltDoc = xmlReadFile(xsltURL_.encodedPathAndQuery().toUtf8(), NULL, \
xslt_options); + xmlDocPtr xsltDoc = xmlReadFile(xsltURL_.toLocalFile().toUtf8(), \
NULL, xslt_options); m_stylesheet = xsltParseStylesheetDoc(xsltDoc);
if(!m_stylesheet) {
myDebug() << "null stylesheet pointer for " << xsltURL_.path();
}
} else {
- myDebug() << "XSLTHandler(KUrl) - invalid: " << xsltURL_;
+ myDebug() << "XSLTHandler(QUrl) - invalid: " << xsltURL_;
}
}
diff --git a/src/translators/xslthandler.h b/src/translators/xslthandler.h
index d5c5f91..d0ec921 100644
--- a/src/translators/xslthandler.h
+++ b/src/translators/xslthandler.h
@@ -36,7 +36,7 @@ extern "C" {
#include <libxslt/xsltInternals.h>
}
-class KUrl;
+class QUrl;
class QDomDocument;
namespace Tellico {
@@ -69,7 +69,7 @@ public:
/**
* @param xsltURL The XSLT URL
*/
- XSLTHandler(const KUrl& xsltURL);
+ XSLTHandler(const QUrl& xsltURL);
/**
* @param xsltDoc The XSLT DOM document
* @param xsltFile The XSLT file, should be a url?
diff --git a/src/translators/xsltimporter.cpp b/src/translators/xsltimporter.cpp
index a864ea9..ae775af 100644
--- a/src/translators/xsltimporter.cpp
+++ b/src/translators/xsltimporter.cpp
@@ -43,7 +43,7 @@ using Tellico::Import::XSLTImporter;
namespace {
-static bool isUTF8(const KUrl& url_) {
+static bool isUTF8(const QUrl& url_) {
// read first line to check encoding
const std::auto_ptr<Tellico::FileHandler::FileRef> \
ref(Tellico::FileHandler::fileRef(url_)); if(!ref->isValid()) {
@@ -59,7 +59,7 @@ static bool isUTF8(const KUrl& url_) {
}
// always use utf8 for xslt
-XSLTImporter::XSLTImporter(const KUrl& url_) : Tellico::Import::TextImporter(url_, \
isUTF8(url_)), +XSLTImporter::XSLTImporter(const QUrl& url_) : \
Tellico::Import::TextImporter(url_, isUTF8(url_)), m_widget(0),
m_URLRequester(0) {
}
diff --git a/src/translators/xsltimporter.h b/src/translators/xsltimporter.h
index 18964a7..62d685f 100644
--- a/src/translators/xsltimporter.h
+++ b/src/translators/xsltimporter.h
@@ -46,7 +46,7 @@ Q_OBJECT
public:
/**
*/
- XSLTImporter(const KUrl& url);
+ XSLTImporter(const QUrl& url);
/**
*/
@@ -55,7 +55,7 @@ public:
*/
virtual QWidget* widget(QWidget* parent);
virtual void beginXSLTHandler(XSLTHandler*) {}
- void setXSLTURL(const KUrl& url) { m_xsltURL = url; }
+ void setXSLTURL(const QUrl& url) { m_xsltURL = url; }
public slots:
void slotCancel();
@@ -65,7 +65,7 @@ private:
QWidget* m_widget;
KUrlRequester* m_URLRequester;
- KUrl m_xsltURL;
+ QUrl m_xsltURL;
};
} // end namespace
diff --git a/src/utils/bibtexhandler.cpp b/src/utils/bibtexhandler.cpp
index 6399c8c..745df87 100644
--- a/src/utils/bibtexhandler.cpp
+++ b/src/utils/bibtexhandler.cpp
@@ -30,7 +30,7 @@
#include "../utils/datafileregistry.h"
#include "../tellico_debug.h"
-#include <KUrl>
+#include <QUrl>
#include <QDomDocument>
@@ -133,8 +133,7 @@ void BibtexHandler::loadTranslationMaps() {
return;
}
- KUrl u;
- u.setPath(mapfile);
+ QUrl u = QUrl::fromLocalFile(mapfile);
// no namespace processing
QDomDocument dom = FileHandler::readXMLDocument(u, false);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic