lbrycrd/src/qt/addressbookpage.h

88 lines
2.4 KiB
C
Raw Normal View History

// Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2011-07-07 17:33:15 +02:00
#ifndef ADDRESSBOOKPAGE_H
#define ADDRESSBOOKPAGE_H
2011-05-08 22:23:31 +02:00
#include <QDialog>
class AddressTableModel;
class OptionsModel;
2011-05-12 14:44:52 +02:00
namespace Ui {
2011-07-07 17:33:15 +02:00
class AddressBookPage;
2011-05-12 14:44:52 +02:00
}
2011-05-13 22:00:27 +02:00
QT_BEGIN_NAMESPACE
class QItemSelection;
class QMenu;
class QModelIndex;
class QSortFilterProxyModel;
class QTableView;
2011-05-13 22:00:27 +02:00
QT_END_NAMESPACE
2011-11-13 13:19:52 +01:00
/** Widget that shows a list of sending or receiving addresses.
*/
2011-07-07 17:33:15 +02:00
class AddressBookPage : public QDialog
2011-05-08 22:23:31 +02:00
{
Q_OBJECT
2011-05-12 14:44:52 +02:00
2011-05-08 22:23:31 +02:00
public:
enum Tabs {
2011-05-12 14:44:52 +02:00
SendingTab = 0,
ReceivingTab = 1
};
enum Mode {
2013-10-16 15:14:26 +02:00
ForSelection, /**< Open address book to pick address */
2011-11-13 13:19:52 +01:00
ForEditing /**< Open address book for editing */
};
explicit AddressBookPage(Mode mode, Tabs tab, QWidget *parent);
2011-07-07 17:33:15 +02:00
~AddressBookPage();
2011-05-08 22:23:31 +02:00
void setModel(AddressTableModel *model);
2011-05-13 22:00:27 +02:00
const QString &getReturnValue() const { return returnValue; }
2011-07-07 17:33:15 +02:00
public slots:
void done(int retval);
2011-05-12 14:44:52 +02:00
private:
2011-07-07 17:33:15 +02:00
Ui::AddressBookPage *ui;
AddressTableModel *model;
Mode mode;
2011-07-07 17:33:15 +02:00
Tabs tab;
2011-05-13 22:00:27 +02:00
QString returnValue;
QSortFilterProxyModel *proxyModel;
QMenu *contextMenu;
QAction *deleteAction; // to be able to explicitly disable it
QString newAddressToSelect;
2011-05-13 22:00:27 +02:00
2011-05-12 17:55:24 +02:00
private slots:
/** Delete currently selected address entry */
void on_deleteAddress_clicked();
/** Create a new address for receiving coins and / or add a new address book entry */
void on_newAddress_clicked();
/** Copy address of currently selected address entry to clipboard */
void on_copyAddress_clicked();
/** Copy label of currently selected address entry to clipboard (no button) */
void onCopyLabelAction();
/** Edit currently selected address entry (no button) */
void onEditAction();
/** Export button clicked */
void on_exportButton_clicked();
/** 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);
/** New entry/entries were added to address table */
void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/);
signals:
void sendCoins(QString addr);
2011-05-08 22:23:31 +02:00
};
#endif // ADDRESSBOOKPAGE_H