1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-20 18:27:16 +01:00

bugs 2091507, 2091520

This commit is contained in:
Vadim Kurland 2008-09-07 03:47:19 +00:00
parent e69b8021a2
commit c829718295
30 changed files with 282 additions and 254 deletions

10
VERSION
View File

@ -3,18 +3,18 @@
FWB_MAJOR_VERSION=3
FWB_MINOR_VERSION=0
FWB_MICRO_VERSION=0
VERSION="3.0.0"
SHORTVERSION="300"
FWB_MICRO_VERSION=1
VERSION="3.0.1"
SHORTVERSION="301"
# RELEASE="1"
RELEASE="b@BUILD_NUM@"
BETA="no"
REQUIRED_LIBFWBUILDER_VERSION="3.0.0"
REQUIRED_LIBFWBUILDER_VERSION="3.0.1"
# current (or major) version number of the library so file
#
LIBFWBUILDER_SOMAJOR=7
LIBFWBUILDER_SOMAJOR=8

View File

@ -1,2 +1,2 @@
#define VERSION "3.0.0"
#define VERSION "3.0.1"
#define RELEASE_NUM ""

View File

@ -1 +1 @@
#define BUILD_NUM 507
#define BUILD_NUM 515

View File

@ -1,5 +1,23 @@
2008-09-06 Vadim Kurland <vadim@vk.crocodile.org>
* FWWindow.cpp (FWWindow::projectWindowClosed): fixed bug
#2091520: "Crash FWB". The GUI crashed if user closed mdi window
showing just standard objects and then tried to close the main
window.
* FWWindow.cpp (FWWindow::fileNew): fixed bug #2091507: "Create
New Firewall problem.". If user created new data file using
File/New main menu item, items in the main menu File used to stay
disabled and file could only be saved using "File/Save As" (which
did not make sense because the name has already been assigned to
the file during File/New operation).
* ProjectPanel_file_ops.cpp (ProjectPanel::fileSaveAs): bugfix: if
user called "Save As" and then hit Cancel in the dialog where they
choose file name, internal RCS object used to be deleted anyway.
* v3.0.1 started
* v3.0.0 released Sep 1, 2008. Merged branch "v3" r512 to trunk
2008-09-01 Vadim Kurland <vadim@vk.crocodile.org>

View File

