You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

addressbookpage.h 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright (c) 2011-2015 The Bitcoin Core developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef BITCOIN_QT_ADDRESSBOOKPAGE_H
  5. #define BITCOIN_QT_ADDRESSBOOKPAGE_H
  6. #include <QDialog>
  7. class AddressTableModel;
  8. class OptionsModel;
  9. class PlatformStyle;
  10. namespace Ui {
  11. class AddressBookPage;
  12. }
  13. QT_BEGIN_NAMESPACE
  14. class QItemSelection;
  15. class QMenu;
  16. class QModelIndex;
  17. class QSortFilterProxyModel;
  18. class QTableView;
  19. QT_END_NAMESPACE
  20. /** Widget that shows a list of sending or receiving addresses.
  21. */
  22. class AddressBookPage : public QDialog
  23. {
  24. Q_OBJECT
  25. public:
  26. enum Tabs {
  27. SendingTab = 0,
  28. ReceivingTab = 1
  29. };
  30. enum Mode {
  31. ForSelection, /**< Open address book to pick address */
  32. ForEditing /**< Open address book for editing */
  33. };
  34. explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent);
  35. ~AddressBookPage();
  36. void setModel(AddressTableModel *model);
  37. const QString &getReturnValue() const { return returnValue; }
  38. public Q_SLOTS:
  39. void done(int retval);
  40. private:
  41. Ui::AddressBookPage *ui;
  42. AddressTableModel *model;
  43. Mode mode;
  44. Tabs tab;
  45. QString returnValue;
  46. QSortFilterProxyModel *proxyModel;
  47. QMenu *contextMenu;
  48. QAction *deleteAction; // to be able to explicitly disable it
  49. QString newAddressToSelect;
  50. private Q_SLOTS:
  51. /** Delete currently selected address entry */
  52. void on_deleteAddress_clicked();
  53. /** Create a new address for receiving coins and / or add a new address book entry */
  54. void on_newAddress_clicked();
  55. /** Copy address of currently selected address entry to clipboard */
  56. void on_copyAddress_clicked();
  57. /** Copy label of currently selected address entry to clipboard (no button) */
  58. void onCopyLabelAction();
  59. /** Edit currently selected address entry (no button) */
  60. void onEditAction();
  61. /** Export button clicked */
  62. void on_exportButton_clicked();
  63. /** Set button states based on selected tab and selection */
  64. void selectionChanged();
  65. /** Spawn contextual menu (right mouse menu) for address book entry */
  66. void contextualMenu(const QPoint &point);
  67. /** New entry/entries were added to address table */
  68. void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/);
  69. Q_SIGNALS:
  70. void sendCoins(QString addr);
  71. };
  72. #endif // BITCOIN_QT_ADDRESSBOOKPAGE_H