Connect a left-clicked bookmark on the current tab
Middle-click still opens the server in a new tab. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -202,7 +202,8 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectBookmark(Bookmark bookmark) {
|
||||
public void onConnectBookmark(Bookmark bookmark, boolean newTab) {
|
||||
if (newTab) selectTab(newTab());
|
||||
connectToBookmark(bookmark);
|
||||
}
|
||||
|
||||
@@ -571,21 +572,31 @@ public final class MainFrame extends JFrame implements ServerTabPane.Listener {
|
||||
*/
|
||||
private void startConnection(String address, int port, String nickname, String password, String identityId,
|
||||
String channel, String channelPassword) {
|
||||
startConnection(address, port, nickname, password, identityId, channel, channelPassword, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param replaceCurrent connect on the current tab, leaving the server it is on, instead of
|
||||
* moving to a free tab
|
||||
*/
|
||||
private void startConnection(String address, int port, String nickname, String password, String identityId,
|
||||
String channel, String channelPassword, boolean replaceCurrent) {
|
||||
settings.lastAddress = address + ":" + port;
|
||||
settings.nickname = nickname;
|
||||
settings.serverPassword = password;
|
||||
settings.save();
|
||||
|
||||
ServerTab tab = tabForNewConnection();
|
||||
ServerTab tab = (replaceCurrent && selected != null) ? selected : tabForNewConnection();
|
||||
// The first connection to come up takes the microphone; later ones are muted
|
||||
// until the user activates them.
|
||||
if (micTab == null) setMicTab(tab);
|
||||
tab.connect(address, port, nickname, password, identityId, channel, channelPassword);
|
||||
tab.switchTo(address, port, nickname, password, identityId, channel, channelPassword);
|
||||
}
|
||||
|
||||
/** Connects on the current tab, leaving whatever server it is on. */
|
||||
private void connectToBookmark(Bookmark b) {
|
||||
String nick = (b.nickname != null && !b.nickname.isBlank()) ? b.nickname : settings.nickname;
|
||||
startConnection(b.address, b.port, nick, b.password, b.identityId, b.channel, b.channelPassword);
|
||||
startConnection(b.address, b.port, nick, b.password, b.identityId, b.channel, b.channelPassword, true);
|
||||
}
|
||||
|
||||
private void addCurrentServerBookmark() {
|
||||
|
||||
Reference in New Issue
Block a user