1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-19 17:57:22 +01:00

Merge branch 'development' of ssh://git@vc.netcitadel.com:2222/var/git/fwbuilder into development

This commit is contained in:
Vadim Kurland 2011-01-26 17:05:53 -08:00
commit 959a10535d
52 changed files with 224 additions and 175 deletions

View File

@ -7,7 +7,7 @@ FWB_MICRO_VERSION=0
# build number is like "nano" version number. I am incrementing build
# number during development cycle
#
BUILD_NUM="3447"
BUILD_NUM="3448"
VERSION="$FWB_MAJOR_VERSION.$FWB_MINOR_VERSION.$FWB_MICRO_VERSION.$BUILD_NUM"

View File

@ -1,2 +1,2 @@
#define VERSION "4.2.0.3447"
#define VERSION "4.2.0.3448"
#define GENERATION "4.2"

View File

@ -1,3 +1,10 @@
2011-01-26 Vadim Kurland <vadim@netcitadel.com>
* init.cpp (init): fixed #1989 "variables respath and librespath
are redundant and copy Constants::getTemplateDirectory()". Got rid
of global variables sysfname, tempfname, librespath, respath and
localepath; will now use class Constants to keep this information.
2011-01-25 vadim <vadim@netcitadel.com>
* src/fwbuilder/libfwbuilder-config.h.in: fixes #1937 "RES_DIR

View File

@ -3,7 +3,7 @@
%define name fwbuilder
%define version 4.2.0.3447
%define version 4.2.0.3448
%define release 1
%if "%_vendor" == "MandrakeSoft"

View File

@ -4,6 +4,6 @@ Replaces: fwbuilder (<=4.1.1-1), fwbuilder-common, fwbuilder-bsd, fwbuilder-linu
Priority: extra
Section: checkinstall
Maintainer: vadim@fwbuilder.org
Version: 4.2.0.3447-1
Version: 4.2.0.3448-1
Depends: libqt4-gui (>= 4.3.0), libxml2, libxslt1.1, libsnmp | libsnmp15
Description: Firewall Builder GUI and policy compilers

View File

@ -1,6 +1,6 @@
%define name fwbuilder
%define version 4.2.0.3447
%define version 4.2.0.3448
%define release 1
%if "%_vendor" == "MandrakeSoft"

View File

@ -13,17 +13,13 @@
#include "fwbuilder/Tools.h"
#include "fwbuilder/Resources.h"
#include "fwbuilder/Constants.h"
#include "commoninit.h"
// TODO: switch to QString
std::string appRootDir;
std::string userDataDir;
std::string respath;
std::string localepath;
std::string librespath;
std::string sysfname;
std::string tempfname;
std::string argv0;
std::string ee;
@ -54,20 +50,11 @@ void init(char * const*)
/* On Unix RES_DIR and LIBFWBUILDER_TEMPLATE_DIR are absolute paths */
if (respath=="") respath = Constants::getTemplateDirectory();
librespath = Constants::getTemplateDirectory();
libfwbuilder::init();
/* need argv0 for built-in installer on unix and mac */
argv0 = appRootDir + FS_SEPARATOR + "fwbuilder";
sysfname = respath + FS_SEPARATOR + "objects_init.xml";
tempfname = respath+ FS_SEPARATOR + "templates.xml";
/* define localepath the same way as we define PKGLOCALEDIR in qmake.inc */
localepath = respath + "/locale";
/* default directory where the user may want to save files */
userDataDir = string(getenv("HOME"));

View File

@ -29,6 +29,7 @@
#include "fwbuilder/FWObject.h"
#include "fwbuilder/Resources.h"
#include "fwbuilder/Constants.h"
#include <QRegExp>
#include <QTextStream>
@ -38,7 +39,6 @@
#include <iostream>
extern std::string respath;
using namespace libfwbuilder;
using namespace std;
@ -133,7 +133,8 @@ bool Configlet::reload(const std::string &_prefix, const QString &file_name)
QString Configlet::getFullPath(const QString &path)
{
if (QDir::isRelativePath(path))
return QString(respath.c_str()) + "/configlets/" + path;
return QString(Constants::getResourcesDirectory().c_str()) +
"/configlets/" + path;
else
return path;
}

View File

@ -96,6 +96,8 @@ extern int errno;
#include "fwbuilder/TagService.h"
#include "fwbuilder/UserService.h"
#include "fwbuilder/Constants.h"
#include "../common/init.cpp"
#include "fwbedit.h"
@ -562,9 +564,7 @@ int main(int argc, char * const *argv)
try
{
new Resources(respath+FS_SEPARATOR+"resources.xml");
//new Resources(respath); // creates singleton Resources::global_res
new Resources(Constants::getResourcesFilePath());
/* create database */
objdb = new FWObjectDatabase();
@ -572,7 +572,7 @@ int main(int argc, char * const *argv)
/* load the data file */
UpgradePredicate upgrade_predicate(autoupgrade_flag);
objdb->load(filename, &upgrade_predicate, librespath);
objdb->load(filename, &upgrade_predicate, Constants::getDTDDirectory());
if (cmd == MERGE)
{

View File

@ -83,5 +83,4 @@ extern void findObjects(const std::string &obj_path,
extern bool getBool(std::string s);
extern void usage();
extern std::string librespath;

View File

@ -29,6 +29,7 @@
#include "fwbuilder/ObjectGroup.h"
#include "fwbuilder/ServiceGroup.h"
#include "fwbuilder/IntervalGroup.h"
#include "fwbuilder/Constants.h"
#include "fwbedit.h"
#include "upgradePredicate.h"
@ -61,7 +62,7 @@ void mergeTree(FWObjectDatabase *objdb, const string &mergefile, int conflict_re
try
{
FWObjectDatabase *ndb = new FWObjectDatabase();
ndb->load(mergefile, &upgrade_predicate, librespath);
ndb->load(mergefile, &upgrade_predicate, Constants::getDTDDirectory());
FWObject *dobj = ndb->findInIndex(FWObjectDatabase::DELETED_OBJECTS_ID);
if (dobj) ndb->remove(dobj, false);

View File

@ -70,6 +70,8 @@
#include "fwbuilder/XMLTools.h"
#include "fwbuilder/Resources.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/Constants.h"
#if defined(Q_WS_MAC)
extern void connectOdocHandler();
@ -186,7 +188,7 @@ int main( int argc, char *argv[] )
INIT2;
string full_res_path = respath + FS_SEPARATOR + "resources.xml";
string full_res_path = Constants::getResourcesFilePath();
if (fwbdebug)
{
@ -232,7 +234,7 @@ int main( int argc, char *argv[] )
QString local = QLocale::system().name();//"en_US";//
QTranslator translator(0);
translator.load(QLatin1String("fwbuilder_") +
QString(local), localepath.c_str());
QString(local), Constants::getLocaleDirectory().c_str());
app->installTranslator (&translator);
QString qt_resource_dir =

View File

@ -53,6 +53,7 @@
#include "fwbuilder/XMLTools.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/Tools.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -109,12 +110,6 @@ int main(int argc, char **argv)
{
QString arg = args.at(idx);
last_arg = arg;
if (arg == "-r")
{
idx++;
respath = string(args.at(idx).toLatin1().constData());
continue;
}
if (arg == "-V")
{
usage(argv[0]);
@ -138,7 +133,7 @@ int main(int argc, char **argv)
try
{
new Resources(respath+FS_SEPARATOR+"resources.xml");
new Resources(Constants::getResourcesFilePath());
/* create database */
objdb = new FWObjectDatabase();
@ -149,7 +144,7 @@ int main(int argc, char **argv)
cout << " *** Loading data ...";
objdb->setReadOnly( false );
objdb->load( filename, &upgrade_predicate, librespath);
objdb->load( filename, &upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName(filename);
objdb->reIndex();

View File

@ -60,6 +60,7 @@
#include "fwbuilder/Cluster.h"
#include "fwbuilder/Firewall.h"
#include "fwbuilder/Interface.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -118,12 +119,6 @@ int main(int argc, char **argv)
{
QString arg = args.at(idx);
last_arg = arg;
if (arg == "-r")
{
idx++;
respath = string(args.at(idx).toLatin1().constData());
continue;
}
if (arg == "-V")
{
usage(argv[0]);
@ -146,7 +141,7 @@ int main(int argc, char **argv)
init(argv);
try {
new Resources(respath + FS_SEPARATOR + "resources.xml");
new Resources(Constants::getResourcesFilePath());
/* create database */
objdb = new FWObjectDatabase();
@ -157,10 +152,11 @@ int main(int argc, char **argv)
cout << " *** Loading data ...";
objdb->setReadOnly( false );
objdb->load( sysfname, &upgrade_predicate, librespath);
objdb->load( Constants::getStandardObjectsFilePath(),
&upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName("");
FWObjectDatabase *ndb = new FWObjectDatabase();
ndb->load(filename, &upgrade_predicate, librespath);
ndb->load(filename, &upgrade_predicate, Constants::getDTDDirectory());
objdb->merge(ndb, NULL);
delete ndb;
objdb->setFileName(filename);

View File

@ -58,6 +58,7 @@
#include "fwbuilder/FWException.h"
#include "fwbuilder/Cluster.h"
#include "fwbuilder/Firewall.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -114,12 +115,6 @@ int main(int argc, char **argv)
{
QString arg = args.at(idx);
last_arg = arg;
if (arg == "-r")
{
idx++;
respath = string(args.at(idx).toLatin1().constData());
continue;
}
if (arg == "-V")
{
usage(argv[0]);
@ -142,7 +137,7 @@ int main(int argc, char **argv)
init(argv);
try {
new Resources(respath+FS_SEPARATOR+"resources.xml");
new Resources(Constants::getResourcesFilePath());
/* create database */
objdb = new FWObjectDatabase();
@ -153,10 +148,11 @@ int main(int argc, char **argv)
cout << " *** Loading data ...";
objdb->setReadOnly( false );
objdb->load( sysfname, &upgrade_predicate, librespath);
objdb->load( Constants::getStandardObjectsFilePath(),
&upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName("");
FWObjectDatabase *ndb = new FWObjectDatabase();
ndb->load(filename, &upgrade_predicate, librespath);
ndb->load(filename, &upgrade_predicate, Constants::getDTDDirectory());
objdb->merge(ndb, NULL);
delete ndb;
objdb->setFileName(filename);

View File

@ -38,6 +38,7 @@
#include "fwbuilder/XMLTools.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/IPService.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -94,12 +95,6 @@ int main(int argc, char **argv)
{
QString arg = args.at(idx);
last_arg = arg;
if (arg == "-r")
{
idx++;
respath = string(args.at(idx).toLatin1().constData());
continue;
}
if (arg == "-V")
{
usage(argv[0]);
@ -127,7 +122,7 @@ int main(int argc, char **argv)
try
{
Resources res(respath + FS_SEPARATOR + "resources.xml");
Resources res(Constants::getResourcesFilePath());
/* create database */
objdb = new FWObjectDatabase();
@ -139,7 +134,7 @@ int main(int argc, char **argv)
cerr << flush;
objdb->setReadOnly( false );
objdb->load( filename, &upgrade_predicate, librespath);
objdb->load( filename, &upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName(filename);
objdb->reIndex();

View File

@ -6,9 +6,6 @@
Author: Vadim Zaliva lord@crocodile.org
$Id$
This program is free software which we release under the GNU General Public
License. You may redistribute and/or modify this program under the terms
of that license as published by the Free Software Foundation; either
@ -31,6 +28,14 @@
using namespace std;
using namespace libfwbuilder;
string Constants::res_dir;
void Constants::init(const std::string &app_root_dir)
{
if (app_root_dir.empty()) res_dir = string(RES_DIR);
else res_dir = app_root_dir + FS_SEPARATOR + string(RES_DIR);
}
const string Constants::getLibraryDescription()
{
return "Firewall Builder API ";
@ -50,3 +55,36 @@ const string Constants::getTemplateDirectory()
{
return string(RES_DIR);
}
string Constants::getDTDDirectory()
{
if (res_dir.empty()) init("");
return res_dir;
}
string Constants::getResourcesDirectory()
{
if (res_dir.empty()) init("");
return res_dir;
}
string Constants::getResourcesFilePath()
{
return getResourcesDirectory() + FS_SEPARATOR + "resources.xml";
}
string Constants::getStandardObjectsFilePath()
{
return getResourcesDirectory() + FS_SEPARATOR + "objects_init.xml";
}
string Constants::getTemplatesObjectsFilePath()
{
return getResourcesDirectory() + FS_SEPARATOR + "templates.xml";
}
string Constants::getLocaleDirectory()
{
return getResourcesDirectory() + "/locale";
}

View File

@ -6,9 +6,6 @@
Author: Vadim Zaliva lord@crocodile.org
$Id$
This program is free software which we release under the GNU General Public
License. You may redistribute and/or modify this program under the terms
of that license as published by the Free Software Foundation; either
@ -40,7 +37,11 @@ namespace libfwbuilder
*/
class Constants
{
public:
static std::string res_dir;
public:
static void init(const std::string &app_root_dir);
/**
* Returns library's description
@ -61,6 +62,38 @@ class Constants
* Returns directory in which library stores it's data files.
*/
static const std::string getTemplateDirectory();
/**
* Returns directory where we install XML DTD file
*/
static std::string getDTDDirectory();
/**
* Returns directory where we install resources
*/
static std::string getResourcesDirectory();
/**
* Returns full path to the resources file
*/
static std::string getResourcesFilePath();
/**
* Returns full path to the standard objects library file
*/
static std::string getStandardObjectsFilePath();
/**
* Returns full path to the prepackaged firewall template objects file
*/
static std::string getTemplatesObjectsFilePath();
/**
* Returns full path to the directory where we install locale files
*/
static std::string getLocaleDirectory();
};
}

View File

@ -40,6 +40,7 @@
#include "fwbuilder/XMLTools.h"
#include "fwbuilder/Firewall.h"
#include "fwbuilder/RuleSet.h"
#include "fwbuilder/Constants.h"
#include <qglobal.h>
@ -279,7 +280,8 @@ void FWWindow::printFirewallFromFile(QString fileName,
QPrinter *printer = new QPrinter(QPrinter::HighResolution);
try
{
objdb->load(fileName.toLatin1().constData(), &up, librespath);
objdb->load(fileName.toLatin1().constData(), &up,
Constants::getDTDDirectory());
}
catch (...)
{

View File

@ -27,6 +27,8 @@
#include "global.h"
#include "utils.h"
#include "fwbuilder/Constants.h"
#include "Help.h"
#include "FWWindow.h"
@ -36,6 +38,8 @@
using namespace std;
using namespace libfwbuilder;
Help* Help::help_window = NULL;
@ -56,8 +60,10 @@ Help::Help(QWidget *, const QString &title, bool _load_links_in_browser) :
QString locale = QLocale::system().name(); //"en_US";
// Set up path to help qtextBrowser find contents, such as files for <img>
paths.append(QString(respath.c_str()) + "/help/" + locale);
paths.append(QString(respath.c_str()) + "/help/" + "en_US");
paths.append(QString(Constants::getResourcesDirectory().c_str()) +
"/help/" + locale);
paths.append(QString(Constants::getResourcesDirectory().c_str()) +
"/help/" + "en_US");
m_dialog->textview->setSearchPaths(paths);
m_dialog->textview->setOpenLinks(true);
m_dialog->textview->setOpenExternalLinks(true);

View File

@ -37,6 +37,7 @@
#include <fwbuilder/Rule.h>
#include <fwbuilder/Interface.h>
#include <fwbuilder/Library.h>
#include "fwbuilder/Constants.h"
#include "ProjectPanel.h"
@ -476,7 +477,7 @@ void ProjectPanel::fileCompare()
{
db1 = new FWObjectDatabase();
db1->load(fname1.toLocal8Bit().constData(),
&upgrade_predicate, librespath);
&upgrade_predicate, Constants::getDTDDirectory());
dobj = db1->findInIndex(FWObjectDatabase::DELETED_OBJECTS_ID);
if (dobj) db1->remove(dobj, false);
@ -495,7 +496,7 @@ void ProjectPanel::fileCompare()
{
db2 = new FWObjectDatabase();
db2->load(fname2.toLocal8Bit().constData(),
&upgrade_predicate, librespath);
&upgrade_predicate, Constants::getDTDDirectory());
dobj = db2->findInIndex(FWObjectDatabase::DELETED_OBJECTS_ID);
if (dobj) db2->remove(dobj, false);
@ -847,7 +848,7 @@ FWObject* ProjectPanel::loadLibrary(const string &libfpath)
try
{
FWObjectDatabase *ndb = new FWObjectDatabase();
ndb->load(libfpath, &upgrade_predicate, librespath);
ndb->load(libfpath, &upgrade_predicate, Constants::getDTDDirectory());
FWObject *dobj = ndb->findInIndex(FWObjectDatabase::DELETED_OBJECTS_ID);
if (dobj) ndb->remove(dobj, false);
@ -940,9 +941,11 @@ void ProjectPanel::loadStandardObjects()
// always load system objects
if (fwbdebug)
qDebug("ProjectPanel::load(): sysfname = %s", sysfname.c_str());
qDebug("ProjectPanel::load(): sysfname = %s",
Constants::getStandardObjectsFilePath().c_str());
objdb->load( sysfname, &upgrade_predicate, librespath);
objdb->load( Constants::getStandardObjectsFilePath(),
&upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName("");
if (fwbdebug) qDebug("ProjectPanel::load(): create User library");
@ -1012,7 +1015,8 @@ bool ProjectPanel::loadFromRCS(RCS *_rcs)
// always loading system objects
mw->showStatusBarMessage(tr("Loading system objects...") );
objdb->load( sysfname, &upgrade_predicate, librespath);
objdb->load( Constants::getStandardObjectsFilePath(),
&upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName("");
// objects from a data file are in database ndb
@ -1021,7 +1025,7 @@ bool ProjectPanel::loadFromRCS(RCS *_rcs)
FWObjectDatabase *ndb = new FWObjectDatabase();
ndb->load(rcs->getFileName().toLocal8Bit().constData(),
&upgrade_predicate,librespath);
&upgrade_predicate,Constants::getDTDDirectory());
time_t oldtimestamp = ndb->getTimeLastModified();
/* loadingLib is true if user wants to open a library or master library file */

View File

@ -34,6 +34,8 @@
#include "Help.h"
#include "UserWorkflow.h"
#include "fwbuilder/Constants.h"
#include <QCheckBox>
#include <QLocale>
#include <QtDebug>
@ -63,8 +65,10 @@ StartTipDialog::StartTipDialog(QWidget *parent): QDialog(parent)
QString locale = QLocale::system().name(); //"en_US";
QStringList paths;
paths.append(QString(respath.c_str()) + "/help/" + locale);
paths.append(QString(respath.c_str()) + "/help/" + "en_US");
paths.append(QString(Constants::getResourcesDirectory().c_str()) +
"/help/" + locale);
paths.append(QString(Constants::getResourcesDirectory().c_str()) +
"/help/" + "en_US");
m_dialog->textview->setSearchPaths(paths);
m_dialog->textview->setOpenLinks(true);

View File

@ -47,6 +47,7 @@
#include <iostream>
using namespace std;
using namespace libfwbuilder;
debugDialog::debugDialog(QWidget *parent) : QDialog(parent)
@ -62,16 +63,18 @@ debugDialog::debugDialog(QWidget *parent) : QDialog(parent)
m_dialog->debugText->append( QString("Path to executable: %1")
.arg(argv0.c_str()) );
m_dialog->debugText->append( QString("Path to resources: %1")
.arg(respath.c_str()) );
.arg(Constants::getResourcesDirectory().c_str()) );
m_dialog->debugText->append( QString("Path to locale: %1")
.arg(localepath.c_str()) );
m_dialog->debugText->append( QString("Path to lib resources: %1")
.arg(librespath.c_str()) );
.arg(Constants::getLocaleDirectory().c_str()) );
m_dialog->debugText->append( QString("Path to libfwbuilder data directory: %1")
.arg(Constants::getDTDDirectory().c_str()) );
m_dialog->debugText->append( QString("appRootDir: %1")
.arg(appRootDir.c_str()) );
m_dialog->debugText->append( "\n" );
m_dialog->debugText->append( QString("sysfname: %1").arg(sysfname.c_str()));
m_dialog->debugText->append( QString("tempfname: %1").arg(tempfname.c_str()));
m_dialog->debugText->append( QString("standard objects library: %1")
.arg(Constants::getStandardObjectsFilePath().c_str()));
m_dialog->debugText->append( QString("standard templates library: %1")
.arg(Constants::getTemplatesObjectsFilePath().c_str()));
m_dialog->debugText->append( QString("user name: %1").arg(user_name) );
m_dialog->debugText->append( "\n" );
m_dialog->debugText->append( QString("Path to rcs: %1").arg(RCS_FILE_NAME));

View File

@ -44,11 +44,6 @@ extern UserWorkflow *wfl;
extern std::string appRootDir;
extern std::string userDataDir;
extern std::string respath;
extern std::string localepath;
extern std::string librespath;
extern std::string sysfname;
extern std::string tempfname;
extern std::string argv0;
extern std::string ee;
extern int fwbdebug;

View File

@ -49,6 +49,7 @@
#include "fwbuilder/BackgroundOp.h"
#include "fwbuilder/IPv4.h"
#include "fwbuilder/IPv6.h"
#include "fwbuilder/Constants.h"
#include <qlineedit.h>
#include <qtextedit.h>
@ -126,7 +127,8 @@ newFirewallDialog::newFirewallDialog(QWidget *parentw, FWObject *_p) :
this, SLOT(updateTemplatePanel()));
m_dialog->useStandard->setChecked(true);
m_dialog->templateFilePath->setText(tempfname.c_str());
m_dialog->templateFilePath->setText(
Constants::getTemplatesObjectsFilePath().c_str());
updateTemplatePanel();
/* fill in platform. Since iptables is the most popular, start with
@ -207,7 +209,8 @@ void newFirewallDialog::browseTemplate()
void newFirewallDialog::useStandardTemplate()
{
m_dialog->templateFilePath->setText(tempfname.c_str());
m_dialog->templateFilePath->setText(
Constants::getTemplatesObjectsFilePath().c_str());
updateTemplatePanel();
}
@ -229,7 +232,8 @@ void newFirewallDialog::updateTemplatePanel()
if (using_std)
{
m_dialog->templateFilePath->setText(tempfname.c_str());
m_dialog->templateFilePath->setText(
Constants::getTemplatesObjectsFilePath().c_str());
}
}
else
@ -576,7 +580,7 @@ void newFirewallDialog::showPage(const int page)
{
tmpldb->load(
m_dialog->templateFilePath->text().toAscii().data(),
&upgrade_predicate, librespath);
&upgrade_predicate, Constants::getDTDDirectory());
}
catch (FWException &ex)
{

View File

@ -43,6 +43,7 @@
#include "fwbuilder/BackgroundOp.h"
#include "fwbuilder/IPv4.h"
#include "fwbuilder/IPv6.h"
#include "fwbuilder/Constants.h"
#include <qlineedit.h>
#include <qtextedit.h>
@ -104,7 +105,8 @@ newHostDialog::newHostDialog(QWidget *parentw, FWObject *_p) : QDialog(parentw)
this,SLOT(useStandardTemplate()));
connect( m_dialog->useTemplate, SIGNAL(released()),
this,SLOT(updateTemplatePanel()));
m_dialog->templateFilePath->setText(tempfname.c_str());
m_dialog->templateFilePath->setText(
Constants::getTemplatesObjectsFilePath().c_str());
updateTemplatePanel();
setNextEnabled( OBJECT_NAME_PAGE, false );
@ -131,7 +133,8 @@ void newHostDialog::browseTemplate()
void newHostDialog::useStandardTemplate()
{
m_dialog->templateFilePath->setText(tempfname.c_str());
m_dialog->templateFilePath->setText(
Constants::getTemplatesObjectsFilePath().c_str());
updateTemplatePanel();
}
@ -140,7 +143,7 @@ void newHostDialog::updateTemplatePanel()
if (m_dialog->useTemplate->checkState()==Qt::Checked)
{
QString fileName = m_dialog->templateFilePath->text();
bool using_std = fileName == tempfname.c_str();
bool using_std = fileName == Constants::getTemplatesObjectsFilePath().c_str();
m_dialog->templateFrame->setVisible(true);
m_dialog->templateFilePathLabel->setVisible(!using_std);
@ -391,7 +394,7 @@ void newHostDialog::showPage(const int page)
tmpldb = new FWObjectDatabase();
tmpldb->setReadOnly( false );
tmpldb->load( m_dialog->templateFilePath->text().toAscii().data(),
&upgrade_predicate, librespath);
&upgrade_predicate, Constants::getDTDDirectory());
}
list<FWObject*> fl;

View File

@ -40,6 +40,7 @@
#include "fwbuilder/XMLTools.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/IPService.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -94,12 +95,6 @@ int main(int argc, char **argv)
{
QString arg = args.at(idx);
last_arg = arg;
if (arg == "-r")
{
idx++;
respath = string(args.at(idx).toLatin1().constData());
continue;
}
if (arg == "-V")
{
usage(argv[0]);
@ -126,7 +121,7 @@ int main(int argc, char **argv)
try
{
new Resources(respath + FS_SEPARATOR + "resources.xml");
new Resources(Constants::getResourcesFilePath());
/* create database */
objdb = new FWObjectDatabase();
@ -137,10 +132,11 @@ int main(int argc, char **argv)
cout << " *** Loading data ...";
objdb->setReadOnly( false );
objdb->load( sysfname, &upgrade_predicate, librespath);
objdb->load( Constants::getStandardObjectsFilePath(),
&upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName("");
FWObjectDatabase *ndb = new FWObjectDatabase();
ndb->load(filename, &upgrade_predicate, librespath);
ndb->load(filename, &upgrade_predicate, Constants::getDTDDirectory());
objdb->merge(ndb, NULL);
delete ndb;
objdb->setFileName(filename);

View File

@ -53,6 +53,7 @@
#include "fwbuilder/XMLTools.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/Tools.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -118,12 +119,6 @@ int main(int argc, char **argv)
only_print_inspection_code = true;
continue;
}
if (arg == "-r")
{
idx++;
respath = string(args.at(idx).toLatin1().constData());
continue;
}
if (arg == "-V")
{
usage(argv[0]);
@ -147,7 +142,7 @@ int main(int argc, char **argv)
try
{
new Resources(respath + FS_SEPARATOR + "resources.xml");
new Resources(Constants::getResourcesFilePath());
/* create database */
objdb = new FWObjectDatabase();
@ -158,7 +153,7 @@ int main(int argc, char **argv)
cout << " *** Loading data ...";
objdb->setReadOnly( false );
objdb->load( filename, &upgrade_predicate, librespath);
objdb->load( filename, &upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName(filename);
objdb->reIndex();

View File

@ -53,6 +53,7 @@
#include "fwbuilder/XMLTools.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/Tools.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -109,12 +110,6 @@ int main(int argc, char **argv)
{
QString arg = args.at(idx);
last_arg = arg;
if (arg == "-r")
{
idx++;
respath = string(args.at(idx).toLatin1().constData());
continue;
}
if (arg == "-V")
{
usage(argv[0]);
@ -138,7 +133,7 @@ int main(int argc, char **argv)
try
{
new Resources(respath+FS_SEPARATOR+"resources.xml");
new Resources(Constants::getResourcesFilePath());
/* create database */
objdb = new FWObjectDatabase();
@ -149,7 +144,7 @@ int main(int argc, char **argv)
cout << " *** Loading data ...";
objdb->setReadOnly( false );
objdb->load( filename, &upgrade_predicate, librespath);
objdb->load( filename, &upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName(filename);
objdb->reIndex();

View File

@ -31,7 +31,7 @@
#include <string>
using namespace libfwbuilder;
//std::string respath;
int fwbdebug = 0;
//QString user_name;
std::string platform;

View File

@ -44,6 +44,7 @@
#include "fwbuilder/Policy.h"
#include "fwbuilder/Rule.h"
#include "fwbuilder/TagService.h"
#include "fwbuilder/Constants.h"
#include <QDebug>
#include <QFile>
@ -82,15 +83,11 @@ void ImporterTest::setUp()
db->setReadOnly( false );
//path.pop_back();
//path << "objects_init.xml";
//sysfname = path.join(FS_SEPARATOR).toStdString();
//librespath = string(PREFIX) + "/share/libfwbuilder-" + VERSION;
qDebug() << Constants::getStandardObjectsFilePath().c_str();
qDebug() << Constants::getDTDDirectory().c_str();
qDebug() << sysfname.c_str();
qDebug() << librespath.c_str();
db->load( sysfname, &upgrade_predicate, librespath);
db->load( Constants::getStandardObjectsFilePath(),
&upgrade_predicate, Constants::getDTDDirectory());
qDebug() << "st";
db->setFileName("");

View File

@ -34,7 +34,6 @@
#include "../../../common/init.cpp"
//std::string respath;
int fwbdebug = 0;
//QString user_name;
std::string platform;
@ -44,7 +43,7 @@ int main(int argc, char** argv)
QApplication app(argc, argv, false);
init(argv);
Resources res(respath + FS_SEPARATOR + "resources.xml");
Resources res(Constants::getResourcesFilePath());
CppUnit::TextUi::TestRunner runner;
runner.addTest( ImporterTest::suite() );
runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),

View File

@ -30,7 +30,7 @@
#include <string>
using namespace libfwbuilder;
//std::string respath;
int fwbdebug = 0;
//QString user_name;
std::string platform;

View File

@ -30,7 +30,6 @@
#include <string>
using namespace libfwbuilder;
//std::string respath;
int fwbdebug = 0;
//QString user_name;
std::string platform;

View File

@ -30,7 +30,6 @@
#include <string>
using namespace libfwbuilder;
//std::string respath;
int fwbdebug = 0;
//QString user_name;
std::string platform;

View File

@ -29,7 +29,6 @@
#include <QString>
#include <string>
//std::string respath;
//int fwbdebug = 0;
//QString user_name;

View File

@ -28,7 +28,6 @@
#include "UsageResolverTest.h"
#include <string>
std::string respath;
int fwbdebug = 0;
QString user_name;

View File

@ -27,6 +27,7 @@
#include "fwbuilder/Firewall.h"
#include "fwbuilder/Interface.h"
#include "fwbuilder/Constants.h"
#include <QStringList>
#include <QDebug>
@ -37,8 +38,6 @@ using namespace libfwbuilder;
using namespace CppUnit;
extern string librespath;
class UpgradePredicate: public XMLTools::UpgradePredicate
{
public:
@ -586,7 +585,7 @@ void interfacePropertiesTest::testManageIpAddresses()
string file_name = "test.fwb";
db->setReadOnly( false );
db->load(file_name, &upgrade_predicate, librespath);
db->load(file_name, &upgrade_predicate, Constants::getDTDDirectory());
db->setFileName(file_name);
db->reIndex();
@ -656,7 +655,7 @@ void interfacePropertiesTest::testManageIpAddressesCluster()
string file_name = "test.fwb";
db->setReadOnly( false );
db->load(file_name, &upgrade_predicate, librespath);
db->load(file_name, &upgrade_predicate, Constants::getDTDDirectory());
db->setFileName(file_name);
db->reIndex();

View File

@ -28,11 +28,12 @@
#include "common/init.cpp"
#include "interfacePropertiesTest.h"
#include "fwbuilder/Constants.h"
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/CompilerOutputter.h>
#include <string>
//std::string respath;
//QString user_name;
int main(int, char **argv)
@ -41,9 +42,7 @@ int main(int, char **argv)
init();
Resources res(respath + FS_SEPARATOR + "resources.xml");
// Resources("../../res/resources.xml");
Resources res(Constants::getResourcesFilePath());
CppUnit::TextUi::TestRunner runner;
runner.addTest( interfacePropertiesTest::suite() );

View File

@ -33,6 +33,7 @@
#include "fwbuilder/FWObjectDatabase.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/IPService.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -46,8 +47,6 @@ using namespace libfwbuilder;
using namespace fwcompiler;
extern string librespath;
class UpgradePredicate: public XMLTools::UpgradePredicate
{
public:
@ -74,7 +73,7 @@ void GeneratedScriptTest::loadDataFile(const string &file_name)
UpgradePredicate upgrade_predicate;
objdb->setReadOnly( false );
objdb->load(file_name, &upgrade_predicate, librespath);
objdb->load(file_name, &upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName(file_name);
objdb->reIndex();
}

View File

@ -31,6 +31,7 @@
#include <cppunit/CompilerOutputter.h>
#include "fwbuilder/Resources.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QTextCodec>
@ -51,8 +52,7 @@ int main(int argc, char **argv)
init(argv);
Resources res(respath + FS_SEPARATOR + "resources.xml");
Resources res(Constants::getResourcesFilePath());
CppUnit::TextUi::TestRunner runner;
runner.addTest( GeneratedScriptTest::suite() );

View File

@ -33,6 +33,7 @@
#include "fwbuilder/FWObjectDatabase.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/IPService.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -46,8 +47,6 @@ using namespace libfwbuilder;
using namespace fwcompiler;
extern string librespath;
class UpgradePredicate: public XMLTools::UpgradePredicate
{
public:
@ -74,7 +73,7 @@ void GeneratedScriptTest::loadDataFile(const string &file_name)
UpgradePredicate upgrade_predicate;
objdb->setReadOnly( false );
objdb->load(file_name, &upgrade_predicate, librespath);
objdb->load(file_name, &upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName(file_name);
objdb->reIndex();
}

View File

@ -31,6 +31,7 @@
#include <cppunit/CompilerOutputter.h>
#include "fwbuilder/Resources.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QTextCodec>
@ -51,7 +52,7 @@ int main(int argc, char **argv)
init(argv);
Resources res(respath + FS_SEPARATOR + "resources.xml");
Resources res(Constants::getResourcesFilePath());
CppUnit::TextUi::TestRunner runner;

View File

@ -33,6 +33,7 @@
#include "fwbuilder/FWObjectDatabase.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/IPService.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QDir>
@ -46,8 +47,6 @@ using namespace libfwbuilder;
using namespace fwcompiler;
extern string librespath;
class UpgradePredicate: public XMLTools::UpgradePredicate
{
public:
@ -80,7 +79,7 @@ void GeneratedScriptTest::loadDataFile(const string &file_name)
UpgradePredicate upgrade_predicate;
objdb->setReadOnly( false );
objdb->load(file_name, &upgrade_predicate, librespath);
objdb->load(file_name, &upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName(file_name);
objdb->reIndex();
} catch (FWException &ex)

View File

@ -31,6 +31,7 @@
#include <cppunit/CompilerOutputter.h>
#include "fwbuilder/Resources.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QTextCodec>
@ -51,7 +52,7 @@ int main(int argc, char **argv)
init(argv);
Resources res(respath + FS_SEPARATOR + "resources.xml");
Resources res(Constants::getResourcesFilePath());
CppUnit::TextUi::TestRunner runner;

View File

@ -33,6 +33,7 @@
#include "fwbuilder/FWObjectDatabase.h"
#include "fwbuilder/FWException.h"
#include "fwbuilder/IPService.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QStringList>
@ -46,8 +47,6 @@ using namespace libfwbuilder;
using namespace fwcompiler;
extern string librespath;
class UpgradePredicate: public XMLTools::UpgradePredicate
{
public:
@ -74,7 +73,7 @@ void GeneratedScriptTest::loadDataFile(const string &file_name)
UpgradePredicate upgrade_predicate;
objdb->setReadOnly( false );
objdb->load(file_name, &upgrade_predicate, librespath);
objdb->load(file_name, &upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName(file_name);
objdb->reIndex();
}

View File

@ -31,6 +31,7 @@
#include <cppunit/CompilerOutputter.h>
#include "fwbuilder/Resources.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QTextCodec>
@ -51,7 +52,7 @@ int main(int argc, char **argv)
init(argv);
Resources res(respath + FS_SEPARATOR + "resources.xml");
Resources res(Constants::getResourcesFilePath());
CppUnit::TextUi::TestRunner runner;

View File

@ -22,6 +22,7 @@
#include "Configlet.h"
#include "fwbuilder/IPService.h"
#include "fwbuilder/Constants.h"
#include <QDir>
#include <QDirIterator>
@ -31,7 +32,6 @@ using namespace std;
using namespace libfwbuilder;
using namespace fwcompiler;
extern string librespath;
class UpgradePredicate: public XMLTools::UpgradePredicate
{
@ -63,7 +63,7 @@ void GeneratedScriptTest::loadDataFile(const string &file_name)
UpgradePredicate upgrade_predicate;
objdb->setReadOnly( false );
objdb->load(file_name, &upgrade_predicate, librespath);
objdb->load(file_name, &upgrade_predicate, Constants::getDTDDirectory());
objdb->setFileName(file_name);
objdb->reIndex();
}

View File

@ -22,6 +22,7 @@
#include <cppunit/CompilerOutputter.h>
#include "fwbuilder/Resources.h"
#include "fwbuilder/Constants.h"
#include <QApplication>
#include <QTextCodec>
@ -41,7 +42,7 @@ int main(int argc, char **argv)
init(argv);
Resources res(respath + FS_SEPARATOR + "resources.xml");
Resources res(Constants::getResourcesFilePath());
CppUnit::TextUi::TestRunner runner;

View File

@ -29,6 +29,7 @@
#include "common/commoninit.h"
#include "fwbuilder/Resources.h"
#include "fwbuilder/Constants.h"
#include <QString>
#include <QApplication>
@ -65,7 +66,7 @@ void build_app(int argc, char** argv,
*wfl = new UserWorkflow();
string full_res_path = respath + FS_SEPARATOR + "resources.xml";
string full_res_path = Constants::getResourcesFilePath();
new Resources(full_res_path);

View File

@ -29,17 +29,19 @@
#include <QDialog>
#include "ui_newclusterdialog_q.h"
#include "FWWindow.h"
#include "fwbuilder/Policy.h"
#include "ObjectTreeView.h"
#include "ProjectPanel.h"
#include "StartTipDialog.h"
#include "ObjectTreeView.h"
#include "ObjectTreeViewItem.h"
#include "FWObjectClipboard.h"
#include "FWBApplication.h"
#include "fwbuilder/Policy.h"
#include "fwbuilder/Constants.h"
using namespace libfwbuilder;
using namespace std;
@ -86,7 +88,7 @@ void newClusterDialogTest::test1()
//init();
FWObjectDatabase *db = new FWObjectDatabase();
XMLTools::UpgradePredicate p;
db->load("test_work.fwb", &p, librespath);
db->load("test_work.fwb", &p, Constants::getDTDDirectory());
newClusterDialog_ext *dialog = new newClusterDialog_ext(NULL, db);
vector<FWObject*> fws;
QStringList fwnames;

View File

@ -29,7 +29,6 @@
#include <QString>
#include <string>
//std::string respath;
//int fwbdebug = 0;
//QString user_name;