@ -12,7 +12,7 @@ DEFINES += $$(DEFINES)
LANGUAGE = C++
UI_DIR = ui
MANDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/man/
DOCDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
DOCDIR = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.1
HAVE_ANTLR_RUNTIME = 1
HAVE_EXTERNAL_ANTLR = 0
@ -43,7 +43,7 @@ unix {
target.path = $$PREFIX/bin
dtd.path = @TEMPLATE_DIR@/
migration.path = @TEMPLATE_DIR@/migration
doc.path = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.0
doc.path = /home/vadim/src/fwb3-branch-v3/install_root/share/doc/fwbuilder-3.0.1
datadir.path = /home/vadim/src/fwb3-branch-v3/install_root/share/
@ -51,10 +51,10 @@ unix {
# unix:target.path = $$PREFIX/share/fwbuilder/
# macx:target.path = $$PREFIX/
res.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0
res_os.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/os/
res_platform.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/platform/
res_help.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.0/help/
res.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.1
res_os.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.1/os/
res_platform.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.1/platform/
res_help.path = /home/vadim/src/fwb3-branch-v3/install_root/share/fwbuilder-3.0.1/help/
res_desktop.path = /home/vadim/src/fwb3-branch-v3/install_root/share//applications/
INSTALLS += res

View File

@ -197,10 +197,12 @@ FWWindow::FWWindow() : QMainWindow(), // QMainWindow(NULL, Qt::Desktop),
connect( m_mainWindow->ObjectMenu, SIGNAL (aboutToShow() ),
this, SLOT( prepareObjectMenu() ));
connect( m_mainWindow->fileMenu, SIGNAL (aboutToShow() ),
this, SLOT( prepareFileMenu() ));
connect( m_space, SIGNAL(subWindowActivated (QMdiSubWindow *)),
this, SLOT(changeActiveSubwindow()));
if (fwbdebug)
qDebug("/FWWindow constructor");
recreateWindowsMenu();
disableActions(false);
@ -247,7 +249,7 @@ ProjectPanel* FWWindow::activeProject()
{
QMdiSubWindow *w = m_space->currentSubWindow();
if (w) return dynamic_cast<ProjectPanel*>(w->widget());
return 0;
return NULL;
}
void FWWindow::killInstDialog()
@ -260,7 +262,7 @@ void FWWindow::killInstDialog()
}
}
void FWWindow::updateWindowTitle ()
void FWWindow::updateWindowTitle()
{
if (activeProject())
{
@ -343,7 +345,7 @@ void FWWindow::fileNew()
if (proj->fileNew())
{
showSub(proj);
proj->startupLoad();
//proj->startupLoad();
}
else
{
@ -351,26 +353,6 @@ void FWWindow::fileNew()
}
}
void FWWindow::addToRCSActionSetEn(bool en)
{
m_mainWindow->addToRCSAction->setEnabled(en);
}
void FWWindow::fileDiscardActionSetEn(bool en)
{
m_mainWindow->fileDiscardAction->setEnabled(en);
}
void FWWindow::fileCommitActionSetEn(bool en)
{
m_mainWindow->fileCommitAction->setEnabled(en);
}
void FWWindow::fileSaveActionSetEn(bool en)
{
m_mainWindow->fileSaveAction->setEnabled(en);
}
void FWWindow::fileOpen()
{
std::auto_ptr<ProjectPanel> proj(newProjectPanel());
@ -386,7 +368,19 @@ void FWWindow::fileOpen()
void FWWindow::fileClose()
{
if (activeProject()) activeProject()->fileClose();
if (fwbdebug) qDebug("FWWindow::fileClose()");
if (activeProject())
{
ProjectPanel * project = activeProject();
if (!project->saveIfModified()) return; // abort operation
project->saveState();
project->fileClose();
}
if (fwbdebug) qDebug("subWindowList().size()=%d",
m_space->subWindowList().size());
recreateWindowsMenu();
}
@ -460,34 +454,29 @@ void FWWindow::importPolicy()
void FWWindow::load(QWidget *dialogs_parent)
{
if (activeProject())
activeProject()->load(dialogs_parent);
if (activeProject()) activeProject()->load(dialogs_parent);
}
FWObject* FWWindow::getVisibleFirewalls()
{
if (activeProject())
return activeProject()->getVisibleFirewall();
if (activeProject()) return activeProject()->getVisibleFirewall();
return 0;
}
void FWWindow::load(QWidget *dialogs_parent,RCS *_rcs)
{
if (activeProject())
activeProject()->load(dialogs_parent, _rcs);
if (activeProject()) activeProject()->load(dialogs_parent, _rcs);
}
bool FWWindow::checkin(bool unlock)
{
if (activeProject())
return activeProject()->checkin(unlock);
if (activeProject()) return activeProject()->checkin(unlock);
return false;
}
void FWWindow::save()
{
if (activeProject())
activeProject()->save();
if (activeProject()) activeProject()->save();
}
void FWWindow::loadLibrary(const string &libfpath)
@ -498,35 +487,30 @@ void FWWindow::loadLibrary(const string &libfpath)
void FWWindow::fileImport()
{
if (activeProject())
activeProject()->fileImport();
if (activeProject()) activeProject()->fileImport();
}
void FWWindow::fileCompare()
{
if (activeProject())
activeProject()->fileCompare();
if (activeProject()) activeProject()->fileCompare();
}
void FWWindow::findExternalRefs(FWObject *lib,
FWObject *root,
list<FWReference*> &extRefs)
{
if (activeProject())
activeProject()->findExternalRefs(lib, root, extRefs);
if (activeProject()) activeProject()->findExternalRefs(lib, root, extRefs);
}
void FWWindow::setSafeMode(bool f)
{
if (activeProject())
activeProject()->setSafeMode(f);
if (activeProject()) activeProject()->setSafeMode(f);
}
void FWWindow::setStartupFileName(const QString &fn)
{
if (activeProject())
activeProject()->setStartupFileName(fn);
if (activeProject()) activeProject()->setStartupFileName(fn);
}
bool FWWindow::exportLibraryTest(list<FWObject*> &selectedLibs)
@ -562,8 +546,7 @@ void FWWindow::exportLibraryTo(QString fname,list<FWObject*> &selectedLibs, bool
void FWWindow::fileExport()
{
if (activeProject())
activeProject()->fileExport();
if (activeProject()) activeProject()->fileExport();
}
void FWWindow::setActionsEnabled(bool en)
@ -585,15 +568,13 @@ void FWWindow::setActionsEnabled(bool en)
int FWWindow::findFirewallInList(FWObject *f)
{
if (activeProject())
return activeProject()->findFirewallInList(f);
if (activeProject()) return activeProject()->findFirewallInList(f);
return -1;
}
void FWWindow::ensureObjectVisibleInRules(FWReference *obj)
{
if (activeProject())
activeProject()->ensureObjectVisibleInRules(obj);
if (activeProject()) activeProject()->ensureObjectVisibleInRules(obj);
}
/*
@ -601,14 +582,12 @@ void FWWindow::ensureObjectVisibleInRules(FWReference *obj)
*/
void FWWindow::ensureRuleIsVisible(Rule *rule, int col)
{
if (activeProject())
activeProject()->ensureRuleIsVisible(rule, col);
if (activeProject()) activeProject()->ensureRuleIsVisible(rule, col);
}
void FWWindow::updateRuleSetViewSelection()
{
if (activeProject())
activeProject()->updateRuleSetViewSelection();
if (activeProject()) activeProject()->updateRuleSetViewSelection();
}
void FWWindow::updateTreeViewItemOrder()
@ -616,44 +595,37 @@ void FWWindow::updateTreeViewItemOrder()
//this is for case when tree becomes to be resorted
//if we do not reopen parent item, some of child
//items mix incorrectly (maybe bug of QT?)
if (activeProject())
activeProject()->updateTreeViewItemOrder();
if (activeProject()) activeProject()->updateTreeViewItemOrder();
}
void FWWindow::updateRuleSetView()
{
if (activeProject())
activeProject()->updateRuleSetView();
if (activeProject()) activeProject()->updateRuleSetView();
}
void FWWindow::updateRuleOptions()
{
if (activeProject())
activeProject()->updateRuleOptions();
if (activeProject()) activeProject()->updateRuleOptions();
}
void FWWindow::updateFirewallName(FWObject *obj,const QString &str)
{
if (activeProject())
activeProject()->updateFirewallName(obj, str);
if (activeProject()) activeProject()->updateFirewallName(obj, str);
}
void FWWindow::scheduleRuleSetRedraw()
{
if (activeProject())
activeProject()->scheduleRuleSetRedraw();
if (activeProject()) activeProject()->scheduleRuleSetRedraw();
}
void FWWindow::redrawRuleSets()
{
if (activeProject())
activeProject()->redrawRuleSets();
if (activeProject()) activeProject()->redrawRuleSets();
}
void FWWindow::reopenFirewall()
{
if (activeProject())
activeProject()->reopenFirewall();
if (activeProject()) activeProject()->reopenFirewall();
}
void FWWindow::setEnabledAfterRF()
@ -689,14 +661,12 @@ void FWWindow::selectRules()
m_mainWindow ->compileAction->setEnabled( true );
m_mainWindow ->installAction->setEnabled( true );
if (activeProject())
activeProject()->selectRules();
if (activeProject()) activeProject()->selectRules();
}
void FWWindow::unselectRules()
{
if (activeProject())
activeProject()->unselectRules();
if (activeProject()) activeProject()->unselectRules();
}
void FWWindow::disableActions(bool havePolicies)
@ -718,8 +688,7 @@ void FWWindow::disableActions(bool havePolicies)
void FWWindow::editCopy()
{
if (activeProject())
activeProject()->editCopy();
if (activeProject()) activeProject()->editCopy();
}
void FWWindow::editCut()
@ -799,14 +768,12 @@ void FWWindow::install()
void FWWindow::changeInfoStyle()
{
if (activeProject())
activeProject()->changeInfoStyle();
if (activeProject()) activeProject()->changeInfoStyle();
}
void FWWindow::insertRule()
{
if (activeProject())
activeProject()->insertRule();
if (activeProject()) activeProject()->insertRule();
}
void FWWindow::addRuleAfterCurrent()
@ -817,62 +784,52 @@ void FWWindow::addRuleAfterCurrent()
void FWWindow::removeRule()
{
if (activeProject())
activeProject()->removeRule();
if (activeProject()) activeProject()->removeRule();
}
void FWWindow::moveRule()
{
if (activeProject())
activeProject()->moveRule();
if (activeProject()) activeProject()->moveRule();
}
void FWWindow::moveRuleUp()
{
if (activeProject())
activeProject()->moveRuleUp();
if (activeProject()) activeProject()->moveRuleUp();
}
void FWWindow::moveRuleDown()
{
if (activeProject())
activeProject()->moveRuleDown();
if (activeProject()) activeProject()->moveRuleDown();
}
void FWWindow::copyRule()
{
if (activeProject())
activeProject()->copyRule();
if (activeProject()) activeProject()->copyRule();
}
void FWWindow::cutRule()
{
if (activeProject())
activeProject()->cutRule();
if (activeProject()) activeProject()->cutRule();
}
void FWWindow::pasteRuleAbove()
{
if (activeProject())
activeProject()->pasteRuleAbove();
if (activeProject()) activeProject()->pasteRuleAbove();
}
void FWWindow::pasteRuleBelow()
{
if (activeProject())
activeProject()->pasteRuleBelow();
if (activeProject()) activeProject()->pasteRuleBelow();
}
void FWWindow::search()
{
if (activeProject())
activeProject()->search();
if (activeProject()) activeProject()->search();
}
void FWWindow::findWhereUsed(FWObject * obj)
{
if (activeProject())
activeProject()->findWhereUsed(obj);
if (activeProject()) activeProject()->findWhereUsed(obj);
}
void FWWindow::showEvent(QShowEvent *ev)
@ -889,14 +846,12 @@ void FWWindow::hideEvent(QHideEvent *ev)
void FWWindow::back()
{
if (activeProject())
activeProject()->back();
if (activeProject()) activeProject()->back();
}
void FWWindow::newObject()
{
if (activeProject())
activeProject()->newObject();
if (activeProject()) activeProject()->newObject();
}
// ObjectManipulator::lockObject calls
@ -904,8 +859,7 @@ void FWWindow::newObject()
// other windows
void FWWindow::lockObject()
{
if (activeProject())
activeProject()->lockObject();
if (activeProject()) activeProject()->lockObject();
}
// ObjectManipulator::unlockObject calls
@ -913,8 +867,7 @@ void FWWindow::lockObject()
// other windows
void FWWindow::unlockObject()
{
if (activeProject())
activeProject()->unlockObject();
if (activeProject()) activeProject()->unlockObject();
}
void FWWindow::prepareObjectMenu()
@ -926,49 +879,81 @@ void FWWindow::prepareObjectMenu()
m_mainWindow->ObjectLockAction->setEnabled(otv->isLockable());
}
void FWWindow::prepareFileMenu()
{
if (!activeProject())
{
m_mainWindow->fileCloseAction->setEnabled(false);
m_mainWindow->fileSaveAction->setEnabled(false);
m_mainWindow->fileSaveAsAction->setEnabled(false);
m_mainWindow->addToRCSAction->setEnabled(false);
m_mainWindow->fileCommitAction->setEnabled(false);
m_mainWindow->fileDiscardAction->setEnabled(false);
m_mainWindow->filePropAction->setEnabled(false);
return;
}
bool real_file_opened = (activeProject()->getFileName() != "");
bool in_rcs = (activeProject()->getRCS() != NULL &&
activeProject()->getRCS()->isCheckedOut());
if (fwbdebug)
qDebug("FWWindow::prepareFileMenu(): activeProject()=%p"
" activeProject()->getFileName()='%s'",
activeProject(),
activeProject()->getFileName().toAscii().constData());
m_mainWindow->fileSaveAction->setEnabled(real_file_opened);
m_mainWindow->fileCloseAction->setEnabled(real_file_opened);
m_mainWindow->filePropAction->setEnabled(real_file_opened);
m_mainWindow->filePrintAction->setEnabled(real_file_opened);
m_mainWindow->libExportAction->setEnabled(real_file_opened);
m_mainWindow->addToRCSAction->setEnabled(real_file_opened && !in_rcs);
m_mainWindow->fileCommitAction->setEnabled(real_file_opened && in_rcs);
m_mainWindow->fileDiscardAction->setEnabled(real_file_opened && in_rcs);
m_mainWindow->fileNewAction->setEnabled(true);
m_mainWindow->fileOpenAction->setEnabled(true);
m_mainWindow->fileSaveAsAction->setEnabled(true);
}
void FWWindow::setupAutoSave()
{
if (activeProject())
activeProject()->setupAutoSave();
if (activeProject()) activeProject()->setupAutoSave();
}
QString FWWindow::getCurrentFileName()
{
if (activeProject())
return activeProject()->getCurrentFileName();
if (activeProject()) return activeProject()->getCurrentFileName();
return "";
}
RCS * FWWindow::getRCS()
{
if (activeProject())
return activeProject()->getRCS();
if (activeProject()) return activeProject()->getRCS();
return 0;
}
void FWWindow::findObject(FWObject *o)
{
if (activeProject())
activeProject()->findObject(o);
if (activeProject()) activeProject()->findObject(o);
}
void FWWindow::closeAuxiliaryPanel()
{
if (activeProject())
activeProject()->closeAuxiliaryPanel();
if (activeProject()) activeProject()->closeAuxiliaryPanel();
}
void FWWindow::closeEditorPanel()
{
if (activeProject())
activeProject()->closeEditorPanel();
if (activeProject()) activeProject()->closeEditorPanel();
}
void FWWindow::openEditorPanel()
{
if (activeProject())
activeProject()->openEditorPanel();
if (activeProject()) activeProject()->openEditorPanel();
}
void FWWindow::editPrefs()
@ -1508,7 +1493,9 @@ void FWWindow::minimize()
QList<QMdiSubWindow *> subWindowList = m_space->subWindowList();
for (int i = 0 ; i < subWindowList.size();i++)
{
ProjectPanel * pp = dynamic_cast<ProjectPanel *>(subWindowList[i]->widget());
ProjectPanel * pp = dynamic_cast<ProjectPanel *>(
subWindowList[i]->widget());
if (pp!=NULL)
{
pp->loadState();
@ -1547,6 +1534,7 @@ void FWWindow::recreateWindowsMenu ()
connect(cascade, SIGNAL(triggered()), m_space, SLOT(cascadeSubWindows()));
connect(next, SIGNAL(triggered()),m_space, SLOT(activateNextSubWindow()));
connect(previous, SIGNAL(triggered()),m_space, SLOT(activatePreviousSubWindow()));
QList<QMdiSubWindow *> subWindowList = getMdiArea()->subWindowList();
QActionGroup * ag = new QActionGroup ( this );
ag->setExclusive ( true );
@ -1618,4 +1606,15 @@ void FWWindow::checkForUpgrade(const QString& server_response)
}
}
/*
* This slot is called after one of the mdi windows is closed.
*/
void FWWindow::projectWindowClosed()
{
if (fwbdebug) qDebug("FWWindow::projectWindowClosed()");
if (m_space->subWindowList().size() == 0)
QCoreApplication::exit(0);
}

