1051 |
} |
} |
1052 |
|
|
1053 |
|
|
1054 |
|
static int |
1055 |
|
km_gui_adjust_column_images (listview_ctrl_t ctx, int sortby) |
1056 |
|
{ |
1057 |
|
HWND hheader; |
1058 |
|
HDITEM hdi; |
1059 |
|
int idx, sort_desc = 0; |
1060 |
|
|
1061 |
|
hheader = ListView_GetHeader (ctx->ctrl); |
1062 |
|
if (!hheader) |
1063 |
|
return 0; |
1064 |
|
|
1065 |
|
/* Remove image from all header fields */ |
1066 |
|
memset (&hdi, 0, sizeof(hdi)); |
1067 |
|
|
1068 |
|
for (int i=0; i < 7; i++) { |
1069 |
|
hdi.mask = HDI_FORMAT; |
1070 |
|
Header_GetItem (hheader, i, &hdi); |
1071 |
|
hdi.fmt &= ~HDF_IMAGE; |
1072 |
|
Header_SetItem (hheader, i, &hdi); |
1073 |
|
} |
1074 |
|
|
1075 |
|
switch (sortby & ~KEYLIST_SORT_DESC) { |
1076 |
|
case KEY_SORT_USERID: idx = 0; break; |
1077 |
|
case KEY_SORT_KEYID: idx = 1; break; |
1078 |
|
case KEY_SORT_IS_SECRET: idx = 2; break; |
1079 |
|
case KEY_SORT_LEN: idx = 3; break; |
1080 |
|
case KEY_SORT_VALIDITY: idx = 5; break; |
1081 |
|
case KEY_SORT_OTRUST: idx = 6; break; |
1082 |
|
case KEY_SORT_CREATED: idx = 7; break; |
1083 |
|
case KEY_SORT_ALGO: idx = 8; break; |
1084 |
|
default: idx = 0; break; |
1085 |
|
} |
1086 |
|
|
1087 |
|
sort_desc = sortby & KEYLIST_SORT_DESC; |
1088 |
|
/* Set image to currently sorted field */ |
1089 |
|
memset (&hdi, 0, sizeof(hdi)); |
1090 |
|
hdi.mask = HDI_IMAGE | HDI_FORMAT; |
1091 |
|
Header_GetItem (hheader, idx, &hdi); |
1092 |
|
hdi.fmt |= HDF_IMAGE | HDF_BITMAP_ON_RIGHT; |
1093 |
|
if (!ctx->ext_chkbox) |
1094 |
|
hdi.iImage = imagelist_getindex (sort_desc? IMI_SORT_DOWNARROW : |
1095 |
|
IMI_SORT_UPARROW); |
1096 |
|
else |
1097 |
|
hdi.iImage = sort_desc? KEY_IMG_SORT_DOWN : KEY_IMG_SORT_UP; |
1098 |
|
Header_SetItem (hheader, idx, &hdi); |
1099 |
|
return 0; |
1100 |
|
} |
1101 |
|
|
1102 |
|
|
1103 |
/* Return true if the cache contain marked keys. */ |
/* Return true if the cache contain marked keys. */ |
1104 |
static bool |
static bool |
1105 |
updated_keys_avail (void) |
updated_keys_avail (void) |
1151 |
} |
} |
1152 |
} |
} |
1153 |
keylist_sort (kmi->lv, kmi->keylist_sortby); |
keylist_sort (kmi->lv, kmi->keylist_sortby); |
1154 |
|
km_gui_adjust_column_images (kmi->lv, kmi->keylist_sortby); |
1155 |
update_status_bar (kmi->statbar, kmi->lv); |
update_status_bar (kmi->statbar, kmi->lv); |
1156 |
keyring_check_last_access (); |
keyring_check_last_access (); |
1157 |
SetForegroundWindow (kmi->dlg); |
SetForegroundWindow (kmi->dlg); |
1165 |
refresh_cache_s rcs; |
refresh_cache_s rcs; |
1166 |
|
|
1167 |
memset (&rcs, 0, sizeof rcs); |
memset (&rcs, 0, sizeof rcs); |
1168 |
rcs.kr_reload = rcs.kr_update = 1; |
rcs.kring_update = 1; |
|
rcs.tr_update = 0; |
|
1169 |
DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYCACHE, dlg, |
DialogBoxParam (glob_hinst, (LPCSTR)IDD_WINPT_KEYCACHE, dlg, |
1170 |
keycache_dlg_proc, (LPARAM)&rcs); |
keycache_dlg_proc, (LPARAM)&rcs); |
1171 |
} |
} |
1390 |
update_ui_items (dlg, kmi->lv); |
update_ui_items (dlg, kmi->lv); |
1391 |
restore_column_info (kmi); |
restore_column_info (kmi); |
1392 |
keylist_sort (kmi->lv, kmi->keylist_sortby); |
keylist_sort (kmi->lv, kmi->keylist_sortby); |
1393 |
|
km_gui_adjust_column_images (kmi->lv, kmi->keylist_sortby); |
1394 |
|
|
1395 |
SendMessage (dlg, WM_SETICON, (WPARAM)ICON_SMALL, |
SendMessage (dlg, WM_SETICON, (WPARAM)ICON_SMALL, |
1396 |
(LPARAM)LoadIcon (glob_hinst, (LPCTSTR)IDI_WINPT)); |
(LPARAM)LoadIcon (glob_hinst, (LPCTSTR)IDI_WINPT)); |
1564 |
popup = GetSubMenu (hm, 0); |
popup = GetSubMenu (hm, 0); |
1565 |
translate_popupmenu_strings (popup); |
translate_popupmenu_strings (popup); |
1566 |
|
|
1567 |
if (km_check_for_seckey (kmi->lv, l_idx, &i)) |
if (km_check_for_seckey (kmi->lv, l_idx, &i) && |
1568 |
|
!(km_get_key_status (kmi->lv, l_idx) & KM_FLAG_REVOKED)) |
1569 |
set_menu_state (popup, ID_KEYCTX_SETDEFKEY, MF_ENABLED); |
set_menu_state (popup, ID_KEYCTX_SETDEFKEY, MF_ENABLED); |
1570 |
if (i == 0) |
if (i == 0) |
1571 |
set_menu_state (popup, ID_KEYCTX_MAXTRUST, MF_ENABLED); |
set_menu_state (popup, ID_KEYCTX_MAXTRUST, MF_ENABLED); |
1644 |
else |
else |
1645 |
kmi->keylist_sortby = sortby; |
kmi->keylist_sortby = sortby; |
1646 |
keylist_sort (kmi->lv, kmi->keylist_sortby); |
keylist_sort (kmi->lv, kmi->keylist_sortby); |
1647 |
|
km_gui_adjust_column_images (kmi->lv, kmi->keylist_sortby); |
1648 |
|
|
1649 |
return TRUE; |
return TRUE; |
1650 |
} |
} |
1651 |
break; |
break; |