[calligra] /: Port libs from KUrl to QUrl

Boudewijn Rempt boud at valdyas.org
Thu Sep 10 10:41:44 BST 2015


Git commit defb836a63608335988184e5ed0590588728f8be by Boudewijn Rempt.
Committed on 10/09/2015 at 09:41.
Pushed by rempt into branch 'master'.

Port libs from KUrl to QUrl

This means that several applications are back to unported status:

Sheets engine
QtQuick components
Karbon
Calligra Converter
Thumbnailer
Okular plugins

CCMAIL:calligra-devel at kde.org
CCMAIL:kimageshop at kde.org

It's also a really invasive change, so please help with testing...

M  +9    -9    CalligraProducts.cmake
M  +1    -1    libs/kokross/KoScriptManager.cpp
M  +2    -2    libs/kokross/KoScriptManagerAdd.cpp
M  +1    -1    libs/kokross/KoScriptingPart.cpp
M  +1    -1    libs/kopageapp/KoPADocument.cpp
M  +9    -9    libs/kopageapp/KoPAView.cpp
M  +2    -2    libs/kopageapp/KoPAView.h
M  +2    -2    libs/kopageapp/tools/backgroundTool/KoPABackgroundToolWidget.cpp
M  +6    -6    libs/main/KoApplication.cpp
M  +2    -2    libs/main/KoDetailsPane.h
M  +36   -36   libs/main/KoDocument.cpp
M  +9    -9    libs/main/KoDocument.h
M  +1    -1    libs/main/KoFilter.cpp
M  +1    -1    libs/main/KoFilterChain.cpp
M  +2    -2    libs/main/KoFilterManager.cpp
M  +1    -1    libs/main/KoFilterManager_p.cpp
M  +2    -2    libs/main/KoFilterManager_p.h
M  +31   -28   libs/main/KoMainWindow.cpp
M  +5    -5    libs/main/KoMainWindow.h
M  +4    -4    libs/main/KoOpenPane.cpp
M  +3    -3    libs/main/KoOpenPane.h
M  +9    -9    libs/main/KoPart.cpp
M  +4    -4    libs/main/KoPart.h
M  +2    -2    libs/main/KoPartAdaptor.cpp
M  +2    -2    libs/main/KoRecentDocumentsPane.cpp
M  +5    -7    libs/main/KoTemplateCreateDia.cpp
M  +2    -2    libs/main/KoTemplatesPane.cpp
M  +2    -2    libs/main/KoVersionDialog.cpp
M  +2    -2    libs/main/KoView.cpp
M  +1    -1    libs/widgets/KoDocumentInfoDlg.cpp
M  +2    -2    libs/widgets/KoDocumentInfoPropsPage.cpp
M  +1    -1    libs/widgets/KoFileDialog.cpp
M  +1    -1    libs/widgets/KoResourceItemChooser.cpp

http://commits.kde.org/calligra/defb836a63608335988184e5ed0590588728f8be

diff --git a/CalligraProducts.cmake b/CalligraProducts.cmake
index b110b4a..f14d118 100644
--- a/CalligraProducts.cmake
+++ b/CalligraProducts.cmake
@@ -84,15 +84,15 @@ calligra_define_product(PLUGIN_TEXTSHAPE "Text shape plugin"  REQUIRES LIB_CALLI
 # parts
 calligra_define_product(PART_WORDS "Words engine"  REQUIRES LIB_CALLIGRA LIB_KOMAIN PLUGIN_TEXTSHAPE)
 calligra_define_product(PART_STAGE "Stage engine"  REQUIRES LIB_CALLIGRA LIB_KOMAIN LIB_KOPAGEAPP)
-calligra_define_product(PART_SHEETS "Sheets engine"  REQUIRES LIB_CALLIGRA LIB_KOMAIN)
-calligra_define_product(PART_QTQUICK "QtQuick Plugin that provides Calligra components"  REQUIRES PART_WORDS PART_STAGE)# SHEETS_PART)
+calligra_define_product(PART_SHEETS "Sheets engine" UNPORTED REQUIRES LIB_CALLIGRA LIB_KOMAIN)
+calligra_define_product(PART_QTQUICK "QtQuick Plugin that provides Calligra components" UNPORTED REQUIRES PART_WORDS PART_STAGE)# SHEETS_PART)
 
 # apps
 calligra_define_product(APP_WORDS "Words app (for Desktop)"  REQUIRES PART_WORDS)
 calligra_define_product(APP_STAGE "Stage app (for Desktop)"  REQUIRES PART_STAGE)
-calligra_define_product(APP_SHEETS "Sheets app (for Desktop)"  REQUIRES PART_SHEETS)
+calligra_define_product(APP_SHEETS "Sheets app (for Desktop)" REQUIRES PART_SHEETS)
 calligra_define_product(APP_AUTHOR "Author app (for Desktop)"  REQUIRES PART_WORDS)
-calligra_define_product(APP_KARBON "Karbon app (for Desktop)"  REQUIRES LIB_CALLIGRA LIB_KOMAIN)
+calligra_define_product(APP_KARBON "Karbon app (for Desktop)"  UNPORTED REQUIRES LIB_CALLIGRA LIB_KOMAIN)
 calligra_define_product(APP_KRITA "Krita app (for Desktop)" REQUIRES LIB_CALLIGRA)
 calligra_define_product(APP_KEXI "Kexi app (for Desktop)" REQUIRES LIB_CALLIGRA)
 calligra_define_product(APP_FLOW "Flow app (for Desktop)" UNPORTED  REQUIRES LIB_CALLIGRA LIB_KOMAIN LIB_KOPAGEAPP)
@@ -103,13 +103,13 @@ calligra_define_product(APP_GEMINI "The Calligra Gemini application"  REQUIRES P
 calligra_define_product(DOC "Calligra Documentations" UNPORTED)
 
 # extras
-calligra_define_product(APP_CONVERTER "Format converter for commandline"  REQUIRES LIB_CALLIGRA LIB_KOMAIN)
+calligra_define_product(APP_CONVERTER "Format converter for commandline" UNPORTED REQUIRES LIB_CALLIGRA LIB_KOMAIN)
 calligra_define_product(FILEMANAGER_PROPERTIES "Plugin for the KDE file properties dialog"  REQUIRES LIB_CALLIGRA)
-calligra_define_product(FILEMANAGER_THUMBNAIL "Plugins for KDE filesystem thumbnailing"  REQUIRES LIB_CALLIGRA LIB_KOMAIN)
+calligra_define_product(FILEMANAGER_THUMBNAIL "Plugins for KDE filesystem thumbnailing"  UNPORTED REQUIRES LIB_CALLIGRA LIB_KOMAIN)
 calligra_define_product(FILEMANAGER_QUICKPRINT "Plugin for the filemanager adding a \"Print\" action")
 calligra_define_product(FILEMANAGER_TEMPLATES "File templates for filemanager")
-calligra_define_product(OKULAR_GENERATOR_ODP "Plugin for Okular adding support for ODP"   REQUIRES PART_STAGE)
-calligra_define_product(OKULAR_GENERATOR_ODT "Plugin for Okular adding support for ODT"  REQUIRES PART_WORDS)
+calligra_define_product(OKULAR_GENERATOR_ODP "Plugin for Okular adding support for ODP" UNPORTED REQUIRES PART_STAGE)
+calligra_define_product(OKULAR_GENERATOR_ODT "Plugin for Okular adding support for ODT" UNPORTED REQUIRES PART_WORDS)
 
 # more plugins
 calligra_define_product(PLUGIN_COLORENGINES "Colorengine plugins"  REQUIRES LIB_CALLIGRA)
@@ -139,7 +139,7 @@ calligra_define_product(FILTER_XLSX_TO_ODS "XLSX to ODS filter"  REQUIRES LIB_KO
 calligra_define_product(FILTER_XLS_TO_SHEETS "Sheets XLS import filter"  REQUIRES LIB_MSO LIB_KOMSOOXML PART_SHEETS)
 calligra_define_product(FILTER_SHEETS_TO_XLS "Sheets XLS export filter"  REQUIRES LIB_MSO LIB_KOMSOOXML PART_SHEETS)
 calligra_define_product(FILTER_CSV_TO_SHEETS "Sheets CSV import filter"  REQUIRES PART_SHEETS)
-calligra_define_product(FILTER_SHEETS_TO_CSV "Sheets CSV export filter"  REQUIRES PART_SHEETS)
+calligra_define_product(FILTER_SHEETS_TO_CSV "Sheets CSV export filter"  REQUIRES  PART_SHEETS)
 calligra_define_product(FILTER_APPLIXSPREAD_TO_KSPREAD "Applix Spreadsheet to KSpread filter"  REQUIRES PART_SHEETS)
 calligra_define_product(FILTER_DBASE_TO_KSPREAD "dBASE to KSpread filter"  REQUIRES LIB_KOMAIN)
 calligra_define_product(FILTER_GNUMERIC_TO_SHEETS "Sheets GNUMERIC import filter"  REQUIRES PART_SHEETS)
diff --git a/libs/kokross/KoScriptManager.cpp b/libs/kokross/KoScriptManager.cpp
index de570052..2d3c56e 100644
--- a/libs/kokross/KoScriptManager.cpp
+++ b/libs/kokross/KoScriptManager.cpp
@@ -171,7 +171,7 @@ bool KoScriptManagerCollection::isModified() const
 #if 0
 bool KoScriptManagerCollection::slotInstall() {
     KFileDialog* filedialog = new KFileDialog(
-        KUrl("kfiledialog:///KrossInstallPackage"), // startdir
+        QUrl("kfiledialog:///KrossInstallPackage"), // startdir
         "*.tar.gz *.tgz *.bz2", // filter
         0, // custom widget
         0 // parent
diff --git a/libs/kokross/KoScriptManagerAdd.cpp b/libs/kokross/KoScriptManagerAdd.cpp
index b42ffb0..9a9b227 100644
--- a/libs/kokross/KoScriptManagerAdd.cpp
+++ b/libs/kokross/KoScriptManagerAdd.cpp
@@ -98,7 +98,7 @@ KoScriptManagerAddFileWidget::KoScriptManagerAddFileWidget(KoScriptManagerAddWiz
     QVBoxLayout *layout = new QVBoxLayout(this);
     layout->setMargin(0);
     setLayout(layout);
-    m_filewidget = new KFileWidget(KUrl(startDirOrVariable), this);
+    m_filewidget = new KFileWidget(QUrl(startDirOrVariable), this);
 
     QStringList mimetypes;
     foreach (const QString &interpretername, Kross::Manager::self().interpreters()) {
@@ -183,7 +183,7 @@ void KoScriptManagerAddScriptWidget::showEvent(QShowEvent *event)
     action->setText(fi.baseName());
     //action->setDescription();
     if (fi.isFile()) {
-        action->setIconName(KMimeType::iconNameForUrl(KUrl(file)));
+        action->setIconName(KMimeType::iconNameForUrl(QUrl(file)));
         action->setEnabled(fi.exists());
     }
     action->setFile(file);
diff --git a/libs/kokross/KoScriptingPart.cpp b/libs/kokross/KoScriptingPart.cpp
index 811b90b..3812b6f 100644
--- a/libs/kokross/KoScriptingPart.cpp
+++ b/libs/kokross/KoScriptingPart.cpp
@@ -149,7 +149,7 @@ bool KoScriptingPart::showExecuteScriptFile()
         mimetypes.append(info->mimeTypes().join(" ").trimmed());
     }
     KFileDialog *filedialog = new KFileDialog(
-        KUrl("kfiledialog:///KrossExecuteScript"), // startdir
+        QUrl("kfiledialog:///KrossExecuteScript"), // startdir
         mimetypes.join(" "), // filter
         0, // custom widget
         0 // parent
diff --git a/libs/kopageapp/KoPADocument.cpp b/libs/kopageapp/KoPADocument.cpp
index 4b5824b..a624fba 100644
--- a/libs/kopageapp/KoPADocument.cpp
+++ b/libs/kopageapp/KoPADocument.cpp
@@ -867,6 +867,6 @@ void KoPADocument::updateDocumentURL()
     if (resourceManager()->hasResource(KoText::InlineTextObjectManager)) {
         QVariant var = resourceManager()->resource(KoText::InlineTextObjectManager);
         KoInlineTextObjectManager *om = var.value<KoInlineTextObjectManager*>();
-        om->setProperty(KoInlineObject::DocumentURL, url().pathOrUrl());
+        om->setProperty(KoInlineObject::DocumentURL, url().url(QUrl::PreferLocalFile));
     }
 }
diff --git a/libs/kopageapp/KoPAView.cpp b/libs/kopageapp/KoPAView.cpp
index 9e821d5..9122405 100644
--- a/libs/kopageapp/KoPAView.cpp
+++ b/libs/kopageapp/KoPAView.cpp
@@ -90,7 +90,7 @@
 #include <kmessagebox.h>
 #include <kio/netaccess.h>
 #include <QTemporaryFile>
-#include <kurl.h>
+#include <QUrl>
 
 
 class Q_DECL_HIDDEN KoPAView::Private
@@ -500,7 +500,7 @@ KAction* KoPAView::deleteSelectionAction() const
 
 void KoPAView::importDocument()
 {
-    KFileDialog *dialog = new KFileDialog( KUrl("kfiledialog:///OpenDialog"),QString(), this );
+    KFileDialog *dialog = new KFileDialog( QUrl("kfiledialog:///OpenDialog"),QString(), this );
     dialog->setObjectName( "file dialog" );
     dialog->setMode( KFile::File );
     if ( d->doc->pageType() == KoPageApp::Slide ) {
@@ -519,7 +519,7 @@ void KoPAView::importDocument()
 
     dialog->setMimeFilter( mimeFilter );
     if (dialog->exec() == QDialog::Accepted) {
-        KUrl url(dialog->selectedUrl());
+        QUrl url(dialog->selectedUrl());
         QString tmpFile;
         if ( KIO::NetAccess::download( url, tmpFile, 0 ) ) {
             QFile file( tmpFile );
@@ -532,11 +532,11 @@ void KoPAView::importDocument()
             data.setData( KoOdf::mimeType( d->doc->documentType() ), ba);
             KoPAPastePage paste( d->doc,d->activePage );
             if ( ! paste.paste( d->doc->documentType(), &data ) ) {
-                KMessageBox::error(0, i18n("Could not import\n%1", url.pathOrUrl()));
+                KMessageBox::error(0, i18n("Could not import\n%1", url.url(QUrl::PreferLocalFile)));
             }
         }
         else {
-            KMessageBox::error(0, i18n("Could not import\n%1", url.pathOrUrl()));
+            KMessageBox::error(0, i18n("Could not import\n%1", url.url(QUrl::PreferLocalFile)));
         }
     }
     delete dialog;
@@ -982,7 +982,7 @@ QPixmap KoPAView::pageThumbnail(KoPAPageBase* page, const QSize& size)
     return d->doc->pageThumbnail(page, size);
 }
 
-bool KoPAView::exportPageThumbnail( KoPAPageBase * page, const KUrl& url, const QSize& size,
+bool KoPAView::exportPageThumbnail( KoPAPageBase * page, const QUrl &url, const QSize& size,
                                     const char * format, int quality )
 {
     bool res = false;
@@ -998,9 +998,9 @@ bool KoPAView::exportPageThumbnail( KoPAPageBase * page, const KUrl& url, const
             pix = pix.copy( 0, 0, size.width(), size.height() );
         }
         // save the pixmap to the desired file
-        KUrl fileUrl( url );
-        if ( fileUrl.protocol().isEmpty() ) {
-            fileUrl.setProtocol( "file" );
+        QUrl fileUrl( url );
+        if ( fileUrl.scheme().isEmpty() ) {
+            fileUrl.setScheme( "file" );
         }
         const bool bLocalFile = fileUrl.isLocalFile();
         QTemporaryFile* tmpFile = bLocalFile ? 0 : new QTemporaryFile();
diff --git a/libs/kopageapp/KoPAView.h b/libs/kopageapp/KoPAView.h
index e4fb239..0ed44ca 100644
--- a/libs/kopageapp/KoPAView.h
+++ b/libs/kopageapp/KoPAView.h
@@ -38,7 +38,7 @@ class KoPADocumentStructureDocker;
 class KoRuler;
 class KoShapeManager;
 class KoZoomController;
-class KUrl;
+class QUrl;
 class KAction;
 
 class QTextDocument;
@@ -162,7 +162,7 @@ public:
      *
      * @returns whether the image was successfully saved
      */
-    bool exportPageThumbnail( KoPAPageBase * page, const KUrl& url, const QSize& size = QSize( 512, 512 ),
+    bool exportPageThumbnail( KoPAPageBase * page, const QUrl &url, const QSize& size = QSize( 512, 512 ),
                               const char * format = 0, int quality = -1 );
 
     /// Update page navigation actions
diff --git a/libs/kopageapp/tools/backgroundTool/KoPABackgroundToolWidget.cpp b/libs/kopageapp/tools/backgroundTool/KoPABackgroundToolWidget.cpp
index 4070bb3..bfe0c1a 100644
--- a/libs/kopageapp/tools/backgroundTool/KoPABackgroundToolWidget.cpp
+++ b/libs/kopageapp/tools/backgroundTool/KoPABackgroundToolWidget.cpp
@@ -19,7 +19,7 @@
 
 #include "KoPABackgroundToolWidget.h"
 
-#include <kurl.h>
+#include <QUrl>
 #include <kfiledialog.h>
 #include <kio/netaccess.h>
 
@@ -103,7 +103,7 @@ void KoPABackgroundToolWidget::setBackgroundImage()
         return;
     }
 
-    KUrl url = KFileDialog::getOpenUrl();
+    QUrl url = KFileDialog::getOpenUrl();
     if ( !url.isEmpty() ) {
         QString tmpFile;
         if ( KIO::NetAccess::download(  url, tmpFile, 0 ) ) {
diff --git a/libs/main/KoApplication.cpp b/libs/main/KoApplication.cpp
index 33e1f01..641f1aa 100644
--- a/libs/main/KoApplication.cpp
+++ b/libs/main/KoApplication.cpp
@@ -401,7 +401,7 @@ bool KoApplication::start()
 
         if (autoSaveFiles.size() > 0) {
             short int numberOfOpenDocuments = 0; // number of documents open
-            KUrl url;
+            QUrl url;
             // bah, we need to re-use the document that was already created
             url.setPath(QDir::homePath() + "/" + autoSaveFiles.takeFirst());
             if (mainWindow->openDocument(part, url)) {
@@ -519,13 +519,13 @@ bool KoApplication::start()
                     }
 
                     if (!templatePath.isEmpty()) {
-                        KUrl templateBase;
+                        QUrl templateBase;
                         templateBase.setPath(templatePath);
                         KDesktopFile templateInfo(templatePath);
 
                         QString templateName = templateInfo.readUrl();
-                        KUrl templateURL;
-                        templateURL.setPath(templateBase.directory() + '/' + templateName);
+                        QUrl templateURL;
+                        templateURL.setPath(templateBase.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path() + '/' + templateName);
                         if (mainWindow->openDocument(part, templateURL)) {
                             doc->resetURL();
                             doc->setEmpty();
@@ -533,7 +533,7 @@ bool KoApplication::start()
                             kDebug(30003) << "Template loaded...";
                             numberOfOpenDocuments++;
                         } else {
-                            KMessageBox::error(0, i18n("Template %1 failed to load.", templateURL.prettyUrl()));
+                            KMessageBox::error(0, i18n("Template %1 failed to load.", templateURL.toDisplayString()));
                             delete mainWindow;
                         }
                     }
@@ -547,7 +547,7 @@ bool KoApplication::start()
                                           <<"\t100" << endl;
                         }
                         if (!roundtripFileName.isEmpty()) {
-                            part->document()->saveAs(KUrl("file:"+roundtripFileName));
+                            part->document()->saveAs(QUrl("file:"+roundtripFileName));
                         }
                         // close the document
                         mainWindow->slotFileQuit();
diff --git a/libs/main/KoDetailsPane.h b/libs/main/KoDetailsPane.h
index a6d7118..b839594 100644
--- a/libs/main/KoDetailsPane.h
+++ b/libs/main/KoDetailsPane.h
@@ -23,7 +23,7 @@
 
 class QEvent;
 class KComponentData;
-class KUrl;
+class QUrl;
 class QStandardItemModel;
 
 class KoDetailsPanePrivate;
@@ -45,7 +45,7 @@ public:
 
 Q_SIGNALS:
     /// Emitted when a file is requested to be opened
-    void openUrl(const KUrl&);
+    void openUrl(const QUrl&);
 
     /// This is used to keep all splitters in different details panes synced
     void splitterResized(KoDetailsPane* sender, const QList<int>& sizes);
diff --git a/libs/main/KoDocument.cpp b/libs/main/KoDocument.cpp
index 9438684..2a9b48d 100644
--- a/libs/main/KoDocument.cpp
+++ b/libs/main/KoDocument.cpp
@@ -77,10 +77,10 @@
 #include <QApplication>
 
 // Define the protocol used here for embedded documents' URL
-// This used to "store" but KUrl didn't like it,
+// This used to "store" but QUrl didn't like it,
 // so let's simply make it "tar" !
 #define STORE_PROTOCOL "tar"
-// The internal path is a hack to make KUrl happy and for document children
+// The internal path is a hack to make QUrl happy and for document children
 #define INTERNAL_PROTOCOL "intern"
 #define INTERNAL_PREFIX "intern:/"
 // Warning, keep it sync in koStore.cc
@@ -241,14 +241,14 @@ public:
     KIO::FileCopyJob * m_job;
     KIO::StatJob * m_statJob;
     KIO::FileCopyJob * m_uploadJob;
-    KUrl m_originalURL; // for saveAs
+    QUrl m_originalURL; // for saveAs
     QString m_originalFilePath; // for saveAs
     bool m_saveOk : 1;
     bool m_waitForSave : 1;
     bool m_duringSaveAs : 1;
     bool m_bTemp: 1;      // If @p true, @p m_file is a temporary file that needs to be deleted later.
     bool m_bAutoDetectedMime : 1; // whether the mimetype in the arguments was detected by the part itself
-    KUrl m_url; // Remote (or local) url - the one displayed to the user.
+    QUrl m_url; // Remote (or local) url - the one displayed to the user.
     QString m_file; // Local file - the only one the part implementation should deal with.
     QEventLoop m_eventLoop;
 
@@ -316,7 +316,7 @@ public:
         tempFile.open();
         m_file = tempFile.fileName();
 
-        KUrl destURL;
+        QUrl destURL;
         destURL.setPath( m_file );
         KIO::JobFlags flags = KIO::DefaultFlags;
         flags |= KIO::Overwrite;
@@ -384,7 +384,7 @@ public:
         // this could maybe confuse some apps? So for now we'll just fallback to KIO::get
         // and error again. Well, maybe this even helps with wrong stat results.
         if (!job->error()) {
-            const KUrl localUrl = static_cast<KIO::StatJob*>(job)->mostLocalUrl();
+            const QUrl localUrl = static_cast<KIO::StatJob*>(job)->mostLocalUrl();
             if (localUrl.isLocalFile()) {
                 m_file = localUrl.toLocalFile();
                 openLocalFile();
@@ -419,7 +419,7 @@ public:
         }
         else
         {
-            ::org::kde::KDirNotify::emitFilesAdded(QUrl::fromLocalFile(m_url.directory()));
+            ::org::kde::KDirNotify::emitFilesAdded(QUrl::fromLocalFile(m_url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path()));
 
             m_uploadJob = 0;
             document->setModified( false );
@@ -427,7 +427,7 @@ public:
             m_saveOk = true;
         }
         m_duringSaveAs = false;
-        m_originalURL = KUrl();
+        m_originalURL = QUrl();
         m_originalFilePath.clear();
         if (m_waitForSave) {
             m_eventLoop.quit();
@@ -484,7 +484,7 @@ KoPart *KoDocument::documentPart() const
     return d->parentPart;
 }
 
-bool KoDocument::exportDocument(const KUrl & _url)
+bool KoDocument::exportDocument(const QUrl &_url)
 {
     bool ret;
 
@@ -498,7 +498,7 @@ bool KoDocument::exportDocument(const KUrl & _url)
     // reimplementing saveFile() (Note: importDocument() and exportDocument()
     // will remain non-virtual).
     //
-    KUrl oldURL = url();
+    QUrl oldURL = url();
     QString oldFile = localFilePath();
 
     bool wasModified = isModified();
@@ -557,11 +557,11 @@ bool KoDocument::saveFile()
                                      entry,
                                      d->parentPart->currentMainwindow())) {     // this file exists => backup
                 emit statusBarMessage(i18n("Making backup..."));
-                KUrl backup;
+                QUrl backup;
                 if (d->backupPath.isEmpty())
                     backup = url();
                 else
-                    backup = d->backupPath + '/' + url().fileName();
+                    backup = QUrl::fromLocalFile(d->backupPath + '/' + url().fileName());
                 backup.setPath(backup.path() + QString::fromLatin1("~"));
                 KFileItem item(entry, url());
                 Q_ASSERT(item.name() == url().fileName());
@@ -1005,7 +1005,7 @@ bool KoDocument::saveToStream(QIODevice *dev)
     return nwritten == (int)s.size();
 }
 
-QString KoDocument::checkImageMimeTypes(const QString &mimeType, const KUrl &url) const
+QString KoDocument::checkImageMimeTypes(const QString &mimeType, const QUrl &url) const
 {
     if (!url.isLocalFile()) return mimeType;
 
@@ -1051,9 +1051,9 @@ bool KoDocument::saveToStore(KoStore *_store, const QString & _path)
     _store->pushDirectory();
     // Use the path as the internal url
     if (_path.startsWith(STORE_PROTOCOL))
-        setUrl(KUrl(_path));
+        setUrl(QUrl(_path));
     else // ugly hack to pass a relative URI
-        setUrl(KUrl(INTERNAL_PREFIX +  _path));
+        setUrl(QUrl(INTERNAL_PREFIX +  _path));
 
     // In the current directory we're the king :-)
     if (_store->open("root")) {
@@ -1172,9 +1172,9 @@ QString KoDocument::autoSaveFile(const QString & path) const
         retval = QString("%1/.%2-%3-%4-autosave%5").arg(QDir::homePath()).arg(d->parentPart->componentData().componentName()).arg(QApplication::applicationPid()).arg(objectName()).arg(extension);
 #endif
     } else {
-        KUrl url = KUrl::fromPath(path);
+        QUrl url = QUrl::fromLocalFile(path);
         Q_ASSERT(url.isLocalFile());
-        QString dir = url.directory(KUrl::AppendTrailingSlash);
+        QString dir = QFileInfo(url.toLocalFile()).absolutePath();
         QString filename = url.fileName();
         retval = QString("%1.%2-autosave%3").arg(dir).arg(filename).arg(extension);
     }
@@ -1186,7 +1186,7 @@ void KoDocument::setDisregardAutosaveFailure(bool disregardFailure)
     d->disregardAutosaveFailure = disregardFailure;
 }
 
-bool KoDocument::importDocument(const KUrl & _url)
+bool KoDocument::importDocument(const QUrl &_url)
 {
     bool ret;
 
@@ -1210,7 +1210,7 @@ bool KoDocument::importDocument(const KUrl & _url)
 }
 
 
-bool KoDocument::openUrl(const KUrl & _url)
+bool KoDocument::openUrl(const QUrl &_url)
 {
     kDebug(30003) << "url=" << _url.url();
     d->lastErrorMessage.clear();
@@ -1223,7 +1223,7 @@ bool KoDocument::openUrl(const KUrl & _url)
 
     abortLoad();
 
-    KUrl url(_url);
+    QUrl url(_url);
     bool autosaveOpened = false;
     d->isLoading = true;
     if (url.isLocalFile() && d->shouldCheckAutoSaveFile) {
@@ -1360,7 +1360,7 @@ bool KoDocument::openFile()
     d->specialOutputFlag = 0;
     QByteArray _native_format = nativeFormatMimeType();
 
-    KUrl u(localFilePath());
+    QUrl u(localFilePath());
     QString typeName = mimeType();
 
     if (typeName.isEmpty()) {
@@ -1935,9 +1935,9 @@ bool KoDocument::loadFromStore(KoStore *_store, const QString& url)
     _store->pushDirectory();
     // Store as document URL
     if (url.startsWith(STORE_PROTOCOL)) {
-        setUrl(url);
+        setUrl(QUrl::fromUserInput(url));
     } else {
-        setUrl(KUrl(INTERNAL_PREFIX + url));
+        setUrl(QUrl(INTERNAL_PREFIX + url));
         _store->enterDirectory(url);
     }
 
@@ -2109,7 +2109,7 @@ int KoDocument::queryCloseDia()
 
 QString KoDocument::prettyPathOrUrl() const
 {
-    QString _url( url().pathOrUrl() );
+    QString _url(url().toDisplayString());
 #ifdef Q_WS_WIN
     if (url().isLocalFile()) {
         _url = QDir::convertSeparators(_url);
@@ -2273,9 +2273,9 @@ void KoDocument::setStoreInternal(bool i)
 
 bool KoDocument::hasExternURL() const
 {
-    return    !url().protocol().isEmpty()
-            && url().protocol() != STORE_PROTOCOL
-            && url().protocol() != INTERNAL_PROTOCOL;
+    return    !url().scheme().isEmpty()
+            && url().scheme() != STORE_PROTOCOL
+            && url().scheme() != INTERNAL_PROTOCOL;
 }
 
 static const struct {
@@ -2408,7 +2408,7 @@ int KoDocument::defaultAutoSave()
 }
 
 void KoDocument::resetURL() {
-    setUrl(KUrl());
+    setUrl(QUrl());
     setLocalFilePath(QString());
 }
 
@@ -2433,7 +2433,7 @@ bool KoDocument::isReadWrite() const
     return d->readwrite;
 }
 
-KUrl KoDocument::url() const
+QUrl KoDocument::url() const
 {
     return d->m_url;
 }
@@ -2462,7 +2462,7 @@ bool KoDocument::closeUrl(bool promptToSave)
 }
 
 
-bool KoDocument::saveAs( const KUrl & kurl )
+bool KoDocument::saveAs( const QUrl &kurl )
 {
     if (!kurl.isValid())
     {
@@ -2479,7 +2479,7 @@ bool KoDocument::saveAs( const KUrl & kurl )
         d->m_url = d->m_originalURL;
         d->m_file = d->m_originalFilePath;
         d->m_duringSaveAs = false;
-        d->m_originalURL = KUrl();
+        d->m_originalURL = QUrl();
         d->m_originalFilePath.clear();
     }
 
@@ -2552,7 +2552,7 @@ void KoDocument::abortLoad()
 }
 
 
-void KoDocument::setUrl(const KUrl &url)
+void KoDocument::setUrl(const QUrl &url)
 {
     d->m_url = url;
 }
@@ -2596,7 +2596,7 @@ bool KoDocument::queryClose()
                     mainWindow = d->parentPart->mainWindows()[0];
                 }
                 KoFileDialog dialog(mainWindow, KoFileDialog::SaveFile, "SaveDocument");
-                KUrl url = dialog.filename();
+                QUrl url = QUrl::fromLocalFile(dialog.filename());
                 if (url.isEmpty())
                     return false;
 
@@ -2625,7 +2625,7 @@ bool KoDocument::saveToUrl()
         Q_ASSERT( !d->m_bTemp );
         d->m_saveOk = true;
         d->m_duringSaveAs = false;
-        d->m_originalURL = KUrl();
+        d->m_originalURL = QUrl();
         d->m_originalFilePath.clear();
         return true; // Nothing to do
     }
@@ -2640,7 +2640,7 @@ bool KoDocument::saveToUrl()
         tempFile->open();
         QString uploadFile = tempFile->fileName();
         delete tempFile;
-        KUrl uploadUrl;
+        QUrl uploadUrl;
         uploadUrl.setPath( uploadFile );
         // Create hardlink
         if (::link(QFile::encodeName(d->m_file), QFile::encodeName(uploadFile)) != 0) {
@@ -2660,7 +2660,7 @@ bool KoDocument::saveToUrl()
 }
 
 
-bool KoDocument::openUrlInternal(const KUrl &url)
+bool KoDocument::openUrlInternal(const QUrl &url)
 {
     if ( !url.isValid() )
         return false;
diff --git a/libs/main/KoDocument.h b/libs/main/KoDocument.h
index a4ed7f0..b4c4425 100644
--- a/libs/main/KoDocument.h
+++ b/libs/main/KoDocument.h
@@ -113,7 +113,7 @@ public:
      * Reimplemented from KoParts::ReadWritePart for internal reasons
      * (for the autosave functionality)
      */
-    virtual bool openUrl(const KUrl & url);
+    virtual bool openUrl(const QUrl &url);
 
     /**
      * Opens the document given by @p url, without storing the URL
@@ -125,7 +125,7 @@ public:
      *       Open operation (in any reimplementation of openUrl() or openFile())
      *       call isImporting().
      */
-    bool importDocument(const KUrl &url);
+    bool importDocument(const QUrl &url);
 
     /**
      * Saves the document as @p url without changing the state of the
@@ -137,7 +137,7 @@ public:
      *       from an ordinary Save operation (in any reimplementation of
      *       saveFile()) call isExporting().
      */
-    bool exportDocument(const KUrl &url);
+    bool exportDocument(const QUrl &url);
 
     /**
      * @brief Sets whether the document can be edited or is read only.
@@ -511,7 +511,7 @@ public:
      * Sets the document URL to empty URL
      * KParts doesn't allow this, but %Calligra apps have e.g. templates
      * After using loadNativeFormat on a template, one wants
-     * to set the url to KUrl()
+     * to set the url to QUrl()
      */
     void resetURL();
 
@@ -742,12 +742,12 @@ public:
 
     bool isReadWrite() const;
 
-    KUrl url() const;
-    void setUrl(const KUrl &url);
+    QUrl url() const;
+    void setUrl(const QUrl &url);
 
     virtual bool closeUrl(bool promptToSave = true);
 
-    virtual bool saveAs( const KUrl &url );
+    virtual bool saveAs( const QUrl &url );
 
 public Q_SLOTS:
 
@@ -771,7 +771,7 @@ protected:
 private:
     bool saveToStream(QIODevice *dev);
 
-    QString checkImageMimeTypes(const QString &mimeType, const KUrl& url) const;
+    QString checkImageMimeTypes(const QString &mimeType, const QUrl &url) const;
 
     bool loadNativeFormatFromStore(const QString& file);
     bool loadNativeFormatFromStoreInternal(KoStore *store);
@@ -783,7 +783,7 @@ private:
 
     bool queryClose();
     bool saveToUrl();
-    bool openUrlInternal(const KUrl &url);
+    bool openUrlInternal(const QUrl &url);
 
     void abortLoad();
 
diff --git a/libs/main/KoFilter.cpp b/libs/main/KoFilter.cpp
index 0c7dc0b..9947d94 100644
--- a/libs/main/KoFilter.cpp
+++ b/libs/main/KoFilter.cpp
@@ -21,7 +21,7 @@ Boston, MA 02110-1301, USA.
 #include "KoFilter.h"
 
 #include <QFile>
-#include <kurl.h>
+#include <QUrl>
 #include <kdebug.h>
 #include <QStack>
 #include "KoFilterManager.h"
diff --git a/libs/main/KoFilterChain.cpp b/libs/main/KoFilterChain.cpp
index cea13e2..5e4cfb6 100644
--- a/libs/main/KoFilterChain.cpp
+++ b/libs/main/KoFilterChain.cpp
@@ -501,7 +501,7 @@ KoStoreDevice* KoFilterChain::storageCleanupHelper(KoStore** storage)
 
 KoDocument* KoFilterChain::createDocument(const QString& file)
 {
-    KUrl url;
+    QUrl url;
     url.setPath(file);
     KMimeType::Ptr t = KMimeType::findByUrl(url, 0, true);
     if (t->name() == KMimeType::defaultMimeType()) {
diff --git a/libs/main/KoFilterManager.cpp b/libs/main/KoFilterManager.cpp
index 29f7564..fd6b3d3 100644
--- a/libs/main/KoFilterManager.cpp
+++ b/libs/main/KoFilterManager.cpp
@@ -81,7 +81,7 @@ QString KoFilterManager::importDocument(const QString& url,
 {
     // Find the mime type for the file to be imported.
     QString  typeName(documentMimeType);
-    KUrl u(url);
+    QUrl u(url);
     KMimeType::Ptr t;
     if (documentMimeType.isEmpty()) {
         t = KMimeType::findByUrl(u, 0, true);
@@ -200,7 +200,7 @@ KoFilter::ConversionStatus KoFilterManager::exportDocument(const QString& url, Q
         kDebug(30500) << "Using the mimetype hint:" << m_importUrlMimetypeHint;
         m_graph.setSourceMimeType(m_importUrlMimetypeHint);
     } else {
-        KUrl u;
+        QUrl u;
         u.setPath(m_importUrl);
         KMimeType::Ptr t = KMimeType::findByUrl(u, 0, true);
         if (!t || t->name() == KMimeType::defaultMimeType()) {
diff --git a/libs/main/KoFilterManager_p.cpp b/libs/main/KoFilterManager_p.cpp
index b66b36c..6db6663 100644
--- a/libs/main/KoFilterManager_p.cpp
+++ b/libs/main/KoFilterManager_p.cpp
@@ -32,7 +32,7 @@ Boston, MA 02110-1301, USA.
 
 #include <unistd.h>
 
-KoFilterChooser::KoFilterChooser(QWidget *parent, const QStringList &mimeTypes, const QString &/*nativeFormat*/, const KUrl &url)
+KoFilterChooser::KoFilterChooser(QWidget *parent, const QStringList &mimeTypes, const QString &/*nativeFormat*/, const QUrl &url)
         : KDialog(parent),
         m_mimeTypes(mimeTypes)
 {
diff --git a/libs/main/KoFilterManager_p.h b/libs/main/KoFilterManager_p.h
index b905cc0..aa13ed2 100644
--- a/libs/main/KoFilterManager_p.h
+++ b/libs/main/KoFilterManager_p.h
@@ -23,7 +23,7 @@ Boston, MA 02110-1301, USA.
 
 #include "KoFilterManager.h"
 
-#include <kurl.h>
+#include <QUrl>
 #include <kdialog.h>
 #include <KoProgressUpdater.h>
 
@@ -53,7 +53,7 @@ class KoFilterChooser : public KDialog
 
 public:
     KoFilterChooser(QWidget *parent, const QStringList &mimeTypes,
-                    const QString &nativeFormat = QString(), const KUrl &url = KUrl());
+                    const QString &nativeFormat = QString(), const QUrl &url = QUrl());
     ~KoFilterChooser();
 
     QString filterSelected();
diff --git a/libs/main/KoMainWindow.cpp b/libs/main/KoMainWindow.cpp
index 5ee3e4b..9197c29 100644
--- a/libs/main/KoMainWindow.cpp
+++ b/libs/main/KoMainWindow.cpp
@@ -223,7 +223,7 @@ public:
     bool isImporting;
     bool isExporting;
 
-    KUrl lastExportUrl;
+    QUrl lastExportUrl;
     QByteArray lastExportedFormat;
     int lastExportSpecialOutputFlag;
 
@@ -603,15 +603,15 @@ void KoMainWindow::setReadWrite(bool readwrite)
     updateCaption();
 }
 
-void KoMainWindow::addRecentURL(const KUrl& url)
+void KoMainWindow::addRecentURL(const QUrl &url)
 {
-    kDebug(30003) << "KoMainWindow::addRecentURL url=" << url.prettyUrl();
+    kDebug(30003) << "KoMainWindow::addRecentURL url=" << url.toDisplayString();
     // Add entry to recent documents list
     // (call coming from KoDocument because it must work with cmd line, template dlg, file/open, etc.)
     if (!url.isEmpty()) {
         bool ok = true;
         if (url.isLocalFile()) {
-            QString path = url.toLocalFile(KUrl::RemoveTrailingSlash);
+            QString path = url.adjusted(QUrl::StripTrailingSlash).toLocalFile();
             const QStringList tmpDirs = KGlobal::dirs()->resourceDirs("tmp");
             for (QStringList::ConstIterator it = tmpDirs.begin() ; ok && it != tmpDirs.end() ; ++it)
                 if (path.contains(*it))
@@ -621,7 +621,7 @@ void KoMainWindow::addRecentURL(const KUrl& url)
                 KRecentDirs::add(":OpenDialog", QFileInfo(path).dir().canonicalPath());
             }
         } else {
-            KRecentDocument::add(url.url(KUrl::RemoveTrailingSlash), true);
+            KRecentDocument::add(url.url(QUrl::StripTrailingSlash), true);
         }
         if (ok) {
             d->recent->addUrl(url);
@@ -682,8 +682,8 @@ void KoMainWindow::updateCaption()
         }
 
         updateCaption(caption, d->rootDocument->isModified());
-        if (!rootDocument()->url().fileName(KUrl::ObeyTrailingSlash).isEmpty())
-            d->saveAction->setToolTip(i18n("Save as %1", d->rootDocument->url().fileName(KUrl::ObeyTrailingSlash)));
+        if (!rootDocument()->url().fileName().isEmpty())
+            d->saveAction->setToolTip(i18n("Save as %1", d->rootDocument->url().fileName()));
         else
             d->saveAction->setToolTip(i18n("Save"));
     }
@@ -720,7 +720,7 @@ KoView *KoMainWindow::rootView() const
     return d->rootViews.first();
 }
 
-bool KoMainWindow::openDocument(const KUrl & url)
+bool KoMainWindow::openDocument(const QUrl &url)
 {
     if (!KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, 0)) {
         KMessageBox::error(0, i18n("The file %1 does not exist.", url.url()));
@@ -731,7 +731,7 @@ bool KoMainWindow::openDocument(const KUrl & url)
     return openDocumentInternal(url);
 }
 
-bool KoMainWindow::openDocument(KoPart *newPart, const KUrl & url)
+bool KoMainWindow::openDocument(KoPart *newPart, const QUrl &url)
 {
     // the part always has a document; the document doesn't know about the part.
     KoDocument *newdoc = newPart->document();
@@ -749,7 +749,7 @@ bool KoMainWindow::openDocument(KoPart *newPart, const KUrl & url)
     return openDocumentInternal(url, newPart, newdoc);
 }
 
-bool KoMainWindow::openDocumentInternal(const KUrl & url, KoPart *newpart, KoDocument *newdoc)
+bool KoMainWindow::openDocumentInternal(const QUrl &url, KoPart *newpart, KoDocument *newdoc)
 {
     kDebug(30003) <<"KoMainWindow::openDocument" << url.url();
 
@@ -911,7 +911,7 @@ bool KoMainWindow::saveDocument(bool saveas, bool silent, int specialOutputFlag)
     connect(d->rootDocument, SIGNAL(completed()), this, SLOT(slotSaveCompleted()));
     connect(d->rootDocument, SIGNAL(canceled(const QString &)), this, SLOT(slotSaveCanceled(const QString &)));
 
-    KUrl oldURL = d->rootDocument->url();
+    QUrl oldURL = d->rootDocument->url();
     QString oldFile = d->rootDocument->localFilePath();
 
     QByteArray _native_format = d->rootDocument->nativeFormatMimeType();
@@ -919,7 +919,7 @@ bool KoMainWindow::saveDocument(bool saveas, bool silent, int specialOutputFlag)
 
     int oldSpecialOutputFlag = d->rootDocument->specialOutputFlag();
 
-    KUrl suggestedURL = d->rootDocument->url();
+    QUrl suggestedURL = d->rootDocument->url();
 
     QStringList mimeFilter;
     KMimeType::Ptr mime = KMimeType::mimeType(_native_format);
@@ -957,7 +957,8 @@ bool KoMainWindow::saveDocument(bool saveas, bool silent, int specialOutputFlag)
                 }
             }
 
-            suggestedURL.setFileName(suggestedFilename);
+            suggestedURL = suggestedURL.adjusted(QUrl::RemoveFilename);
+            suggestedURL.setPath(suggestedURL.path() + suggestedFilename);
         }
 
         // force the user to choose outputMimeType
@@ -976,14 +977,14 @@ bool KoMainWindow::saveDocument(bool saveas, bool silent, int specialOutputFlag)
         dialog.setDefaultDir((isExporting() && !d->lastExportUrl.isEmpty()) ?
                                 d->lastExportUrl.toLocalFile() : suggestedURL.toLocalFile());
         dialog.setMimeTypeFilters(mimeFilter);
-        KUrl newURL = dialog.filename();
+        QUrl newURL = QUrl::fromUserInput(dialog.filename());
 
         if (newURL.isLocalFile()) {
             QString fn = newURL.toLocalFile();
             if (QFileInfo(fn).completeSuffix().isEmpty()) {
                 KMimeType::Ptr mime = KMimeType::mimeType(_native_format);
                 fn.append(mime->mainExtension());
-                newURL = KUrl::fromPath(fn);
+                newURL = QUrl::fromLocalFile(fn);
             }
         }
 
@@ -1026,7 +1027,8 @@ bool KoMainWindow::saveDocument(bool saveas, bool silent, int specialOutputFlag)
                 } else { // current filename extension wrong anyway
                     if (dot > 0) fileName = fileName.left(dot);
                 }
-                newURL.setFileName(fileName);
+                newURL = newURL.adjusted(QUrl::RemoveFilename);
+                newURL.setPath(newURL.path() + fileName);
             }
         }
 
@@ -1294,7 +1296,7 @@ void KoMainWindow::slotFileNew()
 
 void KoMainWindow::slotFileOpen()
 {
-    KUrl url;
+    QUrl url;
     if (!isImporting()) {
         KoFileDialog dialog(this, KoFileDialog::OpenFile, "OpenDocument");
         dialog.setCaption(i18n("Open Document"));
@@ -1303,7 +1305,7 @@ void KoMainWindow::slotFileOpen()
                                : QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
         dialog.setMimeTypeFilters(koApp->mimeFilter(KoFilterManager::Import));
         dialog.setHideNameFilterDetailsOption();
-        url = dialog.filename();
+        url = QUrl::fromUserInput(dialog.filename());
     } else {
         KoFileDialog dialog(this, KoFileDialog::ImportFile, "OpenDocument");
         dialog.setCaption(i18n("Import Document"));
@@ -1312,7 +1314,7 @@ void KoMainWindow::slotFileOpen()
                                 : QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
         dialog.setMimeTypeFilters(koApp->mimeFilter(KoFilterManager::Import));
         dialog.setHideNameFilterDetailsOption();
-        url = dialog.filename();
+        url = QUrl::fromUserInput(dialog.filename());
     }
 
     if (url.isEmpty())
@@ -1323,9 +1325,9 @@ void KoMainWindow::slotFileOpen()
 
 void KoMainWindow::slotFileOpenRecent(const QUrl & url)
 {
-    // Create a copy, because the original KUrl in the map of recent files in
+    // Create a copy, because the original QUrl in the map of recent files in
     // KRecentFilesAction may get deleted.
-    (void) openDocument(KUrl(url));
+    (void) openDocument(QUrl(url));
 }
 
 void KoMainWindow::slotFileSave()
@@ -1453,14 +1455,15 @@ KoPrintJob* KoMainWindow::exportToPdf(const KoPageLayout &_pageLayout, const QSt
         QString defaultDir = group.readEntry("SavePdfDialog");
         if (defaultDir.isEmpty())
             defaultDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation);
-        KUrl startUrl = KUrl(defaultDir);
+        QUrl startUrl = QUrl(defaultDir);
         KoDocument* pDoc = rootDocument();
         /** if document has a file name, take file name and replace extension with .pdf */
         if (pDoc && pDoc->url().isValid()) {
             startUrl = pDoc->url();
             QString fileName = startUrl.fileName();
             fileName = fileName.replace( QRegExp( "\\.\\w{2,5}$", Qt::CaseInsensitive ), ".pdf" );
-            startUrl.setFileName( fileName );
+            startUrl = startUrl.adjusted(QUrl::RemoveFilename);
+            startUrl.setPath(startUrl.path() +  fileName );
         }
 
         QPointer<KoPageLayoutDialog> layoutDlg(new KoPageLayoutDialog(this, pageLayout));
@@ -1476,7 +1479,7 @@ KoPrintJob* KoMainWindow::exportToPdf(const KoPageLayout &_pageLayout, const QSt
         dialog.setCaption(i18n("Export as PDF"));
         dialog.setDefaultDir(startUrl.toLocalFile());
         dialog.setMimeTypeFilters(QStringList() << "application/pdf");
-        KUrl url = dialog.filename();
+        QUrl url = QUrl::fromUserInput(dialog.filename());
 
         pdfFileName = url.toLocalFile();
         if (pdfFileName.isEmpty())
@@ -1689,7 +1692,7 @@ void KoMainWindow::slotEmailFile()
             rootDocument()->isModified()) {
         //Save the file as a temporary file
         bool const tmp_modified = rootDocument()->isModified();
-        KUrl const tmp_url = rootDocument()->url();
+        QUrl const tmp_url = rootDocument()->url();
         QByteArray const tmp_mimetype = rootDocument()->outputMimeType();
 
         // a little open, close, delete dance to make sure we have a nice filename
@@ -1700,7 +1703,7 @@ void KoMainWindow::slotEmailFile()
         tmpfile->close();
         delete tmpfile;
 
-        KUrl u;
+        QUrl u;
         u.setPath(fileName);
         rootDocument()->setUrl(u);
         rootDocument()->setModified(true);
@@ -1717,7 +1720,7 @@ void KoMainWindow::slotEmailFile()
         rootDocument()->setOutputMimeType(tmp_mimetype);
     } else {
         fileURL = rootDocument()->url().url();
-        theSubject = i18n("Document - %1", rootDocument()->url().fileName(KUrl::ObeyTrailingSlash));
+        theSubject = i18n("Document - %1", rootDocument()->url().fileName());
         urls.append(fileURL);
     }
 
@@ -1753,7 +1756,7 @@ void KoMainWindow::slotReloadFile()
     if (!bOk)
         return;
 
-    KUrl url = pDoc->url();
+    QUrl url = pDoc->url();
     if (!pDoc->isEmpty()) {
         saveWindowSettings();
         setRootDocument(0);   // don't delete this main window when deleting the document
diff --git a/libs/main/KoMainWindow.h b/libs/main/KoMainWindow.h
index b9e4ecf..e02abbc 100644
--- a/libs/main/KoMainWindow.h
+++ b/libs/main/KoMainWindow.h
@@ -41,7 +41,7 @@ struct KoPageLayout;
 
 // Calligra class but not in main module
 class KoDockerManager;
-class KUrl;
+class QUrl;
 
 /**
  * @brief Main window for a Calligra application
@@ -119,7 +119,7 @@ public:
     /**
      * The document opened a URL -> store into recent documents list.
      */
-    void addRecentURL(const KUrl& url);
+    void addRecentURL(const QUrl &url);
 
     /**
      * Load the desired document and show it.
@@ -127,14 +127,14 @@ public:
      *
      * @return TRUE on success.
      */
-    bool openDocument(const KUrl & url);
+    bool openDocument(const QUrl &url);
 
     /**
      * Load the URL into this document (and make it root doc after loading)
      *
      * Special method for KoApplication::start, don't use.
      */
-    bool openDocument(KoPart *newPart, const KUrl & url);
+    bool openDocument(KoPart *newPart, const QUrl &url);
 
     /**
      * Reloads the recent documents list.
@@ -372,7 +372,7 @@ private:
      */
     bool queryClose();
 
-    bool openDocumentInternal(const KUrl &url, KoPart *newpart = 0, KoDocument *newdoc = 0);
+    bool openDocumentInternal(const QUrl &url, KoPart *newpart = 0, KoDocument *newdoc = 0);
 
     /**
      * Returns whether or not the current slotFileSave[As]() or saveDocument()
diff --git a/libs/main/KoOpenPane.cpp b/libs/main/KoOpenPane.cpp
index 4f80b0a..ae9db1d 100644
--- a/libs/main/KoOpenPane.cpp
+++ b/libs/main/KoOpenPane.cpp
@@ -36,7 +36,7 @@
 #include <QDropEvent>
 #include <QMimeData>
 
-#include <kurl.h>
+#include <QUrl>
 #include <klocale.h>
 #include <kcomponentdata.h>
 #include <kdebug.h>
@@ -206,7 +206,7 @@ void KoOpenPane::openFileDialog()
                           : QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
     dialog.setMimeTypeFilters(m_mimeFilter);
     dialog.setHideNameFilterDetailsOption();
-    KUrl url = dialog.filename();
+    QUrl url = QUrl::fromUserInput(dialog.filename());
     emit openExistingFile(url);
 }
 
@@ -214,7 +214,7 @@ void KoOpenPane::initRecentDocs()
 {
     QString header = i18n("Recent Documents");
     KoRecentDocumentsPane* recentDocPane = new KoRecentDocumentsPane(this, d->m_componentData, header);
-    connect(recentDocPane, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openExistingFile(const KUrl&)));
+    connect(recentDocPane, SIGNAL(openUrl(const QUrl&)), this, SIGNAL(openExistingFile(const QUrl&)));
     QTreeWidgetItem* item = addPane(header, koIconName("document-open"), recentDocPane, 0);
     connect(recentDocPane, SIGNAL(splitterResized(KoDetailsPane*, const QList<int>&)),
             this, SIGNAL(splitterResized(KoDetailsPane*, const QList<int>&)));
@@ -246,7 +246,7 @@ void KoOpenPane::initTemplates(const QString& templatesResourcePath)
 
             KoTemplatesPane* pane = new KoTemplatesPane(this, d->m_componentData, group->name(),
                     group, templateTree.defaultTemplate());
-            connect(pane, SIGNAL(openUrl(const KUrl&)), this, SIGNAL(openTemplate(const KUrl&)));
+            connect(pane, SIGNAL(openUrl(const QUrl&)), this, SIGNAL(openTemplate(const QUrl&)));
             connect(pane, SIGNAL(alwaysUseChanged(KoTemplatesPane*, const QString&)),
                     this, SIGNAL(alwaysUseChanged(KoTemplatesPane*, const QString&)));
             connect(this, SIGNAL(alwaysUseChanged(KoTemplatesPane*, const QString&)),
diff --git a/libs/main/KoOpenPane.h b/libs/main/KoOpenPane.h
index f355859..3629829 100644
--- a/libs/main/KoOpenPane.h
+++ b/libs/main/KoOpenPane.h
@@ -27,7 +27,7 @@ class KComponentData;
 class QPixmap;
 class KoTemplatesPane;
 class KoDetailsPane;
-class KUrl;
+class QUrl;
 class QTreeWidgetItem;
 class QString;
 class QStringList;
@@ -73,8 +73,8 @@ private Q_SLOTS:
     void openFileDialog();
 
 Q_SIGNALS:
-    void openExistingFile(const KUrl&);
-    void openTemplate(const KUrl&);
+    void openExistingFile(const QUrl&);
+    void openTemplate(const QUrl&);
 
     /// Emitted when the always use template has changed
     void alwaysUseChanged(KoTemplatesPane* sender, const QString& alwaysUse);
diff --git a/libs/main/KoPart.cpp b/libs/main/KoPart.cpp
index e8b8389..fc21aa3 100644
--- a/libs/main/KoPart.cpp
+++ b/libs/main/KoPart.cpp
@@ -244,7 +244,7 @@ KoMainWindow *KoPart::currentMainwindow() const
 
 }
 
-void KoPart::openExistingFile(const KUrl& url)
+void KoPart::openExistingFile(const QUrl &url)
 {
     QApplication::setOverrideCursor(Qt::BusyCursor);
     d->document->openUrl(url);
@@ -252,7 +252,7 @@ void KoPart::openExistingFile(const KUrl& url)
     QApplication::restoreOverrideCursor();
 }
 
-void KoPart::openTemplate(const KUrl& url)
+void KoPart::openTemplate(const QUrl &url)
 {
     QApplication::setOverrideCursor(Qt::BusyCursor);
     bool ok = d->document->loadNativeFormat(url.toLocalFile());
@@ -274,7 +274,7 @@ void KoPart::openTemplate(const KUrl& url)
     QApplication::restoreOverrideCursor();
 }
 
-void KoPart::addRecentURLToAllMainWindows(const KUrl &url)
+void KoPart::addRecentURLToAllMainWindows(const QUrl &url)
 {
     // Add to recent actions list in our mainWindows
     foreach(KoMainWindow *mainWindow, d->mainWindows) {
@@ -294,7 +294,7 @@ void KoPart::showStartUpWidget(KoMainWindow *mainWindow, bool alwaysShow)
         KConfigGroup cfgGrp(componentData().config(), "TemplateChooserDialog");
         QString fullTemplateName = cfgGrp.readPathEntry("AlwaysUseTemplate", QString());
         if (!fullTemplateName.isEmpty()) {
-            KUrl url(fullTemplateName);
+            QUrl url(fullTemplateName);
             QFileInfo fi(url.toLocalFile());
             if (!fi.exists()) {
                 const QString templatesResourcePath = this->templatesResourcePath();
@@ -305,14 +305,14 @@ void KoPart::showStartUpWidget(KoMainWindow *mainWindow, bool alwaysShow)
                 if (desktopfile.isEmpty()) {
                     fullTemplateName.clear();
                 } else {
-                    KUrl templateURL;
+                    QUrl templateURL;
                     KDesktopFile f(desktopfile);
-                    templateURL.setPath(KUrl(desktopfile).directory() + '/' + f.readUrl());
+                    templateURL.setPath(QFileInfo(desktopfile).absolutePath() + '/' + f.readUrl());
                     fullTemplateName = templateURL.toLocalFile();
                 }
             }
             if (!fullTemplateName.isEmpty()) {
-                openTemplate(fullTemplateName);
+                openTemplate(QUrl::fromUserInput(fullTemplateName));
                 mainWindows().first()->setRootDocument(d->document, this);
                 return;
             }
@@ -382,8 +382,8 @@ KoOpenPane *KoPart::createOpenPane(QWidget *parent, const KComponentData &compon
     }
     openPane->show();
 
-    connect(openPane, SIGNAL(openExistingFile(const KUrl&)), this, SLOT(openExistingFile(const KUrl&)));
-    connect(openPane, SIGNAL(openTemplate(const KUrl&)), this, SLOT(openTemplate(const KUrl&)));
+    connect(openPane, SIGNAL(openExistingFile(const QUrl&)), this, SLOT(openExistingFile(const QUrl&)));
+    connect(openPane, SIGNAL(openTemplate(const QUrl&)), this, SLOT(openTemplate(const QUrl&)));
 
     return openPane;
 }
diff --git a/libs/main/KoPart.h b/libs/main/KoPart.h
index 5398494..d4c34de 100644
--- a/libs/main/KoPart.h
+++ b/libs/main/KoPart.h
@@ -26,7 +26,7 @@
 #include <QList>
 
 #include <kcomponentdata.h>
-#include <kurl.h>
+#include <QUrl>
 
 #include "komain_export.h"
 
@@ -116,7 +116,7 @@ public:
      */
     int mainwindowCount() const;
 
-    void addRecentURLToAllMainWindows(const KUrl &url);
+    void addRecentURLToAllMainWindows(const QUrl &url);
 
     KoMainWindow *currentMainwindow() const;
 
@@ -126,7 +126,7 @@ public Q_SLOTS:
      * This slot loads an existing file and deletes the start up widget.
      * @param url the file to load
      */
-    virtual void openExistingFile(const KUrl& url);
+    virtual void openExistingFile(const QUrl &url);
 
 protected Q_SLOTS:
 
@@ -134,7 +134,7 @@ protected Q_SLOTS:
      * This slot loads a template and deletes the start up widget.
      * @param url the template to load
      */
-    virtual void openTemplate(const KUrl& url);
+    virtual void openTemplate(const QUrl &url);
 
 private Q_SLOTS:
 
diff --git a/libs/main/KoPartAdaptor.cpp b/libs/main/KoPartAdaptor.cpp
index fe71e01..67e72a3 100644
--- a/libs/main/KoPartAdaptor.cpp
+++ b/libs/main/KoPartAdaptor.cpp
@@ -42,7 +42,7 @@ KoPartAdaptor::~KoPartAdaptor()
 
 void KoPartAdaptor::openUrl(const QString & url)
 {
-    m_pDoc->document()->openUrl(KUrl(url));
+    m_pDoc->document()->openUrl(QUrl(url));
 }
 
 bool KoPartAdaptor::isLoading()
@@ -82,7 +82,7 @@ void KoPartAdaptor::save()
 
 void KoPartAdaptor::saveAs(const QString & url)
 {
-    m_pDoc->document()->saveAs(KUrl(url));
+    m_pDoc->document()->saveAs(QUrl(url));
     m_pDoc->document()->waitSaveComplete(); // see ReadWritePart
 }
 
diff --git a/libs/main/KoRecentDocumentsPane.cpp b/libs/main/KoRecentDocumentsPane.cpp
index cd104a8..a129e32 100644
--- a/libs/main/KoRecentDocumentsPane.cpp
+++ b/libs/main/KoRecentDocumentsPane.cpp
@@ -25,7 +25,7 @@
 
 #include <kcomponentdata.h>
 #include <kconfiggroup.h>
-#include <kurl.h>
+#include <QUrl>
 #include <kfileitem.h>
 #include <kio/previewjob.h>
 
@@ -98,7 +98,7 @@ KoRecentDocumentsPane::KoRecentDocumentsPane(QWidget* parent, const KComponentDa
         if (!path.isEmpty()) {
             QString name = config.readPathEntry(QString("Name%1").arg(i), QString());
 
-            KUrl url(path);
+            QUrl url(path);
 
             if (name.isEmpty())
                 name = url.fileName();
diff --git a/libs/main/KoTemplateCreateDia.cpp b/libs/main/KoTemplateCreateDia.cpp
index 62e1369..9b4e712 100644
--- a/libs/main/KoTemplateCreateDia.cpp
+++ b/libs/main/KoTemplateCreateDia.cpp
@@ -50,7 +50,7 @@
 #include <kinputdialog.h>
 #include <kmessagebox.h>
 #include <kstandarddirs.h>
-#include <kurl.h>
+#include <QUrl>
 #include <kdebug.h>
 #include <kio/netaccess.h>
 #include <kiconloader.h>
@@ -303,12 +303,10 @@ void KoTemplateCreateDia::slotOk() {
     else
         kWarning(30004) << "Template extension not found!";
 
-    KUrl dest;
+    QUrl dest;
     dest.setPath(templateDir+file+ext);
-    if ( QFile::exists( dest.pathOrUrl() ) )
-    {
-        do
-        {
+    if (QFile::exists( dest.toLocalFile())) {
+        do {
             file.prepend( '_' );
             dest.setPath( templateDir + file + ext );
             tmpIcon=".icon/"+file+".png";
@@ -341,7 +339,7 @@ void KoTemplateCreateDia::slotOk() {
         return;
     }
 
-    KUrl orig;
+    QUrl orig;
     orig.setPath(d->m_filePath);
     // don't overwrite the hidden template file with a new non-hidden one
     if ( !ignore )
diff --git a/libs/main/KoTemplatesPane.cpp b/libs/main/KoTemplatesPane.cpp
index 53d8739..e05b91f 100644
--- a/libs/main/KoTemplatesPane.cpp
+++ b/libs/main/KoTemplatesPane.cpp
@@ -24,7 +24,7 @@
 
 #include <QStandardItemModel>
 #include <kcomponentdata.h>
-#include <kurl.h>
+#include <QUrl>
 #include <kconfiggroup.h>
 
 class KoTemplatesPanePrivate
@@ -137,7 +137,7 @@ void KoTemplatesPane::openFile(const QModelIndex& index)
         cfgGrp.writePathEntry("FullTemplateName", item->data(Qt::UserRole + 1).toString());
         cfgGrp.writeEntry("LastReturnType", "Template");
         cfgGrp.writeEntry("AlwaysUseTemplate", d->m_alwaysUseTemplate);
-        emit openUrl(KUrl(item->data(Qt::UserRole + 1).toString()));
+        emit openUrl(QUrl(item->data(Qt::UserRole + 1).toString()));
     }
 }
 
diff --git a/libs/main/KoVersionDialog.cpp b/libs/main/KoVersionDialog.cpp
index 47d9db1..6f91259 100644
--- a/libs/main/KoVersionDialog.cpp
+++ b/libs/main/KoVersionDialog.cpp
@@ -213,10 +213,10 @@ void KoVersionDialog::slotOpen()
             return;
         }
         KoMainWindow *mainWindow = part->createMainWindow();
-        mainWindow ->openDocument(tmp.fileName());
+        mainWindow ->openDocument(QUrl::fromLocalFile(tmp.fileName()));
         mainWindow ->show();
     } else {
-        m_doc->openUrl(tmp.fileName());
+        m_doc->openUrl(QUrl::fromUserInput(tmp.fileName()));
     }
 
     tmp.setAutoRemove(true);
diff --git a/libs/main/KoView.cpp b/libs/main/KoView.cpp
index 68ec573..2fab5b8 100644
--- a/libs/main/KoView.cpp
+++ b/libs/main/KoView.cpp
@@ -46,7 +46,7 @@
 #include <kactioncollection.h>
 #include <klocale.h>
 #include <kdebug.h>
-#include <kurl.h>
+#include <QUrl>
 #include <kmessagebox.h>
 #include <kio/netaccess.h>
 #include <kselectaction.h>
@@ -242,7 +242,7 @@ void KoView::dropEvent(QDropEvent *event)
         QList<QUrl> urls = event->mimeData()->urls();
         foreach (const QUrl &url, urls) {
             QImage image;
-            KUrl kurl(url);
+            QUrl kurl(url);
             // make sure we download the files before inserting them
             if (!kurl.isLocalFile()) {
                 QString tmpFile;
diff --git a/libs/widgets/KoDocumentInfoDlg.cpp b/libs/widgets/KoDocumentInfoDlg.cpp
index 92fea2a..ed3b4b4 100644
--- a/libs/widgets/KoDocumentInfoDlg.cpp
+++ b/libs/widgets/KoDocumentInfoDlg.cpp
@@ -37,7 +37,7 @@
 #include <kmessagebox.h>
 #include <kmainwindow.h>
 #include <kdialog.h>
-#include <kurl.h>
+#include <QUrl>
 
 #include <QLineEdit>
 #include <QDateTime>
diff --git a/libs/widgets/KoDocumentInfoPropsPage.cpp b/libs/widgets/KoDocumentInfoPropsPage.cpp
index 322f8c8..8606399 100644
--- a/libs/widgets/KoDocumentInfoPropsPage.cpp
+++ b/libs/widgets/KoDocumentInfoPropsPage.cpp
@@ -26,7 +26,7 @@
 #include "KoStore.h"
 #include "KoDocumentInfo.h"
 #include "KoDocumentInfoDlg.h"
-#include <kurl.h>
+#include <QUrl>
 #include <kdebug.h>
 
 class KoDocumentInfoPropsPage::KoDocumentInfoPropsPagePrivate
@@ -34,7 +34,7 @@ class KoDocumentInfoPropsPage::KoDocumentInfoPropsPagePrivate
 public:
     KoDocumentInfo *m_info;
     KoDocumentInfoDlg *m_dlg;
-    KUrl m_url;
+    QUrl m_url;
     KoStore *m_src;
     KoStore *m_dst;
 };
diff --git a/libs/widgets/KoFileDialog.cpp b/libs/widgets/KoFileDialog.cpp
index cf9f8b4..a9ba4f4 100644
--- a/libs/widgets/KoFileDialog.cpp
+++ b/libs/widgets/KoFileDialog.cpp
@@ -28,7 +28,7 @@
 #include <kconfiggroup.h>
 
 #include <klocale.h>
-#include <kurl.h>
+#include <QUrl>
 #include <QMimeDatabase>
 #include <QMimeType>
 
diff --git a/libs/widgets/KoResourceItemChooser.cpp b/libs/widgets/KoResourceItemChooser.cpp
index 2946066..8cfa88b 100644
--- a/libs/widgets/KoResourceItemChooser.cpp
+++ b/libs/widgets/KoResourceItemChooser.cpp
@@ -277,7 +277,7 @@ void KoResourceItemChooser::slotButtonClicked(int button)
             KoResource *resource = resourceFromModelIndex(index);
             if (resource) {
                 KNS3::UploadDialog dialog(d->knsrcFile, this);
-                dialog.setUploadFile(KUrl::fromLocalFile(resource->filename()));
+                dialog.setUploadFile(QUrl::fromLocalFile(resource->filename()));
                 dialog.setUploadName(resource->name());
                 dialog.exec();
             }



More information about the calligra-devel mailing list