1
0
mirror of https://github.com/altlinux/admc.git synced 2025-02-15 13:57:29 +03:00

rename FindImpl to FindObjectImpl

This commit is contained in:
Dmitry Degtyarev 2022-07-06 14:08:54 +04:00
parent fb5619d53e
commit 8cc6ea6399
6 changed files with 32 additions and 32 deletions

View File

@ -178,7 +178,7 @@ set(ADMC_SOURCES
console_impls/query_item_impl.cpp console_impls/query_item_impl.cpp
console_impls/query_folder_impl.cpp console_impls/query_folder_impl.cpp
console_impls/policy_root_impl.cpp console_impls/policy_root_impl.cpp
console_impls/find_root_impl.cpp console_impls/find_object_impl.cpp
console_impls/find_policy_impl.cpp console_impls/find_policy_impl.cpp
console_impls/all_policies_folder_impl.cpp console_impls/all_policies_folder_impl.cpp
console_impls/policy_ou_impl.cpp console_impls/policy_ou_impl.cpp

View File

@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "console_impls/find_root_impl.h" #include "console_impls/find_object_impl.h"
#include "adldap.h" #include "adldap.h"
#include "console_impls/object_impl.h" #include "console_impls/object_impl.h"
@ -28,27 +28,27 @@
#include <QStandardItem> #include <QStandardItem>
#include <QModelIndex> #include <QModelIndex>
FindRootImpl::FindRootImpl(ConsoleWidget *console_arg) FindObjectImpl::FindObjectImpl(ConsoleWidget *console_arg)
: ConsoleImpl(console_arg) { : ConsoleImpl(console_arg) {
set_results_view(new ResultsView(console_arg)); set_results_view(new ResultsView(console_arg));
} }
QString FindRootImpl::get_description(const QModelIndex &index) const { QString FindObjectImpl::get_description(const QModelIndex &index) const {
const QString object_count_text = console_object_count_string(console, index); const QString object_count_text = console_object_count_string(console, index);
return object_count_text; return object_count_text;
} }
QList<QString> FindRootImpl::column_labels() const { QList<QString> FindObjectImpl::column_labels() const {
return object_impl_column_labels(); return object_impl_column_labels();
} }
QList<int> FindRootImpl::default_columns() const { QList<int> FindObjectImpl::default_columns() const {
return object_impl_default_columns(); return object_impl_default_columns();
} }
QModelIndex get_find_tree_root(ConsoleWidget *console) { QModelIndex get_find_object_root(ConsoleWidget *console) {
const QModelIndex out = console->search_item(QModelIndex(), {ItemType_FindRoot}); const QModelIndex out = console->search_item(QModelIndex(), {ItemType_FindObject});
return out; return out;
} }

View File

@ -18,21 +18,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef FIND_ROOT_IMPL_H #ifndef FIND_OBJECT_IMPL_H
#define FIND_ROOT_IMPL_H #define FIND_OBJECT_IMPL_H
/** /**
* Impl for root of the find tree which displays results of * Impl for root of the find object tree which displays
* a "Find" operation. Used in Find Widget. * results of a "Find" operation. Used in Find Widget.
*/ */
#include "console_widget/console_impl.h" #include "console_widget/console_impl.h"
class FindRootImpl final : public ConsoleImpl { class FindObjectImpl final : public ConsoleImpl {
Q_OBJECT Q_OBJECT
public: public:
FindRootImpl(ConsoleWidget *console_arg); FindObjectImpl(ConsoleWidget *console_arg);
QString get_description(const QModelIndex &index) const override; QString get_description(const QModelIndex &index) const override;
@ -40,6 +40,6 @@ public:
QList<int> default_columns() const override; QList<int> default_columns() const override;
}; };
QModelIndex get_find_tree_root(ConsoleWidget *console); QModelIndex get_find_object_root(ConsoleWidget *console);
#endif /* FIND_ROOT_IMPL_H */ #endif /* FIND_OBJECT_IMPL_H */

View File

@ -30,7 +30,7 @@ enum ItemType {
ItemType_Policy, ItemType_Policy,
ItemType_QueryFolder, ItemType_QueryFolder,
ItemType_QueryItem, ItemType_QueryItem,
ItemType_FindRoot, ItemType_FindObject,
ItemType_FindPolicy, ItemType_FindPolicy,
ItemType_FoundPolicy, ItemType_FoundPolicy,

View File

@ -24,7 +24,7 @@
#include "console_impls/item_type.h" #include "console_impls/item_type.h"
#include "console_impls/query_folder_impl.h" #include "console_impls/query_folder_impl.h"
#include "console_impls/query_item_impl.h" #include "console_impls/query_item_impl.h"
#include "console_impls/find_root_impl.h" #include "console_impls/find_object_impl.h"
#include "console_impls/policy_root_impl.h" #include "console_impls/policy_root_impl.h"
#include "console_impls/policy_ou_impl.h" #include "console_impls/policy_ou_impl.h"
#include "console_widget/results_view.h" #include "console_widget/results_view.h"
@ -595,11 +595,11 @@ void console_object_properties(ConsoleWidget *console, ConsoleWidget *buddy_cons
const QModelIndex object_root = get_object_tree_root(target_console); const QModelIndex object_root = get_object_tree_root(target_console);
const QModelIndex query_root = get_query_tree_root(target_console); const QModelIndex query_root = get_query_tree_root(target_console);
const QModelIndex policy_root = get_policy_tree_root(target_console); const QModelIndex policy_root = get_policy_tree_root(target_console);
const QModelIndex find_root = get_find_tree_root(target_console); const QModelIndex find_object_root = get_find_object_root(target_console);
apply_changes_to_branch(object_root, ItemType_Object, ObjectRole_DN); apply_changes_to_branch(object_root, ItemType_Object, ObjectRole_DN);
apply_changes_to_branch(query_root, ItemType_Object, ObjectRole_DN); apply_changes_to_branch(query_root, ItemType_Object, ObjectRole_DN);
apply_changes_to_branch(find_root, ItemType_Object, ObjectRole_DN); apply_changes_to_branch(find_object_root, ItemType_Object, ObjectRole_DN);
// Apply to policy branch // Apply to policy branch
if (policy_root.isValid()) { if (policy_root.isValid()) {
@ -694,7 +694,7 @@ void console_object_delete(ConsoleWidget *console, ConsoleWidget *buddy_console,
const QList<QModelIndex> root_list = { const QList<QModelIndex> root_list = {
get_object_tree_root(target_console), get_object_tree_root(target_console),
get_query_tree_root(target_console), get_query_tree_root(target_console),
get_find_tree_root(target_console), get_find_object_root(target_console),
}; };
for (const QModelIndex &root : root_list) { for (const QModelIndex &root : root_list) {
@ -1136,11 +1136,11 @@ void ObjectImpl::set_disabled(const bool disabled) {
}; };
const QModelIndex object_root = get_object_tree_root(target_console); const QModelIndex object_root = get_object_tree_root(target_console);
const QModelIndex find_root = get_find_tree_root(target_console); const QModelIndex find_object_root = get_find_object_root(target_console);
const QModelIndex query_root = get_query_tree_root(target_console); const QModelIndex query_root = get_query_tree_root(target_console);
apply_changes_to_branch(object_root); apply_changes_to_branch(object_root);
apply_changes_to_branch(find_root); apply_changes_to_branch(find_object_root);
apply_changes_to_branch(query_root); apply_changes_to_branch(query_root);
}; };
@ -1275,15 +1275,15 @@ void console_object_move_and_rename(ConsoleWidget *console, ConsoleWidget *buddy
// TODO: decrease code duplication // TODO: decrease code duplication
// For find tree, we only reload the rows to // For find tree, we only reload the rows to
// update name, and attributes (DN for example) // update name, and attributes (DN for example)
const QModelIndex find_root = get_query_tree_root(target_console); const QModelIndex find_object_root = get_query_tree_root(target_console);
if (find_root.isValid()) { if (find_object_root.isValid()) {
// Find indexes of modified objects in find // Find indexes of modified objects in find
// tree // tree
const QHash<QString, QModelIndex> index_map = [&]() { const QHash<QString, QModelIndex> index_map = [&]() {
QHash<QString, QModelIndex> out; QHash<QString, QModelIndex> out;
for (const QString &old_dn : old_dn_list) { for (const QString &old_dn : old_dn_list) {
const QList<QModelIndex> results = target_console->search_items(find_root, ObjectRole_DN, old_dn, {ItemType_Object}); const QList<QModelIndex> results = target_console->search_items(find_object_root, ObjectRole_DN, old_dn, {ItemType_Object});
for (const QModelIndex &index : results) { for (const QModelIndex &index : results) {
out[old_dn] = index; out[old_dn] = index;

View File

@ -24,7 +24,7 @@
#include "adldap.h" #include "adldap.h"
#include "console_impls/item_type.h" #include "console_impls/item_type.h"
#include "console_impls/object_impl.h" #include "console_impls/object_impl.h"
#include "console_impls/find_root_impl.h" #include "console_impls/find_object_impl.h"
#include "console_widget/results_view.h" #include "console_widget/results_view.h"
#include "search_thread.h" #include "search_thread.h"
#include "settings.h" #include "settings.h"
@ -77,13 +77,13 @@ FindWidget::FindWidget(QWidget *parent)
object_impl->set_find_action_enabled(false); object_impl->set_find_action_enabled(false);
object_impl->set_refresh_action_enabled(false); object_impl->set_refresh_action_enabled(false);
auto find_root_impl = new FindRootImpl(ui->console); auto find_object_impl = new FindObjectImpl(ui->console);
ui->console->register_impl(ItemType_FindRoot, find_root_impl); ui->console->register_impl(ItemType_FindObject, find_object_impl);
ResultsView *find_root_view = find_root_impl->view(); ResultsView *find_object_view = find_object_impl->view();
find_root_view->set_drag_drop_enabled(false); find_object_view->set_drag_drop_enabled(false);
const QList<QStandardItem *> row = ui->console->add_scope_item(ItemType_FindRoot, QModelIndex()); const QList<QStandardItem *> row = ui->console->add_scope_item(ItemType_FindObject, QModelIndex());
head_item = row[0]; head_item = row[0];
head_item->setText(tr("Find results")); head_item->setText(tr("Find results"));