Annotation of truecrypt/main/forms/volumelocationwizardpage.cpp, revision 1.1.1.1

1.1       root        1: /*
                      2:  Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
                      3: 
                      4:  Governed by the TrueCrypt License 2.4 the full text of which is contained
                      5:  in the file License.txt included in TrueCrypt binary and source code
                      6:  distribution packages.
                      7: */
                      8: 
                      9: #include "System.h"
                     10: #include "Main/GraphicUserInterface.h"
                     11: #include "Main/VolumeHistory.h"
                     12: #include "VolumeLocationWizardPage.h"
                     13: 
                     14: namespace TrueCrypt
                     15: {
                     16:        VolumeLocationWizardPage::VolumeLocationWizardPage (wxPanel* parent, bool selectExisting)
                     17:                : VolumeLocationWizardPageBase (parent),
                     18:                SelectExisting (selectExisting)
                     19:        {
                     20:                Gui->PreferencesUpdatedEvent.Connect (EventConnector <VolumeLocationWizardPage> (this, &VolumeLocationWizardPage::OnPreferencesUpdated));
                     21:                VolumeHistory::ConnectComboBox (VolumePathComboBox);
                     22: 
                     23:                NoHistoryCheckBox->SetValue (!Gui->GetPreferences().SaveHistory);
                     24:        }
                     25: 
                     26:        VolumeLocationWizardPage::~VolumeLocationWizardPage ()
                     27:        {
                     28:                Gui->PreferencesUpdatedEvent.Disconnect (this);
                     29:                VolumeHistory::DisconnectComboBox (VolumePathComboBox);
                     30:        }
                     31: 
                     32:        void VolumeLocationWizardPage::OnNoHistoryCheckBoxClick( wxCommandEvent& event )
                     33:        {
                     34:                UserPreferences prefs = Gui->GetPreferences();
                     35:                prefs.SaveHistory = !event.IsChecked();
                     36:                Gui->SetPreferences (prefs);
                     37: 
                     38:                if (event.IsChecked())
                     39:                {
                     40:                        VolumeHistory::Clear();
                     41:                }
                     42:        }
                     43:        
                     44:        void VolumeLocationWizardPage::OnPageChanging (bool forward)
                     45:        {
                     46:                if (forward)
                     47:                {
                     48:                        VolumePath path = GetVolumePath();
                     49:                        if (!path.IsEmpty())
                     50:                                VolumeHistory::Add (path);
                     51:                }
                     52:        }
                     53: 
                     54:        void VolumeLocationWizardPage::OnPreferencesUpdated (EventArgs &args)
                     55:        {
                     56:                NoHistoryCheckBox->SetValue (!Gui->GetPreferences().SaveHistory);
                     57:        }
                     58: 
                     59:        void VolumeLocationWizardPage::OnSelectFileButtonClick( wxCommandEvent& event )
                     60:        {
                     61:                FilePath path = Gui->SelectVolumeFile (this, !SelectExisting);
                     62: 
                     63:                if (!path.IsEmpty())
                     64:                        SetVolumePath (path);
                     65:        }
                     66: 
                     67:        void VolumeLocationWizardPage::OnSelectDeviceButtonClick( wxCommandEvent& event )
                     68:        {
                     69:                DevicePath path = Gui->SelectDevice (this);
                     70: 
                     71:                if (!path.IsEmpty())
                     72:                        SetVolumePath (path);
                     73:        }
                     74: 
                     75:        void VolumeLocationWizardPage::SetVolumePath (const VolumePath &path)
                     76:        {
                     77:                VolumePathComboBox->SetValue (wstring (path));
                     78:                PageUpdatedEvent.Raise();
                     79:        }
                     80: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.