mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-08-26 14:32:17 +00:00
Allowed updating bookmark name.
This commit is contained in:
parent
bdcee37f49
commit
5e5867c3b6
@ -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 \
|
||||||
|
60
src/qt/forms/kevaeditbookmarkdialog.ui
Normal file
60
src/qt/forms/kevaeditbookmarkdialog.ui
Normal file
@ -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>
|
@ -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,9 +17,10 @@ KevaBookmarksDialog::KevaBookmarksDialog(QWidget *parent) :
|
|||||||
ui(new Ui::KevaBookmarksDialog)
|
ui(new Ui::KevaBookmarksDialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
|
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
|
||||||
ui->buttonBox->button(QDialogButtonBox::Save)->setText(tr("Edit"));
|
ui->buttonBox->button(QDialogButtonBox::Save)->setText(tr("&Edit"));
|
||||||
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
|
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
|
||||||
connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(apply()));
|
connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(apply()));
|
||||||
connect(ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(rename()));
|
connect(ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(rename()));
|
||||||
@ -78,6 +80,35 @@ void KevaBookmarksDialog::apply()
|
|||||||
|
|
||||||
void KevaBookmarksDialog::rename()
|
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()
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
@ -39,6 +38,7 @@ public Q_SLOTS:
|
|||||||
void apply();
|
void apply();
|
||||||
void reject();
|
void reject();
|
||||||
void rename();
|
void rename();
|
||||||
|
void saveName(const QString& id, const QString& name);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void namespaceView_selectionChanged();
|
void namespaceView_selectionChanged();
|
||||||
|
53
src/qt/kevaeditbookmarkdialog.cpp
Normal file
53
src/qt/kevaeditbookmarkdialog.cpp
Normal file
@ -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
Normal file
41
src/qt/kevaeditbookmarkdialog.h
Normal file
@ -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
|
@ -76,7 +76,7 @@ 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) {
|
else if (index.column() == Value) {
|
||||||
#if (QT_VERSION <= QT_VERSION_CHECK(5, 9, 5))
|
#if (QT_VERSION <= QT_VERSION_CHECK(5, 12, 0))
|
||||||
return (int)(Qt::AlignLeft|Qt::AlignVCenter);
|
return (int)(Qt::AlignLeft|Qt::AlignVCenter);
|
||||||
#else
|
#else
|
||||||
return (int)(Qt::AlignLeft|Qt::AlignTop);
|
return (int)(Qt::AlignLeft|Qt::AlignTop);
|
||||||
|
@ -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>&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 "N".</source>
|
<source>The namespace ID with a prefix "N".</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>
|
||||||
|
@ -928,6 +928,10 @@
|
|||||||
<source>Show</source>
|
<source>Show</source>
|
||||||
<translation>显示</translation>
|
<translation>显示</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>&Edit</source>
|
||||||
|
<translation>编辑</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>KevaBookmarksModel</name>
|
<name>KevaBookmarksModel</name>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user