mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Removed App::searchByHashtag from facades.
This commit is contained in:
parent
93bcd90fd4
commit
05f1caf944
3 changed files with 34 additions and 21 deletions
|
@ -11,10 +11,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/local_url_handlers.h"
|
#include "core/local_url_handlers.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "base/qthelp_regex.h"
|
#include "base/qthelp_regex.h"
|
||||||
#include "storage/storage_account.h"
|
#include "storage/storage_account.h"
|
||||||
|
#include "history/history.h"
|
||||||
#include "history/view/history_view_element.h"
|
#include "history/view/history_view_element.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
|
@ -25,6 +27,36 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include <QtGui/QGuiApplication>
|
#include <QtGui/QGuiApplication>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void SearchByHashtag(ClickContext context, const QString &tag) {
|
||||||
|
const auto my = context.other.value<ClickHandlerContext>();
|
||||||
|
const auto controller = my.sessionWindow.get();
|
||||||
|
if (!controller) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (controller->openedFolder().current()) {
|
||||||
|
controller->closeFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
controller->widget()->ui_hideSettingsAndLayer(anim::type::normal);
|
||||||
|
Core::App().hideMediaView();
|
||||||
|
|
||||||
|
auto &data = controller->session().data();
|
||||||
|
const auto inPeer = my.peer
|
||||||
|
? my.peer
|
||||||
|
: my.itemId
|
||||||
|
? data.message(my.itemId)->history()->peer
|
||||||
|
: nullptr;
|
||||||
|
controller->content()->searchMessages(
|
||||||
|
tag + ' ',
|
||||||
|
(inPeer && !inPeer->isUser())
|
||||||
|
? data.history(inPeer).get()
|
||||||
|
: Dialogs::Key());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
bool UrlRequiresConfirmation(const QUrl &url) {
|
bool UrlRequiresConfirmation(const QUrl &url) {
|
||||||
using namespace qthelp;
|
using namespace qthelp;
|
||||||
|
|
||||||
|
@ -159,7 +191,7 @@ QString HashtagClickHandler::copyToClipboardContextItemText() const {
|
||||||
void HashtagClickHandler::onClick(ClickContext context) const {
|
void HashtagClickHandler::onClick(ClickContext context) const {
|
||||||
const auto button = context.button;
|
const auto button = context.button;
|
||||||
if (button == Qt::LeftButton || button == Qt::MiddleButton) {
|
if (button == Qt::LeftButton || button == Qt::MiddleButton) {
|
||||||
App::searchByHashtag(_tag, Ui::getPeerForMouseAction());
|
SearchByHashtag(context, _tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +206,7 @@ QString CashtagClickHandler::copyToClipboardContextItemText() const {
|
||||||
void CashtagClickHandler::onClick(ClickContext context) const {
|
void CashtagClickHandler::onClick(ClickContext context) const {
|
||||||
const auto button = context.button;
|
const auto button = context.button;
|
||||||
if (button == Qt::LeftButton || button == Qt::MiddleButton) {
|
if (button == Qt::LeftButton || button == Qt::MiddleButton) {
|
||||||
App::searchByHashtag(_tag, Ui::getPeerForMouseAction());
|
SearchByHashtag(context, _tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,24 +215,6 @@ void activateBotCommand(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void searchByHashtag(const QString &tag, PeerData *inPeer) {
|
|
||||||
const auto m = inPeer
|
|
||||||
? CheckMainWidget(&inPeer->session())
|
|
||||||
: App::main(); // multi good
|
|
||||||
if (m) {
|
|
||||||
if (m->controller()->openedFolder().current()) {
|
|
||||||
m->controller()->closeFolder();
|
|
||||||
}
|
|
||||||
Ui::hideSettingsAndLayer();
|
|
||||||
Core::App().hideMediaView();
|
|
||||||
m->searchMessages(
|
|
||||||
tag + ' ',
|
|
||||||
(inPeer && !inPeer->isUser())
|
|
||||||
? inPeer->owner().history(inPeer).get()
|
|
||||||
: Dialogs::Key());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace App
|
} // namespace App
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
|
@ -47,7 +47,6 @@ void activateBotCommand(
|
||||||
not_null<const HistoryItem*> msg,
|
not_null<const HistoryItem*> msg,
|
||||||
int row,
|
int row,
|
||||||
int column);
|
int column);
|
||||||
void searchByHashtag(const QString &tag, PeerData *inPeer);
|
|
||||||
|
|
||||||
} // namespace App
|
} // namespace App
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue