1 |
twoaday |
2 |
/* wptGroupsDlg.cpp - Group management |
2 |
|
|
* Copyright (C) 2001, 2002, 2003 Timo Schulz |
3 |
|
|
* |
4 |
|
|
* This file is part of WinPT. |
5 |
|
|
* |
6 |
|
|
* WinPT is free software; you can redistribute it and/or modify |
7 |
|
|
* it under the terms of the GNU General Public License as published by |
8 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
* (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* WinPT is distributed in the hope that it will be useful, |
12 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with WinPT; if not, write to the Free Software Foundation, |
18 |
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#include <windows.h> |
22 |
|
|
#include <commctrl.h> |
23 |
|
|
#include <stdio.h> |
24 |
|
|
|
25 |
|
|
#include "../resource.h" |
26 |
|
|
#include "wptTypes.h" |
27 |
|
|
#include "wptW32API.h" |
28 |
|
|
#include "wptErrors.h" |
29 |
|
|
#include "wptNLS.h" |
30 |
|
|
#include "wptGPG.h" |
31 |
|
|
#include "wptCommonCtl.h" |
32 |
|
|
#include "wptContext.h" |
33 |
|
|
#include "wptDlgs.h" |
34 |
|
|
#include "wptKeyManager.h" |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
BOOL CALLBACK |
38 |
|
|
group_manager_dlg_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam ) |
39 |
|
|
{ |
40 |
|
|
static km_group_cb_s *ctx; |
41 |
|
|
char name[256]; |
42 |
|
|
|
43 |
|
|
switch ( msg ) { |
44 |
|
|
case WM_INITDIALOG: |
45 |
|
|
ctx = (km_group_cb_s *)lparam; |
46 |
|
|
if (!ctx) |
47 |
|
|
dlg_fatal_error( dlg, "Can't get dialog param" ); |
48 |
|
|
#ifndef LANG_DE |
49 |
|
|
SetWindowText( dlg, _("New Group") ); |
50 |
|
|
#endif |
51 |
|
|
SetForegroundWindow( dlg ); |
52 |
|
|
break; |
53 |
|
|
|
54 |
|
|
case WM_SYSCOMMAND: |
55 |
|
|
if( LOWORD(wparam) == SC_CLOSE ) { |
56 |
|
|
ctx->use_name = 0; |
57 |
|
|
EndDialog( dlg, TRUE ); |
58 |
|
|
} |
59 |
|
|
return FALSE; |
60 |
|
|
|
61 |
|
|
case WM_COMMAND: |
62 |
|
|
switch( LOWORD( wparam ) ) { |
63 |
|
|
case IDOK: |
64 |
|
|
if( !GetDlgItemText(dlg, IDC_GROUP_EMAIL, name, sizeof name -1 ) ) { |
65 |
|
|
msg_box( dlg, _("Please enter the email address"), _("Group manager"), MB_ERR ); |
66 |
|
|
return FALSE; |
67 |
|
|
} |
68 |
|
|
add_group( ctx->gc->gh, name ); |
69 |
|
|
strcpy( ctx->name, name ); |
70 |
|
|
ctx->use_name = 1; |
71 |
|
|
EndDialog( dlg, TRUE ); |
72 |
|
|
return TRUE; |
73 |
|
|
|
74 |
|
|
case IDCANCEL: |
75 |
|
|
ctx->use_name = 0; |
76 |
|
|
EndDialog( dlg, FALSE ); |
77 |
|
|
return FALSE; |
78 |
|
|
} |
79 |
|
|
break; |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
return FALSE; |
83 |
|
|
} /* group_manager_dlg_proc */ |