InternetTab Class Reference

Allows the user to set Internet-related options. More...

#include <optsinet.h>

Inheritance diagram for InternetTab:

OptionsTabs ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

virtual BOOL HandleMsg (DialogMsg *Msg)
 Handles all the Internet options tabs messages.
virtual BOOL InitSection ()
 Sets initial values for the Page section of the options dialog box. This section includes the:-.
virtual BOOL CommitSection ()
 Effect any changes made to the Internet settings.
virtual CDlgResID GetPageID ()
virtual BOOL IsDocumentOption ()
virtual BOOL IsProgramOption ()

Detailed Description

Allows the user to set Internet-related options.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/06/97
See also:
OptionsTabs; AppPrefsDlg;

Definition at line 121 of file optsinet.h.


Member Function Documentation

BOOL InternetTab::CommitSection  )  [virtual]
 

Effect any changes made to the Internet settings.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/06/97
Returns:
TRUE if succesful, FALSE otherwise

Implements OptionsTabs.

Definition at line 125 of file optsinet.cpp.

00126 {
00127     ERROR2IF(pPrefsDlg==NULL,FALSE,"GridTab::CommitSection() - pPrefsDlg==NULL");
00128     if (pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_INTERNET))==FALSE)
00129         return TRUE;    // just return with no error
00130 
00131     // Read in the new potential cache size
00132     BOOL Valid = TRUE;
00133     UINT32 lCacheSize = pPrefsDlg->GetMemoryGadgetValue(_R(IDC_CACHESIZE),1024,UINT32_MAX,_R(IDS_INVALIDCACHESIZE),&Valid);
00134 
00135     if ((lCacheSize < 500 * SIZEOFKILOBYTE) || (lCacheSize == UINT32_MAX))
00136     {
00137         InformWarning(_R(IDS_INVALIDCACHESIZE));
00138 
00139         if (lCacheSize < 500 * SIZEOFKILOBYTE)
00140         {
00141             lCacheSize = 500 * SIZEOFKILOBYTE;
00142         }
00143         else
00144         {
00145             lCacheSize = UINT32_MAX;
00146         }
00147 
00148         pPrefsDlg->SetMemoryGadgetValue(_R(IDC_CACHESIZE), lCacheSize);
00149     }
00150 
00151     if(!Valid) return FALSE;
00152 
00153     if (Valid && !DownloadCache::SetSize(lCacheSize))
00154     {
00155         InformError(_R(IDS_INSUFFICIENT_DISK_SPACE));
00156         return FALSE;
00157     }
00158 
00159     UINT32 lCacheUsage = DownloadCache::GetUsage();
00160     pPrefsDlg->SetLongGadgetValue(_R(IDC_CACHEUSAGE), lCacheUsage);
00161 
00162     // Sort out the connection type
00163     if (pPrefsDlg->GetBoolGadgetSelected(_R(IDC_14K)))
00164         InternetManager::SetConnectionType(CONNECTION_SLOWMODEM);
00165     else if (pPrefsDlg->GetBoolGadgetSelected(_R(IDC_28K)))
00166         InternetManager::SetConnectionType(CONNECTION_FASTMODEM);
00167     else if (pPrefsDlg->GetBoolGadgetSelected(_R(IDC_56K)))
00168         InternetManager::SetConnectionType(CONNECTION_X2);
00169     else if (pPrefsDlg->GetBoolGadgetSelected(_R(IDC_ISDN)))
00170         InternetManager::SetConnectionType(CONNECTION_ISDN);
00171     return TRUE;
00172 }

virtual CDlgResID InternetTab::GetPageID  )  [inline, virtual]
 

Implements OptionsTabs.

Definition at line 135 of file optsinet.h.

00135 {return _R(IDD_OPTSTAB_INTERNET);} // Return section/page id system

BOOL InternetTab::HandleMsg DialogMsg Msg  )  [virtual]
 

Handles all the Internet options tabs messages.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/07/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Implements OptionsTabs.

Definition at line 190 of file optsinet.cpp.

