1 |
/* 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 |
#ifdef HAVE_CONFIG_H |
22 |
#include <config.h> |
23 |
#endif |
24 |
|
25 |
#include <windows.h> |
26 |
#include <windows.h> |
27 |
#include <commctrl.h> |
28 |
#include <stdio.h> |
29 |
|
30 |
#include "../resource.h" |
31 |
#include "wptTypes.h" |
32 |
#include "wptW32API.h" |
33 |
#include "wptErrors.h" |
34 |
#include "wptNLS.h" |
35 |
#include "wptGPG.h" |
36 |
#include "wptCommonCtl.h" |
37 |
#include "wptContext.h" |
38 |
#include "wptDlgs.h" |
39 |
#include "wptKeyManager.h" |
40 |
|
41 |
|
42 |
BOOL CALLBACK |
43 |
group_manager_dlg_proc( HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam ) |
44 |
{ |
45 |
static km_group_cb_s *ctx; |
46 |
char name[256]; |
47 |
|
48 |
switch ( msg ) { |
49 |
case WM_INITDIALOG: |
50 |
ctx = (km_group_cb_s *)lparam; |
51 |
if (!ctx) |
52 |
dlg_fatal_error( dlg, "Can't get dialog param" ); |
53 |
#ifndef LANG_DE |
54 |
SetWindowText( dlg, _("New Group") ); |
55 |
#endif |
56 |
SetForegroundWindow( dlg ); |
57 |
break; |
58 |
|
59 |
case WM_SYSCOMMAND: |
60 |
if( LOWORD(wparam) == SC_CLOSE ) { |
61 |
ctx->use_name = 0; |
62 |
EndDialog( dlg, TRUE ); |
63 |
} |
64 |
return FALSE; |
65 |
|
66 |
case WM_COMMAND: |
67 |
switch( LOWORD( wparam ) ) { |
68 |
case IDOK: |
69 |
if( !GetDlgItemText(dlg, IDC_GROUP_EMAIL, name, sizeof name -1 ) ) { |
70 |
msg_box( dlg, _("Please enter the email address"), _("Group manager"), MB_ERR ); |
71 |
return FALSE; |
72 |
} |
73 |
add_group( ctx->gc->gh, name ); |
74 |
strcpy( ctx->name, name ); |
75 |
ctx->use_name = 1; |
76 |
EndDialog( dlg, TRUE ); |
77 |
return TRUE; |
78 |
|
79 |
case IDCANCEL: |
80 |
ctx->use_name = 0; |
81 |
EndDialog( dlg, FALSE ); |
82 |
return FALSE; |
83 |
} |
84 |
break; |
85 |
} |
86 |
|
87 |
return FALSE; |
88 |
} /* group_manager_dlg_proc */ |