summaryrefslogtreecommitdiff
path: root/plugins/Alarms/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-05 21:10:22 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-05 21:10:22 +0300
commitd9fddc0cfa9066eb1b5ad3f4807b37426ae6ca88 (patch)
treef09baaf9b91477d009cedc5bd77449b0fa3e3af7 /plugins/Alarms/src
parent8a1ff32e54b39ceef22df61bda17bbfda94918fc (diff)
Popup:
- wiping out checks for service presence; - code cleaning
Diffstat (limited to 'plugins/Alarms/src')
-rwxr-xr-xplugins/Alarms/src/alarmlist.cpp28
-rw-r--r--plugins/Alarms/src/alarms.cpp30
-rwxr-xr-xplugins/Alarms/src/options.cpp15
3 files changed, 30 insertions, 43 deletions
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp
index 515383f672..14063d7a5a 100755
--- a/plugins/Alarms/src/alarmlist.cpp
+++ b/plugins/Alarms/src/alarmlist.cpp
@@ -611,20 +611,18 @@ static LRESULT CALLBACK PopupAlarmDlgProc(HWND hWnd, UINT message, WPARAM wParam
void ShowPopup(ALARM *alarm)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPW)) {
- ALARM *data = new ALARM;
- memset(data, 0, sizeof(ALARM));
- copy_alarm_data(data, alarm);
-
- POPUPDATAW ppd = { 0 };
- ppd.lchIcon = hIconMenuSet;
- mir_wstrncpy(ppd.lpwzContactName, data->szTitle, MAX_CONTACTNAME);
- mir_wstrncpy(ppd.lpwzText, data->szDesc, MAX_SECONDLINE);
- ppd.PluginWindowProc = PopupAlarmDlgProc;
- ppd.PluginData = data;
- ppd.iSeconds = -1;
- PUAddPopupW(&ppd);
- }
+ ALARM *data = new ALARM;
+ memset(data, 0, sizeof(ALARM));
+ copy_alarm_data(data, alarm);
+
+ POPUPDATAW ppd = { 0 };
+ ppd.lchIcon = hIconMenuSet;
+ mir_wstrncpy(ppd.lpwzContactName, data->szTitle, MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lpwzText, data->szDesc, MAX_SECONDLINE);
+ ppd.PluginWindowProc = PopupAlarmDlgProc;
+ ppd.PluginData = data;
+ ppd.iSeconds = -1;
+ PUAddPopupW(&ppd);
}
void DoAlarm(ALARM *alarm)
@@ -658,7 +656,7 @@ void DoAlarm(ALARM *alarm)
}
if (alarm->action & AAF_POPUP) {
- if (options.use_popup_module && ServiceExists(MS_POPUP_ADDPOPUPW))
+ if (options.use_popup_module)
ShowPopup(alarm);
else {
HWND hwndDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALARM), GetDesktopWindow(), DlgProcAlarm);
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp
index d75f9688c4..3985bd50fc 100644
--- a/plugins/Alarms/src/alarms.cpp
+++ b/plugins/Alarms/src/alarms.cpp
@@ -60,23 +60,19 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
void ShowPopup(MCONTACT hContact, const wchar_t *msg)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPW)) {
- wchar_t *lpzContactName = Clist_GetContactDisplayName(hContact);
-
- POPUPDATAW ppd = { 0 };
- ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked.
- ppd.lchIcon = hIconList1;
- mir_wstrncpy(ppd.lpwzContactName, lpzContactName, MAX_CONTACTNAME);
- mir_wstrncpy(ppd.lpwzText, msg, MAX_SECONDLINE);
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = RGB(0, 0, 0);
- ppd.PluginWindowProc = PopupDlgProc;
- ppd.PluginData = nullptr;
- ppd.iSeconds = 3;
-
- // Now that every field has been filled, we want to see the popup.
- PUAddPopupW(&ppd);
- }
+ wchar_t *lpzContactName = Clist_GetContactDisplayName(hContact);
+
+ POPUPDATAW ppd = { 0 };
+ ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked.
+ ppd.lchIcon = hIconList1;
+ mir_wstrncpy(ppd.lpwzContactName, lpzContactName, MAX_CONTACTNAME);
+ mir_wstrncpy(ppd.lpwzText, msg, MAX_SECONDLINE);
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = RGB(0, 0, 0);
+ ppd.PluginWindowProc = PopupDlgProc;
+ ppd.PluginData = nullptr;
+ ppd.iSeconds = 3;
+ PUAddPopupW(&ppd);
}
HBITMAP LoadBmpFromIcon(int IdRes)
diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp
index 387275294a..177dd5a2af 100755
--- a/plugins/Alarms/src/options.cpp
+++ b/plugins/Alarms/src/options.cpp
@@ -941,17 +941,10 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
EnableWindow(GetDlgItem(hwndDlg, IDC_DEL), FALSE);
}
- if (ServiceExists(MS_POPUP_ADDPOPUPW)) {
- CheckDlgButton(hwndDlg, IDC_CHK_POPUPS, temp_options.use_popup_module ? BST_CHECKED : BST_UNCHECKED);
- if (options.use_popup_module)
- bChecked = FALSE;
- else {
- CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? BST_CHECKED : BST_UNCHECKED);
- bChecked = TRUE;
- }
- }
+ CheckDlgButton(hwndDlg, IDC_CHK_POPUPS, temp_options.use_popup_module ? BST_CHECKED : BST_UNCHECKED);
+ if (options.use_popup_module)
+ bChecked = FALSE;
else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_POPUPS), FALSE);
CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? BST_CHECKED : BST_UNCHECKED);
bChecked = TRUE;
}
@@ -1179,7 +1172,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
int reminder_period = GetDlgItemInt(hwndDlg, IDC_ED_PERIOD, &translated, FALSE);
if (translated) temp_options.reminder_period = reminder_period;
- if (!ServiceExists(MS_POPUP_ADDPOPUPW) || !options.use_popup_module)
+ if (!options.use_popup_module)
temp_options.loop_sound = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOOPSOUND) ? true : false;
options = temp_options;