mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-03-24 04:07:55 +01:00
Make sure user folders are added properly. Also deal with case of an
object that has a folder attribute that doesn't exist in the parent's subfolders list (shouldn't ever happen, but in case it does it no longer crashes). Also make sure that subfolders don't have commas in them. Fixes #2539.
This commit is contained in:
parent
2ee4869fac
commit
cad71437f3
@ -9,6 +9,12 @@
|
||||
set ".loaded" variable before calling loadFromSource so that if an
|
||||
exception happens we won't try to load it again later.
|
||||
|
||||
* Fixed #2539. Make sure user folders are added properly. Also
|
||||
deal with case of an object that has a folder attribute that
|
||||
doesn't exist in the parent's subfolders list (shouldn't ever
|
||||
happen, but in case it does it no longer crashes). Also make sure
|
||||
that subfolders don't have commas in them.
|
||||
|
||||
2011-06-27 theron <theron@netcitadel.com>
|
||||
|
||||
* Fixed #2530, where adding a subfolder opens the parent folder in
|
||||
|
||||
@ -759,10 +759,18 @@ void ObjectManipulator::addSubfolderSlot()
|
||||
tr("Enter new subfolder name"));
|
||||
folder = folder.simplified();
|
||||
if (folder.isEmpty()) return;
|
||||
if (folder.contains(',')) {
|
||||
QMessageBox::warning(this, "Firewall Builder",
|
||||
tr("Subfolder cannot contain a comma"), "&OK",
|
||||
QString::null, QString::null, 0, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
/* See if the subfolder already exists */
|
||||
string folderStr = folder.toUtf8().constData();
|
||||
set<string> folders = stringToSet(obj->getStr("subfolders"));
|
||||
if (folders.find(folder.toUtf8().constData()) != folders.end()) return;
|
||||
if (folders.find(folderStr) != folders.end()) return;
|
||||
folders.insert(folderStr);
|
||||
|
||||
if (fwbdebug) {
|
||||
qDebug() << "ObjectManipulator::addSubfolder: " << folder;
|
||||
|
||||
@ -252,7 +252,13 @@ ObjectTreeViewItem* ObjectManipulator::insertObject(ObjectTreeViewItem *itm,
|
||||
ObjectTreeViewItem *item = itm;
|
||||
if (!obj->getStr("folder").empty()) {
|
||||
item = findUserFolder(itm, obj->getStr("folder").c_str());
|
||||
if (item == 0) item = itm;
|
||||
|
||||
/* If we can't find the user folder, put it under the system
|
||||
folder and get rid of the folder attribute */
|
||||
if (item == 0) {
|
||||
item = itm;
|
||||
obj->setStr("folder", "");
|
||||
}
|
||||
}
|
||||
|
||||
ObjectTreeViewItem *nitm = new ObjectTreeViewItem(item);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user