1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +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 <QJsonDocument>
#include <QMetaType>
static const int bookmarksVersion = 1;
@ -237,7 +238,7 @@ void Bookmarks::loadBookmarks()
QJsonDocument json = QJsonDocument::fromJson(QzTools::readAllFileByteContents(bookmarksFile), &err);
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()) {
qWarning() << "Bookmarks::init() Error parsing bookmarks! Using default bookmarks!";
qWarning() << "Bookmarks::init() Your bookmarks have been backed up in" << backupFile;
@ -252,7 +253,7 @@ void Bookmarks::loadBookmarks()
const QVariant data = json.toVariant();
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());

View File

@ -21,6 +21,7 @@
#include <QDir>
#include <QFileDialog>
#include <QJsonDocument>
#include <QMetaType>
ChromeImporter::ChromeImporter(QObject* parent)
: BookmarksImporter(parent)
@ -71,7 +72,7 @@ BookmarkItem* ChromeImporter::importBookmarks()
QJsonDocument json = QJsonDocument::fromJson(data, &err);
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!"));
return nullptr;
}

View File

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

View File

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