mirror of
https://github.com/monero-project/monero-gui.git
synced 2026-04-07 02:17:24 -04:00
Settings: Rescan wallet cache button
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user