parent
9b738c321b
commit
6563b11264
@ -43,6 +43,7 @@
|
|||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
|
#include <FilePanel.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
#include <GridLayoutBuilder.h>
|
#include <GridLayoutBuilder.h>
|
||||||
#include <GroupLayout.h>
|
#include <GroupLayout.h>
|
||||||
@ -96,6 +97,7 @@
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
OPEN_LOCATION = 'open',
|
OPEN_LOCATION = 'open',
|
||||||
|
SAVE_PAGE = 'save',
|
||||||
GO_BACK = 'goba',
|
GO_BACK = 'goba',
|
||||||
GO_FORWARD = 'gofo',
|
GO_FORWARD = 'gofo',
|
||||||
STOP = 'stop',
|
STOP = 'stop',
|
||||||
@ -398,6 +400,8 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
new BMessage(B_QUIT_REQUESTED), 'W', B_SHIFT_KEY));
|
new BMessage(B_QUIT_REQUESTED), 'W', B_SHIFT_KEY));
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Close tab"),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Close tab"),
|
||||||
new BMessage(CLOSE_TAB), 'W'));
|
new BMessage(CLOSE_TAB), 'W'));
|
||||||
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Save page"),
|
||||||
|
new BMessage(SAVE_PAGE), 'S'));
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Downloads"),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Downloads"),
|
||||||
new BMessage(SHOW_DOWNLOAD_WINDOW), 'D'));
|
new BMessage(SHOW_DOWNLOAD_WINDOW), 'D'));
|
||||||
@ -594,6 +598,9 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
} else
|
} else
|
||||||
_ShowBookmarkBar(false);
|
_ShowBookmarkBar(false);
|
||||||
|
|
||||||
|
fSavePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this), NULL, 0,
|
||||||
|
false);
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
AddChild(BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
|
AddChild(BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
|
||||||
#if !INTEGRATE_MENU_INTO_TAB_BAR
|
#if !INTEGRATE_MENU_INTO_TAB_BAR
|
||||||
@ -665,6 +672,7 @@ BrowserWindow::~BrowserWindow()
|
|||||||
fAppSettings->RemoveListener(BMessenger(this));
|
fAppSettings->RemoveListener(BMessenger(this));
|
||||||
delete fTabManager;
|
delete fTabManager;
|
||||||
delete fPulseRunner;
|
delete fPulseRunner;
|
||||||
|
delete fSavePanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -811,6 +819,29 @@ BrowserWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SAVE_PAGE:
|
||||||
|
{
|
||||||
|
fSavePanel->SetSaveText(CurrentWebView()->MainFrameTitle());
|
||||||
|
fSavePanel->Show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case B_SAVE_REQUESTED:
|
||||||
|
{
|
||||||
|
entry_ref ref;
|
||||||
|
BString name;
|
||||||
|
|
||||||
|
if (message->FindRef("directory", &ref) == B_OK &&
|
||||||
|
message->FindString("name", &name) == B_OK) {
|
||||||
|
BDirectory dir(&ref);
|
||||||
|
BFile output(&dir, name,
|
||||||
|
B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
|
||||||
|
CurrentWebView()->WebPage()->GetContentsAsMHTML(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case GO_BACK:
|
case GO_BACK:
|
||||||
CurrentWebView()->GoBack();
|
CurrentWebView()->GoBack();
|
||||||
break;
|
break;
|
||||||
|
@ -37,6 +37,7 @@ class BButton;
|
|||||||
class BCheckBox;
|
class BCheckBox;
|
||||||
class BDirectory;
|
class BDirectory;
|
||||||
class BFile;
|
class BFile;
|
||||||
|
class BFilePanel;
|
||||||
class BLayoutItem;
|
class BLayoutItem;
|
||||||
class BMenu;
|
class BMenu;
|
||||||
class BMenuItem;
|
class BMenuItem;
|
||||||
@ -272,6 +273,7 @@ private:
|
|||||||
|
|
||||||
BMenuItem* fBookmarkBarMenuItem;
|
BMenuItem* fBookmarkBarMenuItem;
|
||||||
BookmarkBar* fBookmarkBar;
|
BookmarkBar* fBookmarkBar;
|
||||||
|
BFilePanel* fSavePanel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user