mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:06:08 +00:00
UI: ConfManager: Remove services table handling
This commit is contained in:
parent
fadb50110a
commit
9ebe4e09f8
@ -87,14 +87,6 @@ const char *const sqlUpdateAppGroup = "UPDATE app_group"
|
||||
const char *const sqlDeleteAppGroup = "DELETE FROM app_group"
|
||||
" WHERE app_group_id = ?1;";
|
||||
|
||||
const char *const sqlInsertService = "INSERT INTO service(name, app_group_id) VALUES(?1, ?2);";
|
||||
|
||||
const char *const sqlDeleteServices = "DELETE FROM service;";
|
||||
|
||||
const char *const sqlUpdateServiceResetGroup = "UPDATE service"
|
||||
" SET app_group_id = ?2"
|
||||
" WHERE app_group_id = ?1;";
|
||||
|
||||
const char *const sqlSelectTaskByName = "SELECT task_id, enabled, interval_hours,"
|
||||
" last_run, last_success, data"
|
||||
" FROM task"
|
||||
@ -358,7 +350,6 @@ bool removeAppGroupsInDb(SqliteDb *db, const FirewallConf &conf)
|
||||
bool ok;
|
||||
|
||||
db->executeEx(sqlUpdateAppResetGroup, { appGroupId, defaultAppGroupId }, 0);
|
||||
db->executeEx(sqlUpdateServiceResetGroup, { appGroupId, defaultAppGroupId }, 0);
|
||||
|
||||
db->executeEx(sqlDeleteAppGroup, { appGroupId }, 0, &ok);
|
||||
if (!ok)
|
||||
@ -370,28 +361,6 @@ bool removeAppGroupsInDb(SqliteDb *db, const FirewallConf &conf)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool saveServices(SqliteDb *db, const FirewallConf &conf)
|
||||
{
|
||||
#if 0
|
||||
bool ok;
|
||||
|
||||
// Delete services
|
||||
db->executeEx(sqlDeleteServices, {}, 0, &ok);
|
||||
if (!ok)
|
||||
return false;
|
||||
|
||||
// Add services
|
||||
SqliteStmt stmt;
|
||||
if (!db->prepare(stmt, sqlInsertService))
|
||||
return false;
|
||||
|
||||
for (const auto &v : conf.servicesMap()) {
|
||||
}
|
||||
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ConfManager::ConfManager(const QString &filePath, QObject *parent, quint32 openFlags) :
|
||||
@ -1230,8 +1199,7 @@ bool ConfManager::saveToDb(const FirewallConf &conf)
|
||||
|
||||
const bool ok = saveAddressGroups(sqliteDb(), conf) // Save Address Groups
|
||||
&& saveAppGroups(sqliteDb(), conf) // Save App Groups
|
||||
&& removeAppGroupsInDb(sqliteDb(), conf) // Remove App Groups
|
||||
&& saveServices(sqliteDb(), conf); // Save Services
|
||||
&& removeAppGroupsInDb(sqliteDb(), conf); // Remove App Groups
|
||||
|
||||
return checkResult(ok, true);
|
||||
}
|
||||
|
@ -251,11 +251,6 @@ void FirewallConf::setupAddressGroups()
|
||||
m_addressGroups.append(new AddressGroup(this));
|
||||
}
|
||||
|
||||
void FirewallConf::setServicesMap(const QVariantMap &servicesMap)
|
||||
{
|
||||
m_servicesMap = servicesMap;
|
||||
}
|
||||
|
||||
void FirewallConf::prepareToSave()
|
||||
{
|
||||
if (flagsEdited()) {
|
||||
@ -295,8 +290,6 @@ void FirewallConf::copyFlags(const FirewallConf &o)
|
||||
|
||||
m_appGroupBits = o.appGroupBits();
|
||||
applyAppGroupBits();
|
||||
|
||||
m_servicesMap = o.servicesMap();
|
||||
}
|
||||
|
||||
void FirewallConf::copy(const FirewallConf &o)
|
||||
@ -444,8 +437,6 @@ QVariant FirewallConf::toVariant(bool onlyFlags) const
|
||||
|
||||
map["appGroups"] = appGroupsToVariant();
|
||||
map["removedAppGroupIdList"] = removedAppGroupIdListToVariant();
|
||||
|
||||
map["servicesMap"] = servicesMap();
|
||||
}
|
||||
|
||||
if ((flags & FlagsEdited) != 0) {
|
||||
@ -477,8 +468,6 @@ void FirewallConf::fromVariant(const QVariant &v, bool onlyFlags)
|
||||
|
||||
appGroupsFromVariant(map["appGroups"]);
|
||||
removedAppGroupIdListFromVariant(map["removedAppGroupIdList"]);
|
||||
|
||||
m_servicesMap = map["servicesMap"].toMap();
|
||||
}
|
||||
|
||||
if (flagsEdited()) {
|
||||
|
@ -19,9 +19,8 @@ public:
|
||||
OptEdited = 0x01,
|
||||
FlagsEdited = 0x02,
|
||||
IniEdited = 0x04,
|
||||
ServiceEdited = 0x08,
|
||||
TaskEdited = 0x10,
|
||||
AllEdited = (OptEdited | FlagsEdited | IniEdited | ServiceEdited | TaskEdited)
|
||||
AllEdited = (OptEdited | FlagsEdited | IniEdited | TaskEdited)
|
||||
};
|
||||
|
||||
explicit FirewallConf(Settings *settings = nullptr, QObject *parent = nullptr);
|
||||
@ -37,9 +36,6 @@ public:
|
||||
bool iniEdited() const { return (m_editedFlags & IniEdited) != 0; }
|
||||
void setIniEdited() { m_editedFlags |= IniEdited; }
|
||||
|
||||
bool serviceEdited() const { return (m_editedFlags & ServiceEdited) != 0; }
|
||||
void setServiceEdited() { m_editedFlags |= ServiceEdited; }
|
||||
|
||||
bool taskEdited() const { return (m_editedFlags & TaskEdited) != 0; }
|
||||
void setTaskEdited() { m_editedFlags |= TaskEdited; }
|
||||
|
||||
@ -113,9 +109,6 @@ public:
|
||||
const QVector<qint64> &removedAppGroupIdList() const { return m_removedAppGroupIdList; }
|
||||
void clearRemovedAppGroupIdList() const;
|
||||
|
||||
QVariantMap servicesMap() const { return m_servicesMap; }
|
||||
void setServicesMap(const QVariantMap &servicesMap);
|
||||
|
||||
IniOptions &ini() { return m_ini; }
|
||||
const IniOptions &ini() const { return m_ini; }
|
||||
|
||||
@ -194,8 +187,6 @@ private:
|
||||
QList<AppGroup *> m_appGroups;
|
||||
mutable QVector<qint64> m_removedAppGroupIdList;
|
||||
|
||||
QVariantMap m_servicesMap;
|
||||
|
||||
IniOptions m_ini;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user