Set data2 in ConfigureProgress event

For now it is only set on error, but could contain user-readable log
messages in the future.
This commit is contained in:
Alexander Krotov
2020-09-12 16:23:12 +03:00
committed by link2xt
parent cdba74a027
commit f5b16cf086
6 changed files with 45 additions and 17 deletions

View File

@@ -27,12 +27,18 @@ use auto_outlook::outlk_autodiscover;
use server_params::{expand_param_vector, ServerParams};
macro_rules! progress {
($context:tt, $progress:expr) => {
($context:tt, $progress:expr, $comment:expr) => {
assert!(
$progress <= 1000,
"value in range 0..1000 expected with: 0=error, 1..999=progress, 1000=success"
);
$context.emit_event($crate::events::EventType::ConfigureProgress($progress));
$context.emit_event($crate::events::EventType::ConfigureProgress {
progress: $progress,
comment: $comment,
});
};
($context:tt, $progress:expr) => {
progress!($context, $progress, None);
};
}
@@ -111,7 +117,7 @@ impl Context {
Ok(())
}
Err(err) => {
progress!(self, 0);
progress!(self, 0, Some(err.to_string()));
Err(err)
}
}

View File

@@ -233,10 +233,16 @@ pub enum EventType {
LocationChanged(Option<u32>),
/// Inform about the configuration progress started by configure().
///
/// @param data1 (usize) 0=error, 1-999=progress in permille, 1000=success and done
#[strum(props(id = "2041"))]
ConfigureProgress(usize),
ConfigureProgress {
/// Progress.
///
/// 0=error, 1-999=progress in permille, 1000=success and done
progress: usize,
/// Progress comment or error, something to display to the user.
comment: Option<String>,
},
/// Inform about the import/export progress started by imex().
///