Skip to content

Support select file & folder in quick link access add button #3738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

Jack251970
Copy link
Member

Since quick link access paths support volumn / file / folder type, we should support these three type in quick link access add button.

Now when we click this button, we will get a message box to choose whether to select a file or a folder:

image

Test:

  • test edit & add feature function of these three types

@prlabeler prlabeler bot added the enhancement New feature or request label Jun 17, 2025
@Jack251970 Jack251970 requested a review from Copilot June 17, 2025 06:41

This comment has been minimized.

Copy link

gitstream-cm bot commented Jun 17, 2025

🥷 Code experts: no user but you matched threshold 10

Jack251970 has most 👩‍💻 activity in the files.
Jack251970, jjw24 have most 🧠 knowledge in the files.

See details

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml

Activity based on git-commit:

Jack251970
JUN 7 additions & 0 deletions
MAY 10 additions & 2 deletions
APR
MAR
FEB
JAN

Knowledge based on git-blame:
jjw24: 23%
Jack251970: 9%

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs

Activity based on git-commit:

Jack251970
JUN 45 additions & 50 deletions
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Jack251970: 29%

To learn more about /:\ gitStream - Visit our Docs

Copy link

gitstream-cm bot commented Jun 17, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copilot

This comment was marked as outdated.

Copy link
Contributor

coderabbitai bot commented Jun 17, 2025

📝 Walkthrough

Walkthrough

The changes introduce new localized UI strings for prompting file or folder selection in the Explorer plugin and enhance the quick access link settings logic. The code now explicitly tracks and determines the type (file, folder, or volume) of access links, prompting users as needed and centralizing type determination logic.

Changes

File(s) Change Summary
Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml Added two new English string resources for file/folder selection prompts.
Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs Added explicit tracking and determination of access link type; improved user prompts and selection flow.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant QuickAccessLinkSettings
    participant Dialogs (File/Folder)
    participant MessageBox

    User->>QuickAccessLinkSettings: Click "Select Path"
    alt Editing existing link
        QuickAccessLinkSettings->>Dialogs: Show dialog based on existing type
    else Adding new link
        QuickAccessLinkSettings->>MessageBox: Prompt "Select file or folder?"
        alt User selects File
            QuickAccessLinkSettings->>Dialogs: Show OpenFileDialog
        else User selects Folder
            QuickAccessLinkSettings->>Dialogs: Show FolderBrowserDialog
        end
    end
    Dialogs-->>QuickAccessLinkSettings: Return selected path
    QuickAccessLinkSettings->>QuickAccessLinkSettings: Determine type via GetResultType(path)
    QuickAccessLinkSettings->>User: Update UI with selected path and type
Loading

Suggested labels

Explorer Plugin

Suggested reviewers

  • onesounds

Poem

A bunny hops with code delight,
Now picking links feels just right.
"File or folder?"—choose with care,
Dialogs pop up everywhere!
With types now clear and prompts anew,
Explorer’s job is easier to do.
🗂️🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b8768fe and b89e05f.

📒 Files selected for processing (1)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Report (PR)
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (1)

91-98: Duplicate-path check should ignore the name

Current check only flags duplicates when both path and name match.
Two different names pointing at the same path is still a duplicate entry from a user-perspective.

-if (QuickAccessLinks.Any(x =>
-        x.Path.Equals(SelectedPath, StringComparison.OrdinalIgnoreCase) &&
-        x.Name.Equals(SelectedName, StringComparison.OrdinalIgnoreCase)))
+if (QuickAccessLinks.Any(x =>
+        x.Path.Equals(SelectedPath, StringComparison.OrdinalIgnoreCase)))
🧹 Nitpick comments (3)
Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (3)

148-166: Cancel option not handled

ShowMsgBox is invoked with MessageBoxButton.YesNo, but a third state (MessageBoxResult.None / Cancel) can still be returned by some helper wrappers.
Treating anything other than Yes as Folder may surprise users if they close the box.

var result = Main.Context.API.ShowMsgBox(...);
- type = result == MessageBoxResult.Yes ? ResultType.File : ResultType.Folder;
+ if (result == MessageBoxResult.Yes)
+     type = ResultType.File;
+ else if (result == MessageBoxResult.No)
+     type = ResultType.Folder;
+ else
+     return;   // user aborted

