Commit 411e1c00 authored by Raine Makelainen's avatar Raine Makelainen

Merge branch 'jb47601' into 'master'

Use QStandardPaths::GenericDataLocation for notification path

See merge request !125
parents 39e1be83 a45a4722
......@@ -38,7 +38,7 @@ BuildRequires: pkgconfig(ngf-qt5)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(wayland-server)
BuildRequires: pkgconfig(usb-moded-qt5) >= 1.8
BuildRequires: pkgconfig(systemsettings)
BuildRequires: pkgconfig(systemsettings) >= 0.5.28
BuildRequires: pkgconfig(nemodevicelock)
BuildRequires: qt5-qttools-linguist
BuildRequires: qt5-qtgui-devel >= 5.2.1+git24
......
/***************************************************************************
**
** Copyright (C) 2012-2019 Jolla Ltd.
** Copyright (c) 2012 - 2019 Jolla Ltd.
** Copyright (c) 2019 Open Mobile Platform LLC.
**
** Contact: Robin Burchell <robin.burchell@jollamobile.com>
......@@ -22,8 +22,10 @@
#include <QSqlQuery>
#include <QSqlRecord>
#include <QSqlTableModel>
#include <QStandardPaths>
#include <QFile>
#include <QFileInfo>
#include <aboutsettings.h>
#include <mremoteaction.h>
#include <mdesktopentry.h>
#include <sys/statfs.h>
......@@ -52,9 +54,6 @@ static const char *CATEGORY_DEFINITION_FILE_DIRECTORY = "/usr/share/lipstick/not
//! The number configuration files to load into the event type store.
static const uint MAX_CATEGORY_DEFINITION_FILES = 100;
//! Path of the privileged storage directory relative to the home directory
static const char *PRIVILEGED_DATA_PATH = "/.local/share/system/privileged";
//! Path to probe for desktop entries
static const char *DESKTOP_ENTRY_PATH = "/usr/share/applications/";
......@@ -455,7 +454,8 @@ void NotificationManager::markNotificationDisplayed(uint id)
QString NotificationManager::GetServerInformation(QString &vendor, QString &version, QString &spec_version)
{
QString name = qApp->applicationName();
vendor = "Nemo Mobile";
AboutSettings settings;
vendor = settings.operatingSystemName();
version = qApp->applicationVersion();
spec_version = "1.2";
return name;
......@@ -666,7 +666,7 @@ void NotificationManager::restoreNotifications(bool update)
bool NotificationManager::connectToDatabase()
{
QString databasePath = "/home/nemo" + QString(PRIVILEGED_DATA_PATH) + QDir::separator() + "Notifications";
QString databasePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/system/privileged/Notifications");
if (!QDir::root().exists(databasePath)) {
QDir::root().mkpath(databasePath);
}
......
/***************************************************************************
**
** Copyright (c) 2019 Open Mobile Platform LLC.
**
** This file is part of lipstick.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef ABOUTSETTINGS_H_STUB
#define ABOUTSETTINGS_H_STUB
#include "aboutsettings.h"
#include <stubbase.h>
static const auto TotalDiskSpace = QStringLiteral("totalDiskSpace");
static const auto AvailableDiskSpace = QStringLiteral("availableDiskSpace");
static const auto DiskUsageModel = QStringLiteral("diskUsageModel");
static const auto RefreshStorageModels = QStringLiteral("refreshStorageModels");
static const auto WlanMacAddress = QStringLiteral("wlanMacAddress");
static const auto Imei = QStringLiteral("imei");
static const auto Serial = QStringLiteral("serial");
static const auto LocalizedOperatingSystemName = QStringLiteral("localizedOperatingSystemName");
static const auto OperatingSystemName = QStringLiteral("operatingSystemName");
static const auto BaseOperatingSystemName = QStringLiteral("baseOperatingSystemName");
static const auto SoftwareVersion = QStringLiteral("softwareVersion");
static const auto SoftwareVersionId = QStringLiteral("softwareVersionId");
static const auto AdaptationVersion = QStringLiteral("adaptationVersion");
static const auto VendorName = QStringLiteral("vendorName");
static const auto VendorVersion = QStringLiteral("vendorVersion");
class AboutSettingsStub : public StubBase
{
public:
virtual void AboutSettingsConstructor(QObject *parent);
virtual void AboutSettingsDestructor();
virtual QString operatingSystemName() const;
virtual qlonglong totalDiskSpace() const;
virtual qlonglong availableDiskSpace() const;
virtual QVariant diskUsageModel() const;
virtual void refreshStorageModels();
virtual QString wlanMacAddress() const;
virtual QString imei() const;
virtual QString serial() const;
virtual QString localizedOperatingSystemName() const;
virtual QString baseOperatingSystemName() const;
virtual QString softwareVersion() const;
virtual QString softwareVersionId() const;
virtual QString adaptationVersion() const;
virtual QString vendorName() const;
virtual QString vendorVersion() const;
};
void AboutSettingsStub::AboutSettingsConstructor(QObject *parent)
{
Q_UNUSED(parent)
}
void AboutSettingsStub::AboutSettingsDestructor()
{
}
QString AboutSettingsStub::operatingSystemName() const
{
stubMethodEntered(OperatingSystemName);
return stubReturnValue<QString>(OperatingSystemName);
}
qlonglong AboutSettingsStub::totalDiskSpace() const
{
stubMethodEntered(TotalDiskSpace);
return stubReturnValue<qlonglong>(TotalDiskSpace);
}
qlonglong AboutSettingsStub::availableDiskSpace() const
{
stubMethodEntered(AvailableDiskSpace);
return stubReturnValue<qlonglong>(AvailableDiskSpace);
}
QVariant AboutSettingsStub::diskUsageModel() const
{
stubMethodEntered(DiskUsageModel);
return stubReturnValue<QVariant>(DiskUsageModel);
}
void AboutSettingsStub::refreshStorageModels()
{
// Do nothing
}
QString AboutSettingsStub::wlanMacAddress() const
{
stubMethodEntered(WlanMacAddress);
return stubReturnValue<QString>(WlanMacAddress);
}
QString AboutSettingsStub::imei() const
{
stubMethodEntered(Imei);
return stubReturnValue<QString>(Imei);
}
QString AboutSettingsStub::serial() const
{
stubMethodEntered(Serial);
return stubReturnValue<QString>(Serial);
}
QString AboutSettingsStub::localizedOperatingSystemName() const
{
stubMethodEntered(LocalizedOperatingSystemName);
return stubReturnValue<QString>(LocalizedOperatingSystemName);
}
QString AboutSettingsStub::baseOperatingSystemName() const
{
stubMethodEntered(BaseOperatingSystemName);
return stubReturnValue<QString>(BaseOperatingSystemName);
}
QString AboutSettingsStub::softwareVersion() const
{
stubMethodEntered(SoftwareVersion);
return stubReturnValue<QString>(SoftwareVersion);
}
QString AboutSettingsStub::softwareVersionId() const
{
stubMethodEntered(SoftwareVersionId);
return stubReturnValue<QString>(SoftwareVersionId);
}
QString AboutSettingsStub::adaptationVersion() const
{
stubMethodEntered(AdaptationVersion);
return stubReturnValue<QString>(AdaptationVersion);
}
QString AboutSettingsStub::vendorName() const
{
stubMethodEntered(VendorName);
return stubReturnValue<QString>(VendorName);
}
QString AboutSettingsStub::vendorVersion() const
{
stubMethodEntered(VendorVersion);
return stubReturnValue<QString>(VendorVersion);
}
AboutSettingsStub gDefaultAboutSettingsStub;
AboutSettingsStub *gAboutSettingsStub = &gDefaultAboutSettingsStub;
AboutSettings::AboutSettings(QObject *parent)
{
gAboutSettingsStub->AboutSettingsConstructor(parent);
}
AboutSettings::~AboutSettings()
{
gAboutSettingsStub->AboutSettingsDestructor();
}
QString AboutSettings::operatingSystemName() const
{
return gAboutSettingsStub->operatingSystemName();
}
qlonglong AboutSettings::totalDiskSpace() const
{
return gAboutSettingsStub->totalDiskSpace();
}
qlonglong AboutSettings::availableDiskSpace() const
{
return gAboutSettingsStub->availableDiskSpace();
}
QVariant AboutSettings::diskUsageModel() const
{
return gAboutSettingsStub->diskUsageModel();
}
void AboutSettings::refreshStorageModels()
{
gAboutSettingsStub->refreshStorageModels();
}
QString AboutSettings::wlanMacAddress() const
{
return gAboutSettingsStub->wlanMacAddress();
}
QString AboutSettings::imei() const
{
return gAboutSettingsStub->imei();
}
QString AboutSettings::serial() const
{
return gAboutSettingsStub->serial();
}
QString AboutSettings::localizedOperatingSystemName() const
{
return gAboutSettingsStub->localizedOperatingSystemName();
}
QString AboutSettings::baseOperatingSystemName() const
{
return gAboutSettingsStub->baseOperatingSystemName();
}
QString AboutSettings::softwareVersion() const
{
return gAboutSettingsStub->softwareVersion();
}
QString AboutSettings::softwareVersionId() const
{
return gAboutSettingsStub->softwareVersionId();
}
QString AboutSettings::adaptationVersion() const
{
return gAboutSettingsStub->adaptationVersion();
}
QString AboutSettings::vendorName() const
{
return gAboutSettingsStub->vendorName();
}
QString AboutSettings::vendorVersion() const
{
return gAboutSettingsStub->vendorVersion();
}
#endif
/***************************************************************************
**
** Copyright (C) 2012 Jolla Ltd.
** Copyright (c) 2012 - 2019 Jolla Ltd.
** Copyright (c) 2019 Open Mobile Platform LLC.
** Contact: Robin Burchell <robin.burchell@jollamobile.com>
**
** This file is part of lipstick.
......
......@@ -15,6 +15,8 @@
#include <QtTest/QtTest>
#include "ut_notificationmanager.h"
#include "aboutsettings_stub.h"
#include "notificationmanager.h"
#include "notificationmanageradaptor_stub.h"
#include "lipsticknotification.h"
......@@ -90,9 +92,12 @@ void Ut_NotificationManager::testServerInformation()
QString name, vendor, version, spec_version;
qApp->setApplicationName("testApp");
qApp->setApplicationVersion("1.2.3");
QString testVendor("test vendor");
gAboutSettingsStub->stubSetReturnValue(OperatingSystemName, testVendor);
name = NotificationManager::instance()->GetServerInformation(vendor, version, spec_version);
QCOMPARE(name, qApp->applicationName());
QCOMPARE(vendor, QString("Nemo Mobile"));
QCOMPARE(vendor, testVendor);
QCOMPARE(version, qApp->applicationVersion());
QCOMPARE(spec_version, QString("1.2"));
}
......
......@@ -19,5 +19,7 @@ HEADERS += \
$$NOTIFICATIONSRCDIR/lipsticknotification.h \
$$NOTIFICATIONSRCDIR/notificationmanageradaptor.h \
$$NOTIFICATIONSRCDIR/categorydefinitionstore.h \
$$NOTIFICATIONSRCDIR/androidprioritystore.h
$$NOTIFICATIONSRCDIR/androidprioritystore.h \
/usr/include/systemsettings/aboutsettings.h
QMAKE_CXXFLAGS += `pkg-config --cflags-only-I systemsettings`
/*
* Copyright (c) 2015 - 2019 Jolla Ltd.
* Copyright (c) 2019 Open Mobile Platform LLC.
*
* This file is part of lipstick.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* and appearing in the file LICENSE.LGPL included in the packaging
* of this file.
*/
import org.nemomobile.lipstick 0.1
import QtQuick 2.2
......@@ -29,6 +42,7 @@ Compositor
repeat: false
onTriggered: {
print("setting the first batch of sources...", root.doAsync ? "async" : "sync");
// Note: This is default content of the main user.
image1.source = "/home/nemo/Pictures/Jolla/Jolla_01.jpg"
image2.source = "/home/nemo/Pictures/Jolla/Jolla_02.jpg"
// image3.source = "/home/nemo/Pictures/Jolla/Jolla_03.jpg"
......
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