diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-02 13:38:53 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-02 13:38:53 +0000 |
commit | 3d26dc75537137d829cc388abe0b9fe4b2df0d9d (patch) | |
tree | 61ee0925fca5f4d9ab10ef3ea5a8e14f213a1a11 /plugins/ExternalAPI/m_folders.h | |
parent | 6d46936f5711c2b927b88f4c93cf1431a776bbba (diff) |
unicode folders custom names (gotten from szName by default, as usual)
git-svn-id: http://svn.miranda-ng.org/main/trunk@3835 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ExternalAPI/m_folders.h')
-rw-r--r-- | plugins/ExternalAPI/m_folders.h | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/plugins/ExternalAPI/m_folders.h b/plugins/ExternalAPI/m_folders.h index 5d1471a1da..550f52f44c 100644 --- a/plugins/ExternalAPI/m_folders.h +++ b/plugins/ExternalAPI/m_folders.h @@ -77,17 +77,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define FF_TCHAR 0
#endif
-typedef struct{
- int cbSize; //size of struct
- LPCSTR szSection; //section name, if it doesn't exist it will be created otherwise it will just add this entry to it
- LPCSTR szName; //entry name - will be shown in options
+typedef struct
+{
+ int cbSize; //size of struct
+ LPCSTR szSection; //section name, if it doesn't exist it will be created otherwise it will just add this entry to it
+ LPCSTR szName; //entry name - will be shown in options
union {
- const char *szFormat; //default string format. Fallback string in case there's no entry in the database for this folder. This should be the initial value for the path, users will be able to change it later.
- const wchar_t *szFormatW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
+ const char *szFormat; //default string format. Fallback string in case there's no entry in the database for this folder. This should be the initial value for the path, users will be able to change it later.
+ const wchar_t *szFormatW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
const TCHAR *szFormatT;
};
- DWORD flags; //FF_* flags
-} FOLDERSDATA;
+ DWORD flags; //FF_* flags
+ union {
+ const char *szUserName; //for display purposes. if NULL, plugins gets it as the translated szName
+ const wchar_t *szUserNameW; //String is dup()'d so you can free it later. If you set the unicode string don't forget to set the flag accordingly.
+ const TCHAR *szUserNameT;
+ };
+}
+ FOLDERSDATA;
+
+#define FOLDERSDATA_SIZE_V1 FIELD_OFFSET(FOLDERSDATA,szUserName)
/*Folders/Register/Path service
wParam - not used, must be 0
@@ -140,9 +149,8 @@ typedef struct{ __inline static HANDLE FoldersRegisterCustomPath(const char *section, const char *name, const char *defaultPath)
{
- FOLDERSDATA fd = {0};
if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0;
- fd.cbSize = sizeof(FOLDERSDATA);
+ FOLDERSDATA fd = { sizeof(fd) };
fd.szSection = section;
fd.szName = name;
fd.szFormat = defaultPath;
@@ -150,14 +158,14 @@ __inline static HANDLE FoldersRegisterCustomPath(const char *section, const char }
#ifdef _UNICODE
-__inline static HANDLE FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW)
+__inline static HANDLE FoldersRegisterCustomPathW(const char *section, const char *name, const wchar_t *defaultPathW, const wchar_t *userNameW = NULL)
{
- FOLDERSDATA fd = {0};
if (!ServiceExists(MS_FOLDERS_REGISTER_PATH)) return 0;
- fd.cbSize = sizeof(FOLDERSDATA);
+ FOLDERSDATA fd = { sizeof(fd) };
fd.szSection = section;
fd.szName = name;
fd.szFormatW = defaultPathW;
+ fd.szUserNameW = userNameW;
fd.flags = FF_UNICODE;
return (HANDLE) CallService(MS_FOLDERS_REGISTER_PATH, 0, (LPARAM) &fd);
}
@@ -165,12 +173,10 @@ __inline static HANDLE FoldersRegisterCustomPathW(const char *section, const cha __inline static INT_PTR FoldersGetCustomPath(HANDLE hFolderEntry, char *path, const int size, const char *notFound)
{
- FOLDERSGETDATA fgd = {0};
- INT_PTR res;
- fgd.cbSize = sizeof(FOLDERSGETDATA);
+ FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
fgd.szPath = path;
- res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res) {
char buffer[MAX_PATH];
CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) notFound, (LPARAM) buffer);
@@ -183,13 +189,11 @@ __inline static INT_PTR FoldersGetCustomPath(HANDLE hFolderEntry, char *path, co #ifdef _UNICODE
__inline static INT_PTR FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *pathW, const int size, const wchar_t *notFoundW)
{
- FOLDERSGETDATA fgd = {0};
- INT_PTR res;
- fgd.cbSize = sizeof(FOLDERSGETDATA);
+ FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
fgd.szPathW = pathW;
fgd.flags = FF_UNICODE;
- res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res) {
wchar_t buffer[MAX_PATH];
CallService(MS_UTILS_PATHTOABSOLUTEW, (WPARAM) notFoundW, (LPARAM) buffer);
@@ -202,12 +206,10 @@ __inline static INT_PTR FoldersGetCustomPathW(HANDLE hFolderEntry, wchar_t *path __inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path, const int size, char *notFound, char *fileName)
{
- FOLDERSGETDATA fgd = {0};
- INT_PTR res;
- fgd.cbSize = sizeof(FOLDERSGETDATA);
+ FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
fgd.szPath = path;
- res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res) {
char buffer[MAX_PATH];
CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM) notFound, (LPARAM) buffer);
@@ -228,13 +230,11 @@ __inline static INT_PTR FoldersGetCustomPathEx(HANDLE hFolderEntry, char *path, #ifdef _UNICODE
__inline static INT_PTR FoldersGetCustomPathExW(HANDLE hFolderEntry, wchar_t *pathW, const int size, wchar_t *notFoundW, wchar_t *fileNameW)
{
- FOLDERSGETDATA fgd = {0};
- INT_PTR res;
- fgd.cbSize = sizeof(FOLDERSGETDATA);
+ FOLDERSGETDATA fgd = { sizeof(fgd) };
fgd.nMaxPathSize = size;
fgd.szPathW = pathW;
fgd.flags = FF_UNICODE;
- res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
+ INT_PTR res = CallService(MS_FOLDERS_GET_PATH, (WPARAM) hFolderEntry, (LPARAM) &fgd);
if (res) {
wchar_t buffer[MAX_PATH];
CallService(MS_UTILS_PATHTOABSOLUTEW, (WPARAM) notFoundW, (LPARAM) buffer);
|