Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 302739f4 authored by Laurent Montel's avatar Laurent Montel 😁 Committed by Pali Rohár

Port to QStandardPath

parent 16a1c12d
......@@ -30,6 +30,7 @@
#include <kplugininfo.h>
#include <kiconloader.h>
#include <qpainter.h>
#include <KSharedConfig>
#include "kopetecommandhandler.h"
#include "kopetepluginmanager.h"
......@@ -161,7 +162,7 @@ AliasPreferences::~AliasPreferences()
// reload configuration reading it from kopeterc
void AliasPreferences::load()
{
KConfigGroup config(KGlobal::config(), "AliasPlugin");
KConfigGroup config(KSharedConfig::openConfig(), "AliasPlugin");
if (config.exists()) {
QStringList aliases = config.readEntry("AliasNames", QStringList());
for (QStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it) {
......@@ -186,7 +187,7 @@ void AliasPreferences::slotPluginLoaded(Kopete::Plugin *plugin)
{
Kopete::Protocol *protocol = static_cast<Kopete::Protocol *>(plugin);
if (protocol) {
KConfigGroup config(KGlobal::config(), "AliasPlugin");
KConfigGroup config(KSharedConfig::openConfig(), "AliasPlugin");
if (config.exists()) {
QStringList aliases = config.readEntry("AliasNames", QStringList());
for (QStringList::Iterator it = aliases.begin(); it != aliases.end(); ++it) {
......@@ -228,7 +229,7 @@ void AliasPreferences::slotPluginLoaded(Kopete::Plugin *plugin)
// save list to kopeterc and creates map out of it
void AliasPreferences::save()
{
KConfigGroup config = KGlobal::config()->group("AliasPlugin");
KConfigGroup config = KSharedConfig::openConfig()->group("AliasPlugin");
config.deleteGroup();
QStringList aliases;
......
......@@ -22,6 +22,7 @@
#include <kglobal.h>
#include <KLocalizedString>
#include <kconfiggroup.h>
#include <KSharedConfig>
//TODO: Use KConfigXT
AutoReplaceConfig::AutoReplaceConfig()
......
......@@ -27,8 +27,9 @@
#include <QTextStream>
#include <QSaveFile>
#include <kstandarddirs.h>
#include <KLocalizedString>
#include <QStandardPaths>
#include "filter.h"
......@@ -77,7 +78,7 @@ void HighlightConfig::load()
{
m_filters.clear(); //clear filters
const QString filename = KStandardDirs::locateLocal("appdata", QStringLiteral("highlight.xml"));
const QString filename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + QStringLiteral("highlight.xml");
if (filename.isEmpty()) {
return;
}
......@@ -135,7 +136,7 @@ void HighlightConfig::load()
void HighlightConfig::save()
{
const QString fileName = KStandardDirs::locateLocal("appdata", QStringLiteral("highlight.xml"));
const QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + QStringLiteral("highlight.xml");
QSaveFile file(fileName);
if (file.open(QIODevice::WriteOnly)) {
......
......@@ -28,8 +28,9 @@
#include <QtGui/QTextDocument>
#include <kdebug.h>
#include <kstandarddirs.h>
#include <QSaveFile>
#include <QStandardPaths>
#include "kopeteglobal.h"
#include "kopetecontact.h"
......@@ -694,7 +695,7 @@ QString HistoryLogger::getFileName(const Kopete::Contact *c, QDate date)
+c->contactId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-"))
+date.toString(".yyyyMM");
QString filename = KStandardDirs::locateLocal("data", QString::fromLatin1("kopete/logs/") + name+ QString::fromLatin1(".xml"));
QString filename = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QString::fromLatin1("kopete/logs/") + name+ QString::fromLatin1(".xml");
//Check if there is a kopete 0.7.x file
QFileInfo fi(filename);
......@@ -704,7 +705,7 @@ QString HistoryLogger::getFileName(const Kopete::Contact *c, QDate date)
+c->contactId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-"))
+date.toString(".yyyyMM");
QString filename2 = KStandardDirs::locateLocal("data", QString::fromLatin1("kopete/logs/") + name+ QString::fromLatin1(".xml"));
QString filename2 = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QString::fromLatin1("kopete/logs/") + name+ QString::fromLatin1(".xml");
QFileInfo fi2(filename2);
if (fi2.exists()) {
......@@ -724,7 +725,7 @@ unsigned int HistoryLogger::getFirstMonth(const Kopete::Contact *c)
QRegExp rx("\\.(\\d\\d\\d\\d)(\\d\\d)");
// BEGIN check if there are Kopete 0.7.x
QDir d1(KStandardDirs::locateLocal("data", QString("kopete/logs/")
QDir d1(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QString("kopete/logs/"
+c->protocol()->pluginId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-"))
));
d1.setFilter(QDir::Files | QDir::NoSymLinks);
......@@ -746,7 +747,7 @@ unsigned int HistoryLogger::getFirstMonth(const Kopete::Contact *c)
}
// END of kopete 0.7.x check
QDir d(KStandardDirs::locateLocal("data", QString("kopete/logs/")
QDir d(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1Char('/') + QString("kopete/logs/"
+c->protocol()->pluginId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-"))
+QString::fromLatin1("/")
+c->account()->accountId().replace(QRegExp(QString::fromLatin1("[./~?*]")), QString::fromLatin1("-"))
......
......@@ -33,7 +33,7 @@
#include <kio/job.h>
#include <kmessagebox.h>
#include <ktemporaryfile.h>
#include <kstandarddirs.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
......@@ -42,6 +42,7 @@
#include <libxslt/xsltInternals.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
#include <QStandardPaths>
#include "kopetepluginmanager.h"
#include "kopeteprotocol.h"
......@@ -329,16 +330,16 @@ bool WebPresencePlugin::transform(KTemporaryFile *src, KTemporaryFile *dest)
return false;
case WEB_HTML:
if (WebPresenceConfig::self()->useImagesHTML()) {
sheet.setFileName(KStandardDirs::locate("appdata", QStringLiteral("webpresence/webpresence_html_images.xsl")));
sheet.setFileName(QStandardPaths::locate(QStandardPaths::DataLocation, QStringLiteral("webpresence/webpresence_html_images.xsl")));
} else {
sheet.setFileName(KStandardDirs::locate("appdata", QStringLiteral("webpresence/webpresence_html.xsl")));
sheet.setFileName(QStandardPaths::locate(QStandardPaths::DataLocation, QStringLiteral("webpresence/webpresence_html.xsl")));
}
break;
case WEB_XHTML:
if (WebPresenceConfig::self()->useImagesHTML()) {
sheet.setFileName(KStandardDirs::locate("appdata", QStringLiteral("webpresence/webpresence_xhtml_images.xsl")));
sheet.setFileName(QStandardPaths::locate(QStandardPaths::DataLocation, QStringLiteral("webpresence/webpresence_xhtml_images.xsl")));
} else {
sheet.setFileName(KStandardDirs::locate("appdata", QStringLiteral("webpresence/webpresence_xhtml.xsl")));
sheet.setFileName(QStandardPaths::locate(QStandardPaths::DataLocation, QStringLiteral("webpresence/webpresence_xhtml.xsl")));
}
break;
case WEB_CUSTOM:
......
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