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

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