diff --git a/src/Application.cpp b/src/Application.cpp index c67dca54..183a88a9 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -30,7 +30,6 @@ #include #include #include -#include // Konsole #include "SessionManager.h" @@ -415,7 +414,7 @@ Profile::Ptr Application::processProfileChangeArgs(KCmdLineArgs* args, Profile:: // Note: KCmdLineArgs::count() return the number of arguments // that aren't options. - if (args->count() == 0 && KStandardDirs::findExe(commandExec).isEmpty()) { + if (args->count() == 0 && QStandardPaths::findExecutable(commandExec).isEmpty()) { // Example: konsole -e "man ls" ShellCommand shellCommand(args->getOption("e")); commandExec = shellCommand.command(); diff --git a/src/BookmarkHandler.cpp b/src/BookmarkHandler.cpp index eed2d7ce..d23417f1 100644 --- a/src/BookmarkHandler.cpp +++ b/src/BookmarkHandler.cpp @@ -26,12 +26,13 @@ // Qt #include +#include +#include // KDE #include #include #include -#include #include // Konsole @@ -51,9 +52,13 @@ BookmarkHandler::BookmarkHandler(KActionCollection* collection, { setObjectName(QLatin1String("BookmarkHandler")); - _file = KStandardDirs::locate("data", "konsole/bookmarks.xml"); - if (_file.isEmpty()) - _file = KStandardDirs::locateLocal("data", "konsole/bookmarks.xml"); + _file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/bookmarks.xml")); + + if (_file.isEmpty()) { + _file = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/konsole"); + QDir().mkpath(_file); + _file += QStringLiteral("/bookmarks.xml"); + } KBookmarkManager* manager = KBookmarkManager::managerForFile(_file, "konsole"); diff --git a/src/ColorSchemeManager.cpp b/src/ColorSchemeManager.cpp index dd9758bf..fb808ab0 100644 --- a/src/ColorSchemeManager.cpp +++ b/src/ColorSchemeManager.cpp @@ -26,9 +26,9 @@ #include #include #include +#include // KDE -#include #include #include #include @@ -268,16 +268,12 @@ bool ColorSchemeManager::loadKDE3ColorScheme(const QString& filePath) QStringList ColorSchemeManager::listColorSchemes() { - return KGlobal::dirs()->findAllResources("data", - "konsole/*.colorscheme", - KStandardDirs::NoDuplicates); + return QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/*.colorscheme")); } QStringList ColorSchemeManager::listKDE3ColorSchemes() { - return KGlobal::dirs()->findAllResources("data", - "konsole/*.schema", - KStandardDirs::NoDuplicates); + return QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/*.schema")); } const ColorScheme ColorSchemeManager::_defaultColorScheme; @@ -297,7 +293,10 @@ void ColorSchemeManager::addColorScheme(ColorScheme* scheme) _colorSchemes.insert(scheme->name(), scheme); // save changes to disk - QString path = KGlobal::dirs()->saveLocation("data", "konsole/") + scheme->name() + ".colorscheme"; + + const QString dir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("konsole/"); + QDir().mkpath(dir); + const QString path = dir + scheme->name() + QStringLiteral(".colorscheme"); KConfig config(path , KConfig::NoGlobals); scheme->write(config); @@ -352,13 +351,12 @@ const ColorScheme* ColorSchemeManager::findColorScheme(const QString& name) QString ColorSchemeManager::findColorSchemePath(const QString& name) const { - QString path = KStandardDirs::locate("data", "konsole/" + name + ".colorscheme"); + QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".colorscheme")); - if (!path.isEmpty()) + if (!path.isEmpty()) { return path; + } - path = KStandardDirs::locate("data", "konsole/" + name + ".schema"); - - return path; + return QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".schema")); } diff --git a/src/History.cpp b/src/History.cpp index 67f07c96..3f2126a9 100644 --- a/src/History.cpp +++ b/src/History.cpp @@ -32,7 +32,6 @@ // KDE #include #include -#include #include diff --git a/src/KeyboardTranslatorManager.cpp b/src/KeyboardTranslatorManager.cpp index 27c481a2..f98e9576 100644 --- a/src/KeyboardTranslatorManager.cpp +++ b/src/KeyboardTranslatorManager.cpp @@ -25,11 +25,11 @@ // Qt #include #include +#include // KDE #include #include -#include using namespace Konsole; @@ -78,14 +78,12 @@ bool KeyboardTranslatorManager::deleteTranslator(const QString& name) QString KeyboardTranslatorManager::findTranslatorPath(const QString& name) { - return KStandardDirs::locate("data", "konsole/" + name + ".keytab"); + return QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + name + QStringLiteral(".keytab")); } void KeyboardTranslatorManager::findTranslators() { - QStringList list = KGlobal::dirs()->findAllResources("data", - "konsole/*.keytab", - KStandardDirs::NoDuplicates); + QStringList list = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/*.keytab")); // add the name of each translator to the list and associated // the name with a null pointer to indicate that the translator @@ -120,8 +118,9 @@ const KeyboardTranslator* KeyboardTranslatorManager::findTranslator(const QStrin bool KeyboardTranslatorManager::saveTranslator(const KeyboardTranslator* translator) { - const QString path = KGlobal::dirs()->saveLocation("data", "konsole/") + translator->name() - + ".keytab"; + const QString dir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("konsole/"); + QDir().mkpath(dir); + const QString path = dir + translator->name() + QStringLiteral(".keytab"); //kDebug() << "Saving translator to" << path; diff --git a/src/ManageProfilesDialog.cpp b/src/ManageProfilesDialog.cpp index 29d25a62..705e0b32 100644 --- a/src/ManageProfilesDialog.cpp +++ b/src/ManageProfilesDialog.cpp @@ -22,11 +22,11 @@ // Qt #include +#include #include // KDE #include -#include #include #include @@ -404,7 +404,7 @@ Profile::Ptr ManageProfilesDialog::currentProfile() const } bool ManageProfilesDialog::isProfileDeletable(Profile::Ptr profile) const { - static const QString systemDataLocation = KStandardDirs::installPath("data") + "konsole/"; + static const QString systemDataLocation = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).last() + QStringLiteral("konsole/"); if (profile) { QFileInfo fileInfo(profile->path()); diff --git a/src/ProfileManager.cpp b/src/ProfileManager.cpp index 4d938883..8d6f925f 100644 --- a/src/ProfileManager.cpp +++ b/src/ProfileManager.cpp @@ -33,7 +33,6 @@ #include #include #include -#include // Konsole #include "ProfileReader.h" @@ -90,7 +89,8 @@ ProfileManager::ProfileManager() } // load the default profile - const QString path = KStandardDirs::locate("data", "konsole/" + defaultProfileFileName); + const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + defaultProfileFileName); + if (!path.isEmpty()) { Profile::Ptr profile = loadProfile(path); if (profile) @@ -137,7 +137,7 @@ Profile::Ptr ProfileManager::loadProfile(const QString& shortPath) // if the file is not an absolute path, look it up if (!fileInfo.isAbsolute()) - path = KStandardDirs::locate("data", path); + path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, path); // if the file is not found, return immediately if (path.isEmpty()) { @@ -471,7 +471,7 @@ void ProfileManager::loadShortcuts() // if the file is not an absolute path, look it up QFileInfo fileInfo(profilePath); if (!fileInfo.isAbsolute()) { - profilePath = KStandardDirs::locate("data", "konsole/" + profilePath); + profilePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + profilePath); } data.profilePath = profilePath; @@ -497,8 +497,8 @@ void ProfileManager::saveShortcuts() if (fileInfo.isAbsolute()) { // Check to see if file is under KDE's data locations. If not, // store full path. - QString location = KGlobal::dirs()->locate("data", - "konsole/" + fileInfo.fileName()); + const QString location = QStandardPaths::locate(QStandardPaths::GenericDataLocation, + QStringLiteral("konsole/") + fileInfo.fileName()); if (location.isEmpty()) { profileName = iter.value().profilePath; } else { @@ -580,8 +580,8 @@ void ProfileManager::saveFavorites() if (fileInfo.isAbsolute()) { // Check to see if file is under KDE's data locations. If not, // store full path. - QString location = KGlobal::dirs()->locate("data", - "konsole/" + fileInfo.fileName()); + const QString location = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/") + fileInfo.fileName()); + if (location.isEmpty()) { profileName = profile->path(); } else { diff --git a/src/ProfileReader.cpp b/src/ProfileReader.cpp index 053f3e1a..9739b388 100644 --- a/src/ProfileReader.cpp +++ b/src/ProfileReader.cpp @@ -29,7 +29,6 @@ #include #include #include -#include // Konsole #include "ShellCommand.h" @@ -41,8 +40,7 @@ static const char GENERAL_GROUP[] = "General"; QStringList KDE4ProfileReader::findProfiles() { - return KGlobal::dirs()->findAllResources("data", "konsole/*.profile", - KStandardDirs::NoDuplicates); + return QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("konsole/*.profile")); } void KDE4ProfileReader::readProperties(const KConfig& config, Profile::Ptr profile, const Profile::PropertyInfo* properties) diff --git a/src/ProfileWriter.cpp b/src/ProfileWriter.cpp index 143787bf..8420919c 100644 --- a/src/ProfileWriter.cpp +++ b/src/ProfileWriter.cpp @@ -29,7 +29,6 @@ #include #include #include -#include // Konsole #include "ShellCommand.h" @@ -42,8 +41,8 @@ static const char GENERAL_GROUP[] = "General"; QString KDE4ProfileWriter::getPath(const Profile::Ptr profile) { // both location have trailing slash - static const QString localDataLocation = KGlobal::dirs()->saveLocation("data", "konsole/"); - static const QString systemDataLocation = KStandardDirs::installPath("data") + "konsole/"; + static const QString localDataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("konsole/"); + static const QString systemDataLocation = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).last() + QStringLiteral("konsole/"); const QString candidateLocalPath = localDataLocation + profile->untranslatedName() + ".profile"; QString newPath; diff --git a/src/Session.cpp b/src/Session.cpp index 04fea2dd..6ed47b3b 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include // Konsole @@ -392,7 +391,7 @@ QString Session::checkProgram(const QString& program) exec = KRun::binaryName(exec, false); exec = KShell::tildeExpand(exec); - QString pexec = KStandardDirs::findExe(exec); + const QString pexec = QStandardPaths::findExecutable(exec); if (pexec.isEmpty()) { kError() << i18n("Could not find binary: ") << exec; return QString(); diff --git a/src/SessionController.cpp b/src/SessionController.cpp index 1393eb81..061a1283 100644 --- a/src/SessionController.cpp +++ b/src/SessionController.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include