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

Add user name and host name to user-specific file directory #658

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

JoleneSun111
Copy link

@JoleneSun111 JoleneSun111 commented Oct 22, 2023

Fixes #572, user-specific file directory should show user name.
Implement a hover on user-specific file directory. If the mouse is on hower, JabRef displays: user: {username}, host: {hostname}.
589e2a9a049ace9deb4f7ab3096b275

Describe the changes you have made here: Change the src/main/java/org/jabref/gui/libraryproperties/general, add two properties to display the username and hostname in the frontend.
Fixed kopper issue : #572 #572

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

This commit adds hower to user-specific file directory, if the mouse is on the hower, jabref display: host: hostname, username: username
Fixes koppor#572
@calixtus calixtus merged commit e23031f into koppor:main Oct 22, 2023
1 check passed
@calixtus
Copy link
Collaborator

There went sthg wrong, when i tried to resolve merge conflicts with in a PR, sorry for that.

@calixtus
Copy link
Collaborator

Im afraid you have to create a new PR, but please this time targeting JabRef:JabRef, this repo is just a mirror.

Copy link
Owner

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some code comments, maybe the help for a future PR

@@ -61,6 +66,16 @@ public void setValues() {
selectedDatabaseModeProperty.setValue(metaData.getMode().orElse(BibDatabaseMode.BIBLATEX));
generalFileDirectoryProperty.setValue(metaData.getDefaultFileDirectory().orElse("").trim());
userSpecificFileDirectoryProperty.setValue(metaData.getUserFileDirectory(preferencesService.getFilePreferences().getUserAndHost()).orElse("").trim());
userSpecificFileDirectoryProperty.setValue(metaData.getUserFileDirectory(preferencesService.getFilePreferences().getUserAndHost()).map(path -> usernameProperty.getValue() + ": " + path).orElse("").trim());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this more be a binding?

@@ -61,6 +66,16 @@ public void setValues() {
selectedDatabaseModeProperty.setValue(metaData.getMode().orElse(BibDatabaseMode.BIBLATEX));
generalFileDirectoryProperty.setValue(metaData.getDefaultFileDirectory().orElse("").trim());
userSpecificFileDirectoryProperty.setValue(metaData.getUserFileDirectory(preferencesService.getFilePreferences().getUserAndHost()).orElse("").trim());
userSpecificFileDirectoryProperty.setValue(metaData.getUserFileDirectory(preferencesService.getFilePreferences().getUserAndHost()).map(path -> usernameProperty.getValue() + ": " + path).orElse("").trim());
String username = preferencesService.getFilePreferences().getUserAndHost(); // get the username
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return username AND hostname. -- You can add new methods to the getFilePreferences to return the username and the hostname separately. - The getUserAndHost should IMHO be still be avialble. Check the usages.

Comment on lines +73 to +74
InetAddress localHost = InetAddress.getLocalHost();
hostProperty.set(localHost.getHostName()); // get the host Name
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this code - JabRef already knows the host name. It is returned in getUserAndHost().

Comment on lines +160 to +162
public void setUsername(String username) {
usernameProperty.setValue(username);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary - because the change of the username would be handled in other places in JabRef.

@koppor
Copy link
Owner

koppor commented Oct 22, 2023

Regrading the screenshot: The tooltip looks good. - The content of the text field seems to have a prefix inside, but maybe just a quirk because of the screenshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

user-specific file directory should show user name
3 participants