Browse Source

Implemented bookmarks for namespaces.

views
Just Wonder 5 years ago
parent
commit
7fc7f28f6c
  1. 4
      configure.ac
  2. 4
      src/Makefile.qt.include
  3. 2
      src/qt/bitcoin.qrc
  4. 2
      src/qt/bitcoingui.cpp
  5. 2
      src/qt/forms/kevabookmarksdialog.ui
  6. 660
      src/qt/forms/kevadialog.ui
  7. 60
      src/qt/forms/kevaeditbookmarkdialog.ui
  8. 55
      src/qt/kevabookmarksdialog.cpp
  9. 4
      src/qt/kevabookmarksdialog.h
  10. 10
      src/qt/kevabookmarksmodel.cpp
  11. 1
      src/qt/kevabookmarksmodel.h
  12. 70
      src/qt/kevadialog.cpp
  13. 3
      src/qt/kevadialog.h
  14. 53
      src/qt/kevaeditbookmarkdialog.cpp
  15. 41
      src/qt/kevaeditbookmarkdialog.h
  16. 6
      src/qt/kevamynamespacesdialog.cpp
  17. 1
      src/qt/kevamynamespacesdialog.h
  18. 5
      src/qt/kevatablemodel.cpp
  19. 39
      src/qt/locale/bitcoin_en.ts
  20. 6
      src/qt/locale/bitcoin_zh_CN.ts
  21. BIN
      src/qt/res/icons/keva.png
  22. BIN
      src/qt/res/icons/star.png
  23. BIN
      src/qt/res/icons/star_empty.png

4
configure.ac

