[kde-doc-english] [digikam] /: appliction disable "internal database"
Francesco Riosa
francesco+kde at pnpitalia.it
Wed May 11 16:27:15 CEST 2011
Git commit 8907ceb5ee89b4d822fec8d20433894439be125c by Francesco Riosa.
Committed on 11/05/2011 at 16:17.
Pushed by riosa into branch 'master'.
appliction disable "internal database"
When internal database has been disabled at compile time we don't know
how to start a server and widget should not show the option to use one.
Also for how cmake machinery work mysqldPath option is not empty but
contain "SERVERCMD_MYSQL-NOTFOUND", add a check for that.
When a digikam w/o mysqld support encounter a configuration file which
point to a "internal database" it threat the database as external and
will fail to connect to.
GUI:
BUG: 254533
M +1 -1 databaseserver/databaseserver.cpp
M +10 -1 libs/database/databaseparameters.cpp
M +9 -0 libs/widgets/common/databasewidget.cpp
http://commits.kde.org/digikam/8907ceb5ee89b4d822fec8d20433894439be125c
diff --git a/databaseserver/databaseserver.cpp b/databaseserver/databaseserver.cpp
index 80cd2e7..a877d89 100644
--- a/databaseserver/databaseserver.cpp
+++ b/databaseserver/databaseserver.cpp
@@ -157,7 +157,7 @@ DatabaseServerError DatabaseServer::startMYSQLDatabaseProcess()
const QString mysqldPath(DatabaseConfigElement::element(dbType).dbServerCmd);
//const QString mysqldPath("/usr/sbin/mysqld");
- if ( mysqldPath.isEmpty() )
+ if ( mysqldPath.isEmpty() || mysqldPath.compare( QLatin1String( "SERVERCMD_MYSQL-NOTFOUND" ) ))
{
kDebug() << "No path to mysqld set in server configuration!";
return DatabaseServerError(DatabaseServerError::StartError, i18n("No path to mysqld set in server configuration."));
diff --git a/libs/database/databaseparameters.cpp b/libs/database/databaseparameters.cpp
index 98cd070..f483ad7 100644
--- a/libs/database/databaseparameters.cpp
+++ b/libs/database/databaseparameters.cpp
@@ -7,7 +7,7 @@
* Description : Storage container for database connection parameters.
*
* Copyright (C) 2007-2008 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
- * Copyright (C) 2010 by Holger F�rster <hamsi2k at freenet dot de>
+ * Copyright (C) 2010 by Holger Foerster <hamsi2k at freenet dot de>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -27,6 +27,7 @@
#endif
*/
+#include "config-digikam.h"
#include "databaseparameters.h"
// Qt includes
@@ -97,12 +98,16 @@ DatabaseParameters::DatabaseParameters(const KUrl& url)
port = queryPort.toInt();
}
+#ifdef HAVE_INTERNALMYSQL
QString queryServer = url.queryItem("internalServer");
if (!queryServer.isNull())
{
internalServer = (queryServer == "true");
}
+#else
+ internalServer = false;
+#endif // HAVE_INTERNALMYSQL
userName = url.queryItem("userName");
password = url.queryItem("password");
@@ -207,7 +212,11 @@ void DatabaseParameters::readFromConfig(KSharedConfig::Ptr config, const QString
userName = group.readEntry(configDatabaseUsername, QString());
password = group.readEntry(configDatabasePassword, QString());
connectOptions = group.readEntry(configDatabaseConnectOptions, QString());
+#ifdef HAVE_INTERNALMYSQL
internalServer = group.readEntry(configInternalDatabaseServer, false);
+#else
+ internalServer = false;
+#endif // HAVE_INTERNALMYSQL
if (isSQLite() && !databaseName.isNull())
{
diff --git a/libs/widgets/common/databasewidget.cpp b/libs/widgets/common/databasewidget.cpp
index fef3fed..560371f 100644
--- a/libs/widgets/common/databasewidget.cpp
+++ b/libs/widgets/common/databasewidget.cpp
@@ -45,6 +45,7 @@
// Local includes
+#include "config-digikam.h"
#include "databaseparameters.h"
#include "databaseserverstarter.h"
@@ -130,7 +131,9 @@ void DatabaseWidget::setupMainArea()
QFormLayout* expertSettinglayout = new QFormLayout();
d->expertSettings->setLayout(expertSettinglayout);
+#ifdef HAVE_INTERNALMYSQL
expertSettinglayout->addRow(internalServerLabel, internalServer);
+#endif // HAVE_INTERNALMYSQL
expertSettinglayout->addRow(hostNameLabel, hostName);
expertSettinglayout->addRow(hostPortLabel, hostPort);
expertSettinglayout->addRow(databaseNameLabel, databaseName);
@@ -177,8 +180,10 @@ void DatabaseWidget::setupMainArea()
connect(databaseType, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotHandleDBTypeIndexChanged(int)));
+#ifdef HAVE_INTERNALMYSQL
connect(internalServer, SIGNAL(stateChanged(int)),
this, SLOT(slotHandleInternalServerCheckbox(int)));
+#endif // HAVE_INTERNALMYSQL
connect(checkDatabaseConnectionButton, SIGNAL(clicked()),
this, SLOT(checkDatabaseConnection()));
@@ -317,7 +322,11 @@ void DatabaseWidget::setParametersFromSettings(const AlbumSettings* settings)
originalDbType = settings->getDatabaseType();
databasePathEdit->setUrl(settings->getDatabaseFilePath());
+#ifdef HAVE_INTERNALMYSQL
internalServer->setChecked(settings->getInternalDatabaseServer());
+#else
+ internalServer->setChecked(false);
+#endif // HAVE_INTERNALMYSQL
databaseName->setText(settings->getDatabaseName());
databaseNameThumbnails->setText(settings->getDatabaseNameThumbnails());
hostName->setText(settings->getDatabaseHostName());
More information about the kde-doc-english
mailing list