Annotation of truecrypt/main/forms/volumepropertiesdialog.cpp, revision 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/Main.h"
        !            11: #include "Main/GraphicUserInterface.h"
        !            12: #include "VolumePropertiesDialog.h"
        !            13: 
        !            14: namespace TrueCrypt
        !            15: {
        !            16:        VolumePropertiesDialog::VolumePropertiesDialog (wxWindow* parent, const VolumeInfo &volumeInfo)
        !            17:                : VolumePropertiesDialogBase (parent)
        !            18:        {
        !            19:                list <int> colPermilles;
        !            20: 
        !            21:                PropertiesListCtrl->InsertColumn (0, LangString["PROPERTY"], wxLIST_FORMAT_LEFT, 208);
        !            22:                colPermilles.push_back (500);
        !            23:                PropertiesListCtrl->InsertColumn (1, LangString["VALUE"], wxLIST_FORMAT_LEFT, 192);
        !            24:                colPermilles.push_back (500);
        !            25: 
        !            26:                Gui->SetListCtrlWidth (PropertiesListCtrl, 70, false);
        !            27:                Gui->SetListCtrlHeight (PropertiesListCtrl, 17);
        !            28:                Gui->SetListCtrlColumnWidths (PropertiesListCtrl, colPermilles, false);
        !            29: 
        !            30:                AppendToList ("LOCATION", wstring (volumeInfo.Path));
        !            31: #ifndef TC_WINDOWS
        !            32:                AppendToList ("VIRTUAL_DEVICE", wstring (volumeInfo.VirtualDevice));
        !            33: #endif
        !            34:                AppendToList ("SIZE", Gui->SizeToString (volumeInfo.Size));
        !            35:                AppendToList ("TYPE", Gui->VolumeTypeToString (volumeInfo.Type, volumeInfo.Protection));
        !            36:                AppendToList ("READ_ONLY", LangString [volumeInfo.Protection == VolumeProtection::ReadOnly ? "UISTR_YES" : "UISTR_NO"]);
        !            37:                
        !            38:                wxString protection;
        !            39:                if (volumeInfo.Type == VolumeType::Hidden)
        !            40:                        protection = LangString["N_A_UISTR"];
        !            41:                else if (volumeInfo.HiddenVolumeProtectionTriggered)
        !            42:                        protection = LangString["HID_VOL_DAMAGE_PREVENTED"];
        !            43:                else
        !            44:                        protection = LangString [volumeInfo.Protection == VolumeProtection::HiddenVolumeReadOnly ? "UISTR_YES" : "UISTR_NO"];
        !            45: 
        !            46:                AppendToList ("HIDDEN_VOL_PROTECTION", protection);
        !            47:                AppendToList ("ENCRYPTION_ALGORITHM", volumeInfo.EncryptionAlgorithmName);
        !            48:                AppendToList ("KEY_SIZE", StringFormatter (L"{0} {1}", volumeInfo.EncryptionAlgorithmKeySize * 8, LangString ["BITS"]));
        !            49: 
        !            50:                wstringstream blockSize;
        !            51:                blockSize << volumeInfo.EncryptionAlgorithmBlockSize * 8;
        !            52:                if (volumeInfo.EncryptionAlgorithmBlockSize != volumeInfo.EncryptionAlgorithmMinBlockSize)
        !            53:                        blockSize << L"/" << volumeInfo.EncryptionAlgorithmMinBlockSize * 8;
        !            54: 
        !            55:                AppendToList ("BLOCK_SIZE", blockSize.str() + L" " + LangString ["BITS"]);
        !            56:                AppendToList ("MODE_OF_OPERATION", volumeInfo.EncryptionModeName);
        !            57:                AppendToList ("PKCS5_PRF", volumeInfo.Pkcs5PrfName);
        !            58:                AppendToList ("PKCS5_ITERATIONS", StringConverter::FromNumber (volumeInfo.Pkcs5IterationCount));
        !            59: 
        !            60:                AppendToList ("VOLUME_CREATE_DATE", Gui->VolumeTimeToString (volumeInfo.VolumeCreationTime));
        !            61:                AppendToList ("VOLUME_HEADER_DATE", Gui->VolumeTimeToString (volumeInfo.HeaderCreationTime));
        !            62: 
        !            63:                AppendToList ("TOTAL_DATA_READ", Gui->SizeToString (volumeInfo.TotalDataRead));
        !            64:                AppendToList ("TOTAL_DATA_WRITTEN", Gui->SizeToString (volumeInfo.TotalDataWritten));
        !            65:                
        !            66:                Layout();
        !            67:                Fit();
        !            68:                Center();
        !            69: 
        !            70:                StdButtonsOK->SetDefault();
        !            71:        }
        !            72: 
        !            73:        void VolumePropertiesDialog::AppendToList (const string &name, const wxString &value)
        !            74:        {
        !            75:                vector <wstring> fields (PropertiesListCtrl->GetColumnCount());
        !            76: 
        !            77:                fields[0] = LangString[name];
        !            78:                fields[1] = value;
        !            79: 
        !            80:                Gui->AppendToListCtrl (PropertiesListCtrl, fields);
        !            81:        }
        !            82: }

unix.superglobalmegacorp.com

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