lbrycrd/src/qt/addressbookpage.h

94 lines
2.8 KiB
C
Raw Normal View History

2011-07-07 17:33:15 +02:00
#ifndef ADDRESSBOOKPAGE_H
#define ADDRESSBOOKPAGE_H
2011-05-08 22:23:31 +02:00
#include <QDialog>
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
}
class AddressTableModel;
class OptionsModel;
2011-05-12 14:44:52 +02:00
2011-05-13 22:00:27 +02:00
QT_BEGIN_NAMESPACE
class QTableView;
class QItemSelection;
class QSortFilterProxyModel;
class QMenu;
class QModelIndex;
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 {
2011-11-13 13:19:52 +01:00
ForSending, /**< Open address book to pick address for sending */
ForEditing /**< Open address book for editing */
};
2011-07-07 17:33:15 +02:00
explicit AddressBookPage(Mode mode, Tabs tab, QWidget *parent = 0);
~AddressBookPage();
2011-05-08 22:23:31 +02:00
void setModel(AddressTableModel *model);
void setOptionsModel(OptionsModel *optionsModel);
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);
void exportClicked();
2011-07-07 17:33:15 +02:00
2011-05-12 14:44:52 +02:00
private:
2011-07-07 17:33:15 +02:00
Ui::AddressBookPage *ui;
AddressTableModel *model;
OptionsModel *optionsModel;
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 */
2011-05-13 22:00:27 +02:00
void on_deleteButton_clicked();
/** Create a new address for receiving coins and / or add a new address book entry */
2011-05-12 17:55:24 +02:00
void on_newAddressButton_clicked();
/** Copy address of currently selected address entry to clipboard */
2011-05-12 17:55:24 +02:00
void on_copyToClipboard_clicked();
/** Open the sign message tab in the Sign/Verify Message dialog with currently selected address */
void on_signMessage_clicked();
/** Open the verify message tab in the Sign/Verify Message dialog with currently selected address */
void on_verifyMessage_clicked();
/** Open send coins dialog for currently selected address (no button) */
void onSendCoins_clicked();
/** Generate a QR Code from the currently selected address */
void on_showQRCode_clicked();
/** Copy label of currently selected address entry to clipboard (no button) */
void onCopyLabelAction();
/** Edit currently selected address entry (no button) */
void onEditAction();
/** 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 signMessage(QString addr);
void verifyMessage(QString addr);
void sendCoins(QString addr);
2011-05-08 22:23:31 +02:00
};
#endif // ADDRESSBOOKPAGE_H