diff options
author | fiaxh <git@lightrise.org> | 2021-01-21 15:39:36 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2021-01-21 15:51:41 +0100 |
commit | f12fc371a3bd00ac8c3183099d9d54528ef46bf0 (patch) | |
tree | 84cf27c7ed59372338bb43b45aa35027ff69ad23 /libdino | |
parent | 0d3070643884b0a8d960058d1df4d6cd07f9ec84 (diff) | |
download | dino-f12fc371a3bd00ac8c3183099d9d54528ef46bf0.tar.gz dino-f12fc371a3bd00ac8c3183099d9d54528ef46bf0.zip |
Make spell checking a setting, store language per conversation
Diffstat (limited to 'libdino')
-rw-r--r-- | libdino/src/entity/settings.vala | 13 | ||||
-rw-r--r-- | libdino/src/service/database.vala | 19 |
2 files changed, 30 insertions, 2 deletions
diff --git a/libdino/src/entity/settings.vala b/libdino/src/entity/settings.vala index 2aae6055..97ea5482 100644 --- a/libdino/src/entity/settings.vala +++ b/libdino/src/entity/settings.vala @@ -11,6 +11,7 @@ public class Settings : Object { send_marker_ = col_to_bool_or_default("send_marker", true); notifications_ = col_to_bool_or_default("notifications", true); convert_utf8_smileys_ = col_to_bool_or_default("convert_utf8_smileys", true); + check_spelling = col_to_bool_or_default("check_spelling", true); } private bool col_to_bool_or_default(string key, bool def) { @@ -65,6 +66,18 @@ public class Settings : Object { convert_utf8_smileys_ = value; } } + + private bool check_spelling_; + public bool check_spelling { + get { return check_spelling_; } + set { + db.settings.upsert() + .value(db.settings.key, "check_spelling", true) + .value(db.settings.value, value.to_string()) + .perform(); + check_spelling_ = value; + } + } } } diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index 652971a0..17499404 100644 --- a/libdino/src/service/database.vala +++ b/libdino/src/service/database.vala @@ -7,7 +7,7 @@ using Dino.Entities; namespace Dino { public class Database : Qlite.Database { - private const int VERSION = 18; + private const int VERSION = 19; public class AccountTable : Table { public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true }; @@ -254,6 +254,19 @@ public class Database : Qlite.Database { } } + public class ConversationSettingsTable : Table { + public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true }; + public Column<int> conversation_id = new Column.Integer("conversation_id") {not_null=true}; + public Column<string> key = new Column.Text("key") { not_null=true }; + public Column<string> value = new Column.Text("value"); + + internal ConversationSettingsTable(Database db) { + base(db, "conversation_settings"); + init({id, conversation_id, key, value}); + index("settings_conversationid_key", { conversation_id, key }, true); + } + } + public AccountTable account { get; private set; } public JidTable jid { get; private set; } public EntityTable entity { get; private set; } @@ -269,6 +282,7 @@ public class Database : Qlite.Database { public RosterTable roster { get; private set; } public MamCatchupTable mam_catchup { get; private set; } public SettingsTable settings { get; private set; } + public ConversationSettingsTable conversation_settings { get; private set; } public Map<int, Jid> jid_table_cache = new HashMap<int, Jid>(); public Map<Jid, int> jid_table_reverse = new HashMap<Jid, int>(Jid.hash_func, Jid.equals_func); @@ -291,7 +305,8 @@ public class Database : Qlite.Database { roster = new RosterTable(this); mam_catchup = new MamCatchupTable(this); settings = new SettingsTable(this); - init({ account, jid, entity, content_item, message, message_correction, real_jid, file_transfer, conversation, avatar, entity_identity, entity_feature, roster, mam_catchup, settings }); + conversation_settings = new ConversationSettingsTable(this); + init({ account, jid, entity, content_item, message, message_correction, real_jid, file_transfer, conversation, avatar, entity_identity, entity_feature, roster, mam_catchup, settings, conversation_settings }); try { exec("PRAGMA journal_mode = WAL"); |