Changeset 98449 in webkit
- Timestamp:
- Oct 26, 2011 1:29:16 AM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r98447 r98449 1 2011-10-20 Zeno Albisser <zeno.albisser@nokia.com> 2 3 [Qt][WK2] Disable Context Menus until we have a proper QML implementation 4 https://bugs.webkit.org/show_bug.cgi?id=70537 5 6 This is just a temporary fix to avoid crashes in QtGui based 7 MiniBrowser that does not link to QtWidgets. 8 9 Patch by Jocelyn Turcotte <jocelyn.turcotte@nokia.com>, 10 Zeno Albisser <zeno.albisser@nokia.com> 11 12 Reviewed by Simon Hausmann. 13 14 * UIProcess/qt/WebContextMenuProxyQt.cpp: 15 (WebKit::WebContextMenuProxyQt::showContextMenu): 16 (WebKit::WebContextMenuProxyQt::createContextMenu): 17 1 18 2011-10-25 Zeno Albisser <zeno.albisser@nokia.com> 2 19 -
trunk/Source/WebKit2/UIProcess/qt/WebContextMenuProxyQt.cpp
r97852 r98449 70 70 void WebContextMenuProxyQt::showContextMenu(const IntPoint& position, const Vector<WebContextMenuItemData>& items) 71 71 { 72 if (items.isEmpty()) 73 return; 74 75 OwnPtr<QMenu> menu = createContextMenu(items); 76 77 // We call showContextMenu(), even with no items, because the client should be able to show custom items 78 // if WebKit has nothing to show. 79 if (!menu) 80 menu = adoptPtr(new QMenu); 81 82 menu->move(position); 83 m_viewInterface->showContextMenu(QSharedPointer<QMenu>(menu.leakPtr())); 72 // FIXME: Make this a QML compatible context menu. 84 73 } 85 74 … … 91 80 PassOwnPtr<QMenu> WebContextMenuProxyQt::createContextMenu(const Vector<WebContextMenuItemData>& items) const 92 81 { 93 OwnPtr<QMenu> menu = adoptPtr(new QMenu); 94 for (int i = 0; i < items.size(); ++i) { 95 const WebContextMenuItemData& item = items.at(i); 96 switch (item.type()) { 97 case WebCore::CheckableActionType: /* fall through */ 98 case WebCore::ActionType: { 99 QAction* qtAction = new QAction(menu.get()); 100 qtAction->setData(QVariant::fromValue(item)); 101 qtAction->setText(item.title()); 102 qtAction->setEnabled(item.enabled()); 103 qtAction->setChecked(item.checked()); 104 qtAction->setCheckable(item.type() == WebCore::CheckableActionType); 105 connect(qtAction, SIGNAL(triggered(bool)), this, SLOT(actionTriggered(bool)), Qt::DirectConnection); 106 107 menu->addAction(qtAction); 108 break; 109 } 110 case WebCore::SeparatorType: 111 menu->addSeparator(); 112 break; 113 case WebCore::SubmenuType: 114 if (OwnPtr<QMenu> subMenu = createContextMenu(item.submenu())) { 115 subMenu->setParent(menu.get()); 116 subMenu->setTitle(item.title()); 117 QMenu* const subMenuPtr = subMenu.leakPtr(); 118 menu->addMenu(subMenuPtr); 119 } 120 break; 121 } 122 } 123 124 // Do not show sub-menus with just disabled actions. 125 if (menu->isEmpty()) 126 return nullptr; 127 128 bool isAnyActionEnabled = false; 129 QList<QAction *> actions = menu->actions(); 130 for (int i = 0; i < actions.count(); ++i) { 131 if (actions.at(i)->isVisible()) 132 isAnyActionEnabled |= actions.at(i)->isEnabled(); 133 } 134 if (!isAnyActionEnabled) 135 return nullptr; 136 137 return menu.release(); 82 // FIXME: Make this a QML compatible context menu. 83 return nullptr; 138 84 } 139 85
Note: See TracChangeset
for help on using the changeset viewer.