File indexing completed on 2025-01-05 03:58:23
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2009-28-04 0007 * Description : first run assistant dialog 0008 * 0009 * SPDX-FileCopyrightText: 2009-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "databasepage.h" 0016 0017 // Qt includes 0018 0019 #include <QApplication> 0020 #include <QStyle> 0021 #include <QLabel> 0022 #include <QVBoxLayout> 0023 0024 // KDE includes 0025 0026 #include <kconfiggroup.h> 0027 #include <klocalizedstring.h> 0028 #include <ksharedconfig.h> 0029 0030 // Local includes 0031 0032 #include "dlayoutbox.h" 0033 #include "digikam_debug.h" 0034 #include "dbsettingswidget.h" 0035 0036 namespace Digikam 0037 { 0038 0039 class Q_DECL_HIDDEN DatabasePage::Private 0040 { 0041 public: 0042 0043 explicit Private() 0044 : dbsettingswidget(nullptr) 0045 { 0046 } 0047 0048 DatabaseSettingsWidget* dbsettingswidget; 0049 }; 0050 0051 DatabasePage::DatabasePage(QWizard* const dlg) 0052 : DWizardPage(dlg, i18n("<b>Configure where you will store databases</b>")), 0053 d(new Private) 0054 { 0055 d->dbsettingswidget = new DatabaseSettingsWidget(this); 0056 0057 setPageWidget(d->dbsettingswidget); 0058 setLeftBottomPix(QIcon::fromTheme(QLatin1String("network-server-database"))); 0059 } 0060 0061 DatabasePage::~DatabasePage() 0062 { 0063 delete d; 0064 } 0065 0066 void DatabasePage::setDatabasePath(const QString& path) 0067 { 0068 d->dbsettingswidget->setDatabasePath(path); 0069 } 0070 0071 DbEngineParameters DatabasePage::getDbEngineParameters() const 0072 { 0073 return d->dbsettingswidget->getDbEngineParameters(); 0074 } 0075 0076 void DatabasePage::saveSettings() 0077 { 0078 DbEngineParameters params = d->dbsettingswidget->getDbEngineParameters(); 0079 params.writeToConfig(); 0080 0081 KSharedConfig::openConfig()->sync(); 0082 } 0083 0084 bool DatabasePage::checkSettings() 0085 { 0086 // TODO : add checks for Mysql Server. 0087 0088 return d->dbsettingswidget->checkDatabaseSettings(); 0089 } 0090 0091 } // namespace Digikam 0092 0093 #include "moc_databasepage.cpp"