mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-25 04:38:23 +00:00
Don't suggest export if one is running.
This commit is contained in:
parent
914e043abe
commit
a200771868
@ -92,17 +92,20 @@ void Session::suggestStartExport() {
|
||||
if (_exportAvailableAt <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto now = unixtime();
|
||||
const auto left = (_exportAvailableAt <= now)
|
||||
? 0
|
||||
: (_exportAvailableAt - now);
|
||||
if (!left) {
|
||||
Export::View::SuggestStart();
|
||||
} else {
|
||||
if (left) {
|
||||
App::CallDelayed(
|
||||
std::min(left + 5, 3600) * TimeMs(1000),
|
||||
_session,
|
||||
[=] { suggestStartExport(); });
|
||||
} else if (_export) {
|
||||
Export::View::ClearSuggestStart();
|
||||
} else {
|
||||
Export::View::SuggestStart();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,17 +613,11 @@ void Controller::fillMessagesState(
|
||||
int addIndex,
|
||||
int addCount) const {
|
||||
const auto &dialog = info.list[index];
|
||||
auto count = 0;
|
||||
for (const auto &dialog : info.list) {
|
||||
if (dialog.name.isEmpty()) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
result.entityIndex = index + addIndex;
|
||||
result.entityCount = info.list.size() + addCount;
|
||||
result.entityName = dialog.name;
|
||||
result.itemIndex = _messagesWritten + progress.itemIndex;
|
||||
result.itemCount = std::max(_messagesCount, result.entityIndex);
|
||||
result.itemCount = std::max(_messagesCount, result.itemIndex);
|
||||
result.bytesType = ProcessingState::FileType::File; // TODO
|
||||
if (!progress.path.isEmpty()) {
|
||||
const auto last = progress.path.lastIndexOf('/');
|
||||
|
@ -51,10 +51,7 @@ void SuggestBox::prepare() {
|
||||
return;
|
||||
}
|
||||
_cleared = true;
|
||||
|
||||
auto settings = Local::ReadExportSettings();
|
||||
settings.availableAt = 0;
|
||||
Local::WriteExportSettings(settings);
|
||||
ClearSuggestStart();
|
||||
};
|
||||
|
||||
addButton(langFactory(lng_box_ok), [=] {
|
||||
@ -92,6 +89,12 @@ void SuggestStart() {
|
||||
Ui::show(Box<SuggestBox>(), LayerOption::KeepOther);
|
||||
}
|
||||
|
||||
void ClearSuggestStart() {
|
||||
auto settings = Local::ReadExportSettings();
|
||||
settings.availableAt = 0;
|
||||
Local::WriteExportSettings(settings);
|
||||
}
|
||||
|
||||
PanelController::PanelController(not_null<ControllerWrap*> process)
|
||||
: _process(process)
|
||||
, _settings(std::make_unique<Settings>(Local::ReadExportSettings()))
|
||||
|
@ -22,6 +22,7 @@ namespace Export {
|
||||
namespace View {
|
||||
|
||||
void SuggestStart();
|
||||
void ClearSuggestStart();
|
||||
|
||||
class Panel;
|
||||
|
||||
|
@ -50,6 +50,9 @@ void fillCodes() {
|
||||
Messenger::Instance().onSwitchDebugMode();
|
||||
}));
|
||||
});
|
||||
Codes.insert(qsl("viewlogs"), [] {
|
||||
File::ShowInFolder(cWorkingDir() + "log.txt");
|
||||
});
|
||||
Codes.insert(qsl("testmode"), [] {
|
||||
auto text = cTestMode() ? qsl("Do you want to disable TEST mode?") : qsl("Do you want to enable TEST mode?\n\nYou will be switched to test cloud.");
|
||||
Ui::show(Box<ConfirmBox>(text, [] {
|
||||
|
Loading…
Reference in New Issue
Block a user