diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-23 22:02:44 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-23 22:02:44 +0000 |
commit | 01b7a72d43ed1c71544c22c7afb61829762ffe8e (patch) | |
tree | b4c570f41c69097492329b9d18a64f0b42f585ef /plugins/NotesAndReminders | |
parent | 037286255b6a26ed5fba94c5fe9e68b88c1755f7 (diff) |
same for some another plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@5104 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/NotesAndReminders')
-rw-r--r-- | plugins/NotesAndReminders/src/miscutils.cpp | 36 | ||||
-rw-r--r-- | plugins/NotesAndReminders/src/miscutils.h | 6 | ||||
-rw-r--r-- | plugins/NotesAndReminders/src/notes.cpp | 10 | ||||
-rw-r--r-- | plugins/NotesAndReminders/src/options.cpp | 44 | ||||
-rw-r--r-- | plugins/NotesAndReminders/src/reminders.cpp | 12 |
5 files changed, 33 insertions, 75 deletions
diff --git a/plugins/NotesAndReminders/src/miscutils.cpp b/plugins/NotesAndReminders/src/miscutils.cpp index 1ea10305c9..8ce1ca8655 100644 --- a/plugins/NotesAndReminders/src/miscutils.cpp +++ b/plugins/NotesAndReminders/src/miscutils.cpp @@ -23,42 +23,6 @@ WORD ConvertControlToHotKey(WORD HK) return R;
}
-void WriteSettingInt(HANDLE hContact,char *ModuleName,char *SettingName,int Value)
-{
- DBCONTACTWRITESETTING cws = {0};
- DBVARIANT dbv = {0};
- dbv.type = DBVT_DWORD;
- dbv.dVal = Value;
- cws.szModule = ModuleName;
- cws.szSetting = SettingName;
- cws.value = dbv;
- CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)hContact, (DWORD)&cws);
-}
-
-int ReadSettingInt(HANDLE hContact,char *ModuleName,char *SettingName,int Default)
-{
- DBCONTACTGETSETTING cws = {0};
- DBVARIANT dbv = {0};
- dbv.type = DBVT_DWORD;
- dbv.dVal = Default;
- cws.szModule = ModuleName;
- cws.szSetting = SettingName;
- cws.pValue = &dbv;
- if (CallService(MS_DB_CONTACT_GETSETTING,(DWORD)hContact,(DWORD)&cws))
- return Default;
- else
- return dbv.dVal;
-}
-
-void DeleteSetting(HANDLE hContact,char *ModuleName,char *SettingName)
-{
- DBCONTACTGETSETTING dbcgs = {0};
- dbcgs.szModule = ModuleName;
- dbcgs.szSetting = SettingName;
- dbcgs.pValue = NULL;
- CallService(MS_DB_CONTACT_DELETESETTING,(DWORD)hContact,(DWORD)&dbcgs);
-}
-
void FreeSettingBlob(WORD pSize,void *pbBlob)
{
DBVARIANT dbv = {0};
diff --git a/plugins/NotesAndReminders/src/miscutils.h b/plugins/NotesAndReminders/src/miscutils.h index 41f7f5cddc..52652891d5 100644 --- a/plugins/NotesAndReminders/src/miscutils.h +++ b/plugins/NotesAndReminders/src/miscutils.h @@ -1,7 +1,3 @@ -void WriteSettingInt(HANDLE hContact,char *ModuleName,
- char *SettingName,int Value);
-int ReadSettingInt(HANDLE hContact,char *ModuleName,
- char *SettingName,int Default);
void ReadSettingBlob(HANDLE hContact, char *ModuleName,
char *SettingName, WORD *pSize, void **pbBlob);
void WriteSettingBlob(HANDLE hContact,char *ModuleName,
@@ -11,8 +7,6 @@ BOOL ReadSettingBool(HANDLE hContact,char *ModuleName, char *SettingName,BOOL Default);
void WriteSettingBool(HANDLE hContact,char *ModuleName,
char *SettingName,BOOL Value);
-void DeleteSetting(HANDLE hContact,char *ModuleName,
- char *SettingName);
void WriteSettingIntArray(HANDLE hContact,char *ModuleName,
char *SettingName,const int *Value, int Size);
bool ReadSettingIntArray(HANDLE hContact,char *ModuleName,
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index 58e809738e..d54b8ea03b 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -375,7 +375,7 @@ void LoadNotes(BOOL bIsStartup) g_Stickies = NULL;
- NotesCount = ReadSettingInt(0,MODULENAME,"NotesData",0);
+ NotesCount = db_get_dw(0,MODULENAME,"NotesData",0);
for (I = 0; I < NotesCount; I++)
{
@@ -691,7 +691,7 @@ void PurgeNotes(void) int NotesCount, I;
char ValueName[16];
- NotesCount = ReadSettingInt(0,MODULENAME,"NotesData",0);
+ NotesCount = db_get_dw(0,MODULENAME,"NotesData",0);
for(I = 0; I < NotesCount; I++)
{
sprintf(ValueName, "NotesData%d", I);
@@ -721,7 +721,7 @@ void OnDeleteNote(HWND hdlg, STICKYNOTE *SN) void DeleteNotes(void)
{
PurgeNotes();
- WriteSettingInt(0, MODULENAME, "NotesData", 0);
+ db_set_dw(0, MODULENAME, "NotesData", 0);
PurgeNotesTree();
NOTIFY_LIST();
}
@@ -824,9 +824,9 @@ static void JustSaveNotesEx(STICKYNOTE *pModified) int scrollV;
char *tData, *Value;
- const int OldNotesCount = ReadSettingInt(0, MODULENAME, "NotesData", 0);
+ const int OldNotesCount = db_get_dw(0, MODULENAME, "NotesData", 0);
- WriteSettingInt(0, MODULENAME, "NotesData", NotesCount);
+ db_set_dw(0, MODULENAME, "NotesData", NotesCount);
for (TTE = g_Stickies, I = 0; TTE; TTE = (TREEELEMENT*)TTE->next, I++)
{
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index b19e6b3b86..aaa257163c 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -444,17 +444,17 @@ INT_PTR CALLBACK DlgProcOptions(HWND hdlg,UINT message,WPARAM wParam,LPARAM lPar else
db_unset(0,MODULENAME,"AltBrowser");
- WriteSettingInt(0,MODULENAME,"ShowNotesAtStart",g_ShowNotesAtStart);
- WriteSettingInt(0,MODULENAME,"ShowNoteButtons",g_ShowNoteButtons);
- WriteSettingInt(0,MODULENAME,"ShowScrollbar",g_ShowScrollbar);
- WriteSettingInt(0,MODULENAME,"AddContactMenuItems",g_AddContListMI);
- WriteSettingInt(0,MODULENAME,"NoteWidth",g_NoteWidth);
- WriteSettingInt(0,MODULENAME,"NoteHeight",g_NoteHeight);
- WriteSettingInt(0,MODULENAME,"Transparency",g_Transparency);
- WriteSettingInt(0,MODULENAME,"NoteTitleDate",g_NoteTitleDate);
- WriteSettingInt(0,MODULENAME,"NoteTitleTime",g_NoteTitleTime);
- WriteSettingInt(0,MODULENAME,"CloseAfterAddReminder",g_CloseAfterAddReminder);
- WriteSettingInt(0,MODULENAME,"UseMCI",!g_UseDefaultPlaySound);
+ db_set_dw(0,MODULENAME,"ShowNotesAtStart",g_ShowNotesAtStart);
+ db_set_dw(0,MODULENAME,"ShowNoteButtons",g_ShowNoteButtons);
+ db_set_dw(0,MODULENAME,"ShowScrollbar",g_ShowScrollbar);
+ db_set_dw(0,MODULENAME,"AddContactMenuItems",g_AddContListMI);
+ db_set_dw(0,MODULENAME,"NoteWidth",g_NoteWidth);
+ db_set_dw(0,MODULENAME,"NoteHeight",g_NoteHeight);
+ db_set_dw(0,MODULENAME,"Transparency",g_Transparency);
+ db_set_dw(0,MODULENAME,"NoteTitleDate",g_NoteTitleDate);
+ db_set_dw(0,MODULENAME,"NoteTitleTime",g_NoteTitleTime);
+ db_set_dw(0,MODULENAME,"CloseAfterAddReminder",g_CloseAfterAddReminder);
+ db_set_dw(0,MODULENAME,"UseMCI",!g_UseDefaultPlaySound);
SaveNotes();
LoadNotes(FALSE);
return TRUE;
@@ -576,17 +576,17 @@ void InitSettings(void) g_lpszAltBrowser = db_get_sa(0,MODULENAME,"AltBrowser");
- g_ShowNotesAtStart = (BOOL)ReadSettingInt(0,MODULENAME,"ShowNotesAtStart",1);
- g_ShowNoteButtons = (BOOL)ReadSettingInt(0,MODULENAME,"ShowNoteButtons",1);
- g_ShowScrollbar = (BOOL)ReadSettingInt(0,MODULENAME,"ShowScrollbar",1);
- g_AddContListMI = (BOOL)ReadSettingInt(0,MODULENAME,"AddContactMenuItems",1);
- g_NoteWidth = ReadSettingInt(0,MODULENAME,"NoteWidth",179);
- g_NoteHeight = ReadSettingInt(0,MODULENAME,"NoteHeight",50);
- g_Transparency = ReadSettingInt(0,MODULENAME,"Transparency",255);
- g_NoteTitleDate = ReadSettingInt(0,MODULENAME,"NoteTitleDate",1);
- g_NoteTitleTime = ReadSettingInt(0,MODULENAME,"NoteTitleTime",1);
- g_CloseAfterAddReminder = (BOOL)ReadSettingInt(0,MODULENAME,"CloseAfterAddReminder",1);
- g_UseDefaultPlaySound = !(BOOL)ReadSettingInt(0,MODULENAME,"UseMCI",1);
+ g_ShowNotesAtStart = (BOOL)db_get_dw(0,MODULENAME,"ShowNotesAtStart",1);
+ g_ShowNoteButtons = (BOOL)db_get_dw(0,MODULENAME,"ShowNoteButtons",1);
+ g_ShowScrollbar = (BOOL)db_get_dw(0,MODULENAME,"ShowScrollbar",1);
+ g_AddContListMI = (BOOL)db_get_dw(0,MODULENAME,"AddContactMenuItems",1);
+ g_NoteWidth = db_get_dw(0,MODULENAME,"NoteWidth",179);
+ g_NoteHeight = db_get_dw(0,MODULENAME,"NoteHeight",50);
+ g_Transparency = db_get_dw(0,MODULENAME,"Transparency",255);
+ g_NoteTitleDate = db_get_dw(0,MODULENAME,"NoteTitleDate",1);
+ g_NoteTitleTime = db_get_dw(0,MODULENAME,"NoteTitleTime",1);
+ g_CloseAfterAddReminder = (BOOL)db_get_dw(0,MODULENAME,"CloseAfterAddReminder",1);
+ g_UseDefaultPlaySound = !(BOOL)db_get_dw(0,MODULENAME,"UseMCI",1);
ReadSettingIntArray(0,MODULENAME,"ReminderListGeom",g_reminderListGeom,SIZEOF(g_reminderListGeom));
ReadSettingIntArray(0,MODULENAME,"ReminderListColGeom",g_reminderListColGeom,SIZEOF(g_reminderListColGeom));
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 234aea3e6e..25c2772251 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -373,11 +373,11 @@ void PurgeReminders(void) int ReminderCount,I;
char ValueName[32];
- ReminderCount = ReadSettingInt(0,MODULENAME,"RemindersData",0);
+ ReminderCount = db_get_dw(0,MODULENAME,"RemindersData",0);
for(I = 0;I < ReminderCount;I++)
{
sprintf(ValueName, "RemindersData%d", I);
- DeleteSetting(0,MODULENAME,ValueName);
+ db_unset(0, MODULENAME, ValueName);
}
}
@@ -390,11 +390,11 @@ void JustSaveReminders(void) int ReminderCount;
REMINDERDATA *pReminder;
- const int OldReminderCount = ReadSettingInt(0, MODULENAME, "RemindersData", 0);
+ const int OldReminderCount = db_get_dw(0, MODULENAME, "RemindersData", 0);
ReminderCount = TreeGetCount(RemindersList);
- WriteSettingInt(0,MODULENAME, "RemindersData", ReminderCount);
+ db_set_dw(0,MODULENAME, "RemindersData", ReminderCount);
for (TTE = RemindersList, I = 0; TTE; TTE = (TREEELEMENT*)TTE->next, I++)
{
@@ -472,7 +472,7 @@ void LoadReminders(void) BOOL GenerateUids = FALSE;
RemindersList = NULL;
- RemindersCount = ReadSettingInt(0, MODULENAME, "RemindersData", 0);
+ RemindersCount = db_get_dw(0, MODULENAME, "RemindersData", 0);
for (I = 0; I < RemindersCount; I++)
{
@@ -764,7 +764,7 @@ void SaveReminders(void) void DeleteReminders(void)
{
PurgeReminders();
- WriteSettingInt(0,MODULENAME,"RemindersData",0);
+ db_set_dw(0,MODULENAME,"RemindersData",0);
PurgeReminderTree();
}
|