mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 08:48:39 +09:00
restore xp compatibility
This commit is contained in:
parent
701781251b
commit
593762743f
2 changed files with 47 additions and 3 deletions
|
|
@ -56,6 +56,7 @@
|
|||
|
||||
#define NOTIFICATIONCLASSNAME "MailBiffNotificationMessageWindow"
|
||||
#define UNREADMAILNODEKEY "Software\\Microsoft\\Windows\\CurrentVersion\\UnreadMail\\"
|
||||
#define SHELL32_DLL NS_LITERAL_CSTRING("shell32.dll")
|
||||
#define DOUBLE_QUOTE "\""
|
||||
#define MAIL_COMMANDLINE_ARG " -mail"
|
||||
#define IDI_MAILBIFF 32576
|
||||
|
|
@ -355,6 +356,31 @@ nsMessengerWinIntegration::Init()
|
|||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// get path strings needed for unread mail count update
|
||||
nsCOMPtr<nsIFile> systemDir;
|
||||
rv = directoryService->Get(NS_OS_SYSTEM_DIR,
|
||||
NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(systemDir));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// get path to shell dll.
|
||||
nsAutoCString shellFile;
|
||||
rv = systemDir->GetNativePath(shellFile);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
mShellDllPath.Assign(shellFile + NS_LITERAL_CSTRING("\\") + SHELL32_DLL);
|
||||
|
||||
// load shell dll. If no such dll found, return
|
||||
HMODULE hModule = ::LoadLibrary(mShellDllPath.get());
|
||||
if (!hModule)
|
||||
return NS_OK;
|
||||
|
||||
// get process addresses for the unread mail count functions
|
||||
|
||||
if (hModule) {
|
||||
mSHQueryUserNotificationState = (fnSHQueryUserNotificationState)GetProcAddress(hModule, "SHQueryUserNotificationState");
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> profilePath;
|
||||
rv = directoryService->Get(NS_APP_USER_PROFILE_50_DIR,
|
||||
NS_GET_IID(nsIFile),
|
||||
|
|
@ -483,10 +509,10 @@ nsresult nsMessengerWinIntegration::ShowNewAlertNotification(bool aUserInitiated
|
|||
prefBranch->GetBoolPref(SHOW_ALERT_PREF, &showAlert);
|
||||
|
||||
// check if we are allowed to show a notification
|
||||
if (showAlert) {
|
||||
QUERY_USER_NOTIFICATION_STATE qstate;
|
||||
if (showAlert && mSHQueryUserNotificationState) {
|
||||
MOZ_QUERY_USER_NOTIFICATION_STATE qstate;
|
||||
|
||||
if (SUCCEEDED(SHQueryUserNotificationState(&qstate))) {
|
||||
if (SUCCEEDED(mSHQueryUserNotificationState(&qstate))) {
|
||||
if (qstate != QUNS_ACCEPTS_NOTIFICATIONS) {
|
||||
showAlert = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,21 @@
|
|||
#include "nsIMutableArray.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
typedef enum tagMOZ_QUERY_USER_NOTIFICATION_STATE {
|
||||
QUNS_NOT_PRESENT = 1,
|
||||
QUNS_BUSY = 2,
|
||||
QUNS_RUNNING_D3D_FULL_SCREEN = 3,
|
||||
QUNS_PRESENTATION_MODE = 4,
|
||||
QUNS_ACCEPTS_NOTIFICATIONS = 5,
|
||||
QUNS_QUIET_TIME = 6
|
||||
} MOZ_QUERY_USER_NOTIFICATION_STATE;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// Vista or later
|
||||
typedef HRESULT (__stdcall *fnSHQueryUserNotificationState)(MOZ_QUERY_USER_NOTIFICATION_STATE *pquns);
|
||||
}
|
||||
|
||||
#define NS_MESSENGERWININTEGRATION_CID \
|
||||
{0xf62f3d3a, 0x1dd1, 0x11b2, \
|
||||
{0xa5, 0x16, 0xef, 0xad, 0xb1, 0x31, 0x61, 0x5c}}
|
||||
|
|
@ -89,11 +104,14 @@ private:
|
|||
nsCOMPtr <nsIAtom> mTotalUnreadMessagesAtom;
|
||||
nsCOMPtr <nsITimer> mUnreadCountUpdateTimer;
|
||||
|
||||
fnSHQueryUserNotificationState mSHQueryUserNotificationState;
|
||||
|
||||
nsCString mInboxURI;
|
||||
nsCString mEmail;
|
||||
|
||||
nsString mAppName;
|
||||
nsString mEmailPrefix;
|
||||
nsCString mShellDllPath;
|
||||
|
||||
nsString mProfilePath;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue