SVN commit 1088726 by tnyblom: Port the kontact container to kwebkit M +3 -2 CMakeLists.txt M +17 -23 mainwindow.cpp M +3 -2 mainwindow.h --- trunk/KDE/kdepim/kontact/src/CMakeLists.txt #1088725:1088726 @@ -19,7 +19,7 @@ kde4_add_library(kontactprivate SHARED ${kontactprivate_LIB_SRCS}) -target_link_libraries(kontactprivate ${KDE4_KPARTS_LIBS} ${KDEPIMLIBS_KONTACTINTERFACE_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_KHTML_LIBRARY} ${KDEPIMLIBS_KPIMUTILS_LIBS} kdepim ${KDE4_KDE3SUPPORT_LIBRARY} ${QT_QT3SUPPORT_LIBRARY} kdepimdbusinterfaces) +target_link_libraries(kontactprivate ${KDE4_KPARTS_LIBS} ${KDEPIMLIBS_KONTACTINTERFACE_LIBS} ${QT_QTWEBKIT_LIBRARY} ${KDE4_KDEWEBKIT_LIBRARY} ${KDE4_KUTILS_LIBS} ${KDEPIMLIBS_KPIMUTILS_LIBS} kdepim ${KDE4_KDE3SUPPORT_LIBRARY} ${QT_QT3SUPPORT_LIBRARY} kdepimdbusinterfaces) set_target_properties(kontactprivate PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) install(TARGETS kontactprivate ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) @@ -36,7 +36,8 @@ set_target_properties(kontact_bin PROPERTIES OUTPUT_NAME kontact) target_link_libraries(kontact_bin - ${KDE4_KHTML_LIBS} + ${QT_QTWEBKIT_LIBRARY} + ${KDE4_KDEWEBKIT_LIBRARY} ${KDE4_KDE3SUPPORT_LIBS} kontactprivate kdepim --- trunk/KDE/kdepim/kontact/src/mainwindow.cpp #1088725:1088726 @@ -46,8 +46,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -70,6 +69,7 @@ #include #include #include +#include // This class extends the normal KDBusServiceStarter. // @@ -358,14 +358,13 @@ content = content.arg( "" ); } - mIntroPart->begin( KUrl( location ) ); - mIntroPart->write( + mIntroPart->setHtml( content.arg( QFont().pointSize() + 2 ). arg( i18nc( "@item:intext", "KDE Kontact" ) ). arg( i18nc( "@item:intext", "Get Organized!" ) ). arg( i18nc( "@item:intext", "The KDE Personal Information Management Suite" ) ). - arg( msg ) ); - mIntroPart->end(); + arg( msg ), + QUrl( location ) ); } void MainWindow::initAboutScreen() @@ -373,25 +372,15 @@ KHBox *introbox = new KHBox( mPartsStack ); mPartsStack->addWidget( introbox ); mPartsStack->setCurrentWidget( introbox ); - mIntroPart = new KHTMLPart( introbox ); - mIntroPart->widget()->setFocusPolicy( Qt::WheelFocus ); + mIntroPart = new KWebView( introbox ); + mIntroPart->setFocusPolicy( Qt::WheelFocus ); // Let's better be paranoid and disable plugins (it defaults to enabled): - mIntroPart->setPluginsEnabled( false ); - mIntroPart->setJScriptEnabled( false ); // just make this explicit - mIntroPart->setJavaEnabled( false ); // just make this explicit - mIntroPart->setMetaRefreshEnabled( false ); - mIntroPart->setURLCursor( QCursor( Qt::PointingHandCursor ) ); - mIntroPart->view()->setLineWidth( 0 ); + mIntroPart->settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); + mIntroPart->settings()->setAttribute( QWebSettings::JavaEnabled, false ); + mIntroPart->settings()->setAttribute( QWebSettings::PluginsEnabled, false ); - connect( mIntroPart->browserExtension(), - SIGNAL(openUrlRequest(const KUrl &,const KParts::OpenUrlArguments &, - const KParts::BrowserArguments &)), - SLOT(slotOpenUrl(const KUrl &)) ); - - connect( mIntroPart->browserExtension(), - SIGNAL(createNewWindow(const KUrl &,const KParts::OpenUrlArguments &, - const KParts::BrowserArguments &)), - SLOT(slotOpenUrl(const KUrl&)) ); + connect( mIntroPart->page(), SIGNAL( linkClicked( const QUrl & ) ), this, + SLOT( slotUrlOpen( const QUrl & ) ), Qt::QueuedConnection); } void MainWindow::setupActions() @@ -1089,6 +1078,11 @@ updateShortcuts(); // for the plugActionList call } +void MainWindow::slotOpenUrl( const QUrl &url ) +{ + slotOpenUrl( KUrl( url ) ); +} + void MainWindow::slotOpenUrl( const KUrl &url ) { if ( url.protocol() == "exec" ) { --- trunk/KDE/kdepim/kontact/src/mainwindow.h #1088725:1088726 @@ -36,7 +36,7 @@ } class KActionMenu; -class KHTMLPart; +class KWebView; class KPluginInfo; class KSqueezedTextLabel; @@ -91,6 +91,7 @@ void slotShowStatusMsg( const QString & ); void activateInitialPluginModule(); void slotOpenUrl( const KUrl &url ); + void slotOpenUrl( const QUrl &url ); private: void initWidgets(); @@ -136,7 +137,7 @@ PluginList mDelayedPreload; ActionPluginList mActionPlugins; QList mPluginInfos; - KHTMLPart *mIntroPart; + KWebView *mIntroPart; KSqueezedTextLabel *mStatusMsgLabel; KPIM::StatusbarProgressWidget *mLittleProgress;