Page MenuHomePhorge

No OneTemporary

diff --git a/khtml/CMakeLists.txt b/khtml/CMakeLists.txt
index 33c89cad08..c754bec765 100644
--- a/khtml/CMakeLists.txt
+++ b/khtml/CMakeLists.txt
@@ -1,768 +1,768 @@
project(khtml)
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=6000)
########svg#########
add_definitions(-DENABLE_SVG)
add_definitions(-DENABLE_SVG_FONTS)
add_definitions(-DWTF_PLATFORM_QT)
########svg#########
add_subdirectory( tests )
find_package(JPEG)
macro_log_feature(JPEG_FOUND "libjpeg" "JPEG image format support" "http://www.ijg.org" TRUE "" "Required by khtml.")
find_package(GIF)
macro_log_feature(GIF_FOUND "giflib" "GIF image format support" "http://sourceforge.net/projects/giflib" TRUE "" "Required by khtml.")
find_package(PNG)
macro_log_feature(PNG_FOUND "libpng" "PNG image format support" "http://www.libpng.org/pub/png" TRUE "" "Required by khtml.")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
configure_file(config-khtml.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-khtml.h )
set(khtmlgraphics_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/AffineTransform.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/FloatPoint.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/FloatRect.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/FloatSize.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/IntRect.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/Path.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/GraphicsTypes.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/PathTraversalState.cpp
#${CMAKE_SOURCE_DIR}/khtml/platform/graphics/Image.cpp
#${CMAKE_SOURCE_DIR}/khtml/platform/MIMETypeRegistry.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/AffineTransformQt.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/FloatPointQt.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/FloatRectQt.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/IntPointQt.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/IntRectQt.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/IntSizeQt.cpp
${CMAKE_SOURCE_DIR}/khtml/platform/graphics/qt/PathQt.cpp
#${CMAKE_SOURCE_DIR}/khtml/platform/qt/MIMETypeRegistryQt.cpp
)
set(khtmlsvg_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/svg/SVGDocument.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGSVGElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStyledLocatableElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLocatable.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStyledElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStylable.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLength.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTransformable.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTransform.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAngle.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGDocumentExtensions.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGParserUtilities.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTransformDistance.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTransformList.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStringList.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStyledTransformableElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTests.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLangSpace.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGExternalResourcesRequired.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGRectElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPreserveAspectRatio.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGFitToViewBox.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGCircleElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStyleElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGEllipseElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPointList.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAnimatedPoints.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPolyElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPolygonElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPolylineElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAnimatedPathData.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegArc.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegClosePath.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegCurvetoCubic.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegCurvetoCubicSmooth.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegCurvetoQuadratic.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegCurvetoQuadraticSmooth.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegLineto.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegLinetoHorizontal.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegLinetoVertical.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegList.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathSegMoveto.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGPathElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGURIReference.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGStopElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGGradientElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLinearGradientElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGRadialGradientElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGDefsElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGClipPathElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGGElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGElementInstance.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGElementInstanceList.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGUseElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLineElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTextPathElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTextContentElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGNumberList.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTextPositioningElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGLengthList.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTextElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGScriptElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTitleElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGDescElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGNames.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGZoomAndPan.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGViewSpec.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGTSpanElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGGlyphElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGAltGlyphElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGHKernElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGMissingGlyphElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGFontElement.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/SVGFontData.cpp
#############################################################
## GRAPHICS #################################################
#############################################################
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGResource.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServer.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerQt.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServerSolid.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerSolidQt.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGResourceClipper.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGResourceClipperQt.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServerGradient.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServerLinearGradient.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/SVGPaintServerRadialGradient.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerGradientQt.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerLinearGradientQt.cpp
${CMAKE_SOURCE_DIR}/khtml/svg/graphics/qt/SVGPaintServerRadialGradientQt.cpp
#############################################################
## RENDERING PART BELOW ###################################
#############################################################
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGRoot.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderPath.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGRenderStyleDefs.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGRenderStyle.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGGradientStop.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGContainer.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGRenderSupport.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGHiddenContainer.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGTransformableContainer.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGInlineFlowBox.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGRootInlineBox.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGTextPath.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGInlineTextBox.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/SVGCharacterLayoutInfo.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGInline.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGText.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGBlock.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGInlineText.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/RenderSVGTSpan.cpp
)
# khtml/dom/Makefile.am: khtmldom
set(khtmldom_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/dom/dom_misc.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_block.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_inline.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/css_rule.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom_node.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_document.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_list.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/css_stylesheet.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom_string.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_element.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_misc.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/css_value.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom_text.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_object.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom_doc.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom_xml.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_head.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom_element.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_base.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_image.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_form.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom2_range.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/html_table.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom2_traversal.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom2_events.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom2_views.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/QualifiedName.cpp
${CMAKE_SOURCE_DIR}/khtml/dom/dom3_xpath.cpp
)
#set_source_files_properties(${khtmldom_STAT_SRCS} PROPERTIES COMPILE_FLAGS ${KDE4_ENABLE_EXCEPTIONS})
# khtml/misc/Makefile.am: khtmlmisc
set(khtmlmisc_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/misc/loader.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/helper.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/arena.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/stringit.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/paintbuffer.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/imagefilter.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/borderarcstroker.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/idstring.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/htmlnames.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/AtomicString.cpp
${CMAKE_SOURCE_DIR}/khtml/misc/woff.cpp
)
set(khtmlediting_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/editing/jsediting.cpp
${CMAKE_SOURCE_DIR}/khtml/editing/editing.cpp
${CMAKE_SOURCE_DIR}/khtml/editing/editor.cpp
${CMAKE_SOURCE_DIR}/khtml/editing/htmlediting_impl.cpp
)
set(khtmlfind_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/ui/findbar/khtmlfind.cpp
${CMAKE_SOURCE_DIR}/khtml/ui/findbar/khtmlfindbar.cpp
)
kde4_add_ui_files(khtmlfind_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/ui/findbar/khtmlfindbar_base.ui
)
set(passwordbar_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/ui/passwordbar/storepassbar.cpp
)
kde4_add_ui_files(passwordbar_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/ui/passwordbar/storepassbar_base.ui
)
# khtml/html/Makefile.am: khtmlhtml
set(khtmlhtml_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/html/htmlparser.cpp
${CMAKE_SOURCE_DIR}/khtml/html/htmltokenizer.cpp
${CMAKE_SOURCE_DIR}/khtml/html/htmlprospectivetokenizer.cpp
${CMAKE_SOURCE_DIR}/khtml/html/dtd.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_headimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_blockimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_elementimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_inlineimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_documentimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_baseimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_imageimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_listimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_miscimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_formimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_objectimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_tableimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/html_canvasimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/html/HTMLMediaElement.cpp
${CMAKE_SOURCE_DIR}/khtml/html/HTMLAudioElement.cpp
${CMAKE_SOURCE_DIR}/khtml/html/HTMLVideoElement.cpp
${CMAKE_SOURCE_DIR}/khtml/html/HTMLSourceElement.cpp
${CMAKE_SOURCE_DIR}/khtml/html/TimeRanges.cpp
)
# khtml/ecma/Makefile.am: kjs_html
set(kjs_html_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_binding.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_dom.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_html.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_window.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_navigator.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_proxy.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_css.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_range.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_traversal.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_events.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_views.cpp
# ${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_debugwin.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_mozilla.cpp
${CMAKE_CURRENT_BINARY_DIR}/JSTimeRanges.h
${CMAKE_CURRENT_BINARY_DIR}/JSTimeRanges.cpp
${CMAKE_CURRENT_BINARY_DIR}/JSMediaError.h
${CMAKE_CURRENT_BINARY_DIR}/JSMediaError.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/JSHTMLElement.cpp
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLMediaElement.h
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLMediaElement.cpp
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLAudioElement.h
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLAudioElement.cpp
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLVideoElement.h
${CMAKE_CURRENT_BINARY_DIR}/JSHTMLVideoElement.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/xmlhttprequest.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/xmlserializer.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/domparser.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_context2d.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_audio.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_xpath.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_scriptable.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/kjs_data.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/debugwindow.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/debugdocument.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/consoledock.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/breakpointsdock.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/callstackdock.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/localvariabledock.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/scriptsdock.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/value2string.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/errordlg.cpp
${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/interpreter_ctx.cpp
)
qt4_add_resources( kjs_html_STAT_SRCS ${CMAKE_SOURCE_DIR}/khtml/ecma/debugger/debugger.qrc )
# khtml/rendering/Makefile.am: khtmlrender
set(khtmlrender_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/rendering/bidi.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/break_lines.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_block.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_inline.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_style.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_object.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_container.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_box.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_flow.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_text.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_arena.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_layer.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_image.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_table.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/table_layout.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_replaced.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_form.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_list.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_canvas.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_frames.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_br.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_body.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/font.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_line.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_generated.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/enumerate.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/counter_tree.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_canvasimage.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_position.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/render_media.cpp
${CMAKE_SOURCE_DIR}/khtml/rendering/media_controls.cpp
)
# khtml/css/Makefile.am: khtmlcss
set(khtmlcss_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/css/css_stylesheetimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/css/css_ruleimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/css/css_valueimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/css/css_svgvalueimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/css/css_base.cpp
${CMAKE_SOURCE_DIR}/khtml/css/cssparser.cpp
${CMAKE_SOURCE_DIR}/khtml/css/cssstyleselector.cpp
${CMAKE_SOURCE_DIR}/khtml/css/csshelper.cpp
${CMAKE_SOURCE_DIR}/khtml/css/parser.cpp
${CMAKE_SOURCE_DIR}/khtml/css/css_renderstyledeclarationimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/css/css_mediaquery.cpp
${CMAKE_SOURCE_DIR}/khtml/css/css_svgcssparser.cpp
${CMAKE_SOURCE_DIR}/khtml/css/SVGCSSStyleSelector.cpp
${CMAKE_SOURCE_DIR}/khtml/css/css_webfont.cpp
)
# khtml/xml/Makefile.am: khtmlxml
set(khtmlxml_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/xml/security_origin.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_docimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_nodeimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_nodelistimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_textimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_elementimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_stringimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom2_rangeimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom2_traversalimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/xml_tokenizer.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_xmlimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom2_eventsimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom2_viewsimpl.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_restyler.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/ClassNames.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_position.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_positioniterator.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom_selection.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/wa_selectors.cpp
${CMAKE_SOURCE_DIR}/khtml/xml/dom3_xpathimpl.cpp
)
# khtml/imload/Makefile.am: khtmlimload
set(khtmlimload_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/imload/imageplane.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/rawimageplane.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/scaledimageplane.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/pixmapplane.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/animprovider.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/imagepainter.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/updater.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/image.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/imagemanager.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/animtimer.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/canvasimage.cpp
)
# khtml/imload/decoders/Makefile.am: decoders
set(decoders_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/imload/decoders/jpegloader.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/decoders/pngloader.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/decoders/gifloader.cpp
${CMAKE_SOURCE_DIR}/khtml/imload/decoders/qimageioloader.cpp
)
# khtml/xpath/
set(xpath_STAT_SRCS
${CMAKE_SOURCE_DIR}/khtml/xpath/expression.cpp
${CMAKE_SOURCE_DIR}/khtml/xpath/functions.cpp
${CMAKE_SOURCE_DIR}/khtml/xpath/parsedstatement.cpp
${CMAKE_SOURCE_DIR}/khtml/xpath/path.cpp
${CMAKE_SOURCE_DIR}/khtml/xpath/predicate.cpp
${CMAKE_SOURCE_DIR}/khtml/xpath/step.cpp
${CMAKE_SOURCE_DIR}/khtml/xpath/tokenizer.cpp
${CMAKE_SOURCE_DIR}/khtml/xpath/parser.cpp
${CMAKE_SOURCE_DIR}/khtml/xpath/util.cpp
${CMAKE_SOURCE_DIR}/khtml/xpath/variablereference.cpp
# ${CMAKE_SOURCE_DIR}/khtml/xpath/XPathNSResolverImpl.cpp
)
add_subdirectory( css )
add_subdirectory( pics )
add_subdirectory( ecma )
include_directories( ${KDE4_PHONON_INCLUDES} ${KDE4_KPARTS_INCLUDES} )
include_directories( ${CMAKE_BINARY_DIR}/kio/kssl )
include_directories( ${KDE4_KJS_INCLUDES} ${CMAKE_SOURCE_DIR}/kimgio ${CMAKE_SOURCE_DIR}/kio/kssl ${CMAKE_SOURCE_DIR}/interfaces ${CMAKE_SOURCE_DIR}/interfaces/kregexpeditor)
include_directories( ${CMAKE_SOURCE_DIR}/staging/sonnet ${CMAKE_SOURCE_DIR}/staging/sonnet/src/core ${CMAKE_BINARY_DIR}/staging/sonnet/src/core )
include_directories( ${CMAKE_SOURCE_DIR}/staging/kde4support/src/kdecore ${CMAKE_BINARY_DIR}/staging/kde4support/src/kdecore ${CMAKE_BINARY_DIR}/staging/kde4support/src )
include_directories( ${CMAKE_SOURCE_DIR}/staging/karchive/src ${CMAKE_BINARY_DIR}/staging/karchive/src )
include_directories( ${CMAKE_BINARY_DIR}/interfaces/ktexteditor ${CMAKE_SOURCE_DIR}/tier1/kcoreaddons/src/randomness/ ${CMAKE_SOURCE_DIR}/staging/sonnet/src/core/ )
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/misc
${CMAKE_CURRENT_SOURCE_DIR}/dom
${CMAKE_CURRENT_SOURCE_DIR}/xml
${CMAKE_CURRENT_SOURCE_DIR}/html
${CMAKE_CURRENT_SOURCE_DIR}/rendering
${CMAKE_CURRENT_SOURCE_DIR}/ecma
${CMAKE_CURRENT_SOURCE_DIR}/imload
${CMAKE_CURRENT_SOURCE_DIR}/imload/decoders
${CMAKE_CURRENT_SOURCE_DIR}/java
${CMAKE_CURRENT_SOURCE_DIR}/svg
${CMAKE_CURRENT_SOURCE_DIR}/svg/graphics
${CMAKE_CURRENT_SOURCE_DIR}/platform/graphics
${CMAKE_CURRENT_SOURCE_DIR}/platform/text
${CMAKE_CURRENT_SOURCE_DIR}/platform
${CMAKE_CURRENT_SOURCE_DIR}/compat
${CMAKE_CURRENT_SOURCE_DIR}/css
${CMAKE_CURRENT_SOURCE_DIR}/xpath
)
include_directories(
# ${CMAKE_CURRENT_BINARY_DIR}/misc
# ${CMAKE_CURRENT_BINARY_DIR}/dom
# ${CMAKE_CURRENT_BINARY_DIR}/xml
# ${CMAKE_CURRENT_BINARY_DIR}/html
# ${CMAKE_CURRENT_BINARY_DIR}/rendering
${CMAKE_CURRENT_BINARY_DIR}/ecma
# ${CMAKE_CURRENT_BINARY_DIR}/imload
# ${CMAKE_CURRENT_BINARY_DIR}/imload/decoders
${CMAKE_CURRENT_BINARY_DIR}/java
# ${CMAKE_CURRENT_BINARY_DIR}/svg
# ${CMAKE_CURRENT_BINARY_DIR}/svg/graphics
# ${CMAKE_CURRENT_BINARY_DIR}/platform/graphics
# ${CMAKE_CURRENT_BINARY_DIR}/platform/text
# ${CMAKE_CURRENT_SOURCE_DIR}/platform
# ${CMAKE_CURRENT_BINARY_DIR}/compat
${CMAKE_CURRENT_BINARY_DIR}/css
)
include_directories(${JPEG_INCLUDE_DIR} ${GIF_INCLUDE_DIR} ${PNG_INCLUDE_DIR} )
add_subdirectory( kmultipart )
add_subdirectory( java )
add_definitions(-DENABLE_VIDEO)
########### libkhtml ###############
set(khtml_LIB_SRCS
khtmlview.cpp
khtmlviewbar.cpp
khtmlviewbarwidget.cpp
khtml_part.cpp
khtml_childframe.cpp
khtml_run.cpp
khtml_global.cpp
khtml_settings.cpp
khtml_filter.cpp
khtml_events.cpp
khtml_ext.cpp
khtml_pagecache.cpp
khtml_printsettings.cpp
khtml_iface.cc
khtmlimage.cpp
kjserrordlg.cpp
${xpath_STAT_SRCS}
${khtmlfind_STAT_SRCS}
${passwordbar_STAT_SRCS}
${khtmlxml_STAT_SRCS}
${khtmlhtml_STAT_SRCS}
${khtmlrender_STAT_SRCS}
${khtmlcss_STAT_SRCS}
${khtmlmisc_STAT_SRCS}
${khtmlediting_STAT_SRCS}
${kjs_html_STAT_SRCS}
${khtmldom_STAT_SRCS}
${khtmlimload_STAT_SRCS}
${decoders_STAT_SRCS}
${khtmlgraphics_STAT_SRCS} # for WebCore compatibility
${khtmlsvg_STAT_SRCS} # for SVG
${CMAKE_CURRENT_BINARY_DIR}/org.kde.KHTMLPart.xml # just so that it gets generated
)
qt4_generate_dbus_interface(khtml_iface.h org.kde.KHTMLPart.xml)
set(kcookiejar_XML ${CMAKE_CURRENT_BINARY_DIR}/org.kde.KCookieServer.xml)
qt4_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/../kioslave/http/kcookiejar/kcookieserver.h org.kde.KCookieServer.xml)
set_source_files_properties(${kcookiejar_XML} PROPERTIES INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/../kioslave/http/kcookiejar/kcookiejar_include.h")
qt4_add_dbus_interface(khtml_LIB_SRCS ${kcookiejar_XML} kcookiejar_interface)
kde4_add_ui_files(khtml_LIB_SRCS kjserrordlgbase.ui htmlpageinfo.ui )
kde4_add_library(khtml ${LIBRARY_TYPE} ${khtml_LIB_SRCS})
-target_link_libraries(khtml ${KDE4_KPARTS_LIBS} /home/stephen/dev/qtbase/kde/lib/libphonon.so ktexteditor kjs karchive sonnetcore ${JPEG_LIBRARIES} ${GIF_LIBRARIES} ${PNG_LIBRARIES} ${X11_LIBRARIES} ${kde4support_LIBRARY} kdeguiaddons)
+target_link_libraries(khtml ${KDE4_KPARTS_LIBS} ${KDE4_PHONON_LIBS} ktexteditor kjs karchive sonnetcore ${JPEG_LIBRARIES} ${GIF_LIBRARIES} ${PNG_LIBRARIES} ${X11_LIBRARIES} ${kde4support_LIBRARY} kdeguiaddons ${kwindowsystem_LIBRARY})
target_link_libraries(khtml LINK_INTERFACE_LIBRARIES kparts kjs kio kdeui kdecore ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${kde4support_LIBRARY})
set_target_properties(khtml PROPERTIES VERSION ${KDE_NON_GENERIC_LIB_VERSION}
SOVERSION ${KDE_NON_GENERIC_LIB_SOVERSION}
)
set(CREATE_HASH_TABLE ${CMAKE_SOURCE_DIR}/kjs/create_hash_table )
macro(CREATE_LUT _in_FILE _out_FILE)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
COMMAND ${PERL_EXECUTABLE} ${CREATE_HASH_TABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} > ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
)
macro_add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE} )
endmacro(CREATE_LUT)
create_lut(ecma/kjs_dom.cpp kjs_dom.lut.h)
create_lut(ecma/kjs_html.cpp kjs_html.lut.h)
create_lut(ecma/kjs_window.cpp kjs_window.lut.h)
create_lut(ecma/kjs_css.cpp kjs_css.lut.h)
create_lut(ecma/kjs_events.cpp kjs_events.lut.h)
create_lut(ecma/kjs_navigator.cpp kjs_navigator.lut.h)
create_lut(ecma/kjs_mozilla.cpp kjs_mozilla.lut.h)
create_lut(ecma/kjs_range.cpp kjs_range.lut.h)
create_lut(ecma/kjs_traversal.cpp kjs_traversal.lut.h)
create_lut(ecma/kjs_views.cpp kjs_views.lut.h)
create_lut(ecma/xmlhttprequest.cpp xmlhttprequest.lut.h)
create_lut(ecma/xmlserializer.cpp xmlserializer.lut.h)
create_lut(ecma/domparser.cpp domparser.lut.h)
create_lut(ecma/kjs_context2d.cpp kjs_context2d.lut.h)
create_lut(ecma/kjs_audio.cpp kjs_audio.lut.h)
create_lut(ecma/kjs_xpath.cpp kjs_xpath.lut.h)
macro(create_js_binding _in_FILE)
get_filename_component(_in_filename ${_in_FILE} NAME_WE)
set(_out_h_FILE "${CMAKE_CURRENT_BINARY_DIR}/JS${_in_filename}.h")
set(_out_cpp_FILE "${CMAKE_CURRENT_BINARY_DIR}/JS${_in_filename}.cpp")
set(_scripts_dir ${CMAKE_SOURCE_DIR}/khtml/bindings/scripts)
add_custom_command(OUTPUT ${_out_h_FILE} ${_out_cpp_FILE}
COMMAND ${PERL_EXECUTABLE} -I${_scripts_dir}
${_scripts_dir}/generate-bindings.pl
--include=${CMAKE_SOURCE_DIR}/khtml/html
--generator=JS
--outputdir=${CMAKE_CURRENT_BINARY_DIR}
--preprocessor=\"${QT_MOC_EXECUTABLE} -E\"
--defines=ENABLE_VIDEO
${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE}
DEPENDS ${_scripts_dir}/CodeGeneratorJS.pm
)
macro_add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${_out_h_FILE} ${_out_cpp_FILE})
endmacro(create_js_binding)
create_js_binding(html/TimeRanges.idl)
create_js_binding(html/MediaError.idl)
create_js_binding(html/HTMLMediaElement.idl)
create_js_binding(html/HTMLAudioElement.idl)
create_js_binding(html/HTMLVideoElement.idl)
#create_js_binding(svg/SVGRectElement.idl)
#create_js_binding(svg/SVGRect.idl)
#create_js_binding(svg/SVGElement.idl)
#create_js_binding(svg/SVGDocument.idl)
#create_js_binding(svg/SVGAngle.idl)
#create_js_binding(svg/SVGSVGElement.idl)
#create_js_binding(svg/SVGLength.idl)
#create_js_binding(svg/SVGNumber.idl)
#create_js_binding(svg/SVGPoint.idl)
#create_js_binding(svg/SVGMatrix.idl)
#create_js_binding(svg/SVGTransform.idl)
#create_js_binding(svg/SVGException.idl)
#create_js_binding(svg/SVGPaint.idl)
#create_js_binding(svg/SVGNumberList.idl)
#create_js_binding(svg/SVGAnimatedLength.idl)
#create_js_binding(svg/SVGRectElement.idl)
#create_js_binding(svg/SVGTransformList.idl)
#create_js_binding(svg/SVGAnimatedTransformList.idl)
##create_js_binding(svg/SVGLocatable.idl)
##create_js_binding(svg/SVGTransformable.idl)
#create_js_binding(svg/SVGAnimatedString.idl)
#create_js_binding(svg/SVGAnimatedBoolean.idl)
#create_js_binding(svg/SVGStringList.idl)
#create_js_binding(svg/SVGEllipseElement.idl)
#create_js_binding(svg/SVGCircleElement.idl)
#create_js_binding(svg/SVGLineElement.idl)
#create_js_binding(svg/SVGScriptElement.idl)
#create_js_binding(svg/SVGPathSeg.idl)
#create_js_binding(svg/SVGPathElement.idl)
#create_js_binding(svg/SVGAnimatedNumber.idl)
#create_js_binding(svg/SVGPathSegArcAbs.idl)
#create_js_binding(svg/SVGPathSegArcRel.idl)
#create_js_binding(svg/SVGPathSegClosePath.idl)
#create_js_binding(svg/SVGPathSegCurvetoCubicAbs.idl)
#create_js_binding(svg/SVGPathSegCurvetoCubicRel.idl)
#create_js_binding(svg/SVGPathSegCurvetoCubicSmoothAbs.idl)
#create_js_binding(svg/SVGPathSegCurvetoCubicSmoothRel.idl)
#create_js_binding(svg/SVGPathSegCurvetoQuadraticAbs.idl)
#create_js_binding(svg/SVGPathSegCurvetoQuadraticRel.idl)
#create_js_binding(svg/SVGPathSegCurvetoQuadraticSmoothAbs.idl)
#create_js_binding(svg/SVGPathSegCurvetoQuadraticSmoothRel.idl)
#create_js_binding(svg/SVGPathSegLinetoAbs.idl)
#create_js_binding(svg/SVGPathSegLinetoHorizontalAbs.idl)
#create_js_binding(svg/SVGPathSegLinetoHorizontalRel.idl)
#create_js_binding(svg/SVGPathSegLinetoRel.idl)
#create_js_binding(svg/SVGPathSegLinetoVerticalAbs.idl)
#create_js_binding(svg/SVGPathSegLinetoVerticalRel.idl)
#create_js_binding(svg/SVGPathSegList.idl)
#create_js_binding(svg/SVGPathSegMovetoAbs.idl)
#create_js_binding(svg/SVGPathSegMovetoRel.idl)
install(TARGETS khtml EXPORT kdelibsLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
########### khtmlpart ###############
set(khtmlpart_PART_SRCS khtml_factory.cpp )
kde4_add_plugin(khtmlpart WITH_PREFIX ${khtmlpart_PART_SRCS})
target_link_libraries(khtmlpart ${KDE4_KDECORE_LIBS} khtml )
install(TARGETS khtmlpart DESTINATION ${PLUGIN_INSTALL_DIR} )
########### next target ###############
# Note that khtmlimage.cpp is part of libkhtml because it uses internal objects (render tree and loader)
# Only the entry point is separated into khtmlimage_init.cpp
kde4_add_plugin(khtmlimagepart khtmlimage_init.cpp)
target_link_libraries(khtmlimagepart khtml)
install(TARGETS khtmlimagepart DESTINATION ${PLUGIN_INSTALL_DIR} )
########### next target ###############
kde4_add_plugin(khtmladaptorpart khtmladaptorpart.cpp)
target_link_libraries(khtmladaptorpart ${KDE4_KPARTS_LIBS} kjs)
install(TARGETS khtmladaptorpart DESTINATION ${PLUGIN_INSTALL_DIR} )
#######################################
# msvc linker doesn't like "#define protected public"
if(NOT MSVC)
########### next target ###############
set(testkhtml_SRCS
testkhtml.cpp
)
kde4_add_executable(testkhtml ${testkhtml_SRCS})
target_link_libraries(testkhtml ${KDE4_KDECORE_LIBS} khtml )
########### next target ###############
set(testkhtml_static_SRCS
testkhtml.cpp
)
kde4_add_executable(testkhtml_static ${testkhtml_static_SRCS} )
target_link_libraries(testkhtml_static ${KDE4_KDECORE_LIBS} khtml )
########### next target ###############
endif(NOT MSVC)
# Note that testregression can't be compiled by default, it needs private Qt headers.
# See also BUILDING-TESTREGRESSION
if (KHTML_BUILD_TESTREGRESSION)
set(testregression_SRCS
test_regression.cpp
test_regression_fontoverload.cpp
)
include_directories( ${QT_INCLUDE_DIR}/../src/3rdparty/harfbuzz/src )
kde4_add_executable(testregression ${testregression_SRCS})
target_link_libraries(testregression ${KDE4_KDECORE_LIBS} ${X11_X11_LIB} khtml)
########### next target ###############
set(testregressiongui_SRCS
test_regression_gui_window.cpp
test_regression_gui_main.cpp
)
qt4_add_resources(testregressiongui_SRCS test_regression_gui.qrc)
kde4_add_ui_files(testregressiongui_SRCS test_regression_gui.ui)
kde4_add_executable(testregressiongui ${testregressiongui_SRCS})
target_link_libraries(testregressiongui ${KDE4_KDECORE_LIBS} khtml)
endif (KHTML_BUILD_TESTREGRESSION)
########### install files ###############
install( FILES khtml_export.h khtmlview.h khtml_part.h khtml_events.h khtml_settings.h khtmldefaults.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
install( FILES dom/dom_exception.h dom/html_base.h dom/html_inline.h dom/css_rule.h dom/dom_html.h
dom/html_block.h dom/html_list.h dom/css_stylesheet.h dom/dom_misc.h dom/html_document.h
dom/html_misc.h dom/css_value.h dom/dom_node.h dom/html_element.h dom/html_object.h
dom/dom_core.h dom/dom_string.h dom/html_form.h dom/html_table.h dom/dom_doc.h
dom/dom_text.h dom/html_head.h dom/dom_element.h dom/dom_xml.h dom/html_image.h
dom/dom2_range.h dom/dom2_traversal.h dom/dom2_events.h dom/dom2_views.h
DESTINATION ${INCLUDE_INSTALL_DIR}/dom COMPONENT Devel)
install( FILES khtml.desktop khtmlimage.desktop
khtmladaptorpart.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES khtml.rc khtml_browser.rc DESTINATION ${DATA_INSTALL_DIR}/khtml )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.KHTMLPart.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )
install( FILES error.html DESTINATION ${DATA_INSTALL_DIR}/khtml )
install( FILES khtmlrc DESTINATION ${CONFIG_INSTALL_DIR} )
diff --git a/khtml/khtml_ext.cpp b/khtml/khtml_ext.cpp
index 8877f2c52d..070624f9d1 100644
--- a/khtml/khtml_ext.cpp
+++ b/khtml/khtml_ext.cpp
@@ -1,1282 +1,1282 @@
/* This file is part of the KDE project
*
* Copyright (C) 2000-2003 Simon Hausmann <hausmann@kde.org>
* 2001-2003 George Staikos <staikos@kde.org>
* 2001-2003 Laurent Montel <montel@kde.org>
* 2001-2003 Dirk Mueller <mueller@kde.org>
* 2001-2003 Waldo Bastian <bastian@kde.org>
* 2001-2003 David Faure <faure@kde.org>
* 2001-2003 Daniel Naber <dnaber@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "khtml_ext.h"
#include "khtmlview.h"
#include "khtml_pagecache.h"
#include "rendering/render_form.h"
#include "rendering/render_image.h"
#include "html/html_imageimpl.h"
#include "misc/loader.h"
#include "dom/html_form.h"
#include "dom/html_image.h"
#include "dom/dom_string.h"
#include "dom/html_document.h"
#include "dom/dom_element.h"
#include "xml/dom_elementimpl.h"
#include <QClipboard>
#include <QtCore/QFileInfo>
#include <QMenu>
#include <QtCore/QUrl>
#include <QtCore/QMetaEnum>
#include <assert.h>
#include <kdebug.h>
#include <klocalizedstring.h>
#include <kfiledialog.h>
#include <kjobuidelegate.h>
#include <kio/job.h>
#include <kshell.h>
#include <ktoolbar.h>
-#include <ksavefile.h>
+#include <qsavefile.h>
#include <kstringhandler.h>
#include <ktoolinvocation.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#include <krun.h>
#include <kurifilter.h>
#include <kiconloader.h>
#include <kdesktopfile.h>
#include <kinputdialog.h>
#include <ktemporaryfile.h>
#include "khtml_global.h"
#include <kstandardaction.h>
#include <kactioncollection.h>
#include <kactionmenu.h>
#include "khtmlpart_p.h"
KHTMLPartBrowserExtension::KHTMLPartBrowserExtension( KHTMLPart *parent )
: KParts::BrowserExtension( parent )
{
m_part = parent;
setURLDropHandlingEnabled( true );
enableAction( "cut", false );
enableAction( "copy", false );
enableAction( "paste", false );
m_connectedToClipboard = false;
}
int KHTMLPartBrowserExtension::xOffset()
{
return m_part->view()->contentsX();
}
int KHTMLPartBrowserExtension::yOffset()
{
return m_part->view()->contentsY();
}
void KHTMLPartBrowserExtension::saveState( QDataStream &stream )
{
//kDebug( 6050 ) << "saveState!";
m_part->saveState( stream );
}
void KHTMLPartBrowserExtension::restoreState( QDataStream &stream )
{
//kDebug( 6050 ) << "restoreState!";
m_part->restoreState( stream );
}
void KHTMLPartBrowserExtension::editableWidgetFocused( QWidget *widget )
{
m_editableFormWidget = widget;
updateEditActions();
if ( !m_connectedToClipboard && m_editableFormWidget )
{
connect( QApplication::clipboard(), SIGNAL(dataChanged()),
this, SLOT(updateEditActions()) );
if ( m_editableFormWidget->inherits( "QLineEdit" ) || m_editableFormWidget->inherits( "QTextEdit" ) )
connect( m_editableFormWidget, SIGNAL(selectionChanged()),
this, SLOT(updateEditActions()) );
m_connectedToClipboard = true;
}
editableWidgetFocused();
}
void KHTMLPartBrowserExtension::editableWidgetBlurred( QWidget * /*widget*/ )
{
QWidget *oldWidget = m_editableFormWidget;
m_editableFormWidget = 0;
enableAction( "cut", false );
enableAction( "paste", false );
m_part->emitSelectionChanged();
if ( m_connectedToClipboard )
{
disconnect( QApplication::clipboard(), SIGNAL(dataChanged()),
this, SLOT(updateEditActions()) );
if ( oldWidget )
{
if ( oldWidget->inherits( "QLineEdit" ) || oldWidget->inherits( "QTextEdit" ) )
disconnect( oldWidget, SIGNAL(selectionChanged()),
this, SLOT(updateEditActions()) );
}
m_connectedToClipboard = false;
}
editableWidgetBlurred();
}
void KHTMLPartBrowserExtension::setExtensionProxy( KParts::BrowserExtension *proxy )
{
if ( m_extensionProxy )
{
disconnect( m_extensionProxy, SIGNAL(enableAction(const char*,bool)),
this, SLOT(extensionProxyActionEnabled(const char*,bool)) );
if ( m_extensionProxy->inherits( "KHTMLPartBrowserExtension" ) )
{
disconnect( m_extensionProxy, SIGNAL(editableWidgetFocused()),
this, SLOT(extensionProxyEditableWidgetFocused()) );
disconnect( m_extensionProxy, SIGNAL(editableWidgetBlurred()),
this, SLOT(extensionProxyEditableWidgetBlurred()) );
}
}
m_extensionProxy = proxy;
if ( m_extensionProxy )
{
connect( m_extensionProxy, SIGNAL(enableAction(const char*,bool)),
this, SLOT(extensionProxyActionEnabled(const char*,bool)) );
if ( m_extensionProxy->inherits( "KHTMLPartBrowserExtension" ) )
{
connect( m_extensionProxy, SIGNAL(editableWidgetFocused()),
this, SLOT(extensionProxyEditableWidgetFocused()) );
connect( m_extensionProxy, SIGNAL(editableWidgetBlurred()),
this, SLOT(extensionProxyEditableWidgetBlurred()) );
}
enableAction( "cut", m_extensionProxy->isActionEnabled( "cut" ) );
enableAction( "copy", m_extensionProxy->isActionEnabled( "copy" ) );
enableAction( "paste", m_extensionProxy->isActionEnabled( "paste" ) );
}
else
{
updateEditActions();
enableAction( "copy", false ); // ### re-check this
}
}
void KHTMLPartBrowserExtension::cut()
{
if ( m_extensionProxy )
{
callExtensionProxyMethod( "cut" );
return;
}
if ( !m_editableFormWidget )
return;
QLineEdit* lineEdit = qobject_cast<QLineEdit *>( m_editableFormWidget );
if ( lineEdit && !lineEdit->isReadOnly() )
lineEdit->cut();
QTextEdit* textEdit = qobject_cast<QTextEdit *>( m_editableFormWidget );
if ( textEdit && !textEdit->isReadOnly() )
textEdit->cut();
}
void KHTMLPartBrowserExtension::copy()
{
if ( m_extensionProxy )
{
callExtensionProxyMethod( "copy" );
return;
}
if ( !m_editableFormWidget )
{
// get selected text and paste to the clipboard
QString text = m_part->selectedText();
text.replace( QChar( 0xa0 ), ' ' );
//kDebug(6050) << text;
QClipboard *cb = QApplication::clipboard();
disconnect( cb, SIGNAL(selectionChanged()), m_part, SLOT(slotClearSelection()) );
#ifndef QT_NO_MIMECLIPBOARD
QString htmltext;
/*
* When selectionModeEnabled, that means the user has just selected
* the text, not ctrl+c to copy it. The selection clipboard
* doesn't seem to support mime type, so to save time, don't calculate
* the selected text as html.
* optomisation disabled for now until everything else works.
*/
//if(!cb->selectionModeEnabled())
htmltext = m_part->selectedTextAsHTML();
QMimeData *mimeData = new QMimeData;
mimeData->setText(text);
if(!htmltext.isEmpty()) {
htmltext.replace( QChar( 0xa0 ), ' ' );
mimeData->setHtml(htmltext);
}
cb->setMimeData(mimeData);
#else
cb->setText(text);
#endif
connect( cb, SIGNAL(selectionChanged()), m_part, SLOT(slotClearSelection()) );
}
else
{
QLineEdit* lineEdit = qobject_cast<QLineEdit *>( m_editableFormWidget );
if ( lineEdit )
lineEdit->copy();
QTextEdit* textEdit = qobject_cast<QTextEdit *>( m_editableFormWidget );
if ( textEdit )
textEdit->copy();
}
}
void KHTMLPartBrowserExtension::searchProvider()
{
KAction *action = qobject_cast<KAction*>(sender());
if (action) {
KUrl url = action->data().toUrl();
if (url.host().isEmpty()) {
KUriFilterData data(action->data().toString());
if (KUriFilter::self()->filterSearchUri(data, KUriFilter::WebShortcutFilter))
url = data.uri();
}
KParts::BrowserArguments browserArgs;
browserArgs.frameName = "_blank";
emit m_part->browserExtension()->openUrlRequest( url, KParts::OpenUrlArguments(), browserArgs );
}
}
void KHTMLPartBrowserExtension::paste()
{
if ( m_extensionProxy )
{
callExtensionProxyMethod( "paste" );
return;
}
if ( !m_editableFormWidget )
return;
QLineEdit* lineEdit = qobject_cast<QLineEdit *>( m_editableFormWidget );
if ( lineEdit && !lineEdit->isReadOnly() )
lineEdit->paste();
QTextEdit* textEdit = qobject_cast<QTextEdit *>( m_editableFormWidget );
if ( textEdit && !textEdit->isReadOnly() )
textEdit->paste();
}
void KHTMLPartBrowserExtension::callExtensionProxyMethod( const char *method )
{
if ( !m_extensionProxy )
return;
QMetaObject::invokeMethod(m_extensionProxy, method, Qt::DirectConnection);
}
void KHTMLPartBrowserExtension::updateEditActions()
{
if ( !m_editableFormWidget )
{
enableAction( "cut", false );
enableAction( "copy", false );
enableAction( "paste", false );
return;
}
// ### duplicated from KonqMainWindow::slotClipboardDataChanged
#ifndef QT_NO_MIMECLIPBOARD // Handle minimalized versions of Qt Embedded
const QMimeData *data = QApplication::clipboard()->mimeData();
enableAction( "paste", data->hasFormat( "text/plain" ) );
#else
QString data=QApplication::clipboard()->text();
enableAction( "paste", data.contains("://"));
#endif
bool hasSelection = false;
if( m_editableFormWidget) {
if ( qobject_cast<QLineEdit*>(m_editableFormWidget))
hasSelection = static_cast<QLineEdit *>( &(*m_editableFormWidget) )->hasSelectedText();
else if(qobject_cast<QTextEdit*>(m_editableFormWidget))
hasSelection = static_cast<QTextEdit *>( &(*m_editableFormWidget) )->textCursor().hasSelection();
}
enableAction( "copy", hasSelection );
enableAction( "cut", hasSelection );
}
void KHTMLPartBrowserExtension::extensionProxyEditableWidgetFocused() {
editableWidgetFocused();
}
void KHTMLPartBrowserExtension::extensionProxyEditableWidgetBlurred() {
editableWidgetBlurred();
}
void KHTMLPartBrowserExtension::extensionProxyActionEnabled( const char *action, bool enable )
{
// only forward enableAction calls for actions we actually do forward
if ( strcmp( action, "cut" ) == 0 ||
strcmp( action, "copy" ) == 0 ||
strcmp( action, "paste" ) == 0 ) {
enableAction( action, enable );
}
}
void KHTMLPartBrowserExtension::reparseConfiguration()
{
m_part->reparseConfiguration();
}
void KHTMLPartBrowserExtension::print()
{
m_part->view()->print();
}
void KHTMLPartBrowserExtension::disableScrolling()
{
QScrollArea *scrollArea = m_part->view();
if (scrollArea) {
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
}
class KHTMLPopupGUIClient::KHTMLPopupGUIClientPrivate
{
public:
KHTMLPart *m_khtml;
KUrl m_url;
KUrl m_imageURL;
QPixmap m_pixmap;
QString m_suggestedFilename;
KActionCollection* m_actionCollection;
KParts::BrowserExtension::ActionGroupMap actionGroups;
};
KHTMLPopupGUIClient::KHTMLPopupGUIClient( KHTMLPart *khtml, const KUrl &url )
: QObject( khtml ), d(new KHTMLPopupGUIClientPrivate)
{
d->m_khtml = khtml;
d->m_url = url;
d->m_actionCollection = new KActionCollection(this);
bool isImage = false;
bool hasSelection = khtml->hasSelection();
DOM::Element e = khtml->nodeUnderMouse();
if ( !e.isNull() && (e.elementId() == ID_IMG ||
(e.elementId() == ID_INPUT && !static_cast<DOM::HTMLInputElement>(e).src().isEmpty())))
{
if (e.elementId() == ID_IMG) {
DOM::HTMLImageElementImpl *ie = static_cast<DOM::HTMLImageElementImpl*>(e.handle());
khtml::RenderImage *ri = dynamic_cast<khtml::RenderImage*>(ie->renderer());
if (ri && ri->contentObject()) {
d->m_suggestedFilename = static_cast<khtml::CachedImage*>(ri->contentObject())->suggestedFilename();
}
}
isImage=true;
}
if (hasSelection) {
QList<QAction *> editActions;
QAction* copyAction = d->m_actionCollection->addAction( KStandardAction::Copy, "copy",
d->m_khtml->browserExtension(), SLOT(copy()) );
copyAction->setText(i18n("&Copy Text"));
copyAction->setEnabled(d->m_khtml->browserExtension()->isActionEnabled( "copy" ));
editActions.append(copyAction);
editActions.append(khtml->actionCollection()->action("selectAll"));
addSearchActions(editActions);
QString selectedTextURL = selectedTextAsOneLine(d->m_khtml);
if ( selectedTextURL.contains("://") && KUrl(selectedTextURL).isValid() ) {
if (selectedTextURL.length() > 18) {
selectedTextURL.truncate(15);
selectedTextURL += "...";
}
KAction *action = new KAction(i18n("Open '%1'", selectedTextURL), this);
d->m_actionCollection->addAction( "openSelection", action );
action->setIcon( KDE::icon( "window-new" ) );
connect( action, SIGNAL(triggered(bool)), this, SLOT(openSelection()) );
editActions.append(action);
}
KAction* separator = new KAction(d->m_actionCollection);
separator->setSeparator(true);
editActions.append(separator);
d->actionGroups.insert("editactions", editActions);
}
if (!url.isEmpty()) {
QList<QAction *> linkActions;
if (url.scheme() == "mailto") {
KAction *action = new KAction( i18n( "&Copy Email Address" ), this );
d->m_actionCollection->addAction( "copylinklocation", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotCopyLinkLocation()) );
linkActions.append(action);
} else {
KAction *action = new KAction( i18n( "&Save Link As..." ), this );
d->m_actionCollection->addAction( "savelinkas", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotSaveLinkAs()) );
linkActions.append(action);
action = new KAction( i18n( "&Copy Link Address" ), this );
d->m_actionCollection->addAction( "copylinklocation", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotCopyLinkLocation()) );
linkActions.append(action);
}
d->actionGroups.insert("linkactions", linkActions);
}
QList<QAction *> partActions;
// frameset? -> add "Reload Frame" etc.
if (!hasSelection) {
if ( khtml->parentPart() ) {
KActionMenu* menu = new KActionMenu( i18nc("@title:menu HTML frame/iframe", "Frame"), this);
KAction *action = new KAction( i18n( "Open in New &Window" ), this );
d->m_actionCollection->addAction( "frameinwindow", action );
action->setIcon( KDE::icon( "window-new" ) );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotFrameInWindow()) );
menu->addAction(action);
action = new KAction( i18n( "Open in &This Window" ), this );
d->m_actionCollection->addAction( "frameintop", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotFrameInTop()) );
menu->addAction(action);
action = new KAction( i18n( "Open in &New Tab" ), this );
d->m_actionCollection->addAction( "frameintab", action );
action->setIcon( KDE::icon( "tab-new" ) );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotFrameInTab()) );
menu->addAction(action);
action = new KAction(d->m_actionCollection);
action->setSeparator(true);
menu->addAction(action);
action = new KAction( i18n( "Reload Frame" ), this );
d->m_actionCollection->addAction( "reloadframe", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotReloadFrame()) );
menu->addAction(action);
action = new KAction( i18n( "Print Frame..." ), this );
d->m_actionCollection->addAction( "printFrame", action );
action->setIcon( KDE::icon( "document-print-frame" ) );
connect( action, SIGNAL(triggered(bool)), d->m_khtml->browserExtension(), SLOT(print()) );
menu->addAction(action);
action = new KAction( i18n( "Save &Frame As..." ), this );
d->m_actionCollection->addAction( "saveFrame", action );
connect( action, SIGNAL(triggered(bool)), d->m_khtml, SLOT(slotSaveFrame()) );
menu->addAction(action);
action = new KAction( i18n( "View Frame Source" ), this );
d->m_actionCollection->addAction( "viewFrameSource", action );
connect( action, SIGNAL(triggered(bool)), d->m_khtml, SLOT(slotViewDocumentSource()) );
menu->addAction(action);
action = new KAction( i18n( "View Frame Information" ), this );
d->m_actionCollection->addAction( "viewFrameInfo", action );
connect( action, SIGNAL(triggered(bool)), d->m_khtml, SLOT(slotViewPageInfo()) );
action = new KAction(d->m_actionCollection);
action->setSeparator(true);
menu->addAction(action);
if ( KHTMLGlobal::defaultHTMLSettings()->isAdFilterEnabled() ) {
if ( khtml->d->m_frame->m_type == khtml::ChildFrame::IFrame ) {
action = new KAction( i18n( "Block IFrame..." ), this );
d->m_actionCollection->addAction( "blockiframe", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotBlockIFrame()) );
menu->addAction(action);
}
}
partActions.append(menu);
}
}
if (isImage) {
if ( e.elementId() == ID_IMG ) {
d->m_imageURL = KUrl( static_cast<DOM::HTMLImageElement>( e ).src().string() );
DOM::HTMLImageElementImpl *imageimpl = static_cast<DOM::HTMLImageElementImpl *>( e.handle() );
Q_ASSERT(imageimpl);
if(imageimpl) // should be true always. right?
{
if(imageimpl->complete()) {
d->m_pixmap = imageimpl->currentPixmap();
}
}
}
else
d->m_imageURL = KUrl( static_cast<DOM::HTMLInputElement>( e ).src().string() );
KAction *action = new KAction( i18n( "Save Image As..." ), this );
d->m_actionCollection->addAction( "saveimageas", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotSaveImageAs()) );
partActions.append(action);
action = new KAction( i18n( "Send Image..." ), this );
d->m_actionCollection->addAction( "sendimage", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotSendImage()) );
partActions.append(action);
#ifndef QT_NO_MIMECLIPBOARD
action = new KAction( i18n( "Copy Image" ), this );
d->m_actionCollection->addAction( "copyimage", action );
action->setEnabled(!d->m_pixmap.isNull());
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotCopyImage()) );
partActions.append(action);
#endif
if(d->m_pixmap.isNull()) { //fallback to image location if still loading the image. this will always be true if ifdef QT_NO_MIMECLIPBOARD
action = new KAction( i18n( "Copy Image Location" ), this );
d->m_actionCollection->addAction( "copyimagelocation", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotCopyImageLocation()) );
partActions.append(action);
}
QString actionText = d->m_suggestedFilename.isEmpty() ?
KStringHandler::csqueeze(d->m_imageURL.fileName()+d->m_imageURL.query(), 25)
: d->m_suggestedFilename;
action = new KAction( i18n("View Image (%1)", actionText.replace("&", "&&")), this );
d->m_actionCollection->addAction( "viewimage", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotViewImage()) );
partActions.append(action);
if (KHTMLGlobal::defaultHTMLSettings()->isAdFilterEnabled()) {
action = new KAction( i18n( "Block Image..." ), this );
d->m_actionCollection->addAction( "blockimage", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotBlockImage()) );
partActions.append(action);
if (!d->m_imageURL.host().isEmpty() &&
!d->m_imageURL.scheme().isEmpty())
{
action = new KAction( i18n( "Block Images From %1" , d->m_imageURL.host()), this );
d->m_actionCollection->addAction( "blockhost", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotBlockHost()) );
partActions.append(action);
}
}
KAction* separator = new KAction(d->m_actionCollection);
separator->setSeparator(true);
partActions.append(separator);
}
if ( isImage || url.isEmpty() ) {
KAction *action = new KAction( i18n( "Stop Animations" ), this );
d->m_actionCollection->addAction( "stopanimations", action );
connect( action, SIGNAL(triggered(bool)), this, SLOT(slotStopAnimations()) );
partActions.append(action);
KAction* separator = new KAction(d->m_actionCollection);
separator->setSeparator(true);
partActions.append(separator);
}
if (!hasSelection && url.isEmpty()) { // only when right-clicking on the page itself
partActions.append(khtml->actionCollection()->action("viewDocumentSource"));
}
if (!hasSelection && url.isEmpty() && !isImage) {
partActions.append(khtml->actionCollection()->action("setEncoding"));
}
d->actionGroups.insert("partactions", partActions);
}
KHTMLPopupGUIClient::~KHTMLPopupGUIClient()
{
delete d->m_actionCollection;
delete d;
}
void KHTMLPopupGUIClient::addSearchActions(QList<QAction *>& editActions)
{
const QString selectedText = d->m_khtml->simplifiedSelectedText();
if (selectedText.isEmpty())
return;
KUriFilterData data(selectedText);
QStringList alternateProviders;
alternateProviders << "google" << "google_groups" << "google_news" << "webster" << "dmoz" << "wikipedia";
data.setAlternateSearchProviders(alternateProviders);
data.setAlternateDefaultSearchProvider("google");
if (KUriFilter::self()->filterSearchUri(data, KUriFilter::NormalTextFilter)) {
const QString squeezedText = KStringHandler::rsqueeze(selectedText, 21);
KAction *action = new KAction(i18n("Search for '%1' with %2",
squeezedText, data.searchProvider()), this);
action->setData(QUrl(data.uri()));
action->setIcon(KDE::icon(data.iconName()));
connect(action, SIGNAL(triggered(bool)), d->m_khtml->browserExtension(), SLOT(searchProvider()));
d->m_actionCollection->addAction("defaultSearchProvider", action);
editActions.append(action);
const QStringList preferredSearchProviders = data.preferredSearchProviders();
if (!preferredSearchProviders.isEmpty()) {
KActionMenu* providerList = new KActionMenu(i18n("Search for '%1' with", squeezedText), this);
Q_FOREACH(const QString &searchProvider, preferredSearchProviders) {
if (searchProvider == data.searchProvider())
continue;
KAction *action = new KAction(searchProvider, this);
action->setData(data.queryForPreferredSearchProvider(searchProvider));
d->m_actionCollection->addAction(searchProvider, action);
action->setIcon(KDE::icon(data.iconNameForPreferredSearchProvider(searchProvider)));
connect(action, SIGNAL(triggered(bool)), d->m_khtml->browserExtension(), SLOT(searchProvider()));
providerList->addAction(action);
}
d->m_actionCollection->addAction("searchProviderList", providerList);
editActions.append(providerList);
}
}
}
QString KHTMLPopupGUIClient::selectedTextAsOneLine(KHTMLPart* part)
{
QString text = part->simplifiedSelectedText();
// in addition to what simplifiedSelectedText does,
// remove linefeeds and any whitespace surrounding it (#113177),
// to get it all in a single line.
text.remove(QRegExp("[\\s]*\\n+[\\s]*"));
return text;
}
void KHTMLPopupGUIClient::openSelection()
{
KParts::BrowserArguments browserArgs;
browserArgs.frameName = "_blank";
emit d->m_khtml->browserExtension()->openUrlRequest(selectedTextAsOneLine(d->m_khtml), KParts::OpenUrlArguments(), browserArgs);
}
KParts::BrowserExtension::ActionGroupMap KHTMLPopupGUIClient::actionGroups() const
{
return d->actionGroups;
}
void KHTMLPopupGUIClient::slotSaveLinkAs()
{
KIO::MetaData metaData;
metaData["referrer"] = d->m_khtml->referrer();
saveURL( d->m_khtml->widget(), i18n( "Save Link As" ), d->m_url, metaData );
}
void KHTMLPopupGUIClient::slotSendImage()
{
QStringList urls;
urls.append( d->m_imageURL.url());
QString subject = d->m_imageURL.url();
KToolInvocation::invokeMailer(QString(), QString(), QString(), subject,
QString(), //body
QString(),
urls); // attachments
}
void KHTMLPopupGUIClient::slotSaveImageAs()
{
KIO::MetaData metaData;
metaData["referrer"] = d->m_khtml->referrer();
saveURL( d->m_khtml->widget(), i18n( "Save Image As" ), d->m_imageURL, metaData, QString(), 0, d->m_suggestedFilename );
}
void KHTMLPopupGUIClient::slotBlockHost()
{
QString name=d->m_imageURL.scheme()+"://"+d->m_imageURL.host()+"/*";
KHTMLGlobal::defaultHTMLSettings()->addAdFilter( name );
d->m_khtml->reparseConfiguration();
}
void KHTMLPopupGUIClient::slotBlockImage()
{
bool ok = false;
QString url = KInputDialog::getText( i18n("Add URL to Filter"),
i18n("Enter the URL:"),
d->m_imageURL.url(),
&ok);
if ( ok ) {
KHTMLGlobal::defaultHTMLSettings()->addAdFilter( url );
d->m_khtml->reparseConfiguration();
}
}
void KHTMLPopupGUIClient::slotBlockIFrame()
{
bool ok = false;
QString url = KInputDialog::getText( i18n( "Add URL to Filter"),
i18n("Enter the URL:"),
d->m_khtml->url().url(),
&ok );
if ( ok ) {
KHTMLGlobal::defaultHTMLSettings()->addAdFilter( url );
d->m_khtml->reparseConfiguration();
}
}
void KHTMLPopupGUIClient::slotCopyLinkLocation()
{
KUrl safeURL(d->m_url);
safeURL.setPass(QString());
#ifndef QT_NO_MIMECLIPBOARD
// Set it in both the mouse selection and in the clipboard
QMimeData* mimeData = new QMimeData;
safeURL.populateMimeData( mimeData );
QApplication::clipboard()->setMimeData( mimeData, QClipboard::Clipboard );
mimeData = new QMimeData;
safeURL.populateMimeData( mimeData );
QApplication::clipboard()->setMimeData( mimeData, QClipboard::Selection );
#else
QApplication::clipboard()->setText( safeURL.url() ); //FIXME(E): Handle multiple entries
#endif
}
void KHTMLPopupGUIClient::slotStopAnimations()
{
d->m_khtml->stopAnimations();
}
void KHTMLPopupGUIClient::slotCopyImage()
{
#ifndef QT_NO_MIMECLIPBOARD
KUrl safeURL(d->m_imageURL);
safeURL.setPass(QString());
// Set it in both the mouse selection and in the clipboard
QMimeData* mimeData = new QMimeData;
mimeData->setImageData( d->m_pixmap );
safeURL.populateMimeData( mimeData );
QApplication::clipboard()->setMimeData( mimeData, QClipboard::Clipboard );
mimeData = new QMimeData;
mimeData->setImageData( d->m_pixmap );
safeURL.populateMimeData( mimeData );
QApplication::clipboard()->setMimeData( mimeData, QClipboard::Selection );
#else
kDebug() << "slotCopyImage called when the clipboard does not support this. This should not be possible.";
#endif
}
void KHTMLPopupGUIClient::slotCopyImageLocation()
{
KUrl safeURL(d->m_imageURL);
safeURL.setPass(QString());
#ifndef QT_NO_MIMECLIPBOARD
// Set it in both the mouse selection and in the clipboard
QMimeData* mimeData = new QMimeData;
safeURL.populateMimeData( mimeData );
QApplication::clipboard()->setMimeData( mimeData, QClipboard::Clipboard );
mimeData = new QMimeData;
safeURL.populateMimeData( mimeData );
QApplication::clipboard()->setMimeData( mimeData, QClipboard::Selection );
#else
QApplication::clipboard()->setText( safeURL.url() ); //FIXME(E): Handle multiple entries
#endif
}
void KHTMLPopupGUIClient::slotViewImage()
{
d->m_khtml->browserExtension()->createNewWindow(d->m_imageURL);
}
void KHTMLPopupGUIClient::slotReloadFrame()
{
KParts::OpenUrlArguments args = d->m_khtml->arguments();
args.setReload( true );
args.metaData()["referrer"] = d->m_khtml->pageReferrer();
// reload document
d->m_khtml->closeUrl();
d->m_khtml->setArguments( args );
d->m_khtml->openUrl( d->m_khtml->url() );
}
void KHTMLPopupGUIClient::slotFrameInWindow()
{
KParts::OpenUrlArguments args = d->m_khtml->arguments();
args.metaData()["referrer"] = d->m_khtml->pageReferrer();
KParts::BrowserArguments browserArgs( d->m_khtml->browserExtension()->browserArguments() );
browserArgs.setForcesNewWindow(true);
emit d->m_khtml->browserExtension()->createNewWindow( d->m_khtml->url(), args, browserArgs );
}
void KHTMLPopupGUIClient::slotFrameInTop()
{
KParts::OpenUrlArguments args = d->m_khtml->arguments();
args.metaData()["referrer"] = d->m_khtml->pageReferrer();
KParts::BrowserArguments browserArgs( d->m_khtml->browserExtension()->browserArguments() );
browserArgs.frameName = "_top";
emit d->m_khtml->browserExtension()->openUrlRequest( d->m_khtml->url(), args, browserArgs );
}
void KHTMLPopupGUIClient::slotFrameInTab()
{
KParts::OpenUrlArguments args = d->m_khtml->arguments();
args.metaData()["referrer"] = d->m_khtml->pageReferrer();
KParts::BrowserArguments browserArgs( d->m_khtml->browserExtension()->browserArguments() );
browserArgs.setNewTab(true);
emit d->m_khtml->browserExtension()->createNewWindow( d->m_khtml->url(), args, browserArgs );
}
void KHTMLPopupGUIClient::saveURL( QWidget *parent, const QString &caption,
const KUrl &url,
const QMap<QString, QString> &metadata,
const QString &filter, long cacheId,
const QString & suggestedFilename )
{
QString name = QLatin1String( "index.html" );
if ( !suggestedFilename.isEmpty() )
name = suggestedFilename;
else if ( !url.fileName(KUrl::ObeyTrailingSlash).isEmpty() )
name = url.fileName(KUrl::ObeyTrailingSlash);
KUrl destURL;
int query;
do {
query = KMessageBox::Yes;
// convert filename to URL using fromPath to avoid trouble with ':' in filenames (#184202)
destURL = KFileDialog::getSaveUrl( KUrl::fromPath(name), filter, parent, caption );
if( destURL.isLocalFile() )
{
QFileInfo info( destURL.toLocalFile() );
if( info.exists() ) {
// TODO: use KIO::RenameDlg (shows more information)
query = KMessageBox::warningContinueCancel( parent, i18n( "A file named \"%1\" already exists. " "Are you sure you want to overwrite it?" , info.fileName() ), i18n( "Overwrite File?" ), KGuiItem(i18n( "Overwrite" )) );
}
}
} while ( query == KMessageBox::Cancel );
if ( destURL.isValid() )
saveURL(parent, url, destURL, metadata, cacheId);
}
void KHTMLPopupGUIClient::saveURL( QWidget* parent, const KUrl &url, const KUrl &destURL,
const QMap<QString, QString> &metadata,
long cacheId )
{
if ( destURL.isValid() )
{
bool saved = false;
if (KHTMLPageCache::self()->isComplete(cacheId))
{
if (destURL.isLocalFile())
{
- KSaveFile destFile(destURL.toLocalFile());
- if (destFile.open())
- {
- QDataStream stream ( &destFile );
+ QSaveFile destFile(destURL.toLocalFile());
+ if (destFile.open(QIODevice::WriteOnly)) {
+ QDataStream stream(&destFile);
KHTMLPageCache::self()->saveData(cacheId, &stream);
+ destFile.commit();
saved = true;
}
}
else
{
// save to temp file, then move to final destination.
KTemporaryFile destFile;
if (destFile.open())
{
QDataStream stream ( &destFile );
KHTMLPageCache::self()->saveData(cacheId, &stream);
KUrl url2 = KUrl();
url2.setPath(destFile.fileName());
KIO::file_move(url2, destURL, -1, KIO::Overwrite);
saved = true;
}
}
}
if(!saved)
{
// DownloadManager <-> konqueror integration
// find if the integration is enabled
// the empty key means no integration
// only use download manager for non-local urls!
bool downloadViaKIO = true;
if ( !url.isLocalFile() )
{
KConfigGroup cfg = KSharedConfig::openConfig("konquerorrc", KConfig::NoGlobals)->group("HTML Settings");
QString downloadManger = cfg.readPathEntry("DownloadManager", QString());
if (!downloadManger.isEmpty())
{
// then find the download manager location
kDebug(1000) << "Using: "<<downloadManger <<" as Download Manager";
QString cmd = KStandardDirs::findExe(downloadManger);
if (cmd.isEmpty())
{
QString errMsg=i18n("The Download Manager (%1) could not be found in your $PATH ", downloadManger);
QString errMsgEx= i18n("Try to reinstall it \n\nThe integration with Konqueror will be disabled.");
KMessageBox::detailedSorry(0,errMsg,errMsgEx);
cfg.writePathEntry("DownloadManager",QString());
cfg.sync ();
}
else
{
downloadViaKIO = false;
KUrl cleanDest = destURL;
cleanDest.setPass( QString() ); // don't put password into commandline
cmd += ' ' + KShell::quoteArg(url.url()) + ' ' +
KShell::quoteArg(cleanDest.url());
kDebug(1000) << "Calling command "<<cmd;
KRun::runCommand(cmd, parent->topLevelWidget());
}
}
}
if ( downloadViaKIO )
{
KParts::BrowserRun::saveUrlUsingKIO(url, destURL, parent, metadata);
}
} //end if(!saved)
}
}
KHTMLPartBrowserHostExtension::KHTMLPartBrowserHostExtension( KHTMLPart *part )
: KParts::BrowserHostExtension( part )
{
m_part = part;
}
KHTMLPartBrowserHostExtension::~KHTMLPartBrowserHostExtension()
{
}
QStringList KHTMLPartBrowserHostExtension::frameNames() const
{
return m_part->frameNames();
}
const QList<KParts::ReadOnlyPart*> KHTMLPartBrowserHostExtension::frames() const
{
return m_part->frames();
}
bool KHTMLPartBrowserHostExtension::openUrlInFrame(const KUrl &url, const KParts::OpenUrlArguments& arguments, const KParts::BrowserArguments &browserArguments)
{
return m_part->openUrlInFrame( url, arguments, browserArguments );
}
KParts::BrowserHostExtension* KHTMLPartBrowserHostExtension::findFrameParent( KParts::ReadOnlyPart
*callingPart, const QString &frame )
{
KHTMLPart *parentPart = m_part->d->findFrameParent(callingPart, frame, 0, true /* navigation*/);
if (parentPart)
return parentPart->browserHostExtension();
return 0;
}
// defined in khtml_part.cpp
extern const int KDE_NO_EXPORT fastZoomSizes[];
extern const int KDE_NO_EXPORT fastZoomSizeCount;
KHTMLZoomFactorAction::KHTMLZoomFactorAction( KHTMLPart *part, bool direction, const QString &icon, const QString &text, QObject *parent )
: KSelectAction( text, parent )
{
setIcon( KDE::icon( icon ) );
setToolBarMode(MenuMode);
setToolButtonPopupMode(QToolButton::DelayedPopup);
init(part, direction);
}
void KHTMLZoomFactorAction::init(KHTMLPart *part, bool direction)
{
m_direction = direction;
m_part = part;
// xgettext: no-c-format
addAction( i18n( "Default Font Size (100%)" ) );
int m = m_direction ? 1 : -1;
int ofs = fastZoomSizeCount / 2; // take index of 100%
// this only works if there is an odd number of elements in fastZoomSizes[]
for ( int i = m; i != m*(ofs+1); i += m )
{
int num = i * m;
QString numStr = QString::number( num );
if ( num > 0 ) numStr.prepend( QLatin1Char('+') );
// xgettext: no-c-format
addAction( i18n( "%1%" , fastZoomSizes[ofs + i] ) );
}
connect( selectableActionGroup(), SIGNAL(triggered(QAction*)), this, SLOT(slotTriggered(QAction*)) );
}
KHTMLZoomFactorAction::~KHTMLZoomFactorAction()
{
}
void KHTMLZoomFactorAction::slotTriggered(QAction* action)
{
int idx = selectableActionGroup()->actions().indexOf(action);
if (idx == 0)
m_part->setFontScaleFactor(100);
else
m_part->setFontScaleFactor(fastZoomSizes[fastZoomSizeCount/2 + (m_direction ? 1 : -1)*idx]);
setCurrentAction( 0L );
}
KHTMLTextExtension::KHTMLTextExtension(KHTMLPart* part)
: KParts::TextExtension(part)
{
connect(part, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged()));
}
KHTMLPart* KHTMLTextExtension::part() const
{
return static_cast<KHTMLPart*>(parent());
}
bool KHTMLTextExtension::hasSelection() const
{
return part()->hasSelection();
}
QString KHTMLTextExtension::selectedText(Format format) const
{
switch(format) {
case PlainText:
return part()->selectedText();
case HTML:
return part()->selectedTextAsHTML();
}
return QString();
}
QString KHTMLTextExtension::completeText(Format format) const
{
switch(format) {
case PlainText:
return part()->htmlDocument().body().innerText().string();
case HTML:
return part()->htmlDocument().body().innerHTML().string();
}
return QString();
}
////
KHTMLHtmlExtension::KHTMLHtmlExtension(KHTMLPart* part)
: KParts::HtmlExtension(part)
{
}
KUrl KHTMLHtmlExtension::baseUrl() const
{
return part()->baseURL();
}
bool KHTMLHtmlExtension::hasSelection() const
{
return part()->hasSelection();
}
KParts::SelectorInterface::QueryMethods KHTMLHtmlExtension::supportedQueryMethods() const
{
return (KParts::SelectorInterface::SelectedContent | KParts::SelectorInterface::EntireContent);
}
static KParts::SelectorInterface::Element convertDomElement(const DOM::ElementImpl* domElem)
{
KParts::SelectorInterface::Element elem;
elem.setTagName(domElem->tagName().string());
const DOM::NamedAttrMapImpl* attrMap = domElem->attributes(true /*readonly*/);
if (attrMap) {
for (unsigned i = 0; i < attrMap->length(); ++i) {
const DOM::AttributeImpl& attr = attrMap->attributeAt(i);
elem.setAttribute(attr.localName().string(), attr.value().string());
// we could have a setAttributeNS too.
}
}
return elem;
}
KParts::SelectorInterface::Element KHTMLHtmlExtension::querySelector(const QString& query, KParts::SelectorInterface::QueryMethod method) const
{
KParts::SelectorInterface::Element element;
// If the specified method is None, return an empty list; similarly
// if the document is null, which may be possible in case of an error
if (method == KParts::SelectorInterface::None || part()->document().isNull())
return element;
if (!(supportedQueryMethods() & method))
return element;
switch (method) {
case KParts::SelectorInterface::EntireContent: {
int ec = 0; // exceptions are ignored
WTF::RefPtr<DOM::ElementImpl> domElem = part()->document().handle()->querySelector(query, ec);
element = convertDomElement(domElem.get());
break;
}
case KParts::SelectorInterface::SelectedContent:
if (part()->hasSelection()) {
DOM::Element domElem = part()->selection().cloneContents().querySelector(query);
element = convertDomElement(static_cast<DOM::ElementImpl*>(domElem.handle()));
}
break;
default:
break;
}
return element;
}
QList<KParts::SelectorInterface::Element> KHTMLHtmlExtension::querySelectorAll(const QString& query, KParts::SelectorInterface::QueryMethod method) const
{
QList<KParts::SelectorInterface::Element> elements;
// If the specified method is None, return an empty list; similarly
// if the document is null, which may be possible in case of an error
if (method == KParts::SelectorInterface::None || part()->document().isNull())
return elements;
// If the specified method is not supported, return an empty list...
if (!(supportedQueryMethods() & method))
return elements;
switch (method) {
case KParts::SelectorInterface::EntireContent: {
int ec = 0; // exceptions are ignored
WTF::RefPtr<DOM::NodeListImpl> nodes = part()->document().handle()->querySelectorAll(query, ec);
const unsigned long len = nodes->length();
elements.reserve(len);
for (unsigned long i = 0; i < len; ++i) {
DOM::NodeImpl* node = nodes->item(i);
if (node->isElementNode()) { // should be always true
elements.append(convertDomElement(static_cast<DOM::ElementImpl*>(node)));
}
}
break;
}
case KParts::SelectorInterface::SelectedContent:
if (part()->hasSelection()) {
DOM::NodeList nodes = part()->selection().cloneContents().querySelectorAll(query);
const unsigned long len = nodes.length();
for (unsigned long i = 0; i < len; ++i) {
DOM::NodeImpl* node = nodes.item(i).handle();
if (node->isElementNode())
elements.append(convertDomElement(static_cast<DOM::ElementImpl*>(node)));
}
}
break;
default:
break;
}
return elements;
}
QVariant KHTMLHtmlExtension::htmlSettingsProperty(HtmlSettingsInterface::HtmlSettingsType type) const
{
if (part()) {
switch (type) {
case KParts::HtmlSettingsInterface::AutoLoadImages:
return part()->autoloadImages();
case KParts::HtmlSettingsInterface::DnsPrefetchEnabled:
return (part()->dnsPrefetch() == KHTMLPart::DNSPrefetchEnabled);
case KParts::HtmlSettingsInterface::JavaEnabled:
return part()->javaEnabled();
case KParts::HtmlSettingsInterface::JavascriptEnabled:
return part()->jScriptEnabled();
case KParts::HtmlSettingsInterface::MetaRefreshEnabled:
return part()->metaRefreshEnabled();
case KParts::HtmlSettingsInterface::PluginsEnabled:
return part()->pluginsEnabled();
default:
break;
}
}
return QVariant();
}
bool KHTMLHtmlExtension::setHtmlSettingsProperty(HtmlSettingsInterface::HtmlSettingsType type, const QVariant& value)
{
KHTMLPart* p = part();
if (p) {
switch (type) {
case KParts::HtmlSettingsInterface::AutoLoadImages:
p->setAutoloadImages(value.toBool());
return true;
case KParts::HtmlSettingsInterface::DnsPrefetchEnabled:
p->setDNSPrefetch((value.toBool() ? KHTMLPart::DNSPrefetchEnabled : KHTMLPart::DNSPrefetchDisabled));
return true;
case KParts::HtmlSettingsInterface::JavaEnabled:
p->setJavaEnabled(value.toBool());
return true;
case KParts::HtmlSettingsInterface::JavascriptEnabled:
p->setJScriptEnabled(value.toBool());
return true;
case KParts::HtmlSettingsInterface::MetaRefreshEnabled:
p->setMetaRefreshEnabled(value.toBool());
return true;
case KParts::HtmlSettingsInterface::PluginsEnabled:
p->setPluginsEnabled(value.toBool());
return true;
case KParts::HtmlSettingsInterface::UserDefinedStyleSheetURL: {
const KUrl url (value.toUrl());
if (url.protocol() == QLatin1String("data")) {
const QByteArray data (url.encodedPath());
if (!data.isEmpty()) {
const int index = data.indexOf(',');
const QByteArray decodedData ((index > -1 ? QByteArray::fromBase64(data.mid(index)) : QByteArray()));
p->setUserStyleSheet(QString::fromUtf8(decodedData.constData(), decodedData.size()));
}
} else {
p->setUserStyleSheet(url);
}
return true;
}
default:
break; // Unsupported property...
}
}
return false;
}
KHTMLPart* KHTMLHtmlExtension::part() const
{
return static_cast<KHTMLPart*>(parent());
}

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 1, 9:08 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10075557
Default Alt Text
(80 KB)

Event Timeline