View File

@ -157,7 +157,10 @@ public slots:
virtual void newObject();
virtual void lockObject();
virtual void unlockObject();
virtual void prepareObjectMenu();
virtual void prepareFileMenu();
virtual void toolsDiscoveryDruid();
virtual void closeAuxiliaryPanel();
virtual void closeEditorPanel();
@ -166,7 +169,9 @@ public slots:
virtual void killInstDialog();
virtual void checkForUpgrade(const QString&);
virtual void projectWindowClosed();
public:
Ui::FWBMainWindow_q *m_mainWindow;
@ -346,11 +351,6 @@ public slots:
//find dialog functions wrapers
void setFDObject(libfwbuilder::FWObject *o);
void addToRCSActionSetEn(bool en);
void fileDiscardActionSetEn(bool en);
void fileCommitActionSetEn(bool en);
void fileSaveActionSetEn(bool en);
QPrinter* getPrinter();
libfwbuilder::FWObjectDatabase* db();
QString printHeader();

View File

@ -64,11 +64,26 @@ void ProjectPanel::initMain(FWWindow *main)
// mdiWindow changes state several times right after it is opened,
// but we call saveState to store splitter position and its geometry
// when state changed. Flag "ready" is false after ProjectPanel is created
// when state changes. Flag "ready" is false after ProjectPanel is created
// and until FWWindow decides that ProjectPanel is ready for operation.
// Do not load or save state if flag ready is false.
ready = false;
int total_width = DEFAULT_H_SPLITTER_POSITION;
int total_height = DEFAULT_V_SPLITTER_POSITION;
if (mainW)
{
total_width = mainW->width();
total_height = mainW->height();
}
setMainSplitterPosition(DEFAULT_H_SPLITTER_POSITION,
total_width - DEFAULT_H_SPLITTER_POSITION);
setObjInfoSplitterPosition(DEFAULT_V_SPLITTER_POSITION,
total_height - DEFAULT_V_SPLITTER_POSITION);
enableAvtoSaveState=true ;
oldState=-1;
if (st->getInfoStyle()!=0) m_panel->oi->show();
@ -126,8 +141,7 @@ ProjectPanel::ProjectPanel(QWidget *parent):
findObjectWidget(0),
findWhereUsedWidget(0)
{
if (fwbdebug)
qDebug("ProjectPanel constructor");
if (fwbdebug) qDebug("ProjectPanel constructor");
m_panel = new Ui::ProjectPanel_q();
m_panel->setupUi(this);
firstTimeNormal = st->getInt("Window/maximized");
@ -550,7 +564,7 @@ QString ProjectPanel::getDestDir(const QString &fname)
void ProjectPanel::setFileName(const QString &fname)
{
systemFile=false;
systemFile = false;
rcs->setFileName(fname);
db()->setFileName(fname.toLatin1().constData());
@ -1313,13 +1327,16 @@ void ProjectPanel::closeEvent( QCloseEvent * ev)
mw->updateWindowTitle();
mw->recreateWindowsMenu();
if (fwbdebug) qDebug("ProjectPanel::closeEvent all done");
QTimer::singleShot( 0, mw, SLOT(projectWindowClosed()) );
if (fwbdebug) qDebug("ProjectPanel::closeEvent all done");
// emit closed();
}
QString ProjectPanel::getFileName()
{
if (fwbdebug) qDebug("ProjectPanel::getFileName() : rcs=%p", rcs);
if (rcs!=NULL)
{
QString FileName = rcs->getFileName();

View File

@ -55,6 +55,10 @@ class FindWhereUsedWidget;
class listOfLibraries;
class FWBTree;
#define DEFAULT_H_SPLITTER_POSITION 250
#define DEFAULT_V_SPLITTER_POSITION 450
class ProjectPanel: public QWidget {
Q_OBJECT
@ -386,6 +390,9 @@ protected:
virtual void resizeEvent ( QResizeEvent * event );
bool loadFile(const QString &fileName);
void setMainSplitterPosition(int w1, int w2);
void setObjInfoSplitterPosition(int w1, int w2);
};
#endif

View File

@ -145,8 +145,10 @@ void ProjectPanel::fileProp()
bool ProjectPanel::fileNew()
{
if (fwbdebug) qDebug("ProjectPanel::fileNew()");
QString nfn = chooseNewFileName(
st->getWDir(),true,
st->getWDir(), true,
tr("Choose name and location for the new file"));
if ( !nfn.isEmpty() )
@ -162,22 +164,12 @@ bool ProjectPanel::fileNew()
save();
setupAutoSave();
}
if (rcs!=NULL)
{
mainW->addToRCSActionSetEn(
!rcs->isInRCS() && !rcs->isRO() && !rcs->isTemp());
mainW->fileDiscardActionSetEn(
rcs->isInRCS() && !rcs->isRO() && !rcs->isTemp());
mainW->fileCommitActionSetEn(
rcs->isInRCS() && !rcs->isRO() && !rcs->isTemp());
mainW->fileSaveActionSetEn( !rcs->isRO() && !rcs->isTemp() );
return true ;
}
else
{
return false ;
}
if (fwbdebug)
qDebug("ProjectPanel::fileNew() rcs=%p rcs->getFileName()='%s'",
rcs, rcs->getFileName().toAscii().constData());
return (rcs!=NULL);
}
bool ProjectPanel::fileOpen()
@ -277,7 +269,7 @@ void ProjectPanel::fileClose()
{
if (fwbdebug) qDebug("ProjectPanel::fileClose(): start");
closing=true ;
closing = true ;
findObjectWidget->init();
if (isEditorVisible()) hideEditor();
@ -328,13 +320,7 @@ void ProjectPanel::fileSaveAs()
/* need to close the file without asking and saving, then reopen it again */
db()->setDirty(false); // so it wont ask if user wants to save
rcs->abandon();
QString oldFileName = rcs->getFileName();
if (rcs!=NULL) delete rcs;
rcs = new RCS("");
QString nfn = chooseNewFileName(
oldFileName, true,
@ -342,17 +328,16 @@ void ProjectPanel::fileSaveAs()
if (!nfn.isEmpty())
{
db()->setDirty(false); // so it wont ask if user wants to save
rcs->abandon();
if (rcs!=NULL) delete rcs;
rcs = new RCS("");
setFileName(nfn);
save();
mainW->addToRCSActionSetEn(
!rcs->isInRCS() && !rcs->isRO() && !rcs->isTemp());
mainW->fileDiscardActionSetEn(
rcs->isInRCS() && !rcs->isRO() && !rcs->isTemp());
mainW->fileCommitActionSetEn(
rcs->isInRCS() && !rcs->isRO() && !rcs->isTemp());
mainW->fileSaveActionSetEn( !rcs->isRO() && !rcs->isTemp() );
}
}
@ -455,12 +440,6 @@ void ProjectPanel::fileAddToRCS()
if (rcs->isRO()) caption = caption + " " + tr("(read-only)");
setWindowTitle( QString("Firewall Builder: ")+caption );
mainW->addToRCSActionSetEn( !rcs->isInRCS() && !rcs->isRO());
mainW->fileDiscardActionSetEn(
rcs->isInRCS() && !rcs->isRO() && !rcs->isTemp());
mainW->fileCommitActionSetEn(
rcs->isInRCS() && !rcs->isRO() && !rcs->isTemp());
}
void ProjectPanel::fileImport()
@ -1005,11 +984,6 @@ void ProjectPanel::load(QWidget*)
setWindowTitle( "Firewall Builder" );
mainW->fileSaveActionSetEn( false );
mainW->addToRCSActionSetEn( false );
mainW->fileDiscardActionSetEn( false );
mainW->fileCommitActionSetEn( false );
loadObjects();
setupAutoSave();
@ -1050,7 +1024,7 @@ void ProjectPanel::load(QWidget*, RCS* _rcs, FWObjectDatabase* clone)
try
{
systemFile=false;
systemFile = false;
objdb = clone;
sb->showMessage( tr("Loading system objects...") );
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
@ -1204,10 +1178,6 @@ void ProjectPanel::load(QWidget*, RCS* _rcs, FWObjectDatabase* clone)
setWindowTitle( QString("Firewall Builder: ")+caption );
mainW->fileSaveActionSetEn( !rcs->isRO() && !rcs->isTemp());
mainW->addToRCSActionSetEn( !rcs->isInRCS() && !rcs->isRO());
mainW->fileDiscardActionSetEn( rcs->isInRCS() && !rcs->isRO());
mainW->fileCommitActionSetEn( rcs->isInRCS() && !rcs->isRO());
mainW->disableActions(m_panel->ruleSets->count()!=0);
} catch(FWException &ex)
@ -1298,7 +1268,7 @@ void ProjectPanel::load(QWidget*, RCS *_rcs)
try
{
/* load the data file */
systemFile=false;
systemFile = false;
objdb = new FWObjectDatabase();
@ -1512,10 +1482,6 @@ void ProjectPanel::load(QWidget*, RCS *_rcs)
setWindowTitle( QString("Firewall Builder: ")+caption );
mainW->fileSaveActionSetEn( !rcs->isRO() && !rcs->isTemp());
mainW->addToRCSActionSetEn( !rcs->isInRCS() && !rcs->isRO());
mainW->fileDiscardActionSetEn( rcs->isInRCS() && !rcs->isRO());
mainW->fileCommitActionSetEn( rcs->isInRCS() && !rcs->isRO());
mainW->disableActions(m_panel->ruleSets->count()!=0);
} catch(FWException &ex)
@ -1536,12 +1502,12 @@ void ProjectPanel::load(QWidget*, RCS *_rcs)
elem.truncate(LONG_ERROR_CUTOFF);
msg+="\n"+tr("XML element : %1").arg(elem);
}
QMessageBox::critical(
this,"Firewall Builder",
tr("The program encountered error trying to load data file.\n"
"The file has not been loaded. Error:\n%1").arg(msg),
tr("&Continue"), QString::null,QString::null,
0, 1 );
QMessageBox::critical(
this,"Firewall Builder",
tr("The program encountered error trying to load data file.\n"
"The file has not been loaded. Error:\n%1").arg(msg),
tr("&Continue"), QString::null,QString::null,
0, 1 );
} else
{
QString error_txt = ex.toString().c_str();
@ -1551,13 +1517,13 @@ void ProjectPanel::load(QWidget*, RCS *_rcs)
error_txt += "\n\n" + tr("(Long error message was truncated)");
}
QMessageBox::critical(
this,"Firewall Builder",
tr("The program encountered error trying to load data file.\n"
"The file has not been loaded. Error:\n%1").arg(
error_txt),
tr("&Continue"), QString::null,QString::null,
0, 1 );
QMessageBox::critical(
this,"Firewall Builder",
tr("The program encountered error trying to load data file.\n"
"The file has not been loaded. Error:\n%1").arg(
error_txt),
tr("&Continue"), QString::null,QString::null,
0, 1 );
}
// load standard objects so the window does not remain empty
load(this);
@ -1603,7 +1569,9 @@ bool ProjectPanel::checkin(bool unlock)
QDialog *fsd_dialog = new QDialog(this);
fsd.setupUi(fsd_dialog);
fsd.checkinDialogTitle->setText(
QString("<b>")+tr("Checking file %1 in RCS").arg(rcs->getFileName())+QString("</b>")
QString("<b>") +
tr("Checking file %1 in RCS").arg(rcs->getFileName()) +
QString("</b>")
);
if ( fsd_dialog->exec()== QDialog::Rejected )
{
@ -1647,8 +1615,12 @@ bool ProjectPanel::checkin(bool unlock)
void ProjectPanel::save()
{
if (fwbdebug)
qDebug("ProjectPanel::save: rcs=%p rcs->isRO=%d rcs->isTemp=%d rcs->getFileName=%s",
rcs, rcs->isRO(), rcs->isTemp(), rcs->getFileName().toLatin1().constData());
qDebug("ProjectPanel::save: rcs=%p rcs->isRO=%d "
"rcs->isTemp=%d rcs->getFileName=%s",
rcs,
rcs->isRO(),
rcs->isTemp(),
rcs->getFileName().toLatin1().constData());
if (!rcs->isRO() && !rcs->isTemp())
{
@ -1690,8 +1662,12 @@ void ProjectPanel::save()
/* exported libraries are always read-only */
list<FWObject*> ll = ndb->getByType(Library::TYPENAME);
for (FWObject::iterator i=ll.begin(); i!=ll.end(); i++)
if ((*i)->getId()!=FWObjectDatabase::STANDARD_LIB_ID &&
(*i)->getId()!=FWObjectDatabase::DELETED_OBJECTS_ID) (*i)->setReadOnly( true );
{
if ((*i)->getId()!=FWObjectDatabase::STANDARD_LIB_ID
&&
(*i)->getId()!=FWObjectDatabase::DELETED_OBJECTS_ID)
(*i)->setReadOnly( true );
}
}
ndb->resetTimeLastModified( db()->getTimeLastModified() );
@ -1718,10 +1694,9 @@ void ProjectPanel::save()
* error message in the exception, let's check for obvious problems here
*/
QString err;
if (access( rcs->getFileName().toLatin1().constData(), W_OK)!=0 && errno==EACCES)
err=tr("File is read-only");
else
err=ex.toString().c_str();
if (access( rcs->getFileName().toLatin1().constData(), W_OK)!=0 &&
errno==EACCES) err=tr("File is read-only");
else err=ex.toString().c_str();
QMessageBox::critical(
this,"Firewall Builder",

View File

@ -41,9 +41,6 @@ using namespace Ui;
using namespace libfwbuilder;
using namespace std;
#define DEFAULT_H_SPLITTER_POSITION 250
#define DEFAULT_V_SPLITTER_POSITION 450
// this slot is called when user hits "maximize" or "minimize" buttons
// on the title bar of the internal window. Need to restore window
// geometry and splitter position when window becomes normal (not maximized).
@ -179,11 +176,7 @@ void ProjectPanel::loadState()
qDebug(QString("%1: %2x%3").arg(h_splitter_setting).
arg(w1).arg(w2).toAscii().data());
QList<int> sl;
sl.push_back(w1);
sl.push_back(w2);
if (w1 && w2)
m_panel->mainSplitter->setSizes( sl );
setMainSplitterPosition(w1, w2);
if (fwbdebug) qDebug("Restore info window splitter position");
@ -200,14 +193,33 @@ void ProjectPanel::loadState()
qDebug(QString("%1: %2x%3").arg(v_splitter_setting).
arg(w1).arg(w2).toAscii().data());
sl.clear();
sl.push_back(w1);
sl.push_back(w2);
if (w1 && w2)
m_panel->objInfoSplitter->setSizes( sl );
setObjInfoSplitterPosition(w1, w2);
if (fwbdebug) qDebug("ProjectPanel::loadState done");
}
void ProjectPanel::setMainSplitterPosition(int w1, int w2)
{
if (w1 && w2)
{
QList<int> sl;
sl.push_back(w1);
sl.push_back(w2);
if (fwbdebug) qDebug("Setting main splitter position: %d,%d", w1, w2);
m_panel->mainSplitter->setSizes( sl );
}
}
void ProjectPanel::setObjInfoSplitterPosition(int w1, int w2)
{
if (w1 && w2)
{
QList<int> sl;
sl.clear();
sl.push_back(w1);
sl.push_back(w2);
m_panel->objInfoSplitter->setSizes( sl );
}
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="freebsd">
<description>FreeBSD</description>
<family>freebsd</family>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0-">
<FWBuilderResources version="3.0.1-">
<Target name="pix_os">
<description>Cisco FWSM</description>
<compiler>fwb_pix</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0-">
<FWBuilderResources version="3.0.1-">
<Target name="ios">
<description>Cisco IOS</description>
<compiler>fwb_iosacl</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="linksys">
<description>Linksys/Sveasoft</description>
<family>linux24</family>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="linux24">
<description>Linux 2.4/2.6</description>
<family>linux24</family>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="macosx">
<description>Mac OS X</description>
<family>macosx</family>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="openbsd">
<description>OpenBSD</description>
<family>openbsd</family>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0-">
<FWBuilderResources version="3.0.1-">
<Target name="pix_os">
<description>Cisco PIX</description>
<compiler>fwb_pix</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="solaris">
<description>Solaris</description>
<family>solaris</family>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <!-- -*- mode: xml; -*- -->
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="unknown_os">
<description>Unknown</description>
<family>unknown</family>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<FWBuilderResources version="3.0.0-">
<FWBuilderResources version="3.0.1-">
<Target name="FWSM">
<description>FWSM</description>
<compiler>fwb_pix</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<FWBuilderResources version="3.0.0-">
<FWBuilderResources version="3.0.1-">
<Target name="iosacl">
<description>IOS ACL</description>
<compiler>fwb_iosacl</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="ipf">
<description>ipfilter</description>
<compiler>fwb_ipf</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="ipfw">
<description>ipfw</description>
<compiler>fwb_ipfw</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="iptables">
<description>iptables</description>
<compiler>fwb_ipt</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="pf">
<description>PF</description>
<compiler>fwb_pf</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<FWBuilderResources version="3.0.0-">
<FWBuilderResources version="3.0.1-">
<Target name="pix">
<description>PIX</description>
<compiler>fwb_pix</compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Target name="unknown">
<description>Unknown</description>
<compiler></compiler>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<FWBuilderResources version="3.0.0">
<FWBuilderResources version="3.0.1">
<Paths>
<Icndir>@PACKAGE_PIXMAPS_DIR@</Icndir>
</Paths>