wizard: fix reopening testnet and stagenet wallets

This commit is contained in:
selsta committed 2026-10-07 18:30:37 +02:00
1 parent 390e744af5
commit f80283ce7a
4 files changed
+10 -9

No files matched your search

+3 -2
View File
@@ -304,13 +304,14 @@ std::pair<quint8, QString> OSHelper::getNetworkTypeAndAddressFromFile(const QStr
return std::make_pair(networkType, address);
}
quint8 OSHelper::getNetworkTypeFromFile(const QString &keysPath) const
quint8 OSHelper::getNetworkTypeFromFile(const QString &keysPath, quint8 fallbackNetworkType) const
{
QString walletPath = keysPath;
if(keysPath.endsWith(".keys")){
walletPath = keysPath.mid(0,keysPath.length()-5);
}
return getNetworkTypeAndAddressFromFile(walletPath).first;
const auto networkTypeAndAddress = getNetworkTypeAndAddressFromFile(walletPath);
return networkTypeAndAddress.second.isEmpty() ? fallbackNetworkType : networkTypeAndAddress.first;
}
void OSHelper::openSeedTemplate() const
+1 -1
View File
@@ -53,7 +53,7 @@ public:
Q_INVOKABLE bool isWritableDirectory(const QString &path) const;
Q_INVOKABLE QString randomPassword(int numBytes = 32) const;
Q_INVOKABLE bool isCapsLock() const;
Q_INVOKABLE quint8 getNetworkTypeFromFile(const QString &keysPath) const;
Q_INVOKABLE quint8 getNetworkTypeFromFile(const QString &keysPath, quint8 fallbackNetworkType) const;
Q_INVOKABLE void openSeedTemplate() const;
bool installed() const;
+2 -1
View File
@@ -328,7 +328,6 @@ Rectangle {
onAccepted: {
var keysPath = walletManager.urlToLocalPath(fileDialog.selectedFile)
persistentSettings.nettype = oshelper.getNetworkTypeFromFile(keysPath);
wizardController.openWalletFile(keysPath);
}
onRejected: {
@@ -544,6 +543,8 @@ Rectangle {
else
persistentSettings.wallet_path = fn;
persistentSettings.nettype = oshelper.getNetworkTypeFromFile(persistentSettings.wallet_path, persistentSettings.nettype);
if(isIOS)
persistentSettings.wallet_path = persistentSettings.wallet_path.replace(appWindow.accountsDir, "");
+4 -5
View File
@@ -148,8 +148,7 @@ Rectangle {
}
}
function openSelectedWalletFile(networktype, path) {
persistentSettings.nettype = parseInt(networktype);
function openSelectedWalletFile(path) {
wizardController.openWalletFile(path);
}
@@ -186,8 +185,8 @@ Rectangle {
Keys.onBacktabPressed: recentList.moveUp(index);
Keys.onDownPressed: recentList.moveDown(index);
Keys.onTabPressed: recentList.moveDown(index);
Keys.onEnterPressed: recentList.openSelectedWalletFile(networktype, path);
Keys.onReturnPressed: recentList.openSelectedWalletFile(networktype, path);
Keys.onEnterPressed: recentList.openSelectedWalletFile(path);
Keys.onReturnPressed: recentList.openSelectedWalletFile(path);
Rectangle {
height: 1
@@ -317,7 +316,7 @@ Rectangle {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: recentList.openSelectedWalletFile(networktype, path);
onClicked: recentList.openSelectedWalletFile(path);
}
}
}