* Fix bug in handling name/id combos published by transport addons

* Minor whitespace fixing.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36108 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ithamar R. Adema
2010-04-10 15:30:29 +00:00
parent 3a4656dd4c
commit 3d0010a866
+9 -5
View File
@@ -149,10 +149,15 @@ AddPrinterDialog::HandleChangedTransport(BMessage *msg)
void* pointer;
if (msg->FindPointer("source", &pointer) == B_OK) {
BMenuItem* item = (BMenuItem*)pointer;
// Update printer name with Transport Path if not filled in
if (strlen(fName->Text()) == 0)
fName->SetText(item->Label());
BMenu* menu = item->Menu();
int32 index = fTransport->IndexOf(menu);
item = fTransport->ItemAt(index);
if (item != NULL)
if (item != NULL)
item->SetMarked(true);
}
} else {
@@ -379,9 +384,8 @@ void AddPrinterDialog::FillTransportMenu(BMenu* menu)
SetMessage(new BMessage(kTransportSelectedMsg));
for (int32 pidx=0; reply.FindString("port_id", pidx, &portId) == B_OK; pidx++) {
reply.FindString("port_name", pidx, &portName);
if (!portName.Length())
if (reply.FindString("port_name", pidx, &portName) != B_OK ||
!portName.Length())
portName = portId;
// Create menu item in submenu for port
@@ -399,6 +403,6 @@ AddPrinterDialog::Update()
fOk->SetEnabled(fNameText != "" && fPrinterText != "" &&
(fTransportText != "" || fPrinterText == "Preview"));
fTransport->SetEnabled(fPrinterText != "" && fPrinterText != "Preview");
fTransport->SetEnabled(fPrinterText != "Preview");
}