12
12
#include " csvmodelwriter.h"
13
13
#include " guiutil.h"
14
14
15
- #ifdef USE_QRCODE
16
- #include " qrcodedialog.h"
17
- #endif
18
-
19
15
#include < QSortFilterProxyModel>
20
16
#include < QClipboard>
21
17
#include < QMessageBox>
@@ -35,49 +31,47 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
35
31
ui->newAddress ->setIcon (QIcon ());
36
32
ui->copyAddress ->setIcon (QIcon ());
37
33
ui->deleteAddress ->setIcon (QIcon ());
38
- ui->verifyMessage ->setIcon (QIcon ());
39
- ui->signMessage ->setIcon (QIcon ());
40
34
ui->exportButton ->setIcon (QIcon ());
41
35
#endif
42
36
43
- #ifndef USE_QRCODE
44
- ui->showQRCode ->setVisible (false );
45
- #endif
46
-
47
37
switch (mode)
48
38
{
49
- case ForSending:
39
+ case ForSelection:
40
+ switch (tab)
41
+ {
42
+ case SendingTab: setWindowTitle (tr (" Choose the address to send coins to" )); break ;
43
+ case ReceivingTab: setWindowTitle (tr (" Choose the address to receive coins with" )); break ;
44
+ }
50
45
connect (ui->tableView , SIGNAL (doubleClicked (QModelIndex)), this , SLOT (accept ()));
51
46
ui->tableView ->setEditTriggers (QAbstractItemView::NoEditTriggers);
52
47
ui->tableView ->setFocus ();
48
+ ui->closeButton ->setText (tr (" C&hoose" ));
53
49
ui->exportButton ->hide ();
54
50
break ;
55
51
case ForEditing:
56
- ui->buttonBox ->setVisible (false );
52
+ switch (tab)
53
+ {
54
+ case SendingTab: setWindowTitle (tr (" Sending addresses" )); break ;
55
+ case ReceivingTab: setWindowTitle (tr (" Receiving addresses" )); break ;
56
+ }
57
57
break ;
58
58
}
59
59
switch (tab)
60
60
{
61
61
case SendingTab:
62
62
ui->labelExplanation ->setText (tr (" These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins." ));
63
63
ui->deleteAddress ->setVisible (true );
64
- ui->signMessage ->setVisible (false );
65
64
break ;
66
65
case ReceivingTab:
67
- ui->labelExplanation ->setText (tr (" These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you ." ));
66
+ ui->labelExplanation ->setText (tr (" These are your Bitcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction ." ));
68
67
ui->deleteAddress ->setVisible (false );
69
- ui->signMessage ->setVisible (true );
70
68
break ;
71
69
}
72
70
73
71
// Context menu actions
74
72
QAction *copyAddressAction = new QAction (ui->copyAddress ->text (), this );
75
73
QAction *copyLabelAction = new QAction (tr (" Copy &Label" ), this );
76
74
QAction *editAction = new QAction (tr (" &Edit" ), this );
77
- QAction *sendCoinsAction = new QAction (tr (" Send &Coins" ), this );
78
- QAction *showQRCodeAction = new QAction (ui->showQRCode ->text (), this );
79
- QAction *signMessageAction = new QAction (ui->signMessage ->text (), this );
80
- QAction *verifyMessageAction = new QAction (ui->verifyMessage ->text (), this );
81
75
deleteAction = new QAction (ui->deleteAddress ->text (), this );
82
76
83
77
// Build context menu
@@ -88,30 +82,16 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
88
82
if (tab == SendingTab)
89
83
contextMenu->addAction (deleteAction);
90
84
contextMenu->addSeparator ();
91
- if (tab == SendingTab)
92
- contextMenu->addAction (sendCoinsAction);
93
- #ifdef USE_QRCODE
94
- contextMenu->addAction (showQRCodeAction);
95
- #endif
96
- if (tab == ReceivingTab)
97
- contextMenu->addAction (signMessageAction);
98
- else if (tab == SendingTab)
99
- contextMenu->addAction (verifyMessageAction);
100
85
101
86
// Connect signals for context menu actions
102
87
connect (copyAddressAction, SIGNAL (triggered ()), this , SLOT (on_copyAddress_clicked ()));
103
88
connect (copyLabelAction, SIGNAL (triggered ()), this , SLOT (onCopyLabelAction ()));
104
89
connect (editAction, SIGNAL (triggered ()), this , SLOT (onEditAction ()));
105
90
connect (deleteAction, SIGNAL (triggered ()), this , SLOT (on_deleteAddress_clicked ()));
106
- connect (sendCoinsAction, SIGNAL (triggered ()), this , SLOT (onSendCoinsAction ()));
107
- connect (showQRCodeAction, SIGNAL (triggered ()), this , SLOT (on_showQRCode_clicked ()));
108
- connect (signMessageAction, SIGNAL (triggered ()), this , SLOT (on_signMessage_clicked ()));
109
- connect (verifyMessageAction, SIGNAL (triggered ()), this , SLOT (on_verifyMessage_clicked ()));
110
91
111
92
connect (ui->tableView , SIGNAL (customContextMenuRequested (QPoint)), this , SLOT (contextualMenu (QPoint)));
112
93
113
- // Pass through accept action from button box
114
- connect (ui->buttonBox , SIGNAL (accepted ()), this , SLOT (accept ()));
94
+ connect (ui->closeButton , SIGNAL (clicked ()), this , SLOT (accept ()));
115
95
}
116
96
117
97
AddressBookPage::~AddressBookPage ()
@@ -197,42 +177,6 @@ void AddressBookPage::onEditAction()
197
177
dlg.exec ();
198
178
}
199
179
200
- void AddressBookPage::on_signMessage_clicked ()
201
- {
202
- QTableView *table = ui->tableView ;
203
- QModelIndexList indexes = table->selectionModel ()->selectedRows (AddressTableModel::Address);
204
-
205
- foreach (QModelIndex index, indexes)
206
- {
207
- QString address = index.data ().toString ();
208
- emit signMessage (address);
209
- }
210
- }
211
-
212
- void AddressBookPage::on_verifyMessage_clicked ()
213
- {
214
- QTableView *table = ui->tableView ;
215
- QModelIndexList indexes = table->selectionModel ()->selectedRows (AddressTableModel::Address);
216
-
217
- foreach (QModelIndex index, indexes)
218
- {
219
- QString address = index.data ().toString ();
220
- emit verifyMessage (address);
221
- }
222
- }
223
-
224
- void AddressBookPage::onSendCoinsAction ()
225
- {
226
- QTableView *table = ui->tableView ;
227
- QModelIndexList indexes = table->selectionModel ()->selectedRows (AddressTableModel::Address);
228
-
229
- foreach (QModelIndex index, indexes)
230
- {
231
- QString address = index.data ().toString ();
232
- emit sendCoins (address);
233
- }
234
- }
235
-
236
180
void AddressBookPage::on_newAddress_clicked ()
237
181
{
238
182
if (!model)
@@ -278,32 +222,20 @@ void AddressBookPage::selectionChanged()
278
222
ui->deleteAddress ->setEnabled (true );
279
223
ui->deleteAddress ->setVisible (true );
280
224
deleteAction->setEnabled (true );
281
- ui->signMessage ->setEnabled (false );
282
- ui->signMessage ->setVisible (false );
283
- ui->verifyMessage ->setEnabled (true );
284
- ui->verifyMessage ->setVisible (true );
285
225
break ;
286
226
case ReceivingTab:
287
227
// Deleting receiving addresses, however, is not allowed
288
228
ui->deleteAddress ->setEnabled (false );
289
229
ui->deleteAddress ->setVisible (false );
290
230
deleteAction->setEnabled (false );
291
- ui->signMessage ->setEnabled (true );
292
- ui->signMessage ->setVisible (true );
293
- ui->verifyMessage ->setEnabled (false );
294
- ui->verifyMessage ->setVisible (false );
295
231
break ;
296
232
}
297
233
ui->copyAddress ->setEnabled (true );
298
- ui->showQRCode ->setEnabled (true );
299
234
}
300
235
else
301
236
{
302
237
ui->deleteAddress ->setEnabled (false );
303
- ui->showQRCode ->setEnabled (false );
304
238
ui->copyAddress ->setEnabled (false );
305
- ui->signMessage ->setEnabled (false );
306
- ui->verifyMessage ->setEnabled (false );
307
239
}
308
240
}
309
241
@@ -312,9 +244,6 @@ void AddressBookPage::done(int retval)
312
244
QTableView *table = ui->tableView ;
313
245
if (!table->selectionModel () || !table->model ())
314
246
return ;
315
- // When this is a tab/widget and not a model dialog, ignore "done"
316
- if (mode == ForEditing)
317
- return ;
318
247
319
248
// Figure out which address was selected, and return it
320
249
QModelIndexList indexes = table->selectionModel ()->selectedRows (AddressTableModel::Address);
@@ -339,7 +268,7 @@ void AddressBookPage::on_exportButton_clicked()
339
268
// CSV is currently the only supported format
340
269
QString filename = GUIUtil::getSaveFileName (
341
270
this ,
342
- tr (" Export Address Book Data " ), QString (),
271
+ tr (" Export Address List " ), QString (),
343
272
tr (" Comma separated file (*.csv)" ));
344
273
345
274
if (filename.isNull ()) return ;
@@ -358,25 +287,6 @@ void AddressBookPage::on_exportButton_clicked()
358
287
}
359
288
}
360
289
361
- void AddressBookPage::on_showQRCode_clicked ()
362
- {
363
- #ifdef USE_QRCODE
364
- QTableView *table = ui->tableView ;
365
- QModelIndexList indexes = table->selectionModel ()->selectedRows (AddressTableModel::Address);
366
-
367
- foreach (QModelIndex index, indexes)
368
- {
369
- QString address = index.data ().toString ();
370
- QString label = index.sibling (index.row (), 0 ).data (Qt::EditRole).toString ();
371
-
372
- QRCodeDialog *dialog = new QRCodeDialog (address, label, tab == ReceivingTab, this );
373
- dialog->setModel (optionsModel);
374
- dialog->setAttribute (Qt::WA_DeleteOnClose);
375
- dialog->show ();
376
- }
377
- #endif
378
- }
379
-
380
290
void AddressBookPage::contextualMenu (const QPoint &point)
381
291
{
382
292
QModelIndex index = ui->tableView ->indexAt (point);
0 commit comments