1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-24 04:36:34 +01:00

Port from QVariant::Type to QMetaType::Type

GIT_SILENT

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2023-12-17 01:46:12 +01:00
parent 2340b3800c
commit 01e1fa61b4
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
4 changed files with 11 additions and 8 deletions

View File

@ -26,6 +26,7 @@
#include <QSaveFile> #include <QSaveFile>
#include <QJsonDocument> #include <QJsonDocument>
#include <QMetaType>
static const int bookmarksVersion = 1; static const int bookmarksVersion = 1;
@ -237,7 +238,7 @@ void Bookmarks::loadBookmarks()
QJsonDocument json = QJsonDocument::fromJson(QzTools::readAllFileByteContents(bookmarksFile), &err); QJsonDocument json = QJsonDocument::fromJson(QzTools::readAllFileByteContents(bookmarksFile), &err);
const QVariant res = json.toVariant(); const QVariant res = json.toVariant();
if (err.error != QJsonParseError::NoError || res.type() != QVariant::Map) { if (err.error != QJsonParseError::NoError || res.typeId() != QMetaType::QVariantMap) {
if (QFile(bookmarksFile).exists()) { if (QFile(bookmarksFile).exists()) {
qWarning() << "Bookmarks::init() Error parsing bookmarks! Using default bookmarks!"; qWarning() << "Bookmarks::init() Error parsing bookmarks! Using default bookmarks!";
qWarning() << "Bookmarks::init() Your bookmarks have been backed up in" << backupFile; qWarning() << "Bookmarks::init() Your bookmarks have been backed up in" << backupFile;
@ -252,7 +253,7 @@ void Bookmarks::loadBookmarks()
const QVariant data = json.toVariant(); const QVariant data = json.toVariant();
Q_ASSERT(err.error == QJsonParseError::NoError); Q_ASSERT(err.error == QJsonParseError::NoError);
Q_ASSERT(data.type() == QVariant::Map); Q_ASSERT(data.typeId() == QMetaType::QVariantMap);
loadBookmarksFromMap(data.toMap().value(QSL("roots")).toMap()); loadBookmarksFromMap(data.toMap().value(QSL("roots")).toMap());

View File

@ -21,6 +21,7 @@
#include <QDir> #include <QDir>
#include <QFileDialog> #include <QFileDialog>
#include <QJsonDocument> #include <QJsonDocument>
#include <QMetaType>
ChromeImporter::ChromeImporter(QObject* parent) ChromeImporter::ChromeImporter(QObject* parent)
: BookmarksImporter(parent) : BookmarksImporter(parent)
@ -71,7 +72,7 @@ BookmarkItem* ChromeImporter::importBookmarks()
QJsonDocument json = QJsonDocument::fromJson(data, &err); QJsonDocument json = QJsonDocument::fromJson(data, &err);
const QVariant res = json.toVariant(); const QVariant res = json.toVariant();
if (err.error != QJsonParseError::NoError || res.type() != QVariant::Map) { if (err.error != QJsonParseError::NoError || res.typeId() != QMetaType::QVariantMap) {
setError(BookmarksImporter::tr("Cannot parse JSON file!")); setError(BookmarksImporter::tr("Cannot parse JSON file!"));
return nullptr; return nullptr;
} }

View File

@ -35,6 +35,7 @@
#include <QWebEngineProfile> #include <QWebEngineProfile>
#include <QWebEngineUrlRequestJob> #include <QWebEngineUrlRequestJob>
#include <QtWebEngineCoreVersion> #include <QtWebEngineCoreVersion>
#include <QMetaType>
static QString authorString(const char* name, const QString &mail) static QString authorString(const char* name, const QString &mail)
{ {
@ -387,18 +388,18 @@ QString FalkonSchemeReply::configPage()
const QVariant keyValue = settings->value(key); const QVariant keyValue = settings->value(key);
QString keyString; QString keyString;
switch (keyValue.type()) { switch (keyValue.typeId()) {
case QVariant::ByteArray: case QMetaType::QByteArray:
keyString = QLatin1String("QByteArray"); keyString = QLatin1String("QByteArray");
break; break;
case QVariant::Point: { case QMetaType::QPoint: {
const QPoint point = keyValue.toPoint(); const QPoint point = keyValue.toPoint();
keyString = QSL("QPoint(%1, %2)").arg(point.x()).arg(point.y()); keyString = QSL("QPoint(%1, %2)").arg(point.x()).arg(point.y());
break; break;
} }
case QVariant::StringList: case QMetaType::QStringList:
keyString = keyValue.toStringList().join(QSL(",")); keyString = keyValue.toStringList().join(QSL(","));
break; break;

View File

@ -633,7 +633,7 @@ void OpenSearchEngine::suggestionsObtained()
QJsonDocument json = QJsonDocument::fromJson(response, &err); QJsonDocument json = QJsonDocument::fromJson(response, &err);
const QVariant res = json.toVariant(); const QVariant res = json.toVariant();
if (err.error != QJsonParseError::NoError || res.type() != QVariant::List) if (err.error != QJsonParseError::NoError || res.typeId() != QMetaType::QVariantList)
return; return;
const QVariantList list = res.toList(); const QVariantList list = res.toList();