[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kget/kf5_port] /: Do a lot of KUrl->QUrl porting again
From:       Lukas Appelhans <l.appelhans () gmx ! de>
Date:       2014-10-29 11:41:25
Message-ID: E1XjRcz-0004q4-DG () scm ! kde ! org
[Download RAW message or body]

Git commit a415cb4eb2b6d4a137b0e0fb3117082240ecdf09 by Lukas Appelhans.
Committed on 29/10/2014 at 11:41.
Pushed by lappelhans into branch 'kf5_port'.

Do a lot of KUrl->QUrl porting again

M  +26   -26   transfer-plugins/metalink/metalink.cpp
M  +12   -12   transfer-plugins/metalink/metalink.h
M  +8    -9    transfer-plugins/metalink/metalinkhttp.cpp
M  +4    -4    transfer-plugins/metalink/metalinkhttp.h
M  +2    -2    ui/metalinkcreator/dragdlg.cpp
M  +2    -2    ui/metalinkcreator/filedlg.cpp
M  +4    -4    ui/metalinkcreator/filehandler.cpp
M  +1    -1    ui/metalinkcreator/generalwidget.cpp
M  +8    -8    ui/metalinkcreator/metalinkcreator.cpp
M  +18   -18   ui/metalinkcreator/metalinker.cpp
M  +13   -13   ui/metalinkcreator/metalinker.h
M  +1    -1    ui/metalinkcreator/urlwidget.cpp

http://commits.kde.org/kget/a415cb4eb2b6d4a137b0e0fb3117082240ecdf09

diff --git a/transfer-plugins/metalink/metalink.cpp \
b/transfer-plugins/metalink/metalink.cpp index 0853fd8..f56e95a 100644
--- a/transfer-plugins/metalink/metalink.cpp
+++ b/transfer-plugins/metalink/metalink.cpp
@@ -41,7 +41,7 @@
 #include <QDomElement>
 
 Metalink::Metalink(TransferGroup * parent, TransferFactory * factory,
-                         Scheduler * scheduler, const KUrl & source, const KUrl & \
dest, +                         Scheduler * scheduler, const QUrl & source, const \
QUrl & dest,  const QDomElement * e)
     : Transfer(parent, factory, scheduler, source, dest, e),
       m_fileModel(0),
@@ -83,10 +83,10 @@ void Metalink::downloadMetalink()
     setStatus(Job::Stopped, i18n("Downloading Metalink File...."), \
SmallIcon("document-save"));  setTransferChange(Tc_Status, true);
     Download *download = new Download(m_source, \
                QString(KStandardDirs::locateLocal("appdata", "metalinks/") + \
                m_source.fileName()));
