Merge pull request #322 from Varinara/feature
added additional button for clearing history
This commit is contained in:
commit
7363efed6a
@ -662,13 +662,47 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
saveHistory();
|
saveHistory();
|
||||||
});
|
});
|
||||||
historyButtonClear.addActionListener(event -> {
|
historyButtonClear.addActionListener(event -> {
|
||||||
|
if (Utils.getConfigBoolean("history.warn_before_delete", true)) {
|
||||||
|
|
||||||
|
JPanel checkChoise = new JPanel();
|
||||||
|
checkChoise.setLayout(new FlowLayout());
|
||||||
|
JButton yesButton = new JButton("YES");
|
||||||
|
JButton noButton = new JButton("NO");
|
||||||
|
yesButton.setPreferredSize(new Dimension(70, 30));
|
||||||
|
noButton.setPreferredSize(new Dimension(70, 30));
|
||||||
|
checkChoise.add(yesButton);
|
||||||
|
checkChoise.add(noButton);
|
||||||
|
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||||
|
JFrame frame = new JFrame("Are you sure?");
|
||||||
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
frame.add(checkChoise);
|
||||||
|
frame.setSize(405, 70);
|
||||||
|
frame.setVisible(true);
|
||||||
|
frame.setLocationRelativeTo(null);
|
||||||
|
noButton.addActionListener(e -> {
|
||||||
|
frame.setVisible(false);
|
||||||
|
});
|
||||||
|
yesButton.addActionListener(ed -> {
|
||||||
|
frame.setVisible(false);
|
||||||
Utils.clearURLHistory();
|
Utils.clearURLHistory();
|
||||||
HISTORY.clear();
|
HISTORY.clear();
|
||||||
try {
|
try {
|
||||||
historyTableModel.fireTableDataChanged();
|
historyTableModel.fireTableDataChanged();
|
||||||
} catch (Exception e) { }
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
saveHistory();
|
saveHistory();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Utils.clearURLHistory();
|
||||||
|
HISTORY.clear();
|
||||||
|
try {
|
||||||
|
historyTableModel.fireTableDataChanged();
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
saveHistory();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Re-rip all history
|
// Re-rip all history
|
||||||
historyButtonRerip.addActionListener(event -> {
|
historyButtonRerip.addActionListener(event -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user