1
0
mirror of https://github.com/altlinux/admc.git synced 2025-01-06 21:18:15 +03:00

Add advanced selected objects getter to SelectObjectDialog

This commit is contained in:
Semyon Knyazev 2024-06-11 22:45:53 +04:00
parent 650b144697
commit 190ccbdf20
2 changed files with 20 additions and 0 deletions

View File

@ -103,6 +103,20 @@ QList<QString> SelectObjectDialog::get_selected() const {
return out;
}
QList<SelectedObjectData> SelectObjectDialog::get_selected_advanced() const {
QList<SelectedObjectData> out;
for (int row = 0; row < model->rowCount(); row++) {
const QModelIndex index = model->index(row, 0);
const QString dn = index.data(ObjectRole_DN).toString();
const QString category = index.data(ObjectRole_ObjectCategory).toString();
out.append({dn, category});
}
return out;
}
void SelectObjectDialog::accept() {
const QList<QString> selected = get_selected();

View File

@ -36,6 +36,11 @@ enum SelectObjectDialogMultiSelection {
SelectObjectDialogMultiSelection_No
};
struct SelectedObjectData {
QString dn;
QString category;
};
class SelectObjectDialog final : public QDialog {
Q_OBJECT
@ -48,6 +53,7 @@ public:
static QList<QString> header_labels();
QList<QString> get_selected() const;
QList<SelectedObjectData> get_selected_advanced() const;
public slots:
void accept() override;