1/*
2 * Copyright 2005, Waldemar Kornewald <wkornew@gmx.net>
3 * Distributed under the terms of the MIT License.
4 */
5
6#ifndef CONNECTION_VIEW__H
7#define CONNECTION_VIEW__H
8
9#include <CheckBox.h>
10#include <Message.h>
11#include <TextControl.h>
12
13#include <PPPInterfaceListener.h>
14
15class BButton;
16class BStringView;
17
18
19class ConnectionView : public BView {
20		friend class ConnectionWindow;
21
22	public:
23		ConnectionView(BRect rect, const BString& interfaceName);
24
25		virtual void AttachedToWindow();
26		virtual void MessageReceived(BMessage *message);
27
28		const char *Username() const
29			{ return fUsername->Text(); }
30		const char *Password() const
31			{ return fPassword->Text(); }
32		bool DoesSavePassword() const
33			{ return fSavePassword->Value(); }
34
35	private:
36		void Reload();
37
38		void Connect();
39		void Cancel();
40		void CleanUp();
41
42		BString AttemptString() const;
43		void HandleReportMessage(BMessage *message);
44		void UpdateStatus(int32 code);
45		void WatchInterface(ppp_interface_id ID);
46
47	private:
48		PPPInterfaceListener fListener;
49		BString fInterfaceName;
50
51		BTextControl *fUsername, *fPassword;
52		BCheckBox *fSavePassword;
53		BStringView *fAttemptView, *fStatusView;
54		BButton *fConnectButton, *fCancelButton;
55
56		BMessage fSettings;
57		bool fKeepLabel, fHasUsername, fHasPassword, fAskBeforeConnecting;
58};
59
60
61#endif
62