Changeset 56529 in webkit
- Timestamp:
- Mar 25, 2010 4:23:23 AM (14 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qwebpage.cpp
r56450 r56529 548 548 const QList<WebCore::ContextMenuItem> *items, QBitArray *visitedWebActions) 549 549 { 550 QMenu* menu = new QMenu(q->view()); 550 if (!client) 551 return 0; 552 553 QMenu* menu = new QMenu(client->ownerWidget()); 551 554 for (int i = 0; i < items->count(); ++i) { 552 555 const ContextMenuItem &item = items->at(i); … … 1082 1085 handled = true; 1083 1086 QFont defaultFont; 1084 if ( q->view())1085 defaultFont = q->view()->font();1087 if (client) 1088 defaultFont = client->ownerWidget()->font(); 1086 1089 QFontMetrics fm(defaultFont); 1087 1090 if (!handleScrolling(ev, frame)) { … … 1927 1930 Q_UNUSED(frame) 1928 1931 #ifndef QT_NO_MESSAGEBOX 1929 QMessageBox::information(view(), tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Ok); 1932 QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; 1933 QMessageBox::information(parent, tr("JavaScript Alert - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Ok); 1930 1934 #endif 1931 1935 } … … 1943 1947 return true; 1944 1948 #else 1945 return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Yes, QMessageBox::No); 1949 QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; 1950 return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Confirm - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QMessageBox::Yes, QMessageBox::No); 1946 1951 #endif 1947 1952 } … … 1962 1967 bool ok = false; 1963 1968 #ifndef QT_NO_INPUTDIALOG 1964 QString x = QInputDialog::getText(view(), tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QLineEdit::Normal, defaultValue, &ok); 1969 QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; 1970 QString x = QInputDialog::getText(parent, tr("JavaScript Prompt - %1").arg(mainFrame()->url().host()), Qt::escape(msg), QLineEdit::Normal, defaultValue, &ok); 1965 1971 if (ok && result) 1966 1972 *result = x; … … 1987 1993 return false; 1988 1994 #else 1989 return QMessageBox::Yes == QMessageBox::information(view(), tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); 1995 QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; 1996 return QMessageBox::Yes == QMessageBox::information(parent, tr("JavaScript Problem - %1").arg(mainFrame()->url().host()), tr("The script on this page appears to have a problem. Do you want to stop the script?"), QMessageBox::Yes, QMessageBox::No); 1990 1997 #endif 1991 1998 } … … 2006 2013 QWebPage *QWebPage::createWindow(WebWindowType type) 2007 2014 { 2008 QWebView *webView = qobject_cast<QWebView 2015 QWebView *webView = qobject_cast<QWebView*>(view()); 2009 2016 if (webView) { 2010 2017 QWebView *newView = webView->createWindow(type); … … 2290 2297 QString text; 2291 2298 QIcon icon; 2292 QStyle *style = view() ? view()->style() : qApp->style();2299 QStyle *style = d->client ? d->client->style() : qApp->style(); 2293 2300 bool checkable = false; 2294 2301 … … 2987 2994 // FIXME: do not ignore suggestedFiles 2988 2995 QStringList suggestedFiles = static_cast<const ChooseMultipleFilesExtensionOption*>(option)->suggestedFileNames; 2989 QStringList names = QFileDialog::getOpenFileNames(view(), QString::null); 2996 QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; 2997 QStringList names = QFileDialog::getOpenFileNames(parent, QString::null); 2990 2998 static_cast<ChooseMultipleFilesExtensionReturn*>(output)->fileNames = names; 2991 2999 return true; … … 3069 3077 Q_UNUSED(parentFrame) 3070 3078 #ifndef QT_NO_FILEDIALOG 3071 return QFileDialog::getOpenFileName(view(), QString::null, suggestedFile); 3079 QWidget* parent = (d->client) ? d->client->ownerWidget() : 0; 3080 return QFileDialog::getOpenFileName(parent, QString::null, suggestedFile); 3072 3081 #else 3073 3082 return QString::null; … … 3347 3356 // Language 3348 3357 QLocale locale; 3349 if ( view())3350 locale = view()->locale();3358 if (d->client) 3359 locale = d->client->ownerWidget()->locale(); 3351 3360 QString name = locale.name(); 3352 3361 name[2] = QLatin1Char('-'); -
trunk/WebKit/qt/ChangeLog
r56473 r56529 1 2010-03-25 Kenneth Rohde Christiansen <kenneth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Make QWebPage not depend on view() but use the client->ownerWidget() 6 instead. Also, handle the case where there is not page client. 7 8 * Api/qwebpage.cpp: 9 (QWebPagePrivate::createContextMenu): 10 (QWebPagePrivate::keyPressEvent): 11 (QWebPage::javaScriptAlert): 12 (QWebPage::javaScriptConfirm): 13 (QWebPage::javaScriptPrompt): 14 (QWebPage::shouldInterruptJavaScript): 15 (QWebPage::createWindow): 16 (QWebPage::action): 17 (QWebPage::extension): 18 (QWebPage::chooseFile): 19 (QWebPage::userAgentForUrl): 20 1 21 2010-03-24 Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> 2 22
Note: See TracChangeset
for help on using the changeset viewer.