Commit 57907a9d authored by Jan Möbius's avatar Jan Möbius

Fix bug in recent files, ignoring type

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12252 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e5f26be7
......@@ -1013,15 +1013,26 @@ Core::slotRecentOpen(QAction* _action)
{
QStringList recentFiles = OpenFlipperSettings().value("Core/File/RecentFiles", QStringList()).toStringList();
QStringList recentTypes = OpenFlipperSettings().value("Core/File/RecentTypes", QStringList()).toStringList();
// The type of the file to open is attached to the action as a string.
QString actionTypeName = _action->data().toString();
// Iterate over all recent files
for (int i = 0 ; i < recentFiles.size() ; ++i )
if ( recentFiles[i] == _action->text() ){
// If the name matches and also the type, we open it.
if ( (recentFiles[i] == _action->text()) && ( actionTypeName == recentTypes[i] ) ){
OpenFlipper::Options::loadingRecentFile(true);
loadObject(typeId(recentTypes[i]), recentFiles[i]);
coreWidget_->addRecent(recentFiles[i],typeId(recentTypes[i]) );
OpenFlipper::Options::loadingRecentFile(false);
return;
}
emit log(LOGERR, tr("Unable to open recent. Unable to find %1 with datatype %2 in recent files list.").arg(_action->text()).arg(actionTypeName) );
}
......
......@@ -838,10 +838,15 @@ CoreWidget::updateRecent()
QFileInfo fi(recentFiles[i]);
if (fi.suffix() == "ini")
recentFilesMenu_->addAction(QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator()+"Settings-Icon.png"), recentFiles[i]);
else
recentFilesMenu_->addAction(typeIcon( typeId(recentTypes[i]) ), recentFiles[i]);
QAction* newAction = 0;
if (fi.suffix() == "ini") {
newAction = recentFilesMenu_->addAction(QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator()+"Settings-Icon.png"), recentFiles[i]);
newAction->setData( QVariant( QString("ini") ) );
} else {
newAction = recentFilesMenu_->addAction(typeIcon( typeId(recentTypes[i]) ), recentFiles[i]);
newAction->setData( QVariant( recentTypes[i]) );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment