[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/sailfishos-oneplus5/nemo-qml-plugin-systemsettings.git</param>
<param name="branch">partitions-fix</param>
- <param name="revision">HEAD</param>
+ <param name="revision">0.5.24.op5</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/aboutsettings.cpp
^
|
@@ -30,13 +30,10 @@
*/
#include "aboutsettings.h"
-#include "aboutsettings_p.h"
#include <QDebug>
#include <QStringList>
-
#include <QNetworkInfo>
-
#include <QDeviceInfo>
#include <QFile>
#include <QByteArray>
@@ -154,33 +151,19 @@
}
-
-AboutSettingsPrivate::AboutSettingsPrivate(QObject *parent)
- : QObject(parent)
-{
-
-}
-
-AboutSettingsPrivate::~AboutSettingsPrivate()
-{
-
-}
-
-
AboutSettings::AboutSettings(QObject *parent)
- : QObject(parent)
- , d_ptr(new AboutSettingsPrivate(this))
+: QObject(parent), m_netinfo(new QNetworkInfo(this)),
+ m_devinfo(new QDeviceInfo(this))
{
- Q_D(AboutSettings);
QSettings settings(QStringLiteral("/mnt/vendor_data/vendor-data.ini"), QSettings::IniFormat);
- d->vendorName = settings.value(QStringLiteral("Name")).toString();
- d->vendorVersion = settings.value(QStringLiteral("Version")).toString();
+ m_vendorName = settings.value(QStringLiteral("Name")).toString();
+ m_vendorVersion = settings.value(QStringLiteral("Version")).toString();
refreshStorageModels();
- connect(&d->partitionManager, &PartitionManager::partitionAdded,
+ connect(&m_partitionManager, &PartitionManager::partitionAdded,
this, &AboutSettings::partitionCountChanged);
- connect(&d->partitionManager, &PartitionManager::partitionRemoved,
+ connect(&m_partitionManager, &PartitionManager::partitionRemoved,
this, &AboutSettings::partitionCountChanged);
}
@@ -190,32 +173,27 @@
qlonglong AboutSettings::totalDiskSpace() const
{
- Q_D(const AboutSettings);
- return d->partitionManager.root().bytesTotal();
+ return m_partitionManager.root().bytesTotal();
}
qlonglong AboutSettings::availableDiskSpace() const
{
- Q_D(const AboutSettings);
- return d->partitionManager.root().bytesAvailable();
+ return m_partitionManager.root().bytesAvailable();
}
QVariant AboutSettings::diskUsageModel() const
{
- Q_D(const AboutSettings);
- return d->internalStorage;
+ return m_internalStorage;
}
QString AboutSettings::wlanMacAddress() const
{
- Q_D(const AboutSettings);
- return d->networkInfo.macAddress(QNetworkInfo::WlanMode, 0);
+ return m_netinfo->macAddress(QNetworkInfo::WlanMode, 0);
}
QString AboutSettings::imei() const
{
- Q_D(const AboutSettings);
- return d->deviceInfo.imei(0);
+ return m_devinfo->imei(0);
}
QString AboutSettings::serial() const
@@ -246,10 +224,9 @@
QString AboutSettings::localizedOperatingSystemName() const
{
- Q_D(const AboutSettings);
- parseLocalizationFile(QStringLiteral("/etc/os-release-l10n"), &d->osReleaseLocalization);
+ parseLocalizationFile(QStringLiteral("/etc/os-release-l10n"), &m_osReleaseLocalization);
- return d->osReleaseLocalization.value("NAME", operatingSystemName());
+ return m_osReleaseLocalization.value("NAME", operatingSystemName());
}
QString AboutSettings::baseOperatingSystemName() const
@@ -263,60 +240,45 @@
QString AboutSettings::operatingSystemName() const
{
- Q_D(const AboutSettings);
- parseReleaseFile(QStringLiteral("/etc/os-release"), &d->osRelease);
-
- return d->osRelease["NAME"];
-}
-
-QString AboutSettings::localizedSoftwareVersion() const
-{
- Q_D(const AboutSettings);
- parseLocalizationFile(QStringLiteral("/etc/os-release-l10n"), &d->osReleaseLocalization);
+ parseReleaseFile(QStringLiteral("/etc/os-release"), &m_osRelease);
- return d->osReleaseLocalization.value("VERSION", softwareVersion());
+ return m_osRelease["NAME"];
}
QString AboutSettings::softwareVersion() const
{
- Q_D(const AboutSettings);
- parseReleaseFile(QStringLiteral("/etc/os-release"), &d->osRelease);
+ parseReleaseFile(QStringLiteral("/etc/os-release"), &m_osRelease);
- return d->osRelease["VERSION"];
+ return m_osRelease["VERSION"];
}
QString AboutSettings::softwareVersionId() const
{
- Q_D(const AboutSettings);
- parseReleaseFile(QStringLiteral("/etc/os-release"), &d->osRelease);
+ parseReleaseFile(QStringLiteral("/etc/os-release"), &m_osRelease);
- return d->osRelease["VERSION_ID"];
+ return m_osRelease["VERSION_ID"];
}
QString AboutSettings::adaptationVersion() const
{
- Q_D(const AboutSettings);
- parseReleaseFile(QStringLiteral("/etc/hw-release"), &d->hardwareRelease);
+ parseReleaseFile(QStringLiteral("/etc/hw-release"), &m_hardwareRelease);
- return d->hardwareRelease["VERSION_ID"];
+ return m_hardwareRelease["VERSION_ID"];
}
QString AboutSettings::vendorName() const
{
- Q_D(const AboutSettings);
- return d->vendorName;
+ return m_vendorName;
}
QString AboutSettings::vendorVersion() const
{
- Q_D(const AboutSettings);
- return d->vendorVersion;
+ return m_vendorVersion;
}
void AboutSettings::refreshStorageModels()
{
- Q_D(AboutSettings);
- d->partitionManager.refresh();
+ m_partitionManager.refresh();
partitionCountChanged();
}
@@ -330,10 +292,9 @@
void AboutSettings::reloadStorageLists()
{
- Q_D(AboutSettings);
- d->internalStorage.clear();
+ m_internalStorage.clear();
- for (auto partition : d->partitionManager.partitions()) {
+ for (auto partition : m_partitionManager.partitions()) {
QVariantMap row;
row[QStringLiteral("mounted")] = partition.status() == Partition::Mounted;
row[QStringLiteral("path")] = partition.mountPath();
@@ -357,7 +318,7 @@
}();
if (partition.storageType() != Partition::External) {
- d->internalStorage << QVariant(row);
+ m_internalStorage << QVariant(row);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/aboutsettings.h
^
|
@@ -1,6 +1,5 @@
/*
- * Copyright (C) 2013 - 2019 Jolla Ltd.
- * Copyright (c) 2019 Open Mobile Platform LLC.
+ * Copyright (C) 2013 Jolla Ltd. <pekka.vuorela@jollamobile.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -37,9 +36,10 @@
#include <QVariant>
#include <systemsettingsglobal.h>
+#include <partitionmanager.h>
-class AboutSettingsPrivate;
-
+class QNetworkInfo;
+class QDeviceInfo;
class SYSTEMSETTINGS_EXPORT AboutSettings: public QObject
{
Q_OBJECT
@@ -50,7 +50,6 @@
Q_PROPERTY(QString localizedOperatingSystemName READ localizedOperatingSystemName CONSTANT)
Q_PROPERTY(QString baseOperatingSystemName READ baseOperatingSystemName CONSTANT)
Q_PROPERTY(QString operatingSystemName READ operatingSystemName CONSTANT)
- Q_PROPERTY(QString localizedSoftwareVersion READ localizedSoftwareVersion CONSTANT)
Q_PROPERTY(QString softwareVersion READ softwareVersion CONSTANT)
Q_PROPERTY(QString softwareVersionId READ softwareVersionId CONSTANT)
Q_PROPERTY(QString adaptationVersion READ adaptationVersion CONSTANT)
@@ -82,7 +81,6 @@
QString localizedOperatingSystemName() const;
QString baseOperatingSystemName() const;
QString operatingSystemName() const;
- QString localizedSoftwareVersion() const;
QString softwareVersion() const;
QString softwareVersionId() const;
QString adaptationVersion() const;
@@ -97,10 +95,18 @@
void partitionCountChanged();
void reloadStorageLists();
- Q_DECLARE_PRIVATE(AboutSettings)
- Q_DISABLE_COPY(AboutSettings)
+ QNetworkInfo *m_netinfo;
+ QDeviceInfo *m_devinfo;
+
+ QVariantList m_internalStorage;
+ PartitionManager m_partitionManager;
+
+ mutable QMap<QString, QString> m_osRelease;
+ mutable QMap<QString, QString> m_osReleaseLocalization;
+ mutable QMap<QString, QString> m_hardwareRelease;
- AboutSettingsPrivate *d_ptr;
+ QString m_vendorName;
+ QString m_vendorVersion;
};
#endif
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/certificatemodel.cpp
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2016 - 2019 Jolla Ltd.
- * Copyright (c) 2019 Open Mobile Platform LLC.
+ * Copyright (C) 2016 Jolla Ltd.
+ * COntact: Matt Vogt <matthew.vogt@jollamobile.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -426,47 +426,28 @@
if (BIO_read_filename(input, const_cast<char *>(filename.constData())) <= 0) {
qWarning() << "Unable to open PKCS7 file:" << path;
} else {
- read_pem_from_bio(input);
- }
+ STACK_OF(X509_INFO) *certificateStack = PEM_X509_INFO_read_bio(input, NULL, NULL, NULL);
+ if (!certificateStack) {
+ qWarning() << "Unable to read PKCS7 file:" << path;
+ } else {
+ while (sk_X509_INFO_num(certificateStack)) {
+ X509_INFO *certificateInfo = sk_X509_INFO_shift(certificateStack);
+ if (certificateInfo->x509 != NULL) {
+ certs.append(certificateInfo->x509);
+ certificateInfo->x509 = NULL;
+ }
+ X509_INFO_free(certificateInfo);
+ }
- BIO_free(input);
- }
- }
- }
+ sk_X509_INFO_free(certificateStack);
+ }
+ }
- explicit PKCS7File(const QByteArray &pem)
- {
- if (!isValid()) {
- qWarning() << "Unable to prepare X509 certificates structure";
- } else {
- BIO *input = BIO_new_mem_buf(pem.constData(), pem.length());
- if (!input) {
- qWarning() << "Unable to allocate new BIO while importing in-memory PEM";
- } else {
- read_pem_from_bio(input);
BIO_free(input);
}
}
}
- void read_pem_from_bio(BIO *input) {
- STACK_OF(X509_INFO) *certificateStack = PEM_X509_INFO_read_bio(input, NULL, NULL, NULL);
- if (!certificateStack) {
- qWarning() << "Unable to read PKCS7 data";
- } else {
- while (sk_X509_INFO_num(certificateStack)) {
- X509_INFO *certificateInfo = sk_X509_INFO_shift(certificateStack);
- if (certificateInfo->x509 != NULL) {
- certs.append(certificateInfo->x509);
- certificateInfo->x509 = NULL;
- }
- X509_INFO_free(certificateInfo);
- }
-
- sk_X509_INFO_free(certificateStack);
- }
- }
-
~PKCS7File()
{
}
@@ -517,17 +498,11 @@
static Initializer init;
public:
- template<class T>
- static QList<Certificate> getCertificates(const T &bundleData)
- {
- PKCS7File bundle(bundleData);
-
- return bundleToCertificates(bundle);
- }
-private:
- static QList<Certificate> bundleToCertificates(PKCS7File &bundle)
+ static QList<Certificate> getCertificates(const QString &bundlePath)
{
QList<Certificate> certificates;
+
+ PKCS7File bundle(bundlePath);
if (bundle.isValid() && bundle.count() > 0) {
certificates.reserve(bundle.count());
bundle.getCertificates().for_each([&certificates](const X509Certificate &cert) {
@@ -539,7 +514,6 @@
}
};
-
LibCrypto::Initializer LibCrypto::init;
const QList<QPair<QString, CertificateModel::BundleType> > &bundlePaths()
@@ -605,24 +579,9 @@
}
}
- // Matches QSslCertificate::issuerDisplayName() introducd in Qt 5.12
- // Returns a name that describes the issuer. It returns the CommonName if
- // available, otherwise falls back to the Organization or the first
- // OrganizationalUnitName.
- m_issuerDisplayName = cert.issuerElement(NID_commonName);
- if (m_issuerDisplayName.isEmpty()) {
- m_issuerDisplayName = cert.issuerElement(NID_countryName);
- }
- if (m_issuerDisplayName.isEmpty()) {
- m_issuerDisplayName = cert.issuerElement(NID_organizationName);
- }
-
// Populate the details map
m_details.insert(QStringLiteral("Version"), QVariant(cert.version()));
m_details.insert(QStringLiteral("SerialNumber"), QVariant(cert.serialNumber()));
- m_details.insert(QStringLiteral("SubjectDisplayName"), QVariant(m_primaryName));
- m_details.insert(QStringLiteral("OrganizationName"), QVariant(m_organizationName));
- m_details.insert(QStringLiteral("IssuerDisplayName"), QVariant(m_issuerDisplayName));
QVariantMap validity;
validity.insert(QStringLiteral("NotBefore"), QVariant(cert.notBefore()));
@@ -794,7 +753,3 @@
return LibCrypto::getCertificates(bundlePath);
}
-QList<Certificate> CertificateModel::getCertificates(const QByteArray &pem)
-{
- return LibCrypto::getCertificates(pem);
-}
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/certificatemodel.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 2016 - 2019 Jolla Ltd.
- * Copyright (c) 2019 Open Mobile Platform LLC.
+ * Copyright (C) 2016 Jolla Ltd.
+ * Contact: Matt Vogt <matthew.vogt@jollamobile.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -38,7 +38,7 @@
#include <QList>
#include <QVariantMap>
-#include "systemsettingsglobal.h"
+#include <systemsettingsglobal.h>
struct X509Certificate;
@@ -60,8 +60,6 @@
QVariantMap details() const { return m_details; }
- QString issuerDisplayName() const { return m_issuerDisplayName; }
-
private:
QString m_commonName;
QString m_countryName;
@@ -73,8 +71,6 @@
QDateTime m_notValidBefore;
QDateTime m_notValidAfter;
- QString m_issuerDisplayName;
-
QVariantMap m_details;
};
@@ -119,9 +115,8 @@
virtual QVariant data(const QModelIndex &index, int role) const;
static QList<Certificate> getCertificates(const QString &bundlePath);
- static QList<Certificate> getCertificates(const QByteArray &pem);
-Q_SIGNALS:
+signals:
void bundleTypeChanged();
void bundlePathChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/developermodesettings.cpp
^
|
@@ -1,6 +1,5 @@
/*
- * Copyright (c) 2013 – 2019 Jolla Ltd.
- * Copyright (c) 2019 Open Mobile Platform LLC.
+ * Copyright (C) 2013-2018 Jolla Ltd.
* Contact: Thomas Perl <thomas.perl@jollamobile.com>
* Contact: Raine Makelainen <raine.makelainen@jolla.com>
*
@@ -56,7 +55,6 @@
/* A file that is provided by the developer mode package */
#define DEVELOPER_MODE_PROVIDED_FILE "/usr/bin/devel-su"
#define DEVELOPER_MODE_PACKAGE "jolla-developer-mode"
-#define DEVELOPER_MODE_PACKAGE_PRELOAD_DIR "/var/lib/jolla-developer-mode/preloaded/"
/* D-Bus service */
#define USB_MODED_SERVICE "com.meego.usb_moded"
@@ -86,17 +84,6 @@
return result;
}
-static QString get_cached_package(const QString &version)
-{
- QDir dir(DEVELOPER_MODE_PACKAGE_PRELOAD_DIR);
- QStringList filters;
- filters << QStringLiteral("%1-%2.*.rpm").arg(DEVELOPER_MODE_PACKAGE).arg(version);
- auto preloaded = dir.entryList(filters, QDir::Files, QDir::Name);
- if (preloaded.empty())
- return QString();
- return dir.absoluteFilePath(preloaded.last());
-}
-
DeveloperModeSettings::DeveloperModeSettings(QObject *parent)
: QObject(parent)
, m_usbModeDaemon(USB_MODED_SERVICE, USB_MODED_PATH, USB_MODED_INTERFACE, QDBusConnection::systemBus())
@@ -110,8 +97,6 @@
, m_transactionRole(PackageKit::Transaction::RoleUnknown)
, m_transactionStatus(PackageKit::Transaction::StatusUnknown)
, m_refreshedForInstall(false)
- , m_localInstallFailed(false)
- , m_localDeveloperModePackagePath(get_cached_package(QStringLiteral("*"))) // Initialized to possibly incompatible package
{
int uid = getdef_num("UID_MIN", -1);
struct passwd *pwd;
@@ -121,23 +106,6 @@
qCWarning(lcDeveloperModeLog) << "Failed to return username using getpwuid()";
}
- // Resolve and update local package path
- if (!m_localDeveloperModePackagePath.isEmpty()) {
- PackageKit::Transaction *resolvePackage = PackageKit::Daemon::resolve(DEVELOPER_MODE_PACKAGE"-preload", PackageKit::Transaction::FilterInstalled);
- connect(resolvePackage, &PackageKit::Transaction::errorCode, this, &DeveloperModeSettings::reportTransactionErrorCode);
- connect(resolvePackage, &PackageKit::Transaction::package,
- this, [this](PackageKit::Transaction::Info info, const QString &packageID, const QString &summary) {
- Q_UNUSED(summary)
- Q_ASSERT(info == PackageKit::Transaction::InfoInstalled);
- const QString version = PackageKit::Transaction::packageVersion(packageID);
- m_localDeveloperModePackagePath = get_cached_package(version);
- if (m_localDeveloperModePackagePath.isEmpty()) {
- emit repositoryAccessRequiredChanged();
- }
- qCDebug(lcDeveloperModeLog) << "Preload package version: " << version << ", local package path: " << m_localDeveloperModePackagePath;
- });
- }
-
refresh();
// TODO: Watch WLAN / USB IP addresses for changes
@@ -178,12 +146,6 @@
return m_workProgress;
}
-bool DeveloperModeSettings::repositoryAccessRequired() const
-{
- // Aka local-install-of-developer-mode-package-is-not-possible
- return m_localInstallFailed || m_localDeveloperModePackagePath.isEmpty();
-}
-
void DeveloperModeSettings::setDeveloperMode(bool enabled)
{
if (m_developerModeEnabled != enabled) {
@@ -271,114 +233,72 @@
void DeveloperModeSettings::resolveAndExecute(Command command)
{
setWorkStatus(Preparing);
- m_workProgress = 0;
m_developerModePackageId.clear(); // might differ between installed/available
- if (command == InstallCommand && !m_localInstallFailed && !m_localDeveloperModePackagePath.isEmpty()) {
- // Resolve which version of developer mode package is expected
- PackageKit::Transaction *resolvePackage = PackageKit::Daemon::resolve(DEVELOPER_MODE_PACKAGE"-preload", PackageKit::Transaction::FilterInstalled);
- connect(resolvePackage, &PackageKit::Transaction::errorCode, this, &DeveloperModeSettings::reportTransactionErrorCode);
- connect(resolvePackage, &PackageKit::Transaction::package,
- this, [this](PackageKit::Transaction::Info info, const QString &packageID, const QString &summary) {
- Q_UNUSED(summary)
- Q_ASSERT(info == PackageKit::Transaction::InfoInstalled);
- const QString version = PackageKit::Transaction::packageVersion(packageID);
- m_localDeveloperModePackagePath = get_cached_package(version);
- emit repositoryAccessRequiredChanged();
- qCDebug(lcDeveloperModeLog) << "Preload package version: " << version << ", local package path: " << m_localDeveloperModePackagePath;
- });
-
- connect(resolvePackage, &PackageKit::Transaction::finished,
- this, [this](PackageKit::Transaction::Exit status, uint runtime) {
- Q_UNUSED(runtime)
- if (status != PackageKit::Transaction::ExitSuccess || m_localDeveloperModePackagePath.isEmpty()) {
- qCDebug(lcDeveloperModeLog) << "Preloaded package not found, must use remote package";
- // No cached package => install from repos
- resolveAndExecute(InstallCommand);
- } else {
- PackageKit::Transaction *tx = PackageKit::Daemon::installFiles(QStringList() << m_localDeveloperModePackagePath);
- connectCommandSignals(tx);
- connect(tx, &PackageKit::Transaction::finished,
- this, [this](PackageKit::Transaction::Exit status, uint runtime) {
- if (status == PackageKit::Transaction::ExitSuccess) {
- qCDebug(lcDeveloperModeLog) << "Developer mode installation from local package transaction done:" << status << runtime;
- resetState();
- } else if (status == PackageKit::Transaction::ExitFailed) {
- qCWarning(lcDeveloperModeLog) << "Developer mode installation from local package failed, trying from repos";
- m_localInstallFailed = true;
- emit repositoryAccessRequiredChanged();
- resolveAndExecute(InstallCommand); // TODO: If repo access is not available this can not bail out
- } // else ExitUnknown (ignored)
- });
- }
- });
-
+ PackageKit::Transaction::Filters filters;
+ if (command == RemoveCommand) {
+ filters = PackageKit::Transaction::FilterInstalled;
} else {
- PackageKit::Transaction::Filters filters;
- if (command == RemoveCommand) {
- filters = PackageKit::Transaction::FilterInstalled;
- } else {
- filters = PackageKit::Transaction::FilterNewest;
- }
- PackageKit::Transaction *resolvePackage = PackageKit::Daemon::resolve(DEVELOPER_MODE_PACKAGE, filters);
+ filters = PackageKit::Transaction::FilterNewest;
+ }
+ PackageKit::Transaction *resolvePackage = PackageKit::Daemon::resolve(DEVELOPER_MODE_PACKAGE, filters);
- connect(resolvePackage, &PackageKit::Transaction::errorCode, this, &DeveloperModeSettings::reportTransactionErrorCode);
- connect(resolvePackage, &PackageKit::Transaction::package,
- this, [this](PackageKit::Transaction::Info info, const QString &packageId, const QString &summary) {
- qCDebug(lcDeveloperModeLog) << "Package transaction:" << info << packageId << "summary:" << summary;
- m_developerModePackageId = packageId;
- });
-
- connect(resolvePackage, &PackageKit::Transaction::finished,
- this, [this, command](PackageKit::Transaction::Exit status, uint runtime) {
- Q_UNUSED(runtime)
-
- if (status != PackageKit::Transaction::ExitSuccess || m_developerModePackageId.isEmpty()) {
- if (command == InstallCommand) {
- if (m_refreshedForInstall) {
- qCWarning(lcDeveloperModeLog) << "Failed to install developer mode, package didn't resolve.";
- resetState();
- } else {
- refreshPackageCacheAndInstall(); // try once if it helps
- }
- } else if (command == RemoveCommand) {
- qCWarning(lcDeveloperModeLog) << "Removing developer mode but package didn't resolve into anything. Shouldn't happen.";
- resetState();
- }
+ connect(resolvePackage, &PackageKit::Transaction::errorCode, this, &DeveloperModeSettings::reportTransactionErrorCode);
+ connect(resolvePackage, &PackageKit::Transaction::package,
+ this, [this](PackageKit::Transaction::Info info, const QString &packageId, const QString &summary) {
+ qCDebug(lcDeveloperModeLog) << "Package transaction:" << info << packageId << "summary:" << summary;
+ m_developerModePackageId = packageId;
+ });
- } else if (command == InstallCommand) {
- PackageKit::Transaction *tx = PackageKit::Daemon::installPackage(m_developerModePackageId);
- connectCommandSignals(tx);
+ connect(resolvePackage, &PackageKit::Transaction::finished,
+ this, [this, command](PackageKit::Transaction::Exit status, uint runtime) {
+ Q_UNUSED(runtime)
+ if (status != PackageKit::Transaction::ExitSuccess || m_developerModePackageId.isEmpty()) {
+ if (command == InstallCommand) {
if (m_refreshedForInstall) {
- connect(tx, &PackageKit::Transaction::finished,
- this, [this](PackageKit::Transaction::Exit status, uint runtime) {
- qCDebug(lcDeveloperModeLog) << "Developer mode installation transaction done (with refresh):" << status << runtime;
- resetState();
- });
+ qCWarning(lcDeveloperModeLog) << "Failed to install developer mode, package didn't resolve.";
+ resetState();
} else {
- connect(tx, &PackageKit::Transaction::finished,
- this, [this](PackageKit::Transaction::Exit status, uint runtime) {
- if (status == PackageKit::Transaction::ExitSuccess) {
- qCDebug(lcDeveloperModeLog) << "Developer mode installation transaction done:" << status << runtime;
- resetState();
- } else {
- qCDebug(lcDeveloperModeLog) << "Developer mode installation failed, trying again after refresh";
- refreshPackageCacheAndInstall();
- }
- });
+ refreshPackageCacheAndInstall(); // try once if it helps
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/developermodesettings.h
^
|
@@ -1,6 +1,5 @@
/*
- * Copyright (c) 2013 – 2019 Jolla Ltd.
- * Copyright (c) 2019 Open Mobile Platform LLC.
+ * Copyright (C) 2013 Jolla Ltd.
* Contact: Thomas Perl <thomas.perl@jollamobile.com>
*
* You may use this file under the terms of the BSD license as follows:
@@ -56,7 +55,6 @@
Q_PROPERTY(bool developerModeEnabled READ developerModeEnabled NOTIFY developerModeEnabledChanged)
Q_PROPERTY(enum DeveloperModeSettings::Status workStatus READ workStatus NOTIFY workStatusChanged)
Q_PROPERTY(int workProgress READ workProgress NOTIFY workProgressChanged)
- Q_PROPERTY(bool repositoryAccessRequired READ repositoryAccessRequired NOTIFY repositoryAccessRequiredChanged)
public:
explicit DeveloperModeSettings(QObject *parent = NULL);
@@ -76,7 +74,6 @@
bool developerModeEnabled() const;
enum DeveloperModeSettings::Status workStatus() const;
int workProgress() const;
- bool repositoryAccessRequired() const;
Q_INVOKABLE void setDeveloperMode(bool enabled);
Q_INVOKABLE void setUsbIpAddress(const QString &usbIpAddress);
@@ -88,7 +85,6 @@
void developerModeEnabledChanged();
void workStatusChanged();
void workProgressChanged();
- void repositoryAccessRequiredChanged();
private slots:
void reportTransactionErrorCode(PackageKit::Transaction::Error code, const QString &details);
@@ -121,8 +117,6 @@
PackageKit::Transaction::Role m_transactionRole;
PackageKit::Transaction::Status m_transactionStatus;
bool m_refreshedForInstall;
- bool m_localInstallFailed;
- QString m_localDeveloperModePackagePath;
};
Q_DECLARE_METATYPE(DeveloperModeSettings::Status)
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/diskusage.cpp
^
|
@@ -98,8 +98,8 @@
// Sort keys in reverse order (so child directories come before their
// parents, and the calculation is done correctly, no child directory
// subtracted once too often), for example:
- // 1. a0 = size(/home/<user>/foo/)
- // 2. b0 = size(/home/<user>/)
+ // 1. a0 = size(/home/nemo/foo/)
+ // 2. b0 = size(/home/nemo/)
// 3. c0 = size(/)
//
// This will calculate the following changes in the nested for loop below:
@@ -113,9 +113,9 @@
// 3. c' = c2 = c1 - b1 = (c0 - a0) - (b0 - a0) = c0 - a0 - b0 + a0 = c0 - b0
//
// Or with paths:
- // 1. output(/home/<user>/foo/) = size(/home/<user>/foo/)
- // 2. output(/home/<user>/) = size(/home/<user>/) - size(/home/<user>/foo/)
- // 3. output(/) = size(/) - size(/home/<user>/)
+ // 1. output(/home/nemo/foo/) = size(/home/nemo/foo/)
+ // 2. output(/home/nemo/) = size(/home/nemo/) - size(/home/nemo/foo/)
+ // 3. output(/) = size(/) - size(/home/nemo/)
QStringList keys;
foreach (const QString &key, usage.uniqueKeys()) {
keys << expandedPaths.value(key, key);
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/locationsettings.cpp
^
|
@@ -66,9 +66,6 @@
const QString LocationSettingsHereEnabledKey = QStringLiteral("here\\enabled");
const QString LocationSettingsHereAgreementAcceptedKey = QStringLiteral("here\\agreement_accepted");
const QString LocationSettingsHereOnlineEnabledKey = QStringLiteral("here\\online_enabled");
- const QString LocationSettingsYandexLocatorEnabledKey = QStringLiteral("yandex\\enabled");
- const QString LocationSettingsYandexLocatorAgreementAcceptedKey = QStringLiteral("yandex\\agreement_accepted");
- const QString LocationSettingsYandexLocatorOnlineEnabledKey = QStringLiteral("yandex\\online_enabled");
const QMap<LocationSettings::DataSource, QString> AllowedDataSourcesKeys {
{ LocationSettings::OnlineDataSources, QStringLiteral("allowed_data_sources\\online") },
{ LocationSettings::DeviceSensorsData, QStringLiteral("allowed_data_sources\\device_sensors") },
@@ -183,9 +180,7 @@
, m_locationEnabled(false)
, m_gpsEnabled(false)
, m_mlsEnabled(true)
- , m_yandexLocatorEnabled(true)
, m_mlsOnlineState(LocationSettings::OnlineAGpsAgreementNotAccepted)
- , m_yandexLocatorOnlineState(LocationSettings::OnlineAGpsAgreementNotAccepted)
, m_hereState(LocationSettings::OnlineAGpsAgreementNotAccepted)
, m_locationMode(LocationSettings::CustomMode)
, m_settingLocationMode(true)
@@ -206,10 +201,6 @@
this, &LocationSettingsPrivate::recalculateLocationMode);
connect(q, &LocationSettings::mlsOnlineStateChanged,
this, &LocationSettingsPrivate::recalculateLocationMode);
- connect(q, &LocationSettings::yandexLocatorEnabledChanged,
- this, &LocationSettingsPrivate::recalculateLocationMode);
- connect(q, &LocationSettings::yandexLocatorOnlineStateChanged,
- this, &LocationSettingsPrivate::recalculateLocationMode);
connect(q, &LocationSettings::hereStateChanged,
this, &LocationSettingsPrivate::recalculateLocationMode);
@@ -280,28 +271,25 @@
LocationSettings::LocationMode
LocationSettingsPrivate::calculateLocationMode() const
{
- bool nls = m_mlsEnabled || m_yandexLocatorEnabled;
- bool nls_available = mlsAvailable() || yandexLocatorAvailable();
-
if (m_gpsEnabled
- && (!nls_available ||
- (nls && (m_mlsOnlineState == LocationSettings::OnlineAGpsEnabled || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsEnabled)))
+ && (!mlsAvailable() ||
+ (m_mlsEnabled && m_mlsOnlineState == LocationSettings::OnlineAGpsEnabled))
&& (!hereAvailable() || m_hereState == LocationSettings::OnlineAGpsEnabled)) {
return LocationSettings::HighAccuracyMode;
} else if (!m_gpsEnabled
- && (!nls_available ||
- (nls &&
- ((m_mlsOnlineState == LocationSettings::OnlineAGpsEnabled || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsEnabled )
- || (m_mlsOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted))))
+ && (!mlsAvailable() ||
+ (m_mlsEnabled &&
+ (m_mlsOnlineState == LocationSettings::OnlineAGpsEnabled
+ || m_mlsOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted)))
&& (!hereAvailable() ||
(m_hereState == LocationSettings::OnlineAGpsEnabled
|| m_hereState == LocationSettings::OnlineAGpsAgreementNotAccepted))) {
return LocationSettings::BatterySavingMode;
} else if (m_gpsEnabled
- && (!nls_available ||
- (nls &&
- ((m_mlsOnlineState == LocationSettings::OnlineAGpsDisabled || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsDisabled)
- ||(m_mlsOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted || m_yandexLocatorOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted))))
+ && (!mlsAvailable() ||
+ (m_mlsEnabled &&
+ (m_mlsOnlineState == LocationSettings::OnlineAGpsDisabled
+ || m_mlsOnlineState == LocationSettings::OnlineAGpsAgreementNotAccepted)))
&& (!hereAvailable() ||
(m_hereState == LocationSettings::OnlineAGpsDisabled
|| m_hereState == LocationSettings::OnlineAGpsAgreementNotAccepted))) {
@@ -327,11 +315,6 @@
return QFile::exists(QStringLiteral("/usr/libexec/geoclue-mlsdb"));
}
-bool LocationSettingsPrivate::yandexLocatorAvailable() const
-{
- return QFile::exists(QStringLiteral("/usr/libexec/geoclue-yandex"));
-}
-
bool LocationSettingsPrivate::hereAvailable() const
{
return QFile::exists(QStringLiteral("/usr/libexec/geoclue-here"));
@@ -426,8 +409,6 @@
return QFile::exists(QStringLiteral("/usr/libexec/geoclue-hybris"));
}
-/*Mozilla Location services*/
-
bool LocationSettings::mlsEnabled() const
{
Q_D(const LocationSettings);
@@ -467,48 +448,6 @@
return d->mlsAvailable();
}
-/*Yandex locator services*/
-
-bool LocationSettings::yandexLocatorEnabled() const
-{
- Q_D(const LocationSettings);
- return d->m_yandexLocatorEnabled;
-}
-
-void LocationSettings::setYandexLocatorEnabled(bool enabled)
-{
- Q_D(LocationSettings);
- if (enabled != d->m_yandexLocatorEnabled) {
- d->m_yandexLocatorEnabled = enabled;
- d->writeSettings();
- emit yandexLocatorEnabledChanged();
- }
-}
-
-LocationSettings::OnlineAGpsState LocationSettings::yandexLocatorOnlineState() const
-{
- Q_D(const LocationSettings);
- return d->m_yandexLocatorOnlineState;
-}
-
-void LocationSettings::setYandexLocatorOnlineState(LocationSettings::OnlineAGpsState state)
-{
- Q_D(LocationSettings);
- if (state == d->m_yandexLocatorOnlineState)
- return;
-
- d->m_yandexLocatorOnlineState = state;
- d->writeSettings();
- emit yandexLocatorOnlineStateChanged();
-}
-
-bool LocationSettings::yandexLocatorAvailable() const
-{
- Q_D(const LocationSettings);
- return d->yandexLocatorAvailable();
-}
-
-/*HERE*/
LocationSettings::OnlineAGpsState LocationSettings::hereState() const
{
Q_D(const LocationSettings);
@@ -559,12 +498,6 @@
setMlsOnlineState(LocationSettings::OnlineAGpsEnabled);
}
}
- if (yandexLocatorAvailable()) {
- setYandexLocatorEnabled(true);
- if (yandexLocatorOnlineState() != LocationSettings::OnlineAGpsAgreementNotAccepted) {
- setYandexLocatorOnlineState(LocationSettings::OnlineAGpsEnabled);
- }
- }
if (hereAvailable()) {
if (hereState() != LocationSettings::OnlineAGpsAgreementNotAccepted) {
setHereState(LocationSettings::OnlineAGpsEnabled);
@@ -578,12 +511,6 @@
setMlsOnlineState(LocationSettings::OnlineAGpsEnabled);
}
}
- if (yandexLocatorAvailable()) {
- setYandexLocatorEnabled(true);
- if (yandexLocatorOnlineState() != LocationSettings::OnlineAGpsAgreementNotAccepted) {
- setYandexLocatorOnlineState(LocationSettings::OnlineAGpsEnabled);
- }
- }
if (hereAvailable()) {
if (hereState() != LocationSettings::OnlineAGpsAgreementNotAccepted) {
setHereState(LocationSettings::OnlineAGpsEnabled);
@@ -597,12 +524,6 @@
setMlsOnlineState(LocationSettings::OnlineAGpsDisabled);
}
}
- if (yandexLocatorAvailable()) {
- setYandexLocatorEnabled(true);
- if (yandexLocatorOnlineState() != LocationSettings::OnlineAGpsAgreementNotAccepted) {
- setYandexLocatorOnlineState(LocationSettings::OnlineAGpsDisabled);
- }
- }
if (hereAvailable()) {
if (hereState() != LocationSettings::OnlineAGpsAgreementNotAccepted) {
setHereState(LocationSettings::OnlineAGpsDisabled);
@@ -640,7 +561,6 @@
bool oldMlsEnabled = false;
bool oldHereEnabled = false;
bool oldHereAgreementAccepted = false;
- bool oldYandexLocatorEnabled = false;
// current key values
bool locationEnabled = false;
@@ -649,10 +569,6 @@
bool mlsEnabled = false;
bool mlsAgreementAccepted = false;
bool mlsOnlineEnabled = false;
- bool yandexLocatorEnabled = false;
- bool yandexLocatorAgreementAccepted = false;
- bool yandexLocatorOnlineEnabled = false;
-
bool hereEnabled = false;
bool hereAgreementAccepted = false;
@@ -679,9 +595,6 @@
ini.readBool(LocationSettingsSection, LocationSettingsMlsEnabledKey, &mlsEnabled, oldMlsEnabled);
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/locationsettings.h
^
|
@@ -58,10 +58,6 @@
Q_PROPERTY(OnlineAGpsState mlsOnlineState READ mlsOnlineState WRITE setMlsOnlineState NOTIFY mlsOnlineStateChanged)
Q_PROPERTY(bool mlsAvailable READ mlsAvailable CONSTANT)
- Q_PROPERTY(bool yandexLocatorEnabled READ yandexLocatorEnabled WRITE setYandexLocatorEnabled NOTIFY yandexLocatorEnabledChanged)
- Q_PROPERTY(OnlineAGpsState yandexLocatorOnlineState READ yandexLocatorOnlineState WRITE setYandexLocatorOnlineState NOTIFY yandexLocatorOnlineStateChanged)
- Q_PROPERTY(bool yandexLocatorAvailable READ yandexLocatorAvailable CONSTANT)
-
Q_PROPERTY(LocationMode locationMode READ locationMode WRITE setLocationMode NOTIFY locationModeChanged)
Q_PROPERTY(DataSources allowedDataSources READ allowedDataSources WRITE setAllowedDataSources NOTIFY allowedDataSourcesChanged)
@@ -104,12 +100,6 @@
void setMlsOnlineState(OnlineAGpsState state);
bool mlsAvailable() const;
- bool yandexLocatorEnabled() const;
- void setYandexLocatorEnabled(bool enabled);
- OnlineAGpsState yandexLocatorOnlineState() const;
- void setYandexLocatorOnlineState(OnlineAGpsState state);
- bool yandexLocatorAvailable() const;
-
enum LocationMode {
HighAccuracyMode,
BatterySavingMode,
@@ -154,8 +144,6 @@
void gpsFlightModeChanged();
void mlsEnabledChanged();
void mlsOnlineStateChanged();
- void yandexLocatorEnabledChanged();
- void yandexLocatorOnlineStateChanged();
void locationModeChanged();
void allowedDataSourcesChanged();
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/locationsettings_p.h
^
|
@@ -62,16 +62,13 @@
void writeSettings();
bool mlsAvailable() const;
- bool yandexLocatorAvailable() const;
bool hereAvailable() const;
QFileSystemWatcher m_watcher;
bool m_locationEnabled;
bool m_gpsEnabled;
bool m_mlsEnabled;
- bool m_yandexLocatorEnabled;
LocationSettings::OnlineAGpsState m_mlsOnlineState;
- LocationSettings::OnlineAGpsState m_yandexLocatorOnlineState;
LocationSettings::OnlineAGpsState m_hereState;
LocationSettings::LocationMode m_locationMode;
bool m_settingLocationMode;
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/plugin/plugin.cpp
^
|
@@ -47,14 +47,13 @@
#include "diskusage.h"
#include "partitionmodel.h"
#include "certificatemodel.h"
-#include "settingsvpnmodel.h"
+#include "vpnmodel.h"
#include "locationsettings.h"
#include "deviceinfo.h"
-template<class T>
-static QObject *api_factory(QQmlEngine *, QJSEngine *)
+static QObject *vpnmodel_api_factory(QQmlEngine *, QJSEngine *)
{
- return new T;
+ return new VpnModel;
}
class SystemSettingsPlugin : public QQmlExtensionPlugin
@@ -83,7 +82,7 @@
qRegisterMetaType<Partition>("Partition");
qmlRegisterType<DeveloperModeSettings>(uri, 1, 0, "DeveloperModeSettings");
qmlRegisterType<CertificateModel>(uri, 1, 0, "CertificateModel");
- qmlRegisterSingletonType<SettingsVpnModel>(uri, 1, 0, "SettingsVpnModel", api_factory<SettingsVpnModel>);
+ qmlRegisterSingletonType<VpnModel>(uri, 1, 0, "VpnModel", vpnmodel_api_factory);
qRegisterMetaType<DeveloperModeSettings::Status>("DeveloperModeSettings::Status");
qmlRegisterType<BatteryStatus>(uri, 1, 0, "BatteryStatus");
qmlRegisterType<DiskUsage>(uri, 1, 0, "DiskUsage");
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/plugin/plugins.qmltypes
^
|
@@ -19,7 +19,6 @@
Property { name: "localizedOperatingSystemName"; type: "string"; isReadonly: true }
Property { name: "baseOperatingSystemName"; type: "string"; isReadonly: true }
Property { name: "operatingSystemName"; type: "string"; isReadonly: true }
- Property { name: "localizedSoftwareVersion"; type: "string"; isReadonly: true }
Property { name: "softwareVersion"; type: "string"; isReadonly: true }
Property { name: "softwareVersionId"; type: "string"; isReadonly: true }
Property { name: "adaptationVersion"; type: "string"; isReadonly: true }
@@ -372,13 +371,53 @@
Property { name: "mlsEnabled"; type: "bool" }
Property { name: "mlsOnlineState"; type: "OnlineAGpsState" }
Property { name: "mlsAvailable"; type: "bool"; isReadonly: true }
- Property { name: "yandexLocatorEnabled"; type: "bool" }
- Property { name: "yandexLocatorOnlineState"; type: "OnlineAGpsState" }
- Property { name: "yandexLocatorAvailable"; type: "bool"; isReadonly: true }
Property { name: "locationMode"; type: "LocationMode" }
Property { name: "allowedDataSources"; type: "DataSources" }
}
Component {
+ name: "ObjectListModel"
+ prototype: "QAbstractListModel"
+ Property { name: "automaticRoles"; type: "bool" }
+ Property { name: "populated"; type: "bool" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Signal {
+ name: "itemAdded"
+ Parameter { name: "item"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "itemRemoved"
+ Parameter { name: "item"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "item"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "appendItem"
+ Parameter { name: "item"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { name: "item"; type: "QObject"; isPointer: true }
+ }
+ Method {
+ name: "removeItemAt"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method { name: "clear" }
+ Method {
+ name: "get"
+ type: "QObject*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "indexOf"
+ type: "int"
+ Parameter { name: "item"; type: "QObject"; isPointer: true }
+ }
+ }
+ Component {
name: "PartitionModel"
prototype: "QAbstractListModel"
exports: ["org.nemomobile.systemsettings/PartitionModel 1.0"]
@@ -456,7 +495,6 @@
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "storageTypes"; type: "StorageTypes" }
Property { name: "supportedFormatTypes"; type: "QStringList"; isReadonly: true }
- Property { name: "externalStoragesPopulated"; type: "bool"; isReadonly: true }
Signal {
name: "errorMessage"
Parameter { name: "objectPath"; type: "string" }
@@ -652,24 +690,29 @@
}
}
Component {
- name: "SettingsVpnModel"
- prototype: "VpnModel"
- exports: ["org.nemomobile.systemsettings/SettingsVpnModel 1.0"]
+ name: "VpnModel"
+ prototype: "ObjectListModel"
+ exports: ["org.nemomobile.systemsettings/VpnModel 1.0"]
isCreatable: false
isSingleton: true
exportMetaObjectRevisions: [0]
- Property { name: "bestState"; type: "VpnConnection::ConnectionState"; isReadonly: true }
+ Enum {
+ name: "ConnectionState"
+ values: {
+ "Idle": 0,
+ "Failure": 1,
+ "Configuration": 2,
+ "Ready": 3,
+ "Disconnect": 4
+ }
+ }
+ Property { name: "bestState"; type: "int"; isReadonly: true }
Property { name: "autoConnect"; type: "bool"; isReadonly: true }
Property { name: "orderByConnected"; type: "bool" }
Signal {
name: "connectionStateChanged"
Parameter { name: "path"; type: "string" }
- Parameter { name: "state"; type: "VpnConnection::ConnectionState" }
- }
- Method {
- name: "isDefaultDomain"
- type: "bool"
- Parameter { name: "domain"; type: "string" }
+ Parameter { name: "state"; type: "int" }
}
Method {
name: "createConnection"
@@ -722,27 +765,5 @@
Parameter { name: "path"; type: "string" }
Parameter { name: "type"; type: "string" }
}
- Method {
- name: "get"
- type: "VpnConnection*"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "VpnModel"
- prototype: "QAbstractListModel"
- Property { name: "connected"; type: "bool"; isReadonly: true }
- Property { name: "count"; type: "int"; isReadonly: true }
- Property { name: "vpnManager"; type: "VpnManager"; isReadonly: true; isPointer: true }
- Property { name: "populated"; type: "bool"; isReadonly: true }
- Signal {
- name: "connectedChanged"
- Parameter { name: "connected"; type: "bool" }
- }
- Method {
- name: "connectionSettings"
- type: "QVariantMap"
- Parameter { name: "path"; type: "string" }
- }
}
}
|
[-]
[+]
|
Added |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/qdbusxml2cpp_dbus_types.h
^
|
@@ -0,0 +1,14 @@
+#ifndef QDBUSXML2CPP_DBUS_TYPES
+#define QDBUSXML2CPP_DBUS_TYPES
+
+#include <QPair>
+#include <QList>
+#include <QDBusMetaType>
+
+typedef QPair<QDBusObjectPath, QVariantMap> PathProperties;
+Q_DECLARE_METATYPE(PathProperties);
+
+typedef QList<PathProperties> PathPropertiesArray;
+Q_DECLARE_METATYPE(PathPropertiesArray);
+
+#endif
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/src.pro
^
|
@@ -10,6 +10,9 @@
PKGCONFIG += ssu-sysinfo nemodbus packagekitqt5
system(qdbusxml2cpp -p mceiface.h:mceiface.cpp mce.xml)
+system(qdbusxml2cpp -c ConnmanVpnProxy -p connmanvpnproxy ../dbus/net.connman.vpn.xml -i qdbusxml2cpp_dbus_types.h)
+system(qdbusxml2cpp -c ConnmanVpnConnectionProxy -p connmanvpnconnectionproxy ../dbus/net.connman.vpn.Connection.xml -i qdbusxml2cpp_dbus_types.h)
+system(qdbusxml2cpp -c ConnmanServiceProxy -p connmanserviceproxy ../dbus/net.connman.service.xml -i qdbusxml2cpp_dbus_types.h)
SOURCES += \
languagemodel.cpp \
@@ -22,6 +25,10 @@
displaysettings.cpp \
aboutsettings.cpp \
certificatemodel.cpp \
+ vpnmodel.cpp \
+ connmanserviceproxy.cpp \
+ connmanvpnproxy.cpp \
+ connmanvpnconnectionproxy.cpp \
developermodesettings.cpp \
batterystatus.cpp \
diskusage.cpp \
@@ -31,7 +38,6 @@
partitionmodel.cpp \
deviceinfo.cpp \
locationsettings.cpp \
- settingsvpnmodel.cpp \
timezoneinfo.cpp \
udisks2block.cpp \
udisks2blockdevices.cpp \
@@ -47,10 +53,12 @@
displaysettings.h \
aboutsettings.h \
certificatemodel.h \
- settingsvpnmodel.h \
+ vpnmodel.h \
+ connmanserviceproxy.h \
+ connmanvpnproxy.h \
+ connmanvpnconnectionproxy.h \
developermodesettings.h \
batterystatus.h \
- udisks2block_p.h \
udisks2defines.h \
diskusage.h \
partition.h \
@@ -63,7 +71,7 @@
HEADERS += \
$$PUBLIC_HEADERS \
- aboutsettings_p.h \
+ qdbusxml2cpp_dbus_types.h \
localeconfig.h \
batterystatus_p.h \
logging_p.h \
@@ -72,6 +80,7 @@
logging_p.h \
partition_p.h \
partitionmanager_p.h \
+ udisks2block_p.h \
udisks2blockdevices_p.h \
udisks2job_p.h \
udisks2monitor_p.h
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/udisks2block.cpp
^
|
@@ -294,32 +294,6 @@
return value(QStringLiteral("IdUUID")).toString();
}
-QStringList UDisks2::Block::symlinks() const
-{
- QStringList links;
- QVariant variantListBytes = value(QStringLiteral("Symlinks"));
-
- if (variantListBytes.canConvert<QVariantList>()) {
- QSequentialIterable iterable = variantListBytes.value<QSequentialIterable>();
-
- for (const QVariant &a : iterable) {
- QByteArray symlinkBytes;
-
- if (a.canConvert<QVariantList>()) {
- QSequentialIterable i = a.value<QSequentialIterable>();
- for (const QVariant &variantByte : i) {
- symlinkBytes.append(variantByte.toChar());
- }
- }
-
- if (!symlinkBytes.isEmpty())
- links << QString::fromLocal8Bit(symlinkBytes);
- }
- }
-
- return links;
-}
-
QString UDisks2::Block::mountPath() const
{
return m_mountPath;
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/udisks2block_p.h
^
|
@@ -1,6 +1,5 @@
/*
- * Copyright (c) 2018 - 2019 Jolla Ltd.
- * Copyright (c) 2019 Open Mobile Platform LLC.
+ * Copyright (C) 2018 Jolla Ltd. <raine.makelainen@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -39,8 +38,6 @@
#include <QPointer>
#include <functional>
-#include <systemsettingsglobal.h>
-
#include "udisks2defines.h"
class QDBusPendingCallWatcher;
@@ -48,13 +45,12 @@
namespace UDisks2 {
-class SYSTEMSETTINGS_EXPORT Block : public QObject
+class Block : public QObject
{
Q_OBJECT
Q_PROPERTY(QString connectionBus READ connectionBus NOTIFY updated)
public:
- Block(const QString &path, const UDisks2::InterfacePropertyMap &interfacePropertyMap, QObject *parent = nullptr);
virtual ~Block();
QString path() const;
@@ -100,8 +96,6 @@
QString idLabel() const;
QString idUUID() const;
- QStringList symlinks() const;
-
QString mountPath() const;
QVariant value(const QString &key) const;
@@ -125,6 +119,7 @@
void complete();
private:
+ Block(const QString &path, const UDisks2::InterfacePropertyMap &interfacePropertyMap, QObject *parent = nullptr);
Block& operator=(const Block& other);
bool setEncrypted(bool encrypted);
|
[-]
[+]
|
Added |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/vpnmodel.cpp
^
|
@@ -0,0 +1,1220 @@
+/*
+ * Copyright (C) 2016 Jolla Ltd.
+ * Contact: Matt Vogt <matthew.vogt@jollamobile.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * "Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Nemo Mobile nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+ */
+
+#include "vpnmodel.h"
+#include "logging_p.h"
+#include "connmanvpnconnectionproxy.h"
+#include "connmanserviceproxy.h"
+
+#include <QStandardPaths>
+#include <QCryptographicHash>
+#include <QDBusPendingCallWatcher>
+#include <QDBusServiceWatcher>
+#include <QRegularExpression>
+
+#include <nemo-dbus/dbus.h>
+
+namespace {
+
+const auto defaultDomain = QStringLiteral("sailfishos.org");
+const auto legacyDefaultDomain(QStringLiteral("merproject.org"));
+const auto connmanService = QStringLiteral("net.connman");
+const auto connmanVpnService = QStringLiteral("net.connman.vpn");
+const auto autoConnectKey = QStringLiteral("AutoConnect");
+
+QString vpnServicePath(QString connectionPath)
+{
+ return QString("/net/connman/service/vpn_%1").arg(connectionPath.section("/", 5));
+}
+
+// Conversion to/from DBus/QML
+QHash<QString, QList<QPair<QVariant, QVariant> > > propertyConversions()
+{
+ QHash<QString, QList<QPair<QVariant, QVariant> > > rv;
+
+ QList<QPair<QVariant, QVariant> > states;
+ states.push_back(qMakePair(QVariant::fromValue(QString("idle")), QVariant::fromValue(static_cast<int>(VpnModel::Idle))));
+ states.push_back(qMakePair(QVariant::fromValue(QString("failure")), QVariant::fromValue(static_cast<int>(VpnModel::Failure))));
+ states.push_back(qMakePair(QVariant::fromValue(QString("configuration")), QVariant::fromValue(static_cast<int>(VpnModel::Configuration))));
+ states.push_back(qMakePair(QVariant::fromValue(QString("ready")), QVariant::fromValue(static_cast<int>(VpnModel::Ready))));
+ states.push_back(qMakePair(QVariant::fromValue(QString("disconnect")), QVariant::fromValue(static_cast<int>(VpnModel::Disconnect))));
+ rv.insert(QString("state"), states);
+
+ return rv;
+}
+
+QVariant convertValue(const QString &key, const QVariant &value, bool toDBus)
+{
+ static const QHash<QString, QList<QPair<QVariant, QVariant> > > conversions(propertyConversions());
+
+ auto it = conversions.find(key.toLower());
+ if (it != conversions.end()) {
+ const QList<QPair<QVariant, QVariant> > &list(it.value());
+ auto lit = std::find_if(list.cbegin(), list.cend(), [value, toDBus](const QPair<QVariant, QVariant> &pair) { return value == (toDBus ? pair.second : pair.first); });
+ if (lit != list.end()) {
+ return toDBus ? (*lit).first : (*lit).second;
+ } else {
+ qCWarning(lcVpnLog) << "No conversion found for" << (toDBus ? "QML" : "DBus") << "value:" << value << key;
+ }
+ }
+
+ return value;
+}
+
+QVariant convertToQml(const QString &key, const QVariant &value)
+{
+ return convertValue(key, value, false);
+}
+
+QVariant convertToDBus(const QString &key, const QVariant &value)
+{
+ return convertValue(key, value, true);
+}
+
+QVariantMap propertiesToDBus(const QVariantMap &fromQml)
+{
+ QVariantMap rv;
+
+ for (QVariantMap::const_iterator it = fromQml.cbegin(), end = fromQml.cend(); it != end; ++it) {
+ QString key(it.key());
+ QVariant value(it.value());
+
+ if (key == QStringLiteral("providerProperties")) {
+ const QVariantMap providerProperties(value.value<QVariantMap>());
+ for (QVariantMap::const_iterator pit = providerProperties.cbegin(), pend = providerProperties.cend(); pit != pend; ++pit) {
+ rv.insert(pit.key(), pit.value());
+ }
+ continue;
+ }
+
+ // The DBus properties are capitalized
+ QChar &initial(*key.begin());
+ initial = initial.toUpper();
+
+ rv.insert(key, convertToDBus(key, value));
+ }
+
+ return rv;
+}
+
+template<typename T>
+QVariant extract(const QDBusArgument &arg)
+{
+ T rv;
+ arg >> rv;
+ return QVariant::fromValue(rv);
+}
+
+template<typename T>
+QVariant extractArray(const QDBusArgument &arg)
+{
+ QVariantList rv;
+
+ arg.beginArray();
+ while (!arg.atEnd()) {
+ rv.append(extract<T>(arg));
+ }
+ arg.endArray();
+
+ return QVariant::fromValue(rv);
+}
+
+QVariantMap propertiesToQml(const QVariantMap &fromDBus)
+{
+ QVariantMap rv;
+
+ QVariantMap providerProperties;
+
+ for (QVariantMap::const_iterator it = fromDBus.cbegin(), end = fromDBus.cend(); it != end; ++it) {
+ QString key(it.key());
+ QVariant value(it.value());
+
+ if (key.indexOf(QChar('.')) != -1) {
+ providerProperties.insert(key, value);
+ continue;
+ }
+
+ // QML properties must be lowercased
+ QChar &initial(*key.begin());
+ initial = initial.toLower();
+
+ // Some properties must be extracted manually
+ if (key == QStringLiteral("iPv4") ||
+ key == QStringLiteral("iPv6")) {
+ value = extract<QVariantMap>(value.value<QDBusArgument>());
+ } else if (key == QStringLiteral("serverRoutes") ||
+ key == QStringLiteral("userRoutes")) {
+ value = extractArray<QVariantMap>(value.value<QDBusArgument>());
+ }
+
+ rv.insert(key, convertToQml(key, value));
+ }
+
+ if (!providerProperties.isEmpty()) {
+ rv.insert(QStringLiteral("providerProperties"), QVariant::fromValue(providerProperties));
+ }
+
+ return rv;
+}
+
+int numericValue(VpnModel::ConnectionState state)
+{
+ return (state == VpnModel::Ready ? 3 : (state == VpnModel::Configuration ? 2 : (state == VpnModel::Failure ? 1 : 0)));
+}
+
+} // end anonymous namespace
+
+VpnModel::CredentialsRepository::CredentialsRepository(const QString &path)
+ : baseDir_(path)
+{
+ if (!baseDir_.exists() && !baseDir_.mkpath(path)) {
|
[-]
[+]
|
Added |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/src/vpnmodel.h
^
|
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2016 Jolla Ltd.
+ * Contact: Matt Vogt <matthew.vogt@jollamobile.com>
+ *
+ * You may use this file under the terms of the BSD license as follows:
+ *
+ * "Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Nemo Mobile nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+ */
+
+#ifndef VPNMODEL_H
+#define VPNMODEL_H
+
+#include "connmanvpnproxy.h"
+
+#include <systemsettingsglobal.h>
+#include <objectlistmodel.h>
+
+#include <QDir>
+#include <QVariantMap>
+
+class ConnmanServiceProxy;
+class ConnmanVpnConnectionProxy;
+
+class SYSTEMSETTINGS_EXPORT VpnConnection;
+
+class SYSTEMSETTINGS_EXPORT VpnModel : public ObjectListModel
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int bestState READ bestState NOTIFY bestStateChanged)
+ Q_PROPERTY(bool autoConnect READ autoConnect NOTIFY autoConnectChanged)
+ Q_PROPERTY(bool orderByConnected READ orderByConnected WRITE setOrderByConnected NOTIFY orderByConnectedChanged)
+
+public:
+ enum ConnectionState {
+ Idle,
+ Failure,
+ Configuration,
+ Ready,
+ Disconnect,
+ };
+ Q_ENUM(ConnectionState)
+
+ explicit VpnModel(QObject *parent = 0);
+ virtual ~VpnModel();
+
+ int bestState() const;
+ bool autoConnect() const;
+
+ bool orderByConnected() const;
+ void setOrderByConnected(bool orderByConnected);
+
+ Q_INVOKABLE void createConnection(const QVariantMap &properties);
+ Q_INVOKABLE void modifyConnection(const QString &path, const QVariantMap &properties);
+ Q_INVOKABLE void deleteConnection(const QString &path);
+
+ Q_INVOKABLE void activateConnection(const QString &path);
+ Q_INVOKABLE void deactivateConnection(const QString &path);
+
+ Q_INVOKABLE QVariantMap connectionCredentials(const QString &path);
+ Q_INVOKABLE void setConnectionCredentials(const QString &path, const QVariantMap &credentials);
+
+ Q_INVOKABLE bool connectionCredentialsEnabled(const QString &path);
+ Q_INVOKABLE void disableConnectionCredentials(const QString &path);
+
+ Q_INVOKABLE QVariantMap connectionSettings(const QString &path);
+
+ Q_INVOKABLE QVariantMap processProvisioningFile(const QString &path, const QString &type);
+
+ VpnConnection *connection(const QString &path) const;
+
+signals:
+ void bestStateChanged();
+ void autoConnectChanged();
+ void connectionStateChanged(const QString &path, int state);
+ void orderByConnectedChanged();
+
+private:
+ void fetchVpnList();
+
+ VpnConnection *newConnection(const QString &path);
+ void updateConnection(VpnConnection *conn, const QVariantMap &properties);
+
+ QVariantMap processOpenVpnProvisioningFile(QFile &provisioningFile);
+
+ bool domainInUse(const QString &domain) const;
+ QString createDefaultDomain() const;
+ bool isDefaultDomain(const QString &domain) const;
+ void reorderConnection(VpnConnection * conn);
+
+ class CredentialsRepository
+ {
+ public:
+ CredentialsRepository(const QString &path);
+
+ static QString locationForObjectPath(const QString &path);
+
+ bool credentialsExist(const QString &location) const;
+
+ bool storeCredentials(const QString &location, const QVariantMap &credentials);
+ bool removeCredentials(const QString &location);
+
+ QVariantMap credentials(const QString &location) const;
+
+ static QByteArray encodeCredentials(const QVariantMap &credentials);
+ static QVariantMap decodeCredentials(const QByteArray &encoded);
+
+ private:
+ QDir baseDir_;
+ };
+
+ ConnmanVpnProxy connmanVpn_;
+ QHash<QString, ConnmanVpnConnectionProxy *> connections_;
+ QHash<QString, ConnmanServiceProxy *> vpnServices_;
+ QSet<QString> defaultDomains_;
+ CredentialsRepository credentials_;
+ QString provisioningOutputPath_;
+ ConnectionState bestState_;
+ // True if there's one VPN that has autoConnect true
+ bool autoConnect_;
+ bool orderByConnected_;
+};
+
+class SYSTEMSETTINGS_EXPORT VpnConnection : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString path READ path CONSTANT)
+ Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
+ Q_PROPERTY(QString host READ host WRITE setHost NOTIFY hostChanged)
+ Q_PROPERTY(QString domain READ domain WRITE setDomain NOTIFY domainChanged)
+ Q_PROPERTY(QString networks READ networks WRITE setNetworks NOTIFY networksChanged)
+ Q_PROPERTY(bool autoConnect READ autoConnect WRITE setAutoConnect NOTIFY autoConnectChanged)
+ Q_PROPERTY(bool storeCredentials READ storeCredentials WRITE setStoreCredentials NOTIFY storeCredentialsChanged)
+ Q_PROPERTY(int state READ state WRITE setState NOTIFY stateChanged)
+ Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
+ Q_PROPERTY(bool immutable READ immutable WRITE setImmutable NOTIFY immutableChanged)
+ Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged)
+ Q_PROPERTY(QVariantMap iPv4 READ iPv4 WRITE setIPv4 NOTIFY iPv4Changed)
+ Q_PROPERTY(QVariantMap iPv6 READ iPv6 WRITE setIPv6 NOTIFY iPv6Changed)
+ Q_PROPERTY(QStringList nameservers READ nameservers WRITE setNameservers NOTIFY nameserversChanged)
+ Q_PROPERTY(QVariantList userRoutes READ userRoutes WRITE setUserRoutes NOTIFY userRoutesChanged)
+ Q_PROPERTY(QVariantList serverRoutes READ serverRoutes WRITE setServerRoutes NOTIFY serverRoutesChanged)
+ Q_PROPERTY(QVariantMap providerProperties READ providerProperties WRITE setProviderProperties NOTIFY providerPropertiesChanged)
+ Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
+
+public:
+ VpnConnection(const QString &path);
+
+ QString path() const { return path_; }
+
+ QString name() const { return name_; }
+ void setName(const QString &name) { updateMember(&VpnConnection::name_, name, &VpnConnection::nameChanged); }
+
+ QString host() const { return host_; }
+ void setHost(const QString &host) { updateMember(&VpnConnection::host_, host, &VpnConnection::hostChanged); }
+
+ QString domain() const { return domain_; }
+ void setDomain(const QString &domain) { updateMember(&VpnConnection::domain_, domain, &VpnConnection::domainChanged); }
+
+ QString networks() const { return networks_; }
+ void setNetworks(const QString &networks) { updateMember(&VpnConnection::networks_, networks, &VpnConnection::networksChanged); }
+
+ bool autoConnect() const { return autoConnect_; }
+ void setAutoConnect(bool autoConnect) { updateMember(&VpnConnection::autoConnect_, autoConnect, &VpnConnection::autoConnectChanged); }
+
+ bool storeCredentials() const { return storeCredentials_; }
+ void setStoreCredentials(bool storeCredentials) { updateMember(&VpnConnection::storeCredentials_, storeCredentials, &VpnConnection::storeCredentialsChanged); }
+
+ int state() const { return state_; }
+ void setState(int state) { updateMember(&VpnConnection::state_, state, &VpnConnection::stateChanged); }
+
+ QString type() const { return type_; }
+ void setType(const QString &type) { updateMember(&VpnConnection::type_, type, &VpnConnection::typeChanged); }
+
+ bool immutable() const { return immutable_; }
+ void setImmutable(bool immutable) { updateMember(&VpnConnection::immutable_, immutable, &VpnConnection::immutableChanged); }
|
[-]
[+]
|
Changed |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.24.op5.tar.bz2/tests/ut_diskusage.cpp
^
|
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2015 - 2019 Jolla Ltd.
- * Copyright (c) 2019 Open Mobile Platform LLC.
+ * Copyright (C) 2015 Jolla Ltd.
+ * Contact: Thomas Perl <thomas.perl@jolla.com>
*
* You may use this file under the terms of the BSD license as follows:
*
@@ -37,7 +37,7 @@
#include "ut_diskusage.h"
#include <QtTest>
-#include <QDir>
+
static QVariantMap g_mocked_file_size;
static QVariantMap g_mocked_rpm_size;
@@ -131,37 +131,37 @@
{
g_mocked_file_size["/"] = MB(1000);
g_mocked_file_size["/home/"] = MB(300);
- g_mocked_file_size[QDir::homePath()] = MB(150);
- g_mocked_file_size[QDir::homePath() + "/Documents/"] = MB(70);
+ g_mocked_file_size["/home/nemo/"] = MB(150);
+ g_mocked_file_size["/home/nemo/Documents/"] = MB(70);
QVariantMap usage = DiskUsageWorker().calculate(QStringList() <<
- "/" << "/home/" << QDir::homePath() << QDir::homePath() + "/Documents/");
+ "/" << "/home/" << "/home/nemo/" << "/home/nemo/Documents/");
UT_DISKUSAGE_EXPECT_SIZE("/", MB(1000) - MB(300))
UT_DISKUSAGE_EXPECT_SIZE("/home/", MB(300) - MB(150))
- UT_DISKUSAGE_EXPECT_SIZE(QDir::homePath(), MB(150) - MB(70))
- UT_DISKUSAGE_EXPECT_SIZE(QDir::homePath() + "/Documents/", MB(70))
+ UT_DISKUSAGE_EXPECT_SIZE("/home/nemo/", MB(150) - MB(70))
+ UT_DISKUSAGE_EXPECT_SIZE("/home/nemo/Documents/", MB(70))
}
void Ut_DiskUsage::testSubtractNestedSubdirectoryMulti()
{
g_mocked_file_size["/"] = MB(1000);
g_mocked_file_size["/home/"] = MB(300);
- g_mocked_file_size[QDir::homePath()] = MB(150);
- g_mocked_file_size[QDir::homePath() + "/Documents/"] = MB(70);
+ g_mocked_file_size["/home/nemo/"] = MB(150);
+ g_mocked_file_size["/home/nemo/Documents/"] = MB(70);
g_mocked_file_size["/opt/"] = MB(100);
g_mocked_file_size["/opt/foo/"] = MB(30);
g_mocked_file_size["/opt/foo/bar/"] = MB(20);
g_mocked_file_size["/opt/baz/"] = MB(10);
QVariantMap usage = DiskUsageWorker().calculate(QStringList() << "/" <<
- "/home/" << QDir::homePath() << QDir::homePath() + "/Documents/" <<
+ "/home/" << "/home/nemo/" << "/home/nemo/Documents/" <<
"/opt/" << "/opt/foo/" << "/opt/foo/bar/" << "/opt/baz/");
UT_DISKUSAGE_EXPECT_SIZE("/", MB(1000) - MB(300) - MB(100))
UT_DISKUSAGE_EXPECT_SIZE("/home/", MB(300) - MB(150))
- UT_DISKUSAGE_EXPECT_SIZE(QDir::homePath(), MB(150) - MB(70))
- UT_DISKUSAGE_EXPECT_SIZE(QDir::homePath() + "/Documents/", MB(70))
+ UT_DISKUSAGE_EXPECT_SIZE("/home/nemo/", MB(150) - MB(70))
+ UT_DISKUSAGE_EXPECT_SIZE("/home/nemo/Documents/", MB(70))
UT_DISKUSAGE_EXPECT_SIZE("/opt/", MB(100) - MB(30) - MB(10))
UT_DISKUSAGE_EXPECT_SIZE("/opt/foo/", MB(30) - MB(20))
UT_DISKUSAGE_EXPECT_SIZE("/opt/foo/bar/", MB(20))
|
[-]
[+]
|
Deleted |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.34.op5.tar.bz2/src/aboutsettings_p.h
^
|
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2019 Open Mobile Platform LLC.
- *
- * You may use this file under the terms of the BSD license as follows:
- *
- * "Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Nemo Mobile nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- */
-
-#ifndef ABOUTSETTINGS_P_H
-#define ABOUTSETTINGS_P_H
-
-#include <QObject>
-#include <QNetworkInfo>
-#include <QDeviceInfo>
-#include <QVariantList>
-
-#include "partitionmanager.h"
-
-class AboutSettingsPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- AboutSettingsPrivate(QObject *parent = nullptr);
- virtual ~AboutSettingsPrivate();
-
- QNetworkInfo networkInfo;
- QDeviceInfo deviceInfo;
-
- QVariantList internalStorage;
-
- PartitionManager partitionManager;
-
- mutable QMap<QString, QString> osRelease;
- mutable QMap<QString, QString> osReleaseLocalization;
- mutable QMap<QString, QString> hardwareRelease;
-
- QString vendorName;
- QString vendorVersion;
-};
-
-#endif
|
[-]
[+]
|
Deleted |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.34.op5.tar.bz2/src/settingsvpnmodel.cpp
^
|
@@ -1,846 +0,0 @@
-/*
- * Copyright (c) 2016 - 2019 Jolla Ltd.
- * Copyright (c) 2019 Open Mobile Platform LLC.
- *
- * You may use this file under the terms of the BSD license as follows:
- *
- * "Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Nemo Mobile nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- */
-
-#include <QRegularExpression>
-#include <QStandardPaths>
-#include <QDataStream>
-#include <QCryptographicHash>
-#include <QQmlEngine>
-#include <QDir>
-#include "logging_p.h"
-#include "vpnmanager.h"
-
-#include "settingsvpnmodel.h"
-
-namespace {
-
-const auto defaultDomain = QStringLiteral("sailfishos.org");
-const auto legacyDefaultDomain(QStringLiteral("merproject.org"));
-
-int numericValue(VpnConnection::ConnectionState state)
-{
- return (state == VpnConnection::Ready ? 3 :
- (state == VpnConnection::Configuration ? 2 : 0));
-}
-
-VpnConnection::ConnectionState getMaxState(VpnConnection::ConnectionState newState, VpnConnection::ConnectionState oldState)
-{
- if (numericValue(newState) > numericValue(oldState)) {
- return newState;
- }
-
- return oldState;
-}
-
-} // end anonymous namespace
-
-SettingsVpnModel::SettingsVpnModel(QObject* parent)
- : VpnModel(parent)
- , credentials_(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/system/privileged/vpn-data"))
- , bestState_(VpnConnection::Idle)
- , autoConnect_(false)
- , orderByConnected_(true)
- , provisioningOutputPath_(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/system/privileged/vpn-provisioning"))
- , roles(VpnModel::roleNames())
-{
- VpnManager *manager = vpnManager();
-
- roles.insert(ConnectedRole, "connected");
-
- connect(manager, &VpnManager::connectionAdded, this, &SettingsVpnModel::connectionAdded, Qt::UniqueConnection);
- connect(manager, &VpnManager::connectionRemoved, this, &SettingsVpnModel::connectionRemoved, Qt::UniqueConnection);
- connect(manager, &VpnManager::connectionsRefreshed, this, &SettingsVpnModel::connectionsRefreshed, Qt::UniqueConnection);
-}
-
-SettingsVpnModel::~SettingsVpnModel()
-{
- VpnManager *manager = vpnManager();
-
- disconnect(manager, 0, this, 0);
-}
-
-void SettingsVpnModel::createConnection(const QVariantMap &createProperties)
-{
- QVariantMap properties(createProperties);
- const QString domain(properties.value(QString("domain")).toString());
- if (domain.isEmpty()) {
- properties.insert(QString("domain"), QVariant::fromValue(createDefaultDomain()));
- }
-
- vpnManager()->createConnection(properties);
-}
-
-QHash<int, QByteArray> SettingsVpnModel::roleNames() const
-{
- return roles;
-}
-
-QVariant SettingsVpnModel::data(const QModelIndex &index, int role) const
-{
- if (index.isValid() && index.row() >= 0 && index.row() < connections().count()) {
- switch (role) {
- case ConnectedRole:
- return QVariant::fromValue((bool)connections().at(index.row())->connected());
- default:
- return VpnModel::data(index, role);
- }
- }
-
- return QVariant();
-}
-
-VpnConnection::ConnectionState SettingsVpnModel::bestState() const
-{
- return bestState_;
-}
-
-bool SettingsVpnModel::autoConnect() const
-{
- return autoConnect_;
-}
-
-bool SettingsVpnModel::orderByConnected() const
-{
- return orderByConnected_;
-}
-
-void SettingsVpnModel::setOrderByConnected(bool orderByConnected)
-{
- if (orderByConnected != orderByConnected_) {
- orderByConnected_ = orderByConnected;
- VpnModel::connectionsChanged();
- emit orderByConnectedChanged();
- }
-}
-
-void SettingsVpnModel::modifyConnection(const QString &path, const QVariantMap &properties)
-{
- VpnConnection *conn = vpnManager()->connection(path);
- if (conn) {
- QVariantMap updatedProperties(properties);
- const QString domain(updatedProperties.value(QString("domain")).toString());
-
- if (domain.isEmpty()) {
- if (isDefaultDomain(conn->domain())) {
- // The connection already has a default domain, no need to change it
- updatedProperties.remove("domain");
- }
- else {
- updatedProperties.insert(QString("domain"), QVariant::fromValue(createDefaultDomain()));
- }
- }
-
- const QString location(CredentialsRepository::locationForObjectPath(path));
- const bool couldStoreCredentials(credentials_.credentialsExist(location));
- const bool canStoreCredentials(properties.value(QString("storeCredentials")).toBool());
-
- vpnManager()->modifyConnection(path, updatedProperties);
-
- if (canStoreCredentials != couldStoreCredentials) {
- if (canStoreCredentials) {
- credentials_.storeCredentials(location, QVariantMap());
- } else {
- credentials_.removeCredentials(location);
- }
- }
- }
- else {
- qCWarning(lcVpnLog) << "VPN connection modification failed: connection doesn't exist";
- }
-}
-
-void SettingsVpnModel::deleteConnection(const QString &path)
-{
- if (VpnConnection *conn = vpnManager()->connection(path)) {
- // Remove cached credentials
- const QString location(CredentialsRepository::locationForObjectPath(path));
- if (credentials_.credentialsExist(location)) {
- credentials_.removeCredentials(location);
- }
-
- // Remove provisioned files
- if (conn->type() == QStringLiteral("openvpn")) {
- QVariantMap providerProperties = conn->providerProperties();
- QStringList fileProperties;
- fileProperties << QStringLiteral("OpenVPN.Cert") << QStringLiteral("OpenVPN.Key") << QStringLiteral("OpenVPN.CACert") << QStringLiteral("OpenVPN.ConfigFile");
- for (const QString property : fileProperties) {
- const QString filename = providerProperties.value(property).toString();
-
- // Check if the file has been provisioned
- if (filename.contains(provisioningOutputPath_)) {
|
[-]
[+]
|
Deleted |
_service:tar_git:nemo-qml-plugin-systemsettings-0.5.34.op5.tar.bz2/src/settingsvpnmodel.h
^
|
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 2016 - 2019 Jolla Ltd.
- * Copyright (c) 2019 Open Mobile Platform LLC.
- *
- * You may use this file under the terms of the BSD license as follows:
- *
- * "Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Nemo Mobile nor the names of its contributors
- * may be used to endorse or promote products derived from this
- * software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
- */
-
-#ifndef SETTINGSVPNMODEL_H
-#define SETTINGSVPNMODEL_H
-
-#include <QObject>
-#include <QSet>
-#include <QDir>
-
-#include <vpnconnection.h>
-#include <vpnmodel.h>
-#include <systemsettingsglobal.h>
-
-class SYSTEMSETTINGS_EXPORT SettingsVpnModel : public VpnModel
-{
- Q_OBJECT
-
- Q_PROPERTY(VpnConnection::ConnectionState bestState READ bestState NOTIFY bestStateChanged)
- Q_PROPERTY(bool autoConnect READ autoConnect NOTIFY autoConnectChanged)
- Q_PROPERTY(bool orderByConnected READ orderByConnected WRITE setOrderByConnected NOTIFY orderByConnectedChanged)
-
-public:
- SettingsVpnModel(QObject* parent = nullptr);
- ~SettingsVpnModel() override;
-
- enum ItemRoles {
- ConnectedRole = VpnModel::VpnRole + 1
- };
-
- QHash<int, QByteArray> roleNames() const override;
- QVariant data(const QModelIndex &index, int role) const override;
-
- VpnConnection::ConnectionState bestState() const;
- bool autoConnect() const;
- bool orderByConnected() const;
- void setOrderByConnected(bool orderByConnected);
-
- Q_INVOKABLE static bool isDefaultDomain(const QString &domain);
- Q_INVOKABLE void createConnection(const QVariantMap &properties);
- Q_INVOKABLE void modifyConnection(const QString &path, const QVariantMap &properties);
- Q_INVOKABLE void deleteConnection(const QString &path);
-
- Q_INVOKABLE void activateConnection(const QString &path);
- Q_INVOKABLE void deactivateConnection(const QString &path);
-
- Q_INVOKABLE QVariantMap connectionCredentials(const QString &path);
- Q_INVOKABLE void setConnectionCredentials(const QString &path, const QVariantMap &credentials);
-
- Q_INVOKABLE bool connectionCredentialsEnabled(const QString &path);
- Q_INVOKABLE void disableConnectionCredentials(const QString &path);
-
- Q_INVOKABLE QVariantMap connectionSettings(const QString &path);
-
- Q_INVOKABLE QVariantMap processProvisioningFile(const QString &path, const QString &type);
-
- Q_INVOKABLE VpnConnection *get(int index) const;
-
-signals:
- void bestStateChanged();
- void autoConnectChanged();
- void connectionStateChanged(const QString &path, VpnConnection::ConnectionState state);
- void orderByConnectedChanged();
-
-private:
- bool domainInUse(const QString &domain) const;
- QString createDefaultDomain() const;
- void reorderConnection(VpnConnection * conn);
- virtual void orderConnections(QVector<VpnConnection*> &connections) override;
- bool compareConnections(const VpnConnection *i, const VpnConnection *j);
- QVariantMap processOpenVpnProvisioningFile(QFile &provisioningFile);
- void updateBestState(VpnConnection::ConnectionState maxState);
-
-private Q_SLOTS:
- void connectionAdded(const QString &path);
- void connectionRemoved(const QString &path);
- void connectionsRefreshed();
- void updatedConnectionPosition();
- void connectedChanged();
- void stateChanged();
-
-private:
- class CredentialsRepository
- {
- public:
- CredentialsRepository(const QString &path);
-
- static QString locationForObjectPath(const QString &path);
-
- bool credentialsExist(const QString &location) const;
-
- bool storeCredentials(const QString &location, const QVariantMap &credentials);
- bool removeCredentials(const QString &location);
-
- QVariantMap credentials(const QString &location) const;
-
- static QByteArray encodeCredentials(const QVariantMap &credentials);
- static QVariantMap decodeCredentials(const QByteArray &encoded);
-
- private:
- QDir baseDir_;
- };
-
- CredentialsRepository credentials_;
- VpnConnection::ConnectionState bestState_;
- // True if there's one VPN that has autoConnect true
- bool autoConnect_;
- bool orderByConnected_;
- QString provisioningOutputPath_;
- QHash<int, QByteArray> roles;
-};
-
-#endif // SETTINGSVPNMODEL_H
|