mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Implement drag-n-drop to forum topics.
This commit is contained in:
@@ -151,6 +151,13 @@ public:
|
||||
return SectionActionResult::Ignore;
|
||||
}
|
||||
|
||||
virtual bool confirmSendingFiles(const QStringList &files) {
|
||||
return false;
|
||||
}
|
||||
virtual bool confirmSendingFiles(not_null<const QMimeData*> data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create a memento of that section to store it in the history stack.
|
||||
// This method may modify the section ("take" heavy items).
|
||||
virtual std::shared_ptr<SectionMemento> createMemento();
|
||||
|
@@ -1542,20 +1542,20 @@ QPointer<Ui::BoxContent> ShowForwardMessagesBox(
|
||||
std::move(successCallback));
|
||||
}
|
||||
|
||||
QPointer<Ui::BoxContent> ShowForwardMessagesBox(
|
||||
QPointer<Ui::BoxContent> ShowDropMediaBox(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
Data::ForwardDraft &&draft,
|
||||
std::shared_ptr<QMimeData> data,
|
||||
not_null<Data::Forum*> forum,
|
||||
FnMut<void()> &&successCallback) {
|
||||
const auto weak = std::make_shared<QPointer<Ui::BoxContent>>();
|
||||
auto chosen = [
|
||||
draft = std::move(draft),
|
||||
data = std::move(data),
|
||||
callback = std::move(successCallback),
|
||||
weak,
|
||||
navigation
|
||||
](not_null<Data::ForumTopic*> topic) mutable {
|
||||
const auto content = navigation->parentController()->content();
|
||||
if (!content->setForwardDraft(topic, std::move(draft))) {
|
||||
if (!content->onFilesOrForwardDrop(topic, data.get())) {
|
||||
return;
|
||||
} else if (const auto strong = *weak) {
|
||||
strong->closeBox();
|
||||
|
@@ -122,9 +122,9 @@ QPointer<Ui::BoxContent> ShowForwardMessagesBox(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
MessageIdsList &&items,
|
||||
FnMut<void()> &&successCallback = nullptr);
|
||||
QPointer<Ui::BoxContent> ShowForwardMessagesBox(
|
||||
QPointer<Ui::BoxContent> ShowDropMediaBox(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
Data::ForwardDraft &&draft,
|
||||
std::shared_ptr<QMimeData> data,
|
||||
not_null<Data::Forum*> forum,
|
||||
FnMut<void()> &&successCallback = nullptr);
|
||||
|
||||
|
@@ -1670,26 +1670,19 @@ void SessionController::showPeerHistory(
|
||||
}
|
||||
|
||||
void SessionController::showMessage(
|
||||
not_null<const HistoryItem*> item) {
|
||||
not_null<const HistoryItem*> item,
|
||||
const SectionShow ¶ms) {
|
||||
_window->invokeForSessionController(
|
||||
&item->history()->peer->session().account(),
|
||||
&item->history()->session().account(),
|
||||
item->history()->peer,
|
||||
[&](not_null<SessionController*> controller) {
|
||||
if (item->isScheduled()) {
|
||||
controller->showSection(
|
||||
std::make_shared<HistoryView::ScheduledMemento>(
|
||||
item->history()),
|
||||
SectionShow::Way::ClearStack);
|
||||
} else if (const auto topic = item->topic()) {
|
||||
controller->showTopic(
|
||||
topic,
|
||||
item->id,
|
||||
SectionShow::Way::ClearStack);
|
||||
params);
|
||||
} else {
|
||||
controller->showPeerHistory(
|
||||
item->history()->peer,
|
||||
SectionShow::Way::ClearStack,
|
||||
item->id);
|
||||
controller->content()->showMessage(item, params);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@@ -431,7 +431,9 @@ public:
|
||||
const SectionShow ¶ms = SectionShow::Way::ClearStack,
|
||||
MsgId msgId = ShowAtUnreadMsgId) override;
|
||||
|
||||
void showMessage(not_null<const HistoryItem*> item);
|
||||
void showMessage(
|
||||
not_null<const HistoryItem*> item,
|
||||
const SectionShow ¶ms = SectionShow::Way::ClearStack);
|
||||
void cancelUploadLayer(not_null<HistoryItem*> item);
|
||||
|
||||
void showLayer(
|
||||
|
Reference in New Issue
Block a user