summaryrefslogtreecommitdiff
path: root/src/ui/ui_contacts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/ui_contacts.cpp')
-rw-r--r--src/ui/ui_contacts.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/ui_contacts.cpp b/src/ui/ui_contacts.cpp
index 30d01de..cc5a7e0 100644
--- a/src/ui/ui_contacts.cpp
+++ b/src/ui/ui_contacts.cpp
@@ -104,9 +104,14 @@ void draw_contact_form(contact* buffer, bool viewing_only = false)
static void draw_contact_list()
{
+ static char search_buffer[MAX_LEN_LONG_DESC];
+
+ contact_filter filter;
+ strops::copy(filter.name_filter, search_buffer, MAX_LEN_LONG_DESC);
+
const u32 items_per_page = 50;
static s32 current_page = 0;
- s32 max_page = (administration::contact_count() + items_per_page - 1) / items_per_page;
+ s32 max_page = (administration::contact_count(&filter) + items_per_page - 1) / items_per_page;
if (max_page == 0) max_page = 1;
// Table header controls: create button and pagination.
@@ -136,6 +141,12 @@ static void draw_contact_list()
if (ImGui::Button(locale::get("ui.next")) && current_page < max_page-1) current_page++;
if (!enable_next) ImGui::EndDisabled();
+ // Filters
+ ImGui::SameLine();
+ ImGui::PushItemWidth(200.0f);
+ ImGui::InputTextWithHint("##searchFilter", locale::get("contact.table.filter.search"), search_buffer, MAX_LEN_LONG_DESC);
+ ImGui::PopItemWidth();
+
ImGui::Spacing();
if (ImGui::BeginTable("TableContacts", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg)) {
@@ -147,7 +158,7 @@ static void draw_contact_list()
ImGui::TableHeadersRow();
contact contact_list[items_per_page];
- u32 contact_count = administration::contact_get_partial_list(current_page, items_per_page, contact_list);
+ u32 contact_count = administration::contact_get_partial_list(current_page, items_per_page, contact_list, &filter);
for (u32 i = 0; i < contact_count; i++) {
contact c = contact_list[i];