168-196: Consider WPF-native pickers instead of WinForms

Using Microsoft.Win32.OpenFileDialog and System.Windows.Forms.FolderBrowserDialog together in a WPF window pulls in WinForms dependencies and inconsistent UI styling.
If feasible, swap to the WPF versions (or the modern Windows API picker) for a more coherent user experience.


198-225: Minor: early return simplifies GetResultType

Current nested else if/else chain can be flattened for readability, e.g.:

if (string.IsNullOrEmpty(path))
    return ResultType.Folder;

if (File.Exists(path))
    return ResultType.File;

if (!Directory.Exists(path))
    return ResultType.Folder;

return string.Equals(Path.GetPathRoot(path), path, StringComparison.OrdinalIgnoreCase)
    ? ResultType.Volume
    : ResultType.Folder;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00a80ae and e4f02f9.

📒 Files selected for processing (2)
  • Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (1)
Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml (1)

25-26: New resources look correct & consistent

Keys, placeholder usage ({0} for Environment.NewLine), and wording follow the existing pattern in this dictionary.
No issues from my side.

@Jack251970 Jack251970 requested a review from Copilot June 17, 2025 06:44

This comment has been minimized.

Copilot

This comment was marked as outdated.

@Jack251970 Jack251970 requested a review from Copilot June 17, 2025 06:46

This comment has been minimized.

Copilot

This comment was marked as outdated.

@Jack251970 Jack251970 requested a review from Copilot June 17, 2025 06:49

This comment has been minimized.

@Jack251970 Jack251970 added this to the 2.0.0 milestone Jun 17, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the Quick Access Link Settings dialog to let users choose between files, folders, or volumes when adding or editing links.

  • Tracks a new AccessLinkType property and applies it in both add and edit flows
  • Prompts the user with a Yes/No dialog to select file vs. folder, then uses OpenFileDialog/FolderBrowserDialog
  • Adds a GetResultType helper to classify paths, plus corresponding translation keys

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs Introduced AccessLinkType, refactored OnDoneButtonClick to use it, added SelectPath_OnClick prompt logic and GetResultType helper
Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml Added plugin_explorer_quickAccessLinkFileOrFolderTitle and plugin_explorer_quickAccessLinkFileOrFolderSubtitle translation keys
Comments suppressed due to low confidence (5)

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs:109

  • After adding a new AccessLink, the dialog isn’t closed and DialogResult isn’t set. Consider setting DialogResult = true and calling Close() inside AddNewAccessLink to match the edit flow.
QuickAccessLinks.Add(newAccessLink);

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs:146

  • [nitpick] The handler parameter is named commandParameter instead of sender, which may break conventional WPF event wiring. Rename it to object sender to align with the expected signature.
private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs:149

  • [nitpick] The local variable type shadows the keyword and is ambiguous. Consider renaming it to selectedType or pickedType for clarity.
ResultType type;

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs:198

  • The GetResultType method introduces branching logic for files, folders, and volumes but currently lacks unit tests. Add tests covering each branch to ensure correct classification.
private static ResultType GetResultType(string path)

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs:198

  • [nitpick] Consider adding XML documentation to GetResultType to explain how file, folder, and volume paths are determined, including the fallback assumption.
private static ResultType GetResultType(string path)

AddNewAccessLink();
}

void AddNewAccessLink()
Copy link
Preview

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The AddNewAccessLink local function is nested inside OnDoneButtonClick, which can reduce readability. Consider extracting it to a private method so it's easier to test and maintain.

Suggested change
void AddNewAccessLink()
private void AddNewAccessLink()

Copilot uses AI. Check for mistakes.

Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors and Warnings Count
❌ forbidden-pattern 22
⚠️ non-alpha-in-dictionary 13

See ❌ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@Jack251970 Jack251970 removed this from the 2.0.0 milestone Jun 17, 2025
@Jack251970
Copy link
Member Author

Continue in #3739.

@Jack251970 Jack251970 closed this Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant