mirror of
https://github.com/outbackdingo/amnezia-client.git
synced 2026-01-27 02:18:09 +00:00
* feat: added 'clear site list' button (#1747) * chore: rename 'Export/Import Sites' to 'Additional options' --------- Co-authored-by: MrMirDan <58086007+MrMirDan@users.noreply.github.com>
This commit is contained in:
@@ -78,6 +78,13 @@ void SitesController::removeSite(int index)
|
||||
emit finished(tr("Site removed: %1").arg(hostname));
|
||||
}
|
||||
|
||||
void SitesController::removeSites()
|
||||
{
|
||||
m_sitesModel->removeSites();
|
||||
|
||||
emit finished(tr("Site list cleared!"));
|
||||
}
|
||||
|
||||
void SitesController::importSites(const QString &fileName, bool replaceExisting)
|
||||
{
|
||||
QByteArray jsonData;
|
||||
|
||||
@@ -19,6 +19,7 @@ public slots:
|
||||
void addSite(QString hostname);
|
||||
void removeSite(int index);
|
||||
|
||||
void removeSites();
|
||||
void importSites(const QString &fileName, bool replaceExisting);
|
||||
void exportSites(const QString &fileName);
|
||||
|
||||
|
||||
@@ -83,6 +83,16 @@ void SitesModel::removeSite(QModelIndex index)
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
void SitesModel::removeSites()
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
m_settings->removeAllVpnSites(m_currentRouteMode);
|
||||
fillSites();
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
int SitesModel::getRouteMode()
|
||||
{
|
||||
return m_currentRouteMode;
|
||||
|
||||
@@ -28,6 +28,7 @@ public slots:
|
||||
bool addSite(const QString &hostname, const QString &ip);
|
||||
void addSites(const QMap<QString, QString> &sites, bool replaceExisting);
|
||||
void removeSite(QModelIndex index);
|
||||
void removeSites();
|
||||
|
||||
int getRouteMode();
|
||||
void setRouteMode(int routeMode);
|
||||
|
||||
@@ -308,7 +308,7 @@ PageType {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: 16
|
||||
|
||||
headerText: qsTr("Import / Export Sites")
|
||||
headerText: qsTr("Additional options")
|
||||
}
|
||||
|
||||
LabelWithButtonType {
|
||||
@@ -351,6 +351,34 @@ PageType {
|
||||
}
|
||||
|
||||
DividerType {}
|
||||
|
||||
LabelWithButtonType {
|
||||
id: clearSitesButton
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTr("Clear site list")
|
||||
rightImageSource: "qrc:/images/controls/trash.svg"
|
||||
|
||||
clickedFunction: function() {
|
||||
var headerText = qsTr("Clear site list?")
|
||||
var descriptionText = qsTr("All sites will be removed from list.")
|
||||
var yesButtonText = qsTr("Continue")
|
||||
var noButtonText = qsTr("Cancel")
|
||||
|
||||
var yesButtonFunction = function() {
|
||||
PageController.showBusyIndicator(true)
|
||||
SitesController.removeSites()
|
||||
PageController.showBusyIndicator(false)
|
||||
}
|
||||
var noButtonFunction = function() {
|
||||
|
||||
}
|
||||
|
||||
showQuestionDrawer(headerText, descriptionText, yesButtonText, noButtonText, yesButtonFunction, noButtonFunction)
|
||||
}
|
||||
}
|
||||
|
||||
DividerType {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user