@@ -251,7 +251,7 @@ public Q_SLOTS:
251
251
QTimer *pollShutdownTimer;
252
252
#ifdef ENABLE_WALLET
253
253
PaymentServer* paymentServer;
254
- WalletModel *walletModel ;
254
+ std::vector< WalletModel*> m_wallet_models ;
255
255
#endif
256
256
int returnValue;
257
257
const PlatformStyle *platformStyle;
@@ -333,7 +333,7 @@ BitcoinApplication::BitcoinApplication(int &argc, char **argv):
333
333
pollShutdownTimer(0 ),
334
334
#ifdef ENABLE_WALLET
335
335
paymentServer (0 ),
336
- walletModel( 0 ),
336
+ m_wallet_models( ),
337
337
#endif
338
338
returnValue (0 )
339
339
{
@@ -451,8 +451,10 @@ void BitcoinApplication::requestShutdown()
451
451
452
452
#ifdef ENABLE_WALLET
453
453
window->removeAllWallets ();
454
- delete walletModel;
455
- walletModel = 0 ;
454
+ for (WalletModel *walletModel : m_wallet_models) {
455
+ delete walletModel;
456
+ }
457
+ m_wallet_models.clear ();
456
458
#endif
457
459
delete clientModel;
458
460
clientModel = 0 ;
@@ -481,16 +483,25 @@ void BitcoinApplication::initializeResult(bool success)
481
483
window->setClientModel (clientModel);
482
484
483
485
#ifdef ENABLE_WALLET
484
- // TODO: Expose secondary wallets
485
- if (!vpwallets.empty ())
486
- {
487
- walletModel = new WalletModel (platformStyle, vpwallets[0 ], optionsModel);
486
+ bool fFirstWallet = true ;
487
+ for (CWalletRef pwallet : vpwallets) {
488
+ WalletModel * const walletModel = new WalletModel (platformStyle, pwallet, optionsModel);
488
489
489
- window->addWallet (BitcoinGUI::DEFAULT_WALLET, walletModel);
490
- window->setCurrentWallet (BitcoinGUI::DEFAULT_WALLET);
490
+ QString WalletName = QString::fromStdString (pwallet->GetName ());
491
+ if (WalletName.endsWith (" .dat" )) {
492
+ WalletName.truncate (WalletName.size () - 4 );
493
+ }
494
+
495
+ window->addWallet (WalletName, walletModel);
496
+ if (fFirstWallet ) {
497
+ window->setCurrentWallet (WalletName);
498
+ fFirstWallet = false ;
499
+ }
491
500
492
501
connect (walletModel, SIGNAL (coinsSent (CWallet*,SendCoinsRecipient,QByteArray)),
493
502
paymentServer, SLOT (fetchPaymentACK (CWallet*,const SendCoinsRecipient&,QByteArray)));
503
+
504
+ m_wallet_models.push_back (walletModel);
494
505
}
495
506
#endif
496
507
0 commit comments