1
0

feat: add shell verb struct

This commit is contained in:
2026-04-30 13:09:59 +08:00
parent 1df7191a36
commit e6ac59d85c

View File

@@ -85,7 +85,7 @@ impl TryFrom<View> for Scope {
// endregion // endregion
// region: Losse and Variant Structs // region: Exposed Structs (Losse, Variant and others)
// region: Losse ProgId // region: Losse ProgId
@@ -132,7 +132,7 @@ impl From<concept::ProgId> for LosseProgId {
// region: Icon Resource Variant // region: Icon Resource Variant
/// The enum representing a losse Icon Reference String. /// The enum representing a losse Icon Reference String.
/// ///
/// In real usage, programmer can use Icon Reference String, /// In real usage, programmer can use Icon Reference String,
/// or a plain string pointing to a icon file as the icon setting value. /// or a plain string pointing to a icon file as the icon setting value.
/// This enum is designed for handling this scenario. /// This enum is designed for handling this scenario.
@@ -184,7 +184,7 @@ impl From<concept::IconRefStr> for IconResVariant {
// region: String Resource Variant // region: String Resource Variant
/// The enum representing a losse String Reference String. /// The enum representing a losse String Reference String.
/// ///
/// In real usage, programmer can use String Reference String, /// In real usage, programmer can use String Reference String,
/// or a plain string as the string setting value. /// or a plain string as the string setting value.
/// This enum is designed for handling this scenario. /// This enum is designed for handling this scenario.
@@ -203,7 +203,7 @@ impl StrResVariant {
StrResVariant::RefStr(v) => { StrResVariant::RefStr(v) => {
let rc = concept::StrRc::new(v.get_path(), v.get_index())?; let rc = concept::StrRc::new(v.get_path(), v.get_index())?;
rc.into_string() rc.into_string()
}, }
}; };
Ok(rv) Ok(rv)
} }
@@ -238,6 +238,31 @@ impl From<concept::StrRefStr> for StrResVariant {
// endregion // endregion
// region: Shell Verb
/// The struct representing a shell verb pair.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ShellVerb {
verb: concept::Verb,
command: concept::CmdLine,
}
impl ShellVerb {
pub fn new(verb: concept::Verb, command: concept::CmdLine) -> Self {
Self { verb, command }
}
pub fn get_verb(&self) -> &concept::Verb {
&self.verb
}
pub fn get_command(&self) -> &concept::CmdLine {
&self.command
}
}
// endregion
// endregion // endregion
// region: Utilities // region: Utilities
@@ -568,15 +593,11 @@ impl ApplicationsKey {
// We temporarily use String and &str as the command line argument parameter. // We temporarily use String and &str as the command line argument parameter.
// We may introduce a new complete Rust struct for replacing this arbitrary string. // We may introduce a new complete Rust struct for replacing this arbitrary string.
pub fn get_shell_verb(&self, view: View) -> Result<(concept::Verb, String), Error> { pub fn get_shell_verb(&self, view: View) -> Result<ShellVerb, Error> {
todo!() todo!()
} }
pub fn set_shell_verb( pub fn set_shell_verb(&mut self, scope: Scope, sv: &ShellVerb) -> Result<(), Error> {
&mut self,
scope: Scope,
beh: (concept::Verb, &str),
) -> Result<(), Error> {
todo!() todo!()
} }
@@ -586,7 +607,11 @@ impl ApplicationsKey {
todo!() todo!()
} }
pub fn set_default_icon(&self, scope: Scope, icon: Option<&IconResVariant>) -> Result<(), Error> { pub fn set_default_icon(
&self,
scope: Scope,
icon: Option<&IconResVariant>,
) -> Result<(), Error> {
todo!() todo!()
} }
@@ -596,7 +621,11 @@ impl ApplicationsKey {
todo!() todo!()
} }
pub fn set_friendly_app_name(&self, scope: Scope, name: Option<&StrResVariant>) -> Result<(), Error> { pub fn set_friendly_app_name(
&self,
scope: Scope,
name: Option<&StrResVariant>,
) -> Result<(), Error> {
todo!() todo!()
} }
@@ -606,7 +635,11 @@ impl ApplicationsKey {
todo!() todo!()
} }
pub fn set_supported_types(&self, scope: Scope, tys: Option<&[concept::Ext]>) -> Result<(), Error> { pub fn set_supported_types(
&self,
scope: Scope,
tys: Option<&[concept::Ext]>,
) -> Result<(), Error> {
todo!() todo!()
} }