2018-07-26 18:36:45 -04:00
|
|
|
// Copyright (c) 2011-2018 The Bitcoin Core developers
|
2014-12-13 01:09:33 -03:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2013-11-04 12:20:43 -03:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2014-11-03 12:16:40 -03:00
|
|
|
#ifndef BITCOIN_QT_ADDRESSBOOKPAGE_H
|
|
|
|
#define BITCOIN_QT_ADDRESSBOOKPAGE_H
|
2011-05-08 16:23:31 -04:00
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
|
2018-01-03 13:00:18 -03:00
|
|
|
class AddressBookSortFilterProxyModel;
|
2013-04-13 02:13:08 -03:00
|
|
|
class AddressTableModel;
|
2015-07-28 10:20:14 -03:00
|
|
|
class PlatformStyle;
|
2013-04-13 02:13:08 -03:00
|
|
|
|
2011-05-12 08:44:52 -04:00
|
|
|
namespace Ui {
|
2011-07-07 11:33:15 -04:00
|
|
|
class AddressBookPage;
|
2011-05-12 08:44:52 -04:00
|
|
|
}
|
|
|
|
|
2011-05-13 16:00:27 -04:00
|
|
|
QT_BEGIN_NAMESPACE
|
2011-07-06 15:52:23 -04:00
|
|
|
class QItemSelection;
|
2011-12-04 14:01:53 -03:00
|
|
|
class QMenu;
|
2012-05-06 16:41:35 -04:00
|
|
|
class QModelIndex;
|
2011-05-13 16:00:27 -04:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
2011-11-13 09:19:52 -03:00
|
|
|
/** Widget that shows a list of sending or receiving addresses.
|
|
|
|
*/
|
2011-07-07 11:33:15 -04:00
|
|
|
class AddressBookPage : public QDialog
|
2011-05-08 16:23:31 -04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2011-05-12 08:44:52 -04:00
|
|
|
|
2011-05-08 16:23:31 -04:00
|
|
|
public:
|
2011-06-13 06:07:32 -04:00
|
|
|
enum Tabs {
|
2011-05-12 08:44:52 -04:00
|
|
|
SendingTab = 0,
|
|
|
|
ReceivingTab = 1
|
2011-06-13 06:07:32 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum Mode {
|
2013-10-16 10:14:26 -03:00
|
|
|
ForSelection, /**< Open address book to pick address */
|
2011-11-13 09:19:52 -03:00
|
|
|
ForEditing /**< Open address book for editing */
|
2011-06-13 06:07:32 -04:00
|
|
|
};
|
|
|
|
|
2018-07-30 06:37:09 -04:00
|
|
|
explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent = nullptr);
|
2011-07-07 11:33:15 -04:00
|
|
|
~AddressBookPage();
|
2011-05-08 16:23:31 -04:00
|
|
|
|
2011-05-13 09:58:27 -04:00
|
|
|
void setModel(AddressTableModel *model);
|
2011-05-13 16:00:27 -04:00
|
|
|
const QString &getReturnValue() const { return returnValue; }
|
2011-07-07 11:33:15 -04:00
|
|
|
|
2015-07-14 08:59:05 -03:00
|
|
|
public Q_SLOTS:
|
2011-07-07 11:33:15 -04:00
|
|
|
void done(int retval);
|
|
|
|
|
2011-05-12 08:44:52 -04:00
|
|
|
private:
|
2011-07-07 11:33:15 -04:00
|
|
|
Ui::AddressBookPage *ui;
|
2011-05-13 09:58:27 -04:00
|
|
|
AddressTableModel *model;
|
2011-07-02 11:31:27 -04:00
|
|
|
Mode mode;
|
2011-07-07 11:33:15 -04:00
|
|
|
Tabs tab;
|
2011-05-13 16:00:27 -04:00
|
|
|
QString returnValue;
|
2018-01-03 13:00:18 -03:00
|
|
|
AddressBookSortFilterProxyModel *proxyModel;
|
2011-12-04 14:01:53 -03:00
|
|
|
QMenu *contextMenu;
|
2013-01-10 04:52:39 -03:00
|
|
|
QAction *deleteAction; // to be able to explicitly disable it
|
2012-05-06 16:41:35 -04:00
|
|
|
QString newAddressToSelect;
|
2011-05-13 16:00:27 -04:00
|
|
|
|
2015-07-14 08:59:05 -03:00
|
|
|
private Q_SLOTS:
|
2013-01-10 04:52:39 -03:00
|
|
|
/** Delete currently selected address entry */
|
2013-04-02 07:08:13 -03:00
|
|
|
void on_deleteAddress_clicked();
|
2013-01-10 04:52:39 -03:00
|
|
|
/** Create a new address for receiving coins and / or add a new address book entry */
|
2013-04-02 07:08:13 -03:00
|
|
|
void on_newAddress_clicked();
|
2011-12-04 14:01:53 -03:00
|
|
|
/** Copy address of currently selected address entry to clipboard */
|
2013-04-02 07:08:13 -03:00
|
|
|
void on_copyAddress_clicked();
|
2013-01-10 04:52:39 -03:00
|
|
|
/** Copy label of currently selected address entry to clipboard (no button) */
|
2011-12-04 14:01:53 -03:00
|
|
|
void onCopyLabelAction();
|
2013-01-10 04:52:39 -03:00
|
|
|
/** Edit currently selected address entry (no button) */
|
2011-12-04 14:01:53 -03:00
|
|
|
void onEditAction();
|
2013-04-12 07:24:41 -03:00
|
|
|
/** Export button clicked */
|
|
|
|
void on_exportButton_clicked();
|
2012-05-06 16:41:35 -04:00
|
|
|
|
2013-01-10 04:52:39 -03:00
|
|
|
/** Set button states based on selected tab and selection */
|
|
|
|
void selectionChanged();
|
|
|
|
/** Spawn contextual menu (right mouse menu) for address book entry */
|
|
|
|
void contextualMenu(const QPoint &point);
|
2012-05-06 16:41:35 -04:00
|
|
|
/** New entry/entries were added to address table */
|
2012-12-15 07:15:19 -03:00
|
|
|
void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/);
|
2012-07-08 12:48:56 -04:00
|
|
|
|
2015-07-14 08:59:05 -03:00
|
|
|
Q_SIGNALS:
|
2013-01-25 14:46:53 -03:00
|
|
|
void sendCoins(QString addr);
|
2011-05-08 16:23:31 -04:00
|
|
|
};
|
|
|
|
|
2014-11-03 12:16:40 -03:00
|
|
|
#endif // BITCOIN_QT_ADDRESSBOOKPAGE_H
|