Skip to content

Commit

Permalink
Merge pull request #1207 from peuter/fix-folder-keynav
Browse files Browse the repository at this point in the history
Fix folder key navigation
  • Loading branch information
ChristianMayer committed Feb 12, 2022
2 parents 30891ce + 85320fa commit 9b9c950
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 56 deletions.
107 changes: 55 additions & 52 deletions source/class/cv/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -925,60 +925,63 @@ qx.Class.define('cv.Application',
const env = req.getResponse();
const serverVersionId = env.PHP_VERSION_ID;
//const [major, minor] = env.phpversion.split('.').map(ver => parseInt(ver));
const parts = env.required_php_version.split(' ');
const disable = parts.some(constraint => {
const match = /^(>=|<|>|<=|\^)(\d+)\.(\d+)\.?(\d+)?$/.exec(constraint);
if (match) {
const operator = match[1];
const majorConstraint = parseInt(match[2]);
const hasMinorVersion = match[3] !== undefined;
const minorConstraint = hasMinorVersion ? parseInt(match[3]) : 0;
const hasPatchVersion = match[4] !== undefined;
const patchConstraint = hasPatchVersion ? parseInt(match[4]) : 0;
const constraintId = 10000 * majorConstraint + 100 * minorConstraint + patchConstraint;
const maxId = 10000 * majorConstraint + (hasMinorVersion ? 100 * minorConstraint : 999) + (hasPatchVersion ? patchConstraint : 99);
// incomplete implementation of: https://getcomposer.org/doc/articles/versions.md#writing-version-constraints
switch (operator) {
case '>=':
if (serverVersionId < constraintId) {
return true;
}
break;
case '>':
if (serverVersionId <= constraintId) {
return true;
}
break;
case '<=':
if (serverVersionId > maxId) {
return true;
}
break;
case '<':
if (serverVersionId >= maxId) {
return true;
}
break;
case '^':
if (serverVersionId < constraintId || serverVersionId > 10000 *(majorConstraint+1)) {
return true;
}
break;
case '~':
if (serverVersionId < constraintId || hasPatchVersion ? serverVersionId > 10000 * (majorConstraint+1) : serverVersionId > (10000 *(majorConstraint) + 100 * (patchConstraint+1))) {
return true;
}
break;
let disable = false;
if (Object.prototype.hasOwnProperty.call(env, 'required_php_version')) {
const parts = env.required_php_version.split(' ');
disable = parts.some(constraint => {
const match = /^(>=|<|>|<=|\^)(\d+)\.(\d+)\.?(\d+)?$/.exec(constraint);
if (match) {
const operator = match[1];
const majorConstraint = parseInt(match[2]);
const hasMinorVersion = match[3] !== undefined;
const minorConstraint = hasMinorVersion ? parseInt(match[3]) : 0;
const hasPatchVersion = match[4] !== undefined;
const patchConstraint = hasPatchVersion ? parseInt(match[4]) : 0;
const constraintId = 10000 * majorConstraint + 100 * minorConstraint + patchConstraint;
const maxId = 10000 * majorConstraint + (hasMinorVersion ? 100 * minorConstraint : 999) + (hasPatchVersion ? patchConstraint : 99);
// incomplete implementation of: https://getcomposer.org/doc/articles/versions.md#writing-version-constraints
switch (operator) {
case '>=':
if (serverVersionId < constraintId) {
return true;
}
break;
case '>':
if (serverVersionId <= constraintId) {
return true;
}
break;
case '<=':
if (serverVersionId > maxId) {
return true;
}
break;
case '<':
if (serverVersionId >= maxId) {
return true;
}
break;
case '^':
if (serverVersionId < constraintId || serverVersionId > 10000 * (majorConstraint + 1)) {
return true;
}
break;
case '~':
if (serverVersionId < constraintId || hasPatchVersion ? serverVersionId > 10000 * (majorConstraint + 1) : serverVersionId > (10000 * (majorConstraint) + 100 * (patchConstraint + 1))) {
return true;
}
break;
}
}
return false;
});
if (disable) {
this.error('Disabling manager due to PHP version mismatch. Installed:', env.phpversion, 'required:', env.required_php_version);
this.setManagerDisabled(true);
this.setManagerDisabledReason(qx.locale.Manager.tr('Your system does not provide the required PHP version for the manager. Installed: %1, required: %2', env.phpversion, env.required_php_version));
} else {
this.info('Manager available for PHP version', env.phpversion);
}
return false;
});
if (disable) {
this.error('Disabling manager due to PHP version mismatch. Installed:', env.phpversion, 'required:', env.required_php_version);
this.setManagerDisabled(true);
this.setManagerDisabledReason(qx.locale.Manager.tr('Your system does not provide the required PHP version for the manager. Installed: %1, required: %2', env.phpversion, env.required_php_version));
} else {
this.info('Manager available for PHP version', env.phpversion);
}
this.setManagerChecked(true);

Expand Down
13 changes: 9 additions & 4 deletions source/class/cv/ui/manager/viewer/Folder.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
qx.Class.define('cv.ui.manager.viewer.Folder', {
extend: cv.ui.manager.viewer.AbstractViewer,
implement: [
qx.ui.core.IMultiSelection,
qx.ui.core.ISingleSelection,
qx.ui.form.IModelSelection
],
include: [
qx.ui.core.MMultiSelectionHandling,
qx.ui.core.MSingleSelectionHandling,
qx.ui.core.MRemoteChildrenHandling,
qx.ui.form.MModelSelection,
cv.ui.manager.control.MFileEventHandler
Expand Down Expand Up @@ -148,8 +148,13 @@ qx.Class.define('cv.ui.manager.viewer.Folder', {
_isImageRegex: null,
_newItem: null,

/** @type {Class} Pointer to the selection manager to use */
SELECTION_MANAGER : qx.ui.core.selection.ScrollArea,
_getItems: function() {
return this.getChildControl('list').getChildren();
},

_isAllowEmptySelection: function () {
return true;
},

_defaultLabelConverter: function (name) {
if (this.getViewMode() === 'list') {
Expand Down

0 comments on commit 9b9c950

Please sign in to comment.