Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
/ Orion Public archive

Commit

Permalink
Merge pull request #138 from Siderus/bugfix/156-allow-to-upload-direc…
Browse files Browse the repository at this point in the history
…tories-on-win

Allow to add directories
  • Loading branch information
kernelwhisperer authored Jun 15, 2018
2 parents cc4b5f1 + cc51767 commit 2fcc88b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
27 changes: 26 additions & 1 deletion app/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,41 @@
* Import/require this file to set up the Menu of the windows
*/

import electron, { BrowserWindow, Menu, app } from 'electron'
import electron, { BrowserWindow, Menu, app, dialog } from 'electron'

import ImportWindow from './windows/Import/window'
import SettingsWindow from './windows/Settings/window'
import ResolveIPNS from './windows/ResolveIPNS/window'
import PublishToIPNS from './windows/PublishToIPNS/window'

import { addFilesPaths } from './windows/Storage/fileIntegration'

const template = [{
label: 'File',
submenu: [{
label: 'Add File',
click () {
const selectOptions = {
title: 'Add File',
properties: ['openFile', 'multiSelections']
}

const paths = dialog.showOpenDialog(app.mainWindow, selectOptions)
addFilesPaths(paths)
}
}, {
label: 'Add Directory',
click () {
const selectOptions = {
title: 'Add Directory',
properties: ['openDirectory', 'multiSelections']
}

const paths = dialog.showOpenDialog(app.mainWindow, selectOptions)
addFilesPaths(paths)
}
},
{
label: 'Import from hash',
accelerator: 'CmdOrCtrl+D',
click () {
Expand Down
6 changes: 2 additions & 4 deletions app/windows/Storage/fileIntegration.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { remote } from 'electron'
import { dialog, app, shell } from 'electron'
import Settings from 'electron-settings'
import { addFilesFromFSPath, unpinObject } from '../../api'
import DetailsWindow from '../Details/window'

const { app, dialog, shell } = remote

/**
* Returns `true` if the user wants to wrap all files under a single dir,
* `false` otherwise
Expand Down Expand Up @@ -126,7 +124,7 @@ export function proptAndRemoveObjects (hashes) {
cancelId: 0
}

const btnClicked = remote.dialog.showMessageBox(remote.app.mainWindow, opts)
const btnClicked = dialog.showMessageBox(app.mainWindow, opts)
// Check the electron dialog documentation, cancel button is always 0
if (btnClicked !== 0) {
const promises = hashes.map(hash => unpinObject(hash))
Expand Down

0 comments on commit 2fcc88b

Please sign in to comment.