add export functionality for address book / receiving addresses
[novacoin.git] / src / qt / bitcoingui.cpp
index 06c2034..94bd976 100644 (file)
@@ -84,7 +84,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
     QVBoxLayout *vbox = new QVBoxLayout();
 
     transactionView = new TransactionView(this);
-    connect(transactionView, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(transactionDetails(const QModelIndex&)));
+    connect(transactionView, SIGNAL(doubleClicked(const QModelIndex&)), transactionView, SLOT(transactionDetails()));
     vbox->addWidget(transactionView);
 
     transactionsPage = new QWidget(this);
@@ -184,7 +184,6 @@ void BitcoinGUI::createActions()
     connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
     connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
     connect(openBitcoinAction, SIGNAL(triggered()), this, SLOT(show()));
-    connect(exportAction, SIGNAL(triggered()), this, SLOT(exportClicked()));
 }
 
 void BitcoinGUI::setClientModel(ClientModel *clientModel)
@@ -229,7 +228,7 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
     connect(walletModel, SIGNAL(error(QString,QString)), this, SLOT(error(QString,QString)));
 
     // Put transaction list in tabs
-    transactionView->setModel(walletModel->getTransactionTableModel());
+    transactionView->setModel(walletModel);
 
     addressBookPage->setModel(walletModel->getAddressTableModel());
     receiveCoinsPage->setModel(walletModel->getAddressTableModel());
@@ -298,7 +297,7 @@ void BitcoinGUI::setNumConnections(int count)
     default: icon = ":/icons/connect_4"; break;
     }
     labelConnections->setTextFormat(Qt::RichText);
-    labelConnections->setText("<img src=\""+icon+"\">" + tr("%n connection(s)", "", count));
+    labelConnections->setText("<img src=\""+icon+"\"> " + tr("%n connection(s)", "", count));
 }
 
 void BitcoinGUI::setNumBlocks(int count)
@@ -411,13 +410,6 @@ void BitcoinGUI::askFee(qint64 nFeeRequired, bool *payFee)
     *payFee = (retval == QMessageBox::Yes);
 }
 
-void BitcoinGUI::transactionDetails(const QModelIndex& idx)
-{
-    // A transaction is doubleclicked
-    TransactionDescDialog dlg(idx);
-    dlg.exec();
-}
-
 void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end)
 {
     TransactionTableModel *ttm = walletModel->getTransactionTableModel();
@@ -447,41 +439,48 @@ void BitcoinGUI::gotoOverviewPage()
 {
     overviewAction->setChecked(true);
     centralWidget->setCurrentWidget(overviewPage);
+
     exportAction->setEnabled(false);
+    disconnect(exportAction, SIGNAL(triggered()), 0, 0);
 }
 
 void BitcoinGUI::gotoHistoryPage()
 {
     historyAction->setChecked(true);
     centralWidget->setCurrentWidget(transactionsPage);
+
     exportAction->setEnabled(true);
+    disconnect(exportAction, SIGNAL(triggered()), 0, 0);
+    connect(exportAction, SIGNAL(triggered()), transactionView, SLOT(exportClicked()));
 }
 
 void BitcoinGUI::gotoAddressBookPage()
 {
     addressBookAction->setChecked(true);
     centralWidget->setCurrentWidget(addressBookPage);
-    exportAction->setEnabled(false); // TODO
+
+    exportAction->setEnabled(true);
+    disconnect(exportAction, SIGNAL(triggered()), 0, 0);
+    connect(exportAction, SIGNAL(triggered()), addressBookPage, SLOT(exportClicked()));
 }
 
 void BitcoinGUI::gotoReceiveCoinsPage()
 {
     receiveCoinsAction->setChecked(true);
     centralWidget->setCurrentWidget(receiveCoinsPage);
-    exportAction->setEnabled(false); // TODO
+
+    exportAction->setEnabled(true);
+    disconnect(exportAction, SIGNAL(triggered()), 0, 0);
+    connect(exportAction, SIGNAL(triggered()), receiveCoinsPage, SLOT(exportClicked()));
 }
 
 void BitcoinGUI::gotoSendCoinsPage()
 {
     sendCoinsAction->setChecked(true);
+    sendCoinsPage->clear();
     centralWidget->setCurrentWidget(sendCoinsPage);
-    exportAction->setEnabled(false);
-}
 
-void BitcoinGUI::exportClicked()
-{
-    // Redirect to the right view, as soon as export for other views
-    // (such as address book) is implemented.
-    transactionView->exportClicked();
+    exportAction->setEnabled(false);
+    disconnect(exportAction, SIGNAL(triggered()), 0, 0);
 }