* 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:
@@ -149,10 +149,15 @@ AddPrinterDialog::HandleChangedTransport(BMessage *msg)
|
|||||||
void* pointer;
|
void* pointer;
|
||||||
if (msg->FindPointer("source", &pointer) == B_OK) {
|
if (msg->FindPointer("source", &pointer) == B_OK) {
|
||||||
BMenuItem* item = (BMenuItem*)pointer;
|
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();
|
BMenu* menu = item->Menu();
|
||||||
int32 index = fTransport->IndexOf(menu);
|
int32 index = fTransport->IndexOf(menu);
|
||||||
item = fTransport->ItemAt(index);
|
item = fTransport->ItemAt(index);
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -379,9 +384,8 @@ void AddPrinterDialog::FillTransportMenu(BMenu* menu)
|
|||||||
SetMessage(new BMessage(kTransportSelectedMsg));
|
SetMessage(new BMessage(kTransportSelectedMsg));
|
||||||
|
|
||||||
for (int32 pidx=0; reply.FindString("port_id", pidx, &portId) == B_OK; pidx++) {
|
for (int32 pidx=0; reply.FindString("port_id", pidx, &portId) == B_OK; pidx++) {
|
||||||
reply.FindString("port_name", pidx, &portName);
|
if (reply.FindString("port_name", pidx, &portName) != B_OK ||
|
||||||
|
!portName.Length())
|
||||||
if (!portName.Length())
|
|
||||||
portName = portId;
|
portName = portId;
|
||||||
|
|
||||||
// Create menu item in submenu for port
|
// Create menu item in submenu for port
|
||||||
@@ -399,6 +403,6 @@ AddPrinterDialog::Update()
|
|||||||
fOk->SetEnabled(fNameText != "" && fPrinterText != "" &&
|
fOk->SetEnabled(fNameText != "" && fPrinterText != "" &&
|
||||||
(fTransportText != "" || fPrinterText == "Preview"));
|
(fTransportText != "" || fPrinterText == "Preview"));
|
||||||
|
|
||||||
fTransport->SetEnabled(fPrinterText != "" && fPrinterText != "Preview");
|
fTransport->SetEnabled(fPrinterText != "Preview");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user