Fix question when removing server from list

This commit is contained in:
pokamest 2023-05-24 12:18:40 +01:00
parent f0ad76fff6
commit 17fb2a98d6
4 changed files with 13 additions and 3 deletions

View file

@ -100,6 +100,11 @@ void ServerSettingsLogic::onLineEditDescriptionEditingFinished()
uiLogic()->onUpdateAllPages();
}
bool ServerSettingsLogic::isCurrentServerHasCredentials()
{
return m_settings->haveAuthData(uiLogic()->m_selectedServerIndex);
}
#if defined(Q_OS_ANDROID)
/* Auth result handler for Android */
void authResultReceiver::handleActivityResult(int receiverRequestCode, int resultCode, const QJniObject &data)

View file

@ -31,6 +31,8 @@ public:
Q_INVOKABLE void onPushButtonClearClientCacheClicked();
Q_INVOKABLE void onLineEditDescriptionEditingFinished();
Q_INVOKABLE bool isCurrentServerHasCredentials();
public:
explicit ServerSettingsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~ServerSettingsLogic() = default;

View file

@ -110,13 +110,18 @@ PageBase {
Layout.topMargin: 10
text: qsTr("Forget this server")
onClicked: {
if (ServerSettingsLogic.isCurrentServerHasCredentials()) {
popupForgetServer.questionText = "Attention! This action will not remove any data from the server, it will just remove server from the list. Continue?"
}
else {
popupForgetServer.questionText = "Remove server from the list?"
}
popupForgetServer.open()
}
}
PopupWithQuestion {
id: popupForgetServer
questionText: "Attention! This action will not remove the container on the server, it will only remove the container information from the application. Continue?"
yesFunc: function() {
ServerSettingsLogic.onPushButtonForgetServer()
close()