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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user