Use correct default values for missing keys

This commit is contained in:
Damien Elmes 2023-04-26 19:11:48 +10:00
parent e6f970e969
commit d88be5b856
2 changed files with 6 additions and 4 deletions

View file

@ -406,7 +406,9 @@ class Browser(QMainWindow):
self.form.searchEdit.lineEdit().setPlaceholderText(
tr.browsing_search_bar_hint()
)
self.form.searchEdit.addItems([""] + self.mw.pm.profile.get("searchHistory"))
self.form.searchEdit.addItems(
[""] + self.mw.pm.profile.get("searchHistory", [])
)
if search is not None:
self.search_for_terms(*search)
else:
@ -451,7 +453,7 @@ class Browser(QMainWindow):
showWarning(str(err))
def update_history(self) -> None:
sh = self.mw.pm.profile.get("searchHistory")
sh = self.mw.pm.profile.get("searchHistory", [])
if self._lastSearchTxt in sh:
sh.remove(self._lastSearchTxt)
sh.insert(0, self._lastSearchTxt)

View file

@ -632,10 +632,10 @@ create table if not exists profiles
self.profile["hostNum"] = val or 0
def media_syncing_enabled(self) -> bool:
return self.profile.get("syncMedia")
return self.profile.get("syncMedia", True)
def auto_syncing_enabled(self) -> bool:
return self.profile.get("autoSync")
return self.profile.get("autoSync", True)
def sync_auth(self) -> SyncAuth | None:
if not (hkey := self.profile.get("syncKey")):