Example #1
0
void CorePlugin::fileClosed(const QString &pFileName)
{
    // Add, if isn't new and it still exists (i.e. we are not here because the
    // file has been deleted), the file to our list of recent files (making sure
    // that we don't end up with more than 10 recent file names) and update our
    // Reopen sub-menu
    // Note: the most recent file is to be shown first...

    FileManager *fileManagerInstance = FileManager::instance();

    if (   !fileManagerInstance->isNew(pFileName)
        &&  QFile::exists(pFileName)) {
        if (fileManagerInstance->isRemote(pFileName))
            mRecentFileNamesOrUrls.prepend(fileManagerInstance->url(pFileName));
        else
            mRecentFileNamesOrUrls.prepend(pFileName);

        while (mRecentFileNamesOrUrls.count() > 10)
            mRecentFileNamesOrUrls.removeLast();

        updateFileReopenMenu();
    }
}