@ -3,9 +3,9 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 16) define(_CLIENT_VERSION_MINOR, 16)
define(_CLIENT_VERSION_REVISION, 5) define(_CLIENT_VERSION_REVISION, 5)
define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_BUILD, 2)
define(_CLIENT_VERSION_IS_RELEASE, true) define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019) define(_COPYRIGHT_YEAR, 2020)
define(_COPYRIGHT_HOLDERS,[The %s developers]) define(_COPYRIGHT_HOLDERS,[The %s developers])
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Kevacoin Core]]) define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Kevacoin Core]])
AC_INIT([Kevacoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/kevacoin-project/kevacoin/issues],[kevacoin],[https://kevacoin.org/]) AC_INIT([Kevacoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/kevacoin-project/kevacoin/issues],[kevacoin],[https://kevacoin.org/])

4
src/Makefile.qt.include

@ -140,6 +140,7 @@ QT_FORMS_UI = \
qt/forms/kevaaddkeydialog.ui \ qt/forms/kevaaddkeydialog.ui \
qt/forms/kevabookmarksdialog.ui \ qt/forms/kevabookmarksdialog.ui \
qt/forms/kevanewnamespacedialog.ui \ qt/forms/kevanewnamespacedialog.ui \
qt/forms/kevaeditbookmarkdialog.ui \
qt/forms/kevamynamespacesdialog.ui \ qt/forms/kevamynamespacesdialog.ui \
qt/forms/debugwindow.ui \ qt/forms/debugwindow.ui \
qt/forms/sendcoinsdialog.ui \ qt/forms/sendcoinsdialog.ui \
@ -186,6 +187,7 @@ QT_MOC_CPP = \
qt/moc_kevaaddkeydialog.cpp \ qt/moc_kevaaddkeydialog.cpp \
qt/moc_kevabookmarksdialog.cpp \ qt/moc_kevabookmarksdialog.cpp \
qt/moc_kevanewnamespacedialog.cpp \ qt/moc_kevanewnamespacedialog.cpp \
qt/moc_kevaeditbookmarkdialog.cpp \
qt/moc_kevamynamespacesdialog.cpp \ qt/moc_kevamynamespacesdialog.cpp \
qt/moc_rpcconsole.cpp \ qt/moc_rpcconsole.cpp \
qt/moc_sendcoinsdialog.cpp \ qt/moc_sendcoinsdialog.cpp \
@ -281,6 +283,7 @@ BITCOIN_QT_H = \
qt/kevaaddkeydialog.h \ qt/kevaaddkeydialog.h \
qt/kevabookmarksdialog.h \ qt/kevabookmarksdialog.h \
qt/kevanewnamespacedialog.h \ qt/kevanewnamespacedialog.h \
qt/kevaeditbookmarkdialog.h \
qt/kevamynamespacesdialog.h \ qt/kevamynamespacesdialog.h \
qt/utilitydialog.h \ qt/utilitydialog.h \
qt/walletframe.h \ qt/walletframe.h \
@ -405,6 +408,7 @@ BITCOIN_QT_WALLET_CPP = \
qt/kevaaddkeydialog.cpp \ qt/kevaaddkeydialog.cpp \
qt/kevabookmarksdialog.cpp \ qt/kevabookmarksdialog.cpp \
qt/kevanewnamespacedialog.cpp \ qt/kevanewnamespacedialog.cpp \
qt/kevaeditbookmarkdialog.cpp \
qt/kevamynamespacesdialog.cpp \ qt/kevamynamespacesdialog.cpp \
qt/walletframe.cpp \ qt/walletframe.cpp \
qt/walletmodel.cpp \ qt/walletmodel.cpp \

2
src/qt/bitcoin.qrc

@ -55,6 +55,8 @@
<file alias="hd_enabled">res/icons/hd_enabled.png</file> <file alias="hd_enabled">res/icons/hd_enabled.png</file>
<file alias="hd_disabled">res/icons/hd_disabled.png</file> <file alias="hd_disabled">res/icons/hd_disabled.png</file>
<file alias="network_disabled">res/icons/network_disabled.png</file> <file alias="network_disabled">res/icons/network_disabled.png</file>
<file alias="star">res/icons/star.png</file>
<file alias="star_empty">res/icons/star_empty.png</file>
</qresource> </qresource>
<qresource prefix="/movies"> <qresource prefix="/movies">
<file alias="spinner-000">res/movies/spinner-000.png</file> <file alias="spinner-000">res/movies/spinner-000.png</file>

2
src/qt/bitcoingui.cpp

@ -313,7 +313,7 @@ void BitcoinGUI::createActions()
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction); tabGroup->addAction(historyAction);
kevaAction = new QAction(platformStyle->SingleColorIcon(":/icons/keva"), tr("&Keva"), this); kevaAction = new QAction(QIcon(":/icons/keva"), tr("&Keva"), this);
kevaAction->setStatusTip(tr("Keva related operations")); kevaAction->setStatusTip(tr("Keva related operations"));
kevaAction->setToolTip(kevaAction->statusTip()); kevaAction->setToolTip(kevaAction->statusTip());
kevaAction->setCheckable(true); kevaAction->setCheckable(true);

2
src/qt/forms/kevabookmarksdialog.ui

@ -33,7 +33,7 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel</set> <set>QDialogButtonBox::Save|QDialogButtonBox::Ok|QDialogButtonBox::Close</set>
</property> </property>
</widget> </widget>
</item> </item>

660
src/qt/forms/kevadialog.ui

@ -1,329 +1,361 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>KevaDialog</class> <class>KevaDialog</class>
<widget class="QWidget" name="KevaDialog"> <widget class="QWidget" name="KevaDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>776</width> <width>776</width>
<height>396</height> <height>396</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1"> <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
<item>
<widget class="QFrame" name="frame2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <widget class="QFrame" name="frame2">
<item row="4" column="2"> <property name="sizePolicy">
<widget class="QLineEdit" name="nameSpace"> <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<property name="toolTip">
<string>The namespace ID with a prefix "N".</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Use this form to perform Keva database operations.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>The namespace ID with a prefix "N".</string>
</property>
<property name="text">
<string>Namespace:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>namespace</cstring>
</property>
</widget>
</item>
<item row="7" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="showContent">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show content of the namespace.</string>
</property>
<property name="text">
<string>Show</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/eye</normaloff>:/icons/eye</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="createNamespace">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Create a new namespace</string>
</property>
<property name="text">
<string>&amp;Create namespace</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/add</normaloff>:/icons/add</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="listNamespaces">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property>
<property name="toolTip">
<string>List my namespaces</string>
</property>
<property name="text">
<string>&amp;My Namespaces</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/editpaste</normaloff>:/icons/editpaste</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bookmarksButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show bookmarks</string>
</property>
<property name="text">
<string>&amp;Bookmarks</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/address-book</normaloff>:/icons/address-book</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Content of namespace</string>
</property>
</widget>
</item>
<item>
<widget class="QTableView" name="kevaView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="showValueButton">
<property name="enabled">
<bool>false</bool>
</property> </property>
<property name="toolTip"> <property name="frameShape">
<string>Show the selected request (does the same as double clicking an entry)</string> <enum>QFrame::StyledPanel</enum>
</property> </property>
<property name="text"> <property name="frameShadow">
<string>Show</string> <enum>QFrame::Sunken</enum>
</property> </property>
<property name="icon"> <layout class="QVBoxLayout" name="verticalLayout_3">
<iconset resource="../bitcoin.qrc"> <item>
<normaloff>:/icons/edit</normaloff>:/icons/edit</iconset> <layout class="QGridLayout" name="gridLayout">
</property> <item row="4" column="2">
<property name="autoDefault"> <layout class="QHBoxLayout" name="nsHLayout">
<bool>false</bool> <item>
</property> <widget class="QLineEdit" name="nameSpace">
</widget> <property name="toolTip">
</item> <string>The namespace ID with a prefix "N".</string>
<item> </property>
<widget class="QPushButton" name="removeButton"> <property name="maximumWidth">
<property name="enabled"> <number>600</number>
<bool>false</bool> </property>
</property> </widget>
<property name="toolTip"> </item>
<string>Remove the selected entries from the list</string> <item>
</property> <widget class="QPushButton" name="bookmarkNamespace">
<property name="text"> <property name="toolTip">
<string>Remove</string> <string>Bookmark this namespace</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../bitcoin.qrc"> <iconset resource="../bitcoin.qrc">
<normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> <normaloff>:/icons/star_empty</normaloff>:/icons/star_empty
</property> </iconset>
<property name="autoDefault"> </property>
<bool>false</bool> </widget>
</property> </item>
</widget> <item>
</item> <spacer name="horizontalBookmarkSpacer">
<item> <property name="orientation">
<widget class="QPushButton" name="addKVButton"> <enum>Qt::Horizontal</enum>
<property name="enabled"> </property>
<bool>false</bool> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<property name="toolTip"> <horstretch>0</horstretch>
<string>Add new key-value pair</string> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="text"> </property>
<string>Add key-value</string> </spacer>
</item>
</layout>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Use this form to perform Keva database operations.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>The namespace ID with a prefix "N".</string>
</property>
<property name="text">
<string>Namespace:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>namespace</cstring>
</property>
</widget>
</item>
<item row="7" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="showContent">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show content of the namespace.</string>
</property>
<property name="text">
<string>Show</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/eye</normaloff>:/icons/eye</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="createNamespace">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Create a new namespace</string>
</property>
<property name="text">
<string>&amp;Create namespace</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/add</normaloff>:/icons/add</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="listNamespaces">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>List my namespaces</string>
</property>
<property name="text">
<string>&amp;My Namespaces</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/editpaste</normaloff>:/icons/editpaste</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bookmarksButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show bookmarks</string>
</property>
<property name="text">
<string>&amp;Bookmarks</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/address-book</normaloff>:/icons/address-book</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property> </property>
<property name="icon"> <property name="sizeHint" stdset="0">
<iconset resource="../bitcoin.qrc"> <size>
<normaloff>:/icons/add</normaloff>:/icons/add</iconset> <width>20</width>
<height>10</height>
</size>
</property> </property>
<property name="autoDefault"> </spacer>
<bool>false</bool> </item>
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
</widget> <property name="frameShape">
</item> <enum>QFrame::StyledPanel</enum>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="frameShadow">
<size> <enum>QFrame::Raised</enum>
<width>40</width>
<height>20</height>
</size>
</property> </property>
</spacer> <layout class="QVBoxLayout" name="verticalLayout_2">
</item> <item>
</layout> <widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Content of namespace</string>
</property>
</widget>
</item>
<item>
<widget class="QTableView" name="kevaView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="showValueButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Show the selected request (does the same as double clicking an entry)</string>
</property>
<property name="text">
<string>Show</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/edit</normaloff>:/icons/edit</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remove the selected entries from the list</string>
</property>
<property name="text">
<string>Remove</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/remove</normaloff>:/icons/remove</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="addKVButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Add new key-value pair</string>
</property>
<property name="text">
<string>Add key-value</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/add</normaloff>:/icons/add</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> <customwidgets>
</layout> <customwidget>
</widget> <class>BitcoinAmountField</class>
<customwidgets> <extends>QLineEdit</extends>
<customwidget> <header>qt/bitcoinamountfield.h</header>
<class>BitcoinAmountField</class> <container>1</container>
<extends>QLineEdit</extends> </customwidget>
<header>qt/bitcoinamountfield.h</header> </customwidgets>
<container>1</container> <tabstops>
</customwidget> <tabstop>reqMessage</tabstop>
</customwidgets> <tabstop>receiveButton</tabstop>
<tabstops> <tabstop>clearButton</tabstop>
<tabstop>reqMessage</tabstop> <tabstop>recentRequestsView</tabstop>
<tabstop>receiveButton</tabstop> <tabstop>showValueButton</tabstop>
<tabstop>clearButton</tabstop> <tabstop>removeButton</tabstop>
<tabstop>recentRequestsView</tabstop> </tabstops>
<tabstop>showValueButton</tabstop> <resources>
<tabstop>removeButton</tabstop> <include location="../bitcoin.qrc"/>
</tabstops> </resources>
<resources> <connections/>
<include location="../bitcoin.qrc"/>
</resources>
<connections/>
</ui> </ui>

60
src/qt/forms/kevaeditbookmarkdialog.ui

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KevaEditBookmarkDialog</class>
<widget class="QDialog" name="KevaEditBookmarkDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>100</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">Bookmark Name</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>Bookmark name.</string>
</property>
<property name="text">
<string>Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>bookmarkName</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="bookmarkName">
<property name="toolTip">
<string>This pane allows change of bookmark name</string>
</property>
<property name="readOnly">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
</ui>

55
src/qt/kevabookmarksdialog.cpp

@ -4,6 +4,7 @@
#include <qt/kevabookmarksdialog.h> #include <qt/kevabookmarksdialog.h>
#include <qt/forms/ui_kevabookmarksdialog.h> #include <qt/forms/ui_kevabookmarksdialog.h>
#include <qt/kevaeditbookmarkdialog.h>
#include <qt/kevabookmarksmodel.h> #include <qt/kevabookmarksmodel.h>
#include <qt/kevadialog.h> #include <qt/kevadialog.h>
@ -16,10 +17,14 @@ KevaBookmarksDialog::KevaBookmarksDialog(QWidget *parent) :
ui(new Ui::KevaBookmarksDialog) ui(new Ui::KevaBookmarksDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::Apply)->setText(tr("Show")); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("&Show"));
connect(ui->buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply())); ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::Save)->setText(tr("&Edit"));
connect(ui->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(reject()));
connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(apply()));
connect(ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(rename()));
} }
void KevaBookmarksDialog::setModel(WalletModel *_model) void KevaBookmarksDialog::setModel(WalletModel *_model)
@ -48,7 +53,8 @@ void KevaBookmarksDialog::setModel(WalletModel *_model)
void KevaBookmarksDialog::namespaceView_selectionChanged() void KevaBookmarksDialog::namespaceView_selectionChanged()
{ {
bool enable = !ui->namespaceView->selectionModel()->selectedRows().isEmpty(); bool enable = !ui->namespaceView->selectionModel()->selectedRows().isEmpty();
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(enable); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(enable);
if (enable) { if (enable) {
selectedIndex = ui->namespaceView->selectionModel()->currentIndex(); selectedIndex = ui->namespaceView->selectionModel()->currentIndex();
@ -58,6 +64,12 @@ void KevaBookmarksDialog::namespaceView_selectionChanged()
} }
} }
void KevaBookmarksDialog::on_namespaceView_doubleClicked(const QModelIndex &index)
{
selectedIndex = index;
this->apply();
}
void KevaBookmarksDialog::apply() void KevaBookmarksDialog::apply()
{ {
QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaBookmarksModel::Id); QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaBookmarksModel::Id);
@ -67,6 +79,39 @@ void KevaBookmarksDialog::apply()
QDialog::close(); QDialog::close();
} }
void KevaBookmarksDialog::rename()
{
QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaBookmarksModel::Id);
QString idStr = idIdx.data(Qt::DisplayRole).toString();
QModelIndex nameIdx = selectedIndex.sibling(selectedIndex.row(), KevaBookmarksModel::Name);
QString nameStr = nameIdx.data(Qt::DisplayRole).toString();
KevaEditBookmarkDialog *dialog = new KevaEditBookmarkDialog(this, idStr, nameStr);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
void KevaBookmarksDialog::saveName(const QString& id, const QString& name)
{
QJsonArray array;
KevaBookmarksModel* bookmarksModel = this->model->getKevaBookmarksModel();
bookmarksModel->loadBookmarks(array);
for (int i = 0; i < array.size(); ++i) {
QJsonObject obj = array[i].toObject();
BookmarkEntry entry;
QString idStr = obj["id"].toString();
if (idStr == id) {
QJsonObject entry;
entry["id"] = id;
entry["name"] = name;
array.replace(i, entry);
break;
}
}
bookmarksModel->saveBookmarks(array);
bookmarksModel->loadBookmarks();
}
void KevaBookmarksDialog::reject() void KevaBookmarksDialog::reject()
{ {
QDialog::reject(); QDialog::reject();

4
src/qt/kevabookmarksdialog.h

@ -18,7 +18,6 @@ namespace Ui {
class KevaBookmarksDialog; class KevaBookmarksDialog;
} }
/** Dialog showing namepsace creation. */ /** Dialog showing namepsace creation. */
class KevaBookmarksDialog : public QDialog class KevaBookmarksDialog : public QDialog
{ {
@ -38,9 +37,12 @@ public:
public Q_SLOTS: public Q_SLOTS:
void apply(); void apply();
void reject(); void reject();
void rename();
void saveName(const QString& id, const QString& name);
private Q_SLOTS: private Q_SLOTS:
void namespaceView_selectionChanged(); void namespaceView_selectionChanged();
void on_namespaceView_doubleClicked(const QModelIndex &index);
private: private:
Ui::KevaBookmarksDialog *ui; Ui::KevaBookmarksDialog *ui;

10
src/qt/kevabookmarksmodel.cpp

@ -146,6 +146,16 @@ void KevaBookmarksModel::setBookmarks(QJsonArray &array)
setBookmarks(std::move(vBookmarEntries)); setBookmarks(std::move(vBookmarEntries));
} }
bool KevaBookmarksModel::isBookmarked(std::string& ns)
{
for (int i = 0; i < list.size(); ++i) {
if (list.at(i).id == ns) {
return true;
}
}
return false;
}
void KevaBookmarksModel::sort(int column, Qt::SortOrder order) void KevaBookmarksModel::sort(int column, Qt::SortOrder order)
{ {
qSort(list.begin(), list.end(), BookmarkEntryLessThan(column, order)); qSort(list.begin(), list.end(), BookmarkEntryLessThan(column, order));

1
src/qt/kevabookmarksmodel.h

@ -74,6 +74,7 @@ public:
int loadBookmarks(); int loadBookmarks();
int loadBookmarks(QJsonArray &json); int loadBookmarks(QJsonArray &json);
int saveBookmarks(QJsonArray &json); int saveBookmarks(QJsonArray &json);
bool isBookmarked(std::string& ns);
public Q_SLOTS: public Q_SLOTS:
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);

70
src/qt/kevadialog.cpp

@ -55,6 +55,15 @@ KevaDialog::KevaDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QAction *copyMessageAction = new QAction(tr("Copy message"), this); QAction *copyMessageAction = new QAction(tr("Copy message"), this);
QAction *copyAmountAction = new QAction(tr("Copy amount"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
bookmarks = new KevaBookmarksModel(NULL, NULL);
bookmarks->loadBookmarks();
ui->kevaView->setTextElideMode(Qt::ElideRight);
ui->kevaView->setWordWrap(false);
QHeaderView *verticalHeader = ui->kevaView->verticalHeader();
verticalHeader->setSectionResizeMode(QHeaderView::Fixed);
verticalHeader->setDefaultSectionSize(36);
// context menu // context menu
contextMenu = new QMenu(this); contextMenu = new QMenu(this);
contextMenu->addAction(copyURIAction); contextMenu->addAction(copyURIAction);
@ -147,10 +156,23 @@ void KevaDialog::onNamespaceChanged(const QString& nameSpace)
{ {
std::string namespaceStr = nameSpace.toStdString(); std::string namespaceStr = nameSpace.toStdString();
valtype nameSpaceVal; valtype nameSpaceVal;
bool isValidNamespace = false;
if (DecodeKevaNamespace(namespaceStr, Params(), nameSpaceVal)) { if (DecodeKevaNamespace(namespaceStr, Params(), nameSpaceVal)) {
ui->addKVButton->setEnabled(true); ui->addKVButton->setEnabled(true);
isValidNamespace = true;
} else { } else {
ui->addKVButton->setEnabled(false); ui->addKVButton->setEnabled(false);
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star_empty"));
}
if (!isValidNamespace) {
return;
}
if (bookmarks->isBookmarked(namespaceStr)) {
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star"));
} else {
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star_empty"));
} }
} }
@ -213,6 +235,54 @@ void KevaDialog::on_kevaView_doubleClicked(const QModelIndex &index)
dialog->show(); dialog->show();
} }
void KevaDialog::on_bookmarkNamespace_clicked()
{
valtype namespaceVal;
QString nameSpace = ui->nameSpace->text();
std::string namespaceStr = nameSpace.toStdString();
if (!DecodeKevaNamespace(namespaceStr, Params(), namespaceVal)) {
return;
}
QJsonArray array;
bookmarks->loadBookmarks(array);
int index = -1;
for (int i = 0; i < array.size(); ++i) {
QJsonObject obj = array[i].toObject();
BookmarkEntry entry;
std::string id = obj["id"].toString().toStdString();
if (id == namespaceStr) {
index = i;
break;
}
}
if (index >= 0) {
// Remove bookmark
array.removeAt(index);
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star_empty"));
} else {
// Add bookmark
QJsonObject entry;
entry["id"] = namespaceStr.c_str();
entry["name"] = "";
std::vector<NamespaceEntry> vNamespaceEntries;
this->model->getNamespaceEntries(vNamespaceEntries);
for(auto it = vNamespaceEntries.begin(); it != vNamespaceEntries.end(); it++) {
if ((*it).id == namespaceStr) {
entry["name"] = (*it).name.c_str();
break;
}
}
array.prepend(entry);
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star"));
}
bookmarks->saveBookmarks(array);
}
void KevaDialog::kevaView_selectionChanged() void KevaDialog::kevaView_selectionChanged()
{ {
// Enable Show/Remove buttons only if anything is selected. // Enable Show/Remove buttons only if anything is selected.

3
src/qt/kevadialog.h

@ -17,6 +17,7 @@
class PlatformStyle; class PlatformStyle;
class WalletModel; class WalletModel;
class KevaBookmarksModel;
namespace Ui { namespace Ui {
class KevaDialog; class KevaDialog;
@ -62,6 +63,7 @@ private:
WalletModel *model; WalletModel *model;
QMenu *contextMenu; QMenu *contextMenu;
const PlatformStyle *platformStyle; const PlatformStyle *platformStyle;
KevaBookmarksModel* bookmarks;
QModelIndex selectedRow(); QModelIndex selectedRow();
void copyColumnToClipboard(int column); void copyColumnToClipboard(int column);
@ -77,6 +79,7 @@ private Q_SLOTS:
void on_kevaView_doubleClicked(const QModelIndex &index); void on_kevaView_doubleClicked(const QModelIndex &index);
void kevaView_selectionChanged(); void kevaView_selectionChanged();
void on_bookmarksButton_clicked(); void on_bookmarksButton_clicked();
void on_bookmarkNamespace_clicked();
void updateDisplayUnit(); void updateDisplayUnit();
void showMenu(const QPoint &point); void showMenu(const QPoint &point);
void copyURI(); void copyURI();

53
src/qt/kevaeditbookmarkdialog.cpp

@ -0,0 +1,53 @@
// Copyright (c) 2011-2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <qt/kevaeditbookmarkdialog.h>
#include <qt/forms/ui_kevaeditbookmarkdialog.h>
#include <qt/kevabookmarksdialog.h>
#include <qt/kevatablemodel.h>
#include <qt/kevadialog.h>
#include <QPushButton>
#include <QModelIndex>
KevaEditBookmarkDialog::KevaEditBookmarkDialog(QWidget *parent, const QString& id, const QString& name) :
QDialog(parent), id(id), name(name),
ui(new Ui::KevaEditBookmarkDialog)
{
ui->setupUi(this);
ui->bookmarkName->setText(name);
this->parentDialog = (KevaBookmarksDialog*)parent;
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(close()));
connect(ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(save()));
connect(ui->bookmarkName, SIGNAL(textChanged(const QString &)), this, SLOT(onNameChanged(const QString &)));
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
}
void KevaEditBookmarkDialog::onNameChanged(const QString & name)
{
int length = name.length();
bool enabled = length > 0;
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(enabled);
this->name = name;
}
void KevaEditBookmarkDialog::save()
{
KevaDialog* dialog = (KevaDialog*)this->parentWidget();
QString bookmarkText = ui->bookmarkName->text();
this->parentDialog->saveName(id, name);
QDialog::close();
}
void KevaEditBookmarkDialog::close()
{
QDialog::close();
}
KevaEditBookmarkDialog::~KevaEditBookmarkDialog()
{
delete ui;
}

41
src/qt/kevaeditbookmarkdialog.h

@ -0,0 +1,41 @@
// Copyright (c) 2011-2014 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_KEVAEDITBOOKMARKDIALOG_H
#define BITCOIN_QT_KEVAEDITBOOKMARKDIALOG_H
#include <QObject>
#include <QString>
#include <QDialog>
namespace Ui {
class KevaEditBookmarkDialog;
}
class KevaBookmarksDialog;
/** Dialog showing namepsace creation. */
class KevaEditBookmarkDialog : public QDialog
{
Q_OBJECT
public:
explicit KevaEditBookmarkDialog(QWidget *parent, const QString& id, const QString& name);
~KevaEditBookmarkDialog();
public Q_SLOTS:
void save();
void close();
void onNameChanged(const QString & ns);
private:
Ui::KevaEditBookmarkDialog *ui;
QString id;
QString name;
KevaBookmarksDialog* parentDialog;
};
#endif // BITCOIN_QT_KEVAEDITBOOKMARKDIALOG_H

6
src/qt/kevamynamespacesdialog.cpp

@ -60,6 +60,12 @@ void KevaMyNamespacesDialog::namespaceView_selectionChanged()
} }
} }
void KevaMyNamespacesDialog::on_namespaceView_doubleClicked(const QModelIndex &index)
{
selectedIndex = ui->namespaceView->selectionModel()->currentIndex();
this->apply();
}
void KevaMyNamespacesDialog::apply() void KevaMyNamespacesDialog::apply()
{ {
QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaNamespaceModel::Id); QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaNamespaceModel::Id);

1
src/qt/kevamynamespacesdialog.h

@ -41,6 +41,7 @@ public Q_SLOTS:
private Q_SLOTS: private Q_SLOTS:
void namespaceView_selectionChanged(); void namespaceView_selectionChanged();
void on_namespaceView_doubleClicked(const QModelIndex &index);
private: private:
Ui::KevaMyNamespacesDialog *ui; Ui::KevaMyNamespacesDialog *ui;

5
src/qt/kevatablemodel.cpp

@ -75,6 +75,11 @@ QVariant KevaTableModel::data(const QModelIndex &index, int role) const
{ {
if (index.column() == Block) if (index.column() == Block)
return (int)(Qt::AlignRight|Qt::AlignVCenter); return (int)(Qt::AlignRight|Qt::AlignVCenter);
else if (index.column() == Value) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
return (int)(Qt::AlignLeft|Qt::AlignTop);
#endif
}
} }
return QVariant(); return QVariant();
} }

