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