[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
zoltan at webkit.org
zoltan at webkit.org
Sun Feb 20 23:42:06 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 9b0df0bdf15596a8cc2179f7b93bae231e992b80
Author: zoltan at webkit.org <zoltan at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 24 11:53:29 2011 +0000
[Qt] Regroup MiniBrowser's menubar and add open file action
https://bugs.webkit.org/show_bug.cgi?id=53000
Reviewed by Andreas Kling.
Add File and Develop menu to MiniBrowser's menubar and add open file action to File menu.
* MiniBrowser/qt/BrowserWindow.cpp:
(BrowserWindow::BrowserWindow):
(BrowserWindow::openFile):
(BrowserWindow::~BrowserWindow):
* MiniBrowser/qt/BrowserWindow.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76503 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index f95d485..1537ca7 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,18 @@
+2011-01-24 Zoltan Horvath <zoltan at webkit.org>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Regroup MiniBrowser's menubar and add open file action
+ https://bugs.webkit.org/show_bug.cgi?id=53000
+
+ Add File and Develop menu to MiniBrowser's menubar and add open file action to File menu.
+
+ * MiniBrowser/qt/BrowserWindow.cpp:
+ (BrowserWindow::BrowserWindow):
+ (BrowserWindow::openFile):
+ (BrowserWindow::~BrowserWindow):
+ * MiniBrowser/qt/BrowserWindow.h:
+
2011-01-24 Csaba Osztrogonác <ossy at webkit.org>
Unreviewed fix after r76496
diff --git a/Tools/MiniBrowser/qt/BrowserWindow.cpp b/Tools/MiniBrowser/qt/BrowserWindow.cpp
index c63c9d6..c37d36e 100644
--- a/Tools/MiniBrowser/qt/BrowserWindow.cpp
+++ b/Tools/MiniBrowser/qt/BrowserWindow.cpp
@@ -40,22 +40,25 @@ BrowserWindow::BrowserWindow(QWKContext* context)
{
setAttribute(Qt::WA_DeleteOnClose);
- m_menu = new QMenuBar();
- m_browser = new BrowserView(backingStoreTypeForNewWindow, context);
- m_addressBar = new QLineEdit();
+ QMenu* fileMenu = menuBar()->addMenu("&File");
+ fileMenu->addAction("New Window", this, SLOT(newWindow()), QKeySequence::New);
+ fileMenu->addAction("Open File", this, SLOT(openFile()), QKeySequence::Open);
+ fileMenu->addSeparator();
+ fileMenu->addAction("Quit", this, SLOT(close()));
- m_menu->addAction("New Window", this, SLOT(newWindow()));
- m_menu->addAction("Change User Agent", this, SLOT(showUserAgentDialog()));
+ QMenu* toolsMenu = menuBar()->addMenu("&Develop");
+ toolsMenu->addAction("Change User Agent", this, SLOT(showUserAgentDialog()));
- m_menu->addSeparator();
- m_menu->addAction("Quit", this, SLOT(close()));
+ m_browser = new BrowserView(backingStoreTypeForNewWindow, context);
+ connect(m_browser->view(), SIGNAL(loadProgress(int)), SLOT(loadProgress(int)));
+ connect(m_browser->view(), SIGNAL(titleChanged(const QString&)), SLOT(titleChanged(const QString&)));
+ connect(m_browser->view(), SIGNAL(urlChanged(const QUrl&)), SLOT(urlChanged(const QUrl&)));
+ this->setCentralWidget(m_browser);
m_browser->setFocus(Qt::OtherFocusReason);
+ m_addressBar = new QLineEdit();
connect(m_addressBar, SIGNAL(returnPressed()), SLOT(changeLocation()));
- connect(m_browser->view(), SIGNAL(loadProgress(int)), SLOT(loadProgress(int)));
- connect(m_browser->view(), SIGNAL(titleChanged(const QString&)), SLOT(titleChanged(const QString&)));
- connect(m_browser->view(), SIGNAL(urlChanged(const QUrl&)), SLOT(urlChanged(const QUrl&)));
QToolBar* bar = addToolBar("Navigation");
bar->addAction(page()->action(QWKPage::Back));
@@ -64,11 +67,6 @@ BrowserWindow::BrowserWindow(QWKContext* context)
bar->addAction(page()->action(QWKPage::Stop));
bar->addWidget(m_addressBar);
- this->setMenuBar(m_menu);
- this->setCentralWidget(m_browser);
-
- m_browser->setFocus(Qt::OtherFocusReason);
-
QShortcut* selectAddressBar = new QShortcut(Qt::CTRL | Qt::Key_L, this);
connect(selectAddressBar, SIGNAL(activated()), this, SLOT(openLocation()));
@@ -137,6 +135,24 @@ void BrowserWindow::urlChanged(const QUrl& url)
m_addressBar->setText(url.toString());
}
+void BrowserWindow::openFile()
+{
+#ifndef QT_NO_FILEDIALOG
+ static const QString filter("HTML Files (*.htm *.html *.xhtml);;Text Files (*.txt);;Image Files (*.gif *.jpg *.png);;SVG Files (*.svg);;All Files (*)");
+
+ QFileDialog fileDialog(this, tr("Open"), QString(), filter);
+ fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
+ fileDialog.setFileMode(QFileDialog::ExistingFile);
+ fileDialog.setOptions(QFileDialog::ReadOnly);
+
+ if (fileDialog.exec()) {
+ QString selectedFile = fileDialog.selectedFiles()[0];
+ if (!selectedFile.isEmpty())
+ load(selectedFile);
+ }
+#endif
+}
+
void BrowserWindow::updateUserAgentList()
{
QFile file(":/useragentlist.txt");
@@ -189,5 +205,4 @@ BrowserWindow::~BrowserWindow()
{
delete m_addressBar;
delete m_browser;
- delete m_menu;
}
diff --git a/Tools/MiniBrowser/qt/BrowserWindow.h b/Tools/MiniBrowser/qt/BrowserWindow.h
index f984309..2a04aa8 100644
--- a/Tools/MiniBrowser/qt/BrowserWindow.h
+++ b/Tools/MiniBrowser/qt/BrowserWindow.h
@@ -55,13 +55,13 @@ protected slots:
void loadProgress(int progress);
void titleChanged(const QString&);
void urlChanged(const QUrl&);
+ void openFile();
void showUserAgentDialog();
private:
void updateUserAgentList();
BrowserView* m_browser;
- QMenuBar* m_menu;
QLineEdit* m_addressBar;
QStringList m_userAgentList;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list