diff --git a/src/qt/forms/kevaaddkeydialog.ui b/src/qt/forms/kevaaddkeydialog.ui
index 66d7f1ffc..3e98a5b70 100644
--- a/src/qt/forms/kevaaddkeydialog.ui
+++ b/src/qt/forms/kevaaddkeydialog.ui
@@ -11,7 +11,7 @@
- Add New Key-Value Pair
+ Create new record
-
diff --git a/src/qt/forms/kevadetaildialog.ui b/src/qt/forms/kevadetaildialog.ui
index 6bb86bbd8..8c1df56a0 100644
--- a/src/qt/forms/kevadetaildialog.ui
+++ b/src/qt/forms/kevadetaildialog.ui
@@ -15,13 +15,56 @@
-
-
-
- This pane shows the value associated with a give key
-
-
- false
+
+
+
+
+
+
+
+
+
+ true
+
+
+ Qt::AlignLeft
+
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+ Qt::PlainText
+
+
+
+ -
+
+
+ true
+
+
+
+
+
+ true
+
+
+ Qt::AlignLeft
+
+
+ Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse
+
+
+
+ Qt::PlainText
+
+
-
@@ -30,7 +73,7 @@
Qt::Horizontal
- QDialogButtonBox::Close|QDialogButtonBox::Save
+ QDialogButtonBox::Close
diff --git a/src/qt/forms/kevadialog.ui b/src/qt/forms/kevadialog.ui
index 5f4aa9c88..20baef053 100644
--- a/src/qt/forms/kevadialog.ui
+++ b/src/qt/forms/kevadialog.ui
@@ -263,15 +263,55 @@
-
-
-
+
false
- Show the selected request (does the same as double clicking an entry)
+ Create new record
- Show
+ Create
+
+
+
+ :/icons/add:/icons/add
+
+
+ false
+
+
+
+ -
+
+
+ false
+
+
+ Read selected record
+
+
+ Read
+
+
+
+ :/icons/eye:/icons/eye
+
+
+ false
+
+
+
+ -
+
+
+ false
+
+
+ Update selected record
+
+
+ Update
@@ -283,15 +323,15 @@
-
-
+
false
- Remove the selected entries from the list
+ Delete the selected entries from the list
- Remove
+ Delete
@@ -302,26 +342,6 @@
- -
-
-
- false
-
-
- Add new key-value pair
-
-
- Add key-value
-
-
-
- :/icons/add:/icons/add
-
-
- false
-
-
-
-
@@ -355,8 +375,8 @@
receiveButton
clearButton
recentRequestsView
- showValueButton
- removeButton
+ readButton
+ deleteButton
diff --git a/src/qt/kevaaddkeydialog.cpp b/src/qt/kevaaddkeydialog.cpp
index c70289112..a3d120f15 100644
--- a/src/qt/kevaaddkeydialog.cpp
+++ b/src/qt/kevaaddkeydialog.cpp
@@ -28,6 +28,20 @@ KevaAddKeyDialog::~KevaAddKeyDialog()
delete ui;
}
+void KevaAddKeyDialog::setKey(const QString &value)
+{
+ ui->keyText->setText(
+ value
+ );
+}
+
+void KevaAddKeyDialog::setValue(const QString &value)
+{
+ ui->valueText->setPlainText(
+ value
+ );
+}
+
void KevaAddKeyDialog::create()
{
KevaDialog* dialog = (KevaDialog*)this->parentWidget();
diff --git a/src/qt/kevaaddkeydialog.h b/src/qt/kevaaddkeydialog.h
index d65db8b86..668718be3 100644
--- a/src/qt/kevaaddkeydialog.h
+++ b/src/qt/kevaaddkeydialog.h
@@ -34,6 +34,8 @@ private:
public Q_SLOTS:
void create();
void cancel();
+ void setKey(const QString& value);
+ void setValue(const QString& value);
void onKeyChanged(const QString& key);
void onValueChanged();
};
diff --git a/src/qt/kevadetaildialog.cpp b/src/qt/kevadetaildialog.cpp
index 8e9376dd4..34148bec3 100644
--- a/src/qt/kevadetaildialog.cpp
+++ b/src/qt/kevadetaildialog.cpp
@@ -17,40 +17,40 @@ KevaDetailDialog::KevaDetailDialog(const QModelIndex &idx, QWidget *parent, cons
ui(new Ui::KevaDetailDialog)
{
ui->setupUi(this);
- QModelIndex keyIdx = idx.sibling(idx.row(), KevaTableModel::Key);
- QModelIndex valueIdx = idx.sibling(idx.row(), KevaTableModel::Value);
+
this->nameSpace = nameSpace;
- key = keyIdx.data(Qt::DisplayRole).toString();
- setWindowTitle(tr("Value for %1").arg(key));
- QString desc = valueIdx.data(Qt::DisplayRole).toString();
- connect(ui->detailText, SIGNAL(textChanged()), this, SLOT(onValueChanged()));
- //ui->detailText->setHtml(desc);
- ui->detailText->setPlainText(desc);
- ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
- connect(ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(onSave()));
+
+ setWindowTitle(
+ idx.sibling(
+ idx.row(),
+ KevaTableModel::Key
+ ).data(
+ Qt::DisplayRole
+ ).toString()
+ );
+
+ /* @TODO multi-tab data/meta browser
+ ui->detailKey->setText(
+ idx.sibling(
+ idx.row(),
+ KevaTableModel::Key
+ ).data(
+ Qt::DisplayRole
+ ).toString()
+ );
+ */
+
+ ui->detailValue->setText(
+ idx.sibling(
+ idx.row(),
+ KevaTableModel::Value
+ ).data(
+ Qt::DisplayRole
+ ).toString()
+ );
}
KevaDetailDialog::~KevaDetailDialog()
{
delete ui;
-}
-
-void KevaDetailDialog::onValueChanged()
-{
- bool enabled = ui->detailText->toPlainText().length() > 0;
- ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(enabled);
-}
-
-void KevaDetailDialog::onSave()
-{
- KevaDialog* dialog = (KevaDialog*)this->parentWidget();
- std::string keyText = key.toStdString();
- std::string valueText = ui->detailText->toPlainText().toStdString();
- std::string ns = nameSpace.toStdString();
- if (!dialog->addKeyValue(ns, keyText, valueText)) {
- QDialog::close();
- return;
- }
- dialog->showNamespace(nameSpace);
- QDialog::close();
-}
+}
\ No newline at end of file
diff --git a/src/qt/kevadetaildialog.h b/src/qt/kevadetaildialog.h
index 597eb1bc4..7c9f4dd7e 100644
--- a/src/qt/kevadetaildialog.h
+++ b/src/qt/kevadetaildialog.h
@@ -7,7 +7,6 @@
#include
#include
-
#include
namespace Ui {
@@ -27,10 +26,6 @@ public:
explicit KevaDetailDialog(const QModelIndex &idx, QWidget *parent, const QString &nameSpace);
~KevaDetailDialog();
-public Q_SLOTS:
- void onValueChanged();
- void onSave();
-
private:
Ui::KevaDetailDialog *ui;
QString nameSpace;
diff --git a/src/qt/kevadialog.cpp b/src/qt/kevadialog.cpp
index d0eabaaae..9345643d6 100644
--- a/src/qt/kevadialog.cpp
+++ b/src/qt/kevadialog.cpp
@@ -40,13 +40,16 @@ KevaDialog::KevaDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
if (!_platformStyle->getImagesOnButtons()) {
ui->bookmarksButton->setIcon(QIcon());
- ui->showValueButton->setIcon(QIcon());
- ui->removeButton->setIcon(QIcon());
+ ui->createButton->setIcon(QIcon());
+ ui->readButton->setIcon(QIcon());
+ ui->updateButton->setIcon(QIcon());
+ ui->deleteButton->setIcon(QIcon());
} else {
ui->bookmarksButton->setIcon(_platformStyle->SingleColorIcon(":/icons/address-book"));
- ui->showValueButton->setIcon(_platformStyle->SingleColorIcon(":/icons/edit"));
- ui->removeButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove"));
- ui->addKVButton->setIcon(_platformStyle->SingleColorIcon(":/icons/add"));
+ ui->createButton->setIcon(_platformStyle->SingleColorIcon(":/icons/add"));
+ ui->readButton->setIcon(_platformStyle->SingleColorIcon(":/icons/eye"));
+ ui->updateButton->setIcon(_platformStyle->SingleColorIcon(":/icons/edit"));
+ ui->deleteButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove"));
}
// context menu actions
@@ -158,10 +161,10 @@ void KevaDialog::onNamespaceChanged(const QString& nameSpace)
valtype nameSpaceVal;
bool isValidNamespace = false;
if (DecodeKevaNamespace(namespaceStr, Params(), nameSpaceVal)) {
- ui->addKVButton->setEnabled(true);
+ ui->createButton->setEnabled(true);
isValidNamespace = true;
} else {
- ui->addKVButton->setEnabled(false);
+ ui->createButton->setEnabled(false);
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star_empty"));
}
@@ -285,13 +288,22 @@ void KevaDialog::on_bookmarkNamespace_clicked()
void KevaDialog::kevaView_selectionChanged()
{
- // Enable Show/Remove buttons only if anything is selected.
+ // Enable Read/Delete buttons only if anything is selected.
bool enable = !ui->kevaView->selectionModel()->selectedRows().isEmpty();
- ui->showValueButton->setEnabled(enable);
- ui->removeButton->setEnabled(enable);
+ ui->readButton->setEnabled(enable);
+ ui->updateButton->setEnabled(enable);
+ ui->deleteButton->setEnabled(enable);
}
-void KevaDialog::on_showValueButton_clicked()
+void KevaDialog::on_createButton_clicked()
+{
+ QString ns = ui->nameSpace->text();
+ KevaAddKeyDialog *dialog = new KevaAddKeyDialog(this, ns);
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ dialog->show();
+}
+
+void KevaDialog::on_readButton_clicked()
{
if(!model || !model->getKevaTableModel() || !ui->kevaView->selectionModel())
return;
@@ -302,7 +314,44 @@ void KevaDialog::on_showValueButton_clicked()
}
}
-void KevaDialog::on_removeButton_clicked()
+void KevaDialog::on_updateButton_clicked()
+{
+ QString ns = ui->nameSpace->text();
+
+ KevaAddKeyDialog *dialog = new KevaAddKeyDialog(this, ns);
+
+ if(!model || !model->getKevaTableModel() || !ui->kevaView->selectionModel())
+ return;
+
+ for (const QModelIndex& index : ui->kevaView->selectionModel()->selectedRows())
+ {
+ dialog->setKey(
+ index.sibling(
+ index.row(),
+ KevaTableModel::Key
+ ).data(
+ Qt::DisplayRole
+ ).toString()
+ );
+
+ dialog->setValue(
+ index.sibling(
+ index.row(),
+ KevaTableModel::Value
+ ).data(
+ Qt::DisplayRole
+ ).toString()
+ );
+ }
+
+ dialog->setAttribute(
+ Qt::WA_DeleteOnClose
+ );
+
+ dialog->show();
+}
+
+void KevaDialog::on_deleteButton_clicked()
{
if(!model || !model->getKevaTableModel() || !ui->kevaView->selectionModel())
return;
@@ -351,14 +400,6 @@ void KevaDialog::on_removeButton_clicked()
model->getKevaTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent());
}
-void KevaDialog::on_addKVButton_clicked()
-{
- QString ns = ui->nameSpace->text();
- KevaAddKeyDialog *dialog = new KevaAddKeyDialog(this, ns);
- dialog->setAttribute(Qt::WA_DeleteOnClose);
- dialog->show();
-}
-
// We override the virtual resizeEvent of the QWidget to adjust tables column
// sizes as the tables width is proportional to the dialogs width.
void KevaDialog::resizeEvent(QResizeEvent *event)
diff --git a/src/qt/kevadialog.h b/src/qt/kevadialog.h
index 2820ca310..524c5f7a6 100644
--- a/src/qt/kevadialog.h
+++ b/src/qt/kevadialog.h
@@ -73,9 +73,10 @@ private Q_SLOTS:
void on_showContent_clicked();
void on_createNamespace_clicked();
void on_listNamespaces_clicked();
- void on_showValueButton_clicked();
- void on_removeButton_clicked();
- void on_addKVButton_clicked();
+ void on_createButton_clicked();
+ void on_readButton_clicked();
+ void on_updateButton_clicked();
+ void on_deleteButton_clicked();
void on_kevaView_doubleClicked(const QModelIndex &index);
void kevaView_selectionChanged();
void on_bookmarksButton_clicked();