Struct KDialog

Source
pub struct KDialog { /* private fields */ }
Expand description

The kdialog backend.

This backend uses the external kdialog program to display KDE dialog boxes.

Implementations§

Source§

impl KDialog

Source

pub fn new() -> KDialog

Creates a new KDialog instance without configuration.

Examples found in repository?
examples/backend-kdialog.rs (line 8)
7fn main() -> dialog::Result<()> {
8    let mut backend = backends::KDialog::new();
9
10    dialog::Message::new("This is a message.")
11        .title("And this is a title:")
12        .show_with(&backend)?;
13
14    backend.set_icon("error");
15    dialog::Message::new("This is an error message.")
16        .title("Error")
17        .show_with(&backend)
18}
Source

pub fn set_icon(&mut self, icon: impl Into<String>)

Sets the icon in the dialog box’s titlebar and taskbar button.

The icon can be either a name from the user’s configured icon theme, such as error or info or the path to an image to use.

The default image depends on the dialog type.

Examples found in repository?
examples/backend-kdialog.rs (line 14)
7fn main() -> dialog::Result<()> {
8    let mut backend = backends::KDialog::new();
9
10    dialog::Message::new("This is a message.")
11        .title("And this is a title:")
12        .show_with(&backend)?;
13
14    backend.set_icon("error");
15    dialog::Message::new("This is an error message.")
16        .title("Error")
17        .show_with(&backend)
18}

Trait Implementations§

Source§

impl AsRef<KDialog> for KDialog

Source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Backend for KDialog

Source§

fn show_input(&self, input: &Input) -> Result<Option<String>>

Shows the given input dialog and returns the input.
Source§

fn show_message(&self, message: &Message) -> Result<()>

Shows the given message dialog.
Source§

fn show_password(&self, password: &Password) -> Result<Option<String>>

Shows the given password dialog and returns the password.
Source§

fn show_question(&self, question: &Question) -> Result<Choice>

Shows the given question dialog and returns the choice.
Source§

fn show_file_selection( &self, file_selection: &FileSelection, ) -> Result<Option<String>>

Shows the given file selection dialog and returns the file name.
Source§

impl Debug for KDialog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for KDialog

Source§

fn default() -> KDialog

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.