1 /* 2 * Copyright 2003-2004 Waldemar Kornewald. All rights reserved. 3 * Copyright 2017 Haiku, Inc. All rights reserved. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef _DIAL_UP_VIEW__H 7 #define _DIAL_UP_VIEW__H 8 9 #include <Message.h> 10 #include <View.h> 11 12 #include <PPPInterfaceListener.h> 13 14 class BMenuItem; 15 class BStringView; 16 class BButton; 17 class BPopUpMenu; 18 class BMenuField; 19 class BTabView; 20 class GeneralAddon; 21 22 23 class DialUpView : public BView { 24 public: 25 DialUpView(); 26 virtual ~DialUpView(); 27 28 virtual void AttachedToWindow(); 29 virtual void MessageReceived(BMessage *message); 30 31 void UpDownThread(); 32 33 // used by ppp_up application 34 bool SelectInterfaceNamed(const char *name); 35 bool NeedsRequest() const; 36 BView *StatusView() const; 37 BView *ConnectButton() const; 38 bool SaveSettings(BMessage *settings, BMessage *profile, bool saveTemporary); 39 bool SaveSettingsToFile(); 40 41 private: 42 void GetPPPDirectories(BDirectory *settingsDirectory, 43 BDirectory *profileDirectory) const; 44 45 void HandleReportMessage(BMessage *message); 46 void CreateTabs(); 47 48 void UpdateStatus(int32 code); 49 void WatchInterface(ppp_interface_id ID); 50 51 bool LoadSettings(bool isNew); 52 void IsModified(bool *settings, bool *profile); 53 54 void LoadInterfaces(); 55 void LoadAddons(); 56 57 void AddInterface(const char *name, bool isNew = false); 58 void SelectInterface(int32 index, bool isNew = false); 59 int32 CountInterfaces() const; 60 61 void UpdateControls(); 62 63 private: 64 PPPInterfaceListener fListener; 65 66 thread_id fUpDownThread; 67 68 BMessage fAddons, fSettings, fProfile; 69 driver_settings *fDriverSettings; 70 BMenuItem *fCurrentItem, *fDeleterItem; 71 ppp_interface_id fWatching; 72 73 GeneralAddon *fGeneralAddon; 74 bool fKeepLabel; 75 BStringView *fStatusView; 76 BButton *fConnectButton, *fCreateNewButton; 77 BPopUpMenu *fInterfaceMenu; 78 BMenuField *fMenuField; 79 BStringView *fStringView; 80 // shows "No interfaces found..." notice 81 BTabView *fTabView; 82 }; 83 84 85 #endif 86