Skip to content

Commit

Permalink
fixes #116 and jumps to page if provided via argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
grexe committed Aug 13, 2024
1 parent 19110b6 commit 2ed6086
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bepdf/beos/BepdfApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,21 @@ void BepdfApplication::RefsReceived ( BMessage * msg )
BString ownerPassword, userPassword;
const char *owner = NULL;
const char *user = NULL;
int32 pageNum = 0;

if (B_OK == msg->FindString("ownerPassword", &ownerPassword)) {
owner = ownerPassword.String();
}
if (B_OK == msg->FindString("userPassword", &userPassword)) {
user = userPassword.String();
}
status_t result = msg->FindInt32(PAGE_NUM_MSG, &pageNum);
if (result != B_OK) {
if (result != B_NAME_NOT_FOUND) {
BAlert *error = new BAlert(B_TRANSLATE("Error"), B_TRANSLATE("BePDF: Error getting page number!"), B_TRANSLATE("Close"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
error->Go();
}
}

Initialize();

Expand Down Expand Up @@ -589,6 +598,12 @@ void BepdfApplication::RefsReceived ( BMessage * msg )
mWindow = win;
win->Show();
}
// jump to page if provided
if (pageNum != 0) {
mWindow->LockLooper();
mWindow->SetPage(pageNum);
mWindow->UnlockLooper();
}
// stop after first document
mGotSomething = true;
break;
Expand Down

0 comments on commit 2ed6086

Please sign in to comment.