mirror of
https://github.com/altlinux/admc.git
synced 2025-03-13 04:58:22 +03:00
remove obsolete edit ctor's
the ones that construct widgets instead of accepting widget args fix tests fix incosistent order in edit ctors
This commit is contained in:
parent
a03d761fe6
commit
0971a84f20
@ -41,7 +41,7 @@ CreateUserDialog::CreateUserDialog(QWidget *parent)
|
||||
new StringEdit(ui->initials_edit, ATTRIBUTE_INITIALS, CLASS_USER, &edit_list, this);
|
||||
sama_edit = new SamaEdit(ui->sama_edit, ui->sama_domain_edit, &edit_list, this);
|
||||
|
||||
new PasswordEdit(&edit_list, ui->password_main_edit, ui->password_confirm_edit, this);
|
||||
new PasswordEdit(ui->password_main_edit, ui->password_confirm_edit, &edit_list, this);
|
||||
|
||||
upn_edit = new UpnEdit(ui->upn_prefix_edit, ui->upn_suffix_edit, &edit_list, this);
|
||||
|
||||
|
@ -29,42 +29,16 @@
|
||||
#include <QMap>
|
||||
#include <QGroupBox>
|
||||
|
||||
void AccountOptionEdit::make_many(const QList<AccountOption> options, QMap<AccountOption, AccountOptionEdit *> *option_edits_out, QList<AttributeEdit *> *edits_out, QWidget *parent) {
|
||||
QHash<AccountOption, QCheckBox *> check_map;
|
||||
|
||||
for (auto option : options) {
|
||||
auto edit = new AccountOptionEdit(option, edits_out, parent);
|
||||
check_map[option] = edit->check;
|
||||
option_edits_out->insert(option, edit);
|
||||
}
|
||||
|
||||
account_option_setup_conflicts(check_map);
|
||||
}
|
||||
|
||||
QWidget *AccountOptionEdit::layout_many(const QList<AccountOption> &options, const QMap<AccountOption, AccountOptionEdit *> &option_edits) {
|
||||
auto group_box = new QGroupBox(tr("Account options:"));
|
||||
auto layout = new QVBoxLayout();
|
||||
group_box->setLayout(layout);
|
||||
|
||||
for (const auto option : options) {
|
||||
auto edit = option_edits[option];
|
||||
layout->addWidget(edit->check, 0);
|
||||
}
|
||||
|
||||
return group_box;
|
||||
}
|
||||
|
||||
AccountOptionEdit::AccountOptionEdit(const AccountOption option_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
const QString check_text = account_option_string(option_arg);
|
||||
auto check_arg = new QCheckBox(check_text);
|
||||
|
||||
init(option_arg, check_arg);
|
||||
}
|
||||
|
||||
AccountOptionEdit::AccountOptionEdit(QCheckBox *check_arg, const AccountOption option_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
init(option_arg, check_arg);
|
||||
option = option_arg;
|
||||
check = check_arg;
|
||||
|
||||
QObject::connect(
|
||||
check, &QCheckBox::stateChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
||||
void AccountOptionEdit::load_internal(AdInterface &ad, const AdObject &object) {
|
||||
@ -87,25 +61,6 @@ bool AccountOptionEdit::apply(AdInterface &ad, const QString &dn) const {
|
||||
return success;
|
||||
}
|
||||
|
||||
void AccountOptionEdit::set_checked(const bool checked) {
|
||||
check->setChecked(checked);
|
||||
}
|
||||
|
||||
QCheckBox *AccountOptionEdit::get_check() const {
|
||||
return check;
|
||||
}
|
||||
|
||||
void AccountOptionEdit::init(const AccountOption option_arg, QCheckBox *check_arg) {
|
||||
option = option_arg;
|
||||
check = check_arg;
|
||||
|
||||
QObject::connect(
|
||||
check, &QCheckBox::stateChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
||||
// PasswordExpired conflicts with (DontExpirePassword and
|
||||
// CantChangePassword) When PasswordExpired is set, the
|
||||
// other two can't be set When any of the other two are set,
|
||||
|
@ -31,22 +31,12 @@ class QWidget;
|
||||
class AccountOptionEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void make_many(const QList<AccountOption> options, QMap<AccountOption, AccountOptionEdit *> *option_edits_out, QList<AttributeEdit *> *edits_out, QWidget *parent);
|
||||
static QWidget *layout_many(const QList<AccountOption> &options, const QMap<AccountOption, AccountOptionEdit *> &option_edits);
|
||||
|
||||
AccountOptionEdit(QCheckBox *check, const AccountOption option_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
AccountOptionEdit(const AccountOption option_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
void set_checked(const bool checked);
|
||||
|
||||
QCheckBox *get_check() const;
|
||||
|
||||
private:
|
||||
AccountOption option;
|
||||
QCheckBox *check;
|
||||
|
||||
void init(const AccountOption option_arg, QCheckBox *check_arg);
|
||||
};
|
||||
|
||||
void account_option_setup_conflicts(const QHash<AccountOption, QCheckBox *> &check_map);
|
||||
|
@ -27,17 +27,6 @@
|
||||
#include <QComboBox>
|
||||
#include <QFormLayout>
|
||||
|
||||
CountryEdit::CountryEdit(QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
combo = new QComboBox();
|
||||
|
||||
country_combo_init(combo);
|
||||
|
||||
connect(
|
||||
combo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &CountryEdit::edited);
|
||||
}
|
||||
|
||||
CountryEdit::CountryEdit(QComboBox *combo_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
combo = combo_arg;
|
||||
|
@ -28,7 +28,6 @@ class QComboBox;
|
||||
class CountryEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CountryEdit(QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
CountryEdit(QComboBox *combo, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
|
@ -32,16 +32,13 @@ DateTimeEdit::DateTimeEdit(QDateTimeEdit *edit_arg, const QString &attribute_arg
|
||||
attribute = attribute_arg;
|
||||
attribute = attribute_arg;
|
||||
|
||||
init();
|
||||
}
|
||||
edit->setDisplayFormat(DATETIME_DISPLAY_FORMAT);
|
||||
|
||||
|
||||
DateTimeEdit::DateTimeEdit(const QString &attribute_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
edit = new QDateTimeEdit();
|
||||
attribute = attribute_arg;
|
||||
|
||||
init();
|
||||
QObject::connect(
|
||||
edit, &QDateTimeEdit::dateTimeChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
||||
void DateTimeEdit::load_internal(AdInterface &ad, const AdObject &object) {
|
||||
@ -68,13 +65,3 @@ bool DateTimeEdit::apply(AdInterface &ad, const QString &dn) const {
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void DateTimeEdit::init() {
|
||||
edit->setDisplayFormat(DATETIME_DISPLAY_FORMAT);
|
||||
|
||||
QObject::connect(
|
||||
edit, &QDateTimeEdit::dateTimeChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
@ -31,14 +31,11 @@ class DateTimeEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DateTimeEdit(QDateTimeEdit *edit, const QString &attribute_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DateTimeEdit(const QString &attribute_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
private:
|
||||
QString attribute;
|
||||
QDateTimeEdit *edit;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
#endif /* DATETIME_EDIT_H */
|
||||
|
@ -26,30 +26,11 @@
|
||||
#include <QRadioButton>
|
||||
#include <QFormLayout>
|
||||
|
||||
DelegationEdit::DelegationEdit(QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
off_button = new QRadioButton(tr("Do not trust for delegation"));
|
||||
on_button = new QRadioButton(tr("Trust for delegation to any service using Kerberos"));
|
||||
|
||||
off_button->setObjectName("off_button");
|
||||
on_button->setObjectName("on_button");
|
||||
|
||||
QObject::connect(
|
||||
off_button, &QAbstractButton::clicked,
|
||||
this, &AttributeEdit::edited);
|
||||
QObject::connect(
|
||||
on_button, &QAbstractButton::clicked,
|
||||
this, &AttributeEdit::edited);
|
||||
}
|
||||
|
||||
DelegationEdit::DelegationEdit(QRadioButton *off_button_arg, QRadioButton *on_button_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
off_button = off_button_arg;
|
||||
on_button = on_button_arg;
|
||||
|
||||
off_button->setObjectName("off_button");
|
||||
on_button->setObjectName("on_button");
|
||||
|
||||
QObject::connect(
|
||||
off_button, &QAbstractButton::clicked,
|
||||
this, &AttributeEdit::edited);
|
||||
|
@ -28,7 +28,6 @@ class QRadioButton;
|
||||
class DelegationEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DelegationEdit(QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DelegationEdit(QRadioButton *off_button, QRadioButton *on_button, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
|
@ -25,17 +25,6 @@
|
||||
#include <QCheckBox>
|
||||
#include <QFormLayout>
|
||||
|
||||
GpoptionsEdit::GpoptionsEdit(QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
check = new QCheckBox(tr("Block policy inheritance"));
|
||||
|
||||
QObject::connect(
|
||||
check, &QCheckBox::stateChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
||||
GpoptionsEdit::GpoptionsEdit(QCheckBox *check_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
check = check_arg;
|
||||
|
@ -28,7 +28,6 @@ class QCheckBox;
|
||||
class GpoptionsEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GpoptionsEdit(QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
GpoptionsEdit(QCheckBox *check, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
|
@ -25,18 +25,22 @@
|
||||
#include <QComboBox>
|
||||
#include <QFormLayout>
|
||||
|
||||
GroupScopeEdit::GroupScopeEdit(QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
combo = new QComboBox();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
GroupScopeEdit::GroupScopeEdit(QComboBox *combo_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
combo = combo_arg;
|
||||
|
||||
init();
|
||||
for (int i = 0; i < GroupScope_COUNT; i++) {
|
||||
const GroupScope type = (GroupScope) i;
|
||||
const QString type_string = group_scope_string(type);
|
||||
|
||||
combo->addItem(type_string, (int) type);
|
||||
}
|
||||
|
||||
QObject::connect(
|
||||
combo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -61,18 +65,3 @@ bool GroupScopeEdit::apply(AdInterface &ad, const QString &dn) const {
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void GroupScopeEdit::init() {
|
||||
for (int i = 0; i < GroupScope_COUNT; i++) {
|
||||
const GroupScope type = (GroupScope) i;
|
||||
const QString type_string = group_scope_string(type);
|
||||
|
||||
combo->addItem(type_string, (int) type);
|
||||
}
|
||||
|
||||
QObject::connect(
|
||||
combo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
@ -28,14 +28,11 @@ class QComboBox;
|
||||
class GroupScopeEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GroupScopeEdit(QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
GroupScopeEdit(QComboBox *combo, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
private:
|
||||
QComboBox *combo;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
#endif /* GROUP_SCOPE_EDIT_H */
|
||||
|
@ -25,18 +25,22 @@
|
||||
#include <QComboBox>
|
||||
#include <QFormLayout>
|
||||
|
||||
GroupTypeEdit::GroupTypeEdit(QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
combo = new QComboBox();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
GroupTypeEdit::GroupTypeEdit(QComboBox *combo_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
combo = combo_arg;
|
||||
|
||||
init();
|
||||
for (int i = 0; i < GroupType_COUNT; i++) {
|
||||
const GroupType type = (GroupType) i;
|
||||
const QString type_string = group_type_string(type);
|
||||
|
||||
combo->addItem(type_string, (int) type);
|
||||
}
|
||||
|
||||
QObject::connect(
|
||||
combo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
||||
void GroupTypeEdit::load_internal(AdInterface &ad, const AdObject &object) {
|
||||
@ -60,18 +64,3 @@ bool GroupTypeEdit::apply(AdInterface &ad, const QString &dn) const {
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void GroupTypeEdit::init() {
|
||||
for (int i = 0; i < GroupType_COUNT; i++) {
|
||||
const GroupType type = (GroupType) i;
|
||||
const QString type_string = group_type_string(type);
|
||||
|
||||
combo->addItem(type_string, (int) type);
|
||||
}
|
||||
|
||||
QObject::connect(
|
||||
combo, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
@ -28,14 +28,11 @@ class QComboBox;
|
||||
class GroupTypeEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GroupTypeEdit(QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
GroupTypeEdit(QComboBox *combo, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
private:
|
||||
QComboBox *combo;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
#endif /* GROUP_TYPE_EDIT_H */
|
||||
|
@ -26,18 +26,6 @@
|
||||
|
||||
#include <QFormLayout>
|
||||
|
||||
ManagerEdit::ManagerEdit(const QString &manager_attribute_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
manager_attribute = manager_attribute_arg;
|
||||
|
||||
widget = new ManagerWidget();
|
||||
widget->set_attribute(manager_attribute_arg);
|
||||
|
||||
connect(
|
||||
widget, &ManagerWidget::edited,
|
||||
this, &ManagerEdit::edited);
|
||||
}
|
||||
|
||||
ManagerEdit::ManagerEdit(ManagerWidget *widget_arg, const QString &manager_attribute_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
manager_attribute = manager_attribute_arg;
|
||||
|
@ -36,7 +36,6 @@ class ManagerWidget;
|
||||
class ManagerEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ManagerEdit(const QString &manager_attribute_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
ManagerEdit(ManagerWidget *widget_arg, const QString &manager_attribute_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
|
@ -28,17 +28,25 @@
|
||||
#include <QLineEdit>
|
||||
#include <QTextCodec>
|
||||
|
||||
PasswordEdit::PasswordEdit(QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
PasswordEdit::PasswordEdit(QLineEdit *edit_arg, QLineEdit *confirm_edit_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
auto edit_arg = new QLineEdit();
|
||||
auto confirm_edit_arg = new QLineEdit();
|
||||
edit = edit_arg;
|
||||
confirm_edit = confirm_edit_arg;
|
||||
|
||||
init(edit_arg, confirm_edit_arg);
|
||||
}
|
||||
// TODO: remove later because i think this won't be
|
||||
// needed if i set name in create object dialog when i
|
||||
// ui'fy that
|
||||
edit->setObjectName("password_main_edit");
|
||||
confirm_edit->setObjectName("password_confirm_edit");
|
||||
|
||||
PasswordEdit::PasswordEdit(QList<AttributeEdit *> *edits_out, QLineEdit *edit_arg, QLineEdit *confirm_edit_arg, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
init(edit_arg, confirm_edit_arg);
|
||||
limit_edit(edit, ATTRIBUTE_PASSWORD);
|
||||
limit_edit(confirm_edit, ATTRIBUTE_PASSWORD);
|
||||
|
||||
QObject::connect(
|
||||
edit, &QLineEdit::textChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
||||
void PasswordEdit::load_internal(AdInterface &ad, const AdObject &object) {
|
||||
@ -93,23 +101,3 @@ QLineEdit *PasswordEdit::get_edit() const {
|
||||
QLineEdit *PasswordEdit::get_confirm_edit() const {
|
||||
return confirm_edit;
|
||||
}
|
||||
|
||||
void PasswordEdit::init(QLineEdit *edit_arg, QLineEdit *confirm_edit_arg) {
|
||||
edit = edit_arg;
|
||||
confirm_edit = confirm_edit_arg;
|
||||
|
||||
// TODO: remove later because i think this won't be
|
||||
// needed if i set name in create object dialog when i
|
||||
// ui'fy that
|
||||
edit->setObjectName("password_main_edit");
|
||||
confirm_edit->setObjectName("password_confirm_edit");
|
||||
|
||||
limit_edit(edit, ATTRIBUTE_PASSWORD);
|
||||
limit_edit(confirm_edit, ATTRIBUTE_PASSWORD);
|
||||
|
||||
QObject::connect(
|
||||
edit, &QLineEdit::textChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
@ -28,8 +28,7 @@ class QLineEdit;
|
||||
class PasswordEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
PasswordEdit(QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
PasswordEdit(QList<AttributeEdit *> *edits_out, QLineEdit *edit_arg, QLineEdit *confirm_edit_arg, QObject *parent);
|
||||
PasswordEdit(QLineEdit *edit_arg, QLineEdit *confirm_edit_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
bool verify(AdInterface &ad, const QString &dn) const override;
|
||||
@ -40,8 +39,6 @@ public:
|
||||
private:
|
||||
QLineEdit *edit;
|
||||
QLineEdit *confirm_edit;
|
||||
|
||||
void init(QLineEdit *edit_arg, QLineEdit *confirm_edit_arg);
|
||||
};
|
||||
|
||||
#endif /* PASSWORD_EDIT_H */
|
||||
|
@ -31,18 +31,15 @@
|
||||
// permissions for "delete" and "delete subtree" for
|
||||
// "WORLD"(everyone) trustee
|
||||
|
||||
ProtectDeletionEdit::ProtectDeletionEdit(QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
check = new QCheckBox(tr("Protect against deletion"));
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
ProtectDeletionEdit::ProtectDeletionEdit(QCheckBox *check_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
check = check_arg;
|
||||
|
||||
init();
|
||||
connect(
|
||||
check, &QCheckBox::stateChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
||||
void ProtectDeletionEdit::set_enabled(const bool enabled) {
|
||||
@ -69,11 +66,3 @@ bool ProtectDeletionEdit::apply(AdInterface &ad, const QString &dn) const {
|
||||
|
||||
return apply_success;
|
||||
}
|
||||
|
||||
void ProtectDeletionEdit::init() {
|
||||
connect(
|
||||
check, &QCheckBox::stateChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ class QCheckBox;
|
||||
class ProtectDeletionEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProtectDeletionEdit(QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
ProtectDeletionEdit(QCheckBox *check, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
@ -41,8 +40,6 @@ public:
|
||||
|
||||
private:
|
||||
QCheckBox *check;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
#endif /* PROTECT_DELETION_EDIT_H */
|
||||
|
@ -32,18 +32,6 @@ SamaEdit::SamaEdit(QLineEdit *sama_edit, QLineEdit *domain_edit_arg, QList<Attri
|
||||
edit = sama_edit;
|
||||
domain_edit = domain_edit_arg;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
SamaEdit::SamaEdit(QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
edit = new QLineEdit();
|
||||
domain_edit = nullptr;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
void SamaEdit::init() {
|
||||
limit_edit(edit, ATTRIBUTE_SAMACCOUNT_NAME);
|
||||
|
||||
QObject::connect(
|
||||
|
@ -28,7 +28,6 @@ class QLineEdit;
|
||||
class SamaEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SamaEdit(QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
SamaEdit(QLineEdit *sama_edit, QLineEdit *domain_edit_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
@ -37,8 +36,6 @@ public:
|
||||
private:
|
||||
QLineEdit *edit;
|
||||
QLineEdit *domain_edit;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
#endif /* SAMA_EDIT_H */
|
||||
|
@ -27,31 +27,12 @@
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
|
||||
void StringEdit::make_many(const QList<QString> attributes, const QString &objectClass, QList<AttributeEdit *> *edits_out, QObject *parent) {
|
||||
for (auto attribute : attributes) {
|
||||
new StringEdit(attribute, objectClass, edits_out, parent);
|
||||
}
|
||||
}
|
||||
|
||||
StringEdit::StringEdit(QLineEdit *edit_arg, const QString &attribute_arg, const QString &objectClass_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
attribute = attribute_arg;
|
||||
objectClass = objectClass_arg;
|
||||
edit = edit_arg;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
StringEdit::StringEdit(const QString &attribute_arg, const QString &objectClass_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
attribute = attribute_arg;
|
||||
objectClass = objectClass_arg;
|
||||
edit = new QLineEdit();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
void StringEdit::init() {
|
||||
if (g_adconfig->get_attribute_is_number(attribute)) {
|
||||
set_line_edit_to_numbers_only(edit);
|
||||
}
|
||||
|
@ -28,9 +28,6 @@ class QLineEdit;
|
||||
class StringEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static void make_many(const QList<QString> attributes, const QString &objectClass, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
|
||||
StringEdit(const QString &attribute_arg, const QString &objectClass_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
StringEdit(QLineEdit *edit_arg, const QString &attribute_arg, const QString &objectClass_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
@ -39,8 +36,6 @@ private:
|
||||
QString attribute;
|
||||
QString objectClass;
|
||||
|
||||
void init();
|
||||
|
||||
friend class StringOtherEdit;
|
||||
};
|
||||
|
||||
|
@ -26,7 +26,12 @@
|
||||
#include <QFormLayout>
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
void StringLargeEdit::init() {
|
||||
StringLargeEdit::StringLargeEdit(QPlainTextEdit *edit_arg, const QString &attribute_arg, const QString &objectClass_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
attribute = attribute_arg;
|
||||
objectClass = objectClass_arg;
|
||||
edit = edit_arg;
|
||||
|
||||
const int range_upper = g_adconfig->get_attribute_range_upper(attribute);
|
||||
if (range_upper > 0) {
|
||||
// NOTE: QPlainTextEdit doesn't have a straightforward setMaxLength() so have to do it ourselves
|
||||
@ -50,25 +55,6 @@ void StringLargeEdit::init() {
|
||||
});
|
||||
}
|
||||
|
||||
StringLargeEdit::StringLargeEdit(const QString &attribute_arg, const QString &objectClass_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
attribute = attribute_arg;
|
||||
objectClass = objectClass_arg;
|
||||
|
||||
edit = new QPlainTextEdit();
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
StringLargeEdit::StringLargeEdit(QPlainTextEdit *edit_arg, const QString &attribute_arg, const QString &objectClass_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
attribute = attribute_arg;
|
||||
objectClass = objectClass_arg;
|
||||
edit = edit_arg;
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
void StringLargeEdit::load_internal(AdInterface &ad, const AdObject &object) {
|
||||
const QString value = object.get_string(attribute);
|
||||
|
||||
|
@ -33,7 +33,6 @@ class QPlainTextEdit;
|
||||
class StringLargeEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
StringLargeEdit(const QString &attribute_arg, const QString &objectClass_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
StringLargeEdit(QPlainTextEdit *edit, const QString &attribute_arg, const QString &objectClass_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
@ -41,8 +40,6 @@ private:
|
||||
QPlainTextEdit *edit;
|
||||
QString attribute;
|
||||
QString objectClass;
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
#endif /* STRING_LARGE_EDIT_H */
|
||||
|
@ -57,34 +57,6 @@ StringOtherEdit::StringOtherEdit(QLineEdit *line_edit_arg, QPushButton *other_bu
|
||||
});
|
||||
}
|
||||
|
||||
StringOtherEdit::StringOtherEdit(const QString &main_attribute, const QString &other_attribute_arg, const QString &object_class, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent)
|
||||
, other_attribute(other_attribute_arg) {
|
||||
main_edit = new StringEdit(main_attribute, object_class, nullptr, parent);
|
||||
|
||||
QObject::connect(
|
||||
main_edit, &AttributeEdit::edited,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
|
||||
other_button = new QPushButton(tr("Other..."));
|
||||
connect(other_button, &QPushButton::clicked,
|
||||
[this]() {
|
||||
auto dialog = new MultiEditor(other_attribute, other_button);
|
||||
dialog->load(other_values);
|
||||
dialog->open();
|
||||
|
||||
connect(
|
||||
dialog, &QDialog::accepted,
|
||||
[this, dialog]() {
|
||||
other_values = dialog->get_new_values();
|
||||
|
||||
emit edited();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void StringOtherEdit::load_internal(AdInterface &ad, const AdObject &object) {
|
||||
main_edit->load(ad, object);
|
||||
|
||||
|
@ -38,7 +38,6 @@ class QLineEdit;
|
||||
class StringOtherEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
StringOtherEdit(const QString &main_attribute_arg, const QString &other_attribute_arg, const QString &object_class, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
StringOtherEdit(QLineEdit *line_edit, QPushButton *other_button, const QString &main_attribute_arg, const QString &other_attribute_arg, const QString &object_class, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
|
@ -26,16 +26,15 @@
|
||||
#include <QCheckBox>
|
||||
#include <QFormLayout>
|
||||
|
||||
UnlockEdit::UnlockEdit(QList<AttributeEdit *> *edits_out, const UnlockEditStyle style_arg, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
auto check_arg = new QCheckBox();
|
||||
|
||||
init(style_arg, check_arg);
|
||||
}
|
||||
|
||||
UnlockEdit::UnlockEdit(QCheckBox *check_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
init(UnlockEditStyle_CheckOnLeft, check_arg);
|
||||
check = check_arg;
|
||||
|
||||
connect(
|
||||
check, &QCheckBox::stateChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
||||
QString UnlockEdit::label_text() {
|
||||
@ -51,20 +50,19 @@ void UnlockEdit::set_read_only(const bool read_only) {
|
||||
}
|
||||
|
||||
void UnlockEdit::add_to_layout(QFormLayout *layout) {
|
||||
switch (style) {
|
||||
case UnlockEditStyle_CheckOnLeft: {
|
||||
layout->addRow(check);
|
||||
// switch (style) {
|
||||
// case UnlockEditStyle_CheckOnLeft: {
|
||||
// layout->addRow(check);
|
||||
|
||||
break;
|
||||
}
|
||||
case UnlockEditStyle_CheckOnRight: {
|
||||
layout->addRow(QString("%1:").arg(label_text()), check);
|
||||
// break;
|
||||
// }
|
||||
// case UnlockEditStyle_CheckOnRight: {
|
||||
// layout->addRow(QString("%1:").arg(label_text()), check);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
bool UnlockEdit::apply(AdInterface &ad, const QString &dn) const {
|
||||
@ -78,27 +76,3 @@ bool UnlockEdit::apply(AdInterface &ad, const QString &dn) const {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void UnlockEdit::init(const UnlockEditStyle style_arg, QCheckBox *check_arg) {
|
||||
style = style_arg;
|
||||
|
||||
check = check_arg;
|
||||
|
||||
// NOTE: if check is on left, then put text in the
|
||||
// checkbox
|
||||
const QString check_text = [&]() {
|
||||
switch (style) {
|
||||
case UnlockEditStyle_CheckOnLeft: return label_text();
|
||||
case UnlockEditStyle_CheckOnRight: return QString();
|
||||
}
|
||||
return QString();
|
||||
}();
|
||||
|
||||
check->setText(check_text);
|
||||
|
||||
connect(
|
||||
check, &QCheckBox::stateChanged,
|
||||
[this]() {
|
||||
emit edited();
|
||||
});
|
||||
}
|
||||
|
@ -36,15 +36,9 @@
|
||||
|
||||
class QCheckBox;
|
||||
|
||||
enum UnlockEditStyle {
|
||||
UnlockEditStyle_CheckOnLeft,
|
||||
UnlockEditStyle_CheckOnRight,
|
||||
};
|
||||
|
||||
class UnlockEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
UnlockEdit(QList<AttributeEdit *> *edits_out, const UnlockEditStyle style, QObject *parent);
|
||||
UnlockEdit(QCheckBox *check_arg, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
@ -52,9 +46,6 @@ public:
|
||||
|
||||
private:
|
||||
QCheckBox *check;
|
||||
UnlockEditStyle style;
|
||||
|
||||
void init(const UnlockEditStyle style_arg, QCheckBox *check_arg);
|
||||
};
|
||||
|
||||
#endif /* UNLOCK_EDIT_H */
|
||||
|
@ -29,27 +29,11 @@
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
|
||||
UpnEdit::UpnEdit(QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
prefix_edit = new QLineEdit();
|
||||
upn_suffix_combo = new QComboBox();
|
||||
|
||||
init_internal();
|
||||
}
|
||||
|
||||
UpnEdit::UpnEdit(QLineEdit *prefix_edit_arg, QComboBox *upn_suffix_combo_arg, QList<AttributeEdit *> *edits_out, QObject *parent)
|
||||
: AttributeEdit(edits_out, parent) {
|
||||
prefix_edit = prefix_edit_arg;
|
||||
upn_suffix_combo = upn_suffix_combo_arg;
|
||||
|
||||
init_internal();
|
||||
}
|
||||
|
||||
void UpnEdit::init_suffixes(AdInterface &ad) {
|
||||
upn_suffix_combo_init(upn_suffix_combo, ad);
|
||||
}
|
||||
|
||||
void UpnEdit::init_internal() {
|
||||
limit_edit(prefix_edit, ATTRIBUTE_USER_PRINCIPAL_NAME);
|
||||
|
||||
QObject::connect(
|
||||
@ -62,6 +46,10 @@ void UpnEdit::init_internal() {
|
||||
this, &UpnEdit::edited);
|
||||
}
|
||||
|
||||
void UpnEdit::init_suffixes(AdInterface &ad) {
|
||||
upn_suffix_combo_init(upn_suffix_combo, ad);
|
||||
}
|
||||
|
||||
void UpnEdit::load_internal(AdInterface &ad, const AdObject &object) {
|
||||
upn_suffix_combo_load(upn_suffix_combo, object);
|
||||
|
||||
|
@ -30,7 +30,6 @@ class QComboBox;
|
||||
class UpnEdit final : public AttributeEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
UpnEdit(QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
UpnEdit(QLineEdit *prefix_edit, QComboBox *suffix_combo, QList<AttributeEdit *> *edits_out, QObject *parent);
|
||||
DECL_ATTRIBUTE_EDIT_VIRTUALS();
|
||||
|
||||
@ -45,8 +44,6 @@ private:
|
||||
friend class StringOtherEdit;
|
||||
|
||||
QString get_new_value() const;
|
||||
|
||||
void init_internal();
|
||||
};
|
||||
|
||||
#endif /* UPN_EDIT_H */
|
||||
|
@ -46,7 +46,7 @@ PasswordDialog::PasswordDialog(const QString &target_arg, QWidget *parent)
|
||||
|
||||
const AdObject object = ad.search_object(target);
|
||||
|
||||
new PasswordEdit(&edits, ui->password_main_edit, ui->password_confirm_edit, this);
|
||||
new PasswordEdit(ui->password_main_edit, ui->password_confirm_edit, &edits, this);
|
||||
|
||||
new AccountOptionEdit(ui->expired_check, AccountOption_PasswordExpired, &edits, this);
|
||||
|
||||
|
@ -39,20 +39,16 @@ void ADMCTestAccountOptionEdit::init() {
|
||||
|
||||
return out;
|
||||
}();
|
||||
|
||||
QList<AttributeEdit *> edit_list;
|
||||
AccountOptionEdit::make_many(option_list, &edit_map, &edit_list, parent_widget);
|
||||
|
||||
check_map = [&]() {
|
||||
QHash<AccountOption, QCheckBox *> out;
|
||||
for (const AccountOption &option : option_list) {
|
||||
auto check = new QCheckBox(parent_widget);
|
||||
auto edit = new AccountOptionEdit(check, option, &edit_list, parent_widget);
|
||||
|
||||
for (const AccountOption option : edit_map.keys()) {
|
||||
AccountOptionEdit *edit = edit_map[option];
|
||||
QCheckBox *check = edit->get_check();
|
||||
out[option] = check;
|
||||
}
|
||||
|
||||
return out;
|
||||
}();
|
||||
check_map[option] = check;
|
||||
edit_map[option] = edit;
|
||||
}
|
||||
|
||||
// Create test user
|
||||
const QString name = TEST_USER;
|
||||
@ -77,17 +73,6 @@ void ADMCTestAccountOptionEdit::test_emit_edited_signal() {
|
||||
QVERIFY(edited_signal_emitted);
|
||||
}
|
||||
|
||||
void ADMCTestAccountOptionEdit::correct_label() {
|
||||
for (int i = 0; i < AccountOption_COUNT; i++) {
|
||||
const AccountOption option = (AccountOption) i;
|
||||
QCheckBox *check = check_map[option];
|
||||
const QString expected_text = account_option_string(option);
|
||||
const QString actual_text = check->text();
|
||||
|
||||
QCOMPARE(actual_text, expected_text);
|
||||
}
|
||||
}
|
||||
|
||||
void ADMCTestAccountOptionEdit::load_data() {
|
||||
QTest::addColumn<AccountOption>("option");
|
||||
QTest::addColumn<bool>("value");
|
||||
|
@ -35,7 +35,6 @@ private slots:
|
||||
void init() override;
|
||||
|
||||
void test_emit_edited_signal();
|
||||
void correct_label();
|
||||
void load_data();
|
||||
void load();
|
||||
void apply_data();
|
||||
|
@ -33,11 +33,10 @@ void ADMCTestCountryEdit::init() {
|
||||
|
||||
country_combo_load_data();
|
||||
|
||||
edit = new CountryEdit(&edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
combo = new QComboBox(parent_widget);
|
||||
|
||||
combo = parent_widget->findChild<QComboBox *>();
|
||||
QVERIFY(combo);
|
||||
edit = new CountryEdit(combo, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
// Create test user
|
||||
const QString name = TEST_USER;
|
||||
|
@ -31,10 +31,10 @@
|
||||
void ADMCTestDateTimeEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new DateTimeEdit(ATTRIBUTE_WHEN_CHANGED, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
qedit = new QDateTimeEdit(parent_widget);
|
||||
|
||||
qedit = parent_widget->findChild<QDateTimeEdit *>();
|
||||
edit = new DateTimeEdit(qedit, ATTRIBUTE_WHEN_CHANGED, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
const QString name = TEST_USER;
|
||||
dn = test_object_dn(name, CLASS_USER);
|
||||
|
@ -26,22 +26,30 @@
|
||||
#include <QRadioButton>
|
||||
|
||||
void ADMCTestDelegationEdit::initTestCase_data() {
|
||||
QTest::addColumn<QString>("button_name");
|
||||
QTest::addColumn<bool>("use_on_button");
|
||||
QTest::addColumn<bool>("is_on");
|
||||
|
||||
QTest::newRow("on") << "on_button" << true;
|
||||
QTest::newRow("off") << "off_button" << false;
|
||||
QTest::newRow("on") << true << true;
|
||||
QTest::newRow("off") << false << false;
|
||||
}
|
||||
|
||||
void ADMCTestDelegationEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new DelegationEdit(&edits, parent_widget);
|
||||
auto on_button = new QRadioButton(parent_widget);
|
||||
auto off_button = new QRadioButton(parent_widget);
|
||||
|
||||
edit = new DelegationEdit(off_button, on_button, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
QFETCH_GLOBAL(QString, button_name);
|
||||
button = parent_widget->findChild<QRadioButton *>(button_name);
|
||||
QVERIFY(button);
|
||||
QFETCH_GLOBAL(bool, use_on_button);
|
||||
button = [&]() {
|
||||
if (use_on_button) {
|
||||
return on_button;
|
||||
} else {
|
||||
return off_button;
|
||||
}
|
||||
}();
|
||||
|
||||
const QString name = TEST_USER;
|
||||
dn = test_object_dn(name, CLASS_USER);
|
||||
|
@ -30,11 +30,10 @@
|
||||
void ADMCTestGpoptionsEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new GpoptionsEdit(&edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
check = new QCheckBox(parent_widget);
|
||||
|
||||
check = parent_widget->findChild<QCheckBox *>();
|
||||
QVERIFY(check);
|
||||
edit = new GpoptionsEdit(check, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
const QString name = TEST_OU;
|
||||
dn = test_object_dn(name, CLASS_OU);
|
||||
|
@ -27,12 +27,12 @@
|
||||
|
||||
void ADMCTestGroupScopeEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
combo = new QComboBox(parent_widget);
|
||||
|
||||
edit = new GroupScopeEdit(&edits, parent_widget);
|
||||
edit = new GroupScopeEdit(combo, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
combo = parent_widget->findChild<QComboBox *>();
|
||||
|
||||
const QString name = TEST_GROUP;
|
||||
dn = test_object_dn(name, CLASS_GROUP);
|
||||
const bool create_success = ad.object_add(dn, CLASS_GROUP);
|
||||
|
@ -28,10 +28,10 @@
|
||||
void ADMCTestGroupTypeEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new GroupTypeEdit(&edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
combo = new QComboBox(parent_widget);
|
||||
|
||||
combo = parent_widget->findChild<QComboBox *>();
|
||||
edit = new GroupTypeEdit(combo, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
const QString name = TEST_GROUP;
|
||||
dn = test_object_dn(name, CLASS_GROUP);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "admc_test_manager_edit.h"
|
||||
|
||||
#include "edits/manager_edit.h"
|
||||
#include "edits/manager_widget.h"
|
||||
#include "globals.h"
|
||||
#include "properties_dialog.h"
|
||||
|
||||
@ -30,7 +31,9 @@
|
||||
void ADMCTestManagerEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new ManagerEdit(ATTRIBUTE_MANAGER, &edits, parent_widget);
|
||||
auto manager_widget = new ManagerWidget(parent_widget);
|
||||
|
||||
edit = new ManagerEdit(manager_widget, ATTRIBUTE_MANAGER, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
manager_display = parent_widget->findChild<QLineEdit *>("manager_display");
|
||||
|
@ -32,11 +32,11 @@
|
||||
void ADMCTestPasswordEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new PasswordEdit(&edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
main_edit = new QLineEdit(parent_widget);
|
||||
confirm_edit = new QLineEdit(parent_widget);
|
||||
|
||||
main_edit = edit->get_edit();
|
||||
confirm_edit = edit->get_confirm_edit();
|
||||
edit = new PasswordEdit(main_edit, confirm_edit, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
// Create test user
|
||||
const QString name = TEST_USER;
|
||||
|
@ -34,11 +34,10 @@
|
||||
void ADMCTestProtectDeletionEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new ProtectDeletionEdit(&edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
checkbox = new QCheckBox(parent_widget);
|
||||
|
||||
checkbox = parent_widget->findChild<QCheckBox *>();
|
||||
QVERIFY(checkbox);
|
||||
edit = new ProtectDeletionEdit(checkbox, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
dn = test_object_dn(TEST_OU, CLASS_OU);
|
||||
const bool create_success = ad.object_add(dn, CLASS_OU);
|
||||
|
@ -30,11 +30,10 @@
|
||||
void ADMCTestStringEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new StringEdit(TEST_ATTRIBUTE, CLASS_USER, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
line_edit = new QLineEdit(parent_widget);
|
||||
|
||||
line_edit = parent_widget->findChild<QLineEdit *>();
|
||||
QVERIFY(line_edit);
|
||||
edit = new StringEdit(line_edit, TEST_ATTRIBUTE, CLASS_USER, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
// Create test user
|
||||
const QString name = TEST_USER;
|
||||
|
@ -30,11 +30,10 @@
|
||||
void ADMCTestStringLargeEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new StringLargeEdit(TEST_ATTRIBUTE, CLASS_USER, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
text_edit = new QPlainTextEdit(parent_widget);
|
||||
|
||||
text_edit = parent_widget->findChild<QPlainTextEdit *>();
|
||||
QVERIFY(text_edit);
|
||||
edit = new StringLargeEdit(text_edit, TEST_ATTRIBUTE, CLASS_USER, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
// Create test user
|
||||
const QString name = TEST_USER;
|
||||
|
@ -44,15 +44,12 @@ const QList<QByteArray> other_value_list = {
|
||||
void ADMCTestStringOtherEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
edit = new StringOtherEdit(TEST_ATTRIBUTE_MAIN, ATTRIBUTE_WWW_HOMEPAGE_OTHER, CLASS_USER, &edits, parent_widget);
|
||||
line_edit = new QLineEdit(parent_widget);
|
||||
other_button = new QPushButton(parent_widget);
|
||||
|
||||
edit = new StringOtherEdit(line_edit, other_button, TEST_ATTRIBUTE_MAIN, ATTRIBUTE_WWW_HOMEPAGE_OTHER, CLASS_USER, &edits, parent_widget);
|
||||
add_attribute_edit(edit);
|
||||
|
||||
line_edit = parent_widget->findChild<QLineEdit *>();
|
||||
QVERIFY(line_edit);
|
||||
|
||||
other_button = parent_widget->findChild<QPushButton *>();
|
||||
QVERIFY(other_button);
|
||||
|
||||
// Create test user
|
||||
const QString name = TEST_USER;
|
||||
dn = test_object_dn(name, CLASS_USER);
|
||||
|
@ -34,11 +34,10 @@
|
||||
void ADMCTestUnlockEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
unlock_edit = new UnlockEdit(&edits, UnlockEditStyle_CheckOnLeft, parent_widget);
|
||||
add_attribute_edit(unlock_edit);
|
||||
checkbox = new QCheckBox(parent_widget);
|
||||
|
||||
checkbox = parent_widget->findChild<QCheckBox *>();
|
||||
QVERIFY(checkbox);
|
||||
unlock_edit = new UnlockEdit(checkbox, &edits, parent_widget);
|
||||
add_attribute_edit(unlock_edit);
|
||||
|
||||
// Create test user
|
||||
const QString name = TEST_USER;
|
||||
|
@ -31,16 +31,13 @@
|
||||
void ADMCTestUpnEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
upn_edit = new UpnEdit(&edits, parent_widget);
|
||||
prefix_edit = new QLineEdit();
|
||||
suffix_edit = new QComboBox();
|
||||
|
||||
upn_edit = new UpnEdit(prefix_edit, suffix_edit, &edits, parent_widget);
|
||||
upn_edit->init_suffixes(ad);
|
||||
add_attribute_edit(upn_edit);
|
||||
|
||||
prefix_edit = parent_widget->findChild<QLineEdit *>();
|
||||
QVERIFY(prefix_edit);
|
||||
|
||||
suffix_edit = parent_widget->findChild<QComboBox *>();
|
||||
QVERIFY(suffix_edit);
|
||||
|
||||
// Create test user
|
||||
const QString name = TEST_USER;
|
||||
dn = test_object_dn(name, CLASS_USER);
|
||||
|
Loading…
x
Reference in New Issue
Block a user