MCPcopy Create free account
hub / github.com/KDE/labplot / saveConnections

Method saveConnections

src/frontend/datasources/DatabaseManagerWidget.cpp:445–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443}
444
445void DatabaseManagerWidget::saveConnections() {
446 QDEBUG(QStringLiteral("Saving connections to ") + m_configPath);
447 // delete saved connections
448 KConfig config(m_configPath, KConfig::SimpleConfig);
449 for (const auto& group : config.groupList())
450 config.deleteGroup(group);
451
452 // save connections
453 for (const auto& conn : m_connections) {
454 KConfigGroup group = config.group(conn.name);
455 group.writeEntry("Driver", conn.driver);
456 group.writeEntry("DatabaseName", conn.dbName);
457 if (!isFileDB(conn.driver) && !isODBC(conn.driver)) {
458 group.writeEntry("HostName", conn.hostName);
459 group.writeEntry("Port", conn.port);
460 }
461
462 if (!isFileDB(conn.driver)) {
463 group.writeEntry("UserName", conn.userName);
464 group.writeEntry("Password", conn.password);
465 }
466
467 if (isODBC(conn.driver)) {
468 group.writeEntry("CustomConnectionEnabled", conn.customConnectionEnabled);
469 group.writeEntry("CustomConnectionString", conn.customConnectionString);
470 }
471 }
472
473 config.sync();
474}
475
476void DatabaseManagerWidget::testConnection() {
477 if (!m_current_connection)

Callers 2

saveMethod · 0.45
saveMethod · 0.45

Calls 1

groupMethod · 0.45

Tested by

no test coverage detected