Commit 3eb708f2 authored by Rafał Malinowski's avatar Rafał Malinowski

mpris: use QSettings intead of PlainConfigFile

Signed-off-by: Rafał Malinowski's avatarRafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent 2123176d
......@@ -21,6 +21,7 @@
*/
#include <QtCore/QFile>
#include <QtCore/QSettings>
#include "configuration/configuration-file.h"
#include "core/core.h"
......@@ -104,21 +105,23 @@ void MPRISPlayer::choosePlayer(const QString &key, const QString &value)
if (key == "mpris_mediaplayer")
{
QString oldMPRISService = config_file->readEntry("MediaPlayer", "MPRISService");
PlainConfigFile userPlayersFile(MPRISPlayer::userPlayersListFileName());
QSettings userPlayersSettings(MPRISPlayer::userPlayersListFileName(), QSettings::IniFormat);
userPlayersSettings.setIniCodec("ISO8859-2");
userPlayersFile.writeEntry(value, "player", value);
userPlayersFile.writeEntry(value, "service", oldMPRISService);
userPlayersFile.sync();
userPlayersSettings.setValue(value + "/player", value);
userPlayersSettings.setValue(value + "/service", oldMPRISService);
userPlayersSettings.sync();
config_file->writeEntry("MPRISPlayer", "Player", value);
config_file->writeEntry("MPRISPlayer", "Service", oldMPRISService);
}
else // Choose player based on old module loaded.
{
PlainConfigFile globalPlayersFile(MPRISPlayer::globalPlayersListFileName());
QSettings globalPlayersSettings(MPRISPlayer::globalPlayersListFileName(), QSettings::IniFormat);
globalPlayersSettings.setIniCodec("ISO8859-2");
config_file->writeEntry("MPRISPlayer", "Player", value);
config_file->writeEntry("MPRISPlayer", "Service", globalPlayersFile.readEntry(value, "service"));
config_file->writeEntry("MPRISPlayer", "Service", globalPlayersSettings.value(value + "/service").toString());
}
}
......
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