- add CGU and private policy

- add clickable links to checkboxes if present
This commit is contained in:
Julien Wadel 2022-02-01 18:08:19 +01:00
parent 2627a113aa
commit 1997f6aafe
22 changed files with 245 additions and 121 deletions

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>OPRET EN %1 KONTO</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>%1-KONTO ERSTELLEN</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>CREATE A %1 ACCOUNT</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation>I accept %1&apos;s %2terms of use%3 and %4privacy policy%5</translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>CREAR UNA CUENTA %1</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>CRÉER UN COMPTE %1</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation>J&apos;accepte %2les conditions d&apos;utilisation%3 et %4la politique de confidentialité%5 de %1</translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>Készítsen egy %1 fiók</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>CREA UN ACCOUNT %1</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>%1</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>SUSIKURTI %1 PASKYRĄ</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>CRIAR UMA CONTA %1</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>СОЗДАТЬ АККАУНТ %1</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>SKAPA ETT %1-KONTO</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>%1 HESABI OLUŞTUR</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation>СТВОРИТИ ОБЛІКІВКУ %1</translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -146,6 +146,11 @@
<source>createAppSipAccount</source>
<translation> %1 </translation>
</message>
<message>
<source>homeCgu</source>
<extracomment>&apos;I accept %1&apos;s %2terms of use%3 and %4privacy policy%5&apos; : where %1 is the vendor name and other %n are internal keywords that encapsulate links.</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AssistantModel</name>

View file

@ -190,6 +190,15 @@ void SettingsModel::setAssistantLogoutUrl (QString url) {
emit assistantLogoutUrlChanged(url);
}
bool SettingsModel::isCguAccepted () const{
return !!mConfig->getInt(UiSection, "read_and_agree_terms_and_privacy", 0);
}
void SettingsModel::acceptCgu(const bool accept){
mConfig->setInt(UiSection, "read_and_agree_terms_and_privacy", accept);
emit cguAcceptedChanged(accept);
}
// =============================================================================
// SIP Accounts.
// =============================================================================

View file

