comparison framework/MainWindowBase.cpp @ 225:9d50c42d7ca0 templating

Don't add templates to Recent Files
author Chris Cannam
date Tue, 10 May 2011 19:37:45 +0100
parents 46213a34900f
children 2c827ac7c8e7
comparison
equal deleted inserted replaced
224:46213a34900f 225:9d50c42d7ca0
1593 } 1593 }
1594 1594
1595 QXmlInputSource *inputSource = 0; 1595 QXmlInputSource *inputSource = 0;
1596 BZipFileDevice *bzFile = 0; 1596 BZipFileDevice *bzFile = 0;
1597 QFile *rawFile = 0; 1597 QFile *rawFile = 0;
1598 bool isTemplate = false;
1598 1599
1599 if (source.getExtension().toLower() == "sv") { 1600 if (source.getExtension().toLower() == "sv") {
1600 bzFile = new BZipFileDevice(source.getLocalFilename()); 1601 bzFile = new BZipFileDevice(source.getLocalFilename());
1601 if (!bzFile->open(QIODevice::ReadOnly)) { 1602 if (!bzFile->open(QIODevice::ReadOnly)) {
1602 delete bzFile; 1603 delete bzFile;
1603 return FileOpenFailed; 1604 return FileOpenFailed;
1604 } 1605 }
1605 inputSource = new QXmlInputSource(bzFile); 1606 inputSource = new QXmlInputSource(bzFile);
1606 } else { 1607 } else {
1608 if (source.getExtension().toLower() == "svt") {
1609 isTemplate = true;
1610 }
1607 rawFile = new QFile(source.getLocalFilename()); 1611 rawFile = new QFile(source.getLocalFilename());
1608 inputSource = new QXmlInputSource(rawFile); 1612 inputSource = new QXmlInputSource(rawFile);
1609 } 1613 }
1610 1614
1611 if (!checkSaveModified()) { 1615 if (!checkSaveModified()) {
1660 CommandHistory::getInstance()->clear(); 1664 CommandHistory::getInstance()->clear();
1661 CommandHistory::getInstance()->documentSaved(); 1665 CommandHistory::getInstance()->documentSaved();
1662 m_documentModified = false; 1666 m_documentModified = false;
1663 updateMenuStates(); 1667 updateMenuStates();
1664 1668
1665 m_recentFiles.addFile(source.getLocation()); 1669 if (!isTemplate) {
1670 m_recentFiles.addFile(source.getLocation());
1671 }
1666 1672
1667 if (!source.isRemote()) { 1673 if (!source.isRemote()) {
1668 // for file dialog 1674 // for file dialog
1669 registerLastOpenedFilePath(FileFinder::SessionFile, 1675 registerLastOpenedFilePath(FileFinder::SessionFile,
1670 source.getLocalFilename()); 1676 source.getLocalFilename());