Ticket #5619: network.diff
File network.diff, 5.8 KB (added by , 14 years ago) |
---|
-
src/preferences/network/EthernetSettingsView.h
6 6 * Andre Alves Garzia, andre@andregarzia.com 7 7 * Axel Dörfler 8 8 * Hugo Santos 9 * Vegard Wærp 9 10 */ 10 11 #ifndef ETHERNET_SETTINGS_VIEW_H 11 12 #define ETHERNET_SETTINGS_VIEW_H … … 65 66 66 67 BTextControl* fPrimaryDNSTextControl; 67 68 BTextControl* fSecondaryDNSTextControl; 69 BTextControl* fDomainTextControl; 68 70 69 71 BStringView* fErrorMessage; 70 72 -
src/preferences/network/Settings.cpp
5 5 * Authors: 6 6 * Andre Alves Garzia, andre@andregarzia.com 7 7 * Axel Dörfler, axeld@pinc-software.de. 8 * Vegard Wærp, vegarwa@online.no 8 9 */ 9 10 10 11 … … 159 160 fNameServers.AddItem( 160 161 new BString(inet_ntoa(state->nsaddr_list[i].sin_addr))); 161 162 } 163 fDomain = state->dnsrch[0]; 162 164 } 163 165 } -
src/preferences/network/Settings.h
2 2 * Copyright 2004-2009 Haiku Inc. All rights reserved. 3 3 * Distributed under the terms of the MIT License. 4 4 * 5 * Author :5 * Authors: 6 6 * Andre Alves Garzia, andre@andregarzia.com 7 * Vegard Wærp, vegarwa@online.no 7 8 */ 8 9 #ifndef SETTINGS_H 9 10 #define SETTINGS_H … … 21 22 void SetIP(BString ip) { fIP = ip; } 22 23 void SetGateway(BString ip) { fGateway = ip; } 23 24 void SetNetmask(BString ip) { fNetmask = ip; } 25 void SetDomain(BString domain) { fDomain = domain; } 24 26 void SetAutoConfigure(bool autoConfigure) 25 27 { fAuto = autoConfigure; } 26 28 … … 28 30 const char* Gateway() { return fGateway.String(); } 29 31 const char* Netmask() { return fNetmask.String(); } 30 32 const char* Name() { return fName.String(); } 33 const char* Domain() { return fDomain.String(); } 31 34 bool AutoConfigure() { return fAuto; } 32 35 33 36 BObjectList<BString>& NameServers() { return fNameServers; } … … 41 44 BString fGateway; 42 45 BString fNetmask; 43 46 BString fName; 47 BString fDomain; 44 48 int fSocket; 45 49 bool fAuto; 46 50 BObjectList<BString> fNameServers; -
src/preferences/network/EthernetSettingsView.cpp
8 8 * Axel Dörfler 9 9 * Hugo Santos 10 10 * Philippe Saint-Pierre 11 * Vegard Wærp 11 12 */ 12 13 13 14 … … 172 173 layout->AddItem(fSecondaryDNSTextControl->CreateLabelLayoutItem(), 0, 6); 173 174 layout->AddItem(fSecondaryDNSTextControl->CreateTextViewLayoutItem(), 1, 6); 174 175 176 fDomainTextControl = new BTextControl(TR("Domain:"), "", NULL); 177 SetupTextControl(fDomainTextControl); 178 layout->AddItem(fDomainTextControl->CreateLabelLayoutItem(), 0, 7); 179 layout->AddItem(fDomainTextControl->CreateTextViewLayoutItem(), 1, 7); 180 175 181 fErrorMessage = new BStringView("error", ""); 176 182 fErrorMessage->SetAlignment(B_ALIGN_LEFT); 177 183 fErrorMessage->SetFont(be_bold_font); 178 184 fErrorMessage->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); 179 185 180 layout->AddView(fErrorMessage, 1, 7);186 layout->AddView(fErrorMessage, 1, 8); 181 187 182 188 // button group (TODO: move to window, but take care of 183 189 // enabling/disabling) … … 268 274 fGatewayTextControl->SetTarget(this); 269 275 fPrimaryDNSTextControl->SetTarget(this); 270 276 fSecondaryDNSTextControl->SetTarget(this); 277 fDomainTextControl->SetTarget(this); 271 278 fDeviceMenuField->Menu()->SetTargetForItems(this); 272 279 fTypeMenuField->Menu()->SetTargetForItems(this); 273 280 … … 293 300 fNetMaskTextControl->SetText(""); 294 301 fPrimaryDNSTextControl->SetText(""); 295 302 fSecondaryDNSTextControl->SetText(""); 303 fDomainTextControl->SetText(""); 296 304 297 305 bool enableControls = false; 298 306 fTypeMenuField->SetEnabled(settings != NULL); … … 325 333 fPrimaryDNSTextControl->SetText( 326 334 settings->NameServers().ItemAt(0)->String()); 327 335 } 336 fDomainTextControl->SetText(settings->Domain()); 328 337 } 329 338 330 339 _EnableTextControls(enableControls); … … 339 348 fNetMaskTextControl->SetEnabled(enable); 340 349 fPrimaryDNSTextControl->SetEnabled(enable); 341 350 fSecondaryDNSTextControl->SetEnabled(enable); 351 fDomainTextControl->SetEnabled(enable); 342 352 } 343 353 344 354 … … 360 370 fPrimaryDNSTextControl->Text())); 361 371 fCurrentSettings->NameServers().AddItem(new BString( 362 372 fSecondaryDNSTextControl->Text())); 373 fCurrentSettings->SetDomain(fDomainTextControl->Text()); 363 374 364 375 fApplyButton->SetEnabled(false); 365 376 fRevertButton->SetEnabled(true); … … 404 415 << "\n"; 405 416 } 406 417 } 418 if (strlen(settings->Domain()) > 0) { 419 content << "domain\t" 420 << settings->Domain() 421 << "\n"; 422 } 407 423 } 408 424 409 425 file.Write(content.String(), content.Length()); -
src/servers/net/DHCPClient.cpp
4 4 * 5 5 * Authors: 6 6 * Axel Dörfler, axeld@pinc-software.de 7 * Vegard Wærp, vegarwa@online.no 7 8 */ 8 9 9 10 … … 681 682 memcpy(name, data, size); 682 683 name[size] = '\0'; 683 684 syslog(LOG_INFO, "DHCP domain name: \"%s\"\n", name); 685 686 BPath path; 687 if (find_directory(B_COMMON_SETTINGS_DIRECTORY, &path) != B_OK) 688 break; 689 690 path.Append("network/resolv.conf"); 691 692 FILE* file = fopen(path.Path(), "a"); 693 if (file != NULL) { 694 fprintf(file, "domain %s\n", name); 695 } 696 fclose(file); 684 697 break; 685 698 } 686 699