Commit 20f67bae authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Merge in Qt5 variant of KStandardDirs from frameworks branch.

parent 8469dc1e
......@@ -21,11 +21,16 @@
// kde includes
#include <kconfig.h>
#if QT_VERSION < 0x050000
#include <kstandarddirs.h>
#endif
// qt includes
#include <QDateTime>
#include <QRegExp>
#if QT_VERSION >= 0x050000
#include <QStandardPaths>
#endif
#include <QStringList>
#include <QTextStream>
......@@ -481,8 +486,14 @@ void CodeGenerationPolicy::setDefaults(bool emitUpdateSignal)
path = UmbrelloSettings::headingsDirectory();
if (path.isEmpty()) {
#if QT_VERSION >= 0x050000
path = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
QLatin1String("umbrello/headings"),
QStandardPaths::LocateDirectory).first();
#else
KStandardDirs stddirs;
path = stddirs.findDirs("data", QLatin1String("umbrello/headings")).first();
#endif
}
setHeadingFileDir (path);
......
......@@ -24,11 +24,16 @@
#include "umlpackagelist.h"
// kde includes
#if QT_VERSION < 0x050000
#include <KStandardDirs>
#endif
// qt includes
#include <QProcess>
#include <QRegExp>
#if QT_VERSION >= 0x050000
#include <QStandardPaths>
#endif
#include <QStringList>
#include <stdio.h>
......@@ -49,7 +54,11 @@ IDLImport::IDLImport(CodeImpThread* thread) : NativeImportBase(QLatin1String("//
}
QStringList arguments;
#if QT_VERSION >= 0x050000
QString executable = QStandardPaths::findExecutable(QLatin1String("cpp"));
#else
QString executable = KStandardDirs::findExe(QLatin1String("cpp"));
#endif
if (!executable.isEmpty()) {
arguments << QLatin1String("-C"); // -C means "preserve comments"
}
......
......@@ -25,9 +25,17 @@
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
// kde includes
#include <ktemporaryfile.h>
#include <kstandarddirs.h>
#include <KLocalizedString>
#if QT_VERSION < 0x050000
#include <kstandarddirs.h>
#endif
// qt includes
#if QT_VERSION >= 0x050000
#include <QStandardPaths>
#endif
#include <QTextOStream>
......@@ -55,7 +63,11 @@ void Docbook2XhtmlGeneratorJob::run()
umlDoc->writeToStatusBar(i18n("Exporting to XHTML..."));
#if QT_VERSION >= 0x050000
QString xsltFileName(QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String("docbook2xhtml.xsl")));
#else
QString xsltFileName(KGlobal::dirs()->findResource("appdata", QLatin1String("docbook2xhtml.xsl")));
#endif
uDebug() << "XSLT file is'" << xsltFileName << "'";
QFile xsltFile(xsltFileName);
xsltFile.open(QIODevice::ReadOnly);
......@@ -63,7 +75,11 @@ void Docbook2XhtmlGeneratorJob::run()
uDebug() << "XSLT is'" << xslt << "'";
xsltFile.close();
#if QT_VERSION >= 0x050000
QString localXsl = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("ksgmltools2/docbook/xsl/html/docbook.xsl"));
#else
QString localXsl = KGlobal::dirs()->findResource("data", QLatin1String("ksgmltools2/docbook/xsl/html/docbook.xsl"));
#endif
uDebug() << "Local xsl is'" << localXsl << "'";
if (!localXsl.isEmpty())
{
......
......@@ -20,7 +20,6 @@
#include <KLocalizedString>
#include <ktemporaryfile.h>
#include <KMessageBox>
#include <kstandarddirs.h>
#include <kio/netaccess.h>
#include <kio/job.h>
......
......@@ -26,10 +26,16 @@
#include <libxslt/xsltutils.h>
#include <ktemporaryfile.h>
#if QT_VERSION < 0x050000
#include <kstandarddirs.h>
#endif
#include <KLocalizedString>
#include <QTextOStream>
// qt includes
#include <QTextStream>
#if QT_VERSION >= 0x050000
#include <QStandardPaths>
#endif
extern int xmlLoadExtDtdDefaultValue;
......@@ -65,7 +71,11 @@ void DocbookGeneratorJob::run()
int nbparams = 0;
params[nbparams] = NULL;
#if QT_VERSION >= 0x050000
QString xsltFile(QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String("xmi2docbook.xsl")));
#else
QString xsltFile(KGlobal::dirs()->findResource("appdata", QLatin1String("xmi2docbook.xsl")));
#endif
xmlSubstituteEntitiesDefault(1);
xmlLoadExtDtdDefaultValue = 1;
......
......@@ -20,13 +20,18 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <kstandarddirs.h>
#if QT_VERSION < 0x050000
#include <kio/netaccess.h>
#include <kstandarddirs.h>
#endif
#include <kio/job.h>
#include <QApplication>
#include <QFile>
#include <QRegExp>
#if QT_VERSION >= 0x050000
#include <QStandardPaths>
#endif
#include <QTextStream>
/**
......@@ -139,7 +144,11 @@ void XhtmlGenerator::slotHtmlGenerated(const QString& tmpFileName)
m_umlDoc->writeToStatusBar(i18n("Copying CSS..."));
#if QT_VERSION >= 0x050000
QString cssFileName(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("xmi.css")));
#else
QString cssFileName(KGlobal::dirs()->findResource("appdata", QLatin1String("xmi.css")));
#endif
KUrl cssUrl = m_destDir;
cssUrl.addPath(QLatin1String("xmi.css"));
KIO::Job* cssJob = KIO::file_copy(cssFileName, cssUrl, -1, KIO::Overwrite | KIO::HideProgressInfo);
......
......@@ -23,7 +23,9 @@
// kde includes
#include <KConfigGroup>
#include <KDesktopFile>
#if QT_VERSION < 0x050000
#include <KStandardDirs>
#endif
// qt includes
#include <QFile>
......@@ -31,6 +33,9 @@
#include <QProcess>
#include <QRectF>
#include <QRegExp>
#if QT_VERSION >= 0x050000
#include <QStandardPaths>
#endif
#include <QString>
#include <QTemporaryFile>
#include <QTextStream>
......@@ -185,9 +190,13 @@ void DotGenerator::setUseFullNodeLabels(bool state)
bool DotGenerator::availableConfigFiles(UMLScene *scene, QHash<QString, QString> &configFiles)
{
QString diagramType = Uml::DiagramType::toString(scene->type()).toLower();
#if QT_VERSION >= 0x050000
QStringList fileNames = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QString::fromLatin1("umbrello/layouts/%1*.desktop").arg(diagramType));
#else
KStandardDirs dirs;
QStringList fileNames = dirs.findAllResources("data", QString::fromLatin1("umbrello/layouts/%1*.desktop").arg(diagramType));
#endif
foreach(const QString &fileName, fileNames) {
QFileInfo fi(fileName);
QString baseName;
......@@ -221,7 +230,11 @@ bool DotGenerator::readConfigFile(QString diagramType, const QString &variant)
QString configFileName;
foreach(const QString &fileName, fileNames) {
#if QT_VERSION >= 0x050000
configFileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString::fromLatin1("umbrello/layouts/%1").arg(fileName));
#else
configFileName = KStandardDirs::locate("data", QString::fromLatin1("umbrello/layouts/%1").arg(fileName));
#endif
if (!configFileName.isEmpty())
break;
}
......
......@@ -21,8 +21,10 @@
// kde includes
#include <KConfigGroup>
#include <KDesktopFile>
#include <KLocale>
#include <KLocalizedString>
#if QT_VERSION < 0x050000
#include <KStandardDirs>
#endif
// qt includes
#include <QDir>
......@@ -30,6 +32,9 @@
#include <QHash>
#include <QProcess>
#include <QRegExp>
#if QT_VERSION >= 0x050000
#include <QStandardPaths>
#endif
#include <QString>
#include <QTemporaryFile>
//#include <QTextStream>
......@@ -99,7 +104,11 @@ bool LayoutGenerator::isEnabled()
*/
QString LayoutGenerator::currentDotPath()
{
#if QT_VERSION >= 0x050000
QString executable = QStandardPaths::findExecutable(QLatin1String("dot"));
#else
QString executable = KStandardDirs::findExe(QLatin1String("dot"));
#endif
if (!executable.isEmpty()) {
QFileInfo fi(executable);
return fi.absolutePath();
......@@ -284,9 +293,12 @@ bool LayoutGenerator::apply(UMLScene *scene)
bool LayoutGenerator::availableConfigFiles(UMLScene *scene, QHash<QString,QString> &configFiles)
{
QString diagramType = Uml::DiagramType::toString(scene->type()).toLower();
#if QT_VERSION >= 0x050000
QStringList fileNames = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QString::fromLatin1("umbrello/layouts/%1*.desktop").arg(diagramType));
#else
KStandardDirs dirs;
QStringList fileNames = dirs.findAllResources("data", QString::fromLatin1("umbrello/layouts/%1*.desktop").arg(diagramType));
#endif
foreach(const QString &fileName, fileNames) {
QFileInfo fi(fileName);
QString baseName;
......
......@@ -70,7 +70,6 @@
#include <KLocalizedString>
#include <kmenubar.h>
#include <KMessageBox>
#include <kstandarddirs.h>
#include <ktip.h>
#include <ktabwidget.h>
#include <kactionmenu.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment