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

bug 2412310

This commit is contained in:
Vadim Kurland 2008-12-19 07:15:51 +00:00
parent 636840f051
commit d929b73f14
4 changed files with 111 additions and 112 deletions

View File

@ -1 +1 @@
#define BUILD_NUM 694
#define BUILD_NUM 695

View File

@ -1,3 +1,9 @@
2008-12-18 vadim <vadim@vk.crocodile.org>
* RuleSetView.cpp (RuleSetView::renameGroup): fixed bug #2412310:
"Umlauts in group names". The GUI should properly handle non-ascii
characters in the rule group names
2008-12-15 vadim <vadim@vk.crocodile.org>
* ipt.cpp, ipfw.cpp, pf.cpp, iosacl.cpp: changes for FR #2431602:

View File

@ -873,7 +873,7 @@ QString RuleSetView::getFullRuleGroupTitle(int row)
RuleRowInfo *rri = rowsInfo[row];
if (rri) groupName = rri->groupName;
} else
groupName = QString(rule->getRuleGroupName().c_str());
groupName = QString::fromUtf8(rule->getRuleGroupName().c_str());
if (!groupName.isEmpty())
{
@ -1104,7 +1104,7 @@ void RuleSetView::updateGroups()
if (ruleIndex[i]!=NULL)
{
Rule * r = ruleIndex[i];
QString groupName = r->getRuleGroupName().c_str();
QString groupName = QString::fromUtf8(r->getRuleGroupName().c_str());
#if DEBUG_RULE_GROUPS
if (fwbdebug) qDebug("row %d: group %s",
@ -1122,7 +1122,7 @@ void RuleSetView::updateGroups()
for (int i = 0 ; i < rowsInfo.size(); i++)
{
Rule * r = ruleIndex[i];
group = r->getRuleGroupName().c_str();
group = QString::fromUtf8(r->getRuleGroupName().c_str());
QString color = groupColors[group];
RuleRowInfo *rri;
@ -1853,7 +1853,7 @@ void RuleSetView::paintCell(QPainter *pntr,
#ifdef DRAW_RULE_GROUP_FRAME
QString group = rule->getRuleGroupName ().c_str();
QString group = QString::fromUtf8(rule->getRuleGroupName ().c_str());
if (group!= "")
{
if (groupEnd!=-1 && groupEnd==row+1)
@ -2015,7 +2015,7 @@ void RuleSetView::drawRuleGroupHandle(QPainter *pntr, int row, int,
}
else
{
QString group = rule->getRuleGroupName().c_str();
QString group = QString::fromUtf8(rule->getRuleGroupName().c_str());
if (group != "")
{
if (groupEnd!=-1 && groupEnd==row+1)
@ -2796,7 +2796,7 @@ void RuleSetView::createGroup(int row, int count, const QString &groupName)
if (!isTreeReadWrite(this,ruleset)) return;
for (int idx=0 ; idx<count; idx++)
ruleIndex[row + idx]->setRuleGroupName(groupName.toAscii().data());
ruleIndex[row + idx]->setRuleGroupName(groupName.toUtf8().data());
// Note that ProjectPanel::reopenFirewall destroys all RuleSetView
// objects and creates new ones. Save stored inside RuleSetView
// object does not survive call to reopenFirewall()
@ -2818,19 +2818,19 @@ void RuleSetView::renameGroup()
this, "Rename group",
tr("Enter group name:"), QLineEdit::Normal,
oldGroup, &ok);
if (ok && !text.isEmpty())
if (ok && !text.isEmpty())
{
if (oldGroup==""||text=="")
return ;
if (oldGroup=="" || text=="") return ;
QString postfix = "";
for (int i =0 ; i < rowsInfo.size(); i++)
{
Rule * r = ruleIndex[i];
if (r!=NULL)
{
if (r->getRuleGroupName ().c_str() == oldGroup)
if (QString::fromUtf8(r->getRuleGroupName().c_str()) ==
oldGroup)
{
r->setRuleGroupName (text.toAscii().data());
r->setRuleGroupName(text.toUtf8().data());
}
}
}
@ -2862,7 +2862,7 @@ void RuleSetView::addToGroupAbove ()
Rule *r = ruleIndex[row+i];
if (r)
{
r->setRuleGroupName(ru->groupName.toAscii().data());
r->setRuleGroupName(ru->groupName.toUtf8().data());
//ruleIndex[row+i] =r ;
if (ru->collapsedGroup) showHideRuleGroup(row);
}
@ -2889,7 +2889,7 @@ void RuleSetView::addToGroupBelow()
Rule *r = ruleIndex[row+i];
if (r)
{
r->setRuleGroupName (ru->groupName.toAscii().data());
r->setRuleGroupName (ru->groupName.toUtf8().data());
//ruleIndex[row+i] =r ;
if (ru->collapsedGroup) showHideRuleGroup(row);
}
@ -2980,7 +2980,7 @@ void RuleSetView::removeFromGroup(int row, int count)
QString RuleSetView::getGroupColorForRule(Rule *rule)
{
QString group = rule->getRuleGroupName().c_str();
QString group = QString::fromUtf8(rule->getRuleGroupName().c_str());
return groupColors[group];
}

View File

@ -591,148 +591,141 @@ int main( int argc, char *argv[] )
if ( (argc-1)==optind)
filename = strdup( argv[optind++] );
// try
// {
if (fwbdebug) qDebug("Initializing ...");
if (fwbdebug) qDebug("Initializing ...");
if (fwbdebug) qDebug("Creating app ...");
//QApplication::setDesktopSettingsAware(desktopaware);
app = new QApplication( argc, argv );
app->setOrganizationName(QLatin1String("NetCitadel LLC"));
app->setApplicationName(QLatin1String("Firewall Builder"));
if (fwbdebug) qDebug("Creating app ...");
//QApplication::setDesktopSettingsAware(desktopaware);
app = new QApplication( argc, argv );
app->setOrganizationName(QLatin1String("NetCitadel LLC"));
app->setApplicationName(QLatin1String("Firewall Builder"));
/* need to initialize in order to be able to use FWBSettings */
init(argv);
init_platforms();
init(argv);
init_platforms();
Q_INIT_RESOURCE(MainRes);
Q_INIT_RESOURCE(MainRes);
if (fwbdebug) qDebug("Reading settings ...");
st = new FWBSettings();
st->init();
if (fwbdebug) qDebug("done");
if (fwbdebug) qDebug("Reading settings ...");
st = new FWBSettings();
st->init();
if (fwbdebug) qDebug("done");
QPixmapCache::setCacheLimit(4096);
QPixmapCache::setCacheLimit(4096);
// app->setFont(st->getTreeFont());
#ifdef ELC
registered = init2(argv0,
"Firewall Builder",
"fwb_gui30",
"3.0",
true, true, fwbdebug);
registered = init2(argv0,
"Firewall Builder",
"fwb_gui30",
"3.0",
true, true, fwbdebug);
#endif
string full_res_path = respath + FS_SEPARATOR + "resources.xml";
string full_res_path = respath + FS_SEPARATOR + "resources.xml";
if (fwbdebug)
{
qDebug("reading resources from '%s' ...", full_res_path.c_str());
}
if (fwbdebug)
{
qDebug("reading resources from '%s' ...", full_res_path.c_str());
}
//respath = RES_DIR;
new Resources(full_res_path);
if (fwbdebug) qDebug("done");
//respath = RES_DIR;
new Resources(full_res_path);
if (fwbdebug) qDebug("done");
vector<std::string> platforms = Resources::getListOfPlatforms();
if (platforms.empty() || (
platforms.size()==1 && platforms.front()=="unknown" ))
{
qDebug("Failed to load list of supported platforms");
exit(1);
}
vector<std::string> platforms = Resources::getListOfPlatforms();
if (platforms.empty() || (
platforms.size()==1 && platforms.front()=="unknown" ))
{
qDebug("Failed to load list of supported platforms");
exit(1);
}
if (cli_print)
{
if (fwbdebug) qDebug("Print from command line");
FWWindow::printFirewallFromFile(filename,
cli_print_fwname,
print_output_file_name);
return 0;
}
if (cli_print)
{
if (fwbdebug) qDebug("Print from command line");
FWWindow::printFirewallFromFile(filename,
cli_print_fwname,
print_output_file_name);
return 0;
}
if (fwbdebug) qDebug("creating widgets ...");
if (fwbdebug) qDebug("creating widgets ...");
new FWObjectDatabase();
new FWObjectClipboard();
new FWObjectDatabase();
new FWObjectClipboard();
if (fwbdebug) qDebug("loading translation for the current locale ...");
if (fwbdebug) qDebug("loading translation for the current locale ...");
QString local = QLocale::system().name();//"en_US";//
QTranslator translator(0);
translator.load(QLatin1String("fwbuilder_") +
QString(local), localepath.c_str());
app->installTranslator (&translator);
QString local = QLocale::system().name();//"en_US";//
QTranslator translator(0);
translator.load(QLatin1String("fwbuilder_") +
QString(local), localepath.c_str());
app->installTranslator (&translator);
QString qt_resource_dir =
QLibraryInfo::location(QLibraryInfo::TranslationsPath);
QString qt_resource_dir =
QLibraryInfo::location(QLibraryInfo::TranslationsPath);
QTranslator qt_translator(0);
qt_translator.load(QLatin1String("qt_") + QLocale::system().name(),
qt_resource_dir);
app->installTranslator (&qt_translator);
QTranslator qt_translator(0);
qt_translator.load(QLatin1String("qt_") + QLocale::system().name(),
qt_resource_dir);
app->installTranslator (&qt_translator);
/* must build list of available libraries _after_ creation of
* FWObjectDatabase and settings */
if (fwbdebug) qDebug("loading libraries ...");
if (fwbdebug) qDebug("loading libraries ...");
mw = new FWWindow();
//mw->setSafeMode(safemode);
if (filename!="") mw->openDocFiles << filename;
mw = new FWWindow();
//mw->setSafeMode(safemode);
if (filename!="") mw->openDocFiles.append(filename);
mw->show();
mw->show();
app->connect(app, SIGNAL( lastWindowClosed() ), app, SLOT( quit()));
app->connect(app, SIGNAL( lastWindowClosed() ), app, SLOT( quit()));
#if defined(Q_WS_MAC)
connectOdocHandler();
connectOdocHandler();
#endif
// setup single shot timer to call startupLoad()
QTimer::singleShot(0.5, mw, SLOT(startupLoad()));
// setup single shot timer to call startupLoad()
QTimer::singleShot(0.5, mw, SLOT(startupLoad()));
if (! st->getBool("UI/NoStartTip"))
{
StartTipDialog *stdlg = new StartTipDialog();
stdlg->show();
stdlg->raise();
}
if (! st->getBool("UI/NoStartTip"))
{
StartTipDialog *stdlg = new StartTipDialog();
stdlg->show();
stdlg->raise();
}
app->exec();
app->exec();
mw->hide(); // must do this before settings object is destroyed
if (mw->getAddOnLibs()!=NULL)
mw->getAddOnLibs()->save(); // ditto
mw->hide(); // must do this before settings object is destroyed
if (mw->getAddOnLibs()!=NULL)
mw->getAddOnLibs()->save(); // ditto
if ( st->getStartupAction()==1 )
{
if ( st->getStartupAction()==1 )
{
/* save the state of the GUI (opened firewall, opened object tree page, etc */
FWObject *o=mw->getVisibleFirewalls();
FWObject *o=mw->getVisibleFirewalls();
if (fwbdebug) qDebug("Main: closing. VisibleFirewall = %p",o);
if (fwbdebug) qDebug("Main: closing. VisibleFirewall = %p",o);
if (o) st->setStr("UI/visibleFirewall",
FWObjectDatabase::getStringId(
o->getId()).c_str());
if (o) st->setStr("UI/visibleFirewall",
FWObjectDatabase::getStringId(
o->getId()).c_str());
o=mw->getOpened();
if (o) st->setStr("UI/visibleObject",
FWObjectDatabase::getStringId(
o->getId()).c_str());
}
o=mw->getOpened();
if (o) st->setStr("UI/visibleObject",
FWObjectDatabase::getStringId(
o->getId()).c_str());
}
st->save();
delete st;
// }
// catch (FWException &ex)
// {
// qDebug("Exception: %s",ex.toString().c_str());
// }
st->save();
delete st;
}