Release KSwitcher v0.6.76 with incoming file notifications
This commit is contained in:
1 parent
384a93dfea
commit
4cd3104201
12 files changed
+99
-46
No files matched your search
+29
-3
@@ -820,11 +820,13 @@ void App::addTray()
|
||||
NOTIFYICONDATAW icon{sizeof(icon)};
|
||||
icon.hWnd = window;
|
||||
icon.uID = 1;
|
||||
icon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||
icon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_SHOWTIP;
|
||||
icon.uCallbackMessage = TrayMessage;
|
||||
icon.hIcon = (HICON)LoadImageW(instance, MAKEINTRESOURCEW(IDI_KSWITCHER), IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
|
||||
wcscpy_s(icon.szTip, localBuildTitle(L"KSwitcher — keyboard layouts & clipboard").c_str());
|
||||
auto tip = incomingLanFileCount ? L"KSwitcher — files ready to save: " + std::to_wstring(incomingLanFileCount)
|
||||
: localBuildTitle(L"KSwitcher — keyboard layouts & clipboard");
|
||||
wcsncpy_s(icon.szTip, tip.c_str(), _TRUNCATE);
|
||||
if (Shell_NotifyIconW(NIM_ADD, &icon))
|
||||
{
|
||||
KillTimer(window, TrayRetryTimer);
|
||||
@@ -3019,7 +3021,10 @@ LRESULT CALLBACK App::windowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
return 0;
|
||||
case TrayMessage:
|
||||
if (LOWORD(lp) == NIN_BALLOONUSERCLICK)
|
||||
showLogs(*app);
|
||||
{
|
||||
if (std::exchange(app->incomingFileBalloon, false)) app->dispatch(20);
|
||||
else showLogs(*app);
|
||||
}
|
||||
else if (LOWORD(lp) == WM_CONTEXTMENU)
|
||||
app->trayMenu();
|
||||
else if (LOWORD(lp) == WM_LBUTTONDBLCLK)
|
||||
@@ -3091,9 +3096,30 @@ LRESULT CALLBACK App::windowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
wcsncpy_s(icon.szInfo, text->c_str(), _TRUNCATE);
|
||||
wcscpy_s(icon.szInfoTitle, L"KSwitcher");
|
||||
icon.dwInfoFlags = NIIF_WARNING;
|
||||
app->incomingFileBalloon = false;
|
||||
Shell_NotifyIconW(NIM_MODIFY, &icon);
|
||||
return 0;
|
||||
}
|
||||
case LanFilesChangedMessage:
|
||||
{
|
||||
app->incomingLanFileCount = wp;
|
||||
NOTIFYICONDATAW icon{sizeof(icon)};
|
||||
icon.hWnd = hwnd;
|
||||
icon.uID = 1;
|
||||
icon.uFlags = NIF_TIP | NIF_SHOWTIP;
|
||||
auto tip = wp ? L"KSwitcher — files ready to save: " + std::to_wstring(wp)
|
||||
: localBuildTitle(L"KSwitcher — keyboard layouts & clipboard");
|
||||
wcsncpy_s(icon.szTip, tip.c_str(), _TRUNCATE);
|
||||
if (lp)
|
||||
{
|
||||
icon.uFlags |= NIF_INFO;
|
||||
wcscpy_s(icon.szInfoTitle, L"Incoming file ready to save");
|
||||
wcscpy_s(icon.szInfo, L"Open Settings → Computers → Manage computers → Incoming files.");
|
||||
icon.dwInfoFlags = NIIF_INFO;
|
||||
}
|
||||
if (Shell_NotifyIconW(NIM_MODIFY, &icon) && lp) app->incomingFileBalloon = true;
|
||||
return 0;
|
||||
}
|
||||
case CheckAutostartMessage:
|
||||
app->checkAutostartPath();
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user