Skip to content

Commit

Permalink
bugfix: removed the importErrorOccurred() signal overload, since qml …
Browse files Browse the repository at this point in the history
…does not know how to handle signal overloads (#1111)
  • Loading branch information
Nethius authored Oct 13, 2024
1 parent 694e781 commit 7b838e7
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions client/core/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ namespace amnezia

// import and install errors
ImportInvalidConfigError = 900,
ImportOpenConfigError = 901,

// Android errors
AndroidError = 1000,
Expand Down
1 change: 1 addition & 0 deletions client/core/errorstrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ QString errorString(ErrorCode code) {
case (ErrorCode::AddressPoolError): errorMessage = QObject::tr("VPN pool error: no available addresses"); break;

case (ErrorCode::ImportInvalidConfigError): errorMessage = QObject::tr("The config does not contain any containers and credentials for connecting to the server"); break;
case (ErrorCode::ImportOpenConfigError): errorMessage = QObject::tr(""); break;

// Android errors
case (ErrorCode::AndroidError): errorMessage = QObject::tr("VPN connection error"); break;
Expand Down
6 changes: 3 additions & 3 deletions client/ui/controllers/importController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ bool ImportController::extractConfigFromFile(const QString &fileName)
return extractConfigFromData(data);
}

emit importErrorOccurred(tr("Unable to open file"), false);
emit importErrorOccurred(ErrorCode::ImportOpenConfigError, false);
return false;
}

Expand Down Expand Up @@ -188,12 +188,12 @@ bool ImportController::extractConfigFromData(QString data)
if (!m_serversModel->getServersCount()) {
emit restoreAppConfig(config.toUtf8());
} else {
emit importErrorOccurred(tr("Invalid configuration file"), false);
emit importErrorOccurred(ErrorCode::ImportInvalidConfigError, false);
}
break;
}
case ConfigTypes::Invalid: {
emit importErrorOccurred(tr("Invalid configuration file"), false);
emit importErrorOccurred(ErrorCode::ImportInvalidConfigError, false);
break;
}
}
Expand Down
1 change: 0 additions & 1 deletion client/ui/controllers/importController.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public slots:

signals:
void importFinished();
void importErrorOccurred(const QString &errorMessage, bool goToPageHome);
void importErrorOccurred(ErrorCode errorCode, bool goToPageHome);

void qrDecodingFinished();
Expand Down
2 changes: 1 addition & 1 deletion client/ui/controllers/installController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ bool InstallController::checkSshConnection(QSharedPointer<ServerController> serv
} else {
if (output.contains(tr("Please login as the user"))) {
output.replace("\n", "");
emit installationErrorOccurred(output);
emit wrongInstallationUser(output);
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/ui/controllers/installController.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public slots:
void removeAllContainersFinished(const QString &finishedMessage);
void removeProcessedContainerFinished(const QString &finishedMessage);

void installationErrorOccurred(const QString &errorMessage);
void installationErrorOccurred(ErrorCode errorCode);
void wrongInstallationUser(const QString &message);

void serverAlreadyExists(int serverIndex);

Expand Down
2 changes: 1 addition & 1 deletion client/ui/qml/Pages2/PageSetupWizardViewConfig.qml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ PageType {
Connections {
target: ImportController

function onImportErrorOccurred(errorMessage, goToPageHome) {
function onImportErrorOccurred(error, goToPageHome) {
if (goToPageHome) {
PageController.goToStartPage()
} else {
Expand Down
4 changes: 4 additions & 0 deletions client/ui/qml/Pages2/PageStart.qml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ PageType {
}
}

function onWrongInstallationUser(message) {
onInstallationErrorOccurred(message)
}

function onUpdateContainerFinished(message) {
PageController.showNotificationMessage(message)
PageController.closePage()
Expand Down

0 comments on commit 7b838e7

Please sign in to comment.