1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-23 03:37:15 +01:00

* RCS.cpp, FWWindow.cpp: Fixed #1334 Program failed to open data

file on Windows if it was stored on mounted network volume.
"File/Open" operation terminated with no error but did not load
the file. "File/Open Recent" ended with an error message that
quoted file path as somehting like this:
"Volume{3c50bdba-21b0-4ea5-b52f-aa5d9755f918}/test1.fwb"
which was obviously incorrect and the file could not be loaded.
This commit is contained in:
SVN User 2010-03-16 22:31:45 +00:00
parent c69b8f3188
commit ec251ede27
4 changed files with 39 additions and 8 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 2723
#define BUILD_NUM 2724

View File

@ -1,3 +1,13 @@
2010-03-16 <vadim@vk.crocodile.org>
* RCS.cpp, FWWindow.cpp: Fixed #1334 Program failed to open data
file on Windows if it was stored on mounted network volume.
"File/Open" operation terminated with no error but did not load
the file. "File/Open Recent" ended with an error message that
quoted file path as somehting like this:
"Volume{3c50bdba-21b0-4ea5-b52f-aa5d9755f918}/test1.fwb"
which was obviously incorrect and the file could not be loaded.
2010-03-15 vadim <vadim@vk.crocodile.org>
* PolicyCompiler_PrintRule.cpp (PrintRule::_printOptionalGlobalRules):

View File

@ -624,16 +624,32 @@ void FWWindow::fileOpen()
return ;
}
// Using absoluteFilePath(), see #1334
QFileInfo fi(file_name);
QString file_path = fi.canonicalFilePath();
QMdiSubWindow* sw = alreadyOpened(file_path);
QString file_path = fi.absoluteFilePath();
if (fwbdebug) qDebug() << "FWWindow::fileOpen():"
<< "File name: " << file_name
<< "Absolute file path: " << file_path;
QMdiSubWindow* sw = alreadyOpened(file_name);
if (sw != NULL)
{
if (fwbdebug) qDebug() << "This file is already opened";
// activate window with this file
m_mainWindow->m_space->setActiveSubWindow(sw);
return;
}
QFileInfo file_path_info(file_path);
if (!file_path_info.exists() || !file_path_info.isReadable())
{
QMessageBox::warning(
this,"Firewall Builder",
tr("File '%1' does not exist or is not readable").arg(file_path));
return;
}
if (loadFile(file_path, false))
{
updateOpenRecentMenu(file_name);
@ -643,19 +659,23 @@ void FWWindow::fileOpen()
QCoreApplication::postEvent(this, new updateSubWindowTitlesEvent());
} else
m_mainWindow->m_space->setActiveSubWindow(last_active_window);
}
QMdiSubWindow* FWWindow::alreadyOpened(const QString &file_name)
{
QFileInfo fi(file_name);
QString file_path = fi.canonicalFilePath();
QString file_path = fi.absoluteFilePath();
if (fwbdebug) qDebug() << "FWWindow::alreadyOpened():"
<< "File name: " << file_name
<< "Absolute file path: " << file_path;
foreach(QMdiSubWindow* sw, m_mainWindow->m_space->subWindowList())
{
ProjectPanel * pp = dynamic_cast<ProjectPanel *>(sw->widget());
if (pp!=NULL)
{
if (fwbdebug) qDebug() << "Opened file " << pp->getFileName();
if (fwbdebug) qDebug() << "Opened file" << pp->getFileName();
if (pp->getFileName() == file_path) return sw;
}
}

View File

@ -303,8 +303,9 @@ RCS::RCS(const QString &file)
if (fwbdebug) qDebug() << "RCS::RCS(" << file << ")";
// Using absoluteFilePath() rather than canonicalFilePath, see #1334
QFileInfo fi(file);
if (fi.exists()) filename = fi.canonicalFilePath();
if (fi.exists()) filename = fi.absoluteFilePath();
else filename = file;
if (fwbdebug) qDebug() << "filename=" << filename;
@ -469,7 +470,7 @@ void RCS::readFromStderr()
void RCS::setFileName(const QString &fn)
{
QFileInfo fi(fn);
if (fi.exists()) filename = fi.canonicalFilePath();
if (fi.exists()) filename = fi.absoluteFilePath();
else filename = fn;
if (fwbdebug)
qDebug() << "RCS::setFileName fn =" << fn << "filename =" << filename;