@ -31,8 +31,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
ui - > newAddress - > setIcon ( QIcon ( ) ) ;
ui - > newAddress - > setIcon ( QIcon ( ) ) ;
ui - > copyAddress - > setIcon ( QIcon ( ) ) ;
ui - > copyAddress - > setIcon ( QIcon ( ) ) ;
ui - > deleteAddress - > setIcon ( QIcon ( ) ) ;
ui - > deleteAddress - > setIcon ( QIcon ( ) ) ;
ui - > verifyMessage - > setIcon ( QIcon ( ) ) ;
ui - > signMessage - > setIcon ( QIcon ( ) ) ;
ui - > exportButton - > setIcon ( QIcon ( ) ) ;
ui - > exportButton - > setIcon ( QIcon ( ) ) ;
# endif
# endif
@ -62,12 +60,10 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
case SendingTab :
case SendingTab :
ui - > labelExplanation - > setText ( tr ( " These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins. " ) ) ;
ui - > labelExplanation - > setText ( tr ( " These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins. " ) ) ;
ui - > deleteAddress - > setVisible ( true ) ;
ui - > deleteAddress - > setVisible ( true ) ;
ui - > signMessage - > setVisible ( false ) ;
break ;
break ;
case ReceivingTab :
case ReceivingTab :
ui - > labelExplanation - > setText ( tr ( " These are your Bitcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction. " ) ) ;
ui - > labelExplanation - > setText ( tr ( " These are your Bitcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction. " ) ) ;
ui - > deleteAddress - > setVisible ( false ) ;
ui - > deleteAddress - > setVisible ( false ) ;
ui - > signMessage - > setVisible ( true ) ;
break ;
break ;
}
}
@ -75,9 +71,6 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
QAction * copyAddressAction = new QAction ( ui - > copyAddress - > text ( ) , this ) ;
QAction * copyAddressAction = new QAction ( ui - > copyAddress - > text ( ) , this ) ;
QAction * copyLabelAction = new QAction ( tr ( " Copy &Label " ) , this ) ;
QAction * copyLabelAction = new QAction ( tr ( " Copy &Label " ) , this ) ;
QAction * editAction = new QAction ( tr ( " &Edit " ) , this ) ;
QAction * editAction = new QAction ( tr ( " &Edit " ) , this ) ;
QAction * sendCoinsAction = new QAction ( tr ( " Send &Coins " ) , this ) ;
QAction * signMessageAction = new QAction ( ui - > signMessage - > text ( ) , this ) ;
QAction * verifyMessageAction = new QAction ( ui - > verifyMessage - > text ( ) , this ) ;
deleteAction = new QAction ( ui - > deleteAddress - > text ( ) , this ) ;
deleteAction = new QAction ( ui - > deleteAddress - > text ( ) , this ) ;
// Build context menu
// Build context menu
@ -88,21 +81,12 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
if ( tab = = SendingTab )
if ( tab = = SendingTab )
contextMenu - > addAction ( deleteAction ) ;
contextMenu - > addAction ( deleteAction ) ;
contextMenu - > addSeparator ( ) ;
contextMenu - > addSeparator ( ) ;
if ( tab = = SendingTab )
contextMenu - > addAction ( sendCoinsAction ) ;
if ( tab = = ReceivingTab )
contextMenu - > addAction ( signMessageAction ) ;
else if ( tab = = SendingTab )
contextMenu - > addAction ( verifyMessageAction ) ;
// Connect signals for context menu actions
// Connect signals for context menu actions
connect ( copyAddressAction , SIGNAL ( triggered ( ) ) , this , SLOT ( on_copyAddress_clicked ( ) ) ) ;
connect ( copyAddressAction , SIGNAL ( triggered ( ) ) , this , SLOT ( on_copyAddress_clicked ( ) ) ) ;
connect ( copyLabelAction , SIGNAL ( triggered ( ) ) , this , SLOT ( onCopyLabelAction ( ) ) ) ;
connect ( copyLabelAction , SIGNAL ( triggered ( ) ) , this , SLOT ( onCopyLabelAction ( ) ) ) ;
connect ( editAction , SIGNAL ( triggered ( ) ) , this , SLOT ( onEditAction ( ) ) ) ;
connect ( editAction , SIGNAL ( triggered ( ) ) , this , SLOT ( onEditAction ( ) ) ) ;
connect ( deleteAction , SIGNAL ( triggered ( ) ) , this , SLOT ( on_deleteAddress_clicked ( ) ) ) ;
connect ( deleteAction , SIGNAL ( triggered ( ) ) , this , SLOT ( on_deleteAddress_clicked ( ) ) ) ;
connect ( sendCoinsAction , SIGNAL ( triggered ( ) ) , this , SLOT ( onSendCoinsAction ( ) ) ) ;
connect ( signMessageAction , SIGNAL ( triggered ( ) ) , this , SLOT ( on_signMessage_clicked ( ) ) ) ;
connect ( verifyMessageAction , SIGNAL ( triggered ( ) ) , this , SLOT ( on_verifyMessage_clicked ( ) ) ) ;
connect ( ui - > tableView , SIGNAL ( customContextMenuRequested ( QPoint ) ) , this , SLOT ( contextualMenu ( QPoint ) ) ) ;
connect ( ui - > tableView , SIGNAL ( customContextMenuRequested ( QPoint ) ) , this , SLOT ( contextualMenu ( QPoint ) ) ) ;
@ -193,42 +177,6 @@ void AddressBookPage::onEditAction()
dlg . exec ( ) ;
dlg . exec ( ) ;
}
}
void AddressBookPage : : on_signMessage_clicked ( )
{
QTableView * table = ui - > tableView ;
QModelIndexList indexes = table - > selectionModel ( ) - > selectedRows ( AddressTableModel : : Address ) ;
foreach ( QModelIndex index , indexes )
{
QString address = index . data ( ) . toString ( ) ;
emit signMessage ( address ) ;
}
}
void AddressBookPage : : on_verifyMessage_clicked ( )
{
QTableView * table = ui - > tableView ;
QModelIndexList indexes = table - > selectionModel ( ) - > selectedRows ( AddressTableModel : : Address ) ;
foreach ( QModelIndex index , indexes )
{
QString address = index . data ( ) . toString ( ) ;
emit verifyMessage ( address ) ;
}
}
void AddressBookPage : : onSendCoinsAction ( )
{
QTableView * table = ui - > tableView ;
QModelIndexList indexes = table - > selectionModel ( ) - > selectedRows ( AddressTableModel : : Address ) ;
foreach ( QModelIndex index , indexes )
{
QString address = index . data ( ) . toString ( ) ;
emit sendCoins ( address ) ;
}
}
void AddressBookPage : : on_newAddress_clicked ( )
void AddressBookPage : : on_newAddress_clicked ( )
{
{
if ( ! model )
if ( ! model )
@ -274,20 +222,12 @@ void AddressBookPage::selectionChanged()
ui - > deleteAddress - > setEnabled ( true ) ;
ui - > deleteAddress - > setEnabled ( true ) ;
ui - > deleteAddress - > setVisible ( true ) ;
ui - > deleteAddress - > setVisible ( true ) ;
deleteAction - > setEnabled ( true ) ;
deleteAction - > setEnabled ( true ) ;
ui - > signMessage - > setEnabled ( false ) ;
ui - > signMessage - > setVisible ( false ) ;
ui - > verifyMessage - > setEnabled ( true ) ;
ui - > verifyMessage - > setVisible ( true ) ;
break ;
break ;
case ReceivingTab :
case ReceivingTab :
// Deleting receiving addresses, however, is not allowed
// Deleting receiving addresses, however, is not allowed
ui - > deleteAddress - > setEnabled ( false ) ;
ui - > deleteAddress - > setEnabled ( false ) ;
ui - > deleteAddress - > setVisible ( false ) ;
ui - > deleteAddress - > setVisible ( false ) ;
deleteAction - > setEnabled ( false ) ;
deleteAction - > setEnabled ( false ) ;
ui - > signMessage - > setEnabled ( true ) ;
ui - > signMessage - > setVisible ( true ) ;
ui - > verifyMessage - > setEnabled ( false ) ;
ui - > verifyMessage - > setVisible ( false ) ;
break ;
break ;
}
}
ui - > copyAddress - > setEnabled ( true ) ;
ui - > copyAddress - > setEnabled ( true ) ;
@ -296,8 +236,6 @@ void AddressBookPage::selectionChanged()
{
{
ui - > deleteAddress - > setEnabled ( false ) ;
ui - > deleteAddress - > setEnabled ( false ) ;
ui - > copyAddress - > setEnabled ( false ) ;
ui - > copyAddress - > setEnabled ( false ) ;
ui - > signMessage - > setEnabled ( false ) ;
ui - > verifyMessage - > setEnabled ( false ) ;
}
}
}
}