Skip to content

Commit

Permalink
Merge branch 'improve-preview-handling' of github.com:peuter/cometvis…
Browse files Browse the repository at this point in the history
…u into improve-preview-handling
  • Loading branch information
peuter committed Jan 19, 2023
2 parents 0fd89a5 + adaad02 commit c4d87c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/class/cv/ui/manager/editor/Tree.js
Expand Up @@ -195,10 +195,13 @@ qx.Class.define('cv.ui.manager.editor.Tree', {
_maintainPreviewVisibility() {
const handlerOptions = this.getHandlerOptions();
let enablePreview = qx.bom.Viewport.getWidth() > 800 && (!handlerOptions || !handlerOptions.noPreview);
if (enablePreview && !cv.ui.manager.model.FileItem.ROOT.isWriteable()) {
// config folder is not writable, preview can only work when the file already exists and is writeable
if (enablePreview) {
const previewFile = this.__getPreviewFile();
if (previewFile.isTemporary() || !previewFile.isWriteable()) {
if (!previewFile.isTemporary() && !previewFile.isWriteable()) {
// preview file already exists, but it is not writable
enablePreview = false;
} else if (previewFile.isTemporary() && !cv.ui.manager.model.FileItem.ROOT.isWriteable()) {
// parent folder is not writable and preview file does not exist
enablePreview = false;
}
}
Expand Down

0 comments on commit c4d87c8

Please sign in to comment.