summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRahul Chowdhury <rahulc93@gmail.com>2015-09-11 18:45:48 (GMT)
committerRahul Chowdhury <rahulc93@gmail.com>2015-09-11 20:43:21 (GMT)
commit19a8d84d382e9ea1cb8e9eb84876994b81f34065 (patch)
tree52d077bbb34be7712cd6c1b1bc8f6c7af93c407c
parent6e68d2750ecf9728f61a444bf7b52845ec51991f (diff)
Port KStandardDirs -> QStandardPaths
REVIEW: 125173
-rw-r--r--libscience/moleculeparser.cpp7
-rw-r--r--plasmoid/applet/nuclearPlasmoid/kalziumdataobject.cpp12
-rw-r--r--plasmoid/engine/kalzium_engine.cpp5
-rw-r--r--src/calculator/calculator.cpp1
-rw-r--r--src/detailedQmlView.cpp6
-rw-r--r--src/detailedgraphicaloverview.cpp7
-rw-r--r--src/detailinfodlg.cpp13
-rw-r--r--src/kalzium.cpp9
-rw-r--r--src/kalziumdataobject.cpp13
-rw-r--r--src/kalziumschemetype.cpp15
-rw-r--r--src/molcalcwidget.cpp8
-rw-r--r--src/tablesdialog.cpp1
-rw-r--r--src/tools/moleculeview.cpp6
13 files changed, 63 insertions, 40 deletions
diff --git a/libscience/moleculeparser.cpp b/libscience/moleculeparser.cpp
index 35321cc..061cd38 100644
--- a/libscience/moleculeparser.cpp
+++ b/libscience/moleculeparser.cpp
@@ -15,9 +15,10 @@
#include <ctype.h>
-#include <kstandarddirs.h>
+
#include <kdebug.h>
#include <QFile>
+#include <QStandardPaths>
// ================================================================
// class ElementCountMap
@@ -371,7 +372,7 @@ QString MoleculeParser::expandTerm (const QString& _group)
QString temp; // A temporary QString used in Regular expressions
// Search in User defined aliases.
- QString fileName = KStandardDirs::locate( "data", "libkdeedu/data/symbols2.csv");
+ QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/symbols2.csv");
QFile file(fileName);
// Check file validity
@@ -399,7 +400,7 @@ QString MoleculeParser::expandTerm (const QString& _group)
// Find the system defined aliases
// Open the file
- fileName = KStandardDirs::locate( "data", "libkdeedu/data/symbols.csv");
+ fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/symbols.csv");
QFile file2(fileName);
// Check file validity
diff --git a/plasmoid/applet/nuclearPlasmoid/kalziumdataobject.cpp b/plasmoid/applet/nuclearPlasmoid/kalziumdataobject.cpp
index 27c1c61..dff6b46 100644
--- a/plasmoid/applet/nuclearPlasmoid/kalziumdataobject.cpp
+++ b/plasmoid/applet/nuclearPlasmoid/kalziumdataobject.cpp
@@ -31,9 +31,10 @@
#include <klocale.h>
#include <kdebug.h>
-#include <kstandarddirs.h>
+
#include <kpixmapcache.h>
#include <QXmlReader>
+#include <QStandardPaths>
KalziumDataObject* KalziumDataObject::instance()
{
@@ -47,7 +48,7 @@ KalziumDataObject::KalziumDataObject()
// reading elements
ElementSaxParser * parser = new ElementSaxParser();
- QFile xmlFile(KStandardDirs::locate("data", "libkdeedu/data/elements.xml"));
+ QFile xmlFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/elements.xml"));
QXmlInputSource source(&xmlFile);
QXmlSimpleReader reader;
@@ -62,7 +63,7 @@ KalziumDataObject::KalziumDataObject()
//read the spectra
SpectrumParser * spectrumparser = new SpectrumParser();
- QFile xmlSpFile(KStandardDirs::locate("data", "libkdeedu/data/spectra.xml"));
+ QFile xmlSpFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/spectra.xml"));
QXmlInputSource spsource(&xmlSpFile);
QXmlSimpleReader sp_reader;
@@ -77,7 +78,7 @@ KalziumDataObject::KalziumDataObject()
// reading isotopes
IsotopeParser * isoparser = new IsotopeParser();
- QFile xmlIsoFile(KStandardDirs::locate("data", "libkdeedu/data/isotopes.xml"));
+ QFile xmlIsoFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/isotopes.xml"));
QXmlInputSource isosource(&xmlIsoFile);
QXmlSimpleReader isoreader;
@@ -110,7 +111,8 @@ KalziumDataObject::KalziumDataObject()
//a settings-dialog where we can select the different iconsets...
QString setname = "school";
- QString pathname = KGlobal::dirs()->findResourceDir("appdata", "data/iconsets/") + "data/iconsets/";
+ QString pathname = QStandardPaths::locate(QStandardPaths::DataLocation, "data/iconsets/") + "data/iconsets/";
+ pathname = QFileInfo(pathname).absolutePath();
QString filename = pathname + setname + '/' + QString::number(i + 1) + ".svg";
diff --git a/plasmoid/engine/kalzium_engine.cpp b/plasmoid/engine/kalzium_engine.cpp
index ea24caa..da44c17 100644
--- a/plasmoid/engine/kalzium_engine.cpp
+++ b/plasmoid/engine/kalzium_engine.cpp
@@ -23,8 +23,9 @@
#include <QStringList>
#include <KLocale>
-#include <KStandardDirs>
+
#include <KConfigGroup>
+#include <QStandardPaths>
#include "plasma/datacontainer.h"
@@ -43,7 +44,7 @@ KalziumEngine::KalziumEngine(QObject* parent, const QVariantList& args)
// reading elements
ElementSaxParser * parser = new ElementSaxParser();
- QFile xmlFile(KStandardDirs::locate("data", "libkdeedu/data/elements.xml"));
+ QFile xmlFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/elements.xml"));
QXmlInputSource source(&xmlFile);
QXmlSimpleReader reader;
diff --git a/src/calculator/calculator.cpp b/src/calculator/calculator.cpp
index d343a07..d103449 100644
--- a/src/calculator/calculator.cpp
+++ b/src/calculator/calculator.cpp
@@ -22,7 +22,6 @@
#include <kdebug.h>
#include <kactioncollection.h>
#include <kstandardaction.h>
-#include <kstandarddirs.h>
#include <ktoolinvocation.h>
#include <QDialog>
#include <QIcon>
diff --git a/src/detailedQmlView.cpp b/src/detailedQmlView.cpp
index 50321f5..2ab5396 100644
--- a/src/detailedQmlView.cpp
+++ b/src/detailedQmlView.cpp
@@ -3,13 +3,14 @@
#include "detailedQmlView.h"
-#include <kstandarddirs.h>
+
#include <QVBoxLayout>
#include <QDeclarativeView>
#include <QDebug>
#include <prefs.h>
+#include <QStandardPaths>
#include "kalziumdataobject.h"
#include "kalziumutils.h"
@@ -22,7 +23,8 @@ DetailedQmlView::DetailedQmlView(QWidget *parent) : QWidget(parent)
QDeclarativeView *view = new QDeclarativeView(this);
- QString qmlPath = KGlobal::dirs()->findResourceDir("appdata", "qml/") + "qml/";
+ QString qmlPath = QStandardPaths::locate(QStandardPaths::DataLocation, "qml/") + "qml/";
+ qmlPath = QFileInfo(qmlPath).absolutePath();
m_context = view->rootContext();
diff --git a/src/detailedgraphicaloverview.cpp b/src/detailedgraphicaloverview.cpp
index cd792ac..941cc73 100644
--- a/src/detailedgraphicaloverview.cpp
+++ b/src/detailedgraphicaloverview.cpp
@@ -23,15 +23,17 @@ email : cniehaus@kde.org
#include <klocale.h>
#include <kglobalsettings.h>
#include <kglobal.h>
-#include <kstandarddirs.h>
+
//QT-Includes
#include <QFile>
#include <QPainter>
#include <QSvgRenderer>
#include <QRect>
+#include <QFileInfo>
#include <element.h>
+#include <QStandardPaths>
#include "prefs.h"
DetailedGraphicalOverview::DetailedGraphicalOverview(QWidget *parent)
@@ -87,7 +89,8 @@ void DetailedGraphicalOverview::paintEvent(QPaintEvent*)
} else if (Prefs::colorschemebox() == 2) { //The iconic view is the 3rd view (0,1,2,...)
pm.fill(palette().background().color());
- QString pathname = KGlobal::dirs()->findResourceDir("appdata", "data/iconsets/") + "data/iconsets/";
+ QString pathname = QStandardPaths::locate(QStandardPaths::DataLocation, "data/iconsets/") + "data/iconsets/";
+ pathname = QFileInfo(pathname).absolutePath();
int enumii = m_element->dataAsVariant(ChemicalDataObject::atomicNumber).toInt();
diff --git a/src/detailinfodlg.cpp b/src/detailinfodlg.cpp
index ad55f38..d8a3968 100644
--- a/src/detailinfodlg.cpp
+++ b/src/detailinfodlg.cpp
@@ -23,7 +23,7 @@
#include <dom/html_base.h>
#include <dom/html_document.h>
#include <khtmlview.h>
-#include <kstandarddirs.h>
+
#include <kactioncollection.h>
#include <kpagewidgetmodel.h>
#include <KConfig>
@@ -36,9 +36,11 @@
#include "psetables.h"
#include <QFile>
+#include <QFileInfo>
#include <QLabel>
#include <QImage>
#include <QStackedWidget>
+#include <QStandardPaths>
#include "element.h"
#include "orbitswidget.h"
#include "detailedgraphicaloverview.h"
@@ -57,10 +59,13 @@ DetailedInfoDlg::DetailedInfoDlg(int el, QWidget *parent) : KPageDialog(parent),
setButtonGuiItem(User2, KGuiItem(i18nc("Previous element", "Previous"),(layoutDirection() == Qt::LeftToRight) ? "arrow-left" : "arrow-right", i18n("Goes to the previous element")));
resize(820, 580);
*/
- m_baseHtml = KGlobal::dirs()->findResourceDir("appdata", "data/") + "data/htmlview/";
- m_baseHtml2 = KGlobal::dirs()->findResourceDir("appdata", "data/") + "data/hazardsymbols/";
+ m_baseHtml = QStandardPaths::locate(QStandardPaths::DataLocation, "data/") + "data/htmlview/";
+ m_baseHtml = QFileInfo(m_baseHtml).absolutePath();
+ m_baseHtml2 = QStandardPaths::locate(QStandardPaths::DataLocation, "data/") + "data/hazardsymbols/";
+ m_baseHtml2 = QFileInfo(m_baseHtml2).absolutePath();
-//X m_picsdir = KGlobal::dirs()->findResourceDir("appdata", "elempics/") + "elempics/";
+//X m_picsdir = QStandardPaths::locate(QStandardPaths::DataLocation, "elempics/") + "elempics/";
+//X m_picsdir = QFileInfo(m_picsdir).absolutePath();
// creating the tabs but not the contents, as that will be done when setting the element
createContent();
diff --git a/src/kalzium.cpp b/src/kalzium.cpp
index fc8ff50..e70b6cf 100644
--- a/src/kalzium.cpp
+++ b/src/kalzium.cpp
@@ -59,7 +59,7 @@
#include <kaction.h>
#include <kparts/part.h>
#include <kselectaction.h>
-#include <kstandarddirs.h>
+
#include <kstandardaction.h>
#include <QIcon>
#include <kservicetypetrader.h>
@@ -69,6 +69,7 @@
#include <KPluginLoader>
#include <QGridLayout>
#include <KLocalizedString>
+#include <QStandardPaths>
#define IDS_ELEMENTINFO 7
@@ -341,7 +342,8 @@ void Kalzium::slotGlossary()
// creating the glossary dialog and loading the glossaries we have
m_glossarydlg = new GlossaryDialog(this);
m_glossarydlg->setObjectName(QLatin1String("glossary"));
- QString dir = KGlobal::dirs()->findResourceDir("data", "kalzium/data/");
+ QString dir = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kalzium/data/");
+ dir = QFileInfo(dir).absolutePath();
QString picturepath = dir + "kalzium/data/bg.jpg";
QUrl u = QUrl::fromLocalFile(dir + "kalzium/data/knowledge.xml");
Glossary *g = new Glossary(u);
@@ -584,7 +586,8 @@ void Kalzium::elementHover(int num)
void Kalzium::extractIconicInformationAboutElement(int elementNumber)
{
QString setname = "school";
- QString pathname = KGlobal::dirs()->findResourceDir("appdata", "data/iconsets/") + "data/iconsets/";
+ QString pathname = QStandardPaths::locate(QStandardPaths::DataLocation, "data/iconsets/") + "data/iconsets/";
+ pathname = QFileInfo(pathname).absolutePath();
QString filename = pathname + setname + '/' + "iconinformation.txt";
QFile file(filename);
diff --git a/src/kalziumdataobject.cpp b/src/kalziumdataobject.cpp
index e123415..8d0f6d1 100644
--- a/src/kalziumdataobject.cpp
+++ b/src/kalziumdataobject.cpp
@@ -26,15 +26,17 @@
#include <spectrumparser.h>
#include <QFile>
+#include <QFileInfo>
#include <QPainter>
#include <QLocale>
#include <kdebug.h>
#include <QUrl>
-#include <kstandarddirs.h>
+
#include <KPixmapCache>
#include <KGlobal>
#include <kunitconversion/converter.h>
+#include <QStandardPaths>
struct StaticKalziumDataObject
{
@@ -54,7 +56,7 @@ KalziumDataObject::KalziumDataObject()
// reading elements
ElementSaxParser * parser = new ElementSaxParser();
- QFile xmlFile(KStandardDirs::locate("data", "libkdeedu/data/elements.xml"));
+ QFile xmlFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/elements.xml"));
QXmlInputSource source(&xmlFile);
QXmlSimpleReader reader;
@@ -69,7 +71,7 @@ KalziumDataObject::KalziumDataObject()
//read the spectra
SpectrumParser * spectrumparser = new SpectrumParser();
- QFile xmlSpFile(KStandardDirs::locate("data", "libkdeedu/data/spectra.xml"));
+ QFile xmlSpFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/spectra.xml"));
QXmlInputSource spsource(&xmlSpFile);
QXmlSimpleReader sp_reader;
@@ -84,7 +86,7 @@ KalziumDataObject::KalziumDataObject()
// reading isotopes
IsotopeParser * isoparser = new IsotopeParser();
- QFile xmlIsoFile(KStandardDirs::locate("data", "libkdeedu/data/isotopes.xml"));
+ QFile xmlIsoFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/isotopes.xml"));
QXmlInputSource isosource(&xmlIsoFile);
QXmlSimpleReader isoreader;
@@ -196,7 +198,8 @@ void KalziumDataObject::loadIconSet()
//FIXME in case we ever get more than one theme we need
//a settings-dialog where we can select the different iconsets...
const QString setname = "school";
- const QString pathname = KGlobal::dirs()->findResourceDir("appdata", "data/iconsets/") + "data/iconsets/";
+ QString pathname = QStandardPaths::locate(QStandardPaths::DataLocation, "data/iconsets/") + "data/iconsets/";
+ pathname = QFileInfo(pathname).absolutePath();
for (int i = 0; i < m_numOfElements; ++i)
{
diff --git a/src/kalziumschemetype.cpp b/src/kalziumschemetype.cpp
index d35a97c..1a4ce02 100644
--- a/src/kalziumschemetype.cpp
+++ b/src/kalziumschemetype.cpp
@@ -30,7 +30,8 @@
#include <klocale.h>
#include <kdebug.h>
-#include <kstandarddirs.h>
+#include <QStandardPaths>
+
KalziumSchemeTypeFactory::KalziumSchemeTypeFactory()
@@ -457,7 +458,8 @@ QList<legendPair> KalziumColorSchemeType::legendItems() const
//X
//X static QString resourcepath;
//X if (resourcepath.isEmpty()) {
-//X resourcepath = KGlobal::dirs()->findResourceDir("appdata", "data/latticeicons/") + "data/latticeicons/";
+//X resourcepath = QStandardPaths::locate(QStandardPaths::DataLocation, "data/latticeicons/") + "data/latticeicons/";
+//X resourcepath = QFileInfo(resourcepath).absolutePath();
//X }
//X
//X QString filename;
@@ -506,7 +508,8 @@ QList<legendPair> KalziumColorSchemeType::legendItems() const
//X static QString resourcepath;
//X if (resourcepath.isEmpty())
//X {
-//X resourcepath = KGlobal::dirs()->findResourceDir("appdata", "data/latticeicons/") + "data/latticeicons/";
+//X resourcepath = QStandardPaths::locate(QStandardPaths::DataLocation, "data/latticeicons/") + "data/latticeicons/";
+//X resourcepath = QFileInfo(resourcepath).absolutePath();
//X }
//X
//X QList<legendPair> ll;
@@ -551,7 +554,8 @@ QList<legendPair> KalziumColorSchemeType::legendItems() const
//X
//X static QString resourcepath;
//X if (resourcepath.isEmpty()) {
-//X resourcepath = KGlobal::dirs()->findResourceDir("appdata", "data/maps/") + "data/maps/";
+//X resourcepath = QStandardPaths::locate(QStandardPaths::DataLocation, "data/maps/") + "data/maps/";
+//X resourcepath = QFileInfo(resourcepath).absolutePath();
//X }
//X
//X QString filename;
@@ -607,7 +611,8 @@ QList<legendPair> KalziumColorSchemeType::legendItems() const
//X {
//X static QString resourcepath;
//X if (resourcepath.isEmpty()) {
-//X resourcepath = KGlobal::dirs()->findResourceDir("appdata", "data/maps/") + "data/maps/";
+//X resourcepath = QStandardPaths::locate(QStandardPaths::DataLocation, "data/maps/") + "data/maps/";
+//X resourcepath = QFileInfo(resourcepath).absolutePath();
//X }
//X
//X QList<legendPair> ll;
diff --git a/src/molcalcwidget.cpp b/src/molcalcwidget.cpp
index af7c589..fc79673 100644
--- a/src/molcalcwidget.cpp
+++ b/src/molcalcwidget.cpp
@@ -35,11 +35,11 @@
#include <klocale.h>
#include <QPushButton>
#include <QLineEdit>
-#include <kstandarddirs.h>
#include <QTimer>
#include <QKeyEvent>
#include <QFile>
+#include <QStandardPaths>
MolcalcWidget::MolcalcWidget(QWidget *parent) : QWidget(parent)
{
@@ -72,7 +72,7 @@ MolcalcWidget::MolcalcWidget(QWidget *parent) : QWidget(parent)
int i = 0; // loop counter
// Search in User defined aliases.
- QString fileName = KStandardDirs::locate("data", "libkdeedu/data/symbols2.csv");
+ QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/symbols2.csv");
QFile file(fileName);
// Check file validity
@@ -107,7 +107,7 @@ MolcalcWidget::MolcalcWidget(QWidget *parent) : QWidget(parent)
// Find the system defined aliases
// Open the file
- fileName = KStandardDirs::locate("data", "libkdeedu/data/symbols.csv");
+ fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/symbols.csv");
QFile file2(fileName);
shortList.clear();
fullList.clear();
@@ -308,7 +308,7 @@ void MolcalcWidget::addAlias()
}
// Open the file to write
- QString fileName = KStandardDirs::locate("data", "libkdeedu/data/symbols2.csv");
+ QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "libkdeedu/data/symbols2.csv");
QFile file(fileName);
if (!(!file.open(QIODevice::WriteOnly| QIODevice::Append | QIODevice::Text))) {
diff --git a/src/tablesdialog.cpp b/src/tablesdialog.cpp
index 58518b5..87f7040 100644
--- a/src/tablesdialog.cpp
+++ b/src/tablesdialog.cpp
@@ -16,7 +16,6 @@
#include <klocale.h>
#include <QIcon>
-#include <kstandarddirs.h>
#include <kactioncollection.h>
#include <kcombobox.h>
#include <kpagewidgetmodel.h>
diff --git a/src/tools/moleculeview.cpp b/src/tools/moleculeview.cpp
index c70fb1e..031aace 100644
--- a/src/tools/moleculeview.cpp
+++ b/src/tools/moleculeview.cpp
@@ -25,7 +25,6 @@
#include <kdebug.h>
#include <kfiledialog.h>
#include <kjob.h>
-#include <kstandarddirs.h>
#include <kmessagebox.h>
#include <KLocale>
#include <QUrl>
@@ -43,6 +42,7 @@
#define HAVE_GCC_VISIBILITY
#endif
#include <openbabel/forcefield.h>
+#include <QStandardPaths>
using namespace OpenBabel;
using namespace Avogadro;
@@ -174,8 +174,8 @@ void MoleculeDialog::slotLoadMolecule()
KMessageBox::information(this, error);
}
- m_path = KGlobal::dirs()->findResourceDir("appdata", "data/molecules/") +
- "data/molecules/";
+ m_path = QStandardPaths::locate(QStandardPaths::DataLocation, "data/molecules/") + "data/molecules/";
+ m_path = QFileInfo(m_path).absolutePath();
QString commonMoleculeFormats = i18n("Common molecule formats");
QString allFiles = i18n("All files");