share files from UI

pull/4/head
Zlatin Balevsky 2019-05-31 17:01:49 +01:00
parent 8e196a5777
commit 096f784d1b
2 changed files with 16 additions and 3 deletions

View File

@ -27,8 +27,6 @@ You need to have an I2P router up and running on the same machine. After you bu
The first time you run MuWire it will ask you to select a nickname. This nickname will be displayed with search results, so that others can verify the file was shared by you.
To share files, edit $HOME/.MuWire/MuWire.properties and add the property "sharedFiles" with value a comma-separated list of absolute paths to shared files or folders.
At the moment there are very few nodes on the network, so you will see very few connections and search results. It is best to leave MuWire running all the time, just like I2P.

View File

@ -7,10 +7,13 @@ import griffon.metadata.ArtifactProviderFor
import javax.swing.BorderFactory
import javax.swing.Box
import javax.swing.BoxLayout
import javax.swing.JFileChooser
import javax.swing.JSplitPane
import javax.swing.SwingConstants
import javax.swing.border.Border
import com.muwire.core.files.FileSharedEvent
import java.awt.BorderLayout
import java.awt.CardLayout
import java.awt.FlowLayout
@ -109,7 +112,9 @@ class MainFrameView {
gridLayout(cols : 1, rows : 2)
panel {
borderLayout()
label(text : "Shared files", constraints: BorderLayout.NORTH)
panel (constraints : BorderLayout.NORTH) {
button(text : "Shared files", actionPerformed : shareFiles)
}
scrollPane ( constraints : BorderLayout.CENTER) {
table(id : "shared-files-table") {
tableModel(list : model.shared) {
@ -161,4 +166,14 @@ class MainFrameView {
def cardsPanel = builder.getVariable("cards-panel")
cardsPanel.getLayout().show(cardsPanel, "uploads window")
}
def shareFiles = {
def chooser = new JFileChooser()
chooser.setDialogTitle("Select file or directory to share")
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES)
int rv = chooser.showOpenDialog(null)
if (rv == JFileChooser.APPROVE_OPTION) {
model.core.eventBus.publish(new FileSharedEvent(file : chooser.getSelectedFile()))
}
}
}