feat: add shell verb struct
This commit is contained in:
@@ -85,7 +85,7 @@ impl TryFrom<View> for Scope {
|
||||
|
||||
// endregion
|
||||
|
||||
// region: Losse and Variant Structs
|
||||
// region: Exposed Structs (Losse, Variant and others)
|
||||
|
||||
// region: Losse ProgId
|
||||
|
||||
@@ -132,7 +132,7 @@ impl From<concept::ProgId> for LosseProgId {
|
||||
// region: Icon Resource Variant
|
||||
|
||||
/// The enum representing a losse 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.
|
||||
/// This enum is designed for handling this scenario.
|
||||
@@ -184,7 +184,7 @@ impl From<concept::IconRefStr> for IconResVariant {
|
||||
// region: String Resource Variant
|
||||
|
||||
/// The enum representing a losse String Reference String.
|
||||
///
|
||||
///
|
||||
/// In real usage, programmer can use String Reference String,
|
||||
/// or a plain string as the string setting value.
|
||||
/// This enum is designed for handling this scenario.
|
||||
@@ -203,7 +203,7 @@ impl StrResVariant {
|
||||
StrResVariant::RefStr(v) => {
|
||||
let rc = concept::StrRc::new(v.get_path(), v.get_index())?;
|
||||
rc.into_string()
|
||||
},
|
||||
}
|
||||
};
|
||||
Ok(rv)
|
||||
}
|
||||
@@ -238,6 +238,31 @@ impl From<concept::StrRefStr> for StrResVariant {
|
||||
|
||||
// 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
|
||||
|
||||
// region: Utilities
|
||||
@@ -568,15 +593,11 @@ impl ApplicationsKey {
|
||||
// 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.
|
||||
|
||||
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!()
|
||||
}
|
||||
|
||||
pub fn set_shell_verb(
|
||||
&mut self,
|
||||
scope: Scope,
|
||||
beh: (concept::Verb, &str),
|
||||
) -> Result<(), Error> {
|
||||
pub fn set_shell_verb(&mut self, scope: Scope, sv: &ShellVerb) -> Result<(), Error> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
@@ -586,7 +607,11 @@ impl ApplicationsKey {
|
||||
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!()
|
||||
}
|
||||
|
||||
@@ -596,7 +621,11 @@ impl ApplicationsKey {
|
||||
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!()
|
||||
}
|
||||
|
||||
@@ -606,7 +635,11 @@ impl ApplicationsKey {
|
||||
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!()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user