(rowCount()))
- return QVariant();
-
- auto apiServiceData = m_services.at(index.row());
- auto serviceType = apiServiceData.type;
- auto isServiceAvailable = apiServiceData.isServiceAvailable;
-
- switch (role) {
- case NameRole: {
- return apiServiceData.serviceInfo.name;
- }
- case CardDescriptionRole: {
- auto speed = apiServiceData.serviceInfo.speed;
- if (serviceType == serviceType::amneziaPremium) {
- return tr("Amnezia Premium is VPN for comfortable work, downloading large files and watching videos in 8K resolution. "
- "Works for any sites with no restrictions. Speed up to %1 MBit/s. Unlimited traffic.")
- .arg(speed);
- } else if (serviceType == serviceType::amneziaFree) {
- QString description = tr("AmneziaFree provides free unlimited access to a basic set of web sites, such as Facebook, Instagram, Twitter (X), Discord, Telegram, and others. YouTube is not included in the free plan.");
- if (!isServiceAvailable) {
- description += tr("Not available in your region. If you have VPN enabled, disable it, "
- "return to the previous screen, and try again.");
- }
- return description;
- }
- }
- case ServiceDescriptionRole: {
- if (serviceType == serviceType::amneziaPremium) {
- return tr("Amnezia Premium is VPN for comfortable work, downloading large files and watching videos in 8K resolution. "
- "Works for any sites with no restrictions.");
- } else {
- return tr("AmneziaFree provides free unlimited access to a basic set of web sites, such as Facebook, Instagram, Twitter (X), Discord, Telegram, and others. YouTube is not included in the free plan.");
- }
- }
- case IsServiceAvailableRole: {
- if (serviceType == serviceType::amneziaFree) {
- if (!isServiceAvailable) {
- return false;
- }
- }
- return true;
- }
- case SpeedRole: {
- return tr("%1 MBit/s").arg(apiServiceData.serviceInfo.speed);
- }
- case TimeLimitRole: {
- auto timeLimit = apiServiceData.serviceInfo.timeLimit;
- if (timeLimit == "0") {
- return "";
- }
- return tr("%1 days").arg(timeLimit);
- }
- case RegionRole: {
- return apiServiceData.serviceInfo.region;
- }
- case FeaturesRole: {
- if (serviceType == serviceType::amneziaPremium) {
- return tr("");
- } else {
- return tr("VPN will open only popular sites blocked in your region, such as Instagram, Facebook, Twitter and others. "
- "Other sites will be opened from your real IP address, "
- "more details on the website.");
- }
- }
- case PriceRole: {
- auto price = apiServiceData.serviceInfo.price;
- if (price == "free") {
- return tr("Free");
- }
- return tr("%1 $/month").arg(price);
- }
- case EndDateRole: {
- return QDateTime::fromString(apiServiceData.subscription.endDate, Qt::ISODate).toLocalTime().toString("d MMM yyyy");
- }
- }
-
- return QVariant();
-}
-
-void ApiServicesModel::updateModel(const QJsonObject &data)
-{
- beginResetModel();
-
- m_services.clear();
-
- m_countryCode = data.value(configKey::userCountryCode).toString();
- auto services = data.value(configKey::services).toArray();
-
- if (services.isEmpty()) {
- m_services.push_back(getApiServicesData(data));
- m_selectedServiceIndex = 0;
- } else {
- for (const auto &service : services) {
- auto serviceObject = service.toObject();
- m_services.push_back(getApiServicesData(serviceObject));
- }
- }
-
- endResetModel();
-}
-
-void ApiServicesModel::setServiceIndex(const int index)
-{
- m_selectedServiceIndex = index;
-}
-
-QJsonObject ApiServicesModel::getSelectedServiceInfo()
-{
- auto service = m_services.at(m_selectedServiceIndex);
- return service.serviceInfo.object;
-}
-
-QString ApiServicesModel::getSelectedServiceType()
-{
- auto service = m_services.at(m_selectedServiceIndex);
- return service.type;
-}
-
-QString ApiServicesModel::getSelectedServiceProtocol()
-{
- auto service = m_services.at(m_selectedServiceIndex);
- return service.protocol;
-}
-
-QString ApiServicesModel::getSelectedServiceName()
-{
- auto service = m_services.at(m_selectedServiceIndex);
- return service.serviceInfo.name;
-}
-
-QJsonArray ApiServicesModel::getSelectedServiceCountries()
-{
- auto service = m_services.at(m_selectedServiceIndex);
- return service.availableCountries;
-}
-
-QString ApiServicesModel::getCountryCode()
-{
- return m_countryCode;
-}
-
-QString ApiServicesModel::getStoreEndpoint()
-{
- auto service = m_services.at(m_selectedServiceIndex);
- return service.storeEndpoint;
-}
-
-QVariant ApiServicesModel::getSelectedServiceData(const QString roleString)
-{
- QModelIndex modelIndex = index(m_selectedServiceIndex);
- auto roles = roleNames();
- for (auto it = roles.begin(); it != roles.end(); it++) {
- if (QString(it.value()) == roleString) {
- return data(modelIndex, it.key());
- }
- }
-
- return {};
-}
-
-QHash ApiServicesModel::roleNames() const
-{
- QHash roles;
- roles[NameRole] = "name";
- roles[CardDescriptionRole] = "cardDescription";
- roles[ServiceDescriptionRole] = "serviceDescription";
- roles[IsServiceAvailableRole] = "isServiceAvailable";
- roles[SpeedRole] = "speed";
- roles[TimeLimitRole] = "timeLimit";
- roles[RegionRole] = "region";
- roles[FeaturesRole] = "features";
- roles[PriceRole] = "price";
- roles[EndDateRole] = "endDate";
-
- return roles;
-}
-
-ApiServicesModel::ApiServicesData ApiServicesModel::getApiServicesData(const QJsonObject &data)
-{
- auto serviceInfo = data.value(configKey::serviceInfo).toObject();
- auto serviceType = data.value(configKey::serviceType).toString();
- auto serviceProtocol = data.value(configKey::serviceProtocol).toString();
- auto availableCountries = data.value(configKey::availableCountries).toArray();
-
- auto subscriptionObject = data.value(configKey::subscription).toObject();
-
- ApiServicesData serviceData;
- serviceData.serviceInfo.name = serviceInfo.value(configKey::name).toString();
- serviceData.serviceInfo.price = serviceInfo.value(configKey::price).toString();
- serviceData.serviceInfo.region = serviceInfo.value(configKey::region).toString();
- serviceData.serviceInfo.speed = serviceInfo.value(configKey::speed).toString();
- serviceData.serviceInfo.timeLimit = serviceInfo.value(configKey::timelimit).toString();
-
- serviceData.type = serviceType;
- serviceData.protocol = serviceProtocol;
-
- serviceData.storeEndpoint = data.value(configKey::storeEndpoint).toString();
-
- if (data.value(configKey::isAvailable).isBool()) {
- serviceData.isServiceAvailable = data.value(configKey::isAvailable).toBool();
- } else {
- serviceData.isServiceAvailable = true;
- }
-
- serviceData.serviceInfo.object = serviceInfo;
- serviceData.availableCountries = availableCountries;
-
- serviceData.subscription.endDate = subscriptionObject.value(configKey::endDate).toString();
-
- return serviceData;
-}
diff --git a/client/ui/models/api/apiServicesModel.h b/client/ui/models/api/apiServicesModel.h
deleted file mode 100644
index c96a49ab..00000000
--- a/client/ui/models/api/apiServicesModel.h
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef APISERVICESMODEL_H
-#define APISERVICESMODEL_H
-
-#include
-#include
-#include
-
-class ApiServicesModel : public QAbstractListModel
-{
- Q_OBJECT
-
-public:
- enum Roles {
- NameRole = Qt::UserRole + 1,
- CardDescriptionRole,
- ServiceDescriptionRole,
- IsServiceAvailableRole,
- SpeedRole,
- TimeLimitRole,
- RegionRole,
- FeaturesRole,
- PriceRole,
- EndDateRole
- };
-
- explicit ApiServicesModel(QObject *parent = nullptr);
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const override;
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
-
-public slots:
- void updateModel(const QJsonObject &data);
-
- void setServiceIndex(const int index);
-
- QJsonObject getSelectedServiceInfo();
- QString getSelectedServiceType();
- QString getSelectedServiceProtocol();
- QString getSelectedServiceName();
- QJsonArray getSelectedServiceCountries();
-
- QString getCountryCode();
-
- QString getStoreEndpoint();
-
- QVariant getSelectedServiceData(const QString roleString);
-
-protected:
- QHash roleNames() const override;
-
-private:
- struct ServiceInfo
- {
- QString name;
- QString speed;
- QString timeLimit;
- QString region;
- QString price;
-
- QJsonObject object;
- };
-
- struct Subscription
- {
- QString endDate;
- };
-
- struct ApiServicesData
- {
- bool isServiceAvailable;
-
- QString type;
- QString protocol;
- QString storeEndpoint;
-
- ServiceInfo serviceInfo;
- Subscription subscription;
-
- QJsonArray availableCountries;
- };
-
- ApiServicesData getApiServicesData(const QJsonObject &data);
-
- QString m_countryCode;
- QVector m_services;
-
- int m_selectedServiceIndex;
-};
-
-#endif // APISERVICESMODEL_H
diff --git a/client/ui/qml/Components/RenameServerDrawer.qml b/client/ui/qml/Components/RenameServerDrawer.qml
deleted file mode 100644
index d65b9bba..00000000
--- a/client/ui/qml/Components/RenameServerDrawer.qml
+++ /dev/null
@@ -1,55 +0,0 @@
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-
-import Style 1.0
-
-import "../Controls2"
-import "../Controls2/TextTypes"
-
-import "../Config"
-
-DrawerType2 {
- property string serverNameText
-
- id: root
- objectName: "serverNameEditDrawer"
-
- expandedStateContent: ColumnLayout {
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.topMargin: 32
- anchors.leftMargin: 16
- anchors.rightMargin: 16
-
- TextFieldWithHeaderType {
- id: serverName
-
- Layout.fillWidth: true
- headerText: qsTr("Server name")
- textField.text: root.serverNameText
- textField.maximumLength: 30
- checkEmptyText: true
- }
-
- BasicButtonType {
- id: saveButton
-
- Layout.fillWidth: true
-
- text: qsTr("Save")
-
- clickedFunc: function() {
- if (serverName.textField.text === "") {
- return
- }
-
- if (serverName.textField.text !== root.serverNameText) {
- ServersModel.setProcessedServerData("name", serverName.textField.text);
- }
- root.closeTriggered()
- }
- }
- }
-}
diff --git a/client/ui/qml/Controls2/ListViewType.qml b/client/ui/qml/Controls2/ListViewType.qml
deleted file mode 100644
index 0de43d77..00000000
--- a/client/ui/qml/Controls2/ListViewType.qml
+++ /dev/null
@@ -1,38 +0,0 @@
-import QtQuick
-import QtQuick.Controls
-
-ListView {
- id: root
-
- property bool isFocusable: true
-
- Keys.onTabPressed: {
- FocusController.nextKeyTabItem()
- }
-
- Keys.onBacktabPressed: {
- FocusController.previousKeyTabItem()
- }
-
- Keys.onUpPressed: {
- FocusController.nextKeyUpItem()
- }
-
- Keys.onDownPressed: {
- FocusController.nextKeyDownItem()
- }
-
- Keys.onLeftPressed: {
- FocusController.nextKeyLeftItem()
- }
-
- Keys.onRightPressed: {
- FocusController.nextKeyRightItem()
- }
-
- ScrollBar.vertical: ScrollBarType {}
-
- clip: true
- reuseItems: true
- snapMode: ListView.SnapToItem
-}
diff --git a/client/ui/qml/Pages2/PageSettingsApiAvailableCountries.qml b/client/ui/qml/Pages2/PageSettingsApiAvailableCountries.qml
deleted file mode 100644
index 43fbb160..00000000
--- a/client/ui/qml/Pages2/PageSettingsApiAvailableCountries.qml
+++ /dev/null
@@ -1,171 +0,0 @@
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtQuick.Dialogs
-
-import SortFilterProxyModel 0.2
-
-import PageEnum 1.0
-import Style 1.0
-
-import "./"
-import "../Controls2"
-import "../Controls2/TextTypes"
-import "../Config"
-import "../Components"
-
-PageType {
- id: root
-
- property var processedServer
-
- Connections {
- target: ServersModel
-
- function onProcessedServerChanged() {
- root.processedServer = proxyServersModel.get(0)
- }
- }
-
- SortFilterProxyModel {
- id: proxyServersModel
- objectName: "proxyServersModel"
-
- sourceModel: ServersModel
- filters: [
- ValueFilter {
- roleName: "isCurrentlyProcessed"
- value: true
- }
- ]
-
- Component.onCompleted: {
- root.processedServer = proxyServersModel.get(0)
- }
- }
-
- ListViewType {
- id: menuContent
-
- anchors.fill: parent
-
- model: ApiCountryModel
-
- currentIndex: 0
-
- ButtonGroup {
- id: containersRadioButtonGroup
- }
-
- header: ColumnLayout {
- width: menuContent.width
-
- spacing: 4
-
- BackButtonType {
- id: backButton
- objectName: "backButton"
-
- Layout.topMargin: 20
- }
-
- HeaderType {
- id: headerContent
- objectName: "headerContent"
-
- Layout.fillWidth: true
- Layout.leftMargin: 16
- Layout.rightMargin: 16
- Layout.bottomMargin: 10
-
- actionButtonImage: "qrc:/images/controls/settings.svg"
-
- headerText: root.processedServer.name
- descriptionText: qsTr("Locations for connection")
-
- actionButtonFunction: function() {
- PageController.showBusyIndicator(true)
- let result = ApiSettingsController.getAccountInfo(false)
- PageController.showBusyIndicator(false)
- if (!result) {
- return
- }
-
- PageController.goToPage(PageEnum.PageSettingsApiServerInfo)
- }
- }
- }
-
- delegate: ColumnLayout {
- id: content
-
- width: menuContent.width
- height: content.implicitHeight
-
- RowLayout {
- VerticalRadioButton {
- id: containerRadioButton
-
- Layout.fillWidth: true
- Layout.leftMargin: 16
-
- text: countryName
-
- ButtonGroup.group: containersRadioButtonGroup
-
- imageSource: "qrc:/images/controls/download.svg"
-
- checked: index === ApiCountryModel.currentIndex
- checkable: !ConnectionController.isConnected
-
- onClicked: {
- if (ConnectionController.isConnected) {
- PageController.showNotificationMessage(qsTr("Unable change server location while there is an active connection"))
- return
- }
-
- if (index !== ApiCountryModel.currentIndex) {
- PageController.showBusyIndicator(true)
- var prevIndex = ApiCountryModel.currentIndex
- ApiCountryModel.currentIndex = index
- if (!ApiConfigsController.updateServiceFromGateway(ServersModel.defaultIndex, countryCode, countryName)) {
- ApiCountryModel.currentIndex = prevIndex
- }
- PageController.showBusyIndicator(false)
- }
- }
-
- MouseArea {
- anchors.fill: containerRadioButton
- cursorShape: Qt.PointingHandCursor
- enabled: false
- }
-
- Keys.onEnterPressed: {
- if (checkable) {
- checked = true
- }
- containerRadioButton.clicked()
- }
- Keys.onReturnPressed: {
- if (checkable) {
- checked = true
- }
- containerRadioButton.clicked()
- }
- }
-
- Image {
- Layout.rightMargin: 32
- Layout.alignment: Qt.AlignRight
-
- source: "qrc:/countriesFlags/images/flagKit/" + countryImageCode + ".svg"
- }
- }
-
- DividerType {
- Layout.fillWidth: true
- }
- }
- }
-}
diff --git a/client/ui/qml/Pages2/PageSettingsApiDevices.qml b/client/ui/qml/Pages2/PageSettingsApiDevices.qml
deleted file mode 100644
index 5cc21d07..00000000
--- a/client/ui/qml/Pages2/PageSettingsApiDevices.qml
+++ /dev/null
@@ -1,100 +0,0 @@
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtQuick.Dialogs
-
-import QtCore
-
-import SortFilterProxyModel 0.2
-
-import PageEnum 1.0
-import Style 1.0
-
-import "./"
-import "../Controls2"
-import "../Controls2/TextTypes"
-import "../Config"
-import "../Components"
-
-PageType {
- id: root
-
- ListViewType {
- id: listView
-
- anchors.fill: parent
- anchors.topMargin: 20
- anchors.bottomMargin: 24
-
- model: ApiDevicesModel
-
- header: ColumnLayout {
- width: listView.width
-
- BackButtonType {
- id: backButton
- }
-
- HeaderType {
- id: header
-
- Layout.fillWidth: true
- Layout.rightMargin: 16
- Layout.leftMargin: 16
-
- headerText: qsTr("Connected devices")
- descriptionText: qsTr("To manage connected devices")
- }
-
- WarningType {
- Layout.topMargin: 16
- Layout.rightMargin: 16
- Layout.leftMargin: 16
- Layout.fillWidth: true
-
- textString: qsTr("You can find the identifier on the Support tab or, for older versions of the app, "
- + "by tapping '+' and then the three dots at the top of the page.")
-
- iconPath: "qrc:/images/controls/alert-circle.svg"
- }
- }
-
- delegate: ColumnLayout {
- width: listView.width
-
- LabelWithButtonType {
- Layout.fillWidth: true
- Layout.topMargin: 6
-
- text: osVersion + (isCurrentDevice ? qsTr(" (current device)") : "")
- descriptionText: qsTr("Support tag: ") + "\n" + supportTag + "\n" + qsTr("Last updated: ") + lastUpdate
- rightImageSource: "qrc:/images/controls/trash.svg"
-
- clickedFunction: function() {
- var headerText = qsTr("Deactivate the subscription on selected device")
- var descriptionText = qsTr("The next time the “Connect” button is pressed, the device will be activated again")
- var yesButtonText = qsTr("Continue")
- var noButtonText = qsTr("Cancel")
-
- var yesButtonFunction = function() {
- Qt.callLater(deactivateExternalDevice, supportTag, countryCode)
- }
- var noButtonFunction = function() {
- }
-
- showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
- }
- }
-
- DividerType {}
- }
- }
-
- function deactivateExternalDevice(supportTag, countryCode) {
- PageController.showBusyIndicator(true)
- if (ApiConfigsController.deactivateExternalDevice(supportTag, countryCode)) {
- ApiSettingsController.getAccountInfo(true)
- }
- PageController.showBusyIndicator(false)
- }
-}
diff --git a/client/ui/qml/Pages2/PageSettingsApiInstructions.qml b/client/ui/qml/Pages2/PageSettingsApiInstructions.qml
deleted file mode 100644
index 3651407b..00000000
--- a/client/ui/qml/Pages2/PageSettingsApiInstructions.qml
+++ /dev/null
@@ -1,124 +0,0 @@
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-
-import SortFilterProxyModel 0.2
-
-import PageEnum 1.0
-import Style 1.0
-
-import "./"
-import "../Controls2"
-import "../Controls2/TextTypes"
-import "../Config"
-import "../Components"
-
-PageType {
- id: root
-
- QtObject {
- id: windows
-
- readonly property string title: qsTr("Windows")
- readonly property string link: qsTr("https://docs.amnezia.org/documentation/instructions/connect-amnezia-premium#windows")
- }
-
- QtObject {
- id: macos
-
- readonly property string title: qsTr("macOS")
- readonly property string link: qsTr("https://docs.amnezia.org/documentation/instructions/connect-amnezia-premium#macos")
- }
-
- QtObject {
- id: android
-
- readonly property string title: qsTr("Android")
- readonly property string link: qsTr("https://docs.amnezia.org/documentation/instructions/connect-amnezia-premium#android")
- }
-
- QtObject {
- id: androidTv
-
- readonly property string title: qsTr("AndroidTV")
- readonly property string link: qsTr("https://docs.amnezia.org/ru/documentation/instructions/android_tv_connect/")
- }
-
- QtObject {
- id: ios
-
- readonly property string title: qsTr("iOS")
- readonly property string link: qsTr("https://docs.amnezia.org/documentation/instructions/connect-amnezia-premium#ios")
- }
-
- QtObject {
- id: linux
-
- readonly property string title: qsTr("Linux")
- readonly property string link: qsTr("https://docs.amnezia.org/documentation/instructions/connect-amnezia-premium#linux")
- }
-
- QtObject {
- id: routers
-
- readonly property string title: qsTr("Routers")
- readonly property string link: qsTr("https://docs.amnezia.org/documentation/instructions/connect-amnezia-premium#routers")
- }
-
- property list instructionsModel: [
- windows,
- macos,
- android,
- androidTv,
- ios,
- linux,
- routers
- ]
-
- ListViewType {
- id: listView
-
- anchors.fill: parent
- anchors.topMargin: 20
- anchors.bottomMargin: 24
-
- model: instructionsModel
-
- header: ColumnLayout {
- width: listView.width
-
- BackButtonType {
- id: backButton
- }
-
- HeaderType {
- id: header
-
- Layout.fillWidth: true
- Layout.rightMargin: 16
- Layout.leftMargin: 16
-
- headerText: qsTr("How to connect on another device")
- descriptionText: qsTr("Instructions on the Amnezia website")
- }
- }
-
- delegate: ColumnLayout {
- width: listView.width
-
- LabelWithButtonType {
- Layout.fillWidth: true
- Layout.topMargin: 6
-
- text: title
- rightImageSource: "qrc:/images/controls/external-link.svg"
-
- clickedFunction: function() {
- Qt.openUrlExternally(link)
- }
- }
-
- DividerType {}
- }
- }
-}
diff --git a/client/ui/qml/Pages2/PageSettingsApiNativeConfigs.qml b/client/ui/qml/Pages2/PageSettingsApiNativeConfigs.qml
deleted file mode 100644
index a1cc1fb8..00000000
--- a/client/ui/qml/Pages2/PageSettingsApiNativeConfigs.qml
+++ /dev/null
@@ -1,214 +0,0 @@
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-import QtQuick.Dialogs
-
-import QtCore
-
-import SortFilterProxyModel 0.2
-
-import PageEnum 1.0
-import Style 1.0
-
-import "./"
-import "../Controls2"
-import "../Controls2/TextTypes"
-import "../Config"
-import "../Components"
-
-PageType {
- id: root
-
- property string configExtension: ".conf"
- property string configCaption: qsTr("Save AmneziaVPN config")
-
- ListViewType {
- id: listView
-
- anchors.fill: parent
- anchors.topMargin: 20
- anchors.bottomMargin: 24
-
- model: ApiCountryModel
-
- header: ColumnLayout {
- width: listView.width
-
- BackButtonType {
- id: backButton
- }
-
- HeaderType {
- id: header
-
- Layout.fillWidth: true
- Layout.rightMargin: 16
- Layout.leftMargin: 16
-
- headerText: qsTr("Configuration files")
- descriptionText: qsTr("To connect a router or AmneziaWG application")
- }
- }
-
- delegate: ColumnLayout {
- width: listView.width
-
- LabelWithButtonType {
- Layout.fillWidth: true
- Layout.topMargin: 6
-
- text: countryName
- descriptionText: isWorkerExpired ? qsTr("The configuration needs to be reissued") : ""
- descriptionColor: AmneziaStyle.color.vibrantRed
-
- leftImageSource: "qrc:/countriesFlags/images/flagKit/" + countryImageCode + ".svg"
- rightImageSource: isIssued ? "qrc:/images/controls/more-vertical.svg" : "qrc:/images/controls/download.svg"
-
- clickedFunction: function() {
- if (isIssued) {
- moreOptionsDrawer.countryName = countryName
- moreOptionsDrawer.countryCode = countryCode
- moreOptionsDrawer.openTriggered()
- } else {
- issueConfig(countryCode)
- }
- }
- }
-
- DividerType {}
- }
- }
-
- DrawerType2 {
- id: moreOptionsDrawer
-
- property string countryName
- property string countryCode
-
- anchors.fill: parent
- expandedHeight: parent.height * 0.4375
-
- expandedStateContent: Item {
- implicitHeight: moreOptionsDrawer.expandedHeight
-
- BackButtonType {
- id: moreOptionsDrawerBackButton
-
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.topMargin: 16
-
- backButtonFunction: function() {
- moreOptionsDrawer.closeTriggered()
- }
- }
-
- FlickableType {
- anchors.top: moreOptionsDrawerBackButton.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.bottom: parent.bottom
-
- contentHeight: moreOptionsDrawerContent.height
-
- ColumnLayout {
- id: moreOptionsDrawerContent
-
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
-
- Header2Type {
- Layout.fillWidth: true
- Layout.margins: 16
-
- headerText: qsTr("Configuration file ") + moreOptionsDrawer.countryName
- }
-
- LabelWithButtonType {
- Layout.fillWidth: true
-
- text: qsTr("Create a new")
- descriptionText: qsTr("The previously created one will stop working")
-
- clickedFunction: function() {
- showQuestion(true, moreOptionsDrawer.countryCode, moreOptionsDrawer.countryName)
- }
- }
-
- DividerType {}
-
- LabelWithButtonType {
- Layout.fillWidth: true
- text: qsTr("Revoke the current configuration file")
-
- clickedFunction: function() {
- showQuestion(false, moreOptionsDrawer.countryCode, moreOptionsDrawer.countryName)
- }
- }
-
- DividerType {}
- }
- }
- }
- }
-
- function issueConfig(countryCode) {
- var fileName = ""
- if (GC.isMobile()) {
- fileName = countryCode + configExtension
- } else {
- fileName = SystemController.getFileName(configCaption,
- qsTr("Config files (*" + configExtension + ")"),
- StandardPaths.standardLocations(StandardPaths.DocumentsLocation) + "/" + countryCode,
- true,
- configExtension)
- }
- if (fileName !== "") {
- PageController.showBusyIndicator(true)
- let result = ApiConfigsController.exportNativeConfig(countryCode, fileName)
- if (result) {
- ApiSettingsController.getAccountInfo(true)
- }
-
- PageController.showBusyIndicator(false)
- if (result) {
- PageController.showNotificationMessage(qsTr("Config file saved"))
- }
- }
- }
-
- function revokeConfig(countryCode) {
- PageController.showBusyIndicator(true)
- let result = ApiConfigsController.revokeNativeConfig(countryCode)
- if (result) {
- ApiSettingsController.getAccountInfo(true)
- }
- PageController.showBusyIndicator(false)
-
- if (result) {
- PageController.showNotificationMessage(qsTr("The config has been revoked"))
- }
- }
-
- function showQuestion(isConfigIssue, countryCode, countryName) {
- var headerText = qsTr("Revoke the actual %1 configuration file?").arg(countryName)
- var descriptionText = qsTr("The previously created file will no longer be valid. It will not be possible to connect using it.")
- var yesButtonText = qsTr("Continue")
- var noButtonText = qsTr("Cancel")
-
- var yesButtonFunction = function() {
- if (isConfigIssue) {
- issueConfig(countryCode)
- } else {
- revokeConfig(countryCode)
- }
- moreOptionsDrawer.closeTriggered()
- }
- var noButtonFunction = function() {
- }
-
- showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
- }
-}
diff --git a/client/ui/qml/Pages2/PageSettingsApiSupport.qml b/client/ui/qml/Pages2/PageSettingsApiSupport.qml
deleted file mode 100644
index 424e10c5..00000000
--- a/client/ui/qml/Pages2/PageSettingsApiSupport.qml
+++ /dev/null
@@ -1,127 +0,0 @@
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Layouts
-
-import SortFilterProxyModel 0.2
-
-import PageEnum 1.0
-import Style 1.0
-
-import "./"
-import "../Controls2"
-import "../Controls2/TextTypes"
-import "../Config"
-import "../Components"
-
-PageType {
- id: root
-
- QtObject {
- id: telegram
-
- readonly property string title: qsTr("Telegram")
- readonly property string description: "@" + ApiAccountInfoModel.getTelegramBotLink()
- readonly property string link: "https://t.me/" + ApiAccountInfoModel.getTelegramBotLink()
- }
-
- QtObject {
- id: techSupport
-
- readonly property string title: qsTr("For technical support")
- readonly property string description: qsTr("support@amnezia.org")
- readonly property string link: "mailto:support@amnezia.org"
- }
-
- QtObject {
- id: paymentSupport
-
- readonly property string title: qsTr("For payment issues")
- readonly property string description: qsTr("help@vpnpay.io")
- readonly property string link: "mailto:help@vpnpay.io"
- }
-
- QtObject {
- id: site
-
- readonly property string title: qsTr("Site")
- readonly property string description: qsTr("amnezia.org")
- readonly property string link: LanguageModel.getCurrentSiteUrl()
- }
-
- property list supportModel: [
- telegram,
- techSupport,
- paymentSupport,
- site
- ]
-
- ListViewType {
- id: listView
-
- anchors.fill: parent
- anchors.topMargin: 20
- anchors.bottomMargin: 24
-
- model: supportModel
-
- header: ColumnLayout {
- width: listView.width
-
- BackButtonType {
- id: backButton
- }
-
- HeaderType {
- id: header
-
- Layout.fillWidth: true
- Layout.rightMargin: 16
- Layout.leftMargin: 16
-
- headerText: qsTr("Support")
- descriptionText: qsTr("Our technical support specialists are ready to help you at any time")
- }
- }
-
- delegate: ColumnLayout {
- width: listView.width
-
- LabelWithButtonType {
- Layout.fillWidth: true
- text: title
- descriptionText: description
- rightImageSource: "qrc:/images/controls/external-link.svg"
- clickedFunction: function() {
- Qt.openUrlExternally(link)
- }
- }
- DividerType {}
- }
-
-
- footer: ColumnLayout {
- width: listView.width
-
- LabelWithButtonType {
- id: supportUuid
- Layout.fillWidth: true
-
- text: qsTr("Support tag")
- descriptionText: SettingsController.getInstallationUuid()
-
- descriptionOnTop: true
-
- rightImageSource: "qrc:/images/controls/copy.svg"
- rightImageColor: AmneziaStyle.color.paleGray
-
- clickedFunction: function() {
- GC.copyToClipBoard(descriptionText)
- PageController.showNotificationMessage(qsTr("Copied"))
- if (!GC.isMobile()) {
- this.rightButton.forceActiveFocus()
- }
- }
- }
- }
- }
-}