Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Add remarks section to selected item properties #282

Draft
wants to merge 2 commits into
base: v1-2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/TailoringDockWidgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class XCCDFItemPropertiesDockWidget : public QDockWidget

protected slots:
void valueChanged(const QString& newValue);
void remarkChanged();
void selectValue(const QUrl& url);
void selectRule(const QUrl& url);

Expand Down
27 changes: 27 additions & 0 deletions src/TailoringDockWidgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ XCCDFItemPropertiesDockWidget::XCCDFItemPropertiesDockWidget(TailoringWindow* wi
this, SLOT(valueChanged(QString))
);

QObject::connect(
mUI.remarkEdit, SIGNAL(textChanged()),
this, SLOT(remarkChanged())
);

QObject::connect(
mUI.dependsOnValuesBrowser, SIGNAL(anchorClicked(QUrl)),
this, SLOT(selectValue(QUrl))
Expand Down Expand Up @@ -330,6 +335,18 @@ void XCCDFItemPropertiesDockWidget::refresh()
}
}
}

{
struct xccdf_select* select = xccdf_policy_get_select_by_id(mXccdfPolicy, xccdf_item_get_id(mXccdfItem));
if (select)
{
struct oscap_text_iterator* remarks = xccdf_select_get_remarks(select);
if (remarks && oscap_text_iterator_has_more(remarks))
{
mUI.remarkEdit->setHtml(oscapTextIteratorGetPreferred(remarks));
}
}
}
}

mRefreshInProgress = false;
Expand All @@ -346,6 +363,16 @@ void XCCDFItemPropertiesDockWidget::valueChanged(const QString& newValue)
refresh();
}

void XCCDFItemPropertiesDockWidget::remarkChanged()
{
if (mRefreshInProgress)
return;

// TODO: Actually push history and set this stuff correctly.

refresh();
}

void XCCDFItemPropertiesDockWidget::selectValue(const QUrl& url)
{
const QString id = url.fragment();
Expand Down
Loading