39
src/qt/locale/bitcoin_en.ts

@ -1181,8 +1181,8 @@
<context> <context>
<name>KevaBookmarksDialog</name> <name>KevaBookmarksDialog</name>
<message> <message>
<location filename="../kevabookmarksdialog.cpp" line="+20"/> <location filename="../kevabookmarksdialog.cpp" line="+23"/>
<source>Show</source> <source>&amp;Edit</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
@ -1215,7 +1215,7 @@
<context> <context>
<name>KevaDialog</name> <name>KevaDialog</name>
<message> <message>
<location filename="../forms/kevadialog.ui" line="+235"/> <location filename="../forms/kevadialog.ui" line="+267"/>
<source>Show the selected request (does the same as double clicking an entry)</source> <source>Show the selected request (does the same as double clicking an entry)</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1226,13 +1226,18 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-204"/> <location line="-234"/>
<location line="+14"/> <location line="+44"/>
<source>The namespace ID with a prefix &quot;N&quot;.</source> <source>The namespace ID with a prefix &quot;N&quot;.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="-7"/> <location line="-34"/>
<source>Bookmark this namespace</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+27"/>
<source>Use this form to perform Keva database operations.</source> <source>Use this form to perform Keva database operations.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -1322,7 +1327,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+192"/> <location line="+259"/>
<source>Warning</source> <source>Warning</source>
<translation type="unfinished">Warning</translation> <translation type="unfinished">Warning</translation>
</message> </message>
@ -1376,6 +1381,24 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </context>
<context>
<name>KevaEditBookmarkDialog</name>
<message>
<location filename="../forms/kevaeditbookmarkdialog.ui" line="+22"/>
<source>Bookmark name.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+13"/>
<source>This pane allows change of bookmark name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context> <context>
<name>KevaMyNamespacesDialog</name> <name>KevaMyNamespacesDialog</name>
<message> <message>
@ -1438,7 +1461,7 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location line="+81"/> <location line="+88"/>
<source>Requested</source> <source>Requested</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

6
src/qt/locale/bitcoin_zh_CN.ts

@ -925,9 +925,13 @@
<context> <context>
<name>KevaBookmarksDialog</name> <name>KevaBookmarksDialog</name>
<message> <message>
<source>Show</source> <source>&amp;Show</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>&amp;Edit</source>
<translation></translation>
</message>
</context> </context>
<context> <context>
<name>KevaBookmarksModel</name> <name>KevaBookmarksModel</name>

BIN
src/qt/res/icons/keva.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
src/qt/res/icons/star.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
src/qt/res/icons/star_empty.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Loading…
Cancel
Save