From 5f9c893d95c97a85ab5ede11854f4cad02efb52a Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Thu, 30 Apr 2026 10:16:52 +0800 Subject: [PATCH] feat: finish lowlevel application key decl --- wfassoc/src/highlevel.rs | 12 ++---------- wfassoc/src/lowlevel.rs | 42 ++++++++++++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/wfassoc/src/highlevel.rs b/wfassoc/src/highlevel.rs index 1b51cd0..f3d70f3 100644 --- a/wfassoc/src/highlevel.rs +++ b/wfassoc/src/highlevel.rs @@ -282,18 +282,10 @@ impl Program { // region: Program Internals /// Internal used enum presenting a Program string resource. -#[derive(Debug)] -enum ProgramStr { - Plain(String), - RefStr(win32::concept::StrRefStr) -} +type ProgramStr = lowlevel::LosseStrRefStr; /// Internal used enum presenting a Program icon resource. -#[derive(Debug)] -enum ProgramIcon { - Plain(String), - RefStr(win32::concept::IconRefStr) -} +type ProgramIcon = lowlevel::LosseIconRefStr; /// Internal used enum presenting a Program behavior (command line setups). #[derive(Debug)] diff --git a/wfassoc/src/lowlevel.rs b/wfassoc/src/lowlevel.rs index 6970cc7..6cfcb3f 100644 --- a/wfassoc/src/lowlevel.rs +++ b/wfassoc/src/lowlevel.rs @@ -561,18 +561,18 @@ impl ApplicationsKey { .ok_or(Error::InexistantKey) } - const NAMEOF_DEFAULT_BEHAVIOR_PART1: &str = "shell"; - const NAMEOF_DEFAULT_BEHAVIOR_PART3: &str = "command"; + const NAMEOF_SHELL_VERB_PART1: &str = "shell"; + const NAMEOF_SHELL_VERB_PART3: &str = "command"; // TODO: // 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_default_behavior(&self, view: View) -> Result<(concept::Verb, String), Error> { + pub fn get_shell_verb(&self, view: View) -> Result<(concept::Verb, String), Error> { todo!() } - pub fn set_default_behavior( + pub fn set_shell_verb( &mut self, scope: Scope, beh: (concept::Verb, &str), @@ -582,11 +582,41 @@ impl ApplicationsKey { const NAMEOF_DEFAULT_ICON: &str = "DefaultIcon"; - pub fn get_default_icon(&self, view: View) -> Result<(), Error> { + pub fn get_default_icon(&self, view: View) -> Result, Error> { todo!() } - pub fn set_default_icon(&self, scope: Scope, icon: ()) -> Result<(), Error> { + pub fn set_default_icon(&self, scope: Scope, icon: Option<&LosseIconRefStr>) -> Result<(), Error> { + todo!() + } + + const NAMEOF_FRIENDLY_APP_NAME: &str = "FriendlyAppName"; + + pub fn get_friendly_app_name(&self, view: View) -> Result, Error> { + todo!() + } + + pub fn set_friendly_app_name(&self, scope: Scope, name: Option<&LosseStrRefStr>) -> Result<(), Error> { + todo!() + } + + const NAMEOF_SUPPORTED_TYPES: &str = "SupportedTypes"; + + pub fn get_supported_types(&self, view: View) -> Result>, Error> { + todo!() + } + + pub fn set_supported_types(&self, scope: Scope, tys: Option<&[concept::Ext]>) -> Result<(), Error> { + todo!() + } + + const NAMEOF_NO_OPEN_WITH: &str = "NoOpenWith"; + + pub fn get_no_open_with(&self, view: View) -> Result { + todo!() + } + + pub fn set_no_open_with(&self, scope: Scope, flag: bool) -> Result<(), Error> { todo!() } }