コード例 #1
0
ファイル: coreplugin.cpp プロジェクト: nickerso/opencor
void CorePlugin::fileOpened(const QString &pFileName)
{
    // Remove the file from our list of recent files and update our Reopen
    // sub-menu

    FileManager *fileManagerInstance = FileManager::instance();

    if (fileManagerInstance->isRemote(pFileName))
        mRecentFileNamesOrUrls.removeOne(fileManagerInstance->url(pFileName));
    else
        mRecentFileNamesOrUrls.removeOne(pFileName);

    updateFileReopenMenu();
}
コード例 #2
0
ファイル: coreplugin.cpp プロジェクト: nickerso/opencor
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();
    }
}