mirror of https://github.com/zlatinb/muwire
Add a note about DND, automatically watch shared directories
parent
4f436a636c
commit
3e7f2aa70a
|
@ -186,7 +186,7 @@ class MainFrameView {
|
|||
panel (constraints : BorderLayout.NORTH) {
|
||||
label(text : bind {
|
||||
if (model.hashingFile == null) {
|
||||
""
|
||||
"You can drag-and-drop files and directories here"
|
||||
} else {
|
||||
"hashing: " + model.hashingFile.getAbsolutePath() + " (" + DataHelper.formatSize2Decimal(model.hashingFile.length(), false).toString() + "B)"
|
||||
}
|
||||
|
@ -411,6 +411,9 @@ class MainFrameView {
|
|||
public boolean importData(TransferHandler.TransferSupport support) {
|
||||
def files = support.getTransferable().getTransferData(DataFlavor.javaFileListFlavor)
|
||||
files.each {
|
||||
if (it.isDirectory())
|
||||
watchDirectory(it)
|
||||
else
|
||||
model.core.eventBus.publish(new FileSharedEvent(file : it))
|
||||
}
|
||||
showUploadsWindow.call()
|
||||
|
@ -841,14 +844,18 @@ class MainFrameView {
|
|||
int rv = chooser.showOpenDialog(null)
|
||||
if (rv == JFileChooser.APPROVE_OPTION) {
|
||||
chooser.getSelectedFiles().each { f ->
|
||||
watchDirectory(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void watchDirectory(File f) {
|
||||
model.watched << f.getAbsolutePath()
|
||||
application.context.get("muwire-settings").watchedDirectories << f.getAbsolutePath()
|
||||
mvcGroup.controller.saveMuWireSettings()
|
||||
builder.getVariable("watched-directories-table").model.fireTableDataChanged()
|
||||
model.core.eventBus.publish(new FileSharedEvent(file : f))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String getSelectedWatchedDirectory() {
|
||||
def watchedTable = builder.getVariable("watched-directories-table")
|
||||
|
|
Loading…
Reference in New Issue