Skip to content

Commit

Permalink
Added a contextmenu to desktop iconview (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersevenrud committed Sep 12, 2019
1 parent b37b864 commit c06e003
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/adapters/ui/iconview.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import {h, app} from 'hyperapp';
import {doubleTap} from '../../utils/input';
import {pathJoin} from '../../utils/vfs';

// TODO: Add context menu with refresh

const tapper = doubleTap();

const validVfsDrop = data => data && data.path;
Expand Down Expand Up @@ -234,6 +232,8 @@ export class DesktopIconView extends EventEmitter {
this.createFileContextMenu(ev, entry);

return {selected: index};
} else {
this.createRootContextMenu(ev);
}
},

Expand Down Expand Up @@ -338,4 +338,16 @@ export class DesktopIconView extends EventEmitter {
}]
});
}

createRootContextMenu(ev) {
const _ = this.core.make('osjs/locale').translate;

this.core.make('osjs/contextmenu', {
position: ev,
menu: [{
label: _('LBL_REFRESH'),
onclick: () => this.iconview.reload()
}]
});
}
}

0 comments on commit c06e003

Please sign in to comment.