remove transparency effect and windows-specific code for now, it's not working as...
[novacoin.git] / src / qt / bitcoingui.cpp
1 /*
2  * Qt4 bitcoin GUI.
3  *
4  * W.J. van der Laan 2011
5  */
6 #include "bitcoingui.h"
7 #include "transactiontablemodel.h"
8 #include "addressbookpage.h"
9 #include "sendcoinsdialog.h"
10 #include "optionsdialog.h"
11 #include "aboutdialog.h"
12 #include "clientmodel.h"
13 #include "walletmodel.h"
14 #include "editaddressdialog.h"
15 #include "optionsmodel.h"
16 #include "transactiondescdialog.h"
17 #include "addresstablemodel.h"
18 #include "transactionview.h"
19 #include "overviewpage.h"
20 #include "bitcoinunits.h"
21 #include "guiconstants.h"
22 #include "askpassphrasedialog.h"
23 #include "notificator.h"
24
25 #include <QApplication>
26 #include <QMainWindow>
27 #include <QMenuBar>
28 #include <QMenu>
29 #include <QIcon>
30 #include <QTabWidget>
31 #include <QVBoxLayout>
32 #include <QToolBar>
33 #include <QStatusBar>
34 #include <QLabel>
35 #include <QLineEdit>
36 #include <QPushButton>
37 #include <QLocale>
38 #include <QMessageBox>
39 #include <QProgressBar>
40 #include <QStackedWidget>
41 #include <QDateTime>
42 #include <QMovie>
43
44 #include <QDragEnterEvent>
45 #include <QUrl>
46
47 #include <iostream>
48
49 BitcoinGUI::BitcoinGUI(QWidget *parent):
50     QMainWindow(parent),
51     clientModel(0),
52     walletModel(0),
53     encryptWalletAction(0),
54     changePassphraseAction(0),
55     trayIcon(0),
56     notificator(0)
57 {
58     resize(850, 550);
59     setWindowTitle(tr("Bitcoin Wallet"));
60     setWindowIcon(QIcon(":icons/bitcoin"));
61     // Accept D&D of URIs
62     setAcceptDrops(true);
63
64     createActions();
65
66     // Menus
67     QMenu *file = menuBar()->addMenu(tr("&File"));
68     file->addAction(sendCoinsAction);
69     file->addAction(receiveCoinsAction);
70     file->addSeparator();
71     file->addAction(quitAction);
72     
73     QMenu *settings = menuBar()->addMenu(tr("&Settings"));
74     settings->addAction(encryptWalletAction);
75     settings->addAction(changePassphraseAction);
76     settings->addSeparator();
77     settings->addAction(optionsAction);
78
79     QMenu *help = menuBar()->addMenu(tr("&Help"));
80     help->addAction(aboutAction);
81     
82     // Toolbars
83     QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
84     toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
85     toolbar->addAction(overviewAction);
86     toolbar->addAction(sendCoinsAction);
87     toolbar->addAction(receiveCoinsAction);
88     toolbar->addAction(historyAction);
89     toolbar->addAction(addressBookAction);
90
91     QToolBar *toolbar2 = addToolBar(tr("Actions toolbar"));
92     toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
93     toolbar2->addAction(exportAction);
94
95     // Create tabs
96     overviewPage = new OverviewPage();
97
98     transactionsPage = new QWidget(this);
99     QVBoxLayout *vbox = new QVBoxLayout();
100     transactionView = new TransactionView(this);
101     vbox->addWidget(transactionView);
102     transactionsPage->setLayout(vbox);
103
104     addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);
105
106     receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);
107
108     sendCoinsPage = new SendCoinsDialog(this);
109
110     centralWidget = new QStackedWidget(this);
111     centralWidget->addWidget(overviewPage);
112     centralWidget->addWidget(transactionsPage);
113     centralWidget->addWidget(addressBookPage);
114     centralWidget->addWidget(receiveCoinsPage);
115     centralWidget->addWidget(sendCoinsPage);
116     setCentralWidget(centralWidget);
117
118     // Create status bar
119     statusBar();
120
121     // Status bar notification icons
122     QFrame *frameBlocks = new QFrame();
123     //frameBlocks->setFrameStyle(QFrame::Panel | QFrame::Sunken);
124     frameBlocks->setContentsMargins(0,0,0,0);
125     frameBlocks->setMinimumWidth(56);
126     frameBlocks->setMaximumWidth(56);
127     QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
128     frameBlocksLayout->setContentsMargins(3,0,3,0);
129     frameBlocksLayout->setSpacing(3);
130     labelEncryptionIcon = new QLabel();
131     labelConnectionsIcon = new QLabel();
132     labelBlocksIcon = new QLabel();
133     frameBlocksLayout->addStretch();
134     frameBlocksLayout->addWidget(labelEncryptionIcon);
135     frameBlocksLayout->addStretch();
136     frameBlocksLayout->addWidget(labelConnectionsIcon);
137     frameBlocksLayout->addStretch();
138     frameBlocksLayout->addWidget(labelBlocksIcon);
139     frameBlocksLayout->addStretch();
140
141     // Progress bar for blocks download
142     progressBarLabel = new QLabel(tr("Synchronizing with network..."));
143     progressBarLabel->setVisible(false);
144     progressBar = new QProgressBar();
145     progressBar->setToolTip(tr("Block chain synchronization in progress"));
146     progressBar->setVisible(false);
147
148     statusBar()->addWidget(progressBarLabel);
149     statusBar()->addWidget(progressBar);
150     statusBar()->addPermanentWidget(frameBlocks);
151
152     createTrayIcon();
153
154     syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
155
156     // Clicking on a transaction on the overview page simply sends you to transaction history page
157     connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
158
159     // Doubleclicking on a transaction on the transaction history page shows details
160     connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));
161
162     gotoOverviewPage();
163 }
164
165 void BitcoinGUI::createActions()
166 {
167     QActionGroup *tabGroup = new QActionGroup(this);
168
169     overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
170     overviewAction->setToolTip(tr("Show general overview of wallet"));
171     overviewAction->setCheckable(true);
172     tabGroup->addAction(overviewAction);
173
174     historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
175     historyAction->setToolTip(tr("Browse transaction history"));
176     historyAction->setCheckable(true);
177     tabGroup->addAction(historyAction);
178
179     addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
180     addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
181     addressBookAction->setCheckable(true);
182     tabGroup->addAction(addressBookAction);
183
184     receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
185     receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
186     receiveCoinsAction->setCheckable(true);
187     tabGroup->addAction(receiveCoinsAction);
188
189     sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
190     sendCoinsAction->setToolTip(tr("Send coins to a bitcoin address"));
191     sendCoinsAction->setCheckable(true);
192     tabGroup->addAction(sendCoinsAction);
193
194     connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
195     connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
196     connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
197     connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
198     connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
199
200     quitAction = new QAction(QIcon(":/icons/quit"), tr("&Exit"), this);
201     quitAction->setToolTip(tr("Quit application"));
202     aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About"), this);
203     aboutAction->setToolTip(tr("Show information about Bitcoin"));
204     optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
205     optionsAction->setToolTip(tr("Modify configuration options for bitcoin"));
206     openBitcoinAction = new QAction(QIcon(":/icons/bitcoin"), tr("Open &Bitcoin"), this);
207     openBitcoinAction->setToolTip(tr("Show the Bitcoin window"));
208     exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
209     exportAction->setToolTip(tr("Export the current view to a file"));
210     encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet"), this);
211     encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet"));
212     encryptWalletAction->setCheckable(true);
213     changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase"), this);
214     changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption"));
215
216     connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
217     connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
218     connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
219     connect(openBitcoinAction, SIGNAL(triggered()), this, SLOT(showNormal()));
220     connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool)));
221     connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase()));
222 }
223
224 void BitcoinGUI::setClientModel(ClientModel *clientModel)
225 {
226     this->clientModel = clientModel;
227
228     if(clientModel->isTestNet())
229     {
230         QString title_testnet = windowTitle() + QString(" ") + tr("[testnet]");
231         setWindowTitle(title_testnet);
232         setWindowIcon(QIcon(":icons/bitcoin_testnet"));
233         if(trayIcon)
234         {
235             trayIcon->setToolTip(title_testnet);
236             trayIcon->setIcon(QIcon(":/icons/toolbar_testnet"));
237         }
238     }
239
240     // Keep up to date with client
241     setNumConnections(clientModel->getNumConnections());
242     connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
243
244     setNumBlocks(clientModel->getNumBlocks());
245     connect(clientModel, SIGNAL(numBlocksChanged(int)), this, SLOT(setNumBlocks(int)));
246
247     // Report errors from network/worker thread
248     connect(clientModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString)));
249 }
250
251 void BitcoinGUI::setWalletModel(WalletModel *walletModel)
252 {
253     this->walletModel = walletModel;
254
255     // Report errors from wallet thread
256     connect(walletModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString)));
257
258     // Put transaction list in tabs
259     transactionView->setModel(walletModel);
260
261     overviewPage->setModel(walletModel);
262     addressBookPage->setModel(walletModel->getAddressTableModel());
263     receiveCoinsPage->setModel(walletModel->getAddressTableModel());
264     sendCoinsPage->setModel(walletModel);
265
266     setEncryptionStatus(walletModel->getEncryptionStatus());
267     connect(walletModel, SIGNAL(encryptionStatusChanged(int)), this, SLOT(setEncryptionStatus(int)));
268
269     // Balloon popup for new transaction
270     connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(QModelIndex,int,int)),
271             this, SLOT(incomingTransaction(QModelIndex,int,int)));
272
273     // Ask for passphrase if needed
274     connect(walletModel, SIGNAL(requireUnlock()), this, SLOT(unlockWallet()));
275 }
276
277 void BitcoinGUI::createTrayIcon()
278 {
279     QMenu *trayIconMenu = new QMenu(this);
280     trayIconMenu->addAction(openBitcoinAction);
281     trayIconMenu->addAction(optionsAction);
282     trayIconMenu->addSeparator();
283     trayIconMenu->addAction(quitAction);
284
285     trayIcon = new QSystemTrayIcon(this);
286     trayIcon->setContextMenu(trayIconMenu);
287     trayIcon->setToolTip("Bitcoin client");
288     trayIcon->setIcon(QIcon(":/icons/toolbar"));
289     connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
290             this, SLOT(trayIconActivated(QSystemTrayIcon::ActivationReason)));
291     trayIcon->show();
292
293     notificator = new Notificator(tr("bitcoin-qt"), trayIcon);
294 }
295
296 void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
297 {
298     if(reason == QSystemTrayIcon::Trigger)
299     {
300         // Click on system tray icon triggers "open bitcoin"
301         openBitcoinAction->trigger();
302     }
303
304 }
305
306 void BitcoinGUI::optionsClicked()
307 {
308     OptionsDialog dlg;
309     dlg.setModel(clientModel->getOptionsModel());
310     dlg.exec();
311 }
312
313 void BitcoinGUI::aboutClicked()
314 {
315     AboutDialog dlg;
316     dlg.setModel(clientModel);
317     dlg.exec();
318 }
319
320 void BitcoinGUI::setNumConnections(int count)
321 {
322     QString icon;
323     switch(count)
324     {
325     case 0: icon = ":/icons/connect_0"; break;
326     case 1: case 2: case 3: icon = ":/icons/connect_1"; break;
327     case 4: case 5: case 6: icon = ":/icons/connect_2"; break;
328     case 7: case 8: case 9: icon = ":/icons/connect_3"; break;
329     default: icon = ":/icons/connect_4"; break;
330     }
331     labelConnectionsIcon->setPixmap(QIcon(icon).pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
332     labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Bitcoin network", "", count));
333 }
334
335 void BitcoinGUI::setNumBlocks(int count)
336 {
337     int initTotal = clientModel->getNumBlocksAtStartup();
338     int total = clientModel->getNumBlocksOfPeers();
339     QString tooltip;
340
341     if(count < total)
342     {
343         progressBarLabel->setVisible(true);
344         progressBar->setVisible(true);
345         progressBar->setMaximum(total - initTotal);
346         progressBar->setValue(count - initTotal);
347         tooltip = tr("Downloaded %1 of %2 blocks of transaction history.").arg(count).arg(total);
348     }
349     else
350     {
351         progressBarLabel->setVisible(false);
352         progressBar->setVisible(false);
353         tooltip = tr("Downloaded %1 blocks of transaction history.").arg(count);
354     }
355
356     QDateTime now = QDateTime::currentDateTime();
357     QDateTime lastBlockDate = clientModel->getLastBlockDate();
358     int secs = lastBlockDate.secsTo(now);
359     QString text;
360
361     // Represent time from last generated block in human readable text
362     if(secs < 60)
363     {
364         text = tr("%n second(s) ago","",secs);
365     }
366     else if(secs < 60*60)
367     {
368         text = tr("%n minute(s) ago","",secs/60);
369     }
370     else if(secs < 24*60*60)
371     {
372         text = tr("%n hour(s) ago","",secs/(60*60));
373     }
374     else
375     {
376         text = tr("%n day(s) ago","",secs/(60*60*24));
377     }
378
379     // Set icon state: spinning if catching up, tick otherwise
380     if(secs < 30*60)
381     {
382         tooltip = tr("Up to date") + QString("\n") + tooltip;
383         labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
384     }
385     else
386     {
387         tooltip = tr("Catching up...") + QString("\n") + tooltip;
388         labelBlocksIcon->setMovie(syncIconMovie);
389         syncIconMovie->start();
390     }
391
392     tooltip += QString("\n");
393     tooltip += tr("Last received block was generated %1.").arg(text);
394
395     labelBlocksIcon->setToolTip(tooltip);
396     progressBarLabel->setToolTip(tooltip);
397     progressBar->setToolTip(tooltip);
398 }
399
400 void BitcoinGUI::error(const QString &title, const QString &message)
401 {
402     // Report errors from network/worker thread
403     notificator->notify(Notificator::Critical, title, message);
404 }
405
406 void BitcoinGUI::changeEvent(QEvent *e)
407 {
408     if (e->type() == QEvent::WindowStateChange)
409     {
410         if(clientModel->getOptionsModel()->getMinimizeToTray())
411         {
412             if (isMinimized())
413             {
414                 hide();
415                 e->ignore();
416             }
417             else
418             {
419                 show();
420                 e->accept();
421             }
422         }
423     }
424     QMainWindow::changeEvent(e);
425 }
426
427 void BitcoinGUI::closeEvent(QCloseEvent *event)
428 {
429     if(!clientModel->getOptionsModel()->getMinimizeToTray() &&
430        !clientModel->getOptionsModel()->getMinimizeOnClose())
431     {
432         qApp->quit();
433     }
434     QMainWindow::closeEvent(event);
435 }
436
437 void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
438 {
439     QString strMessage =
440         tr("This transaction is over the size limit.  You can still send it for a fee of %1, "
441           "which goes to the nodes that process your transaction and helps to support the network.  "
442           "Do you want to pay the fee?").arg(
443                 BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, nFeeRequired));
444     QMessageBox::StandardButton retval = QMessageBox::question(
445           this, tr("Sending..."), strMessage,
446           QMessageBox::Yes|QMessageBox::Cancel, QMessageBox::Yes);
447     *payFee = (retval == QMessageBox::Yes);
448 }
449
450 void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end)
451 {
452     TransactionTableModel *ttm = walletModel->getTransactionTableModel();
453     qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent)
454                     .data(Qt::EditRole).toULongLong();
455     if(!clientModel->inInitialBlockDownload())
456     {
457         // On new transaction, make an info balloon
458         // Unless the initial block download is in progress, to prevent balloon-spam
459         QString date = ttm->index(start, TransactionTableModel::Date, parent)
460                         .data().toString();
461         QString type = ttm->index(start, TransactionTableModel::Type, parent)
462                         .data().toString();
463         QString address = ttm->index(start, TransactionTableModel::ToAddress, parent)
464                         .data().toString();
465         QIcon icon = qvariant_cast<QIcon>(ttm->index(start,
466                             TransactionTableModel::ToAddress, parent)
467                         .data(Qt::DecorationRole));
468
469         notificator->notify(Notificator::Information,
470                             (amount)<0 ? tr("Sent transaction") :
471                                          tr("Incoming transaction"),
472                               tr("Date: %1\n"
473                                  "Amount: %2\n"
474                                  "Type: %3\n"
475                                  "Address: %4\n")
476                               .arg(date)
477                               .arg(BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true))
478                               .arg(type)
479                               .arg(address), icon);
480     }
481 }
482
483 void BitcoinGUI::gotoOverviewPage()
484 {
485     overviewAction->setChecked(true);
486     centralWidget->setCurrentWidget(overviewPage);
487
488     exportAction->setEnabled(false);
489     disconnect(exportAction, SIGNAL(triggered()), 0, 0);
490 }
491
492 void BitcoinGUI::gotoHistoryPage()
493 {
494     historyAction->setChecked(true);
495     centralWidget->setCurrentWidget(transactionsPage);
496
497     exportAction->setEnabled(true);
498     disconnect(exportAction, SIGNAL(triggered()), 0, 0);
499     connect(exportAction, SIGNAL(triggered()), transactionView, SLOT(exportClicked()));
500 }
501
502 void BitcoinGUI::gotoAddressBookPage()
503 {
504     addressBookAction->setChecked(true);
505     centralWidget->setCurrentWidget(addressBookPage);
506
507     exportAction->setEnabled(true);
508     disconnect(exportAction, SIGNAL(triggered()), 0, 0);
509     connect(exportAction, SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
510 }
511
512 void BitcoinGUI::gotoReceiveCoinsPage()
513 {
514     receiveCoinsAction->setChecked(true);
515     centralWidget->setCurrentWidget(receiveCoinsPage);
516
517     exportAction->setEnabled(true);
518     disconnect(exportAction, SIGNAL(triggered()), 0, 0);
519     connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
520 }
521
522 void BitcoinGUI::gotoSendCoinsPage()
523 {
524     sendCoinsAction->setChecked(true);
525     if(centralWidget->currentWidget() != sendCoinsPage)
526     {
527         // Clear the current contents if we arrived from another tab
528         sendCoinsPage->clear();
529     }
530     centralWidget->setCurrentWidget(sendCoinsPage);
531
532     exportAction->setEnabled(false);
533     disconnect(exportAction, SIGNAL(triggered()), 0, 0);
534 }
535
536 void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
537 {
538     // Accept only URLs
539     if(event->mimeData()->hasUrls())
540         event->acceptProposedAction();
541 }
542
543 void BitcoinGUI::dropEvent(QDropEvent *event)
544 {
545     if(event->mimeData()->hasUrls())
546     {
547         gotoSendCoinsPage();
548         QList<QUrl> urls = event->mimeData()->urls();
549         foreach(const QUrl &url, urls)
550         {
551             sendCoinsPage->handleURL(&url);
552         }
553     }
554
555     event->acceptProposedAction();
556 }
557
558 void BitcoinGUI::setEncryptionStatus(int status)
559 {
560     switch(status)
561     {
562     case WalletModel::Unencrypted:
563         labelEncryptionIcon->hide();
564         encryptWalletAction->setChecked(false);
565         changePassphraseAction->setEnabled(false);
566         encryptWalletAction->setEnabled(true);
567         break;
568     case WalletModel::Unlocked:
569         labelEncryptionIcon->show();
570         labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_open").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
571         labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>unlocked</b>"));
572         encryptWalletAction->setChecked(true);
573         changePassphraseAction->setEnabled(true);
574         encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
575         break;
576     case WalletModel::Locked:
577         labelEncryptionIcon->show();
578         labelEncryptionIcon->setPixmap(QIcon(":/icons/lock_closed").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
579         labelEncryptionIcon->setToolTip(tr("Wallet is <b>encrypted</b> and currently <b>locked</b>"));
580         encryptWalletAction->setChecked(true);
581         changePassphraseAction->setEnabled(true);
582         encryptWalletAction->setEnabled(false); // TODO: decrypt currently not supported
583         break;
584     }
585 }
586
587 void BitcoinGUI::encryptWallet(bool status)
588 {
589     AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt:
590                                      AskPassphraseDialog::Decrypt, this);
591     dlg.setModel(walletModel);
592     dlg.exec();
593
594     setEncryptionStatus(walletModel->getEncryptionStatus());
595 }
596
597 void BitcoinGUI::changePassphrase()
598 {
599     AskPassphraseDialog dlg(AskPassphraseDialog::ChangePass, this);
600     dlg.setModel(walletModel);
601     dlg.exec();
602 }
603
604 void BitcoinGUI::unlockWallet()
605 {
606     // Unlock wallet when requested by wallet model
607     if(walletModel->getEncryptionStatus() == WalletModel::Locked)
608     {
609         AskPassphraseDialog dlg(AskPassphraseDialog::Unlock, this);
610         dlg.setModel(walletModel);
611         dlg.exec();
612     }
613 }