Ticket #4123: drivesetupdisablebutton.patch
File drivesetupdisablebutton.patch, 2.9 KB (added by , 15 years ago) |
---|
-
src/add-ons/disk_systems/bfs/InitializeParameterEditor.cpp
21 21 22 22 23 23 static uint32 MSG_BLOCK_SIZE = 'blsz'; 24 static uint32 MSG_NAME_CHANGED = 'nmch'; 24 25 25 26 27 26 28 InitializeBFSEditor::InitializeBFSEditor() 27 29 : 28 30 BPartitionParameterEditor(), … … 88 90 InitializeBFSEditor::_CreateViewControls() 89 91 { 90 92 fNameTC = new BTextControl("Name", "Haiku", NULL); 93 fNameTC->SetModificationMessage(new BMessage(MSG_NAME_CHANGED)); 91 94 // TODO find out what is the max length for this specific FS partition name 92 95 fNameTC->TextView()->SetMaxBytes(31); 93 96 -
src/apps/drivesetup/InitParamsPanel.cpp
69 69 enum { 70 70 MSG_OK = 'okok', 71 71 MSG_CANCEL = 'cncl', 72 MSG_ BLOCK_SIZE = 'blsz'72 MSG_NAME_CHANGED = 'nmch' 73 73 }; 74 74 75 75 … … 85 85 { 86 86 AddCommonFilter(fEscapeFilter); 87 87 88 BButton* okButton = new BButton("Initialize", new BMessage(MSG_OK));88 fOkButton = new BButton("Initialize", new BMessage(MSG_OK)); 89 89 BButton* cancelButton = new BButton("Cancel", new BMessage(MSG_CANCEL)); 90 90 91 91 partition->GetInitializationParameterEditor(diskSystem.String(), … … 102 102 .Add(BSpaceLayoutItem::CreateHorizontalStrut(5)) 103 103 .AddGlue() 104 104 .Add(cancelButton) 105 .Add( okButton)105 .Add(fOkButton) 106 106 .Add(BSpaceLayoutItem::CreateHorizontalStrut(5)) 107 107 .End() 108 108 … … 111 111 112 112 SetLayout(new BGroupLayout(B_HORIZONTAL)); 113 113 AddChild(rootView); 114 SetDefaultButton( okButton);114 SetDefaultButton(fOkButton); 115 115 116 116 // If the partition had a previous name, set to that name. 117 117 BString name = partition->ContentName(); … … 152 152 release_sem(fExitSemaphore); 153 153 break; 154 154 155 case MSG_NAME_CHANGED: 156 // message comes from fEditor's BTextControl 157 BTextControl* control; 158 if (message->FindPointer("source", (void**)&control) != B_OK) 159 break; 160 if (control->TextView()->TextLength() == 0 161 && fOkButton->IsEnabled()) 162 fOkButton->SetEnabled(false); 163 else if (control->TextView()->TextLength() > 0 164 && !fOkButton->IsEnabled()) 165 fOkButton->SetEnabled(true); 166 break; 167 155 168 default: 156 169 BWindow::MessageReceived(message); 157 170 } -
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;