summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <[email protected]>2015-05-29 12:43:31 +0200
committerRalf Habacker <[email protected]>2015-05-29 13:56:41 +0200
commit20f67bae2e8e444beeed914bee36a69abf307336 (patch)
tree6bc8f30d3f051e20fcda17db2cab57dc8b306c86
parent8469dc1e14af3089c08ff6ddf0f29cda85ac5c39 (diff)
Merge in Qt5 variant of KStandardDirs from frameworks branch.
-rw-r--r--umbrello/codegenerators/codegenerationpolicy.cpp11
-rw-r--r--umbrello/codeimport/idlimport.cpp9
-rw-r--r--umbrello/docgenerators/docbook2xhtmlgeneratorjob.cpp18
-rw-r--r--umbrello/docgenerators/docbookgenerator.cpp1
-rw-r--r--umbrello/docgenerators/docbookgeneratorjob.cpp12
-rw-r--r--umbrello/docgenerators/xhtmlgenerator.cpp11
-rw-r--r--umbrello/dotgenerator.cpp13
-rw-r--r--umbrello/layoutgenerator.cpp16
-rw-r--r--umbrello/uml.cpp1
9 files changed, 85 insertions, 7 deletions
diff --git a/umbrello/codegenerators/codegenerationpolicy.cpp b/umbrello/codegenerators/codegenerationpolicy.cpp
index 51dfd40..75b76af 100644
--- a/umbrello/codegenerators/codegenerationpolicy.cpp
+++ b/umbrello/codegenerators/codegenerationpolicy.cpp
@@ -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);
diff --git a/umbrello/codeimport/idlimport.cpp b/umbrello/codeimport/idlimport.cpp
index c1dadc0..24c2cc5 100644
--- a/umbrello/codeimport/idlimport.cpp
+++ b/umbrello/codeimport/idlimport.cpp
@@ -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"
}
diff --git a/umbrello/docgenerators/docbook2xhtmlgeneratorjob.cpp b/umbrello/docgenerators/docbook2xhtmlgeneratorjob.cpp
index 2270519..aba5104 100644
--- a/umbrello/docgenerators/docbook2xhtmlgeneratorjob.cpp
+++ b/umbrello/docgenerators/docbook2xhtmlgeneratorjob.cpp
@@ -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())
{
diff --git a/umbrello/docgenerators/docbookgenerator.cpp b/umbrello/docgenerators/docbookgenerator.cpp
index b0a8ae7..c511de4 100644
--- a/umbrello/docgenerators/docbookgenerator.cpp
+++ b/umbrello/docgenerators/docbookgenerator.cpp
@@ -20,7 +20,6 @@
#include <KLocalizedString>
#include <ktemporaryfile.h>
#include <KMessageBox>
-#include <kstandarddirs.h>
#include <kio/netaccess.h>
#include <kio/job.h>
diff --git a/umbrello/docgenerators/docbookgeneratorjob.cpp b/umbrello/docgenerators/docbookgeneratorjob.cpp
index 09a3af7..c52b25c 100644
--- a/umbrello/docgenerators/docbookgeneratorjob.cpp
+++ b/umbrello/docgenerators/docbookgeneratorjob.cpp
@@ -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;
diff --git a/umbrello/docgenerators/xhtmlgenerator.cpp b/umbrello/docgenerators/xhtmlgenerator.cpp
index 67d8749..34cb275 100644
--- a/umbrello/docgenerators/xhtmlgenerator.cpp
+++ b/umbrello/docgenerators/xhtmlgenerator.cpp
@@ -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);
diff --git a/umbrello/dotgenerator.cpp b/umbrello/dotgenerator.cpp
index 2ada2c7..5ec6a4f 100644
--- a/umbrello/dotgenerator.cpp
+++ b/umbrello/dotgenerator.cpp
@@ -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;
}
diff --git a/umbrello/layoutgenerator.cpp b/umbrello/layoutgenerator.cpp
index 4d48d99..aed6a7a 100644
--- a/umbrello/layoutgenerator.cpp
+++ b/umbrello/layoutgenerator.cpp
@@ -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;
diff --git a/umbrello/uml.cpp b/umbrello/uml.cpp
index 9f4c83b..9476de9 100644
--- a/umbrello/uml.cpp
+++ b/umbrello/uml.cpp
@@ -70,7 +70,6 @@
#include <KLocalizedString>
#include <kmenubar.h>
#include <KMessageBox>
-#include <kstandarddirs.h>
#include <ktip.h>
#include <ktabwidget.h>
#include <kactionmenu.h>