[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra] /: Move to use QUrlQuery in favor of deprecated queryItemValue() from QUrl
From: Damien Caliste <null () kde ! org>
Date: 2018-09-20 8:35:57
Message-ID: E1g2uRJ-000148-Of () code ! kde ! org
[Download RAW message or body]
Git commit 5873bc9d963ca8d3bfa7b9fe7400f8a0fdf95b84 by Damien Caliste.
Committed on 20/09/2018 at 08:33.
Pushed by dcaliste into branch 'master'.
Move to use QUrlQuery in favor of deprecated queryItemValue() from QUrl
Some more deprecation upgrades:
There is now in Qt a dedicated class for queries in urls, so accessors from
QUrl have been moved to this dedicated class.
Reviewed By: leinir
Differential Revision: https://phabricator.kde.org/D15231
M +4 -2 components/Global.cpp
M +17 -14 components/impl/TextDocumentImpl.cpp
M +2 -1 sheets/dialogs/LinkDialog.cpp
https://commits.kde.org/calligra/5873bc9d963ca8d3bfa7b9fe7400f8a0fdf95b84
diff --git a/components/Global.cpp b/components/Global.cpp
index 9c6d8f29d64..8c51ab3dd28 100644
--- a/components/Global.cpp
+++ b/components/Global.cpp
@@ -25,6 +25,7 @@
#include <QDebug>
#include <QUrl>
+#include <QUrlQuery>
#include <QMimeDatabase>
#include <QPluginLoader>
@@ -52,10 +53,11 @@ void Global::loadPlugins()
int Global::documentType(const QUrl& document)
{
int result = DocumentType::Unknown;
+ const QUrlQuery query(document);
// First, check if the URL gives us specific information on this topic (such as \
asking for a new file)
- if(document.hasQueryItem("mimetype")) {
- QString mime = document.queryItemValue("mimetype");
+ if(query.hasQueryItem("mimetype")) {
+ QString mime = query.queryItemValue("mimetype");
if(mime == WORDS_MIME_TYPE) {
result = DocumentType::TextDocument;
}
diff --git a/components/impl/TextDocumentImpl.cpp \
b/components/impl/TextDocumentImpl.cpp index 4c445257f90..68eb719a3bd 100644
--- a/components/impl/TextDocumentImpl.cpp
+++ b/components/impl/TextDocumentImpl.cpp
@@ -43,6 +43,7 @@
#include <QTextLayout>
#include <QDebug>
#include <QPointer>
+#include <QUrlQuery>
#include "ComponentsKoCanvasController.h"
#include <libs/textlayout/KoTextShapeData.h>
@@ -189,35 +190,37 @@ bool TextDocumentImpl::load(const QUrl& url)
bool retval = false;
if (url.scheme() == QStringLiteral("newfile")) {
+ QUrlQuery query(url);
+
d->document->initEmpty();
KWPageStyle style = d->document->pageManager()->defaultPageStyle();
Q_ASSERT(style.isValid());
KoColumns columns;
- columns.count = url.queryItemValue("columncount").toInt();
- columns.gapWidth = url.queryItemValue("columngap").toDouble();
+ columns.count = query.queryItemValue("columncount").toInt();
+ columns.gapWidth = query.queryItemValue("columngap").toDouble();
style.setColumns(columns);
KoPageLayout layout = style.pageLayout();
- layout.format = \
KoPageFormat::formatFromString(url.queryItemValue("pageformat"));
- layout.orientation = \
(KoPageFormat::Orientation)url.queryItemValue("pageorientation").toInt();
- layout.height = MM_TO_POINT(url.queryItemValue("height").toDouble());
- layout.width = MM_TO_POINT(url.queryItemValue("width").toDouble());
- if (url.queryItemValue("facingpages").toInt() == 1) {
- layout.bindingSide = \
MM_TO_POINT(url.queryItemValue("leftmargin").toDouble());
- layout.pageEdge = \
MM_TO_POINT(url.queryItemValue("rightmargin").toDouble()); + layout.format = \
KoPageFormat::formatFromString(query.queryItemValue("pageformat")); + \
layout.orientation = \
(KoPageFormat::Orientation)query.queryItemValue("pageorientation").toInt(); + \
layout.height = MM_TO_POINT(query.queryItemValue("height").toDouble()); + \
layout.width = MM_TO_POINT(query.queryItemValue("width").toDouble()); + if \
(query.queryItemValue("facingpages").toInt() == 1) { + layout.bindingSide \
= MM_TO_POINT(query.queryItemValue("leftmargin").toDouble()); + \
layout.pageEdge = MM_TO_POINT(query.queryItemValue("rightmargin").toDouble()); \
layout.leftMargin = layout.rightMargin = -1; }
else {
layout.bindingSide = layout.pageEdge = -1;
- layout.leftMargin = \
MM_TO_POINT(url.queryItemValue("leftmargin").toDouble());
- layout.rightMargin = \
MM_TO_POINT(url.queryItemValue("rightmargin").toDouble()); + \
layout.leftMargin = MM_TO_POINT(query.queryItemValue("leftmargin").toDouble()); + \
layout.rightMargin = MM_TO_POINT(query.queryItemValue("rightmargin").toDouble()); }
- layout.topMargin = MM_TO_POINT(url.queryItemValue("topmargin").toDouble());
- layout.bottomMargin = \
MM_TO_POINT(url.queryItemValue("bottommargin").toDouble()); + layout.topMargin \
= MM_TO_POINT(query.queryItemValue("topmargin").toDouble()); + \
layout.bottomMargin = MM_TO_POINT(query.queryItemValue("bottommargin").toDouble()); \
style.setPageLayout(layout);
- d->document->setUnit(KoUnit::fromSymbol(url.queryItemValue("unit")));
+ d->document->setUnit(KoUnit::fromSymbol(query.queryItemValue("unit")));
d->document->relayout();
retval = true;
}
diff --git a/sheets/dialogs/LinkDialog.cpp b/sheets/dialogs/LinkDialog.cpp
index 76ed166f6c5..50c94e4dcbc 100644
--- a/sheets/dialogs/LinkDialog.cpp
+++ b/sheets/dialogs/LinkDialog.cpp
@@ -34,6 +34,7 @@
#include <QLabel>
#include <QUrl>
+#include <QUrlQuery>
#include <QVBoxLayout>
#include <kcombobox.h>
@@ -272,7 +273,7 @@ void LinkDialog::setLink(const QString& link)
QUrl url(link);
if (url.isValid()) {
d->mailLink->setText(url.toString(QUrl::RemoveScheme | \
QUrl::RemoveQuery));
- d->mailSubject->setText(url.queryItemValue("subject"));
+ d->mailSubject->setText(QUrlQuery(url).queryItemValue("subject"));
} else {
d->mailLink->setText(link.mid(7));
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic