diff options
| author | Jaquee <jaquee.monero@gmail.com> | 2017-05-03 14:37:33 +0200 |
|---|---|---|
| committer | Jaquee <jaquee.monero@gmail.com> | 2017-05-03 14:37:33 +0200 |
| commit | 98b040670c0edc5f1cf97ce9493524cd5408ee9d (patch) | |
| tree | 518dcdde2e555c18949c1c53b1a68cdfadd691b6 /src/libwalletqt/WalletManager.cpp | |
| parent | 4ca35af11ac8b41192bdb373216513e524ee4cb0 (diff) | |
| download | monzero-gui-98b040670c0edc5f1cf97ce9493524cd5408ee9d.tar.gz monzero-gui-98b040670c0edc5f1cf97ce9493524cd5408ee9d.tar.xz monzero-gui-98b040670c0edc5f1cf97ce9493524cd5408ee9d.zip | |
Settings: Rescan wallet cache button
Diffstat (limited to 'src/libwalletqt/WalletManager.cpp')
| -rw-r--r-- | src/libwalletqt/WalletManager.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libwalletqt/WalletManager.cpp b/src/libwalletqt/WalletManager.cpp index ad77ad48..300b3699 100644 --- a/src/libwalletqt/WalletManager.cpp +++ b/src/libwalletqt/WalletManager.cpp @@ -11,6 +11,7 @@ #include <QtConcurrent/QtConcurrent> #include <QMutex> #include <QMutexLocker> +#include <QString> WalletManager * WalletManager::m_instance = nullptr; @@ -338,6 +339,24 @@ QString WalletManager::checkUpdates(const QString &software, const QString &subd return QString::fromStdString(std::get<1>(result) + "|" + std::get<2>(result) + "|" + std::get<3>(result) + "|" + std::get<4>(result)); } +bool WalletManager::clearWalletCache(const QString &wallet_path) const +{ + + QString fileName = wallet_path; + // Make sure wallet file is not .keys + fileName.replace(".keys",""); + QFile walletCache(fileName); + QString suffix = ".old_cache"; + QString newFileName = fileName + suffix; + + // create unique file name + for (int i = 1; QFile::exists(newFileName); i++) { + newFileName = QString("%1%2.%3").arg(fileName).arg(suffix).arg(i); + } + + return walletCache.rename(newFileName); +} + WalletManager::WalletManager(QObject *parent) : QObject(parent) { m_pimpl = Monero::WalletManagerFactory::getWalletManager(); |
