mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 16:28:14 +00:00
KeysFiles: don't use WalletManager in findWallets
This commit is contained in:
parent
38c3534ead
commit
dec5dcf25c
3 changed files with 14 additions and 9 deletions
|
@ -474,7 +474,7 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
|||
#endif
|
||||
|
||||
// Wallet .keys files model (wizard -> open wallet)
|
||||
WalletKeysFilesModel walletKeysFilesModel(walletManager);
|
||||
WalletKeysFilesModel walletKeysFilesModel;
|
||||
engine.rootContext()->setContextProperty("walletKeysFilesModel", &walletKeysFilesModel);
|
||||
engine.rootContext()->setContextProperty("walletKeysFilesModelProxy", &walletKeysFilesModel.proxyModel());
|
||||
|
||||
|
|
|
@ -78,10 +78,9 @@ quint8 WalletKeysFiles::networkType() const
|
|||
}
|
||||
|
||||
|
||||
WalletKeysFilesModel::WalletKeysFilesModel(WalletManager *walletManager, QObject *parent)
|
||||
WalletKeysFilesModel::WalletKeysFilesModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
this->m_walletManager = walletManager;
|
||||
this->m_walletKeysFilesItemModel = qobject_cast<QAbstractItemModel *>(this);
|
||||
|
||||
this->m_walletKeysFilesModelProxy.setSourceModel(this->m_walletKeysFilesItemModel);
|
||||
|
@ -110,11 +109,18 @@ void WalletKeysFilesModel::refresh(const QString &moneroAccountsDir)
|
|||
|
||||
void WalletKeysFilesModel::findWallets(const QString &moneroAccountsDir)
|
||||
{
|
||||
QStringList walletDir = this->m_walletManager->findWallets(moneroAccountsDir);
|
||||
foreach(QString wallet, walletDir){
|
||||
if(!fileExists(wallet + ".keys"))
|
||||
continue;
|
||||
QDirIterator it(moneroAccountsDir, QDirIterator::Subdirectories);
|
||||
for (; it.hasNext(); it.next())
|
||||
{
|
||||
QFileInfo keysFileinfo = it.fileInfo();
|
||||
|
||||
constexpr const char keysFileExtension[] = "keys";
|
||||
if (!keysFileinfo.isFile() || keysFileinfo.completeSuffix() != keysFileExtension)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString wallet(keysFileinfo.absolutePath() + QDir::separator() + keysFileinfo.baseName());
|
||||
quint8 networkType = NetworkType::MAINNET;
|
||||
QString address = QString("");
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
AddressRole
|
||||
};
|
||||
|
||||
WalletKeysFilesModel(WalletManager *walletManager, QObject *parent = 0);
|
||||
WalletKeysFilesModel(QObject *parent = 0);
|
||||
|
||||
Q_INVOKABLE void refresh(const QString &moneroAccountsDir);
|
||||
Q_INVOKABLE void clear();
|
||||
|
@ -82,7 +82,6 @@ protected:
|
|||
|
||||
private:
|
||||
QList<WalletKeysFiles> m_walletKeyFiles;
|
||||
WalletManager *m_walletManager;
|
||||
|
||||
QAbstractItemModel *m_walletKeysFilesItemModel;
|
||||
QSortFilterProxyModel m_walletKeysFilesModelProxy;
|
||||
|
|
Loading…
Reference in a new issue