Commit 2123176d authored by Rafał Malinowski's avatar Rafał Malinowski

mpris: define variables only when required

Signed-off-by: Rafał Malinowski's avatarRafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent 0f45772a
......@@ -100,13 +100,11 @@ void MPRISPlayer::replacePlugin()
void MPRISPlayer::choosePlayer(const QString &key, const QString &value)
{
PlainConfigFile globalPlayersFile(MPRISPlayer::globalPlayersListFileName());
PlainConfigFile userPlayersFile(MPRISPlayer::userPlayersListFileName());
// Save service value from mpris_mediaplayer module
if (key == "mpris_mediaplayer")
{
QString oldMPRISService = config_file->readEntry("MediaPlayer", "MPRISService");
PlainConfigFile userPlayersFile(MPRISPlayer::userPlayersListFileName());
userPlayersFile.writeEntry(value, "player", value);
userPlayersFile.writeEntry(value, "service", oldMPRISService);
......@@ -117,6 +115,8 @@ void MPRISPlayer::choosePlayer(const QString &key, const QString &value)
}
else // Choose player based on old module loaded.
{
PlainConfigFile globalPlayersFile(MPRISPlayer::globalPlayersListFileName());
config_file->writeEntry("MPRISPlayer", "Player", value);
config_file->writeEntry("MPRISPlayer", "Service", globalPlayersFile.readEntry(value, "service"));
}
......
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