@ -52,6 +52,8 @@ class SettingsModel : public QObject {
Q_PROPERTY(QString assistantLoginUrl READ getAssistantLoginUrl WRITE setAssistantLoginUrl NOTIFY assistantLoginUrlChanged)
Q_PROPERTY(QString assistantLogoutUrl READ getAssistantLogoutUrl WRITE setAssistantLogoutUrl NOTIFY assistantLogoutUrlChanged)
Q_PROPERTY(bool cguAccepted READ isCguAccepted WRITE acceptCgu NOTIFY cguAcceptedChanged)
// SIP Accounts. -------------------------------------------------------------
Q_PROPERTY(QString deviceName READ getDeviceName WRITE setDeviceName NOTIFY deviceNameChanged)
@ -253,6 +255,9 @@ public:
QString getAssistantLogoutUrl () const;
void setAssistantLogoutUrl (QString url);
bool isCguAccepted () const;
void acceptCgu(const bool accept);
// SIP Accounts. -------------------------------------------------------------
static QString getDeviceName(const std::shared_ptr<linphone::Config>& config);
@ -561,6 +566,8 @@ signals:
void assistantLoginUrlChanged (QString url);
void assistantLogoutUrlChanged (QString url);
void cguAcceptedChanged(bool accepted);
// SIP Accounts. -------------------------------------------------------------
void deviceNameChanged();

View file

@ -107,6 +107,8 @@ constexpr int Constants::DefaultExpires;
constexpr char Constants::DownloadUrl[];
constexpr char Constants::VersionCheckUrl[];
constexpr char Constants::PasswordRecoveryUrl[];
constexpr char Constants::CguUrl[];
constexpr char Constants::PrivatePolicyUrl[];
constexpr char Constants::LinphoneBZip2_exe[];

View file

@ -57,6 +57,8 @@ public:
static constexpr char DownloadUrl[] = "https://www.linphone.org/technical-corner/linphone";
static constexpr char VersionCheckUrl[] = "https://linphone.org/releases";
static constexpr char PasswordRecoveryUrl[] = "https://subscribe.linphone.org/login";
static constexpr char CguUrl[] = "https://www.linphone.org/general-terms";
static constexpr char PrivatePolicyUrl[] = "https://www.linphone.org/privacy-policy";
static constexpr char LinphoneBZip2_exe[] = "http://www.linphone.org/releases/windows/tools/bzip2/bzip2.exe";
static constexpr char LinphoneBZip2_dll[] = "http://www.linphone.org/releases/windows/tools/bzip2/bzip2.dll";
@ -67,6 +69,8 @@ public:
static constexpr char RemoteProvisioningURL[] = "https://subscribe.linphone.org/flexiapi/provisioning";
Q_PROPERTY(QString PasswordRecoveryUrl MEMBER PasswordRecoveryUrl CONSTANT)
Q_PROPERTY(QString CguUrl MEMBER CguUrl CONSTANT)
Q_PROPERTY(QString PrivatePolicyUrl MEMBER PrivatePolicyUrl CONSTANT)
static constexpr char DefaultAssistantRegistrationUrl[] = "https://subscribe.linphone.org/register";
static constexpr char DefaultAssistantLoginUrl[] = "https://subscribe.linphone.org/login";
static constexpr char DefaultAssistantLogoutUrl[] = "https://subscribe.linphone.org/logout";

View file

@ -29,6 +29,13 @@ CheckBox {
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
onLinkActivated: Qt.openUrlExternally(link)
MouseArea {
id: mouseArea
anchors.fill: parent
cursorShape: parent.hoveredLink != '' ? Qt.PointingHandCursor : Qt.ArrowCursor
acceptedButtons: Qt.NoButton
}
}
font.pointSize: CheckBoxTextStyle.pointSize

View file

@ -3,130 +3,150 @@ import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import ConstantsCpp 1.0
import App.Styles 1.0
// =============================================================================
ColumnLayout {
spacing: 0
// ---------------------------------------------------------------------------
// Info.
// ---------------------------------------------------------------------------
Item {
Layout.fillHeight: true
Layout.fillWidth: true
Column {
anchors.verticalCenter: parent.verticalCenter
spacing: 0
height: AssistantHomeStyle.info.height
width: parent.width
Icon {
anchors.horizontalCenter: parent.horizontalCenter
icon: 'home_account_assistant'
iconSize: AssistantHomeStyle.info.iconSize
}
Text {
height: AssistantHomeStyle.info.title.height
width: parent.width
color: AssistantHomeStyle.info.title.color
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font {
bold: true
pointSize: AssistantHomeStyle.info.title.pointSize
}
text: qsTr('homeTitle')
}
Text {
height: AssistantHomeStyle.info.description.height
width: parent.width
color: AssistantHomeStyle.info.description.color
elide: Text.ElideRight
font.pointSize: AssistantHomeStyle.info.description.pointSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr('homeDescription')
}
}
}
// ---------------------------------------------------------------------------
// Buttons.
// ---------------------------------------------------------------------------
GridView {
id: buttons
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.maximumWidth: AssistantHomeStyle.buttons.maxWidth
Layout.preferredHeight: AssistantHomeStyle.buttons.height
Layout.leftMargin: AssistantStyle.leftMargin
Layout.rightMargin: AssistantStyle.rightMargin
Layout.bottomMargin: AssistantStyle.bottomMargin
cellHeight: height / 2
cellWidth: width / 2
delegate: Item {
height: buttons.cellHeight
width: buttons.cellWidth
TextButtonA {
anchors {
fill: parent
margins: AssistantHomeStyle.buttons.spacing
}
enabled: SettingsModel[$viewType.charAt(0).toLowerCase() + $viewType.slice(1) + "Enabled"]
text: $text.replace('%1', Qt.application.name.toUpperCase())
onClicked:{ assistant.pushView($view, $props) }
}
}
model: ListModel {
Component.onCompleted: {
insert(0, {
$text: qsTr('createAppSipAccount'),
$view: 'CreateAppSipAccount',
$viewType: 'CreateAppSipAccount',
$props:{defaultUrl: SettingsModel.assistantRegistrationUrl, defaultLogoutUrl:SettingsModel.assistantLogoutUrl, configFilename: 'create-app-sip-account.rc'}
})
append({
$text: qsTr('useAppSipAccount'),
$view: 'CreateAppSipAccount',
$viewType: 'UseAppSipAccount',
$props:{defaultUrl: SettingsModel.assistantLoginUrl, defaultLogoutUrl:SettingsModel.assistantLogoutUrl, configFilename: 'use-app-sip-account.rc'}
})
append({
$text: qsTr('useOtherSipAccount'),
$view: 'UseOtherSipAccount',
$viewType: 'UseOtherSipAccount'
})
append( {
$text: qsTr('fetchRemoteConfiguration'),
$view: 'FetchRemoteConfiguration',
$viewType: 'FetchRemoteConfiguration'
})
}
}
interactive: false
}
spacing: 0
// ---------------------------------------------------------------------------
// Info.
// ---------------------------------------------------------------------------
Item {
id: infoItem
Layout.fillHeight: true
Layout.fillWidth: true
ColumnLayout {
anchors.verticalCenter: parent.verticalCenter
spacing: 0
height: AssistantHomeStyle.info.height
width: parent.width
Icon {
//anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignHCenter
icon: 'home_account_assistant'
iconSize: AssistantHomeStyle.info.iconSize
}
Text {
height: AssistantHomeStyle.info.title.height
Layout.fillWidth: true
//width: parent.width
color: AssistantHomeStyle.info.title.color
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font {
bold: true
pointSize: AssistantHomeStyle.info.title.pointSize
}
text: qsTr('homeTitle')
}
Text {
height: AssistantHomeStyle.info.description.height
Layout.fillWidth: true
//width: parent.width
color: AssistantHomeStyle.info.description.color
elide: Text.ElideRight
font.pointSize: AssistantHomeStyle.info.description.pointSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr('homeDescription')
}
CheckBoxText{
id: cguCheckBox
Layout.topMargin: 10
Layout.maximumWidth: infoItem.width
Layout.alignment: Qt.AlignHCenter
visible: applicationVendor != '' && ConstantsCpp.CguUrl != '' && ConstantsCpp.PrivatePolicyUrl != ''
checked: SettingsModel.cguAccepted
onCheckedChanged: SettingsModel.cguAccepted = checked
//: 'I accept %1's %2terms of use%3 and %4privacy policy%5' : where %1 is the vendor name and other %n are internal keywords that encapsulate links.
text: qsTr('homeCgu').arg(applicationVendor).arg('< a href="'+ConstantsCpp.CguUrl+'">').arg('</a>').arg('<a href="'+ConstantsCpp.PrivatePolicyUrl+'">').arg('</a>')
}
}
}
// ---------------------------------------------------------------------------
// Buttons.
// ---------------------------------------------------------------------------
GridView {
id: buttons
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.maximumWidth: AssistantHomeStyle.buttons.maxWidth
Layout.preferredHeight: AssistantHomeStyle.buttons.height
Layout.leftMargin: AssistantStyle.leftMargin
Layout.rightMargin: AssistantStyle.rightMargin
Layout.bottomMargin: AssistantStyle.bottomMargin
cellHeight: height / 2
cellWidth: width / 2
enabled: cguCheckBox.checked
delegate: Item {
height: buttons.cellHeight
width: buttons.cellWidth
TextButtonA {
anchors {
fill: parent
margins: AssistantHomeStyle.buttons.spacing
}
enabled: cguCheckBox.checked && SettingsModel[$viewType.charAt(0).toLowerCase() + $viewType.slice(1) + "Enabled"]
text: $text.replace('%1', Qt.application.name.toUpperCase())
onClicked:{ assistant.pushView($view, $props) }
}
}
model: ListModel {
Component.onCompleted: {
insert(0, {
$text: qsTr('createAppSipAccount'),
$view: 'CreateAppSipAccount',
$viewType: 'CreateAppSipAccount',
$props:{defaultUrl: SettingsModel.assistantRegistrationUrl, defaultLogoutUrl:SettingsModel.assistantLogoutUrl, configFilename: 'create-app-sip-account.rc'}
})
append({
$text: qsTr('useAppSipAccount'),
$view: 'CreateAppSipAccount',
$viewType: 'UseAppSipAccount',
$props:{defaultUrl: SettingsModel.assistantLoginUrl, defaultLogoutUrl:SettingsModel.assistantLogoutUrl, configFilename: 'use-app-sip-account.rc'}
})
append({
$text: qsTr('useOtherSipAccount'),
$view: 'UseOtherSipAccount',
$viewType: 'UseOtherSipAccount'
})
append( {
$text: qsTr('fetchRemoteConfiguration'),
$view: 'FetchRemoteConfiguration',
$viewType: 'FetchRemoteConfiguration'
})
}
}
interactive: false
}
}

@ -1 +1 @@
Subproject commit 9cc416ad81725beb1d04baa9c6e1dc3d23db11ac
Subproject commit 0a4f40d12d3573d0e6b981f637209b23fb11d0a9