Recent files should remember the editor type as well.

Task-number: QTCREATORBUG-1785
This commit is contained in:
con
2010-12-09 11:37:58 +01:00
parent f1021f2a18
commit abd4a7b931
4 changed files with 63 additions and 33 deletions

View File

@@ -1278,11 +1278,11 @@ void MainWindow::aboutToShowRecentFiles()
aci->menu()->clear();
bool hasRecentFiles = false;
foreach (const QString &fileName, m_fileManager->recentFiles()) {
foreach (const FileManager::RecentFile &file, m_fileManager->recentFiles()) {
hasRecentFiles = true;
QAction *action = aci->menu()->addAction(
QDir::toNativeSeparators(Utils::withTildeHomePath(fileName)));
action->setData(fileName);
QDir::toNativeSeparators(Utils::withTildeHomePath(file.first)));
action->setData(qVariantFromValue(file));
connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
}
aci->menu()->setEnabled(hasRecentFiles);
@@ -1291,9 +1291,8 @@ void MainWindow::aboutToShowRecentFiles()
void MainWindow::openRecentFile()
{
if (const QAction *action = qobject_cast<const QAction*>(sender())) {
const QString fileName = action->data().toString();
if (!fileName.isEmpty())
editorManager()->openEditor(fileName, QString(), Core::EditorManager::ModeSwitch);
const FileManager::RecentFile file = action->data().value<FileManager::RecentFile>();
editorManager()->openEditor(file.first, file.second, Core::EditorManager::ModeSwitch);
}
}