mirror of https://github.com/procxx/kepka.git
Added restoring of scroll position after edit items in SendFilesBox.
This commit is contained in:
parent
a1bb9cbb2b
commit
12250676f9
|
@ -1745,18 +1745,24 @@ void SendFilesBox::prepareAlbumPreview() {
|
||||||
_list,
|
_list,
|
||||||
_sendWay->value()));
|
_sendWay->value()));
|
||||||
|
|
||||||
addThumbButtonHandlers();
|
addThumbButtonHandlers(wrap);
|
||||||
|
|
||||||
_preview = wrap;
|
_preview = wrap;
|
||||||
_albumPreview->show();
|
_albumPreview->show();
|
||||||
setupShadows(wrap, _albumPreview);
|
setupShadows(wrap, _albumPreview);
|
||||||
|
|
||||||
initPreview(_albumPreview->desiredHeightValue());
|
initPreview(_albumPreview->desiredHeightValue());
|
||||||
|
|
||||||
|
crl::on_main([=] {
|
||||||
|
wrap->scrollToY(_lastScrollTop);
|
||||||
|
_lastScrollTop = 0;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::addThumbButtonHandlers() {
|
void SendFilesBox::addThumbButtonHandlers(not_null<Ui::ScrollArea*> wrap) {
|
||||||
_albumPreview->thumbDeleted(
|
_albumPreview->thumbDeleted(
|
||||||
) | rpl::start_with_next([=](auto index) {
|
) | rpl::start_with_next([=](auto index) {
|
||||||
|
_lastScrollTop = wrap->scrollTop();
|
||||||
|
|
||||||
_list.files.erase(_list.files.begin() + index);
|
_list.files.erase(_list.files.begin() + index);
|
||||||
applyAlbumOrder();
|
applyAlbumOrder();
|
||||||
|
@ -1780,6 +1786,7 @@ void SendFilesBox::addThumbButtonHandlers() {
|
||||||
|
|
||||||
_albumPreview->thumbChanged(
|
_albumPreview->thumbChanged(
|
||||||
) | rpl::start_with_next([=](auto index) {
|
) | rpl::start_with_next([=](auto index) {
|
||||||
|
_lastScrollTop = wrap->scrollTop();
|
||||||
|
|
||||||
const auto callback = [=](FileDialog::OpenResult &&result) {
|
const auto callback = [=](FileDialog::OpenResult &&result) {
|
||||||
FileDialogCallback(
|
FileDialogCallback(
|
||||||
|
|
|
@ -120,7 +120,7 @@ private:
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
void updateCaptionPlaceholder();
|
void updateCaptionPlaceholder();
|
||||||
|
|
||||||
void addThumbButtonHandlers();
|
void addThumbButtonHandlers(not_null<Ui::ScrollArea*> wrap);
|
||||||
|
|
||||||
bool canAddFiles(not_null<const QMimeData*> data) const;
|
bool canAddFiles(not_null<const QMimeData*> data) const;
|
||||||
bool addFiles(not_null<const QMimeData*> data);
|
bool addFiles(not_null<const QMimeData*> data);
|
||||||
|
@ -169,6 +169,8 @@ private:
|
||||||
int _albumVideosCount = 0;
|
int _albumVideosCount = 0;
|
||||||
int _albumPhotosCount = 0;
|
int _albumPhotosCount = 0;
|
||||||
|
|
||||||
|
int _lastScrollTop = 0;
|
||||||
|
|
||||||
QPointer<Ui::RoundButton> _send;
|
QPointer<Ui::RoundButton> _send;
|
||||||
QPointer<Ui::RoundButton> _addFileToAlbum;
|
QPointer<Ui::RoundButton> _addFileToAlbum;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue