Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding file to file field - automatically asking what to do? #4356

Closed
ilippert opened this issue Sep 21, 2018 · 19 comments
Closed

adding file to file field - automatically asking what to do? #4356

ilippert opened this issue Sep 21, 2018 · 19 comments
Labels
entry-editor good first issue An issue intended for project-newcomers. Varies in difficulty. hacktoberfest Hacktoberfest tag. See https://hacktoberfest.digitalocean.com/faq/ for details. preferences type: enhancement
Milestone

Comments

@ilippert
Copy link

I believe in some more or less distance past, it was possible to drag and drop a file onto the entry editor's file field and then jabref automatically asked what to do with the file, e.g. automatically rename and store the file in the preferred folder (#4166).
would be amazing if this, too, worked again ;)

@Siedlerchr
Copy link
Member

We reworked drag and drop completely. If you drop directly on the file field the file will be just linked.
If you drop it elsewhere on the entry editor or preview panel it will be renamed and moved to the file directory.
If you drop on maintable, JabRef tries to create an entry and asks what to do

@tobiasdiez
Copy link
Member

Its somewhat strange that drop on file field is different from a drop on the rest of the entry editor. I think, this should be aligned (i.e. always rename + move + link).

@tb77phd
Copy link

tb77phd commented Sep 21, 2018

I agree with the alignment but not that it must always rename+move+link. I, for one, prefer to keep my files the way I have already named them and in the subfolders they are already in. It could be a Preference choice:

"When dropping a file on the entry editor, do you wish to ...
a) only link (i.e., keep the file where it is and with its original name)
b) rename and keep in location
c) rename+move+link"

Something along those lines.

@Siedlerchr
Copy link
Member

So in fact we restore the dialog asking what to do

@tb77phd
Copy link

tb77phd commented Sep 21, 2018

Not necessarily if it is in Options -> Preferences. Then one chooses once and that's it.

@Siedlerchr
Copy link
Member

Okay, will think about t his:
In the meantime we have the following options also avaiable:

Holding Shift and dragging or directly dropping without key on windows -> move + rename + link
Holding alt key on windows -> link file to entry, keep in location
Holding ctrl on windows -> copy files to file dir + link to entry

The modifiers are the system ones for MOVE, LINK, and COPY. They are system dependent:
https://ux.stackexchange.com/questions/83748/what-are-the-most-common-modifier-keys-for-dragging-objects-with-a-mouse

@tobiasdiez
Copy link
Member

A preference option for the default action is a good idea in my opinion. Thanks @tb77phd for the suggestion.

@tobiasdiez tobiasdiez added type: enhancement preferences entry-editor good first issue An issue intended for project-newcomers. Varies in difficulty. labels Sep 21, 2018
@tobiasdiez tobiasdiez added this to the v5.0 milestone Sep 21, 2018
@shahamish150294
Copy link
Contributor

If anybody is not looking into this, can I take this issue?

@Siedlerchr Siedlerchr added the hacktoberfest Hacktoberfest tag. See https://hacktoberfest.digitalocean.com/faq/ for details. label Oct 2, 2018
@Siedlerchr
Copy link
Member

@shahamish150294 Sure go ahead. as starting point you can look at the EntryEditor and in the LinkedFilesEditor. The methods which handle DragAndDrop are all similiar:
this.setOnDragDropped(event -> { ........ }

@shahamish150294
Copy link
Contributor

As part of this task I am also removing the three methods related to Drag and Drop in

.setOnDragDetected(this::handleOnDragDetected)
.setOnDragDropped(this::handleOnDragDropped)
.setOnDragOver(this::handleOnDragOver);

because now the drag and drop will be a part of the EntryEditor and hence IMO, this is not needed. Please let me know if I am correct. @Siedlerchr
Thanks.

@morganlovato
Copy link
Contributor

Is this issue still available to work on? I'd like to contribute for a school project.

@Siedlerchr
Copy link
Member

@shahamish150294 Yeah. I think we don't need there any special handling. Please test if it's really sufficient to have them in the entry editor.

@morganlovato Seems like @shahamish150294 is already working on this. But you can look through the other issues and take one

shahamish150294 added a commit to shahamish150294/jabref that referenced this issue Oct 26, 2018
shahamish150294 added a commit to shahamish150294/jabref that referenced this issue Oct 26, 2018
shahamish150294 added a commit to shahamish150294/jabref that referenced this issue Oct 31, 2018
tobiasdiez pushed a commit that referenced this issue Nov 1, 2018
* Add a preference to add files in entry editor (#4356)

* Fix import order

* Edit changelog

* Use enum to represent FileDragDropPreference for Entry Editor

* Changes for localization message and replaced boolean for drag and drop preference with enums

* Change drag-drop option name in preferences

* Added behaviors to accommodate different drag-drop ways along with preference default

* Added whitespaces after if condition

* Remove unused imports
@tobiasdiez
Copy link
Member

Thanks to @shahamish150294 this is now implemented in the latest development version. Could you please check the build from http://builds.jabref.org/master/. Thanks! Please remember to make a backup of your library before trying-out this version.

@shahamish150294
Copy link
Contributor

The latest build seems to reflect the changes. Thank you @tobiasdiez and @Siedlerchr for your help!

@ilippert
Copy link
Author

ilippert commented Nov 4, 2018

JabRef 5.0-dev--snapshot--2018-11-02--master--611e35a6b
Linux 4.18.16-200.fc28.x86_64 amd64
Java 1.8.0_172

Sorry, but in my version drag/drop of a pdf onto an existing entry (both in table and in fiel field of editor) does not result in any effect: no file linked.

Only if I use the + button next to the file field in the entry editor, then I can add a single entry. Here, at least, I would also like to be able to add several files (e.g. chapters of a book that are from the same author).

@Siedlerchr
Copy link
Member

@ilippert Have you checked the preferences?

@ilippert
Copy link
Author

ilippert commented Nov 4, 2018

I guess I checjked preference Entry editor Default drag & drop: Copy, rename and link file.

The problem is is difficult to reproduce: two times I managed by now to drag a file from external file browser onto the file field and then a link became visible (as expected). But I cannot reliably reproduce this linking.
I did not yet manage at all to drag & drop the file onto the specific entry table entry and then get a link.

@Siedlerchr
Copy link
Member

It should not only work in the file field, it should work on the whole entry editor.

@ilippert
Copy link
Author

ilippert commented Nov 4, 2018

just tried again. Interestingly, when I drag & drop a file on the entry editor after phase of non-use, the link is produced. I then remove the link to test again. Now, a second later, I cannot re-perform this effect: no link is produced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
entry-editor good first issue An issue intended for project-newcomers. Varies in difficulty. hacktoberfest Hacktoberfest tag. See https://hacktoberfest.digitalocean.com/faq/ for details. preferences type: enhancement
Projects
None yet
Development

No branches or pull requests

6 participants