Skip to content

Dismiss preview window when opening files through Open With action - #2004

Open
BerryUIKI wants to merge 1 commit into
QL-Win:masterfrom
BerryUIKI:fix/open-with-close-preview
Open

BerryUIKI wants to merge 1 commit into
QL-Win:masterfrom
BerryUIKI:fix/open-with-close-preview

Conversation

@BerryUIKI

@BerryUIKI BerryUIKI commented Sep 18, 2026

Copy link
Copy Markdown

PR Checklist

  • Functionality has been tested, no obvious bugs
  • Code style follows project conventions
  • Documentation/comments updated (if applicable)

Brief Description of Changes

  • In ViewerWindow.xaml.cs, clicking the "Open With" button (buttonOpenWith) previously launched ShareHelper.Share(_path, this, true) (invoking rundll32.exe shell32.dll,OpenAs_RunDLL) but left the QuickLook preview window open on screen.
  • Updated buttonOpenWith.Click to dismiss the preview window (Close() if pinned, or ViewWindowManager.GetInstance().ClosePreview()), matching the closing behavior of the default "Open with [App]" button (buttonOpen).

Related Issue (if any)

Fixes #1267

Additional Notes

Tested opening various file types via the Open With dialog. The QuickLook window cleanly closes upon invoking the system dialog.

Summary by Sourcery

Bug Fixes:

  • Close the QuickLook preview window when invoking the system Open With action.

@sourcery-ai

sourcery-ai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The Open With action now dismisses the QuickLook preview after invoking the system dialog, closing pinned windows directly and delegating unpinned previews to ViewWindowManager; the file header’s BOM was also removed.

Sequence diagram for dismissing the preview after Open With

sequenceDiagram
    participant User
    participant ViewerWindow
    participant ShareHelper
    participant ViewWindowManager
    participant SystemDialog

    User->>ViewerWindow: buttonOpenWith.Click
    ViewerWindow->>ShareHelper: Share(_path, this, true)
    ShareHelper->>SystemDialog: OpenAs_RunDLL
    alt Pinned
        ViewerWindow->>ViewerWindow: Close()
    else Unpinned
        ViewerWindow->>ViewWindowManager: GetInstance()
        ViewWindowManager->>ViewWindowManager: ClosePreview()
    end
Loading

File-Level Changes

Change Details Files
Close the QuickLook preview after launching the system Open With dialog, using the same pinned-versus-managed-preview behavior as the existing close flow.
  • Continue launching the system Open With dialog through the existing share helper.
  • Close the current window directly when pinned.
  • Otherwise request preview closure through the window manager.
QuickLook/ViewerWindow.xaml.cs
Normalize the file header encoding marker without changing the copyright text.
  • Remove the leading byte-order mark from the source file.
QuickLook/ViewerWindow.xaml.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#1267 Close the QuickLook preview window when a file is opened through the 'Open With' action, including when the preview is pinned.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QuickLook Remains Open When Opening Files Through the 'Open With' Action

1 participant