diff --git a/src/libtomahawk/widgets/checkdirtree.cpp b/src/libtomahawk/widgets/checkdirtree.cpp index 96a7440f4..66ab932bf 100644 --- a/src/libtomahawk/widgets/checkdirtree.cpp +++ b/src/libtomahawk/widgets/checkdirtree.cpp @@ -20,6 +20,7 @@ #include "checkdirtree.h" #include "utils/logger.h" +#include "tomahawksettings.h" #include @@ -57,7 +58,9 @@ CheckDirModel::getFileInfoResult() if ( res == "1" ) { // Remove the hidden flag for the /Volumnes folder so all mount points are visible in the default (Q)FileSystemModel - QProcess::startDetached( QString( "SetFile -a v %1" ).arg( s_macVolumePath ) ); + QProcess* p = new QProcess( this ); + connect( p, SIGNAL( finished( int, QProcess::ExitStatus ) ), this, SLOT( volumeShowFinished() ) ); + p->start( QString( "SetFile -a v %1" ).arg( s_macVolumePath ) ); m_shownVolumes = true; } @@ -65,6 +68,12 @@ CheckDirModel::getFileInfoResult() #endif } +void +CheckDirModel::volumeShowFinished() +{ + reset(); +} + Qt::ItemFlags CheckDirModel::flags( const QModelIndex& index ) const { @@ -150,6 +159,8 @@ CheckDirTree::CheckDirTree( QWidget* parent ) SLOT( updateNode( QModelIndex ) ) ); connect( &m_dirModel, SIGNAL( dataChangedByUser( const QModelIndex& ) ), SIGNAL( changed() ) ); + connect( &m_dirModel, SIGNAL( modelReset() ), + SLOT( modelReset() ) ); connect( this, SIGNAL( collapsed( QModelIndex ) ), SLOT( onCollapse( QModelIndex ) ) ); @@ -301,6 +312,16 @@ CheckDirTree::updateNode( const QModelIndex& idx ) } +void +CheckDirTree::modelReset() +{ + foreach ( const QString& dir, TomahawkSettings::instance()->scannerPaths() ) + { + checkPath( dir, Qt::Checked ); + } +} + + void CheckDirTree::fillDown( const QModelIndex& parent ) { diff --git a/src/libtomahawk/widgets/checkdirtree.h b/src/libtomahawk/widgets/checkdirtree.h index 1ea22d2f0..3c8119534 100644 --- a/src/libtomahawk/widgets/checkdirtree.h +++ b/src/libtomahawk/widgets/checkdirtree.h @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2011, Leo Franchi * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,6 +45,7 @@ signals: private slots: void getFileInfoResult(); + void volumeShowFinished(); private: QHash m_checkTable; @@ -73,6 +75,7 @@ private slots: void onExpand( const QModelIndex& idx ); void updateNode( const QModelIndex& idx ); + void modelReset(); private: CheckDirModel m_dirModel; QSet m_expandedSet;