-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Showing correct icon on main table linked files column #6264
Showing correct icon on main table linked files column #6264
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR.
I think the original getName
was ok there. We want to save the name of the file type which is in this case "PDF". It's more a problem with the display, which is controlled by
jabref/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java
Lines 409 to 420 in 8968ccf
private Node createFileIcon(List<LinkedFile> linkedFiles) { | |
if (linkedFiles.size() > 1) { | |
return IconTheme.JabRefIcons.FILE_MULTIPLE.getGraphicNode(); | |
} else if (linkedFiles.size() == 1) { | |
return externalFileTypes.fromLinkedFile(linkedFiles.get(0), false) | |
.map(ExternalFileType::getIcon) | |
.orElse(IconTheme.JabRefIcons.FILE) | |
.getGraphicNode(); | |
} else { | |
return null; | |
} | |
} |
The improvements around the getTypeIcon
method you suggest would indeed be a valuable addition!
Finally, I think, we should convert the filetype string
in LinkedFile
to use the interface FileType
. This would prevent the irritation if the filetype is specified by name or by extension or by something else. @leitianjian if you feel like you want to do this, please be invited to do so.
Thanks for your instructions! I'm not very familiar with the code in fact. Really appreciate that you can indicate the source of the problem. I will try again. For the addition bug (I think), I will try to work on it and thanks for your tips. |
Nice to hear! You can also reuse this PR if you want (just push your updates to the same branch). |
Please be aware that a "LinkedFile" can also be a http url or link. I don't know if this is actually considered in the file type. |
Ok, I will reuse this PR next time I want to commit some code. @Siedlerchr Thanks for your additional tips, which I have not considered yet. I will review the source code carefully. |
Fixes #6169 and finish the TODO additional feature, which has mentioned before. Hello, I have fixed the bugs that appear in the icon of the linked file column and finish the additional feature. I create a draft pull request. If there are breaking any contribution rules, please let me know. If everything is ok, I will create a pull request then. I have tested to import some format of doc, just a simple test of .docx, .pptx and .pdf format files. For the bugs, I found that is coming from the wrong filter. I think it should be a mistake. For the additional features, I was using the same method in: jabref/src/main/java/org/jabref/gui/maintable/MainTableColumnFactory.java Lines 412 to 416 in 8968ccf
I think the modification won't do any harm to other code
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! This already looks really good. So I've marked it as ready for review for the other developers.
Please add a changelog entry, then this is good to go from my side.
@@ -140,7 +140,9 @@ public String getDescriptionAndLink() { | |||
* org.jabref.gui.externalfiletype.ExternalFileTypes#getExternalFileTypeByName(String)} | |||
*/ | |||
public JabRefIcon getTypeIcon() { | |||
return IconTheme.JabRefIcons.PDF_FILE; | |||
return externalFileTypes.fromLinkedFile(linkedFile, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also remove the above TODO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I get it. I will finish it in one hour. Many thanks for your instructions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for your contribution! Looks good to me as well!
Could you please add a changelog entry as well?
I have finished the changing of CHANGELOG.md and the deletion of TODO comments. Thanks for your instructions! @tobiasdiez @Siedlerchr |
Perfect! Thanks again for your contribution and hope to see the next PR from you soon! |
I'm searching for our next target issue ^_^ |
…ionCaseInsensitive * upstream/master: (25 commits) ActionHelper to test for present file (#6151) Reduce memory footprint (#6298) Add missing abbreviated journal names (#6292) fix l10n again fix checkstyle fix l10n Try to minimize CodeCov "wrong metrics" Showing correct icon on main table linked files column (#6264) Fix labels for outdated dependency issue Change one more line Squashed 'src/main/resources/csl-styles/' changes from c31d9ca..c1793d2 Resolve unit test from failing Add one more change Fix errors RIS import takes the wrong date and duplicates abstract (#6272) Update EntryTypeView.java Change to the old school format Fix XmpExporterTest (#6289) Add checkstyle screenshot (and lint guidelines-...md) Squashed 'src/main/resources/csl-styles/' changes from db54e56..c31d9ca ...
Fixes #6169
Hello, I have fixed the bugs that appear in the icon of the linked file column. I create a draft pull request. If there are breaking any contribution rules, please let me know. If everything is ok, I will create a pull request then.
I have tested to import some format of doc, just a simple test of .docx, .pptx and .pdf format files.
About the source code, I have a question:
I found the wrong icon still shows in the General -> Files list, which only shows pdf icon no matter what format of files attached. Then I found org.jabref.gui.fieldeditors.LinkedFileViewModel#getTypeIcon() which directly indicate the icon to pdf, which seems like the source of the bug. There is a TODO comment above, which seems like this bug has already discovered. Then I went through the issue list and tried to find some relevant thing to this bug (TODO), but nothing found. I would be happy if you can provide more info about it. Thanks, ^_^