diff --git a/akonadi/tests/testrunner/config.cpp b/akonadi/tests/testrunner/config.cpp index e098a92d9..dc5ede3fb 100644 --- a/akonadi/tests/testrunner/config.cpp +++ b/akonadi/tests/testrunner/config.cpp @@ -1,107 +1,100 @@ /* * Copyright (c) 2008 Igor Trindade Oliveira * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include "config.h" #include "configreader.h" #include #include #include Config* Config::instance = 0; Config::Config() { } -Config *Config::getInstance() +Config *Config::getInstance(QString pathToConfig) { if(instance == 0){ - const QString pathToConfig = KStandardDirs::locate("config","akonaditest.xml"); - instance = new ConfigReader(pathToConfig); - } - return instance; -} - -Config *Config::getInstance(const QString &pathToConfig = NULL) -{ - if(instance == 0){ - instance = new ConfigReader(pathToConfig); + if(pathToConfig == NULL) + const QString pathToConfig = KStandardDirs::locate("config","akonaditest.xml"); + instance = new ConfigReader(pathToConfig); } return instance; } void Config::destroyInstance() { delete instance; } QString Config::getKdeHome() const { return kdehome; } QString Config::getXdgDataHome() const { return xdgdatahome; } QString Config::getXdgConfigHome() const { return xdgconfighome; } void Config::setKdeHome(const QString &home) { QDir kdeHomeDir( home ); kdehome = kdeHomeDir.absolutePath(); } void Config::setXdgDataHome(const QString &datahome) { QDir dataHomeDir( datahome ); xdgdatahome = dataHomeDir.absolutePath(); } void Config::setXdgConfigHome(const QString &confighome) { QDir configHomeDir( confighome ); xdgconfighome = configHomeDir.absolutePath(); } void Config::insertItemConfig(const QString &itemname, const QString &colname) { itemconfig.append( qMakePair(itemname, colname) ); } QList< QPair > Config::getItemConfig() { return itemconfig; } void Config::insertAgent(QString agent) { mAgents << agent; } QStringList Config::getAgents() { return mAgents; } diff --git a/akonadi/tests/testrunner/config.h b/akonadi/tests/testrunner/config.h index 1d98b3d5f..5fff9cea3 100644 --- a/akonadi/tests/testrunner/config.h +++ b/akonadi/tests/testrunner/config.h @@ -1,55 +1,54 @@ /* * Copyright (c) 2008 Igor Trindade Oliveira * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef CONFIG_H #define CONFIG_H #include #include #include class Config { private: QString kdehome; QString xdgdatahome; QString xdgconfighome; QList > itemconfig; QStringList mAgents; static Config *instance; public: - static Config *getInstance(); //to maintain the compatibility - static Config *getInstance(const QString &pathToConfig); + static Config *getInstance(QString pathToConfig = NULL); static void destroyInstance(); QString getKdeHome() const; QString getXdgDataHome() const; QString getXdgConfigHome() const; QList > getItemConfig(); QStringList getAgents(); protected: Config(); void setKdeHome(const QString &home); void setXdgDataHome(const QString &datahome); void setXdgConfigHome(const QString &confighome); void insertItemConfig(const QString &itemname, const QString &colname); void insertAgent(QString agent); }; #endif