HP JetDirect transport add-on was the only one to not store/retrieve is
address from transport_address attribute but a custom one. Fixed. Now explicitly shutdown the connection at job end, some printers requires this. Style cleanup that was lying since months, but this code will be reworked again soon, as the SetupWindow needs to be rebuild for layout API and locale translation... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39718 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,35 +1,14 @@
|
|||||||
/*****************************************************************************/
|
/*
|
||||||
// HP JetDirect (TCP/IP only) transport add-on,
|
* Copyright 2001-2010 Haiku Inc. All rights reserved.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Author
|
*
|
||||||
// Philippe Houdoin
|
* Authors:
|
||||||
//
|
* Philippe Houdoin,
|
||||||
// This application and all source files used in its construction, except
|
*/
|
||||||
// where noted, are licensed under the MIT License, and have been written
|
|
||||||
// and are:
|
|
||||||
//
|
|
||||||
// Copyright (c) 2001-2003 OpenBeOS Project
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
|
||||||
// to deal in the Software without restriction, including without limitation
|
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included
|
|
||||||
// in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "HPJetDirectTransport.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
@@ -39,34 +18,39 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <NetEndpoint.h>
|
#include <NetEndpoint.h>
|
||||||
|
|
||||||
#include "HPJetDirectTransport.h"
|
|
||||||
#include "SetupWindow.h"
|
#include "SetupWindow.h"
|
||||||
|
|
||||||
// Implementation of HPJetDirectPort
|
|
||||||
|
|
||||||
HPJetDirectPort::HPJetDirectPort(BDirectory* printer, BMessage *msg)
|
HPJetDirectPort::HPJetDirectPort(BDirectory* printer, BMessage *msg)
|
||||||
:
|
: fHost(""),
|
||||||
fPort(9100),
|
fPort(9100),
|
||||||
fEndpoint(NULL),
|
fEndpoint(NULL),
|
||||||
fReady(B_ERROR)
|
fReady(B_ERROR)
|
||||||
{
|
{
|
||||||
fHost[0] = '\0';
|
BString address;
|
||||||
|
|
||||||
const char *spool_path = msg->FindString("printer_file");
|
if (printer->ReadAttrString("transport_address", &address) < 0) {
|
||||||
if (spool_path && *spool_path) {
|
SetupWindow *setup = new SetupWindow(printer);
|
||||||
BDirectory dir(spool_path);
|
if (setup->Go() == B_ERROR)
|
||||||
|
return;
|
||||||
dir.ReadAttr("hp_jetdirect:host", B_STRING_TYPE, 0, fHost, sizeof(fHost));
|
|
||||||
if (fHost[0] == '\0') {
|
|
||||||
SetupWindow *setup = new SetupWindow(&dir);
|
|
||||||
if (setup->Go() == B_ERROR)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dir.ReadAttr("hp_jetdirect:host", B_STRING_TYPE, 0, fHost, sizeof(fHost));
|
|
||||||
dir.ReadAttr("hp_jetdirect:port", B_UINT16_TYPE, 0, &fPort, sizeof(fPort));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (printer->ReadAttrString("transport_address", &address) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
printf("address = %s\n", address.String());
|
||||||
|
|
||||||
|
int32 index = address.FindLast(':');
|
||||||
|
if (index >= 0) {
|
||||||
|
fPort = atoi(address.String() + index);
|
||||||
|
address.MoveInto(fHost, 0, index);
|
||||||
|
} else
|
||||||
|
fHost = address;
|
||||||
|
|
||||||
|
printf("fHost = %s\n", fHost.String());
|
||||||
|
printf("fPort = %d\n", fPort);
|
||||||
|
|
||||||
|
|
||||||
fEndpoint = new BNetEndpoint(SOCK_STREAM);
|
fEndpoint = new BNetEndpoint(SOCK_STREAM);
|
||||||
if ((fReady = fEndpoint->InitCheck()) != B_OK) {
|
if ((fReady = fEndpoint->InitCheck()) != B_OK) {
|
||||||
BAlert *alert = new BAlert("", "Fail to create the NetEndpoint!", "OK");
|
BAlert *alert = new BAlert("", "Fail to create the NetEndpoint!", "OK");
|
||||||
@@ -75,10 +59,12 @@ HPJetDirectPort::HPJetDirectPort(BDirectory* printer, BMessage *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fEndpoint->Connect(fHost, fPort) == B_OK) {
|
if (fEndpoint->Connect(fHost, fPort) == B_OK) {
|
||||||
printf("Connected to HP JetDirect printer port at %s:%d\n", fHost, fPort);
|
printf("Connected to HP JetDirect printer port at %s:%d\n",
|
||||||
|
fHost.String(), fPort);
|
||||||
fReady = B_OK;
|
fReady = B_OK;
|
||||||
} else {
|
} else {
|
||||||
BAlert *alert = new BAlert("", "Can't connect to HP JetDirect printer port!", "OK");
|
BAlert *alert = new BAlert("",
|
||||||
|
"Can't connect to HP JetDirect printer port!", "OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
fReady = B_ERROR;
|
fReady = B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -87,8 +73,10 @@ HPJetDirectPort::HPJetDirectPort(BDirectory* printer, BMessage *msg)
|
|||||||
|
|
||||||
HPJetDirectPort::~HPJetDirectPort()
|
HPJetDirectPort::~HPJetDirectPort()
|
||||||
{
|
{
|
||||||
if (fEndpoint)
|
if (fEndpoint) {
|
||||||
|
shutdown(fEndpoint->Socket(), SHUT_WR);
|
||||||
fEndpoint->Close();
|
fEndpoint->Close();
|
||||||
|
}
|
||||||
delete fEndpoint;
|
delete fEndpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,53 +1,32 @@
|
|||||||
/*****************************************************************************/
|
/*
|
||||||
// HP JetDirect (TCP/IP only) transport add-on,
|
* Copyright 2001-2010, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Author
|
*
|
||||||
// Philippe Houdoin
|
* Authors:
|
||||||
//
|
* Philippe Houdoin
|
||||||
// This application and all source files used in its construction, except
|
*/
|
||||||
// where noted, are licensed under the MIT License, and have been written
|
|
||||||
// and are:
|
|
||||||
//
|
|
||||||
// Copyright (c) 2001-2003 OpenBeOS Project
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
|
||||||
// to deal in the Software without restriction, including without limitation
|
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included
|
|
||||||
// in all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef HP_JETDIRECT_TRANSPORT_H
|
#ifndef HP_JETDIRECT_TRANSPORT_H
|
||||||
#define HP_JETDIRECT_TRANSPORT_H
|
#define HP_JETDIRECT_TRANSPORT_H
|
||||||
|
|
||||||
#include <Message.h>
|
#include <DataIO.h>
|
||||||
#include <Directory.h>
|
#include <String.h>
|
||||||
#include <NetEndpoint.h>
|
|
||||||
|
class BDirectory;
|
||||||
|
class BMessage;
|
||||||
|
class BNetEndpoint;
|
||||||
|
|
||||||
class HPJetDirectPort : public BDataIO {
|
class HPJetDirectPort : public BDataIO {
|
||||||
public:
|
public:
|
||||||
HPJetDirectPort(BDirectory* printer, BMessage* msg);
|
HPJetDirectPort(BDirectory* printer, BMessage* msg);
|
||||||
~HPJetDirectPort();
|
~HPJetDirectPort();
|
||||||
|
|
||||||
status_t InitCheck() { return fReady; }
|
status_t InitCheck() { return fReady; }
|
||||||
|
|
||||||
ssize_t Read(void* buffer, size_t size);
|
ssize_t Read(void* buffer, size_t size);
|
||||||
ssize_t Write(const void* buffer, size_t size);
|
ssize_t Write(const void* buffer, size_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char fHost[256];
|
BString fHost;
|
||||||
uint16 fPort; // default is 9100
|
uint16 fPort; // default is 9100
|
||||||
BNetEndpoint *fEndpoint;
|
BNetEndpoint *fEndpoint;
|
||||||
status_t fReady;
|
status_t fReady;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Addon HP\ JetDirect :
|
|||||||
print_transport.cpp
|
print_transport.cpp
|
||||||
HPJetDirectTransport.cpp
|
HPJetDirectTransport.cpp
|
||||||
SetupWindow.cpp
|
SetupWindow.cpp
|
||||||
: be $(TARGET_NETAPI_LIB) $(TARGET_LIBSUPC++)
|
: be $(TARGET_NETWORK_LIBS) $(TARGET_NETAPI_LIB) $(TARGET_LIBSUPC++)
|
||||||
;
|
;
|
||||||
|
|
||||||
Package haiku-printingkit-cvs :
|
Package haiku-printingkit-cvs :
|
||||||
|
|||||||
@@ -1,16 +1,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include "SetupWindow.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <Alert.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Directory.h>
|
||||||
|
#include <NetEndpoint.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
|
#include <String.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <Directory.h>
|
|
||||||
#include <Alert.h>
|
|
||||||
#include <String.h>
|
|
||||||
#include <NetEndpoint.h>
|
|
||||||
|
|
||||||
#include "SetupWindow.h"
|
|
||||||
|
|
||||||
#define DLG_WIDTH 370
|
#define DLG_WIDTH 370
|
||||||
#define DLG_HEIGHT 100
|
#define DLG_HEIGHT 100
|
||||||
@@ -22,7 +24,7 @@
|
|||||||
#define SERVER_V 10
|
#define SERVER_V 10
|
||||||
#define SERVER_WIDTH (DLG_WIDTH - SERVER_H - SERVER_H)
|
#define SERVER_WIDTH (DLG_WIDTH - SERVER_H - SERVER_H)
|
||||||
#define SERVER_HEIGHT 20
|
#define SERVER_HEIGHT 20
|
||||||
#define SERVER_TEXT "Printer host name"
|
#define SERVER_TEXT "Printer address"
|
||||||
|
|
||||||
#define QUEUE_H 10
|
#define QUEUE_H 10
|
||||||
#define QUEUE_V SERVER_V + SERVER_HEIGHT + 2
|
#define QUEUE_V SERVER_V + SERVER_HEIGHT + 2
|
||||||
@@ -70,42 +72,46 @@ enum MSGS {
|
|||||||
|
|
||||||
class SetupView : public BView {
|
class SetupView : public BView {
|
||||||
public:
|
public:
|
||||||
SetupView(BRect, BDirectory *);
|
SetupView(BRect, BDirectory* );
|
||||||
~SetupView() {}
|
virtual void AttachedToWindow();
|
||||||
virtual void AttachedToWindow();
|
|
||||||
bool UpdateViewData();
|
|
||||||
|
|
||||||
|
bool CheckSetup();
|
||||||
private:
|
private:
|
||||||
BTextControl *server;
|
|
||||||
BTextControl *queue;
|
BTextControl* fServerAddress;
|
||||||
BDirectory *dir;
|
BTextControl* fQueuePort;
|
||||||
|
BDirectory* fPrinterDirectory;
|
||||||
};
|
};
|
||||||
|
|
||||||
SetupView::SetupView(BRect frame, BDirectory *d)
|
|
||||||
: BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW), dir(d)
|
SetupView::SetupView(BRect frame, BDirectory* directory)
|
||||||
|
: BView(frame, "", B_FOLLOW_ALL, B_WILL_DRAW),
|
||||||
|
fPrinterDirectory(directory)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupView::AttachedToWindow()
|
|
||||||
|
void
|
||||||
|
SetupView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
float width = MAX(StringWidth(SERVER_TEXT), StringWidth(QUEUE_TEXT)) + 10;
|
float width = MAX(StringWidth(SERVER_TEXT), StringWidth(QUEUE_TEXT)) + 10;
|
||||||
|
|
||||||
/* server name box */
|
/* server name box */
|
||||||
|
|
||||||
server = new BTextControl(SERVER_RECT, "", SERVER_TEXT, "", NULL);
|
fServerAddress = new BTextControl(SERVER_RECT, "", SERVER_TEXT, "<printer's hostname or address>", NULL);
|
||||||
AddChild(server);
|
AddChild(fServerAddress);
|
||||||
server->SetDivider(width);
|
fServerAddress->SetDivider(width);
|
||||||
|
|
||||||
/* queue name box */
|
/* queue name box */
|
||||||
|
|
||||||
queue = new BTextControl(QUEUE_RECT, "", QUEUE_TEXT, "9100", NULL); // 9100 is default HP JetDirect port number
|
fQueuePort = new BTextControl(QUEUE_RECT, "", QUEUE_TEXT, "9100", NULL); // 9100 is default HP JetDirect port number
|
||||||
AddChild(queue);
|
AddChild(fQueuePort);
|
||||||
queue->SetDivider(width);
|
fQueuePort->SetDivider(width);
|
||||||
|
|
||||||
/* cancel */
|
/* cancel */
|
||||||
|
|
||||||
BButton *button = new BButton(CANCEL_RECT, "", CANCEL_TEXT, new BMessage(M_CANCEL));
|
BButton* button = new BButton(CANCEL_RECT, "", CANCEL_TEXT, new BMessage(M_CANCEL));
|
||||||
AddChild(button);
|
AddChild(button);
|
||||||
|
|
||||||
/* ok */
|
/* ok */
|
||||||
@@ -115,92 +121,106 @@ void SetupView::AttachedToWindow()
|
|||||||
button->MakeDefault(true);
|
button->MakeDefault(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetupView::UpdateViewData()
|
|
||||||
|
bool
|
||||||
|
SetupView::CheckSetup()
|
||||||
{
|
{
|
||||||
if (*server->Text() && *queue->Text()) {
|
if (*fServerAddress->Text() && *fQueuePort->Text()) {
|
||||||
BNetEndpoint *ep = new BNetEndpoint(SOCK_STREAM);
|
BNetEndpoint* ep = new BNetEndpoint(SOCK_STREAM);
|
||||||
if (ep->InitCheck() == B_NO_ERROR) {
|
if (ep->InitCheck() == B_NO_ERROR) {
|
||||||
uint16 port = atoi(queue->Text());
|
uint16 port = atoi(fQueuePort->Text());
|
||||||
|
|
||||||
if (! port)
|
if (! port)
|
||||||
port = 9100;
|
port = 9100;
|
||||||
|
|
||||||
if (ep->Connect(server->Text(), atoi(queue->Text())) != B_OK) {
|
if (ep->Connect(fServerAddress->Text(), port) != B_OK) {
|
||||||
BString text;
|
BString text;
|
||||||
text << "Fail to connect to " << server->Text() << ":" << (int) port << "!";
|
text << "Fail to connect to " << fServerAddress->Text() << ":" << (int) port << "!";
|
||||||
BAlert *alert = new BAlert("", text.String(), "OK");
|
BAlert* alert = new BAlert("", text.String(), "OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
char str[256];
|
char str[256];
|
||||||
sprintf(str, "%s:%s", server->Text(), queue->Text());
|
sprintf(str, "%s:%d", fServerAddress->Text(), port);
|
||||||
dir->WriteAttr("hp_jetdirect:host", B_STRING_TYPE, 0, server->Text(), strlen(server->Text()) + 1);
|
fPrinterDirectory->WriteAttr("transport_address", B_STRING_TYPE,
|
||||||
dir->WriteAttr("hp_jetdirect:port", B_UINT16_TYPE, 0, &port, sizeof(port));
|
0, str, strlen(str) + 1);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
BAlert *alert = new BAlert("", "please input parameters.", "OK");
|
BAlert* alert = new BAlert("", "please input parameters.", "OK");
|
||||||
alert->Go();
|
alert->Go();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetupWindow::SetupWindow(BDirectory *dir)
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
SetupWindow::SetupWindow(BDirectory* printerDirectory)
|
||||||
: BWindow(BRect(100, 100, 100 + DLG_WIDTH, 100 + DLG_HEIGHT),
|
: BWindow(BRect(100, 100, 100 + DLG_WIDTH, 100 + DLG_HEIGHT),
|
||||||
"HP JetDirect Setup", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
|
"HP JetDirect Setup", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
|
||||||
B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE)
|
B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE)
|
||||||
{
|
{
|
||||||
result = 0;
|
fResult = 0;
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
SetupView *view = new SetupView(Bounds(), dir);
|
SetupView* view = new SetupView(Bounds(), printerDirectory);
|
||||||
AddChild(view);
|
AddChild(view);
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
semaphore = create_sem(0, "SetupWindowSem");
|
fExitSem = create_sem(0, "SetupWindowSem");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetupWindow::QuitRequested()
|
|
||||||
|
bool
|
||||||
|
SetupWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
result = B_ERROR;
|
fResult = B_ERROR;
|
||||||
release_sem(semaphore);
|
release_sem(fExitSem);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupWindow::MessageReceived(BMessage *msg)
|
|
||||||
|
void
|
||||||
|
SetupWindow::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case M_OK:
|
case M_OK:
|
||||||
Lock();
|
Lock();
|
||||||
success = ((SetupView *)ChildAt(0))->UpdateViewData();
|
success = ((SetupView*)ChildAt(0))->CheckSetup();
|
||||||
Unlock();
|
Unlock();
|
||||||
if (success) {
|
if (success) {
|
||||||
result = B_NO_ERROR;
|
fResult = B_NO_ERROR;
|
||||||
release_sem(semaphore);
|
release_sem(fExitSem);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_CANCEL:
|
case M_CANCEL:
|
||||||
result = B_ERROR;
|
fResult = B_ERROR;
|
||||||
release_sem(semaphore);
|
release_sem(fExitSem);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(msg);
|
BWindow::MessageReceived(msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SetupWindow::Go()
|
|
||||||
|
int
|
||||||
|
SetupWindow::Go()
|
||||||
{
|
{
|
||||||
Show();
|
Show();
|
||||||
acquire_sem(semaphore);
|
acquire_sem(fExitSem);
|
||||||
delete_sem(semaphore);
|
delete_sem(fExitSem);
|
||||||
int value = result;
|
int value = fResult;
|
||||||
Lock();
|
Lock();
|
||||||
Quit();
|
Quit();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ class BDirectory;
|
|||||||
|
|
||||||
class SetupWindow : public BWindow {
|
class SetupWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
SetupWindow(BDirectory *);
|
SetupWindow(BDirectory* printerDirectory);
|
||||||
~SetupWindow() {}
|
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
int Go();
|
int Go();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int result;
|
int fResult;
|
||||||
long semaphore;
|
long fExitSem;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETUPWINDOW_H
|
#endif // SETUPWINDOW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user