-    connect(download, SIGNAL(finishedSuccessfully(KUrl,QByteArray)), \
SLOT(metalinkInit(KUrl,QByteArray))); +    connect(download, \
SIGNAL(finishedSuccessfully(QUrl,QByteArray)), SLOT(metalinkInit(QUrl,QByteArray)));  \
}  
-bool Metalink::metalinkInit(const KUrl &src, const QByteArray &data)
+bool Metalink::metalinkInit(const QUrl &src, const QByteArray &data)
 {
     qCDebug(KGET_DEBUG);
 
@@ -127,8 +127,8 @@ bool Metalink::metalinkInit(const KUrl &src, const QByteArray \
                &data)
     QList<KGetMetalink::File>::const_iterator itEnd = \
m_metalink.files.files.constEnd();  m_totalSize = 0;
     KIO::fileoffset_t segSize = 500 * 1024;//TODO use config here!
-    const KUrl tempDest = KUrl(m_dest.directory());
-    KUrl dest;
+    const QUrl tempDest = QUrl(m_dest.directory());
+    QUrl dest;
     for (it = m_metalink.files.files.constBegin(); it != itEnd ; ++it)
     {
         dest = tempDest;
@@ -146,7 +146,7 @@ bool Metalink::metalinkInit(const KUrl &src, const QByteArray \
                &data)
         dataFactory->setMaxMirrorsUsed(MetalinkSettings::mirrorsPerFile());
 
 #ifdef HAVE_NEPOMUK
-        nepomukHandler()->setProperties((*it).properties(), QList<KUrl>() << dest);
+        nepomukHandler()->setProperties((*it).properties(), QList<QUrl>() << dest);
 #endif //HAVE_NEPOMUK
 
 //TODO compare available file size (<size>) with the sizes of the server while \
downloading? @@ -160,7 +160,7 @@ bool Metalink::metalinkInit(const KUrl &src, const \
QByteArray &data)  //add the DataSources
         for (int i = 0; i < urlList.size(); ++i)
         {
-            const KUrl url = urlList[i].url;
+            const QUrl url = urlList[i].url;
             if (url.isValid())
             {
                 dataFactory->addMirror(url, MetalinkSettings::connectionsPerUrl());
@@ -533,7 +533,7 @@ void Metalink::slotSignatureVerified()
     }
 }
 
-bool Metalink::repair(const KUrl &file)
+bool Metalink::repair(const QUrl &file)
 {
     if (file.isValid())
     {
@@ -580,7 +580,7 @@ void Metalink::load(const QDomElement *element)
     }
 
     const QDomElement e = *element;
-    m_localMetalinkLocation = KUrl(e.attribute("LocalMetalinkLocation"));
+    m_localMetalinkLocation = QUrl(e.attribute("LocalMetalinkLocation"));
     QDomNodeList factories = \
e.firstChildElement("factories").elementsByTagName("factory");  
     //no stored information found, stop right here
@@ -633,7 +633,7 @@ void Metalink::save(const QDomElement &element)
     }
 }
 
-Verifier *Metalink::verifier(const KUrl &file)
+Verifier *Metalink::verifier(const QUrl &file)
 {
     if (!m_dataSourceFactory.contains(file))
     {
@@ -643,7 +643,7 @@ Verifier *Metalink::verifier(const KUrl &file)
     return m_dataSourceFactory[file]->verifier();
 }
 
-Signature *Metalink::signature(const KUrl &file)
+Signature *Metalink::signature(const QUrl &file)
 {
     if (!m_dataSourceFactory.contains(file)) {
         return 0;
@@ -652,7 +652,7 @@ Signature *Metalink::signature(const KUrl &file)
     return m_dataSourceFactory[file]->signature();
 }
 
-QList<KUrl> Metalink::files() const
+QList<QUrl> Metalink::files() const
 {
     return m_dataSourceFactory.keys();
 }
@@ -662,12 +662,12 @@ FileModel *Metalink::fileModel()
     if (!m_fileModel)
     {
         m_fileModel = new FileModel(files(), directory(), this);
-        connect(m_fileModel, SIGNAL(rename(KUrl,KUrl)), this, \
SLOT(slotRename(KUrl,KUrl))); +        connect(m_fileModel, \
                SIGNAL(rename(QUrl,QUrl)), this, SLOT(slotRename(QUrl,QUrl)));
         connect(m_fileModel, SIGNAL(checkStateChanged()), this, \
SLOT(filesSelected()));  
         foreach (DataSourceFactory *factory, m_dataSourceFactory)
         {
-            const KUrl dest = factory->dest();
+            const QUrl dest = factory->dest();
             QModelIndex size = m_fileModel->index(dest, FileItem::Size);
             m_fileModel->setData(size, static_cast<qlonglong>(factory->size()));
             QModelIndex status = m_fileModel->index(dest, FileItem::Status);
@@ -699,7 +699,7 @@ void Metalink::filesSelected()
     //and asks the user if there are existing files already
     foreach (const QModelIndex &index, files)
     {
-        const KUrl dest = fileModel()->getUrl(index);
+        const QUrl dest = fileModel()->getUrl(index);
         bool doDownload = index.data(Qt::CheckStateRole).toBool();
         if (m_dataSourceFactory.contains(dest))
         {
@@ -723,7 +723,7 @@ void Metalink::filesSelected()
                     if (result == KIO::R_RENAME) {
                         //no reason to use FileModel::rename() since the file does \
not exist yet, so simply skip it  //avoids having to deal with signals
-                        const KUrl newDest = dlg.newDestUrl();
+                        const QUrl newDest = dlg.newDestUrl();
                         factory->setDoDownload(doDownload);
                         factory->setNewDestination(newDest);
                         fileModel()->setData(index, newDest.fileName(), \
FileItem::File); @@ -772,7 +772,7 @@ void Metalink::filesSelected()
     slotDataSourceFactoryChange(change);
 }
 
-void Metalink::slotRename(const KUrl &oldUrl, const KUrl &newUrl)
+void Metalink::slotRename(const QUrl &oldUrl, const QUrl &newUrl)
 {
     if (!m_dataSourceFactory.contains(oldUrl))
     {
@@ -786,7 +786,7 @@ void Metalink::slotRename(const KUrl &oldUrl, const KUrl &newUrl)
     setTransferChange(Tc_FileName);
 }
 
-bool Metalink::setDirectory(const KUrl &new_directory)
+bool Metalink::setDirectory(const QUrl &new_directory)
 {
     if (new_directory == directory())
     {
@@ -798,17 +798,17 @@ bool Metalink::setDirectory(const KUrl &new_directory)
         m_fileModel->setDirectory(new_directory);
     }
 
-    const QString oldDirectory = directory().pathOrUrl(KUrl::AddTrailingSlash);
-    const QString newDirectory = new_directory.pathOrUrl(KUrl::AddTrailingSlash);
+    const QString oldDirectory = directory().pathOrUrl(QUrl::AddTrailingSlash);
+    const QString newDirectory = new_directory.pathOrUrl(QUrl::AddTrailingSlash);
     const QString fileName = m_dest.fileName();
     m_dest = new_directory;
     m_dest.addPath(fileName);
 
-    QHash<KUrl, DataSourceFactory*> newStorage;
+    QHash<QUrl, DataSourceFactory*> newStorage;
     foreach (DataSourceFactory *factory, m_dataSourceFactory)
     {
-        const KUrl oldUrl = factory->dest();
-        const KUrl newUrl = KUrl(oldUrl.pathOrUrl().replace(oldDirectory, \
newDirectory)); +        const QUrl oldUrl = factory->dest();
+        const QUrl newUrl = QUrl(oldUrl.pathOrUrl().replace(oldDirectory, \
newDirectory));  factory->setNewDestination(newUrl);
         newStorage[newUrl] = factory;
     }
@@ -818,9 +818,9 @@ bool Metalink::setDirectory(const KUrl &new_directory)
     return true;
 }
 
-QHash<KUrl, QPair<bool, int> > Metalink::availableMirrors(const KUrl &file) const
+QHash<QUrl, QPair<bool, int> > Metalink::availableMirrors(const QUrl &file) const
 {
-    QHash<KUrl, QPair<bool, int> > urls;
+    QHash<QUrl, QPair<bool, int> > urls;
 
     if (m_dataSourceFactory.contains(file))
     {
@@ -831,7 +831,7 @@ QHash<KUrl, QPair<bool, int> > Metalink::availableMirrors(const \
KUrl &file) cons  }
 
 
-void Metalink::setAvailableMirrors(const KUrl &file, const QHash<KUrl, QPair<bool, \
int> > &mirrors) +void Metalink::setAvailableMirrors(const QUrl &file, const \
QHash<QUrl, QPair<bool, int> > &mirrors)  {
     if (!m_dataSourceFactory.contains(file))
     {
diff --git a/transfer-plugins/metalink/metalink.h \
b/transfer-plugins/metalink/metalink.h index 915fa75..83df94e 100644
--- a/transfer-plugins/metalink/metalink.h
+++ b/transfer-plugins/metalink/metalink.h
@@ -26,7 +26,7 @@ class Metalink : public Transfer
 
     public:
         Metalink(TransferGroup * parent, TransferFactory * factory,
-                    Scheduler * scheduler, const KUrl & src, const KUrl & dest,
+                    Scheduler * scheduler, const QUrl & src, const QUrl & dest,
                     const QDomElement * e = 0);
 
         ~Metalink();
@@ -39,31 +39,31 @@ class Metalink : public Transfer
          */
         int remainingTime() const;
 
-        bool repair(const KUrl &file = KUrl());
+        bool repair(const QUrl &file = QUrl());
 
         /**
          * Move the download to the new destination
          * @param newDirectory is a directory where the download should be stored
          * @returns true if newDestination can be used
          */
-        virtual bool setDirectory(const KUrl &newDirectory);
+        virtual bool setDirectory(const QUrl &newDirectory);
 
-        QHash<KUrl, QPair<bool, int> > availableMirrors(const KUrl &file) const;
-        void setAvailableMirrors(const KUrl &file, const QHash<KUrl, QPair<bool, \
int> > &mirrors); +        QHash<QUrl, QPair<bool, int> > availableMirrors(const QUrl \
&file) const; +        void setAvailableMirrors(const QUrl &file, const QHash<QUrl, \
QPair<bool, int> > &mirrors);  
         /**
          * @param file for which to get the verifier
          * @return Verifier that allows you to add checksums manually verify a file \
                etc.
          */
-        virtual Verifier *verifier(const KUrl &file);
+        virtual Verifier *verifier(const QUrl &file);
 
         /**
          * @param file for which to get the signature
          * @return Signature that allows you to add signatures and verify them
          */
-        virtual Signature *signature(const KUrl &file);
+        virtual Signature *signature(const QUrl &file);
 
-        virtual QList<KUrl> files() const;
+        virtual QList<QUrl> files() const;
 
         FileModel *fileModel();
 
@@ -80,7 +80,7 @@ class Metalink : public Transfer
          * @note false does not mean that an error happened, it could mean, that the \
                user
          * decided to update the metalink
          */
-        bool metalinkInit(const KUrl &url = KUrl(), const QByteArray &data = \
QByteArray()); +        bool metalinkInit(const QUrl &url = QUrl(), const QByteArray \
&data = QByteArray());  
         void fileDlgFinished(int result);
         /**
@@ -91,7 +91,7 @@ class Metalink : public Transfer
         void filesSelected();
         void slotUpdateCapabilities();
         void slotDataSourceFactoryChange(Transfer::ChangesFlags change);
-        void slotRename(const KUrl &oldUrl, const KUrl &newUrl);
+        void slotRename(const QUrl &oldUrl, const QUrl &newUrl);
         void slotVerified(bool isVerified);
         void slotSignatureVerified();
 
@@ -108,9 +108,9 @@ class Metalink : public Transfer
         FileModel *m_fileModel;
         int m_currentFiles;
         bool m_metalinkJustDownloaded;
-        KUrl m_localMetalinkLocation;
+        QUrl m_localMetalinkLocation;
         KGetMetalink::Metalink m_metalink;
-        QHash<KUrl, DataSourceFactory*> m_dataSourceFactory;
+        QHash<QUrl, DataSourceFactory*> m_dataSourceFactory;
         bool m_ready;
         int m_speedCount;
         int m_tempAverageSpeed;
diff --git a/transfer-plugins/metalink/metalinkhttp.cpp \
b/transfer-plugins/metalink/metalinkhttp.cpp index 9bb9dda..c59c386 100644
--- a/transfer-plugins/metalink/metalinkhttp.cpp
+++ b/transfer-plugins/metalink/metalinkhttp.cpp
@@ -55,11 +55,11 @@ QString base64ToHex(const QString& b64)
 }
 
 MetalinkHttp::MetalinkHttp(TransferGroup * parent, TransferFactory * factory,
-                         Scheduler * scheduler, const KUrl & source, const KUrl & \
dest, +                         Scheduler * scheduler, const QUrl & source, const \
QUrl & dest,  KGetMetalink::MetalinkHttpParser *httpParser,
                          const QDomElement * e)
     : AbstractMetalink(parent,factory,scheduler,source, dest, e) ,
-      m_signatureUrl(KUrl()),
+      m_signatureUrl(QUrl()),
       m_httpparser(httpParser)
 
 {
@@ -138,7 +138,7 @@ void MetalinkHttp::start()
     }
 }
 
-void MetalinkHttp::setSignature(KUrl & dest, QByteArray & data, DataSourceFactory* \
dataFactory) +void MetalinkHttp::setSignature(QUrl & dest, QByteArray & data, \
DataSourceFactory* dataFactory)  {
     Q_UNUSED(dest);
     dataFactory->signature()->setSignature(data,Signature::AsciiDetached);
@@ -178,9 +178,8 @@ void MetalinkHttp::slotSignatureVerified()
 bool MetalinkHttp::metalinkHttpInit()
 {
     kDebug() << "m_dest = " << m_dest;
-    const KUrl tempDest = KUrl(m_dest.adjusted(QUrl::RemoveFilename));
-    KUrl dest = tempDest;
-    dest.addPath(m_dest.fileName());
+    const QUrl tempDest = QUrl(m_dest.adjusted(QUrl::RemoveFilename));
+    QUrl dest = tempDest.toString() + "/" + m_dest.fileName();
     kDebug() << "dest = " << dest;
 
     //sort the urls according to their priority (highest first)
@@ -198,7 +197,7 @@ bool MetalinkHttp::metalinkHttpInit()
     //add the Mirrors Sources
 
     for(int i = 0; i < m_linkheaderList.size(); ++i) {
-        const KUrl url = m_linkheaderList[i].url;
+        const QUrl url = m_linkheaderList[i].url;
         if (url.isValid()) {
             if (m_linkheaderList[i].pref) {
                 kDebug() << "found etag in a mirror" ;
@@ -226,9 +225,9 @@ bool MetalinkHttp::metalinkHttpInit()
         dataFactory->verifier()->addChecksums(m_DigestList);
 
         //Add OpenPGP signatures
-        if (m_signatureUrl != KUrl()) {
+        if (m_signatureUrl != QUrl()) {
             Download *signat_download = new Download(m_signatureUrl, \
                QString(KStandardDirs::locateLocal("appdata", "metalinks/") + \
                m_source.fileName()));
-            connect(signat_download, SIGNAL(finishedSuccessfully(KUrl,QByteArray)), \
SLOT(setSignature(KUrl,QByteArray))); +            connect(signat_download, \
SIGNAL(finishedSuccessfully(QUrl,QByteArray)), SLOT(setSignature(QUrl,QByteArray)));  \
}  m_dataSourceFactory[dataFactory->dest()] = dataFactory;
     }
diff --git a/transfer-plugins/metalink/metalinkhttp.h \
b/transfer-plugins/metalink/metalinkhttp.h index 714b6b0..952bde1 100644
--- a/transfer-plugins/metalink/metalinkhttp.h
+++ b/transfer-plugins/metalink/metalinkhttp.h
@@ -28,7 +28,7 @@ class MetalinkHttp : public AbstractMetalink
 
     public:
     MetalinkHttp(TransferGroup * parent, TransferFactory * factory,
-                Scheduler * scheduler, const KUrl & src, const KUrl & dest,
+                Scheduler * scheduler, const QUrl & src, const QUrl & dest,
                 KGetMetalink::MetalinkHttpParser *httpParser, const QDomElement * e \
= 0 );  ~MetalinkHttp();
 
@@ -53,7 +53,7 @@ class MetalinkHttp : public AbstractMetalink
          * @note sets the signatures in the headers to the signature reader
          */
 
-        void setSignature(KUrl & dest, QByteArray & data, DataSourceFactory* \
dataFactory); +        void setSignature(QUrl & dest, QByteArray & data, \
DataSourceFactory* dataFactory);  
         /**
          * @note sets the Instance Digests in the headers to the vlaues as per
@@ -68,8 +68,8 @@ class MetalinkHttp : public AbstractMetalink
         void setLinks();
 
     private:
-        KUrl m_signatureUrl;
-        KUrl m_metalinkxmlUrl ;
+        QUrl m_signatureUrl;
+        QUrl m_metalinkxmlUrl ;
         void startMetalink();
         KGetMetalink::MetalinkHttpParser *m_httpparser;
         QList<KGetMetalink::HttpLinkHeader> m_linkheaderList;
diff --git a/ui/metalinkcreator/dragdlg.cpp b/ui/metalinkcreator/dragdlg.cpp
index 34ae149..7199f24 100644
--- a/ui/metalinkcreator/dragdlg.cpp
+++ b/ui/metalinkcreator/dragdlg.cpp
@@ -85,7 +85,7 @@ void DragDlg::slotFinished()
     m_commonData->identity = uiData.identity->text();
     m_commonData->version = uiData.version->text();
     m_commonData->description = uiData.description->text();
-    m_commonData->logo = KUrl(uiData.logo->text());
+    m_commonData->logo = QUrl(uiData.logo->text());
     if (uiData.os->text().isEmpty()) {
         m_commonData->oses.clear();
     } else {
@@ -93,7 +93,7 @@ void DragDlg::slotFinished()
     }
     m_commonData->copyright = uiData.copyright->text();
     m_commonData->publisher.name = uiData.pub_name->text();
-    m_commonData->publisher.url = KUrl(uiData.pub_url->text());
+    m_commonData->publisher.url = QUrl(uiData.pub_url->text());
     m_commonData->languages << \
uiData.language->itemData(uiData.language->currentIndex()).toString();  
     emit usedTypes(used, ui.partialChecksums->isChecked());
diff --git a/ui/metalinkcreator/filedlg.cpp b/ui/metalinkcreator/filedlg.cpp
index 37bbd83..f56d036 100644
--- a/ui/metalinkcreator/filedlg.cpp
+++ b/ui/metalinkcreator/filedlg.cpp
@@ -168,13 +168,13 @@ void FileDlg::slotOkClicked()
     m_file->data.identity = uiData.identity->text();
     m_file->data.version = uiData.version->text();
     m_file->data.description = uiData.description->text();
-    m_file->data.logo = KUrl(uiData.logo->text());
+    m_file->data.logo = QUrl(uiData.logo->text());
     if (!uiData.os->text().isEmpty()) {
         m_file->data.oses = uiData.os->text().split(i18nc("comma, to seperate \
members of a list", ","));  }
     m_file->data.copyright = uiData.copyright->text();
     m_file->data.publisher.name = uiData.pub_name->text();
-    m_file->data.publisher.url = KUrl(uiData.pub_url->text());
+    m_file->data.publisher.url = QUrl(uiData.pub_url->text());
     m_file->data.languages << \
uiData.language->itemData(uiData.language->currentIndex()).toString();  
     m_urlWidget->save();
diff --git a/ui/metalinkcreator/filehandler.cpp b/ui/metalinkcreator/filehandler.cpp
index fe4d275..b4dddf9 100644
--- a/ui/metalinkcreator/filehandler.cpp
+++ b/ui/metalinkcreator/filehandler.cpp
@@ -69,13 +69,13 @@ void FileHandlerThread::run()
         while (files.count() && !abort) {
             //take the first file and try to handle it
             FileData data = files.takeFirst();
-            const KUrl url = data.url;
+            const QUrl url = data.url;
             KGetMetalink::File file = data.file;
             file.data = commonData;
 
             foreach (const KGetMetalink::Url &metalinkUrl, tempResources.urls) {
                 KGetMetalink::Url mirror = metalinkUrl;
-                mirror.url.addPath(file.name);
+                mirror.url.setPath(mirror.url.toString() + "/" + file.name);
 
                 //if the url has already been added, remove it and readd it
                 for (int i = 0; i < file.resources.urls.count(); ++i) {
@@ -150,7 +150,7 @@ void DirectoryHandler::slotFiles(const QList<QUrl> &files)
 
     m_allJobsStarted = false;
 
-    foreach (const KUrl &url, files) {
+    foreach (const QUrl &url, files) {
         QDir dir(url.path());
         if (dir.exists()) {
             KIO::ListJob *listJob = KIO::listRecursive(url);
@@ -180,7 +180,7 @@ void DirectoryHandler::slotDirEntries(KIO::Job *j, const \
KIO::UDSEntryList &entr  return;
     }
 
-    const KUrl baseUrl = m_jobs[job];
+    const QUrl baseUrl = m_jobs[job];
     const QString baseDir = baseUrl.fileName() + '/';
 
     foreach (const KIO::UDSEntry &entry, entries) {
diff --git a/ui/metalinkcreator/generalwidget.cpp \
b/ui/metalinkcreator/generalwidget.cpp index 7d8faf0..92f916b 100644
--- a/ui/metalinkcreator/generalwidget.cpp
+++ b/ui/metalinkcreator/generalwidget.cpp
@@ -87,7 +87,7 @@ void GeneralWidget::load(const KGetMetalink::Metalink &metalink) \
const  
 void GeneralWidget::save(KGetMetalink::Metalink *metalink)
 {
-    metalink->origin = KUrl(ui.origin->text());
+    metalink->origin = QUrl(ui.origin->text());
     metalink->dynamic = ui.dynamic->isChecked();
 
     metalink->published.clear();
diff --git a/ui/metalinkcreator/metalinkcreator.cpp \
b/ui/metalinkcreator/metalinkcreator.cpp index fdbbbc8..71648bd 100644
--- a/ui/metalinkcreator/metalinkcreator.cpp
+++ b/ui/metalinkcreator/metalinkcreator.cpp
@@ -29,7 +29,7 @@
 #include <QMimeData>
 #include <QStandardItemModel>
 
-#include <KFileDialog>
+#include <QFileDialog>
 #include <KLocalizedString>
 #include <KMessageBox>
 #include <QPushButton>
@@ -74,7 +74,7 @@ MetalinkCreator::MetalinkCreator(QWidget *parent)
 {
     create();
 
-    connect(this, SIGNAL(user1Clicked()), this, SLOT(slotSave()));
+    connect(finishButton(), &QPushButton::clicked, this, \
                &MetalinkCreator::slotSave);
     connect(this, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), \
this, SLOT(slotUpdateAssistantButtons(KPageWidgetItem*,KPageWidgetItem*)));  
     qRegisterMetaType<KGetMetalink::File>("KGetMetalink::File");
@@ -139,12 +139,12 @@ void MetalinkCreator::slotDelayedCreation()
 
 void MetalinkCreator::load()
 {
-    KUrl url = KUrl(uiIntroduction.load->text());
+    QUrl url = uiIntroduction.load->url();
     if (uiIntroduction.loadButton->isChecked() && url.isValid())
     {
         if (!KGetMetalink::HandleMetalink::load(url, &metalink))
         {
-            KMessageBox::error(this, i18n("Unable to load: %1", url.pathOrUrl()), \
i18n("Error")); +            KMessageBox::error(this, i18n("Unable to load: %1", \
url.toString()), i18n("Error"));  }
     }
 
@@ -156,12 +156,12 @@ void MetalinkCreator::slotSave()
 {
     m_general->save(&metalink);
 
-    KUrl url = KUrl(uiIntroduction.save->text());
+    QUrl url = uiIntroduction.save->url();
     if (url.isValid())
     {
         if(!KGetMetalink::HandleMetalink::save(url, &metalink))
         {
-            KMessageBox::error(this, i18n("Unable to save to: %1", url.pathOrUrl()), \
i18n("Error")); +            KMessageBox::error(this, i18n("Unable to save to: %1", \
url.toString()), i18n("Error"));  }
     }
 }
@@ -252,8 +252,8 @@ void MetalinkCreator::slotUpdateFilesButtons()
 
 void MetalinkCreator::slotAddLocalFilesClicked()
 {
-    QPointer<KFileDialog> dialog = new KFileDialog(KUrl(), QString(), this);
-    dialog->setMode(KFile::Files | KFile::ExistingOnly | KFile::LocalOnly);
+    QPointer<QFileDialog> dialog = new QFileDialog(this);
+    dialog->setFileMode(QFileDialog::ExistingFiles);
     if (dialog->exec() == QDialog::Accepted) {
         m_handler->slotFiles(dialog->selectedUrls());
     }
diff --git a/ui/metalinkcreator/metalinker.cpp b/ui/metalinkcreator/metalinker.cpp
index 652371b..c8b622e 100644
--- a/ui/metalinkcreator/metalinker.cpp
+++ b/ui/metalinkcreator/metalinker.cpp
@@ -161,12 +161,12 @@ void KGetMetalink::CommonData::load(const QDomElement &e)
     identity = e.firstChildElement("identity").text();
     version = e.firstChildElement("version").text();
     description = e.firstChildElement("description").text();
-    logo = KUrl(e.firstChildElement("logo").text());
+    logo = QUrl(e.firstChildElement("logo").text());
     copyright = e.firstChildElement("copyright").text();
 
     const QDomElement publisherElem = e.firstChildElement("publisher");
     publisher.name = publisherElem.attribute("name");
-    publisher.url = KUrl(publisherElem.attribute("url"));
+    publisher.url = QUrl(publisherElem.attribute("url"));
 
     for (QDomElement elemRes = e.firstChildElement("language"); !elemRes.isNull(); \
elemRes = elemRes.nextSiblingElement("language")) {  languages << elemRes.text();
@@ -317,7 +317,7 @@ void KGetMetalink::Metaurl::load(const QDomElement &e)
         priority = Metalink::MAX_URL_PRIORITY;
     }
     name = e.attribute("name");
-    url = KUrl(e.text());
+    url = QUrl(e.text());
 }
 
 void KGetMetalink::Metaurl::save(QDomElement &e) const
@@ -342,7 +342,7 @@ void KGetMetalink::Metaurl::save(QDomElement &e) const
 
 bool KGetMetalink::Metaurl::isValid()
 {
-    return url.isValid() && url.hasHost() && !url.protocol().isEmpty() && \
!type.isEmpty(); +    return url.isValid() && !url.host().isEmpty() && \
!url.scheme().isEmpty() && !type.isEmpty();  }
 
 void KGetMetalink::Metaurl::clear()
@@ -373,7 +373,7 @@ void KGetMetalink::Url::load(const QDomElement &e)
     if (priority > Metalink::MAX_URL_PRIORITY) {
         priority = Metalink::MAX_URL_PRIORITY;
     }
-    url = KUrl(e.text());
+    url = QUrl(e.text());
 }
 
 void KGetMetalink::Url::save(QDomElement &e) const
@@ -397,7 +397,7 @@ void KGetMetalink::Url::save(QDomElement &e) const
 
 bool KGetMetalink::Url::isValid()
 {
-    return url.isValid() && url.hasHost() && !url.protocol().isEmpty();
+    return url.isValid() && !url.host().isEmpty() && !url.scheme().isEmpty();
 }
 
 void KGetMetalink::Url::clear()
@@ -710,7 +710,7 @@ void KGetMetalink::Metalink::load(const QDomElement &e)
     published.setData(metalink.firstChildElement("published").text());
     updated.setData(metalink.firstChildElement("updated").text());
     const QDomElement originElem = metalink.firstChildElement("origin");
-    origin = KUrl(metalink.firstChildElement("origin").text());
+    origin = QUrl(metalink.firstChildElement("origin").text());
     if (originElem.hasAttribute("dynamic")) {
         bool worked = false;
         dynamic = originElem.attribute("dynamic").toInt(&worked);
@@ -796,7 +796,7 @@ void KGetMetalink::Metalink_v3::load(const QDomElement &e)
     const QDomElement metalinkDom = doc.firstChildElement("metalink");
 
     m_metalink.dynamic = (metalinkDom.attribute("type") == "dynamic");
-    m_metalink.origin = KUrl(metalinkDom.attribute("origin"));
+    m_metalink.origin = QUrl(metalinkDom.attribute("origin"));
     m_metalink.generator = metalinkDom.attribute("generator");
     m_metalink.published = parseDateConstruct(metalinkDom.attribute("pubdate"));
     m_metalink.updated = parseDateConstruct(metalinkDom.attribute("refreshdate"));
@@ -863,7 +863,7 @@ KGetMetalink::CommonData \
KGetMetalink::Metalink_v3::parseCommonData(const QDomEl  
     const QDomElement publisherElem = e.firstChildElement("publisher");
     data.publisher.name = publisherElem.firstChildElement("name").text();
-    data.publisher.url = KUrl(publisherElem.firstChildElement("url").text());
+    data.publisher.url = QUrl(publisherElem.firstChildElement("url").text());
 
     return data;
 }
@@ -916,7 +916,7 @@ KGetMetalink::Resources \
KGetMetalink::Metalink_v3::parseResources(const QDomElem  }
         const int priority = MAX_PREFERENCE - preference + 1;//convert old \
preference to new priority  
-        const KUrl link = KUrl(elemRes.text());
+        const QUrl link = QUrl(elemRes.text());
         QString type;
 
         if (link.fileName().endsWith(QLatin1String(".torrent"))) {
@@ -1232,9 +1232,9 @@ QString KGetMetalink::Metalink_v3::dateConstructToString(const \
KGetMetalink::Dat  }
 
 
-bool KGetMetalink::HandleMetalink::load(const KUrl &destination, \
KGetMetalink::Metalink *metalink) +bool KGetMetalink::HandleMetalink::load(const QUrl \
&destination, KGetMetalink::Metalink *metalink)  {
-    QFile file(destination.pathOrUrl());
+    QFile file(destination.toString());
     if (!file.open(QIODevice::ReadOnly))
     {
         return false;
@@ -1296,9 +1296,9 @@ bool KGetMetalink::HandleMetalink::load(const QByteArray &data, \
KGetMetalink::Me  return false;
 }
 
-bool KGetMetalink::HandleMetalink::save(const KUrl &destination, \
KGetMetalink::Metalink *metalink) +bool KGetMetalink::HandleMetalink::save(const QUrl \
&destination, KGetMetalink::Metalink *metalink)  {
-    QFile file(destination.pathOrUrl());
+    QFile file(destination.toString());
     if (!file.open(QIODevice::WriteOnly)) {
         return false;
     }
@@ -1362,7 +1362,7 @@ void KGetMetalink::MetalinkHttpParser::checkMetalinkHttp()
     job->addMetaData("PropagateHttpHeader", "true");
     job->setRedirectionHandlingEnabled(false);
     connect(job, SIGNAL(result(KJob*)), this, SLOT(slotHeaderResult(KJob*)));  // \
                Finished
-    connect(job, SIGNAL(redirection(KIO::Job*,KUrl)), this, \
SLOT(slotRedirection(KIO::Job*,KUrl))); // Redirection +    connect(job, \
SIGNAL(redirection(KIO::Job*,QUrl)), this, SLOT(slotRedirection(KIO::Job*,QUrl))); // \
                Redirection
     connect(job,SIGNAL(mimetype(KIO::Job*,QString)),this,SLOT(detectMime(KIO::Job*,QString))); \
// Mime detection.  kDebug() << " Verifying Metalink/HTTP Status" ;
     m_loop.exec();
@@ -1385,7 +1385,7 @@ void KGetMetalink::MetalinkHttpParser::slotHeaderResult(KJob* \
kjob)  // Handle the redirection... (Comment out if not desired)
     if (m_redirectionUrl.isValid()) {
        m_Url = m_redirectionUrl;
-       m_redirectionUrl = KUrl();
+       m_redirectionUrl = QUrl();
        checkMetalinkHttp();
     }
 
@@ -1393,7 +1393,7 @@ void KGetMetalink::MetalinkHttpParser::slotHeaderResult(KJob* \
kjob)  m_loop.exit();
 }
 
-void KGetMetalink::MetalinkHttpParser::slotRedirection(KIO::Job *job, const KUrl & \
url) +void KGetMetalink::MetalinkHttpParser::slotRedirection(KIO::Job *job, const \
QUrl & url)  {
     Q_UNUSED(job)
     m_redirectionUrl = url;
@@ -1456,7 +1456,7 @@ void KGetMetalink::MetalinkHttpParser::setMetalinkHSatus()
 
 }
 
-KUrl KGetMetalink::MetalinkHttpParser::getUrl()
+QUrl KGetMetalink::MetalinkHttpParser::getUrl()
 {
     return m_Url;
 }
diff --git a/ui/metalinkcreator/metalinker.h b/ui/metalinkcreator/metalinker.h
index 3733815..4f1c523 100644
--- a/ui/metalinkcreator/metalinker.h
+++ b/ui/metalinkcreator/metalinker.h
@@ -23,7 +23,7 @@
 #define Metalinker_H
 
 #include <KIO/Job>
-#include <KUrl>
+#include <QUrl>
 #include <QDate>
 #include <QDomElement>
 #include <QEventLoop>
@@ -83,7 +83,7 @@ class UrlText
         void clear();
 
         QString name;
-        KUrl url;
+        QUrl url;
 };
 
 /**
@@ -111,7 +111,7 @@ class CommonData
         QString version;
         QString description;
         QStringList oses;
-        KUrl logo;
+        QUrl logo;
         QStringList languages;
         UrlText publisher;
         QString copyright;
@@ -150,7 +150,7 @@ class Metaurl
          */
         QString name;
 
-        KUrl url;
+        QUrl url;
 };
 
 class Url
@@ -184,7 +184,7 @@ class Url
          */
         QString location;
 
-        KUrl url;
+        QUrl url;
 };
 
 class Resources
@@ -323,7 +323,7 @@ class Metalink
         bool dynamic;
         QString xmlns; //the xmlns value is ignored when saving, instead the data \
format described in the specification is always used  DateConstruct published; //when \
                the metalink was published
-        KUrl origin;
+        QUrl origin;
         QString generator;
         DateConstruct updated; //when the metalink was updated
         Files files;
@@ -388,7 +388,7 @@ class HandleMetalink
          * @param metalink the instance of Metalink where the metalink will be \
                stored
          * @return return true if it worked
          */
-        static bool load(const KUrl &destination, Metalink *metalink);
+        static bool load(const QUrl &destination, Metalink *metalink);
 
         /**
          * Loads data into metalink
@@ -405,7 +405,7 @@ class HandleMetalink
          * @param metalink the instance of metalink that will be written to the \
                filesystem
          * @return return true if it worked
          */
-        static bool save(const KUrl &destination, Metalink *metalink);
+        static bool save(const QUrl &destination, Metalink *metalink);
 
 #ifdef HAVE_NEPOMUK
         /**
@@ -420,7 +420,7 @@ class MetalinkHttpParser : public QObject
 {
     Q_OBJECT
     public:
-        MetalinkHttpParser(const KUrl& Url)
+        MetalinkHttpParser(const QUrl& Url)
             : m_Url(Url), m_MetalinkHSatus(false) , m_EtagValue(QString(""))
         {
             checkMetalinkHttp();
@@ -438,7 +438,7 @@ class MetalinkHttpParser : public QObject
          * @return the Url m_Url which is being tested for metalink
          */
 
-        KUrl getUrl();
+        QUrl getUrl();
         QMultiMap<QString, QString>* getHeaderInfo();
 
         /**
@@ -451,12 +451,12 @@ class MetalinkHttpParser : public QObject
         void slotHeaderResult(KJob* kjob);
         void checkMetalinkHttp();
         void detectMime(KIO::Job *  job, const QString &  type);
-        void slotRedirection(KIO::Job*, const KUrl&);
+        void slotRedirection(KIO::Job*, const QUrl&);
 
 
     private:
-        KUrl m_Url;
-        KUrl m_redirectionUrl;
+        QUrl m_Url;
+        QUrl m_redirectionUrl;
         bool m_MetalinkHSatus;
         QEventLoop m_loop;
         QMultiMap<QString, QString> m_headerInfo;
diff --git a/ui/metalinkcreator/urlwidget.cpp b/ui/metalinkcreator/urlwidget.cpp
index d429567..eae4bbe 100644
--- a/ui/metalinkcreator/urlwidget.cpp
+++ b/ui/metalinkcreator/urlwidget.cpp
@@ -116,7 +116,7 @@ void UrlWidget::save()
         for (int i = 0; i < m_mirrorModel->rowCount(); ++i)
         {
             KGetMetalink::Url url;
-            url.url = KUrl(m_mirrorModel->index(i, \
MirrorItem::Url).data(Qt::UserRole).toUrl()); +            url.url = \
                QUrl(m_mirrorModel->index(i, \
                MirrorItem::Url).data(Qt::UserRole).toUrl());
             url.priority = m_mirrorModel->index(i, \
                MirrorItem::Priority).data(Qt::UserRole).toInt();
             url.location = m_mirrorModel->index(i, \
MirrorItem::Country).data(Qt::UserRole).toString();  m_resources->urls.append(url);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic