1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4 * JP Rosevear <jpr@ximian.com>
6 * Copyright 2003, Novell, Inc.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
30 #include "exchangeitaccount.h"
32 #define EXCHANGEIT_GCONF_SERVER "/apps/evolution-exchangeit/account_server"
33 #define EXCHANGEIT_GCONF_USER "/apps/evolution-exchangeit/account_user"
34 #define EXCHANGEIT_GCONF_PASSWORD "/apps/evolution-exchangeit/account_password"
36 ExchangeItAccount::ExchangeItAccount(WvStringParm _server
,
38 WvStringParm _password
) :
45 ExchangeItAccount::ExchangeItAccount(GConfClient
*gconf
)
47 WvString server_value
= gconf_client_get_string(gconf
,
48 EXCHANGEIT_GCONF_SERVER
,
50 WvString user_value
= gconf_client_get_string(gconf
,
51 EXCHANGEIT_GCONF_USER
,
54 WvString password_value
= gconf_client_get_string(gconf
,
55 EXCHANGEIT_GCONF_PASSWORD
,
58 // FIXME: There HAS to be a better way of doing this...
59 // are the accessors used anywhere else.. if not, then why use
60 // them here... especially since wherever else they are being used
61 // they need to be validated... do they not?
63 if (!!server_value
&& !!user_value
&& !!password_value
)
65 set_server(server_value
);
67 set_password(password_value
);
71 void ExchangeItAccount::save(GConfClient
*gconf
)
73 // Since it is possible to get here without having a value in server,
74 // user and/or password, probably some sort of check and an error return
75 // would be usefull here.
76 gconf_client_set_string (gconf
, EXCHANGEIT_GCONF_SERVER
,
79 gconf_client_set_string (gconf
, EXCHANGEIT_GCONF_USER
,
82 gconf_client_set_string (gconf
, EXCHANGEIT_GCONF_PASSWORD
,
83 password
.cstr(), NULL
);