mirror of
https://github.com/altlinux/admc.git
synced 2025-02-13 05:57:40 +03:00
clean up object impl
match decl and impl order remove unused f-ns inline f-ns
This commit is contained in:
parent
74f3cf2dfc
commit
7b3f8bce11
@ -22,7 +22,6 @@
|
||||
|
||||
#include "adldap.h"
|
||||
#include "change_dc_dialog.h"
|
||||
#include "console_impls/object_impl.h"
|
||||
#include "settings.h"
|
||||
#include "utils.h"
|
||||
|
||||
@ -33,14 +32,11 @@
|
||||
#include <QRadioButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
ChangeDCDialog::ChangeDCDialog(QStandardItem *domain_head_item_arg, QWidget *parent)
|
||||
ChangeDCDialog::ChangeDCDialog(QWidget *parent)
|
||||
: QDialog(parent) {
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setMinimumSize(500, 200);
|
||||
setWindowTitle(tr("Change Domain Controller"));
|
||||
|
||||
domain_head_item = domain_head_item_arg;
|
||||
|
||||
select_button = new QRadioButton(tr("Select:"));
|
||||
auto custom_button = new QRadioButton(tr("Custom:"));
|
||||
|
||||
@ -110,8 +106,6 @@ void ChangeDCDialog::accept() {
|
||||
|
||||
AdInterface::set_dc(selected_dc);
|
||||
|
||||
console_object_load_root_text(domain_head_item);
|
||||
|
||||
if (save_dc_checkbox->isChecked()) {
|
||||
settings_set_variant(SETTING_dc, selected_dc);
|
||||
}
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QStandardItem;
|
||||
class QLineEdit;
|
||||
class QListWidget;
|
||||
class QCheckBox;
|
||||
@ -37,13 +36,12 @@ class ChangeDCDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChangeDCDialog(QStandardItem *domain_head_item, QWidget *parent);
|
||||
ChangeDCDialog(QWidget *parent);
|
||||
|
||||
void accept() override;
|
||||
|
||||
private:
|
||||
QListWidget *list_widget;
|
||||
QStandardItem *domain_head_item;
|
||||
QCheckBox *save_dc_checkbox;
|
||||
QLineEdit *custom_dc_edit;
|
||||
QRadioButton *select_button;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,31 +52,6 @@ enum ObjectRole {
|
||||
ObjectRole_LAST,
|
||||
};
|
||||
|
||||
void console_object_load(const QList<QStandardItem *> row, const AdObject &object);
|
||||
void console_object_item_data_load(QStandardItem *item, const AdObject &object);
|
||||
QList<QString> object_impl_column_labels();
|
||||
QList<int> object_impl_default_columns();
|
||||
QList<QString> console_object_search_attributes();
|
||||
void console_object_create(ConsoleWidget *console, const QList<AdObject> &object_list, const QModelIndex &parent);
|
||||
void console_object_create(ConsoleWidget *console, AdInterface &ad, const QList<QString> &dn_list, const QModelIndex &parent);
|
||||
void console_object_search(ConsoleWidget *console, const QModelIndex &index, const QString &base, const SearchScope scope, const QString &filter, const QList<QString> &attributes);
|
||||
void console_object_tree_init(ConsoleWidget *console, AdInterface &ad);
|
||||
|
||||
// NOTE: this f-ns don't do anything with console. Just
|
||||
// convenience code for reuse
|
||||
QList<QString> object_operation_delete(const QList<QString> &targets, QWidget *parent);
|
||||
QList<QString> object_operation_set_disabled(const QList<QString> &targets, const bool disabled, QWidget *parent);
|
||||
void object_operation_add_to_group(const QList<QString> &targets, QWidget *parent);
|
||||
|
||||
bool console_object_is_ou(const QModelIndex &index);
|
||||
void console_object_load_root_text(QStandardItem *item);
|
||||
|
||||
// NOTE: this may return an invalid index if there's no tree
|
||||
// of objects setup
|
||||
QModelIndex get_object_tree_root(ConsoleWidget *console);
|
||||
|
||||
QString console_object_count_string(ConsoleWidget *console, const QModelIndex &index);
|
||||
|
||||
class ObjectImpl final : public ConsoleImpl {
|
||||
Q_OBJECT
|
||||
|
||||
@ -95,7 +70,6 @@ public:
|
||||
void activate(const QModelIndex &index) override;
|
||||
|
||||
QList<QAction *> get_all_custom_actions() const override;
|
||||
|
||||
QSet<QAction *> get_custom_actions(const QModelIndex &index, const bool single_selection) const override;
|
||||
QSet<QAction *> get_disabled_custom_actions(const QModelIndex &index, const bool single_selection) const override;
|
||||
|
||||
@ -113,6 +87,21 @@ public:
|
||||
QList<QString> column_labels() const override;
|
||||
QList<int> default_columns() const override;
|
||||
|
||||
private slots:
|
||||
void on_new_user();
|
||||
void on_new_computer();
|
||||
void on_new_ou();
|
||||
void on_new_group();
|
||||
void on_move();
|
||||
void on_enable();
|
||||
void on_disable();
|
||||
void on_add_to_group();
|
||||
void on_find();
|
||||
void on_reset_password();
|
||||
void on_edit_upn_suffixes();
|
||||
void on_reset_account();
|
||||
void on_change_dc();
|
||||
|
||||
private:
|
||||
PolicyImpl *policy_impl;
|
||||
|
||||
@ -133,20 +122,6 @@ private:
|
||||
bool find_action_enabled;
|
||||
bool refresh_action_enabled;
|
||||
|
||||
void on_new_user();
|
||||
void on_new_computer();
|
||||
void on_new_ou();
|
||||
void on_new_group();
|
||||
void on_move();
|
||||
void on_enable();
|
||||
void on_disable();
|
||||
void on_add_to_group();
|
||||
void on_find();
|
||||
void on_reset_password();
|
||||
void on_edit_upn_suffixes();
|
||||
void on_reset_account();
|
||||
void on_change_dc();
|
||||
|
||||
void new_object(const QString &object_class);
|
||||
void set_disabled(const bool disabled);
|
||||
void drop_objects(const QList<QPersistentModelIndex> &dropped_list, const QPersistentModelIndex &target);
|
||||
@ -155,4 +130,19 @@ private:
|
||||
void move(AdInterface &ad, const QList<QString> &old_dn_list, const QString &new_parent_dn);
|
||||
};
|
||||
|
||||
void object_impl_add_objects_to_console(ConsoleWidget *console, const QList<AdObject> &object_list, const QModelIndex &parent);
|
||||
void object_impl_add_objects_to_console_from_dns(ConsoleWidget *console, AdInterface &ad, const QList<QString> &dn_list, const QModelIndex &parent);
|
||||
void console_object_load(const QList<QStandardItem *> row, const AdObject &object);
|
||||
void console_object_item_data_load(QStandardItem *item, const AdObject &object);
|
||||
QList<QString> object_impl_column_labels();
|
||||
QList<int> object_impl_default_columns();
|
||||
QList<QString> console_object_search_attributes();
|
||||
void console_object_search(ConsoleWidget *console, const QModelIndex &index, const QString &base, const SearchScope scope, const QString &filter, const QList<QString> &attributes);
|
||||
void console_object_tree_init(ConsoleWidget *console, AdInterface &ad);
|
||||
bool console_object_is_ou(const QModelIndex &index);
|
||||
// NOTE: this may return an invalid index if there's no tree
|
||||
// of objects setup
|
||||
QModelIndex get_object_tree_root(ConsoleWidget *console);
|
||||
QString console_object_count_string(ConsoleWidget *console, const QModelIndex &index);
|
||||
|
||||
#endif /* OBJECT_IMPL_H */
|
||||
|
@ -198,35 +198,6 @@ void ADMCTestObjectMenu::object_menu_move() {
|
||||
QVERIFY(true);
|
||||
}
|
||||
|
||||
void ADMCTestObjectMenu::object_menu_able_account_data() {
|
||||
QTest::addColumn<bool>("final_state");
|
||||
QTest::addColumn<QDate>("date");
|
||||
QTest::addColumn<QString>("value");
|
||||
|
||||
QTest::newRow("enable") << true << QDate(2011, 11, 11) << "129655295400000000";
|
||||
QTest::newRow("disable") << false << QDate() << AD_LARGE_INTEGER_DATETIME_NEVER_2;
|
||||
;
|
||||
}
|
||||
|
||||
void ADMCTestObjectMenu::object_menu_able_account() {
|
||||
QFETCH(bool, final_state);
|
||||
|
||||
const QString dn = test_object_dn(TEST_USER, CLASS_USER);
|
||||
|
||||
ad.object_add(dn, CLASS_USER);
|
||||
|
||||
// Setup initial disabled state
|
||||
ad.user_set_account_option(dn, AccountOption_Disabled, !final_state);
|
||||
|
||||
// Modify state using object menu
|
||||
object_operation_set_disabled({dn}, final_state, parent_widget);
|
||||
|
||||
// Check that final disabled state has changed
|
||||
const AdObject update_object = ad.search_object(dn);
|
||||
const bool current_state = update_object.get_account_option(AccountOption_Disabled, ad.adconfig());
|
||||
QCOMPARE(current_state, final_state);
|
||||
}
|
||||
|
||||
void ADMCTestObjectMenu::object_menu_find_simple() {
|
||||
const QString parent = test_arena_dn();
|
||||
|
||||
|
@ -35,9 +35,6 @@ private slots:
|
||||
void object_menu_move();
|
||||
void object_menu_rename();
|
||||
|
||||
void object_menu_able_account_data();
|
||||
void object_menu_able_account();
|
||||
|
||||
void object_menu_find_simple();
|
||||
void object_menu_find_advanced();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user