1
0
mirror of https://github.com/altlinux/admc.git synced 2025-01-20 10:04:05 +03:00

Add disabled computer icon

Add disabled computer icon, bug №47551 fixed
This commit is contained in:
Semyon Knyazev 2023-11-14 22:22:04 +04:00
parent 4b6eed9ca3
commit b1de04f01a
4 changed files with 21 additions and 1 deletions

View File

@ -238,6 +238,7 @@ enum SystemFlagsBit {
#define OBJECT_CATEGORY_PERSON "Person"
#define OBJECT_CATEGORY_GROUP "Group"
#define OBJECT_CATEGORY_OU "Organizational-Unit"
#define OBJECT_CATEGORY_COMPUTER "Computer"
#define LOCKOUT_UNLOCKED_VALUE "0"

View File

@ -1198,8 +1198,16 @@ void ObjectImpl::set_disabled(const bool disabled) {
for (const QModelIndex &index : index_list) {
QStandardItem *item = target_console->get_item(index);
item->setData(disabled, ObjectRole_AccountDisabled);
const QIcon icon = disabled ? g_icon_manager->get_icon_for_type(ItemIconType_Person_Blocked) :
const QString category= dn_get_name(item->data(ObjectRole_ObjectCategory).toString());
QIcon icon;
if (category == OBJECT_CATEGORY_PERSON) {
icon = disabled ? g_icon_manager->get_icon_for_type(ItemIconType_Person_Blocked) :
g_icon_manager->get_icon_for_type(ItemIconType_Person_Clean);
}
else if (category == OBJECT_CATEGORY_COMPUTER) {
icon = disabled ? g_icon_manager->get_icon_for_type(ItemIconType_Computer_Blocked) :
g_icon_manager->get_icon_for_type(ItemIconType_Computer_Clean);
}
item->setIcon(icon);
}
}
@ -1858,6 +1866,12 @@ void console_object_item_load_icon(QStandardItem *item, bool disabled) {
item->setIcon(icon);
return;
}
else if (category == OBJECT_CATEGORY_COMPUTER) {
icon = disabled ? g_icon_manager->get_icon_for_type(ItemIconType_Computer_Blocked) :
g_icon_manager->get_icon_for_type(ItemIconType_Computer_Clean);
item->setIcon(icon);
return;
}
icon = g_icon_manager->get_object_icon(category);
item->setIcon(icon);
}

View File

@ -55,6 +55,9 @@ void IconManager::init()
type_index_icons_array[ItemIconType_Person_Blocked] = overlay_scope_item_icon(type_index_icons_array[ItemIconType_Person_Clean],
QIcon::fromTheme("dialog-error"), QSize(8, 8), QPoint(8, 8));
type_index_icons_array[ItemIconType_Site_Clean] = QIcon::fromTheme("go-home");
type_index_icons_array[ItemIconType_Computer_Clean] = get_object_icon("Computer");
type_index_icons_array[ItemIconType_Computer_Blocked] = overlay_scope_item_icon(type_index_icons_array[ItemIconType_Computer_Clean],
QIcon::fromTheme("dialog-error"), QSize(8, 8), QPoint(8, 8));
}
QIcon IconManager::overlay_scope_item_icon(const QIcon &clean_icon, const QIcon &overlay_icon, IconOverlayPosition position) const

View File

@ -23,6 +23,8 @@ enum ItemIconType {
// ItemIconType_Container_Clean,
// ItemIconType_Configuration,
// ItemIconType_Settings,
ItemIconType_Computer_Clean,
ItemIconType_Computer_Blocked,
ItemIconType_LAST
};