diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-17 16:46:21 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-17 16:46:21 +0300 |
commit | 5e2da550b8bde42999cdc970b06e110b4c48c6a8 (patch) | |
tree | d7af0eac865a7a9874fff4d40cecdc22c372e12a | |
parent | bec09dbab4b07281f3da8478618deb9c10aa0a29 (diff) |
fix for displaying locked/used profiles in Profile Manager window
-rw-r--r-- | src/mir_app/src/database.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/profilemanager.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/profilemanager.h | 1 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp index 2dc134e6da..8ca3bcef1b 100644 --- a/src/mir_app/src/database.cpp +++ b/src/mir_app/src/database.cpp @@ -450,7 +450,7 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam) return TRUE;
}
-static int FindMirandaForProfile(wchar_t *szProfile)
+int findMirandaForProfile(wchar_t *szProfile)
{
ENUMMIRANDAWINDOW x = {};
x.profile = szProfile;
@@ -488,7 +488,7 @@ int LoadDatabaseModule(void) }
// if this profile is already opened in another miranda, silently return
- if (FindMirandaForProfile(szProfile))
+ if (findMirandaForProfile(szProfile))
return 1;
// find a driver to support the given profile
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index a39fee2bb0..07ae55e4a1 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -248,7 +248,7 @@ class CChooseProfileDlg : public CDlgBase CCtrlListView &list = ped->list; wchar_t sizeBuf[64]; - bool bFileLocked = true; + bool bFileLocked; wchar_t *p = wcsrchr(profile, '.'); mir_wstrcpy(sizeBuf, L"0 KB"); @@ -269,8 +269,9 @@ class CChooseProfileDlg : public CDlgBase mir_snwprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1024.0); mir_wstrcpy(sizeBuf + 5, L" KB"); } - bFileLocked = !fileExist(tszFullPath); + bFileLocked = findMirandaForProfile(tszFullPath) != 0; } + else bFileLocked = true; DATABASELINK *dblink; switch (touchDatabase(tszFullPath, &dblink)) { diff --git a/src/mir_app/src/profilemanager.h b/src/mir_app/src/profilemanager.h index da5001b4f5..a3c238f9ca 100644 --- a/src/mir_app/src/profilemanager.h +++ b/src/mir_app/src/profilemanager.h @@ -35,6 +35,7 @@ struct PROFILEMANAGERDATA DATABASELINK *dblink; // out
};
+int findMirandaForProfile(wchar_t *szProfile);
char* makeFileName(const wchar_t *tszOriginalName);
int touchDatabase(const wchar_t *tszProfile, DATABASELINK **pDblink);
int getProfileManager(PROFILEMANAGERDATA *pd);
|