#
#
# patch "res/forms/db_variables.ui"
# from [411a1a308272e830c0ba00967eaff03be8b6023e]
# to [690d763ebe661aace3e5d70e2b80555a1ec151f9]
#
# patch "src/view/panels/DatabaseVariables.cpp"
# from [e5da1c26d5f67116f29008a1525d9f92473e4e3a]
# to [8b2ab1c213b06aa5c4e3246fe1a8b0fbf1520095]
#
# patch "src/view/panels/DatabaseVariables.h"
# from [e391c11ecb671270ceb1b3e5064186b94b984491]
# to [18f5901a440cc1179edc722b1c611d1ee92c9068]
#
============================================================
--- res/forms/db_variables.ui 411a1a308272e830c0ba00967eaff03be8b6023e
+++ res/forms/db_variables.ui 690d763ebe661aace3e5d70e2b80555a1ec151f9
@@ -5,10 +5,16 @@
0
0
- 456
- 253
+ 422
+ 185
+
+
+ 400
+ 0
+
+
Database variables
@@ -27,15 +33,24 @@
-
+
+ 0
+
-
-
+
+
+
+ Qt::ToolButtonTextOnly
+
-
-
+
+
+ false
+
-
@@ -55,10 +70,13 @@
-
-
+
- Update
+ update
+
+ Qt::ToolButtonTextOnly
+
============================================================
--- src/view/panels/DatabaseVariables.cpp e5da1c26d5f67116f29008a1525d9f92473e4e3a
+++ src/view/panels/DatabaseVariables.cpp 8b2ab1c213b06aa5c4e3246fe1a8b0fbf1520095
@@ -52,8 +52,13 @@ DatabaseVariables::DatabaseVariables(QWi
);
connect(
+ variableTree, SIGNAL(clicked(const QModelIndex &)),
+ this, SLOT(enableDisableDropButton(const QModelIndex &))
+ );
+
+ connect(
variableTree, SIGNAL(doubleClicked(const QModelIndex &)),
- this, SLOT(variableDoubleClicked(const QModelIndex &))
+ this, SLOT(openVariableEditor(const QModelIndex &))
);
setWindowTitle(tr("Database variables"));
@@ -70,6 +75,14 @@ void DatabaseVariables::setDatabaseFile(
void DatabaseVariables::setDatabaseFile(const DatabaseFile & db)
{
databaseVariables->setDatabaseFile(db);
+ // FIXME: this is hacky, but we can't properly determine when to
+ // read the variables other than here or on every view change
+ // (see QDockWidget::visibilityChanged(bool) for that purpose), but
+ // the latter is not working properly as well because the widget
+ // might be made visible / displayed before the database/workspace
+ // path is set and we have no other signal floating around than
+ // this one here to determine when we actually _can_ start to read
+ // them
databaseVariables->readVariables();
}
@@ -90,7 +103,7 @@ void DatabaseVariables::variablesRead()
variableTree->expandAll();
}
-void DatabaseVariables::variableDoubleClicked(const QModelIndex & index)
+void DatabaseVariables::openVariableEditor(const QModelIndex & index)
{
if (!index.isValid() || !index.parent().isValid()) return;
@@ -154,7 +167,9 @@ void DatabaseVariables::removeCurrentVar
I(false);
QMessageBox msgBox(this);
+ msgBox.setIcon(QMessageBox::Question);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+ msgBox.setDefaultButton(QMessageBox::Yes);
msgBox.setWindowTitle(tr("Attention"));
msgBox.setText(tr("Are you sure you want to remove the "
"variable '%1' from the domain '%2'?").arg(key).arg(domain));
@@ -169,3 +184,9 @@ void DatabaseVariables::removeCurrentVar
}
}
+void DatabaseVariables::enableDisableDropButton(const QModelIndex & index)
+{
+ // only enable the children, i.e. single entries of a particular domain
+ removeVariable->setEnabled(index.isValid() && index.parent().isValid());
+}
+
============================================================
--- src/view/panels/DatabaseVariables.h e391c11ecb671270ceb1b3e5064186b94b984491
+++ src/view/panels/DatabaseVariables.h 18f5901a440cc1179edc722b1c611d1ee92c9068
@@ -39,7 +39,8 @@ private slots:
void openVariableEditor(const QString & domain = QString(),
const QString & key = QString(),
const QString & value= QString());
- void variableDoubleClicked(const QModelIndex &);
+ void openVariableEditor(const QModelIndex &);
+ void enableDisableDropButton(const QModelIndex &);
void removeCurrentVariable();
private: