Verified Commit 8c2087e2 authored by Jonah Brüchert's avatar Jonah Brüchert
Browse files

Apply clang-format

parent 80e3c718
......@@ -23,7 +23,6 @@
#include "useragent.h"
class UserAgentTest : public QObject
{
Q_OBJECT
......@@ -43,8 +42,10 @@ private Q_SLOTS:
void desktopUserAgent()
{
m_userAgent->setIsMobile(false);
const QString expectedString = QString("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/%1 Chrome/75.0.3770.116 Desktop Safari/537.36")
.arg(QTWEBENGINE_VERSION_STR);
const QString expectedString =
QString("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) "
"QtWebEngine/%1 Chrome/75.0.3770.116 Desktop Safari/537.36")
.arg(QTWEBENGINE_VERSION_STR);
QCOMPARE(m_userAgent->userAgent(), expectedString);
}
......@@ -59,8 +60,11 @@ private Q_SLOTS:
void mobileUserAgent()
{
m_userAgent->setIsMobile(true);
const QString expectedString = QString("Mozilla/5.0 (Linux; Plasma Mobile, like Android 9.0) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/%1 Chrome/75.0.3770.116 Mobile Safari/537.36")
.arg(QTWEBENGINE_VERSION_STR);
const QString expectedString =
QString("Mozilla/5.0 (Linux; Plasma Mobile, like Android 9.0) AppleWebKit/537.36 "
"(KHTML, like Gecko) QtWebEngine/%1 Chrome/75.0.3770.116 Mobile "
"Safari/537.36")
.arg(QTWEBENGINE_VERSION_STR);
QCOMPARE(m_userAgent->userAgent(), expectedString);
}
......
......@@ -30,7 +30,6 @@
#include "urlmodel.h"
#include "useragent.h"
Q_DECL_EXPORT int main(int argc, char *argv[])
{
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
......@@ -62,12 +61,9 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("webappcontainer", parser.isSet("webapp-container"));
// Browser manager
qmlRegisterType<AngelFish::BrowserManager>("org.kde.mobile.angelfish", 1, 0,
"BrowserManager");
qmlRegisterType<UrlFilterProxyModel>("org.kde.mobile.angelfish", 1, 0,
"UrlFilterProxyModel");
qmlRegisterType<UserAgent>("org.kde.mobile.angelfish", 1, 0,
"UserAgentGenerator");
qmlRegisterType<AngelFish::BrowserManager>("org.kde.mobile.angelfish", 1, 0, "BrowserManager");
qmlRegisterType<UrlFilterProxyModel>("org.kde.mobile.angelfish", 1, 0, "UrlFilterProxyModel");
qmlRegisterType<UserAgent>("org.kde.mobile.angelfish", 1, 0, "UserAgentGenerator");
engine.load(QUrl(QStringLiteral("qrc:///webbrowser.qml")));
// Error handling
......
......@@ -44,8 +44,10 @@ bool UrlFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou
bool UrlFilterProxyModel::lessThan(const QModelIndex &source_left,
const QModelIndex &source_right) const
{
auto leftDate = QDateTime::fromString(sourceModel()->data(source_left, UrlModel::lastVisited).toString(), Qt::ISODate);
auto rightDate = QDateTime::fromString(sourceModel()->data(source_right, UrlModel::lastVisited).toString(), Qt::ISODate);
auto leftDate = QDateTime::fromString(
sourceModel()->data(source_left, UrlModel::lastVisited).toString(), Qt::ISODate);
auto rightDate = QDateTime::fromString(
sourceModel()->data(source_right, UrlModel::lastVisited).toString(), Qt::ISODate);
return leftDate < rightDate;
}
......
......@@ -29,7 +29,8 @@ class UrlFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel WRITE setSourceModel NOTIFY sourceModelChanged)
Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel WRITE setSourceModel NOTIFY
sourceModelChanged)
public:
UrlFilterProxyModel(QObject *parent = nullptr);
......
......@@ -5,13 +5,14 @@
UserAgent::UserAgent(QObject *parent) : QObject(parent)
{
}
QString UserAgent::userAgent() const
{
return QString("Mozilla/5.0 (%1) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/%2 Chrome/75.0.3770.116 %3 Safari/537.36")
.arg(m_isMobile ? QStringLiteral("Linux; Plasma Mobile, like Android 9.0") : QStringLiteral("X11; Linux x86_64"))
return QString("Mozilla/5.0 (%1) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/%2 "
"Chrome/75.0.3770.116 %3 Safari/537.36")
.arg(m_isMobile ? QStringLiteral("Linux; Plasma Mobile, like Android 9.0")
: QStringLiteral("X11; Linux x86_64"))
.arg(QTWEBENGINE_VERSION_STR)
.arg(m_isMobile ? QStringLiteral("Mobile") : QStringLiteral("Desktop"));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment