summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-01-03 19:15:44 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-01-03 19:15:44 +0300
commit09a49cfe0925494f7fd516657df7fe327c7370dd (patch)
tree44d9d0e278fe250282bbe73b082a8952bb4645c0 /plugins
parent756cbebea5281171c32d62a599cedd9657db7999 (diff)
fixes #3946 (Прогресс скачивания крупных файлов)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dbx_sqlite/src/dbevents.cpp9
-rw-r--r--plugins/NewStory/src/history_array.cpp5
-rw-r--r--plugins/NewStory/src/history_array.h5
-rw-r--r--plugins/NewStory/src/history_control.cpp18
4 files changed, 29 insertions, 8 deletions
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp
index 3d26ec28c5..81fc24fa39 100644
--- a/plugins/Dbx_sqlite/src/dbevents.cpp
+++ b/plugins/Dbx_sqlite/src/dbevents.cpp
@@ -368,6 +368,15 @@ int CDbxSQLite::SetEventJson(MEVENT hDbEvent, const char *szSetting, DBVARIANT *
}
DBFlush();
+
+ if (m_safetyMode) {
+ MCONTACT hContact = GetEventContact(hDbEvent);
+ if (auto *cc = m_cache->GetCachedContact(hContact))
+ if (cc->IsSub())
+ hContact = cc->parentID;
+
+ NotifyEventHooks(g_hevEventEdited, hContact, hDbEvent);
+ }
return 0;
}
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 2d109c1540..4e5ac3a1a5 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -401,7 +401,10 @@ void ItemData::load(bool bLoadAlways)
DB::FILE_BLOB blob(dbe);
if (blob.isOffline()) {
m_bOfflineFile = true;
- m_bOfflineDownloaded = blob.isCompleted();
+ if (blob.isCompleted())
+ m_bOfflineDownloaded = 100;
+ else
+ m_bOfflineDownloaded = uint8_t(100.0 * blob.getTransferred() / blob.getSize());
CMStringW buf;
buf.Append(blob.getName() ? blob.getName() : TranslateT("Unnamed"));
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h
index 29331d0235..afeb93e54c 100644
--- a/plugins/NewStory/src/history_array.h
+++ b/plugins/NewStory/src/history_array.h
@@ -17,8 +17,8 @@ struct ItemData
bool m_bSelected, m_bHighlighted;
bool m_bLoaded, m_bIsResult;
- bool m_bOfflineFile, m_bOfflineDownloaded;
- uint8_t m_grouping;
+ bool m_bOfflineFile;
+ uint8_t m_grouping, m_bOfflineDownloaded;
int savedTop, savedHeight;
@@ -38,6 +38,7 @@ struct ItemData
void markRead();
void setText(HWND hwnd);
+ bool completed() const { return m_bOfflineDownloaded == 100; }
bool fetch(void);
void fill(int tmpl);
void load(bool bLoad = false);
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 32e01076c4..d0ffd77994 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -289,7 +289,7 @@ void NewstoryListData::Copy(bool bTextOnly)
void NewstoryListData::CopyUrl()
{
if (auto *pItem = GetItem(caret)) {
- if (pItem->m_bOfflineDownloaded) {
+ if (pItem->completed()) {
DB::EventInfo dbei(pItem->hEvent);
DB::FILE_BLOB blob(dbei);
Utils_ClipboardCopy(blob.getLocalName());
@@ -551,7 +551,7 @@ ItemData* NewstoryListData::LoadItem(int idx)
void NewstoryListData::OpenFolder()
{
if (auto *pItem = GetItem(caret)) {
- if (pItem->m_bOfflineDownloaded) {
+ if (pItem->completed()) {
DB::EventInfo dbei(pItem->hEvent);
DB::FILE_BLOB blob(dbei);
CMStringW wszFile(blob.getLocalName());
@@ -608,7 +608,7 @@ int NewstoryListData::PaintItem(HDC hdc, ItemData *pItem, int top, int width, bo
pos.x += 18;
sz.cx -= pos.x;
- if (pItem->m_bOfflineDownloaded) // Download completed icon
+ if (pItem->m_bOfflineDownloaded != 0) // Download completed icon
sz.cx -= 18;
HFONT hfnt = (HFONT)SelectObject(hdc, g_fontTable[fontid].hfnt);
@@ -667,8 +667,16 @@ int NewstoryListData::PaintItem(HDC hdc, ItemData *pItem, int top, int width, bo
}
// Finished icon
- if (pItem->m_bOfflineDownloaded)
- DrawIconEx(hdc, width-20, pos.y, g_plugin.getIcon(IDI_OK), 16, 16, 0, 0, DI_NORMAL);
+ if (pItem->m_bOfflineDownloaded != 0) {
+ if (pItem->completed())
+ DrawIconEx(hdc, width - 20, pos.y, g_plugin.getIcon(IDI_OK), 16, 16, 0, 0, DI_NORMAL);
+ else {
+ HPEN hpn = (HPEN)SelectObject(hdc, CreatePen(PS_SOLID, 4, RGB(255, 0, 0)));
+ MoveToEx(hdc, rc.left, rc.bottom - 4, 0);
+ LineTo(hdc, rc.left + (rc.right - rc.left) * int(pItem->m_bOfflineDownloaded) / 100, rc.bottom - 4);
+ DeleteObject(SelectObject(hdc, hpn));
+ }
+ }
hfnt = (HFONT)SelectObject(hdc, g_fontTable[fontid].hfnt);
MTextDisplay(hdc, pos, sz, pItem->data);