diff options
Diffstat (limited to 'src/modules/database')
-rw-r--r-- | src/modules/database/database.cpp | 54 | ||||
-rw-r--r-- | src/modules/database/dbini.cpp | 96 | ||||
-rw-r--r-- | src/modules/database/dbutils.cpp | 6 | ||||
-rw-r--r-- | src/modules/database/profilemanager.cpp | 98 | ||||
-rw-r--r-- | src/modules/database/profilemanager.h | 10 |
5 files changed, 132 insertions, 132 deletions
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index ec97fcaa9f..d9299c6c5d 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -66,7 +66,7 @@ bool IsInsideRootDir(TCHAR* profiledir, bool exact) }
// returns 1 if the profile path was returned, without trailing slash
-int getProfilePath(TCHAR * buf, size_t cch)
+int getProfilePath(TCHAR *buf, size_t cch)
{
TCHAR profiledir[MAX_PATH];
GetPrivateProfileString(_T("Database"), _T("ProfileDir"), _T(""), profiledir, SIZEOF(profiledir), mirandabootini);
@@ -114,7 +114,7 @@ bool shouldAutoCreate(TCHAR *szProfile) return _tcsicmp(ac, _T("yes")) == 0;
}
-static void getDefaultProfile(TCHAR * szProfile, size_t cch, TCHAR * profiledir)
+static void getDefaultProfile(TCHAR *szProfile, size_t cch, TCHAR *profiledir)
{
TCHAR defaultProfile[MAX_PATH];
GetPrivateProfileString(_T("Database"), _T("DefaultProfile"), _T(""), defaultProfile, SIZEOF(defaultProfile), mirandabootini);
@@ -131,12 +131,12 @@ static void getDefaultProfile(TCHAR * szProfile, size_t cch, TCHAR * profiledir) }
// returns 1 if something that looks like a profile is there
-static int getProfileCmdLineArgs(TCHAR * szProfile, size_t cch)
+static int getProfileCmdLineArgs(TCHAR *szProfile, size_t cch)
{
TCHAR *szCmdLine = GetCommandLine();
TCHAR *szEndOfParam;
TCHAR szThisParam[1024];
- int firstParam=1;
+ int firstParam = 1;
while (szCmdLine[0])
{
@@ -153,8 +153,8 @@ static int getProfileCmdLineArgs(TCHAR * szProfile, size_t cch) lstrcpyn(szThisParam, szCmdLine, min(SIZEOF(szThisParam), szEndOfParam - szCmdLine+1));
szCmdLine = szEndOfParam;
}
- while (*szCmdLine && *szCmdLine<=' ') szCmdLine++;
- if (firstParam) { firstParam=0; continue; } //first param is executable name
+ while (*szCmdLine && *szCmdLine <= ' ') szCmdLine++;
+ if (firstParam) { firstParam = 0; continue; } //first param is executable name
if (szThisParam[0] == '/' || szThisParam[0] == '-') continue; //no switches supported
TCHAR* res = Utils_ReplaceVarsT(szThisParam);
@@ -166,7 +166,7 @@ static int getProfileCmdLineArgs(TCHAR * szProfile, size_t cch) return 0;
}
-void getProfileCmdLine(TCHAR * szProfile, size_t cch, TCHAR * profiledir)
+void getProfileCmdLine(TCHAR *szProfile, size_t cch, TCHAR *profiledir)
{
TCHAR buf[MAX_PATH];
if (getProfileCmdLineArgs(buf, SIZEOF(buf)))
@@ -202,7 +202,7 @@ void getProfileCmdLine(TCHAR * szProfile, size_t cch, TCHAR * profiledir) }
// move profile from profile subdir
-static void moveProfileDirProfiles(TCHAR * profiledir, BOOL isRootDir = TRUE)
+static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE)
{
TCHAR pfd[MAX_PATH];
if (isRootDir) {
@@ -217,19 +217,19 @@ static void moveProfileDirProfiles(TCHAR * profiledir, BOOL isRootDir = TRUE) HANDLE hFind = FindFirstFile(pfd, &ffd);
if (hFind != INVALID_HANDLE_VALUE)
{
- TCHAR *c =_tcsrchr(pfd, '\\'); if (c) *c = 0;
+ TCHAR *c = _tcsrchr(pfd, '\\'); if (c) *c = 0;
do
{
TCHAR path[MAX_PATH], path2[MAX_PATH];
TCHAR* profile = mir_tstrdup(ffd.cFileName);
- TCHAR *c =_tcsrchr(profile, '.'); if (c) *c = 0;
+ TCHAR *c = _tcsrchr(profile, '.'); if (c) *c = 0;
mir_sntprintf(path, SIZEOF(path), _T("%s\\%s"), pfd, ffd.cFileName);
mir_sntprintf(path2, SIZEOF(path2), _T("%s\\%s"), profiledir, profile);
CreateDirectoryTreeT(path2);
mir_sntprintf(path2, SIZEOF(path2), _T("%s\\%s\\%s"), profiledir, profile, ffd.cFileName);
if (_taccess(path2, 0) == 0)
{
- const TCHAR tszMoveMsg[] =
+ const TCHAR tszMoveMsg[] =
_T("Miranda is trying upgrade your profile structure.\n")
_T("It cannot move profile %s to the new location %s\n")
_T("Because profile with this name already exist. Please resolve the issue manually.");
@@ -240,7 +240,7 @@ static void moveProfileDirProfiles(TCHAR * profiledir, BOOL isRootDir = TRUE) }
else if (MoveFile(path, path2) == 0)
{
- const TCHAR tszMoveMsg[] =
+ const TCHAR tszMoveMsg[] =
_T("Miranda is trying upgrade your profile structure.\n")
_T("It cannot move profile %s to the new location %s automatically\n")
_T("Most likely due to insufficient privileges. Please move profile manually.");
@@ -258,7 +258,7 @@ static void moveProfileDirProfiles(TCHAR * profiledir, BOOL isRootDir = TRUE) }
// returns 1 if a single profile (full path) is found within the profile dir
-static int getProfile1(TCHAR * szProfile, size_t cch, TCHAR * profiledir, BOOL * noProfiles)
+static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * noProfiles)
{
unsigned int found = 0;
@@ -307,7 +307,7 @@ static int getProfile1(TCHAR * szProfile, size_t cch, TCHAR * profiledir, BOOL * }
// returns 1 if a default profile should be selected instead of showing the manager.
-static int getProfileAutoRun(TCHAR * szProfile)
+static int getProfileAutoRun(TCHAR *szProfile)
{
TCHAR Mgr[32];
GetPrivateProfileString(_T("Database"), _T("ShowProfileMgr"), _T(""), Mgr, SIZEOF(Mgr), mirandabootini);
@@ -318,7 +318,7 @@ static int getProfileAutoRun(TCHAR * szProfile) }
// returns 1 if a profile was selected
-static int getProfile(TCHAR * szProfile, size_t cch)
+static int getProfile(TCHAR *szProfile, size_t cch)
{
getProfilePath(g_profileDir, SIZEOF(g_profileDir));
if (IsInsideRootDir(g_profileDir, true))
@@ -371,12 +371,12 @@ char* makeFileName(const TCHAR* tszOriginalName) }
// called by the UI, return 1 on success, use link to create profile, set error if any
-int makeDatabase(TCHAR * profile, DATABASELINK * link, HWND hwndDlg)
+int makeDatabase(TCHAR *profile, DATABASELINK * link, HWND hwndDlg)
{
TCHAR buf[256];
- int err=0;
+ int err = 0;
// check if the file already exists
- TCHAR * file = _tcsrchr(profile, '\\');
+ TCHAR *file = _tcsrchr(profile, '\\');
if (file) file++;
if (_taccess(profile, 0) == 0) {
// file already exists!
@@ -475,7 +475,7 @@ static int FindDbPluginAutoCreate(const char*, DATABASELINK * dblink, LPARAM lPa }
typedef struct {
- TCHAR * profile;
+ TCHAR *profile;
UINT msg;
ATOM aPath;
int found;
@@ -485,7 +485,7 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam) {
TCHAR classname[256];
ENUMMIRANDAWINDOW * x = (ENUMMIRANDAWINDOW *)lParam;
- DWORD_PTR res=0;
+ DWORD_PTR res = 0;
if (GetClassName(hwnd, classname, SIZEOF(classname)) && lstrcmp(_T("Miranda"), classname) == 0) {
if (SendMessageTimeout(hwnd, x->msg, (WPARAM)x->aPath, 0, SMTO_ABORTIFHUNG, 100, &res) && res) {
x->found++;
@@ -495,12 +495,12 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam) return TRUE;
}
-static int FindMirandaForProfile(TCHAR * szProfile)
+static int FindMirandaForProfile(TCHAR *szProfile)
{
- ENUMMIRANDAWINDOW x={0};
- x.profile=szProfile;
- x.msg=RegisterWindowMessage(_T("Miranda::ProcessProfile"));
- x.aPath=GlobalAddAtom(szProfile);
+ ENUMMIRANDAWINDOW x = {0};
+ x.profile = szProfile;
+ x.msg = RegisterWindowMessage(_T("Miranda::ProcessProfile"));
+ x.aPath = GlobalAddAtom(szProfile);
EnumWindows(EnumMirandaWindows, (LPARAM)&x);
GlobalDeleteAtom(x.aPath);
return x.found;
@@ -525,9 +525,9 @@ int LoadDatabaseModule(void) dbe.lParam = (LPARAM)szProfile;
if (_taccess(szProfile, 0) && shouldAutoCreate(szProfile))
- dbe.pfnEnumCallback=(int(*) (const char*, void*, LPARAM))FindDbPluginAutoCreate;
+ dbe.pfnEnumCallback = (int(*) (const char*, void*, LPARAM))FindDbPluginAutoCreate;
else
- dbe.pfnEnumCallback=(int(*) (const char*, void*, LPARAM))FindDbPluginForProfile;
+ dbe.pfnEnumCallback = (int(*) (const char*, void*, LPARAM))FindDbPluginForProfile;
// find a driver to support the given profile
bool retry;
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index 70c1f965af..d8da15eac6 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -113,21 +113,21 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg, UINT message, WPARAM SetDlgItemTextA(hwndDlg, IDC_SETTINGNAME, szSettingName);
SetDlgItemTextA(hwndDlg, IDC_NEWVALUE, warnInfo->szValue);
if (IsInSpaceSeparatedList(warnInfo->szSection, warnInfo->szSafeSections))
- pszSecurityInfo=LPGENT("This change is known to be safe.");
+ pszSecurityInfo = LPGENT("This change is known to be safe.");
else if (IsInSpaceSeparatedList(warnInfo->szSection, warnInfo->szUnsafeSections))
- pszSecurityInfo=LPGENT("This change is known to be potentially hazardous.");
+ pszSecurityInfo = LPGENT("This change is known to be potentially hazardous.");
else
- pszSecurityInfo=LPGENT("This change is not known to be safe.");
+ pszSecurityInfo = LPGENT("This change is not known to be safe.");
SetDlgItemText(hwndDlg, IDC_SECURITYINFO, TranslateTS(pszSecurityInfo));
return TRUE;
}
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDCANCEL:
- warnInfo->cancel=1;
+ warnInfo->cancel = 1;
case IDYES:
case IDNO:
- warnInfo->warnNoMore=IsDlgButtonChecked(hwndDlg, IDC_WARNNOMORE);
+ warnInfo->warnNoMore = IsDlgButtonChecked(hwndDlg, IDC_WARNNOMORE);
EndDialog(hwndDlg, LOWORD(wParam));
break;
}
@@ -154,10 +154,10 @@ static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg, UINT message, WPARAM EndDialog(hwndDlg, LOWORD(wParam));
break;
case IDC_RECYCLE:
- { SHFILEOPSTRUCT shfo={0};
- shfo.wFunc=FO_DELETE;
- shfo.pFrom=szIniPath;
- szIniPath[lstrlen(szIniPath)+1]='\0';
+ { SHFILEOPSTRUCT shfo = {0};
+ shfo.wFunc = FO_DELETE;
+ shfo.pFrom = szIniPath;
+ szIniPath[lstrlen(szIniPath)+1] = '\0';
shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
SHFileOperation(&shfo);
}
@@ -186,7 +186,7 @@ struct SettingsList int SettingsEnumProc(const char *szSetting, LPARAM lParam)
{
- SettingsList *newItem = (SettingsList *)mir_alloc(sizeof(SettingsList));
+ SettingsList *newItem = (SettingsList *)mir_alloc(sizeof(SettingsList));
newItem->name = mir_strdup(szSetting);
newItem->next = setting_items;
setting_items = newItem;
@@ -222,10 +222,10 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf break;
int lineLength = lstrlenA(szLine);
- while (lineLength && (BYTE)(szLine[lineLength-1])<=' ')
- szLine[--lineLength]='\0';
+ while (lineLength && (BYTE)(szLine[lineLength-1]) <= ' ')
+ szLine[--lineLength] = '\0';
- if (szLine[0] == ';' || szLine[0]<=' ')
+ if (szLine[0] == ';' || szLine[0] <= ' ')
continue;
if (szLine[0] == '[') {
@@ -254,14 +254,14 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf warnThisSection = true;
break;
}
- if (secFN) warnThisSection=0;
+ if (secFN) warnThisSection = 0;
}
if (szLine[1] == '?') {
DBCONTACTENUMSETTINGS dbces;
- dbces.pfnEnumProc=SettingsEnumProc;
+ dbces.pfnEnumProc = SettingsEnumProc;
lstrcpynA(szSection, szLine+2, min(sizeof(szSection), (int)(szEnd-szLine-1)));
- dbces.szModule=szSection;
- dbces.ofsSettings=0;
+ dbces.szModule = szSection;
+ dbces.ofsSettings = 0;
CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
while (setting_items) {
SettingsList *next = setting_items->next;
@@ -282,7 +282,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf if (szSection[0] == '\0')
continue;
- char *szValue=strchr(szLine, '=');
+ char *szValue = strchr(szLine, '=');
if (szValue == NULL)
continue;
@@ -291,20 +291,20 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf szValue++;
{
warnSettingChangeInfo_t warnInfo;
- warnInfo.szIniPath=szIniPath;
- warnInfo.szName=szName;
- warnInfo.szSafeSections=szSafeSections;
- warnInfo.szSection=szSection;
- warnInfo.szUnsafeSections=szUnsafeSections;
- warnInfo.szValue=szValue;
- warnInfo.warnNoMore=0;
- warnInfo.cancel=0;
+ warnInfo.szIniPath = szIniPath;
+ warnInfo.szName = szName;
+ warnInfo.szSafeSections = szSafeSections;
+ warnInfo.szSection = szSection;
+ warnInfo.szUnsafeSections = szUnsafeSections;
+ warnInfo.szValue = szValue;
+ warnInfo.warnNoMore = 0;
+ warnInfo.cancel = 0;
if (warnThisSection && IDNO == DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_WARNINICHANGE), NULL, WarnIniChangeDlgProc, (LPARAM)&warnInfo))
continue;
if (warnInfo.cancel)
break;
if (warnInfo.warnNoMore)
- warnThisSection=0;
+ warnThisSection = 0;
}
switch(szValue[0]) {
@@ -334,13 +334,13 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf case 'g':
case 'G':
{ char *pstr;
- for (pstr=szValue+1;*pstr;pstr++) {
+ for (pstr = szValue+1;*pstr;pstr++) {
if (*pstr == '\\') {
switch(pstr[1]) {
- case 'n': *pstr='\n'; break;
- case 't': *pstr='\t'; break;
- case 'r': *pstr='\r'; break;
- default: *pstr=pstr[1]; break;
+ case 'n': *pstr = '\n'; break;
+ case 't': *pstr = '\t'; break;
+ case 'r': *pstr = '\r'; break;
+ default: *pstr = pstr[1]; break;
}
MoveMemory(pstr+1, pstr+2, lstrlenA(pstr+2)+1);
} } }
@@ -357,17 +357,17 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf char *pszValue, *pszEnd;
DBCONTACTWRITESETTING cws;
- buf=(PBYTE)mir_alloc(lstrlenA(szValue+1));
- for (len=0, pszValue=szValue+1;;len++) {
- buf[len]=(BYTE)strtol(pszValue, &pszEnd, 0x10);
+ buf = (PBYTE)mir_alloc(lstrlenA(szValue+1));
+ for (len = 0, pszValue = szValue+1;;len++) {
+ buf[len] = (BYTE)strtol(pszValue, &pszEnd, 0x10);
if (pszValue == pszEnd) break;
- pszValue=pszEnd;
+ pszValue = pszEnd;
}
- cws.szModule=szSection;
- cws.szSetting=szName;
- cws.value.type=DBVT_BLOB;
- cws.value.pbVal=buf;
- cws.value.cpbVal=len;
+ cws.szModule = szSection;
+ cws.szSetting = szName;
+ cws.value.type = DBVT_BLOB;
+ cws.value.pbVal = buf;
+ cws.value.cpbVal = len;
CallService(MS_DB_CONTACT_WRITESETTING, (WPARAM)(HANDLE)NULL, (LPARAM)&cws);
mir_free(buf);
}
@@ -432,7 +432,7 @@ static void DoAutoExec(void) mir_sntprintf(szIniPath, SIZEOF(szIniPath), _T("%s%s"), szFindPath, fd.cFileName);
if ( !lstrcmpi(szUse, _T("prompt")) && !secFN) {
- int result=DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath);
+ int result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_INSTALLINI), NULL, InstallIniDlgProc, (LPARAM)szIniPath);
if (result == IDC_NOTOALL) break;
if (result == IDCANCEL) continue;
}
@@ -447,11 +447,11 @@ static void DoAutoExec(void) if ( !lstrcmpi(szOnCompletion, _T("delete")))
DeleteFile(szIniPath);
else if ( !lstrcmpi(szOnCompletion, _T("recycle"))) {
- SHFILEOPSTRUCT shfo={0};
- shfo.wFunc=FO_DELETE;
- shfo.pFrom=szIniPath;
- szIniPath[lstrlen(szIniPath)+1]=0;
- shfo.fFlags=FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
+ SHFILEOPSTRUCT shfo = {0};
+ shfo.wFunc = FO_DELETE;
+ shfo.pFrom = szIniPath;
+ szIniPath[lstrlen(szIniPath)+1] = 0;
+ shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO;
SHFileOperation(&shfo);
}
else if ( !lstrcmpi(szOnCompletion, _T("rename"))) {
@@ -487,7 +487,7 @@ int InitIni(void) DoAutoExec();
PathToAbsoluteT(_T("."), szMirandaDir, NULL);
- hIniChangeNotification=FindFirstChangeNotification(szMirandaDir, 0, FILE_NOTIFY_CHANGE_FILE_NAME);
+ hIniChangeNotification = FindFirstChangeNotification(szMirandaDir, 0, FILE_NOTIFY_CHANGE_FILE_NAME);
if (hIniChangeNotification != INVALID_HANDLE_VALUE) {
CreateServiceFunction("DB/Ini/CheckImportNow", CheckIniImportNow);
CallService(MS_SYSTEM_WAITONHANDLE, (WPARAM)hIniChangeNotification, (LPARAM)"DB/Ini/CheckImportNow");
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index 54b352bb4d..1e62b160b4 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -45,7 +45,7 @@ static INT_PTR DbEventTypeRegister(WPARAM, LPARAM lParam) p->cbSize = DBEVENTTYPEDESCR_SIZE;
p->module = mir_strdup(et->module);
p->eventType = et->eventType;
- p->descr = mir_strdup(et->descr);
+ p->descr = mir_strdup(et->descr);
p->textService = NULL;
p->iconService = NULL;
p->eventIcon = NULL;
@@ -132,7 +132,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) }
else {
size_t msglen = strlen((char*)dbei->pBlob) + 1, msglenW = 0;
- if (msglen != dbei->cbBlob) {
+ if (msglen != dbei->cbBlob) {
size_t i, count = ((dbei->cbBlob - msglen) / sizeof(WCHAR));
WCHAR* p = (WCHAR*)&dbei->pBlob[ msglen ];
for (i=0; i < count; i++) {
@@ -231,7 +231,7 @@ static INT_PTR DbDeleteModule(WPARAM, LPARAM lParam) dbces.szModule = (char*)lParam;
CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces);
- for (int i=vars.getCount()-1; i >= 0; i--) {
+ for (int i = vars.getCount()-1; i >= 0; i--) {
DBDeleteContactSetting(NULL, (char*)lParam, vars[i]);
mir_free(vars[i]);
}
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index 32e515efbe..558646e510 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define WM_INPUTCHANGED (WM_USER + 0x3000)
#define WM_FOCUSTEXTBOX (WM_USER + 0x3001)
-typedef BOOL (__cdecl *ENUMPROFILECALLBACK) (TCHAR * fullpath, TCHAR * profile, LPARAM lParam);
+typedef BOOL (__cdecl *ENUMPROFILECALLBACK) (TCHAR *fullpath, TCHAR *profile, LPARAM lParam);
struct DetailsPageInit {
int pageCount;
@@ -76,7 +76,7 @@ static void ThemeDialogBackground(HWND hwnd) enableThemeDialogTexture(hwnd, ETDT_ENABLETAB);
}
-static int findProfiles(TCHAR * szProfileDir, ENUMPROFILECALLBACK callback, LPARAM lParam)
+static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARAM lParam)
{
// find in Miranda IM profile subfolders
HANDLE hFind = INVALID_HANDLE_VALUE;
@@ -242,19 +242,19 @@ char* fullpath = makeFileName((TCHAR*)lParam); return DBPE_CONT;
}
-BOOL EnumProfilesForList(TCHAR * fullpath, TCHAR * profile, LPARAM lParam)
+BOOL EnumProfilesForList(TCHAR *fullpath, TCHAR *profile, LPARAM lParam)
{
ProfileEnumData *ped = (ProfileEnumData*)lParam;
HWND hwndList = GetDlgItem(ped->hwnd, IDC_PROFILELIST);
TCHAR sizeBuf[64];
- int iItem=0;
+ int iItem = 0;
struct _stat statbuf;
bool bFileExists = false, bFileLocked = true;
TCHAR* p = _tcsrchr(profile, '.');
_tcscpy(sizeBuf, _T("0 KB"));
- if (p != NULL) *p=0;
+ if (p != NULL) *p = 0;
LVITEM item = { 0 };
item.mask = LVIF_TEXT | LVIF_IMAGE;
@@ -371,23 +371,23 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, // set columns
col.mask = LVCF_TEXT | LVCF_WIDTH;
col.pszText = TranslateT("Profile");
- col.cx=122;
+ col.cx = 122;
ListView_InsertColumn(hwndList, 0, &col);
col.pszText = TranslateT("Driver");
- col.cx=100;
+ col.cx = 100;
ListView_InsertColumn(hwndList, 1, &col);
col.pszText = TranslateT("Size");
- col.cx=60;
+ col.cx = 60;
ListView_InsertColumn(hwndList, 2, &col);
col.pszText = TranslateT("Created");
- col.cx=145;
+ col.cx = 145;
ListView_InsertColumn(hwndList, 3, &col);
col.pszText = TranslateT("Modified");
- col.cx=145;
+ col.cx = 145;
ListView_InsertColumn(hwndList, 4, &col);
// icons
@@ -445,13 +445,13 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_CONTEXTMENU:
{
LVHITTESTINFO lvht = {0};
- lvht.pt.x = GET_X_LPARAM(lParam);
- lvht.pt.y = GET_Y_LPARAM(lParam);
+ lvht.pt.x = GET_X_LPARAM(lParam);
+ lvht.pt.y = GET_Y_LPARAM(lParam);
ScreenToClient(hwndList, &lvht.pt);
if (ListView_HitTest(hwndList, &lvht) < 0) break;
- lvht.pt.x = GET_X_LPARAM(lParam);
- lvht.pt.y = GET_Y_LPARAM(lParam);
+ lvht.pt.x = GET_X_LPARAM(lParam);
+ lvht.pt.y = GET_Y_LPARAM(lParam);
HMENU hMenu = CreatePopupMenu();
AppendMenu(hMenu, MF_STRING, 1, TranslateT("Run"));
@@ -600,7 +600,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, ShowWindow(GetDlgItem(hwndDlg, IDC_SM_LABEL), FALSE);
ShowWindow(GetDlgItem(hwndDlg, IDC_SM_COMBO), FALSE);
} else {
- int i = 0;
+ int i=0;
LRESULT index;
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_SM_COMBO);
index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)_T(""));
@@ -628,7 +628,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, break;
case PSM_CHANGED:
- dat->opd[dat->currentPage].changed=1;
+ dat->opd[dat->currentPage].changed = 1;
return TRUE;
case PSM_FORCECHANGED:
@@ -671,13 +671,13 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, if (dat->currentPage != -1) {
if (dat->opd[dat->currentPage].hwnd == NULL) {
PSHNOTIFY pshn;
- dat->opd[dat->currentPage].hwnd=CreateDialogIndirectParam(dat->opd[dat->currentPage].hInst, dat->opd[dat->currentPage].pTemplate, hwndDlg, dat->opd[dat->currentPage].dlgProc, (LPARAM)dat->prof);
+ dat->opd[dat->currentPage].hwnd = CreateDialogIndirectParam(dat->opd[dat->currentPage].hInst, dat->opd[dat->currentPage].pTemplate, hwndDlg, dat->opd[dat->currentPage].dlgProc, (LPARAM)dat->prof);
ThemeDialogBackground(dat->opd[dat->currentPage].hwnd);
SetWindowPos(dat->opd[dat->currentPage].hwnd, HWND_TOP, dat->rcDisplay.left, dat->rcDisplay.top, 0, 0, SWP_NOSIZE);
- pshn.hdr.code=PSN_INFOCHANGED;
- pshn.hdr.hwndFrom=dat->opd[dat->currentPage].hwnd;
- pshn.hdr.idFrom=0;
- pshn.lParam=(LPARAM)0;
+ pshn.hdr.code = PSN_INFOCHANGED;
+ pshn.hdr.hwndFrom = dat->opd[dat->currentPage].hwnd;
+ pshn.hdr.idFrom = 0;
+ pshn.lParam = (LPARAM)0;
SendMessage(dat->opd[dat->currentPage].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
}
ShowWindow(dat->opd[dat->currentPage].hwnd, SW_SHOW);
@@ -693,12 +693,12 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, case IDCANCEL:
{ int i;
PSHNOTIFY pshn;
- pshn.hdr.idFrom=0;
- pshn.lParam=0;
- pshn.hdr.code=PSN_RESET;
+ pshn.hdr.idFrom = 0;
+ pshn.lParam = 0;
+ pshn.hdr.code = PSN_RESET;
for (i=0;i<dat->pageCount;i++) {
if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed) continue;
- pshn.hdr.hwndFrom=dat->opd[i].hwnd;
+ pshn.hdr.hwndFrom = dat->opd[i].hwnd;
SendMessage(dat->opd[i].hwnd, WM_NOTIFY, 0, (LPARAM)&pshn);
}
EndDialog(hwndDlg, 0);
@@ -716,8 +716,8 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, {
int i;
PSHNOTIFY pshn;
- pshn.hdr.idFrom=0;
- pshn.lParam=(LPARAM)0;
+ pshn.hdr.idFrom = 0;
+ pshn.lParam = (LPARAM)0;
if (dat->currentPage != -1) {
pshn.hdr.code = PSN_KILLACTIVE;
pshn.hdr.hwndFrom = dat->opd[dat->currentPage].hwnd;
@@ -725,7 +725,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
- pshn.hdr.code=PSN_APPLY;
+ pshn.hdr.code = PSN_APPLY;
for (i=0; i < dat->pageCount; i++) {
if (dat->opd[i].hwnd == NULL || !dat->opd[i].changed)
continue;
@@ -776,15 +776,15 @@ static int AddProfileManagerPage(struct DetailsPageInit * opi, OPTIONSDIALOGPAGE opi->odp = (OPTIONSDIALOGPAGE*)mir_realloc(opi->odp, sizeof(OPTIONSDIALOGPAGE)*(opi->pageCount+1));
{
OPTIONSDIALOGPAGE* p = opi->odp + opi->pageCount++;
- p->cbSize = sizeof(OPTIONSDIALOGPAGE);
- p->hInstance = odp->hInstance;
- p->pfnDlgProc = odp->pfnDlgProc;
- p->position = odp->position;
- p->ptszTitle = Langpack_PcharToTchar(odp->pszTitle);
- p->pszGroup = NULL;
+ p->cbSize = sizeof(OPTIONSDIALOGPAGE);
+ p->hInstance = odp->hInstance;
+ p->pfnDlgProc = odp->pfnDlgProc;
+ p->position = odp->position;
+ p->ptszTitle = Langpack_PcharToTchar(odp->pszTitle);
+ p->pszGroup = NULL;
p->groupPosition = odp->groupPosition;
- p->hGroupIcon = odp->hGroupIcon;
- p->hIcon = odp->hIcon;
+ p->hGroupIcon = odp->hGroupIcon;
+ p->hIcon = odp->hIcon;
if ((DWORD_PTR)odp->pszTemplate & 0xFFFF0000)
p->pszTemplate = mir_strdup(odp->pszTemplate);
else
@@ -796,34 +796,34 @@ static int AddProfileManagerPage(struct DetailsPageInit * opi, OPTIONSDIALOGPAGE int getProfileManager(PROFILEMANAGERDATA * pd)
{
DetailsPageInit opi;
- opi.pageCount=0;
- opi.odp=NULL;
+ opi.pageCount = 0;
+ opi.odp = NULL;
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.cbSize = sizeof(odp);
- odp.pszTitle = LPGEN("My Profiles");
- odp.pfnDlgProc = DlgProfileSelect;
+ odp.cbSize = sizeof(odp);
+ odp.pszTitle = LPGEN("My Profiles");
+ odp.pfnDlgProc = DlgProfileSelect;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PROFILE_SELECTION);
- odp.hInstance = hInst;
+ odp.hInstance = hInst;
AddProfileManagerPage(&opi, &odp);
- odp.pszTitle = LPGEN("New Profile");
+ odp.pszTitle = LPGEN("New Profile");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PROFILE_NEW);
- odp.pfnDlgProc = DlgProfileNew;
+ odp.pfnDlgProc = DlgProfileNew;
AddProfileManagerPage(&opi, &odp);
}
PROPSHEETHEADER psh = { 0 };
- psh.dwSize = sizeof(psh);
- psh.dwFlags = PSH_PROPSHEETPAGE|PSH_NOAPPLYNOW;
+ psh.dwSize = sizeof(psh);
+ psh.dwFlags = PSH_PROPSHEETPAGE|PSH_NOAPPLYNOW;
psh.hwndParent = NULL;
- psh.nPages = opi.pageCount;
+ psh.nPages = opi.pageCount;
psh.pStartPage = 0;
- psh.ppsp = (PROPSHEETPAGE*)opi.odp;
+ psh.ppsp = (PROPSHEETPAGE*)opi.odp;
DlgProfData prof;
- prof.pd = pd;
+ prof.pd = pd;
prof.psh = &psh;
int rc = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_PROFILEMANAGER), NULL, DlgProfileManager, (LPARAM)&prof);
diff --git a/src/modules/database/profilemanager.h b/src/modules/database/profilemanager.h index 9d4e7821e1..416403f057 100644 --- a/src/modules/database/profilemanager.h +++ b/src/modules/database/profilemanager.h @@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
typedef struct {
- TCHAR * szProfile; // in/out
- TCHAR * szProfileDir; // in/out
+ TCHAR *szProfile; // in/out
+ TCHAR *szProfileDir; // in/out
BOOL noProfiles; // in
BOOL newProfile; // out
DATABASELINK * dblink; // out
@@ -32,10 +32,10 @@ typedef struct { int InitUtils(void);
char* makeFileName(const TCHAR* tszOriginalName);
-int makeDatabase(TCHAR * profile, DATABASELINK * link, HWND hwndDlg);
+int makeDatabase(TCHAR *profile, DATABASELINK * link, HWND hwndDlg);
int getProfileManager(PROFILEMANAGERDATA * pd);
-int getProfilePath(TCHAR * buf, size_t cch);
-int isValidProfileName(const TCHAR * name);
+int getProfilePath(TCHAR *buf, size_t cch);
+int isValidProfileName(const TCHAR *name);
bool fileExist(TCHAR* fname);
bool shouldAutoCreate(TCHAR *szProfile);
|