Add settings reset defaults
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
use std::{collections::BTreeMap, time::SystemTime};
|
||||
|
||||
use ely_domain::{
|
||||
ArchivePolicy, ArchivedTab, BookmarkEntry, BrowserTab, DomainError, DownloadEntry,
|
||||
DownloadPolicy, FavoriteLimit, HistoryEntry, HistoryRecordingPolicy, NewTabDestination,
|
||||
NoteEntry, Profile, ProfileId, ProfileKind, ReadingListEntry, SearchEngine,
|
||||
ArchivePolicy, ArchivedTab, BookmarkEntry, BrowserTab, DEFAULT_SIDEBAR_WIDTH_PX, DomainError,
|
||||
DownloadEntry, DownloadPolicy, FavoriteLimit, HistoryEntry, HistoryRecordingPolicy,
|
||||
NewTabDestination, NoteEntry, Profile, ProfileId, ProfileKind, ReadingListEntry, SearchEngine,
|
||||
SitePermissionAuditEvent, SitePermissionEntry, Space, SpaceId, SplitLayout, SyncStatus,
|
||||
TabGroup, TabId, UrlText,
|
||||
};
|
||||
@@ -292,6 +292,10 @@ impl BrowserCore {
|
||||
self.search_engine = search_engine;
|
||||
}
|
||||
|
||||
pub fn reset_search_settings(&mut self) {
|
||||
self.set_search_engine(SearchEngine::default());
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn search_engine(&self) -> SearchEngine {
|
||||
self.search_engine
|
||||
@@ -301,6 +305,10 @@ impl BrowserCore {
|
||||
self.new_tab_destination = destination;
|
||||
}
|
||||
|
||||
pub fn reset_general_settings(&mut self) {
|
||||
self.set_new_tab_destination(NewTabDestination::default());
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn new_tab_destination(&self) -> NewTabDestination {
|
||||
self.new_tab_destination
|
||||
@@ -310,6 +318,10 @@ impl BrowserCore {
|
||||
self.history_recording_policy = policy;
|
||||
}
|
||||
|
||||
pub fn reset_privacy_settings(&mut self) {
|
||||
self.set_history_recording_policy(HistoryRecordingPolicy::default());
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn history_recording_policy(&self) -> HistoryRecordingPolicy {
|
||||
self.history_recording_policy
|
||||
@@ -319,6 +331,14 @@ impl BrowserCore {
|
||||
self.favorite_limit = favorite_limit;
|
||||
}
|
||||
|
||||
pub fn reset_sidebar_tabs_settings(&mut self) -> Result<(), CoreError> {
|
||||
let active_space_id = self.active_space_id.clone();
|
||||
self.set_space_archive_policy(&active_space_id, ArchivePolicy::Manual)?;
|
||||
self.set_space_sidebar_width(&active_space_id, DEFAULT_SIDEBAR_WIDTH_PX)?;
|
||||
self.set_favorite_limit(FavoriteLimit::default());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn favorite_limit(&self) -> FavoriteLimit {
|
||||
self.favorite_limit
|
||||
|
||||
@@ -90,6 +90,10 @@ impl BrowserCore {
|
||||
self.set_profile_download_policy(&profile_id, download_policy)
|
||||
}
|
||||
|
||||
pub fn reset_active_profile_download_settings(&mut self) -> Result<(), CoreError> {
|
||||
self.set_active_profile_download_policy(DownloadPolicy::ask_every_time())
|
||||
}
|
||||
|
||||
pub fn set_profile_sync_policy(
|
||||
&mut self,
|
||||
profile_id: &ProfileId,
|
||||
@@ -108,6 +112,12 @@ impl BrowserCore {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn reset_profile_sync_settings(&mut self) {
|
||||
for profile in &mut self.profiles {
|
||||
profile.set_sync_policy(ProfileSyncPolicy::default());
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn cleanup_private_profile_session_data(&mut self, profile_id: &ProfileId) {
|
||||
if self
|
||||
.profiles
|
||||
|
||||
@@ -66,6 +66,10 @@ impl BrowserCore {
|
||||
self.sync_object_policies.set(kind, policy);
|
||||
}
|
||||
|
||||
pub fn reset_sync_settings(&mut self) {
|
||||
self.sync_object_policies = SyncObjectPolicies::default();
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn sync_object_policy(&self, kind: SyncObjectKind) -> SyncObjectPolicy {
|
||||
self.sync_object_policies.get(kind)
|
||||
|
||||
Reference in New Issue
Block a user