00191 {
00192     ERROR2IF(Msg == NULL,FALSE,"Null message received");
00193     ERROR2IF(pPrefsDlg == NULL,FALSE,"HandleMsg called with no dialog pointer");
00194 
00195     BOOL ok = pPrefsDlg->TalkToPage(_R(IDD_OPTSTAB_INTERNET));  // The Page page identifier
00196     if (!ok)
00197         return TRUE;        // page not present
00198 
00199     switch(Msg->DlgMsg)
00200     {
00201         case DIM_CREATE:    // Initialise controls
00202             ok = InitSection();
00203             if (!ok)
00204                 InformError();
00205             break;
00206         case DIM_TEXT_CHANGED:
00207             OptionsTabs::SetApplyNowState(TRUE);
00208             OptionsTabs::UngreyApplyNow();
00209             break;
00210         case DIM_LFT_BN_CLICKED:
00211             switch (Msg->GadgetID)
00212             {
00213                 case _R(IDC_FLUSHCACHE):
00214                     {
00215                         DownloadCache::Flush();
00216                         UINT32 lCacheUsage = DownloadCache::GetUsage();
00217                         pPrefsDlg->SetMemoryGadgetValue(_R(IDC_CACHEUSAGE), lCacheUsage);
00218                     }
00219                     break;
00220                 default:
00221                     OptionsTabs::SetApplyNowState(TRUE);
00222             }
00223             break;
00224     }   
00225     return TRUE;
00226 }  

BOOL InternetTab::InitSection  )  [virtual]
 

Sets initial values for the Page section of the options dialog box. This section includes the:-.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/10/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
AppPrefsDlg; OptionsTabs; UpdateSection;

Implements OptionsTabs.

Definition at line 245 of file optsinet.cpp.

00246 {
00247     ERROR2IF(pPrefsDlg == NULL,FALSE,"InitSection called with no dialog pointer");
00248 
00249     // Fill in the data regardless of whether the proxy is enabled or not
00250     // Now get the current settings
00251     TCHAR szHostName[INTERNET_MAX_PATH_LENGTH];
00252     SERVENT proxyEntry = {szHostName, NULL, 0x0000, NULL};
00253     bool bProxyEnabled;
00254 
00255     String_256 strProxyNote(_T(""));
00256     
00257     if (!InternetManager::GetProxyServer(&proxyEntry, &bProxyEnabled))
00258     {
00259         // failed to read proxy settings
00260         String_256 strProxyError(_R(IDS_PROXY_SUB_ERROR));
00261         strProxyNote.MakeMsg(_R(IDS_PROXY_NOTE), static_cast<TCHAR *>(strProxyError));
00262     }
00263     else
00264     {
00265         // read settings ok
00266         if (bProxyEnabled)
00267         {
00268             // proxy server enabled
00269             String_256 strProxyEnabled;
00270             strProxyEnabled.MakeMsg(_R(IDS_PROXY_SUB_ENABLED), proxyEntry.s_name, proxyEntry.s_port);
00271             strProxyNote.MakeMsg(_R(IDS_PROXY_NOTE), static_cast<TCHAR *>(strProxyEnabled));
00272         }
00273         else
00274         {
00275             // proxy server disabled
00276             String_256 strProxyDisabled(_R(IDS_PROXY_SUB_DISABLED));
00277             strProxyNote.MakeMsg(_R(IDS_PROXY_NOTE), static_cast<TCHAR *>(strProxyDisabled));
00278         }
00279     }
00280 
00281     pPrefsDlg->SetStringGadgetValue(_R(IDC_PROXY_DETAILS), &strProxyNote);
00282 
00283     // Sort out the connection type
00284     UINT32 nSelID;
00285     switch (InternetManager::GetConnectionType())
00286     {
00287         case CONNECTION_SLOWMODEM:
00288             nSelID = _R(IDC_14K);
00289             break;
00290         case CONNECTION_FASTMODEM:
00291             nSelID = _R(IDC_28K);
00292             break;
00293         case CONNECTION_X2:
00294             nSelID = _R(IDC_56K);
00295             break;
00296         case CONNECTION_ISDN:
00297             nSelID = _R(IDC_ISDN);
00298     }
00299     pPrefsDlg->SetBoolGadgetSelected(nSelID, TRUE);
00300 
00301     
00302     // Sort out the download cache section.
00303     UINT32 lCacheUsage = DownloadCache::GetUsage();
00304     pPrefsDlg->SetLongGadgetValue(_R(IDC_CACHEUSAGE), lCacheUsage);
00305 
00306     UINT32 lCacheSize = DownloadCache::GetSize();
00307     pPrefsDlg->SetMemoryGadgetValue(_R(IDC_CACHESIZE), lCacheSize);
00308     return TRUE;
00309 }

virtual BOOL InternetTab::IsDocumentOption  )  [inline, virtual]
 

Implements OptionsTabs.

Definition at line 137 of file optsinet.h.

00137 {return FALSE;} // Return True if document option  

virtual BOOL InternetTab::IsProgramOption  )  [inline, virtual]
 

Implements OptionsTabs.

Definition at line 139 of file optsinet.h.

00139 {return TRUE;}  // Return True if program option


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:55:32 2007 for Camelot by  doxygen 1.4.4