diff options
author | George Hazan <ghazan@miranda.im> | 2021-02-13 15:18:28 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-02-13 15:18:28 +0300 |
commit | cadbeb897f40973ff85b9413a313b996b1921f98 (patch) | |
tree | b34d8ffa188e9d161655f81cffb0229afce561f3 /plugins/New_GPG/src | |
parent | fcbfc265c3631cbf5acba9552a23968d1ee4edd6 (diff) |
fixes #2727 (New_GPG: columns' autosize fails for empty lists)
Diffstat (limited to 'plugins/New_GPG/src')
-rwxr-xr-x | plugins/New_GPG/src/options.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 5fe3bd646d..d280e4e9e9 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -34,6 +34,8 @@ public: list_EXISTING_KEY_LIST(this, IDC_EXISTING_KEY_LIST) { id[0] = 0; + + list_EXISTING_KEY_LIST.OnClick = Callback(this, &CDlgLoadExistingKey::onChange_EXISTING_KEY_LIST); } bool OnInitDialog() override @@ -47,7 +49,6 @@ public: list_EXISTING_KEY_LIST.AddColumn(4, TranslateT("Expiration date"), 30); list_EXISTING_KEY_LIST.AddColumn(5, TranslateT("Key length"), 30); list_EXISTING_KEY_LIST.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_SINGLEROW); - int i = 1; // parse gpg output gpg_execution_params params; @@ -58,6 +59,7 @@ public: if (params.result == pxNotFound) return false; + int i = 1; string out(params.out); string::size_type p = 0, p2 = 0, stop = 0; while (p != string::npos) { @@ -108,17 +110,17 @@ public: p = out.find_first_not_of(" ", p); list_EXISTING_KEY_LIST.SetItemText(row, 2, toUTF16(out.substr(p, p2 - p)).c_str()); + i++; + } - list_EXISTING_KEY_LIST.SetColumnWidth(0, LVSCW_AUTOSIZE);// not sure about this + if (list_EXISTING_KEY_LIST.GetItemCount()) { + list_EXISTING_KEY_LIST.SetColumnWidth(0, LVSCW_AUTOSIZE); list_EXISTING_KEY_LIST.SetColumnWidth(1, LVSCW_AUTOSIZE); list_EXISTING_KEY_LIST.SetColumnWidth(2, LVSCW_AUTOSIZE); list_EXISTING_KEY_LIST.SetColumnWidth(3, LVSCW_AUTOSIZE); list_EXISTING_KEY_LIST.SetColumnWidth(4, LVSCW_AUTOSIZE); list_EXISTING_KEY_LIST.SetColumnWidth(5, LVSCW_AUTOSIZE); - i++; } - - list_EXISTING_KEY_LIST.OnClick = Callback(this, &CDlgLoadExistingKey::onChange_EXISTING_KEY_LIST); return true; } @@ -517,6 +519,9 @@ public: void SetListAutoSize() { + if (list_USERLIST.GetItemCount() == 0) + return; + list_USERLIST.SetColumnWidth(0, LVSCW_AUTOSIZE); list_USERLIST.SetColumnWidth(1, LVSCW_AUTOSIZE); list_USERLIST.SetColumnWidth(2, LVSCW_AUTOSIZE); |