Trait kconfig::kconfig::KConfigTrait
source · [−]pub trait KConfigTrait: KConfigImpl {
Show 14 methods
fn is_dirty(&self) -> bool;
fn is_config_writable(&self, warn_user: bool) -> bool;
fn open_flags(&self) -> OpenFlags;
fn reparse_configuration(&mut self);
fn set_read_defaults(&mut self, b: bool);
fn read_defaults(&self) -> bool;
fn location_type(&self) -> QStandardPathLocation;
fn set_main_config_name<T: Into<QString>>(name: T) { ... }
fn name(&self) -> QString { ... }
fn add_config_sources(&mut self, sources: QStringList) { ... }
fn additional_config_sources(&self) -> QStringList { ... }
fn locale(&self) -> QString { ... }
fn set_locale<T>(&mut self, locale: T) -> bool
where
T: Into<QString>,
{ ... }
fn check_update<T>(&mut self, id: T, update_file: T)
where
T: Into<QString>,
{ ... }
}
Expand description
Trait representing methods from KConfig
class.
Required methods
fn is_config_writable(&self, warn_user: bool) -> bool
fn is_config_writable(&self, warn_user: bool) -> bool
Whether the configuration can be written to. The most likely cause for this method returning false is that the user does not have write permission for the configuration file.
Argumenst
warn_user
- whether to show a warning message to the user if the configuration cannot be written to
fn open_flags(&self) -> OpenFlags
fn open_flags(&self) -> OpenFlags
Returns the flags this object was opened with.
fn reparse_configuration(&mut self)
fn reparse_configuration(&mut self)
Updates the state of this object to match the persistent storage.
Note that if this object has pending changes, this method will call sync()
first so as not to lose those changes.
fn set_read_defaults(&mut self, b: bool)
fn set_read_defaults(&mut self, b: bool)
When set, all readEntry calls return the system-wide (default) values instead of the user’s settings. This is off by default.
fn read_defaults(&self) -> bool
fn read_defaults(&self) -> bool
true
if the system-wide defaults will be read instead of the user’s settings
fn location_type(&self) -> QStandardPathLocation
fn location_type(&self) -> QStandardPathLocation
Returns the standard location enum passed to the constructor.
Provided methods
fn set_main_config_name<T: Into<QString>>(name: T)
fn set_main_config_name<T: Into<QString>>(name: T)
Sets the name of the application config file.
fn add_config_sources(&mut self, sources: QStringList)
fn add_config_sources(&mut self, sources: QStringList)
Adds the list of configuration sources to the merge stack.
Currently only files are accepted as configuration sources.
The first entry in sources is treated as the most general and will be overridden by the second entry.
The settings in the final entry in sources will override all the other sources provided in the list.
The state is automatically updated by this method, so there is no need to call reparse_configuration()
.
fn additional_config_sources(&self) -> QStringList
fn additional_config_sources(&self) -> QStringList
Returns a list of the additional configuration sources used in this object.
fn set_locale<T>(&mut self, locale: T) -> bool where
T: Into<QString>,
fn set_locale<T>(&mut self, locale: T) -> bool where
T: Into<QString>,
Set Locale
fn check_update<T>(&mut self, id: T, update_file: T) where
T: Into<QString>,
fn check_update<T>(&mut self, id: T, update_file: T) where
T: Into<QString>,
Ensures that the configuration file contains a certain update.
If the configuration file does not contain the update id
as contained in updateFile,
kconf_update
is run to update the configuration file.
If you install config update files with critical fixes you may wish to use this method to verify that a
critical update has indeed been performed to catch the case where a user restores an old config file from
backup that has not been updated yet.
Arguments
id
: the update to checkupdate_file
: the file containing the update