fixed update downloader destroy, select message outside message rect from context menu

This commit is contained in:
John Preston 2014-11-27 21:58:51 +03:00
parent 5aecf2d3a3
commit 9d0f1c4e43
4 changed files with 13 additions and 5 deletions

View File

@ -179,6 +179,7 @@ void Application::onAppUpdate(const MTPhelp_AppUpdate &response) {
startUpdateCheck();
} else {
updateThread = new QThread();
connect(updateThread, SIGNAL(finished()), updateThread, SLOT(deleteLater()));
updateDownloader = new PsUpdateDownloader(updateThread, response.c_help_appUpdate());
updateThread->start();
}
@ -201,6 +202,7 @@ void Application::updateGotCurrent() {
int32 currentVersion = m.captured(1).toInt();
if (currentVersion > AppVersion) {
updateThread = new QThread();
connect(updateThread, SIGNAL(finished()), updateThread, SLOT(deleteLater()));
updateDownloader = new PsUpdateDownloader(updateThread, m.captured(2));
updateThread->start();
}
@ -247,7 +249,7 @@ void Application::onUpdateFailed() {
if (updateDownloader) {
updateDownloader->deleteLater();
updateDownloader = 0;
if (updateThread) updateThread->deleteLater();
if (updateThread) updateThread->quit();
updateThread = 0;
}
@ -477,7 +479,7 @@ void Application::stopUpdate() {
if (updateDownloader) {
updateDownloader->deleteLater();
updateDownloader = 0;
if (updateThread) updateThread->deleteLater();
if (updateThread) updateThread->quit();
updateThread = 0;
}
}
@ -775,9 +777,9 @@ Application::~Application() {
delete updateReply;
delete ::uploader;
updateReply = 0;
delete updateDownloader;
if (updateDownloader) updateDownloader->deleteLater();
updateDownloader = 0;
delete updateThread;
if (updateThread) updateThread->quit();
updateThread = 0;
delete window;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

@ -711,7 +711,7 @@ void HistoryList::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_menu->addAction(lang(lng_context_forward_selected), historyWidget, SLOT(onForwardSelected()));
_menu->addAction(lang(lng_context_delete_selected), historyWidget, SLOT(onDeleteSelected()));
_menu->addAction(lang(lng_context_clear_selection), historyWidget, SLOT(onClearSelected()));
} else {
} else if (item) {
if (!_menu) _menu = new ContextMenu(this);
if (isUponSelected != -2) {
if (canForward) {
@ -723,6 +723,12 @@ void HistoryList::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}
}
_menu->addAction(lang(lng_context_select_msg), historyWidget, SLOT(selectMessage()))->setEnabled(true);
} else {
if (App::mousedItem() && App::mousedItem()->itemType() == HistoryItem::MsgType) {
if (!_menu) _menu = new ContextMenu(this);
_menu->addAction(lang(lng_context_select_msg), historyWidget, SLOT(selectMessage()))->setEnabled(true);
item = App::mousedItem();
}
}
App::contextItem(item);
}