1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 22:56:42 +02:00

* Modify Tomahawk's config file to be only accessible by the owner.

This commit is contained in:
Christian Muehlhaeuser
2012-02-23 04:36:30 +01:00
parent 55e7d6383b
commit 396b5cd6e0

View File

@@ -47,6 +47,11 @@ TomahawkSettings::TomahawkSettings( QObject* parent )
{ {
s_instance = this; s_instance = this;
#ifdef Q_OS_LINUX
QFile file( fileName() );
file.setPermissions( file.permissions() & ~(QFile::ReadGroup | QFile::WriteGroup | QFile::ExeGroup | QFile::ReadOther | QFile::WriteOther | QFile::ExeOther ) );
#endif
if ( !contains( "configversion" ) ) if ( !contains( "configversion" ) )
{ {
setValue( "configversion", VERSION ); setValue( "configversion", VERSION );
@@ -68,7 +73,6 @@ TomahawkSettings::TomahawkSettings( QObject* parent )
// insert upgrade code here as required // insert upgrade code here as required
setValue( "configversion", VERSION ); setValue( "configversion", VERSION );
} }
} }
@@ -98,7 +102,8 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion )
setValue( "script/loadedresolvers", value( "script/resolvers" ) ); setValue( "script/loadedresolvers", value( "script/resolvers" ) );
remove( "script/resolvers" ); remove( "script/resolvers" );
} }
} else if( oldVersion == 2 ) }
else if ( oldVersion == 2 )
{ {
qDebug() << "Migrating config from version 2 to 3: Converting jabber and twitter accounts to new SIP Factory approach"; qDebug() << "Migrating config from version 2 to 3: Converting jabber and twitter accounts to new SIP Factory approach";
// migrate old accounts to new system. only jabber and twitter, and max one each. create a new plugin for each if needed // migrate old accounts to new system. only jabber and twitter, and max one each. create a new plugin for each if needed
@@ -144,7 +149,8 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion )
} }
// create a zeroconf plugin too // create a zeroconf plugin too
addSipPlugin( "sipzeroconf_legacy" ); addSipPlugin( "sipzeroconf_legacy" );
} else if ( oldVersion == 3 ) }
else if ( oldVersion == 3 )
{ {
if ( contains( "script/atticaresolverstates" ) ) if ( contains( "script/atticaresolverstates" ) )
{ {
@@ -183,7 +189,8 @@ TomahawkSettings::doUpgrade( int oldVersion, int newVersion )
tDebug() << "UPGRADING AND DELETING:" << resolverDir.absolutePath(); tDebug() << "UPGRADING AND DELETING:" << resolverDir.absolutePath();
TomahawkUtils::removeDirectory( resolverDir.absolutePath() ); TomahawkUtils::removeDirectory( resolverDir.absolutePath() );
} }
} else if ( oldVersion == 4 ) }
else if ( oldVersion == 4 )
{ {
// 0.3.0 contained a bug which prevent indexing local files. Force a reindex. // 0.3.0 contained a bug which prevent indexing local files. Force a reindex.
QTimer::singleShot( 0, this, SLOT( updateIndex() ) ); QTimer::singleShot( 0, this, SLOT( updateIndex() ) );
@@ -935,6 +942,7 @@ TomahawkSettings::setNowPlayingEnabled( bool enable )
setValue( "adium/enablenowplaying", enable ); setValue( "adium/enablenowplaying", enable );
} }
TomahawkSettings::PrivateListeningMode TomahawkSettings::PrivateListeningMode
TomahawkSettings::privateListeningMode() const TomahawkSettings::privateListeningMode() const
{ {