diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-06 23:03:26 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-06 23:03:26 +0300 |
commit | 9022cd651aaf7e0cd44d2c987b329f9ae0a21529 (patch) | |
tree | cfb8aab5bcd0aa454d650885a5d6911820ee8396 | |
parent | 776188f249fa2360bafcc3083119efc9d82446b7 (diff) |
it's all for today, i need to sleep
-rw-r--r-- | commonheaders.h | 1 | ||||
-rw-r--r-- | options.cpp | 7 | ||||
-rw-r--r-- | utilities.cpp | 22 | ||||
-rw-r--r-- | utilities.h | 1 |
4 files changed, 31 insertions, 0 deletions
diff --git a/commonheaders.h b/commonheaders.h index 6986e13..db3682b 100644 --- a/commonheaders.h +++ b/commonheaders.h @@ -17,6 +17,7 @@ #define COMMONHEADERS_H #include <windows.h> #include <locale.h> +#include <shlobj.h> #define MIRANDA_VER 0x0801 diff --git a/options.cpp b/options.cpp index 6d223ee..8eb471c 100644 --- a/options.cpp +++ b/options.cpp @@ -100,6 +100,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { TranslateDialogDefault(hwndDlg); SetDlgItemText(hwndDlg, IDC_BIN_PATH, UniGetContactSettingUtf(NULL, szModuleName, "szGpgBinPath", _T("gpg2.exe"))); + SetDlgItemText(hwndDlg, IDC_HOME_DIR, UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T("gpg"))); return TRUE; } @@ -112,6 +113,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetFilePath(_T("Choose gpg2.exe"), "szGpgBinPath", _T("*.exe"), _T("EXE Executables")); SetDlgItemText(hwndDlg, IDC_BIN_PATH, UniGetContactSettingUtf(NULL, szModuleName, "szGpgBinPath", _T("gpg2.exe"))); break; + case IDC_SET_HOME_DIR: + GetFolderPath(_T("Set home diractory"), "szHomePath"); + SetDlgItemText(hwndDlg, IDC_HOME_DIR, UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T(""))); + break; default: break; } @@ -130,6 +135,8 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR tmp[512]; GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512); DBWriteContactSettingTString(NULL, szModuleName, "szGpgBinPath", tmp); + GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); + DBWriteContactSettingTString(NULL, szModuleName, "szHomePath", tmp); return TRUE; } } diff --git a/utilities.cpp b/utilities.cpp index f8ea696..0654bd6 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -101,3 +101,25 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx return; DBWriteContactSettingTString(0, szModuleName, szSetting, str); } + +void GetFolderPath(TCHAR *WindowTittle, char *szSetting) +{ + BROWSEINFO pbi = {0}; + pbi.lpszTitle = WindowTittle; + pbi.ulFlags = BIF_EDITBOX|BIF_NEWDIALOGSTYLE|BIF_SHAREABLE; + LPITEMIDLIST pidl = SHBrowseForFolder(&pbi);
+ if (pidl != 0)
+ {
+ TCHAR path[MAX_PATH];
+ if (SHGetPathFromIDList(pidl, path))
+ {
+ DBWriteContactSettingTString(NULL, szModuleName, "szHomePath", path);
+ }
+ IMalloc * imalloc = 0;
+ if (SUCCEEDED(SHGetMalloc(&imalloc)))
+ {
+ imalloc->Free(pidl);
+ imalloc->Release();
+ }
+ }
+} diff --git a/utilities.h b/utilities.h index e3622dd..c913838 100644 --- a/utilities.h +++ b/utilities.h @@ -18,5 +18,6 @@ #define UTILITIES_H TCHAR* __stdcall UniGetContactSettingUtf(HANDLE hContact, const char *szModule,const char* szSetting, TCHAR* szDef); void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szExtDesc); +void GetFolderPath(TCHAR *WindowTittle, char *szSetting); #endif |