Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
walletframe.cpp
Go to the documentation of this file.
1 /*
2  * Qt4 bitcoin GUI.
3  *
4  * W.J. van der Laan 2011-2012
5  * The Bitcoin Developers 2011-2013
6  */
7 #include "walletframe.h"
8 #include "bitcoingui.h"
9 #include "walletstack.h"
10 #include "walletview.h"
11 
12 #include <QHBoxLayout>
13 #include <QMessageBox>
14 #include <QLabel>
15 
17  QFrame(_gui),
18  gui(_gui),
19  clientModel(0)
20 {
21  // Leave HBox hook for adding a list view later
22  QHBoxLayout *walletFrameLayout = new QHBoxLayout(this);
23  setContentsMargins(0,0,0,0);
24  walletStack = new WalletStack(this);
26  walletFrameLayout->setContentsMargins(0,0,0,0);
27  walletFrameLayout->addWidget(walletStack);
28 
29  QLabel *noWallet = new QLabel(tr("No wallet has been loaded."));
30  noWallet->setAlignment(Qt::AlignCenter);
31  walletStack->addWidget(noWallet);
32 }
33 
35 {
36 }
37 
39 {
40  this->clientModel = clientModel;
41  walletStack->setClientModel(clientModel);
42 }
43 
44 bool WalletFrame::addWallet(const QString& name, WalletModel *walletModel)
45 {
46  return walletStack->addWallet(name, walletModel);
47 }
48 
49 bool WalletFrame::setCurrentWallet(const QString& name)
50 {
51  // TODO: Check if valid name
53  return true;
54 }
55 
57 {
59 }
60 
61 bool WalletFrame::handleURI(const QString &uri)
62 {
63  WalletView *walletView = currentWalletView();
64  if (!walletView)
65  return false;
66 
67  return walletStack->handleURI(uri);
68 }
69 
71 {
72  if (!walletStack) {
73  QMessageBox box;
74  box.setText("walletStack is null");
75  box.exec();
76  return;
77  }
79 }
80 
82 {
84 }
85 
87 {
89 }
90 
92 {
93  WalletView *walletView = currentWalletView();
94  if (walletView)
96 }
97 
99 {
101 }
102 
104 {
106 }
107 
109 {
110  WalletView *walletView = currentWalletView();
111  if (walletView)
112  walletView->gotoSignMessageTab(addr);
113 }
114 
116 {
117  WalletView *walletView = currentWalletView();
118  if (walletView)
119  walletView->gotoVerifyMessageTab(addr);
120 }
121 
122 void WalletFrame::encryptWallet(bool status)
123 {
124  WalletView *walletView = currentWalletView();
125  if (walletView)
126  walletView->encryptWallet(status);
127 }
128 
130 {
131  WalletView *walletView = currentWalletView();
132  if (walletView)
133  walletView->backupWallet();
134 }
135 
137 {
138  WalletView *walletView = currentWalletView();
139  if (walletView)
140  walletView->changePassphrase();
141 }
142 
144 {
145  WalletView *walletView = currentWalletView();
146  if (walletView)
147  walletView->unlockWallet();
148 }
149 
151 {
152  WalletView *walletView = currentWalletView();
153  if (walletView)
155 }
156 
158 {
159  return qobject_cast<WalletView*>(walletStack->currentWidget());
160 }
161 
bool handleURI(const QString &uri)
Definition: walletstack.cpp:62
bool setCurrentWallet(const QString &name)
Definition: walletframe.cpp:49
bool handleURI(const QString &uri)
Definition: walletframe.cpp:61
void gotoVerifyMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to verify message tab.
Definition: walletview.cpp:198
void gotoSendCoinsPage(QString addr="")
Switch to send coins page.
void setEncryptionStatus()
Set the encryption status as shown in the UI.
WalletView * currentWalletView()
ClientModel * clientModel
Definition: walletframe.h:39
void removeAllWallets()
Definition: walletstack.cpp:54
void changePassphrase()
Change encrypted wallet passphrase.
Definition: walletview.cpp:265
void gotoAddressBookPage()
Switch to address book page.
Definition: walletframe.cpp:91
void encryptWallet(bool status)
Encrypt the wallet.
void gotoOverviewPage()
Switch to overview (home) page.
Definition: walletstack.cpp:78
Bitcoin GUI main class.
Definition: bitcoingui.h:39
void gotoReceiveCoinsPage()
Switch to receive coins page.
Definition: walletstack.cpp:99
WalletStack * walletStack
Definition: walletframe.h:40
void setClientModel(ClientModel *clientModel)
Definition: walletstack.h:50
void removeAllWallets()
Definition: walletframe.cpp:56
void showOutOfSyncWarning(bool fShow)
Definition: walletframe.cpp:70
void setBitcoinGUI(BitcoinGUI *gui)
Definition: walletstack.h:48
void gotoHistoryPage()
Switch to history (transactions) page.
Definition: walletframe.cpp:86
void gotoOverviewPage()
Switch to overview (home) page.
Definition: walletframe.cpp:81
bool addWallet(const QString &name, WalletModel *walletModel)
Definition: walletstack.cpp:27
void setClientModel(ClientModel *clientModel)
Definition: walletframe.cpp:38
void showOutOfSyncWarning(bool fShow)
Definition: walletstack.cpp:70
void gotoVerifyMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to verify message tab.
BitcoinGUI * gui
Definition: walletframe.h:38
void gotoAddressBookPage()
Switch to address book page.
Definition: walletstack.cpp:92
bool addWallet(const QString &name, WalletModel *walletModel)
Definition: walletframe.cpp:44
void gotoHistoryPage()
Switch to history (transactions) page.
Definition: walletstack.cpp:85
void unlockWallet()
Ask for passphrase to unlock wallet temporarily.
Definition: walletview.cpp:272
void changePassphrase()
Change encrypted wallet passphrase.
Model for Bitcoin network client.
Definition: clientmodel.h:24
void unlockWallet()
Ask for passphrase to unlock wallet temporarily.
void gotoSignMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to sign message tab.
void backupWallet()
Backup the wallet.
Definition: walletview.cpp:246
void gotoSendCoinsPage(QString addr="")
Switch to send coins page.
WalletFrame(BitcoinGUI *_gui=0)
Definition: walletframe.cpp:16
void gotoReceiveCoinsPage()
Switch to receive coins page.
Definition: walletframe.cpp:98
void gotoSignMessageTab(QString addr="")
Show Sign/Verify Message dialog and switch to sign message tab.
Definition: walletview.cpp:189
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:36
void setCurrentWallet(const QString &name)
void setEncryptionStatus()
Set the encryption status as shown in the UI.
void backupWallet()
Backup the wallet.
void encryptWallet(bool status)
Encrypt the wallet.
Definition: walletview.cpp:235
const char * name
Definition: testharness.cc:18