diff --git a/qbolt/itemwindow.ui b/qbolt/itemwindow.ui
index ab9a896..2f2960e 100644
--- a/qbolt/itemwindow.ui
+++ b/qbolt/itemwindow.ui
@@ -17,7 +17,7 @@
:/rsrc/database_lightning.png:/rsrc/database_lightning.png
-
+
0
@@ -30,6 +30,9 @@
0
+
+ 0
+
-
@@ -37,10 +40,62 @@
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Save
+
+
+
+
+
+
-
+
+
+ buttonBox
+ rejected()
+ ItemWindow
+ reject()
+
+
+ 184
+ 330
+
+
+ 184
+ 176
+
+
+
+
+ buttonBox
+ accepted()
+ ItemWindow
+ accept()
+
+
+ 184
+ 330
+
+
+ 184
+ 176
+
+
+
+
diff --git a/qbolt/mainwindow.cpp b/qbolt/mainwindow.cpp
index d9e64b7..9a743d8 100644
--- a/qbolt/mainwindow.cpp
+++ b/qbolt/mainwindow.cpp
@@ -270,7 +270,7 @@ void MainWindow::on_actionClear_selection_triggered()
}
#define GET_ITM_TOP_BROWSE_BDB \
- QTreeWidgetItem* itm = lastContextSelection; \
+ QTreeWidgetItem* itm = ui->bucketTree->currentItem(); \
if (itm == nullptr) { \
return; \
} \
@@ -300,7 +300,18 @@ void MainWindow::on_bucketData_doubleClicked(const QModelIndex &index)
auto iw = new ItemWindow();
iw->ContentArea()->setPlainText(QString::fromUtf8(content));
iw->setWindowTitle(key);
- connect(iw, &ItemWindow::finished, iw, &ItemWindow::deleteLater);
+ connect(iw, &ItemWindow::finished, iw, [=](int exitCode){
+ if (exitCode == ItemWindow::Accepted) {
+ QString err;
+ if (! bdb->setItem(browse, key.toUtf8(), iw->ContentArea()->toPlainText().toUtf8(), err)) {
+ QMessageBox qmb;
+ qmb.setText(tr("Error saving item content: %1").arg(err));
+ qmb.exec();
+ }
+ }
+ iw->deleteLater();
+ });
+
iw->show();
},
[=](QString error) {
@@ -370,7 +381,6 @@ void MainWindow::on_AddDataButton_clicked()
}
-
void MainWindow::on_DeleteDataButton_clicked()
{
GET_ITM_TOP_BROWSE_BDB;