Two-column bookmark manager with connect-on-startup
Replace the modal add/edit form with a master/detail dialog: bookmark list on the left, the selected bookmark's settings on the right. Edits are flushed back into the bookmark when the selection changes or the dialog closes. Bookmarks gain a "connect on startup" flag (only one at a time, since the client holds a single connection); MainFrame connects to it once the window is up. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,8 @@ public final class Bookmark {
|
||||
public String channel = "";
|
||||
/** Password for {@link #channel}, if it is protected. */
|
||||
public String channelPassword = "";
|
||||
/** Connect to this server automatically when the client starts. */
|
||||
public boolean connectOnStartup = false;
|
||||
|
||||
public Bookmark() {
|
||||
}
|
||||
|
||||
@@ -30,6 +30,14 @@ public final class Bookmarks {
|
||||
if (index >= 0 && index < entries.size()) entries.remove(index);
|
||||
}
|
||||
|
||||
/** First bookmark flagged to connect at startup, or {@code null}. */
|
||||
public Bookmark startupBookmark() {
|
||||
for (Bookmark b : entries) {
|
||||
if (b.connectOnStartup) return b;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Bookmarks load() {
|
||||
Bookmarks b = new Bookmarks();
|
||||
if (!FILE.isFile()) return b;
|
||||
@@ -51,6 +59,7 @@ public final class Bookmarks {
|
||||
bm.identityId = p.getProperty(prefix + "identityId", "");
|
||||
bm.channel = p.getProperty(prefix + "channel", "");
|
||||
bm.channelPassword = p.getProperty(prefix + "channelPassword", "");
|
||||
bm.connectOnStartup = Boolean.parseBoolean(p.getProperty(prefix + "connectOnStartup", "false"));
|
||||
if (bm.address != null && !bm.address.isBlank()) b.entries.add(bm);
|
||||
}
|
||||
return b;
|
||||
@@ -70,6 +79,7 @@ public final class Bookmarks {
|
||||
p.setProperty(prefix + "identityId", nullToEmpty(bm.identityId));
|
||||
p.setProperty(prefix + "channel", nullToEmpty(bm.channel));
|
||||
p.setProperty(prefix + "channelPassword", nullToEmpty(bm.channelPassword));
|
||||
p.setProperty(prefix + "connectOnStartup", Boolean.toString(bm.connectOnStartup));
|
||||
}
|
||||
try {
|
||||
if (!DIR.isDirectory()) {
|
||||
|
||||
Reference in New Issue
Block a user