Class SetupEmailDialogController
java.lang.Object
page.codeberg.friedolyn.gui.controllers.Controller<Configuration>
page.codeberg.friedolyn.gui.controllers.DialogController<Configuration,EMailNotifier>
page.codeberg.friedolyn.gui.controllers.SetupEmailDialogController
- All Implemented Interfaces:
javafx.fxml.Initializable,Preparable<Configuration>
Specifies the behaviour of the
GUI.Window.SETUP_EMAIL_DIALOG dialog.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate javafx.scene.layout.BorderPaneprivate javafx.scene.control.CheckBoxprivate EMailNotifierTheEMailNotifierthat is being set up by the user.private static final @NonNull URLThe Evolution website.private javafx.scene.control.Labelprivate javafx.scene.control.Labelprivate javafx.scene.control.Hyperlinkprivate javafx.scene.control.Labelprivate static final @NonNull URLThe K-9 Mail website.private @NonNull ResourceBundleContains the translations for the dialog's text elements and popups.private BooleanThe result of the dialog.private javafx.scene.control.TextAreaprivate static final @NonNull URLThe Thunderbird website. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Makes the dialog disappear from the user's screen.voidconfirm()The user confirms their input in order to close the dialog.@NonNull Optional<EMailNotifier> @NonNull FuzzyBooleanvoidinitialize(URL location, ResourceBundle resources) It is required to callprepare(page.codeberg.friedolyn.configuration.Configuration)immediately after this method.voidvoidOpenstheK-9 Mail websitein the user's default web browser.voidOpenstheThunderbird websitein the user's default web browser.voidprepare(@NonNull Configuration configuration) Uses the givenConfigurationto insert the user's current e-mail setup into the dialog.voidSends a test notification to the user's e-mail address to verify that the setup is correct.private voidtoggleHidePgpTextArea(boolean hide) Switches the visibility of the PGP public key text area.private booleanvalidate()Validates the user's input and updates theemailNotifieraccordingly.
-
Field Details
-
K9_WEBSITE
-
THUNDERBIRD_WEBSITE
The Thunderbird website. -
EVOLUTION_WEBSITE
-
resourceBundle
Contains the translations for the dialog's text elements and popups. -
emailNotifier
TheEMailNotifierthat is being set up by the user. -
result
The result of the dialog.trueif the user confirmed the dialog,falseif the user cancelled it,nullif the dialog is still open. -
borderPane
private javafx.scene.layout.BorderPane borderPane -
hyperlinkK9Mail
private javafx.scene.control.Label hyperlinkK9Mail -
hyperlinkThunderbird
private javafx.scene.control.Label hyperlinkThunderbird -
hyperlinkEvolution
private javafx.scene.control.Label hyperlinkEvolution -
checkBoxPGP
private javafx.scene.control.CheckBox checkBoxPGP -
textAreaPgpPaste
private javafx.scene.control.TextArea textAreaPgpPaste -
hyperlinkTest
private javafx.scene.control.Hyperlink hyperlinkTest
-
-
Constructor Details
-
SetupEmailDialogController
public SetupEmailDialogController()
-
-
Method Details
-
initialize
It is required to callprepare(page.codeberg.friedolyn.configuration.Configuration)immediately after this method.- Parameters:
location- SeeInitializable.initialize(java.net.URL, java.util.ResourceBundle).resources- SeeInitializable.initialize(java.net.URL, java.util.ResourceBundle).
-
toggleHidePgpTextArea
private void toggleHidePgpTextArea(boolean hide) Switches the visibility of the PGP public key text area.- Parameters:
hide-trueto visually remove the text area from the dialog,falseto make it re-appear.
-
prepare
Uses the givenConfigurationto insert the user's current e-mail setup into the dialog. It is required to call this method beforeinitialize(java.net.URL, java.util.ResourceBundle).- Specified by:
preparein interfacePreparable<Configuration>- Overrides:
preparein classController<Configuration>- Parameters:
configuration- TheConfigurationto use for the setup.Configuration.getEmail()andConfiguration.getUser()must not be empty.- Throws:
IllegalArgumentException- If the configuration does not contain an e-mail address or no user.- See Also:
-
openK9Website
public void openK9Website()OpenstheK-9 Mail websitein the user's default web browser. -
openThunderbirdWebsite
public void openThunderbirdWebsite()OpenstheThunderbird websitein the user's default web browser. -
openEvolutionWebsite
public void openEvolutionWebsite() -
validate
private boolean validate()Validates the user's input and updates theemailNotifieraccordingly.- Returns:
trueif the user's PGP is unset or valid,falseif it's invalid.
-
testSetup
public void testSetup()Sends a test notification to the user's e-mail address to verify that the setup is correct. -
confirm
public void confirm()The user confirms their input in order to close the dialog.Validatesthe user's input before proceeding.- Specified by:
confirmin classDialogController<Configuration,EMailNotifier>
-
getSuccess
- Overrides:
getSuccessin classController<Configuration>- Returns:
-
FuzzyBoolean.TRUEiff the user has entered valid data and closed the window or dialog. -
If
FuzzyBoolean.FALSEis returned, it means the user has entered invalid data and closed the window or dialog. -
If
FuzzyBoolean.MAYBEis returned if the window/dialog is still open or if it is unclear whether the user has entered valid data.
-
-
getResult
- Specified by:
getResultin classDialogController<Configuration,EMailNotifier> - Returns:
- The result of the dialog. May contain nonsensical data if the dialog has not been closed yet.
-
close
public void close()Makes the dialog disappear from the user's screen.- Specified by:
closein classController<Configuration>
-