convert the searched string to lowercase

fixes #204
This commit is contained in:
Bilal Elmoussaoui 2020-12-16 00:17:00 +01:00
parent 98b16a8e6f
commit 6dfae8e89a
2 changed files with 6 additions and 2 deletions

View file

@ -17,6 +17,7 @@ use qrcode::QrCode;
use ring::hmac;
use std::cell::{Cell, RefCell};
use std::time::{SystemTime, UNIX_EPOCH};
use unicase::UniCase;
#[derive(Insertable)]
#[table_name = "accounts"]
@ -242,7 +243,7 @@ impl Account {
let account1 = obj1.downcast_ref::<Account>().unwrap();
let account2 = obj2.downcast_ref::<Account>().unwrap();
account1.name().cmp(&account2.name())
UniCase::new(account1.name()).cmp(&UniCase::new(account2.name()))
}
pub fn new(id: i32, name: &str, token_id: &str, counter: i32, provider: Provider) -> Account {

View file

@ -486,7 +486,10 @@ impl Provider {
let self_ = imp::Provider::from_instance(self);
let filter = gtk::CustomFilter::new(Some(Box::new(move |obj| {
let account = obj.downcast_ref::<Account>().unwrap();
account.name().contains(&text)
account
.name()
.to_ascii_lowercase()
.contains(&text.to_ascii_lowercase())
})));
self_.filter_model.set_filter(Some(&filter));
}