Skip to content

Commit 857660c

Browse files
committed
Added a contextmenu to desktop iconview (#51)
1 parent 7b7fa3b commit 857660c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/adapters/ui/iconview.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ import {h, app} from 'hyperapp';
3232
import {doubleTap} from '../../utils/input';
3333
import {pathJoin} from '../../utils/vfs';
3434

35-
// TODO: Add context menu with refresh
36-
3735
const tapper = doubleTap();
3836

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

236234
return {selected: index};
235+
} else {
236+
this.createRootContextMenu(ev);
237237
}
238238
},
239239

@@ -338,4 +338,16 @@ export class DesktopIconView extends EventEmitter {
338338
}]
339339
});
340340
}
341+
342+
createRootContextMenu(ev) {
343+
const _ = this.core.make('osjs/locale').translate;
344+
345+
this.core.make('osjs/contextmenu', {
346+
position: ev,
347+
menu: [{
348+
label: _('LBL_REFRESH'),
349+
onclick: () => this.iconview.reload()
350+
}]
351+
});
352+
}
341353
}

0 commit comments

Comments
 (0)