Android: bookmark edit page, and bookmarks that join a channel

Edit from a bookmark's menu or create from the connect form: name,
address, passwords, identity, nickname, and the channel to join, picked
from the server's channels while connected there. The channel and server
sheets add the server as a bookmark joining that channel.

Bookmarking the current server takes the connect's own nickname and
password (core ServerSession.toBookmark), on desktop too, rather than the
global ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 18:26:18 +00:00
co-authored by Claude Opus 5.5
parent ad7bb4fc6e
commit 33066f454a
9 changed files with 214 additions and 71 deletions
@@ -1,6 +1,7 @@
package com.ts3client.session;
import com.ts3client.audio.AudioBackend;
import com.ts3client.config.Bookmark;
import com.ts3client.config.IdentityEntry;
import com.ts3client.config.IdentityStore;
import com.ts3client.config.Settings;
@@ -135,6 +136,19 @@ public final class ServerSession {
return identityId;
}
/**
* A bookmark leading back here: this server under its name, with the nickname, password and
* identity of the last connect, joining {@code channel}. Null before a first connect.
*/
public Bookmark toBookmark(String channel) {
Target target = lastTarget;
if (target == null) return null;
Bookmark b = new Bookmark(title, target.address(), target.port(), target.nickname(), target.password());
b.identityId = identityId;
b.channel = channel == null ? "" : channel;
return b;
}
// ---- connection lifecycle ----
/**
@@ -826,8 +826,6 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
"Add bookmark", JOptionPane.INFORMATION_MESSAGE);
return;
}
String addr = selected.session().address();
int port = selected.session().port();
String channelPath = selected.session().currentChannelPath();
JTextField labelField = new JTextField(selected.session().title());
@@ -840,10 +838,8 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) != JOptionPane.OK_OPTION) {
return;
}
Bookmark bookmark = new Bookmark(labelField.getText().trim(), addr, port,
settings.nickname, settings.serverPassword);
bookmark.identityId = selected.session().identityId();
if (joinChannel.isSelected()) bookmark.channel = channelPath;
Bookmark bookmark = selected.session().toBookmark(joinChannel.isSelected() ? channelPath : "");
bookmark.label = labelField.getText().trim();
bookmarks.add(bookmark);
bookmarks.save();
menuBar.rebuildBookmarks();