]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
portable mode: reset wallet dir on start
authortobtoht <tob@featherwallet.org>
Thu, 26 Jan 2023 15:05:54 +0000 (16:05 +0100)
committertobtoht <tob@featherwallet.org>
Thu, 26 Jan 2023 15:21:18 +0000 (16:21 +0100)
src/MainWindow.cpp
src/MainWindow.h
src/main.cpp

index c8cae11138821a1979dab5d542feb0632fc4905e..b9e316fe7d0d5aa58b5a12051dd63322c38f2ff2 100644 (file)
@@ -1601,9 +1601,14 @@ void MainWindow::donationNag() {
     config()->set(Config::donateBeg, donationCounter);
 }
 
-void MainWindow::addToRecentlyOpened(const QString &keysFile) {
+void MainWindow::addToRecentlyOpened(QString keysFile) {
     auto recent = config()->get(Config::recentlyOpenedWallets).toList();
 
+    if (Utils::isPortableMode()) {
+        QDir appPath{Utils::applicationPath()};
+        keysFile = appPath.relativeFilePath(keysFile);
+    }
+
     if (recent.contains(keysFile)) {
         recent.removeOne(keysFile);
     }
@@ -1631,7 +1636,7 @@ void MainWindow::updateRecentlyOpenedMenu() {
     const QStringList recentWallets = config()->get(Config::recentlyOpenedWallets).toStringList();
     for (const auto &walletPath : recentWallets) {
         QFileInfo fileInfo{walletPath};
-        ui->menuRecently_open->addAction(fileInfo.fileName(), m_windowManager, std::bind(&WindowManager::tryOpenWallet, m_windowManager, walletPath, ""));
+        ui->menuRecently_open->addAction(fileInfo.fileName(), m_windowManager, std::bind(&WindowManager::tryOpenWallet, m_windowManager, fileInfo.absoluteFilePath(), ""));
     }
     ui->menuRecently_open->addSeparator();
     ui->menuRecently_open->addAction(m_clearRecentlyOpenAction);
index 5525f1361e091e1b592521f89e5db1bb42100423..7b1c7dc62ee18c579d3bbb10c1624b819daa0ada 100644 (file)
@@ -214,7 +214,7 @@ private:
     QString getHardwareDevice();
     void updateTitle();
     void donationNag();
-    void addToRecentlyOpened(const QString &filename);
+    void addToRecentlyOpened(QString filename);
     void updateRecentlyOpenedMenu();
     void updateWidgetIcons();
     bool verifyPassword(bool sensitive = true);
index ab89fc7b63dda6d756d309e563bb0bed863ff8f1..367b3f53f3718e72d20abcc5c1bd217c9bbc11bd 100644 (file)
@@ -179,7 +179,7 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) {
 
     // Setup wallet directory
     QString walletDir = config()->get(Config::walletDirectory).toString();
-    if (walletDir.isEmpty()) {
+    if (walletDir.isEmpty() || Utils::isPortableMode()) {
         walletDir = Utils::defaultWalletDir();
         config()->set(Config::walletDirectory, walletDir);
     }