diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-11 05:22:07 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-11 05:22:07 +0300 |
commit | 41539458d2d114cb714b72315c482e33340a9ee3 (patch) | |
tree | 0dffe24b1af5cdd47b00ba8e5bb79cc5853f2c02 /main.cpp | |
parent | ff34af8edad99fae99b59def8a3d5cce92085a9c (diff) |
modified: init.cpp
modified: main.cpp
modified: messages.cpp
modified: new_gpg.rc
modified: options.cpp
modified: resource.h
modified: utilities.cpp
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);
+}
|