2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Moved file click handlers to separated file.

This commit is contained in:
23rd
2021-06-18 02:28:09 +03:00
parent 8834ec8bf2
commit 3fd772ce17
29 changed files with 421 additions and 398 deletions

View File

@@ -468,52 +468,3 @@ auto PhotoData::createStreamingLoader(
origin)
: nullptr;
}
PhotoClickHandler::PhotoClickHandler(
not_null<PhotoData*> photo,
FullMsgId context,
PeerData *peer)
: FileClickHandler(&photo->session(), context)
, _photo(photo)
, _peer(peer) {
}
PhotoOpenClickHandler::PhotoOpenClickHandler(
not_null<PhotoData*> photo,
Fn<void()> &&callback)
: PhotoClickHandler(photo)
, _handler(std::move(callback)) {
}
void PhotoOpenClickHandler::onClickImpl() const {
if (_handler) {
_handler();
}
}
void PhotoSaveClickHandler::onClickImpl() const {
const auto data = photo();
if (!data->date) {
return;
} else {
data->clearFailed(PhotoSize::Large);
data->load(context());
}
}
void PhotoCancelClickHandler::onClickImpl() const {
const auto data = photo();
if (!data->date) {
return;
} else if (data->uploading()) {
if (const auto item = data->owner().message(context())) {
if (const auto m = App::main()) { // multi good
if (&m->session() == &data->session()) {
m->cancelUploadLayer(item);
}
}
}
} else {
data->cancel();
}
}