Choose a local channel when opening a server link
This commit is contained in:
1 parent
031b8b086b
commit
f606c65858
3 files changed
+49
No files matched your search
@@ -14,6 +14,7 @@
|
||||
#include "dminvitedialog.h"
|
||||
#include "debug_ui.h"
|
||||
#include "inviteby.h"
|
||||
#include <QInputDialog>
|
||||
#include "joindialog.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "channelsettingsdialog.h"
|
||||
@@ -1156,6 +1157,19 @@ void MainWindow::onMessageLinkActivated(const QString& link) {
|
||||
"The core is not running.")); return;
|
||||
}
|
||||
const QString channelId = QString::number(invite.channelId);
|
||||
if (invite.kind == INVITE_KIND_SERVER) {
|
||||
QStringList ids, labels;
|
||||
for (const auto& channel : m_db->getChannels()) {
|
||||
if (!m_db->isChannelMember(channel.channelId, m_db->myNodeId())) continue;
|
||||
ids.append(channel.channelId); labels.append(channel.name + " (" + channel.channelId + ")");
|
||||
}
|
||||
bool accepted = false;
|
||||
const QString selected = QInputDialog::getItem(this, QCoreApplication::translate("ChatGui", "Add server to channel"),
|
||||
QCoreApplication::translate("ChatGui", "Channel:"), labels, qMax(0, ids.indexOf(m_currentChannelId)), false, &accepted);
|
||||
int index = labels.indexOf(selected);
|
||||
if (!accepted || index < 0) return;
|
||||
InviteByLinkDialog dialog(ids[index], m_node, this, link); dialog.exec(); return;
|
||||
}
|
||||
for (const auto& channel : m_db->getChannels()) {
|
||||
if (channel.channelId == channelId && m_db->isChannelMember(channelId, m_db->myNodeId())) {
|
||||
GUI_INFO("invite link: opening existing group ch=%s", qPrintable(channelId));
|
||||
@@ -1322,6 +1336,9 @@ void MainWindow::showJoinDialog() {
|
||||
autoLink = selText;
|
||||
}
|
||||
|
||||
if (!autoLink.isEmpty() && decodeInviteLink(autoLink).kind == INVITE_KIND_SERVER) {
|
||||
onMessageLinkActivated(autoLink); return;
|
||||
}
|
||||
QPointer<JoinDialog> dialog = new JoinDialog(m_node, m_db, this, autoLink);
|
||||
auto release = qScopeGuard([&] { delete dialog.data(); }); dialog->exec();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
<TS version="2.1" language="en_US" sourcelanguage="en_US">
|
||||
<context>
|
||||
<name>ChatGui</name>
|
||||
<message>
|
||||
<source>The server access key is invalid or has changed.</source>
|
||||
<translation>The server access key is invalid or has changed.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Select a channel and use Invite by link to add this server.</source>
|
||||
<translation>Select a channel and use Invite by link to add this server.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Add server to channel</source>
|
||||
<translation>Add server to channel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Channel:</source>
|
||||
<translation>Channel:</translation>
|
||||
</message>
|
||||
<message><source>Could not complete the request.</source><translation>Could not complete the request.</translation></message>
|
||||
<message><source>Invalid request or chat service unavailable.</source><translation>Invalid request or chat service unavailable.</translation></message>
|
||||
<message><source>The request timed out.</source><translation>The request timed out.</translation></message>
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
<TS version="2.1" language="ru_RU" sourcelanguage="en_US">
|
||||
<context>
|
||||
<name>ChatGui</name>
|
||||
<message>
|
||||
<source>The server access key is invalid or has changed.</source>
|
||||
<translation>Ключ доступа к серверу неверен или был изменён.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Select a channel and use Invite by link to add this server.</source>
|
||||
<translation>Выберите канал и используйте «Пригласить по ссылке», чтобы добавить сервер.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Add server to channel</source>
|
||||
<translation>Добавить сервер в канал</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Channel:</source>
|
||||
<translation>Канал:</translation>
|
||||
</message>
|
||||
<message><source>Could not complete the request.</source><translation>Не удалось выполнить запрос.</translation></message>
|
||||
<message><source>Invalid request or chat service unavailable.</source><translation>Некорректный запрос или сервис чата недоступен.</translation></message>
|
||||
<message><source>The request timed out.</source><translation>Истекло время ожидания запроса.</translation></message>
|
||||
|
||||
Reference in new issue
Block a user