some improvements and fixes
This commit is contained in:
parent
bf1ec599ee
commit
392e70ba01
@ -146,6 +146,9 @@ public class KeepassApp extends JFrame {
|
|||||||
initMenuBar();
|
initMenuBar();
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
|
// Try to load last opened database
|
||||||
|
loadLastDatabase();
|
||||||
|
|
||||||
// Small delay to let OS/Window Manager settle before checking tray
|
// Small delay to let OS/Window Manager settle before checking tray
|
||||||
Timer trayTimer = new Timer(1000, e -> initSystemTray());
|
Timer trayTimer = new Timer(1000, e -> initSystemTray());
|
||||||
trayTimer.setRepeats(false);
|
trayTimer.setRepeats(false);
|
||||||
@ -441,29 +444,16 @@ public class KeepassApp extends JFrame {
|
|||||||
int row = entryTable.rowAtPoint(e.getPoint());
|
int row = entryTable.rowAtPoint(e.getPoint());
|
||||||
int col = entryTable.columnAtPoint(e.getPoint());
|
int col = entryTable.columnAtPoint(e.getPoint());
|
||||||
if (row >= 0 && col >= 0) {
|
if (row >= 0 && col >= 0) {
|
||||||
|
// Double click on username (col 1) or password (col 2) copies to clipboard
|
||||||
|
if (col == 1 || col == 2) {
|
||||||
int modelRow = entryTable.convertRowIndexToModel(row);
|
int modelRow = entryTable.convertRowIndexToModel(row);
|
||||||
Entry entry = currentEntries.get(modelRow);
|
Entry entry = currentEntries.get(modelRow);
|
||||||
String content;
|
String content = (col == 1) ? entry.getUsername() : entry.getPassword();
|
||||||
switch (col) {
|
|
||||||
case 0:
|
|
||||||
content = entry.getTitle();
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
content = entry.getUsername();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
content = entry.getPassword();
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
content = entry.getUrl();
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
content = entry.getNotes();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
content = "";
|
|
||||||
}
|
|
||||||
copyTextToClipboard(content, entryTable.getColumnName(col));
|
copyTextToClipboard(content, entryTable.getColumnName(col));
|
||||||
|
} else {
|
||||||
|
// Double click on other columns opens edit dialog
|
||||||
|
editEntry();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -701,6 +691,25 @@ public class KeepassApp extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadLastDatabase() {
|
||||||
|
String recentFiles = prefs.get(PREF_RECENT_LIST, "");
|
||||||
|
if (recentFiles.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] paths = recentFiles.split(";");
|
||||||
|
if (paths.length == 0 || paths[0].isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String lastFilePath = paths[0];
|
||||||
|
File lastFile = new File(lastFilePath);
|
||||||
|
|
||||||
|
if (lastFile.exists()) {
|
||||||
|
openDatabase(lastFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void saveDatabase() {
|
private void saveDatabase() {
|
||||||
if (database == null || currentFile == null || currentPassword == null) {
|
if (database == null || currentFile == null || currentPassword == null) {
|
||||||
JOptionPane.showMessageDialog(this, "No database open to save.", "Warning", JOptionPane.WARNING_MESSAGE);
|
JOptionPane.showMessageDialog(this, "No database open to save.", "Warning", JOptionPane.WARNING_MESSAGE);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user