Skip to content

Commit

Permalink
UI minor bugs (#1101)
Browse files Browse the repository at this point in the history
* Updated to chack signature versions for dirty rather than the URLs

* Fixed the bug when Preferences dialog was not resetting values on cancel
  • Loading branch information
sparkhi authored May 1, 2024
1 parent 7e31027 commit a84e2d8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public class DroidMainFrame extends JFrame {
private JFileChooser filterFileChooser;
private ResourceSelectorDialog resourceFileChooser;
private ButtonManager buttonManager;
private ConfigDialog configDialog;
private GlobalContext globalContext;
private JFileChooser exportFileChooser;
private SignatureInstallDialog signatureInstallDialog;
Expand Down Expand Up @@ -320,7 +319,6 @@ public void windowClosing(WindowEvent e) {

globalContext = new SpringGuiContext();
profileManager = globalContext.getProfileManager();
configDialog = new ConfigDialog(this, globalContext);
droidContext = new DroidUIContext(jProfilesTabbedPane, profileManager);
exportFileChooser = new ExportFileChooser();
filterFileChooser = new FilterFileChooser(globalContext.getGlobalConfig().getFilterDir().toFile());
Expand Down Expand Up @@ -1172,25 +1170,29 @@ private void jMenuItemCopyFilterToAllActionPerformed(java.awt.event.ActionEvent
}// GEN-LAST:event_jMenuItemCopyFIlterToAllActionPerformed

private void settingsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_settingsMenuItemActionPerformed
// initialise the dialog's values
// create the dialog and initialise the dialog's values
Map<String, Object> settings = globalContext.getGlobalConfig().getPropertiesMap();
configDialog.init(settings);

configDialog.setVisible(true);
if (configDialog.getResponse() == ConfigDialog.OK) {
try {
globalContext.getGlobalConfig().update(configDialog.getGlobalConfig());
} catch (ConfigurationException e) {
log.error("Error updating properties: " + e.getMessage(), e);
JOptionPane.showMessageDialog(configDialog, NbBundle.getMessage(ConfigDialog.class,
"ConfigDialog.error.text"),
NbBundle.getMessage(ConfigDialog.class, "ConfigDialog.error.title"), JOptionPane.ERROR_MESSAGE);

ConfigDialog configDialog = new ConfigDialog(this, globalContext);
try {
configDialog.init(settings);
configDialog.setVisible(true);
if (configDialog.getResponse() == ConfigDialog.OK) {
try {
globalContext.getGlobalConfig().update(configDialog.getGlobalConfig());
} catch (ConfigurationException e) {
log.error("Error updating properties: " + e.getMessage(), e);
JOptionPane.showMessageDialog(configDialog, NbBundle.getMessage(ConfigDialog.class,
"ConfigDialog.error.text"),
NbBundle.getMessage(ConfigDialog.class, "ConfigDialog.error.title"), JOptionPane.ERROR_MESSAGE);
}
}
}

if (configDialog.getCreateNewProfile()) {
createAndInitNewProfile();
if (configDialog.getCreateNewProfile()) {
createAndInitNewProfile();
}
} finally {
configDialog.dispose();
}
}// GEN-LAST:event_settingsMenuItemActionPerformed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public ConfigDialog(Frame owner, GlobalContext context) {

private void populatePropertyListNeedingNewProfile() {
propertiesAffectingNewProfile.addAll(
Arrays.asList(DroidGlobalProperty.BINARY_UPDATE_URL.getName(), DroidGlobalProperty.CONTAINER_UPDATE_URL.getName(),
Arrays.asList(DroidGlobalProperty.DEFAULT_BINARY_SIG_FILE_VERSION.getName(), DroidGlobalProperty.DEFAULT_CONTAINER_SIG_FILE_VERSION.getName(),
DroidGlobalProperty.PROCESS_ZIP.getName(), DroidGlobalProperty.PROCESS_TAR.getName(),
DroidGlobalProperty.PROCESS_GZIP.getName(), DroidGlobalProperty.PROCESS_RAR.getName(),
DroidGlobalProperty.PROCESS_7ZIP.getName(), DroidGlobalProperty.PROCESS_ISO.getName(),
Expand Down Expand Up @@ -907,7 +907,6 @@ private void initComponents() {
}// </editor-fold>//GEN-END:initComponents

private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
response = OK;
if (isDirtyForNewProfile()) {
int optionResponse = JOptionPane.showOptionDialog(
this,
Expand All @@ -921,9 +920,11 @@ private void okButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_okButto
);
switch (optionResponse) {
case JOptionPane.YES_OPTION:
response = OK;
automaticallyCreateNewProfile = true;
break;
case JOptionPane.NO_OPTION:
response = OK;
automaticallyCreateNewProfile = false;
break;
case JOptionPane.CANCEL_OPTION:
Expand All @@ -943,6 +944,7 @@ private boolean isDirtyForNewProfile() {
}

private void cancelButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
response = CANCEL;
dispose();
}//GEN-LAST:event_cancelButtonActionPerformed

Expand Down

0 comments on commit a84e2d8

Please sign in to comment.