summaryrefslogtreecommitdiff
path: root/plugins/WhenWasIt/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/WhenWasIt/src')
-rw-r--r--plugins/WhenWasIt/src/date_utils.cpp4
-rw-r--r--plugins/WhenWasIt/src/date_utils.h4
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp8
-rw-r--r--plugins/WhenWasIt/src/hooked_events.cpp33
-rw-r--r--plugins/WhenWasIt/src/services.cpp6
5 files changed, 31 insertions, 24 deletions
diff --git a/plugins/WhenWasIt/src/date_utils.cpp b/plugins/WhenWasIt/src/date_utils.cpp
index 856a2711ab..2dd9a3b91b 100644
--- a/plugins/WhenWasIt/src/date_utils.cpp
+++ b/plugins/WhenWasIt/src/date_utils.cpp
@@ -29,7 +29,7 @@ time_t Today()
return mktime(date);
}
-int IsDOBValid(int year, int month, int day)
+bool IsDOBValid(int year, int month, int day)
{
return (year != 0 && month != 0 && day != 0);
}
@@ -89,7 +89,7 @@ char GetContactGender(HANDLE hContact)
return gender;
}
-int IsLeapYear(int year)
+bool IsLeapYear(int year)
{
return ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0)));
}
diff --git a/plugins/WhenWasIt/src/date_utils.h b/plugins/WhenWasIt/src/date_utils.h
index 45db98fad7..6b4cfcc7f2 100644
--- a/plugins/WhenWasIt/src/date_utils.h
+++ b/plugins/WhenWasIt/src/date_utils.h
@@ -37,8 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SAVE_MODE_DELETEALL 100
time_t Today();
-int IsLeapYear(int year);
-int IsDOBValid(int year, int month, int day);
+bool IsLeapYear(int year);
+bool IsDOBValid(int year, int month, int day);
unsigned int DaysToBirthday(time_t now, int ctYear, int ctMonth, int ctDay);
int DaysAfterBirthday(time_t now, int ctYear, int ctMonth, int ctDay);
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index 1719090ee3..f8988c6004 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -400,7 +400,12 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
case WM_INITDIALOG:
TranslateDialogDefault(hWnd);
SetWindowLongPtr(hWnd, GWLP_USERDATA, lParam);
-
+
+ {
+ HANDLE hContact = (HANDLE) lParam;
+ WindowList_Add(hAddBirthdayWndsList, hWnd, hContact);
+ Utils_RestoreWindowPositionNoSize(hWnd,hContact,ModuleName,"BirthdayWnd");
+ }
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(hAddBirthdayContact, 1));
{
for (int i = 0; i < cSaveModule; i++)
@@ -475,6 +480,7 @@ INT_PTR CALLBACK DlgProcAddBirthday(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
case WM_DESTROY:
RefreshContactListIcons(hContact); //the birthday might be changed, refresh icon.
Skin_ReleaseIcon((HICON)SendMessage(hWnd, WM_GETICON, ICON_BIG, 0));
+ Utils_SaveWindowPosition(hWnd,hContact,ModuleName,"BirthdayWnd");
WindowList_Remove(hAddBirthdayWndsList, hWnd);
break;
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp
index 3f7efbc41d..758b4f4bea 100644
--- a/plugins/WhenWasIt/src/hooked_events.cpp
+++ b/plugins/WhenWasIt/src/hooked_events.cpp
@@ -56,61 +56,62 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded);
- SkinAddNewSoundEx(BIRTHDAY_NEAR_SOUND, LPGEN("WhenWasIt"), LPGEN("Birthday near"));
- SkinAddNewSoundEx(BIRTHDAY_TODAY_SOUND, LPGEN("WhenWasIt"), LPGEN("Birthday today"));
+ SkinAddNewSoundExT(BIRTHDAY_NEAR_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday near"));
+ SkinAddNewSoundExT(BIRTHDAY_TODAY_SOUND, LPGENT("WhenWasIt"), LPGENT("Birthday today"));
UpdateTimers();
CLISTMENUITEM cl = { sizeof(cl) };
cl.position = 10000000;
- cl.flags = CMIF_ICONFROMICOLIB;
- cl.pszPopupName = "Birthdays (When Was It)";
+ cl.flags = CMIF_ICONFROMICOLIB|CMIF_TCHAR;
+ cl.ptszPopupName = LPGENT("Birthdays (When Was It)");
cl.pszService = MS_WWI_CHECK_BIRTHDAYS;
cl.icolibItem = hCheckMenu;
- cl.pszName = "Check for birthdays";
+ cl.ptszName = LPGENT("Check for birthdays");
hmCheckBirthdays = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_LIST_SHOW;
- cl.pszName = "Birthday list";
+ cl.ptszName = LPGENT("Birthday list");
cl.icolibItem = hListMenu;
hmBirthdayList = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_REFRESH_USERDETAILS;
cl.position = 10100000;
- cl.pszName = "Refresh user details";
+ cl.ptszName = LPGENT("Refresh user details");
cl.icolibItem = hRefreshUserDetails;
hmRefreshDetails = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_IMPORT_BIRTHDAYS;
cl.position = 10200000;
- cl.pszName = "Import birthdays";
+ cl.ptszName = LPGENT("Import birthdays");
cl.icolibItem = hImportBirthdays;
hmImportBirthdays = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_EXPORT_BIRTHDAYS;
- cl.pszName = "Export birthdays";
+ cl.ptszName = LPGENT("Export birthdays");
cl.icolibItem = hExportBirthdays;
hmExportBirthdays = Menu_AddMainMenuItem(&cl);
cl.pszService = MS_WWI_ADD_BIRTHDAY;
cl.position = 10000000;
cl.icolibItem = hAddBirthdayContact;
- cl.pszName = "Add/change user &birthday";
+ cl.ptszName = LPGENT("Add/change user &birthday");
hmAddChangeBirthday = Menu_AddContactMenuItem(&cl);
// Register hotkeys
HOTKEYDESC hotkey = {0};
hotkey.cbSize = sizeof(hotkey);
- hotkey.pszSection = LPGEN("Birthdays");
+ hotkey.ptszSection = LPGENT("Birthdays");
+ hotkey.dwFlags = HKD_TCHAR;
hotkey.pszName = "wwi_birthday_list";
- hotkey.pszDescription = LPGEN("Birthday list");
+ hotkey.ptszDescription = LPGENT("Birthday list");
hotkey.pszService = MS_WWI_LIST_SHOW;
Hotkey_Register(&hotkey);
hotkey.pszName = "wwi_check_birthdays";
- hotkey.pszDescription = LPGEN("Check for birthdays");
+ hotkey.ptszDescription = LPGENT("Check for birthdays");
hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS;
Hotkey_Register(&hotkey);
@@ -137,10 +138,10 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM lParam)
odp.position = 100000000;
odp.hInstance = hInstance;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_WWI);
- odp.pszTitle = LPGEN("Birthdays");
- odp.pszGroup = LPGEN("Contacts");
+ odp.ptszTitle = LPGENT("Birthdays");
+ odp.ptszGroup = LPGENT("Contacts");
odp.groupPosition = 910000000;
- odp.flags = ODPF_BOLDGROUPS;
+ odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
odp.pfnDlgProc = DlgProcOptions;
Options_AddPage(wParam, &odp);
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index 0af7b99e39..3e1d391a79 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -170,10 +170,10 @@ INT_PTR ShowListService(WPARAM wParam, LPARAM lParam)
INT_PTR AddBirthdayService(WPARAM wParam, LPARAM lParam)
{
- HWND hWnd = WindowList_Find(hAddBirthdayWndsList, (HANDLE) wParam);
+ HANDLE hContact = (HANDLE) wParam;
+ HWND hWnd = WindowList_Find(hAddBirthdayWndsList, hContact);
if ( !hWnd) {
- hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_ADD_BIRTHDAY), NULL, DlgProcAddBirthday, wParam);
- WindowList_Add(hAddBirthdayWndsList, hWnd, (HANDLE) wParam);
+ hWnd = CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_ADD_BIRTHDAY), NULL, DlgProcAddBirthday, (LPARAM) hContact);
}
return ShowWindow(hWnd, SW_SHOW);
}