void ModelBackendOneFile::addDir ( const QString& dirPath )
{
    // IMPORTANT: Keep in mind that the dirPath is not guaranteed to exist during the whole function (i.e a SD card may be extracted)
    QString path(QDir::cleanPath(dirPath));// Copy of the reference dirPath

    m_pathsMount.insert(path, false);

    // Load path files MetaInfo
    bool bRet = loadMetaInfo(path);
    if(!bRet)
    {
        qWarning() << Q_FUNC_INFO << "Error loading metaInfo, exiting";
        removeDir(path);// TODO: Do partial remove to make it faster
        return;
    }

    // Load path dir looking for new files
    QStringList booksPaths;
    bRet = booksToLoad(path, booksPaths);
    if(!bRet)
    {
        qDebug() << Q_FUNC_INFO << "Error loading books, Exiting";
        removeDir(path);// TODO: Do partial remove to make it faster
        return;
    }

    qDebug() << Q_FUNC_INFO << "Books to load: " << booksPaths;

    int totalBooks = booksPaths.size();
    if(path != _privatePartition)
    {
        if(totalBooks > BOOKS_LOADED_TO_SHOW_DIALOG) // For 20 books or more it shows progress dialog
            emit loadingBooks(totalBooks);
    }

    bRet = load(booksPaths);
    if(!bRet)
    {
        qDebug() << Q_FUNC_INFO << "Error. Exiting";
        removeDir(path);// TODO: Do partial remove to make it faster
        emit loadFinished();
        return;
    }

    qDebug() << Q_FUNC_INFO << "Before load finished";

    emit loadFinished();

    qDebug() << Q_FUNC_INFO << "After load finished";

    qDebug() << Q_FUNC_INFO << "dir path: " << path << "_privatePartition: " << _privatePartition;
    if(QDir::cleanPath(path) == QDir::cleanPath(_privatePartition))
        loadArchivedBooks();

    messDir(path, UPDATE_FULL);
}
ParameterFileModel::ParameterFileModel(
			QString fName, QObject* myParent, QString metaFile) :
		QAbstractTableModel(myParent),
		_resetMutex(new QMutex()),
		_parameterFile(new QParameterFile()),
		_fileName(fName),
		_prefix(""),
		_metaInfos(0),
		_useMetaInfo(false),
		_onlyParams(false),
		_minPriority(0),
		_handleDynamics(true)
{
	// this ParameterFile stores the description of classes.
	if (!metaFile.isEmpty()) {
		loadMetaInfo(metaFile);
		setOnlyParams(true);
	}
	if (!_fileName.isEmpty())
		_load();

	connect(this, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
		SLOT(_updatePriority(QModelIndex,QModelIndex)));
}