| 443 | } |
| 444 | |
| 445 | void 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 | |
| 476 | void DatabaseManagerWidget::testConnection() { |
| 477 | if (!m_current_connection) |