summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <[email protected]>2015-08-30 19:50:57 +0200
committerVolker Krause <[email protected]>2015-08-30 19:50:57 +0200
commit8722c15070c0ff821f2f934eb08753c3bf87b802 (patch)
treee083b77a0edfa1d8a6d34bbefa3acd51342fd47a
parentc7b9b1fbefd95f498f93654e54d96ab062f85f3b (diff)
Port away from KStandardDirs.
-rw-r--r--incidenceeditor-ng/incidencedialog.cpp29
-rw-r--r--kalarm/alarmcalendar.cpp3
-rw-r--r--kalarm/kalarmapp.cpp3
3 files changed, 16 insertions, 19 deletions
diff --git a/incidenceeditor-ng/incidencedialog.cpp b/incidenceeditor-ng/incidencedialog.cpp
index b7370e5..94f98a2 100644
--- a/incidenceeditor-ng/incidencedialog.cpp
+++ b/incidenceeditor-ng/incidencedialog.cpp
@@ -20,6 +20,7 @@
*/
#include "incidencedialog.h"
+#include "incidenceeditor_debug.h"
#include "combinedincidenceeditor.h"
#include "editorconfig.h"
#include "incidencealarm.h"
@@ -50,15 +51,14 @@
#include <KCalUtils/Stringify>
#include <KMessageBox>
-#include <KStandardDirs>
#include <KSystemTimeZones>
-
#include <KIconLoader>
-#include <QIcon>
-#include "incidenceeditor_debug.h"
+#include <KSharedConfig>
#include <QCloseEvent>
-#include <KSharedConfig>
+#include <QDir>
+#include <QIcon>
+#include <QStandardPaths>
using namespace IncidenceEditorNG;
@@ -295,8 +295,8 @@ void IncidenceDialogPrivate::loadTemplate(const QString &templateName)
KCalCore::MemoryCalendar::Ptr cal(new KCalCore::MemoryCalendar(KSystemTimeZones::local()));
- const QString fileName = KStandardDirs::locateLocal(
- "data",
+ const QString fileName = QStandardPaths::locate(
+ QStandardPaths::GenericDataLocation,
"korganizer/templates/" +
typeToString(mEditor->type()) + '/' +
templateName);
@@ -384,11 +384,10 @@ void IncidenceDialogPrivate::saveTemplate(const QString &templateName)
Q_ASSERT_X(false, "saveTemplate", "Fix your program");
}
- const QString fileName = KStandardDirs::locateLocal(
- "data",
- "korganizer/templates/" +
- typeToString(mEditor->type()) + '/' +
- templateName);
+ QString fileName = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
+ "korganizer/templates/" + typeToString(mEditor->type()) + '/';
+ QDir::root().mkpath(fileName);
+ fileName += templateName;
KCalCore::ICalFormat format;
format.save(cal, fileName);
@@ -400,10 +399,10 @@ void IncidenceDialogPrivate::storeTemplatesInConfig(const QStringList &templateN
// be changed by adding a setTemplates method.
const QStringList origTemplates =
IncidenceEditorNG::EditorConfig::instance()->templates(mEditor->type());
- const QString defaultPath = KStandardDirs::locateLocal(
- "data",
+ const QString defaultPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
"korganizer/templates/" +
- typeToString(mEditor->type()) + '/');
+ typeToString(mEditor->type()) + '/';
+ QDir::root().mkpath(defaultPath);
Q_FOREACH (const QString &tmpl, origTemplates) {
if (!templateNames.contains(tmpl)) {
const QString fileName = defaultPath + tmpl;
diff --git a/kalarm/alarmcalendar.cpp b/kalarm/alarmcalendar.cpp
index 8fe5cfa..514cff7 100644
--- a/kalarm/alarmcalendar.cpp
+++ b/kalarm/alarmcalendar.cpp
@@ -34,7 +34,6 @@
#include <KTimeZone>
#include <KLocalizedString>
-#include <kstandarddirs.h>
#include <kio/netaccess.h>
#include <kfileitem.h>
#include <KSharedConfig>
@@ -591,7 +590,7 @@ bool AlarmCalendar::importAlarms(QWidget* parent, Collection* collection)
if (local)
{
filename = url.toLocalFile();
- if (!KStandardDirs::exists(filename))
+ if (!QFile::exists(filename))
{
qCDebug(KALARM_LOG) << "File '" << url.toDisplayString() <<"' not found";
KAMessageBox::error(parent, xi18nc("@info", "Could not load calendar <filename>%1</filename>.", url.toDisplayString()));
diff --git a/kalarm/kalarmapp.cpp b/kalarm/kalarmapp.cpp
index 213d4cb..91aec82 100644
--- a/kalarm/kalarmapp.cpp
+++ b/kalarm/kalarmapp.cpp
@@ -44,7 +44,6 @@
#include <kalarmcal/karecurrence.h>
#include <KLocalizedString>
-#include <kstandarddirs.h>
#include <kconfig.h>
#include <KSharedConfig>
#include <K4AboutData>
@@ -169,7 +168,7 @@ KAlarmApp::KAlarmApp()
if (!mSpeechEnabled) { qCDebug(KALARM_LOG) << "Speech synthesis disabled (KTTSD not found)"; }
// Check if KOrganizer is installed
const QString korg = QStringLiteral("korganizer");
- mKOrganizerEnabled = !QStandardPaths::findExecutable(korg).isNull() || !KStandardDirs::findExe(korg).isNull();
+ mKOrganizerEnabled = !QStandardPaths::findExecutable(korg).isEmpty();
if (!mKOrganizerEnabled) { qCDebug(KALARM_LOG) << "KOrganizer options disabled (KOrganizer not found)"; }
}