Skip to content

Commit

Permalink
Merge pull request #245 from amnezia-vpn/fix/ui_fixes
Browse files Browse the repository at this point in the history
Tiny ui fixes
  • Loading branch information
pokamest committed May 24, 2023
2 parents 780efc2 + 3e0085b commit adcc74a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
2 changes: 0 additions & 2 deletions client/core/sshclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ namespace libssh {
int bytesWritten = sftp_write(file, buffer, bufferSize);

std::string chunk(buffer, bufferSize);
qDebug() << "sftp write: " << QString(chunk.c_str());

if (bytesWritten != bufferSize) {
fin.close();
Expand All @@ -272,7 +271,6 @@ namespace libssh {
fin.read(buffer, lastChunkSize);

std::string chunk(buffer, lastChunkSize);
qDebug() << "sftp write: " << QString(chunk.c_str());

int bytesWritten = sftp_write(file, buffer, lastChunkSize);

Expand Down
5 changes: 5 additions & 0 deletions client/ui/pages_logic/ServerSettingsLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions client/ui/pages_logic/ServerSettingsLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class ServerSettingsLogic : public PageLogicBase
Q_INVOKABLE void onPushButtonClearClientCacheClicked();
Q_INVOKABLE void onLineEditDescriptionEditingFinished();

Q_INVOKABLE bool isCurrentServerHasCredentials();

public:
explicit ServerSettingsLogic(UiLogic *uiLogic, QObject *parent = nullptr);
~ServerSettingsLogic() = default;
Expand Down
11 changes: 8 additions & 3 deletions client/ui/qml/Controls/PopupWithQuestion.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ Popup {

anchors.centerIn: Overlay.overlay
modal: true
closePolicy: Popup.NoAutoClose
closePolicy: Popup.CloseOnEscape

width: parent.width - 20
focus: true

onAboutToHide: {
parent.forceActiveFocus(true)
}

ColumnLayout {
width: parent.width

Text {
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
Expand All @@ -28,9 +34,9 @@ Popup {
}

RowLayout {
Layout.fillWidth: true
BlueButtonType {
id: yesButton
Layout.preferredWidth: parent.width / 2
Layout.fillWidth: true
text: yesText
onClicked: {
Expand All @@ -43,7 +49,6 @@ Popup {
}
BlueButtonType {
id: noButton
Layout.preferredWidth: parent.width / 2
Layout.fillWidth: true
text: noText
onClicked: {
Expand Down
7 changes: 6 additions & 1 deletion client/ui/qml/Pages/PageServerSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit adcc74a

Please sign in to comment.