Ticket #4123: drivesetupdisablebutton-v2.patch
File drivesetupdisablebutton-v2.patch, 2.9 KB (added by , 15 years ago) |
---|
-
src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp
24 24 25 25 26 26 static uint32 MSG_BLOCK_SIZE = 'blsz'; 27 static uint32 MSG_NAME_CHANGED = 'nmch'; 27 28 28 29 29 30 InitializeBFSEditor::InitializeBFSEditor() … … 95 96 InitializeBFSEditor::_CreateViewControls() 96 97 { 97 98 fNameTC = new BTextControl("Name:", "Haiku", NULL); 99 fNameTC->SetModificationMessage(new BMessage(MSG_NAME_CHANGED)); 98 100 // TODO find out what is the max length for this specific FS partition name 99 101 fNameTC->TextView()->SetMaxBytes(31); 100 102 -
src/apps/drivesetup/InitParamsPanel.cpp
20 20 #include <Message.h> 21 21 #include <MessageFilter.h> 22 22 #include <String.h> 23 #include <TextControl.h> 23 24 24 25 25 26 #define TR_CONTEXT "InitParamsPanel" … … 70 71 enum { 71 72 MSG_OK = 'okok', 72 73 MSG_CANCEL = 'cncl', 73 MSG_ BLOCK_SIZE = 'blsz'74 MSG_NAME_CHANGED = 'nmch' 74 75 }; 75 76 76 77 … … 87 88 { 88 89 AddCommonFilter(fEscapeFilter); 89 90 90 BButton* okButton = new BButton(TR("Initialize"), new BMessage(MSG_OK));91 fOkButton = new BButton(TR("Initialize"), new BMessage(MSG_OK)); 91 92 92 93 partition->GetInitializationParameterEditor(diskSystem.String(), 93 94 &fEditor); … … 99 100 .AddGroup(B_HORIZONTAL, spacing) 100 101 .AddGlue() 101 102 .Add(new BButton(TR("Cancel"), new BMessage(MSG_CANCEL))) 102 .Add( okButton)103 .Add(fOkButton) 103 104 .End() 104 105 .SetInsets(spacing, spacing, spacing, spacing) 105 106 ); 106 107 107 SetDefaultButton( okButton);108 SetDefaultButton(fOkButton); 108 109 109 110 // If the partition had a previous name, set to that name. 110 111 BString name = partition->ContentName(); … … 145 146 release_sem(fExitSemaphore); 146 147 break; 147 148 149 case MSG_NAME_CHANGED: 150 // message comes from fEditor's BTextControl 151 BTextControl* control; 152 if (message->FindPointer("source", (void**)&control) != B_OK) 153 break; 154 if (control->TextView()->TextLength() == 0 155 && fOkButton->IsEnabled()) 156 fOkButton->SetEnabled(false); 157 else if (control->TextView()->TextLength() > 0 158 && !fOkButton->IsEnabled()) 159 fOkButton->SetEnabled(true); 160 break; 161 148 162 default: 149 163 BWindow::MessageReceived(message); 150 164 } -
src/apps/drivesetup/InitParamsPanel.h
36 36 EscapeFilter* fEscapeFilter; 37 37 sem_id fExitSemaphore; 38 38 BWindow* fWindow; 39 BButton* fOkButton; 39 40 int32 fReturnValue; 40 41 41 42 BPartitionParameterEditor* fEditor;