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