+QVariantMap StorageSelectionPage::connectionProperties() const {
+ QString backend = ui.backendList->itemData(ui.backendList->currentIndex()).toString();
+
+ QVariantMap properties;
+ QStringList setupKeys = _backends[backend].toMap()["SetupKeys"].toStringList();
+ if(!setupKeys.isEmpty()) {
+ QVariantMap defaults = _backends[backend].toMap()["SetupDefaults"].toMap();
+ foreach(QString key, setupKeys) {
+ QWidget *widget = _connectionBox->findChild<QWidget *>(key);
+ QVariant def;
+ if(defaults.contains(key)) {
+ def = defaults[key];
+ }
+ switch(def.type()) {
+ case QVariant::Int:
+ {
+ QSpinBox *spinbox = qobject_cast<QSpinBox *>(widget);
+ Q_ASSERT(spinbox);
+ def = QVariant(spinbox->value());
+ }
+ break;
+ default:
+ {
+ QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget);
+ Q_ASSERT(lineEdit);
+ def = QVariant(lineEdit->text());
+ }
+ }
+ properties[key] = def;
+ }
+ }
+ qDebug() << properties;
+
+
+// QVariantMap properties = _backends[backend].toMap()["ConnectionProperties"].toMap();
+// if(!properties.isEmpty() && _connectionBox) {
+// QVariantMap::iterator propertyIter = properties.begin();
+// while(propertyIter != properties.constEnd()) {
+// QWidget *widget = _connectionBox->findChild<QWidget *>(propertyIter.key());
+// switch(propertyIter.value().type()) {
+// case QVariant::Int:
+// {
+// QSpinBox *spinbox = qobject_cast<QSpinBox *>(widget);
+// Q_ASSERT(spinbox);
+// propertyIter.value() = QVariant(spinbox->value());
+// }
+// break;
+// default:
+// {
+// QLineEdit *lineEdit = qobject_cast<QLineEdit *>(widget);
+// Q_ASSERT(lineEdit);
+// propertyIter.value() = QVariant(lineEdit->text());
+// }
+// }
+// propertyIter++;
+// }
+// }
+ return properties;
+}
+