2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-03 16:15:13 +00:00

Add "Open in new window" to context menu.

This commit is contained in:
John Preston
2023-02-03 19:32:25 +04:00
parent 94b489835c
commit bbd937115c
18 changed files with 92 additions and 48 deletions

View File

@@ -60,6 +60,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "api/api_chat_filters.h"
#include "base/qt/qt_common_adapters.h"
#include "styles/style_dialogs.h"
#include "styles/style_chat.h" // popupMenuExpandedSeparator
#include "styles/style_chat_helpers.h"
#include "styles/style_window.h"
#include "styles/style_menu_icons.h"
@@ -70,13 +71,6 @@ namespace {
constexpr auto kHashtagResultsLimit = 5;
constexpr auto kStartReorderThreshold = 30;
base::options::toggle CtrlClickChatNewWindow({
.id = kOptionCtrlClickChatNewWindow,
.name = "New chat window by Ctrl+Click",
.description = "Open chat in a new window by Ctrl+Click "
"(Cmd+Click on macOS).",
});
int FixedOnTopDialogsCount(not_null<Dialogs::IndexedList*> list) {
auto result = 0;
for (const auto &row : *list) {
@@ -105,8 +99,6 @@ int PinnedDialogsCount(
} // namespace
const char kOptionCtrlClickChatNewWindow[] = "ctrl-click-chat-new-window";
struct InnerWidget::CollapsedRow {
CollapsedRow(Data::Folder *folder) : folder(folder) {
}
@@ -2206,7 +2198,7 @@ void InnerWidget::contextMenuEvent(QContextMenuEvent *e) {
_menu = base::make_unique_q<Ui::PopupMenu>(
this,
row.fullId ? st::defaultPopupMenu : st::popupMenuWithIcons);
row.fullId ? st::defaultPopupMenu : st::popupMenuExpandedSeparator);
if (row.fullId) {
if (session().supportMode()) {
fillSupportSearchMenu(_menu.get());
@@ -3310,9 +3302,7 @@ bool InnerWidget::chooseRow(
const auto modifyChosenRow = [](
ChosenRow row,
Qt::KeyboardModifiers modifiers) {
if (CtrlClickChatNewWindow.value()) {
row.newWindow = (modifiers & Qt::ControlModifier);
}
row.newWindow = (modifiers & Qt::ControlModifier);
return row;
};
auto chosen = modifyChosenRow(computeChosenRow(), modifiers);