diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 99 |
1 files changed, 74 insertions, 25 deletions
@@ -21,30 +21,79 @@ void test()
{
- DWORD exitcode;
- string output;
- TCHAR *bin_path = UniGetContactSettingUtf(NULL, szModuleName, "szGpgBinPath", _T(""));
+ string out;
+ DWORD code;
+ TCHAR cmd[512];
+ _tcscpy(cmd, _T("--list-secret-keys"));
+ pxExecute(cmd, "", &out, &code);
+ MessageBoxA(0, out.c_str(), "test", MB_OK);
+}
+
+
+HWND hwndFirstRun = NULL;
+
+static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+ return TRUE;
+ }
+
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case ID_OK:
+ DestroyWindow(hwndDlg);
+ break;
+ }
+ break;
+ }
+
+ case WM_NOTIFY:
+ {
+ switch (((LPNMHDR)lParam)->code)
+ {
+
+ case PSN_APPLY:
+ {
+ return TRUE;
+ }
+ }
+ }
+ break;
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
+ break;
+ case WM_DESTROY:
+ hwndFirstRun = NULL;
+ break;
+
+ }
+
+ return FALSE;
+}
+
+extern HINSTANCE hInst;
+
+void ShowFirstRunDialog()
+{
+ if (hwndFirstRun == NULL)
{
- if(_waccess(bin_path, 0) == -1)
- if(errno == ENOENT)
- {
- mir_free(bin_path);
- return;
- }
+ hwndFirstRun = CreateDialog(hInst, MAKEINTRESOURCE(IDD_FIRST_RUN), NULL, DlgProcFirstRun);
}
- TCHAR *home_dir = UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T(""));
- TCHAR bin[512];
- _tcscpy(bin, bin_path);
- _tcscat(bin, _T(" --homedir "));
- _tcscat(bin, _T("\""));
- _tcscat(bin, home_dir);
- _tcscat(bin, _T("\""));
- _tcscat(bin, _T(" --help"));
- pxResult pxresult=pxExecute(bin,"",&output,&exitcode);
- mir_free(bin_path);
- mir_free(home_dir);
-/* fstream f("c:\\str.txt", std::ios::out);
- f<<output;
- f.close();
- MessageBoxA(0, output.c_str(), "", MB_OK); */
-}
\ No newline at end of file + SetForegroundWindow(hwndFirstRun);
+}
+
+
+void FirstRun()
+{
+ if(!DBGetContactSettingByte(NULL, szModuleName, "FirstRun", 1))
+ return;
+ ShowFirstRunDialog();
+ DBWriteContactSettingByte(NULL, szModuleName, "FirstRun", 0);
+}
|