Commit b5347fb8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Allow to assign rules

parent 209a9eac
......@@ -56,6 +56,11 @@ QStringList ConfirmBeforeDeletingManager::ruleGroups(const KSharedConfig::Ptr &c
return config->groupList().filter(QRegularExpression(defaultGroupName() + QStringLiteral(" #\\d+")));
}
void ConfirmBeforeDeletingManager::setRules(const QVector<ConfirmBeforeDeletingRule> &newRules)
{
mRules = newRules;
}
const QVector<ConfirmBeforeDeletingRule> &ConfirmBeforeDeletingManager::rules() const
{
return mRules;
......
......@@ -29,6 +29,8 @@ public:
Q_REQUIRED_RESULT const QVector<ConfirmBeforeDeletingRule> &rules() const;
void setRules(const QVector<ConfirmBeforeDeletingRule> &newRules);
private:
Q_REQUIRED_RESULT QString defaultConfigFileName() const;
Q_REQUIRED_RESULT QStringList ruleGroups(const KSharedConfig::Ptr &config) const;
......
......@@ -50,7 +50,10 @@ void ConfirmBeforeDeletingWidget::slotEditRule()
{
QTreeWidgetItem *item = mTreeWidget->currentItem();
QPointer<ConfirmBeforeDeletingCreateRuleDialog> dlg = new ConfirmBeforeDeletingCreateRuleDialog(this);
// TODO dlg->setInfo();
ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo currentInfo;
currentInfo.pattern = item->text(0);
currentInfo.ruleType = item->text(1);
dlg->setInfo(currentInfo);
if (dlg->exec()) {
const ConfirmBeforeDeletingCreateRuleWidget::ConfirmBeforeDeletingInfo info = dlg->info();
item->setText(0, info.pattern);
......@@ -96,4 +99,7 @@ void ConfirmBeforeDeletingWidget::slotAddRule()
void ConfirmBeforeDeletingWidget::save()
{
QVector<ConfirmBeforeDeletingRule> rules;
// TODO
ConfirmBeforeDeletingManager::self()->saveRules();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment