Skip to content

Commit

Permalink
(feat) #2 Added functionality for password dialog pop up. It is trigg…
Browse files Browse the repository at this point in the history
…ered from JabRefGUI if proxy requires password
  • Loading branch information
jakobewaldsson committed Mar 3, 2023
1 parent 01c529c commit 828110f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/main/java/org/jabref/gui/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@
import org.jabref.gui.importer.ParserResultWarningDialog;
import org.jabref.gui.importer.actions.OpenDatabaseAction;
import org.jabref.gui.keyboard.TextInputKeyBindings;
import org.jabref.gui.preferences.PreferencesDialogView;
import org.jabref.gui.shared.SharedDatabaseUIManager;
import org.jabref.logic.importer.ParserResult;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.net.ProxyRegisterer;
import org.jabref.logic.shared.DatabaseNotSupportedException;
import org.jabref.logic.shared.exception.InvalidDBMSConnectionPropertiesException;
import org.jabref.logic.shared.exception.NotASharedDatabaseException;
import org.jabref.logic.util.WebViewStore;
import org.jabref.preferences.GuiPreferences;
import org.jabref.preferences.PreferencesService;
import org.jabref.preferences.JabRefPreferences;

import impl.org.controlsfx.skin.DecorationPane;
import org.slf4j.Logger;
Expand Down Expand Up @@ -65,11 +64,13 @@ public JabRefGUI(Stage mainStage, List<ParserResult> databases, boolean isBlank,
preferencesService.getInternalPreferences())
.checkForNewVersionDelayed();

if (JabRefPreferences.getInstance().getProxyPreferences().shouldUseAuthentication()){
if (preferencesService.getProxyPreferences().shouldUseAuthentication()){
DialogService dialogService = Injector.instantiateModelOrService(DialogService.class);
PreferencesDialogView preferencesDialogView = new PreferencesDialogView(this.mainFrame);
preferencesDialogView.getPreferenceTabList().getSelectionModel().select(20);
dialogService.showCustomDialog(preferencesDialogView);
dialogService.showPasswordDialogAndWait("Proxy configuration", "Proxy requires password","Password")
.ifPresent(newPassword -> {
preferencesService.getProxyPreferences().setPassword(newPassword);
ProxyRegisterer.register(preferencesService.getProxyPreferences());
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ public PreferencesDialogViewModel getViewModel() {
return viewModel;
}

public ListView<PreferencesTab> getPreferenceTabList() {return preferenceTabList;}

@FXML
private void initialize() {
viewModel = new PreferencesDialogViewModel(dialogService, preferencesService, frame);
Expand Down

0 comments on commit 828110f

Please sign in to comment.