summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt264
-rw-r--r--src/Messages.sh5
-rw-r--r--src/adblock/adblockhostmatcher.cpp56
-rw-r--r--src/adblock/adblockhostmatcher.h54
-rw-r--r--src/adblock/adblockmanager.cpp450
-rw-r--r--src/adblock/adblockmanager.h202
-rw-r--r--src/adblock/adblocknetworkreply.cpp70
-rw-r--r--src/adblock/adblocknetworkreply.h58
-rw-r--r--src/adblock/adblockrule.cpp67
-rw-r--r--src/adblock/adblockrule.h74
-rw-r--r--src/adblock/adblockrulefallbackimpl.cpp180
-rw-r--r--src/adblock/adblockrulefallbackimpl.h56
-rw-r--r--src/adblock/adblockruleimpl.h44
-rw-r--r--src/adblock/adblockrulenullimpl.cpp139
-rw-r--r--src/adblock/adblockrulenullimpl.h51
-rw-r--r--src/adblock/adblockruletextmatchimpl.cpp94
-rw-r--r--src/adblock/adblockruletextmatchimpl.h52
-rw-r--r--src/adblock/adblockwidget.cpp242
-rw-r--r--src/adblock/adblockwidget.h73
-rw-r--r--src/adblock/blocked_elements.ui116
-rw-r--r--src/adblock/blockedelementswidget.cpp116
-rw-r--r--src/adblock/blockedelementswidget.h71
-rw-r--r--src/adblock/settings_adblock.ui178
-rw-r--r--src/adblock/tests/RULES19
-rw-r--r--src/adblock/tests/divhidingtest.html15
-rw-r--r--src/analyzer/analyzerpanel.cpp95
-rw-r--r--src/analyzer/analyzerpanel.h66
-rw-r--r--src/analyzer/networkanalyzer.cpp237
-rw-r--r--src/analyzer/networkanalyzer.h79
-rw-r--r--src/application.cpp883
-rw-r--r--src/application.h155
-rw-r--r--src/bookmarks/bookmarkmanager.cpp353
-rw-r--r--src/bookmarks/bookmarkmanager.h172
-rw-r--r--src/bookmarks/bookmarkowner.cpp428
-rw-r--r--src/bookmarks/bookmarkowner.h159
-rw-r--r--src/bookmarks/bookmarkscontextmenu.cpp164
-rw-r--r--src/bookmarks/bookmarkscontextmenu.h57
-rw-r--r--src/bookmarks/bookmarkspanel.cpp169
-rw-r--r--src/bookmarks/bookmarkspanel.h93
-rw-r--r--src/bookmarks/bookmarkstoolbar.cpp624
-rw-r--r--src/bookmarks/bookmarkstoolbar.h115
-rw-r--r--src/bookmarks/bookmarkstreemodel.cpp407
-rw-r--r--src/bookmarks/bookmarkstreemodel.h116
-rw-r--r--src/cleardata.ui129
-rw-r--r--src/clicktoflash.cpp135
-rw-r--r--src/clicktoflash.h65
-rwxr-xr-xsrc/data/rekonq.desktop15
-rw-r--r--src/downloaditem.cpp157
-rw-r--r--src/downloaditem.h117
-rw-r--r--src/downloadmanager.cpp263
-rw-r--r--src/downloadmanager.h89
-rw-r--r--src/findbar.cpp212
-rw-r--r--src/findbar.h74
-rw-r--r--src/history/autosaver.cpp96
-rw-r--r--src/history/autosaver.h75
-rw-r--r--src/history/historymanager.cpp455
-rw-r--r--src/history/historymanager.h206
-rw-r--r--src/history/historymodels.cpp744
-rw-r--r--src/history/historymodels.h179
-rw-r--r--src/history/historypanel.cpp211
-rw-r--r--src/history/historypanel.h63
-rw-r--r--src/icondownloader.cpp112
-rw-r--r--src/icondownloader.h61
-rw-r--r--src/iconmanager.cpp264
-rw-r--r--src/iconmanager.h72
-rw-r--r--src/kspellplugin.cpp198
-rw-r--r--src/kspellplugin.h76
-rw-r--r--src/main.cpp224
-rw-r--r--src/mainview.cpp848
-rw-r--r--src/mainview.h211
-rw-r--r--src/mainwindow.cpp1694
-rw-r--r--src/mainwindow.h235
-rw-r--r--src/messagebar.cpp71
-rw-r--r--src/messagebar.h54
-rw-r--r--src/networkaccessmanager.cpp120
-rw-r--r--src/networkaccessmanager.h59
-rw-r--r--src/newtabpage.cpp1094
-rw-r--r--src/newtabpage.h125
-rw-r--r--src/opensearch/opensearchengine.cpp314
-rw-r--r--src/opensearch/opensearchengine.h122
-rw-r--r--src/opensearch/opensearchmanager.cpp358
-rw-r--r--src/opensearch/opensearchmanager.h125
-rw-r--r--src/opensearch/opensearchreader.cpp194
-rw-r--r--src/opensearch/opensearchreader.h55
-rw-r--r--src/opensearch/opensearchwriter.cpp130
-rw-r--r--src/opensearch/opensearchwriter.h56
-rw-r--r--src/opensearch/searchengine.cpp157
-rw-r--r--src/opensearch/searchengine.h59
-rw-r--r--src/opensearch/suggestionparser.cpp147
-rw-r--r--src/opensearch/suggestionparser.h118
-rw-r--r--src/paneltreeview.cpp185
-rw-r--r--src/paneltreeview.h69
-rw-r--r--src/previewselectorbar.cpp132
-rw-r--r--src/previewselectorbar.h67
-rw-r--r--src/protocolhandler.cpp386
-rw-r--r--src/protocolhandler.h83
-rw-r--r--src/qwebkitplatformplugin.h201
-rw-r--r--src/rekonq.kcfg294
-rw-r--r--src/rekonq.kcfgc5
-rw-r--r--src/rekonq_defines.h117
-rw-r--r--src/rekonqmenu.cpp99
-rw-r--r--src/rekonqmenu.h64
-rw-r--r--src/rekonqui.rc155
-rw-r--r--src/searchenginebar.cpp93
-rw-r--r--src/searchenginebar.h55
-rw-r--r--src/sessionmanager.cpp298
-rw-r--r--src/sessionmanager.h87
-rw-r--r--src/settings/advancedwidget.cpp70
-rw-r--r--src/settings/advancedwidget.h62
-rw-r--r--src/settings/appearancewidget.cpp119
-rw-r--r--src/settings/appearancewidget.h65
-rw-r--r--src/settings/generalwidget.cpp130
-rw-r--r--src/settings/generalwidget.h62
-rw-r--r--src/settings/networkwidget.cpp100
-rw-r--r--src/settings/networkwidget.h63
-rw-r--r--src/settings/passexceptionswidget.cpp73
-rw-r--r--src/settings/passexceptionswidget.h53
-rw-r--r--src/settings/password_exceptions.ui55
-rw-r--r--src/settings/privacywidget.cpp135
-rw-r--r--src/settings/privacywidget.h67
-rw-r--r--src/settings/settings_advanced.ui172
-rw-r--r--src/settings/settings_appearance.ui284
-rw-r--r--src/settings/settings_general.ui267
-rw-r--r--src/settings/settings_privacy.ui260
-rw-r--r--src/settings/settings_tabs.ui290
-rw-r--r--src/settings/settings_webkit.ui200
-rw-r--r--src/settings/settingsdialog.cpp232
-rw-r--r--src/settings/settingsdialog.h63
-rw-r--r--src/settings/tabswidget.cpp52
-rw-r--r--src/settings/tabswidget.h58
-rw-r--r--src/settings/webkitwidget.cpp71
-rw-r--r--src/settings/webkitwidget.h60
-rw-r--r--src/sslinfo.ui392
-rw-r--r--src/sslinfodialog.cpp176
-rw-r--r--src/sslinfodialog.h79
-rw-r--r--src/sync/ftpsynchandler.cpp289
-rw-r--r--src/sync/ftpsynchandler.h82
-rw-r--r--src/sync/googlesynchandler.cpp437
-rw-r--r--src/sync/googlesynchandler.h86
-rw-r--r--src/sync/operasynchandler.cpp911
-rw-r--r--src/sync/operasynchandler.h134
-rw-r--r--src/sync/sync_check.ui149
-rw-r--r--src/sync/sync_data.ui76
-rw-r--r--src/sync/sync_ftp_settings.ui102
-rw-r--r--src/sync/sync_google_settings.ui83
-rw-r--r--src/sync/sync_host_type.ui62
-rw-r--r--src/sync/sync_opera_settings.ui83
-rw-r--r--src/sync/syncassistant.cpp52
-rw-r--r--src/sync/syncassistant.h53
-rw-r--r--src/sync/synccheckwidget.cpp201
-rw-r--r--src/sync/synccheckwidget.h53
-rw-r--r--src/sync/syncdatawidget.cpp86
-rw-r--r--src/sync/syncdatawidget.h54
-rw-r--r--src/sync/syncftpsettingswidget.cpp63
-rw-r--r--src/sync/syncftpsettingswidget.h51
-rw-r--r--src/sync/syncgooglesettingswidget.cpp61
-rw-r--r--src/sync/syncgooglesettingswidget.h52
-rw-r--r--src/sync/synchandler.cpp41
-rw-r--r--src/sync/synchandler.h61
-rw-r--r--src/sync/synchosttypewidget.cpp107
-rw-r--r--src/sync/synchosttypewidget.h63
-rw-r--r--src/sync/syncmanager.cpp170
-rw-r--r--src/sync/syncmanager.h67
-rw-r--r--src/sync/syncoperasettingswidget.cpp85
-rw-r--r--src/sync/syncoperasettingswidget.h52
-rw-r--r--src/tabbar.cpp568
-rw-r--r--src/tabbar.h135
-rw-r--r--src/tabhighlighteffect.cpp100
-rw-r--r--src/tabhighlighteffect.h58
-rw-r--r--src/tabpreviewpopup.cpp166
-rw-r--r--src/tabpreviewpopup.h73
-rw-r--r--src/tests/CMakeLists.txt183
-rw-r--r--src/tests/findbar_test.cpp80
-rw-r--r--src/tests/html/HTTP_tests.html601
-rw-r--r--src/tests/html/charset_ISO_8859_1.html12
-rw-r--r--src/tests/html/charset_NULL.html11
-rw-r--r--src/tests/html/charset_UTF_8.html12
-rw-r--r--src/tests/html/font_test.html24
-rw-r--r--src/tests/html/js_window_close.html3
-rw-r--r--src/tests/html/link_test.html165
-rw-r--r--src/tests/html/test_with_dark_colors.html7
-rw-r--r--src/tests/listitem_test.cpp95
-rw-r--r--src/tests/mainview_test.cpp418
-rw-r--r--src/tests/mainwindow_test.cpp70
-rw-r--r--src/tests/networkaccessmanager_test.cpp68
-rw-r--r--src/tests/protocolhandler_test.cpp131
-rw-r--r--src/tests/sessionmanager_test.cpp73
-rw-r--r--src/tests/tabbar_test.cpp152
-rw-r--r--src/tests/urlbar_test.cpp75
-rw-r--r--src/tests/walletbar_test.cpp70
-rw-r--r--src/tests/webpage_test.cpp112
-rw-r--r--src/tests/websnap_test.cpp69
-rw-r--r--src/tests/webtab_test.cpp69
-rw-r--r--src/tests/webview_test.cpp71
-rw-r--r--src/thumbupdater.cpp81
-rw-r--r--src/thumbupdater.h58
-rw-r--r--src/urlbar/bookmarkwidget.cpp383
-rw-r--r--src/urlbar/bookmarkwidget.h104
-rw-r--r--src/urlbar/completionwidget.cpp402
-rw-r--r--src/urlbar/completionwidget.h93
-rw-r--r--src/urlbar/favoritewidget.cpp115
-rw-r--r--src/urlbar/favoritewidget.h58
-rw-r--r--src/urlbar/listitem.cpp661
-rw-r--r--src/urlbar/listitem.h291
-rw-r--r--src/urlbar/newresourcedialog.cpp121
-rw-r--r--src/urlbar/newresourcedialog.h57
-rw-r--r--src/urlbar/resourcelinkdialog.cpp385
-rw-r--r--src/urlbar/resourcelinkdialog.h73
-rw-r--r--src/urlbar/rsswidget.cpp166
-rw-r--r--src/urlbar/rsswidget.h61
-rw-r--r--src/urlbar/sslwidget.cpp252
-rw-r--r--src/urlbar/sslwidget.h58
-rw-r--r--src/urlbar/stackedurlbar.cpp68
-rw-r--r--src/urlbar/stackedurlbar.h55
-rw-r--r--src/urlbar/urlbar.cpp773
-rw-r--r--src/urlbar/urlbar.h156
-rw-r--r--src/urlbar/urlresolver.cpp403
-rw-r--r--src/urlbar/urlresolver.h179
-rw-r--r--src/urlbar/webshortcutwidget.cpp163
-rw-r--r--src/urlbar/webshortcutwidget.h76
-rw-r--r--src/urlfilterproxymodel.cpp59
-rw-r--r--src/urlfilterproxymodel.h59
-rw-r--r--src/urlpanel.cpp110
-rw-r--r--src/urlpanel.h81
-rw-r--r--src/useragent/useragentinfo.cpp202
-rw-r--r--src/useragent/useragentinfo.h86
-rw-r--r--src/useragent/useragentmanager.cpp173
-rw-r--r--src/useragent/useragentmanager.h63
-rw-r--r--src/useragent/useragentsettings.ui69
-rw-r--r--src/useragent/useragentwidget.cpp96
-rw-r--r--src/useragent/useragentwidget.h53
-rw-r--r--src/walletbar.cpp103
-rw-r--r--src/walletbar.h66
-rw-r--r--src/webappcreation.ui96
-rw-r--r--src/webicon.cpp65
-rw-r--r--src/webicon.h56
-rw-r--r--src/webinspectorpanel.cpp86
-rw-r--r--src/webinspectorpanel.h62
-rw-r--r--src/webpage.cpp777
-rw-r--r--src/webpage.h114
-rw-r--r--src/webpluginfactory.cpp105
-rw-r--r--src/webpluginfactory.h65
-rw-r--r--src/websnap.cpp166
-rw-r--r--src/websnap.h124
-rw-r--r--src/websslinfo.cpp232
-rw-r--r--src/websslinfo.h78
-rw-r--r--src/webtab.cpp419
-rw-r--r--src/webtab.h131
-rw-r--r--src/webview.cpp1463
-rw-r--r--src/webview.h171
-rw-r--r--src/zoombar.cpp210
-rw-r--r--src/zoombar.h79
252 files changed, 0 insertions, 42404 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
deleted file mode 100644
index 75c1b0eb..00000000
--- a/src/CMakeLists.txt
+++ /dev/null
@@ -1,264 +0,0 @@
-### ------- sub dirs -------
-
-ADD_SUBDIRECTORY( data )
-ADD_SUBDIRECTORY( tests )
-
-
-### ------- SETTING REKONQ FILES..
-add_definitions(-DQT_STATICPLUGIN)
-QT4_WRAP_CPP(wk_HEADERS_MOC qwebkitplatformplugin.h)
-
-
-SET( rekonq_KDEINIT_SRCS
- application.cpp
- clicktoflash.cpp
- downloaditem.cpp
- downloadmanager.cpp
- findbar.cpp
- icondownloader.cpp
- iconmanager.cpp
- mainview.cpp
- mainwindow.cpp
- messagebar.cpp
- networkaccessmanager.cpp
- newtabpage.cpp
- paneltreeview.cpp
- previewselectorbar.cpp
- protocolhandler.cpp
- rekonqmenu.cpp
- searchenginebar.cpp
- sessionmanager.cpp
- sslinfodialog.cpp
- tabpreviewpopup.cpp
- tabbar.cpp
- tabhighlighteffect.cpp
- thumbupdater.cpp
- urlfilterproxymodel.cpp
- urlpanel.cpp
- walletbar.cpp
- webicon.cpp
- webinspectorpanel.cpp
- webpage.cpp
- webpluginfactory.cpp
- websslinfo.cpp
- websnap.cpp
- webview.cpp
- webtab.cpp
- zoombar.cpp
- #----------------------------------------
- history/autosaver.cpp
- history/historymanager.cpp
- history/historymodels.cpp
- history/historypanel.cpp
- #----------------------------------------
- settings/settingsdialog.cpp
- settings/appearancewidget.cpp
- settings/advancedwidget.cpp
- settings/generalwidget.cpp
- settings/privacywidget.cpp
- settings/tabswidget.cpp
- settings/webkitwidget.cpp
- settings/passexceptionswidget.cpp
- #----------------------------------------
- bookmarks/bookmarkmanager.cpp
- bookmarks/bookmarkspanel.cpp
- bookmarks/bookmarkstreemodel.cpp
- bookmarks/bookmarkscontextmenu.cpp
- bookmarks/bookmarkstoolbar.cpp
- bookmarks/bookmarkowner.cpp
- #----------------------------------------
- adblock/adblockhostmatcher.cpp
- adblock/adblockmanager.cpp
- adblock/adblocknetworkreply.cpp
- adblock/adblockrule.cpp
- adblock/adblockrulefallbackimpl.cpp
- adblock/adblockrulenullimpl.cpp
- adblock/adblockruletextmatchimpl.cpp
- adblock/adblockwidget.cpp
- adblock/blockedelementswidget.cpp
- #----------------------------------------
- urlbar/stackedurlbar.cpp
- urlbar/urlbar.cpp
- urlbar/completionwidget.cpp
- urlbar/urlresolver.cpp
- urlbar/listitem.cpp
- urlbar/rsswidget.cpp
- urlbar/sslwidget.cpp
- urlbar/bookmarkwidget.cpp
- urlbar/webshortcutwidget.cpp
- urlbar/favoritewidget.cpp
- #----------------------------------------
- analyzer/analyzerpanel.cpp
- analyzer/networkanalyzer.cpp
- #----------------------------------------
- opensearch/searchengine.cpp
- opensearch/opensearchwriter.cpp
- opensearch/opensearchreader.cpp
- opensearch/opensearchmanager.cpp
- opensearch/opensearchengine.cpp
- opensearch/suggestionparser.cpp
- #----------------------------------------
- useragent/useragentinfo.cpp
- useragent/useragentmanager.cpp
- useragent/useragentwidget.cpp
- #----------------------------------------
- sync/ftpsynchandler.cpp
- sync/googlesynchandler.cpp
- sync/syncassistant.cpp
- sync/synchandler.cpp
- sync/syncmanager.cpp
- #
- sync/synccheckwidget.cpp
- sync/syncdatawidget.cpp
- sync/synchosttypewidget.cpp
- sync/syncftpsettingswidget.cpp
- sync/syncgooglesettingswidget.cpp
- sync/syncoperasettingswidget.cpp
- #----------------------------
- kspellplugin.cpp
- ${wk_HEADERS_MOC}
-)
-
-# Nepomuk OPTIONAL src files
-IF(HAVE_NEPOMUK)
- SET( rekonq_KDEINIT_SRCS
- ${rekonq_KDEINIT_SRCS}
- urlbar/resourcelinkdialog.cpp
- urlbar/newresourcedialog.cpp
- )
-ENDIF(HAVE_NEPOMUK)
-
-
-# Opera sync optional src files
-IF(HAVE_QCA2 AND HAVE_QTOAUTH)
- SET( rekonq_KDEINIT_SRCS
- ${rekonq_KDEINIT_SRCS}
- sync/operasynchandler.cpp
- )
-ENDIF(HAVE_QCA2 AND HAVE_QTOAUTH)
-
-
-KDE4_ADD_UI_FILES( rekonq_KDEINIT_SRCS
- settings/settings_general.ui
- settings/settings_tabs.ui
- settings/settings_appearance.ui
- settings/settings_webkit.ui
- settings/settings_advanced.ui
- settings/settings_privacy.ui
- settings/password_exceptions.ui
- # ----------------------------------------
- adblock/settings_adblock.ui
- adblock/blocked_elements.ui
- # ----------------------------------------
- cleardata.ui
- sslinfo.ui
- webappcreation.ui
- useragent/useragentsettings.ui
- # ----------------------------------------
- sync/sync_check.ui
- sync/sync_data.ui
- sync/sync_ftp_settings.ui
- sync/sync_google_settings.ui
- sync/sync_opera_settings.ui
- sync/sync_host_type.ui
- )
-
-KDE4_ADD_KCFG_FILES( rekonq_KDEINIT_SRCS rekonq.kcfgc )
-
-IF(HAVE_NEPOMUK)
- INCLUDE(SopranoAddOntology)
-ENDIF(HAVE_NEPOMUK)
-
-### ------------- INCLUDING DIRECTORIES...
-
-INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_SOURCE_DIR}/adblock
- ${CMAKE_CURRENT_SOURCE_DIR}/analyzer
- ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks
- ${CMAKE_CURRENT_SOURCE_DIR}/history
- ${CMAKE_CURRENT_SOURCE_DIR}/opensearch
- ${CMAKE_CURRENT_SOURCE_DIR}/settings
- ${CMAKE_CURRENT_SOURCE_DIR}/sync
- ${CMAKE_CURRENT_SOURCE_DIR}/urlbar
- ${CMAKE_CURRENT_SOURCE_DIR}/useragent
- ${CMAKE_CURRENT_BINARY_DIR}
- ${KDE4_INCLUDES}
- ${QT4_INCLUDES}
-)
-
-# Nepomuk optional include directories
-IF(HAVE_NEPOMUK)
- INCLUDE_DIRECTORIES(${SOPRANO_INCLUDE_DIR}
- ${NEPOMUK_INCLUDE_DIR}
- )
-ENDIF(HAVE_NEPOMUK)
-
-# Opera sync optional include directories
-IF(HAVE_QCA2 AND HAVE_QTOAUTH)
- INCLUDE_DIRECTORIES(${QCA2_INCLUDE_DIR}
- ${QTOAUTH_INCLUDE_DIR}
- )
-ENDIF(HAVE_QCA2 AND HAVE_QTOAUTH)
-
-
-### -------------- ADDING DEFINITIONS...
-
-ADD_DEFINITIONS ( ${KDE4_DEFINITIONS} )
-
-
-### -------------- ADDING APPLICATION ICON...
-
-KDE4_ADD_APP_ICON( rekonq_KDEINIT_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/../icons/hi*-app-rekonq.png )
-
-
-### --------------- ADDING EXECUTABLE...
-
-KDE4_ADD_KDEINIT_EXECUTABLE( rekonq ${rekonq_KDEINIT_SRCS} main.cpp )
-
-
-### --------------- TARGETTING LINK LIBRARIES...
-
-TARGET_LINK_LIBRARIES ( kdeinit_rekonq
- ${QT_LIBRARIES}
- ${QT_QTSCRIPT_LIBRARY}
- ${QT_QTWEBKIT_LIBRARY}
- ${KDE4_KDEWEBKIT_LIBS}
- ${KDE4_KUTILS_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KIO_LIBS}
- ${KDE4_KPARTS_LIBS}
-)
-
-
-# Nepomuk optional target link libraries
-IF(HAVE_NEPOMUK)
- TARGET_LINK_LIBRARIES( kdeinit_rekonq
- ${NEPOMUK_LIBRARIES}
- ${NEPOMUK_QUERY_LIBRARIES}
- ${SOPRANO_LIBRARIES}
- )
-ENDIF(HAVE_NEPOMUK)
-
-# KActivities optional target link libraries
-IF(HAVE_KACTIVITIES)
- TARGET_LINK_LIBRARIES( kdeinit_rekonq
- ${KACTIVITIES_LIBRARY}
- )
-ENDIF(HAVE_KACTIVITIES)
-
-# Opera sync optional link libraries
-IF(HAVE_QCA2 AND HAVE_QTOAUTH)
- TARGET_LINK_LIBRARIES( kdeinit_rekonq
- ${QCA2_LIBRARY}
- ${QTOAUTH_LIBRARY}
- )
-ENDIF(HAVE_QCA2 AND HAVE_QTOAUTH)
-
-
-### ------------ INSTALL FILES...
-
-INSTALL( TARGETS rekonq ${INSTALL_TARGETS_DEFAULT_ARGS} )
-INSTALL( TARGETS kdeinit_rekonq ${INSTALL_TARGETS_DEFAULT_ARGS} )
-
-INSTALL( FILES rekonq.kcfg DESTINATION ${KCFG_INSTALL_DIR} )
-INSTALL( FILES rekonqui.rc DESTINATION ${DATA_INSTALL_DIR}/rekonq )
diff --git a/src/Messages.sh b/src/Messages.sh
deleted file mode 100644
index ccad97fc..00000000
--- a/src/Messages.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/sh
-$EXTRACTRC *.ui */*ui *.rc >> rc.cpp || exit 1
-$XGETTEXT *.cpp */*.cpp -o $podir/rekonq.pot
-rm -f rc.cpp
-
diff --git a/src/adblock/adblockhostmatcher.cpp b/src/adblock/adblockhostmatcher.cpp
deleted file mode 100644
index 021fe12d..00000000
--- a/src/adblock/adblockhostmatcher.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-// Self Includes
-#include "adblockhostmatcher.h"
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-bool AdBlockHostMatcher::tryAddFilter(const QString &filter)
-{
- if (filter.startsWith(QL1S("||")))
- {
-
- QString domain = filter.mid(2);
-
- if (!domain.endsWith(QL1C('^')))
- return false;
-
- if (domain.contains(QL1C('$')))
- return false;
-
- domain = domain.left(domain.size() - 1);
-
- if (domain.contains(QL1C('/')) || domain.contains(QL1C('*')) || domain.contains(QL1C('^')))
- return false;
-
- domain = domain.toLower();
- m_hostList.insert(domain);
- m_hostList.insert(QL1S("www.") + domain);
- return true;
- }
- return false;
-}
diff --git a/src/adblock/adblockhostmatcher.h b/src/adblock/adblockhostmatcher.h
deleted file mode 100644
index bdad883c..00000000
--- a/src/adblock/adblockhostmatcher.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-#ifndef ADBLOCKHOSTMATCHER_H
-#define ADBLOCKHOSTMATCHER_H
-
-#include <QSet>
-#include <QString>
-
-class AdBlockHostMatcher
-{
-public:
- // Try to add an adblock filter to this host matcher.
- // If the filter is not an hostname, the filter is not added
- // and the method return false;
- bool tryAddFilter(const QString &filter);
-
- bool match(const QString &host) const
- {
- return m_hostList.contains(host.toLower());
- }
-
- void clear()
- {
- m_hostList.clear();
- }
-
-private:
- QSet<QString> m_hostList;
-};
-
-#endif // ADBLOCKHOSTMATCHER_H
diff --git a/src/adblock/adblockmanager.cpp b/src/adblock/adblockmanager.cpp
deleted file mode 100644
index 73daef88..00000000
--- a/src/adblock/adblockmanager.cpp
+++ /dev/null
@@ -1,450 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "adblockmanager.h"
-#include "adblockmanager.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "adblocknetworkreply.h"
-#include "adblockwidget.h"
-#include "blockedelementswidget.h"
-
-#include "webpage.h"
-
-// KDE Includes
-#include <KIO/FileCopyJob>
-#include <KStandardDirs>
-
-// Qt Includes
-#include <QUrl>
-#include <QWebElement>
-#include <QNetworkReply>
-#include <QNetworkRequest>
-
-
-AdBlockManager::AdBlockManager(QObject *parent)
- : QObject(parent)
- , _isAdblockEnabled(false)
- , _isHideAdsEnabled(false)
-{
- loadSettings();
-}
-
-
-AdBlockManager::~AdBlockManager()
-{
- _whiteList.clear();
- _blackList.clear();
- _hideList.clear();
-}
-
-
-bool AdBlockManager::isEnabled()
-{
- return _isAdblockEnabled;
-}
-
-
-bool AdBlockManager::isHidingElements()
-{
- return _isHideAdsEnabled;
-}
-
-
-void AdBlockManager::loadSettings()
-{
- // first, check this...
- QString adblockFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrc"));
- if (!QFile::exists(adblockFilePath))
- {
- QString generalAdblockFilePath = KStandardDirs::locate("appdata" , QL1S("adblockrc"));
- QFile adblockFile(generalAdblockFilePath);
- bool copied = adblockFile.copy(adblockFilePath);
- if (!copied)
- {
- kDebug() << "oh oh... Problems copying default adblock file";
- return;
- }
- }
- _adblockConfig = KSharedConfig::openConfig("adblockrc", KConfig::SimpleConfig, "appdata");
- // ----------------
-
- _hostWhiteList.clear();
- _hostBlackList.clear();
-
- _whiteList.clear();
- _blackList.clear();
- _hideList.clear();
-
- KConfigGroup settingsGroup(_adblockConfig, "Settings");
- _isAdblockEnabled = settingsGroup.readEntry("adBlockEnabled", false);
-
- // no need to load filters if adblock is not enabled :)
- if (!_isAdblockEnabled)
- return;
-
- // just to be sure..
- _isHideAdsEnabled = settingsGroup.readEntry("hideAdsEnabled", false);
-
- // ----------------------------------------------------------
-
- QDateTime today = QDateTime::currentDateTime();
- QDateTime lastUpdate = QDateTime::fromString(settingsGroup.readEntry("lastUpdate", QString()));
- int days = settingsGroup.readEntry("updateInterval", 7);
-
- bool allSubscriptionsNeedUpdate = (today > lastUpdate.addDays(days));
- if (allSubscriptionsNeedUpdate)
- {
- settingsGroup.writeEntry("lastUpdate", today.toString());
- }
-
- // (Eventually) update and load automatic rules
- KConfigGroup filtersGroup(_adblockConfig, "FiltersList");
- for (int i = 0; i < 60; i++)
- {
- QString n = QString::number(i + 1);
- if (!filtersGroup.hasKey("FilterEnabled-" + n))
- continue;
-
- bool isFilterEnabled = filtersGroup.readEntry("FilterEnabled-" + n, false);
- if (!isFilterEnabled)
- continue;
-
- bool fileExists = subscriptionFileExists(i);
- if (allSubscriptionsNeedUpdate || !fileExists)
- {
- kDebug() << "FILE SHOULDN'T EXIST. updating subscription";
- updateSubscription(i);
- }
- else
- {
- QString rulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_") + n);
- loadRules(rulesFilePath);
- }
- }
-
- // load local rules
- QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_local"));
- loadRules(localRulesFilePath);
-}
-
-
-void AdBlockManager::loadRules(const QString &rulesFilePath)
-{
- QFile ruleFile(rulesFilePath);
- if (!ruleFile.open(QFile::ReadOnly | QFile::Text))
- {
- kDebug() << "Unable to open rule file" << rulesFilePath;
- return;
- }
-
- QTextStream in(&ruleFile);
- while (!in.atEnd())
- {
- QString stringRule = in.readLine();
- loadRuleString(stringRule);
- }
-}
-
-
-void AdBlockManager::loadRuleString(const QString &stringRule)
-{
- // ! rules are comments
- if (stringRule.startsWith('!'))
- return;
-
- // [ rules are ABP info
- if (stringRule.startsWith('['))
- return;
-
- // empty rules are just dangerous..
- // (an empty rule in whitelist allows all, in blacklist blocks all..)
- if (stringRule.isEmpty())
- return;
-
- // white rules
- if (stringRule.startsWith(QL1S("@@")))
- {
- const QString filter = stringRule.mid(2);
- if (_hostWhiteList.tryAddFilter(filter))
- return;
-
- AdBlockRule rule(filter);
- _whiteList << rule;
- return;
- }
-
- // hide (CSS) rules
- if (stringRule.startsWith(QL1S("##")))
- {
- _hideList << stringRule.mid(2);
- return;
- }
-
- // TODO implement domain-specific hiding
- if (stringRule.contains(QL1S("##")))
- return;
-
- if (_hostBlackList.tryAddFilter(stringRule))
- return;
-
- AdBlockRule rule(stringRule);
- _blackList << rule;
-}
-
-
-QNetworkReply *AdBlockManager::block(const QNetworkRequest &request, WebPage *page)
-{
- if (!_isAdblockEnabled)
- return 0;
-
- // we (ad)block just http traffic
- if (request.url().scheme() != QL1S("http"))
- return 0;
-
- QString urlString = request.url().toString();
- // We compute a lowercase version of the URL so each rule does not
- // have to do it.
- const QString urlStringLowerCase = urlString.toLower();
- const QString host = request.url().host();
-
- // check white rules before :)
- if (_hostWhiteList.match(host))
- {
- kDebug() << "ADBLOCK: WHITE RULE (@@) Matched by string: " << urlString;
- return 0;
- }
-
- Q_FOREACH(const AdBlockRule & filter, _whiteList)
- {
- if (filter.match(request, urlString, urlStringLowerCase))
- {
- kDebug() << "ADBLOCK: WHITE RULE (@@) Matched by string: " << urlString;
- return 0;
- }
- }
-
- // then check the black ones :(
- if (_hostBlackList.match(host))
- {
- kDebug() << "ADBLOCK: BLACK RULE Matched by string: " << urlString;
- AdBlockNetworkReply *reply = new AdBlockNetworkReply(request, urlString, this);
- _blockedElements << request.url().toString();
- page->setHasAdBlockedElements(true);
- return reply;
- }
-
- // get sure page is extant to perform elements check. bug:282012
- if (!page)
- return 0;
-
- Q_FOREACH(const AdBlockRule & filter, _blackList)
- {
- if (filter.match(request, urlString, urlStringLowerCase))
- {
- kDebug() << "ADBLOCK: BLACK RULE Matched by string: " << urlString;
-
- QWebElement document = page->mainFrame()->documentElement();
- QWebElementCollection elements = document.findAll("[src]");
- Q_FOREACH(QWebElement el, elements)
- {
- QString srcAttribute = el.attribute("src");
- if (srcAttribute.isEmpty())
- continue;
-
- srcAttribute = page->mainFrame()->baseUrl().resolved(srcAttribute).toString();
-
- if (filter.match(request, srcAttribute, srcAttribute.toLower()))
- {
- el.setStyleProperty(QL1S("visibility"), QL1S("hidden"));
- el.setStyleProperty(QL1S("width"), QL1S("0"));
- el.setStyleProperty(QL1S("height"), QL1S("0"));
- }
- }
-
- AdBlockNetworkReply *reply = new AdBlockNetworkReply(request, urlString, this);
- _blockedElements << request.url().toString();
- page->setHasAdBlockedElements(true);
- return reply;
- }
- }
-
- // no match
- return 0;
-}
-
-
-void AdBlockManager::applyHidingRules(WebPage *page)
-{
- if (!page)
- return;
-
- if (!_isAdblockEnabled)
- return;
-
- if (!_isHideAdsEnabled)
- return;
-
- QWebElement document = page->mainFrame()->documentElement();
-
- // HIDE RULES
- Q_FOREACH(const QString & filter, _hideList)
- {
- QWebElementCollection elements = document.findAll(filter);
-
- Q_FOREACH(QWebElement el, elements)
- {
- if (el.isNull())
- continue;
- kDebug() << "Hide element: " << el.localName();
- el.setStyleProperty(QL1S("visibility"), QL1S("hidden"));
- el.removeFromDocument();
- _hidedElements++;
- page->setHasAdBlockedElements(true);
- }
- }
-}
-
-
-void AdBlockManager::updateSubscription(int i)
-{
- KConfigGroup filtersGroup(_adblockConfig, "FiltersList");
- QString n = QString::number(i + 1);
-
- QString fUrl = filtersGroup.readEntry("FilterURL-" + n, QString());
- KUrl subUrl = KUrl(fUrl);
-
- QString rulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_") + n);
- KUrl destUrl = KUrl(rulesFilePath);
-
- KIO::FileCopyJob* job = KIO::file_copy(subUrl , destUrl, -1, KIO::HideProgressInfo);
- job->metaData().insert("ssl_no_client_cert", "TRUE");
- job->metaData().insert("ssl_no_ui", "TRUE");
- job->metaData().insert("UseCache", "false");
- job->metaData().insert("cookies", "none");
- job->metaData().insert("no-auth", "true");
-
- connect(job, SIGNAL(finished(KJob *)), this, SLOT(slotFinished(KJob *)));
-}
-
-
-void AdBlockManager::slotFinished(KJob *job)
-{
- if (job->error())
- return;
-
- KIO::FileCopyJob *fJob = qobject_cast<KIO::FileCopyJob *>(job);
- KUrl url = fJob->destUrl();
- url.setProtocol(QString()); // this is needed to load local url well :(
- loadRules(url.url());
-}
-
-
-bool AdBlockManager::subscriptionFileExists(int i)
-{
- QString n = QString::number(i + 1);
-
- QString rulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_") + n);
- return QFile::exists(rulesFilePath);
-}
-
-
-void AdBlockManager::showSettings()
-{
- QPointer<KDialog> dialog = new KDialog();
- dialog->setCaption(i18nc("@title:window", "Ad Block Settings"));
- dialog->setButtons(KDialog::Ok | KDialog::Cancel);
-
- AdBlockWidget widget(_adblockConfig);
- dialog->setMainWidget(&widget);
- connect(dialog, SIGNAL(okClicked()), &widget, SLOT(save()));
- connect(dialog, SIGNAL(okClicked()), this, SLOT(loadSettings()));
- dialog->exec();
-
- dialog->deleteLater();
-}
-
-
-void AdBlockManager::addCustomRule(const QString &stringRule, bool reloadPage)
-{
- // save rule in local filters
- QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_local"));
-
- QFile ruleFile(localRulesFilePath);
- if (!ruleFile.open(QFile::WriteOnly | QFile::Append))
- {
- kDebug() << "Unable to open rule file" << localRulesFilePath;
- return;
- }
-
- QTextStream out(&ruleFile);
- out << stringRule << '\n';
-
- ruleFile.close();
-
- // load it
- loadRuleString(stringRule);
-
- // eventually reload page
- if (reloadPage)
- emit reloadCurrentPage();
-}
-
-
-void AdBlockManager::showBlockedItemDialog()
-{
- QPointer<KDialog> dialog = new KDialog();
- dialog->setCaption(i18nc("@title:window", "Blocked elements"));
- dialog->setButtons(KDialog::Ok);
-
- BlockedElementsWidget widget(this);
- widget.setBlockedElements(_blockedElements);
- widget.setHidedElements(_hidedElements);
-
- dialog->setMainWidget(&widget);
- dialog->exec();
-
- Q_FOREACH(const QString & r, widget.rulesToAdd())
- {
- addCustomRule(r);
- }
-
- if (widget.pageNeedsReload())
- emit reloadCurrentPage();
-
- dialog->deleteLater();
-}
-
-
-void AdBlockManager::clearElementsLists()
-{
- _blockedElements.clear();
- _hidedElements = 0;
-}
diff --git a/src/adblock/adblockmanager.h b/src/adblock/adblockmanager.h
deleted file mode 100644
index fe92cf11..00000000
--- a/src/adblock/adblockmanager.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-
-#ifndef ADBLOCK_MANAGER_H
-#define ADBLOCK_MANAGER_H
-
-
-// NOTE: AdBlockPlus Filters (fast) summary
-//
-// ### Basic Filter rules
-//
-// RULE = http://example.com/ads/*
-// this should block every link containing all things from that link
-//
-// ### Exception rules (@@)
-//
-// RULE = @@advice*
-//
-// this will save every site, also that matched by other rules, cointaining words
-// that starts with "advice". Wildcards && regular expression allowed here.
-//
-// ### Beginning/end matching rules (||)
-//
-// RULE=||http://badsite.com
-//
-// will stop all links starting with http://badsite.com
-//
-// RULE=*swf||
-//
-// will stop all links to direct flash contents
-//
-// ### Comments (!)
-//
-// RULE=!azz..
-//
-// Every rule starting with a ! is commented out and should not be checked
-//
-// ### Filter Options
-//
-// There are 3 kind of filter options:
-//
-// --- ### TYPE OPTIONS
-//
-// You can also specify a number of options to modify the behavior of a filter.
-// You list these options separated with commas after a dollar sign ($) at the end of the filter
-//
-// RULE=*/ads/*$element,match-case
-//
-// where $element can be one of the following:
-// $script external scripts loaded via HTML script tag
-// $image regular images, typically loaded via HTML img tag
-// $background background images, often specified via CSS
-// $stylesheet external CSS stylesheet files
-// $object content handled by browser plugins, e.g. Flash or Java
-// $xbl XBL bindings (typically loaded by -moz-binding CSS property) Firefox 3 or higher required
-// $ping link pings Firefox 3 or higher required
-// $xmlhttprequest requests started by the XMLHttpRequest object Firefox 3 or higher required
-// $object-subrequest requests started plugins like Flash Firefox 3 or higher required
-// $dtd DTD files loaded by XML documents Firefox 3 or higher required
-// $subdocument embedded pages, usually included via HTML frames
-// $document the page itself (only exception rules can be applied to the page)
-// $other types of requests not covered in the list above
-//
-//
-// --- ### INVERSE TYPE OPTIONS
-//
-// Inverse type options are allowed through the ~ sign, for example:
-//
-// RULE=*/ads/*~$script,match-case
-//
-//
-// --- ### THIRD-PARTY OPTIONS
-//
-// If "third-party" option is specified, filter is applied just to requests coming from a different
-// origin than the currently viewed page.
-// In the same way, the "~third-party" option restricts the filter to the requests coming from the
-// same origin as the currently viewed page.
-//
-//
-// ### Regular expressions
-//
-// They usually allow to check for (a lot of) sites, using just one rule, but be careful:
-// BASIC FILTERS ARE PROCESSED FASTER THAN REGULAR EXPRESSIONS
-// (That's true at least in ABP! In rekonq, I don't know...)
-//
-//
-// ### ELEMENT HIDING (##)
-//
-// This is quite different from usual adblock (but, for me, more powerful!). Sometimes you will find advertisements
-// that can’t be blocked because they are embedded as text in the web page itself.
-// All you can do there is HIDE the element :)
-//
-// RULE=##div.advise
-//
-// The previous rule will hide every div whose class is named "advise". Usual CSS selectors apply here :)
-//
-// END NOTE ----------------------------------------------------------------------------------------------------------
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "adblockhostmatcher.h"
-#include "adblockrule.h"
-
-// KDE Includes
-#include <KIO/Job>
-#include <KSharedConfig>
-
-// Qt Includes
-#include <QObject>
-#include <QStringList>
-#include <QByteArray>
-
-// Forward Includes
-class QNetworkReply;
-class QNetworkRequest;
-class WebPage;
-
-// Definitions
-typedef QList<AdBlockRule> AdBlockRuleList;
-
-
-class REKONQ_TESTS_EXPORT AdBlockManager : public QObject
-{
- Q_OBJECT
-
-public:
- AdBlockManager(QObject *parent = 0);
- ~AdBlockManager();
-
- bool isEnabled();
- bool isHidingElements();
-
- QNetworkReply *block(const QNetworkRequest &request, WebPage *page);
- void applyHidingRules(WebPage *page);
-
- void addCustomRule(const QString &, bool reloadPage = true);
- void clearElementsLists();
-
-private:
- void updateSubscription(int);
- bool subscriptionFileExists(int);
-
- // load a file rule, given a path
- void loadRules(const QString &rulesFilePath);
-
- // load a single rule
- void loadRuleString(const QString &stringRule);
-
-private Q_SLOTS:
- void loadSettings();
- void showSettings();
- void showBlockedItemDialog();
-
- void slotFinished(KJob *);
-
-Q_SIGNALS:
- void reloadCurrentPage();
-
-private:
- bool _isAdblockEnabled;
- bool _isHideAdsEnabled;
-
- AdBlockHostMatcher _hostBlackList;
- AdBlockHostMatcher _hostWhiteList;
- AdBlockRuleList _blackList;
- AdBlockRuleList _whiteList;
- QStringList _hideList;
-
- QStringList _blockedElements;
- int _hidedElements;
-
- KSharedConfig::Ptr _adblockConfig;
-};
-
-#endif
diff --git a/src/adblock/adblocknetworkreply.cpp b/src/adblock/adblocknetworkreply.cpp
deleted file mode 100644
index 5a5e9d8b..00000000
--- a/src/adblock/adblocknetworkreply.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ============================================================
- *
- * This file is a part of the rekonq project
- *
- * Copyright (c) 2009 by Benjamin C. Meyer <ben@meyerhome.net>
- * Copyright (C) 2010 by Andrea Diamantini <adjam7 at gmail dot com>
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * ============================================================ */
-
-
-// Self Includes
-#include "adblocknetworkreply.h"
-#include "adblocknetworkreply.moc"
-
-// KDE Includes
-#include <klocalizedstring.h>
-
-// Qt Includes
-#include <QtCore/QTimer>
-#include <QtCore/QString>
-
-#include <QtNetwork/QNetworkRequest>
-
-
-AdBlockNetworkReply::AdBlockNetworkReply(const QNetworkRequest &request, const QString &urlString, QObject *parent)
- : QNetworkReply(parent)
-{
- setOperation(QNetworkAccessManager::GetOperation);
- setRequest(request);
- setUrl(request.url());
- setError(QNetworkReply::ContentAccessDenied, i18n("Blocked by AdBlockRule: %1", urlString));
- QTimer::singleShot(0, this, SLOT(delayedFinished()));
-}
-
-
-void AdBlockNetworkReply::abort()
-{
-}
-
-
-qint64 AdBlockNetworkReply::readData(char *data, qint64 maxSize)
-{
- Q_UNUSED(data);
- Q_UNUSED(maxSize);
- return -1;
-}
-
-
-void AdBlockNetworkReply::delayedFinished()
-{
- emit error(QNetworkReply::ContentAccessDenied);
- emit finished();
-}
diff --git a/src/adblock/adblocknetworkreply.h b/src/adblock/adblocknetworkreply.h
deleted file mode 100644
index f85868b8..00000000
--- a/src/adblock/adblocknetworkreply.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ============================================================
- *
- * This file is a part of the rekonq project
- *
- * Copyright (c) 2009 by Benjamin C. Meyer <ben@meyerhome.net>
- * Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * ============================================================ */
-
-
-#ifndef ADBLOCK_NETWORK_REPLY_H
-#define ADBLOCK_NETWORK_REPLY_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QNetworkReply>
-
-// Forward Declarations
-class QString;
-
-
-class REKONQ_TESTS_EXPORT AdBlockNetworkReply : public QNetworkReply
-{
- Q_OBJECT
-
-public:
- AdBlockNetworkReply(const QNetworkRequest &request, const QString &urlString, QObject *parent = 0);
- void abort();
-
-protected:
- qint64 readData(char *data, qint64 maxSize);
-
-private Q_SLOTS:
- void delayedFinished();
-
-};
-
-#endif // ADBLOCKBLOCKEDNETWORKREPLY_H
diff --git a/src/adblock/adblockrule.cpp b/src/adblock/adblockrule.cpp
deleted file mode 100644
index d65c340d..00000000
--- a/src/adblock/adblockrule.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ============================================================
- *
- * This file is a part of the rekonq project
- *
- * Copyright (c) 2009 by Zsombor Gegesy <gzsombor@gmail.com>
- * Copyright (c) 2009 by Benjamin C. Meyer <ben@meyerhome.net>
- * Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * ============================================================ */
-
-
-// Self Includes
-#include "adblockrule.h"
-
-// Local Includes
-#include "adblockrulefallbackimpl.h"
-#include "adblockrulenullimpl.h"
-#include "adblockruletextmatchimpl.h"
-
-
-AdBlockRule::AdBlockRule(const QString &filter)
-{
- switch (AdBlockRule::ruleType(filter))
- {
- case TextRule:
- m_implementation = QSharedPointer<AdBlockRuleImpl>(new AdBlockRuleTextMatchImpl(filter));
- break;
-
- case FallbackRule:
- m_implementation = QSharedPointer<AdBlockRuleImpl>(new AdBlockRuleFallbackImpl(filter));
- break;
-
- case NullRule:
- default:
- m_implementation = QSharedPointer<AdBlockRuleImpl>(new AdBlockRuleNullImpl(filter));
- break;
- }
-}
-
-
-RuleTypes AdBlockRule::ruleType(const QString &filter)
-{
- if (AdBlockRuleTextMatchImpl::isTextMatchFilter(filter))
- return TextRule;
-
- if (AdBlockRuleNullImpl::isNullFilter(filter))
- return NullRule;
-
- return FallbackRule;
-}
diff --git a/src/adblock/adblockrule.h b/src/adblock/adblockrule.h
deleted file mode 100644
index 15dea344..00000000
--- a/src/adblock/adblockrule.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * This file is a part of the rekonq project
- *
- * Copyright (c) 2009 by Benjamin C. Meyer <ben@meyerhome.net>
- * Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * ============================================================ */
-
-
-#ifndef ADBLOCKRULE_H
-#define ADBLOCKRULE_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-#include "adblockruleimpl.h"
-
-#include <QSharedPointer>
-
-// Forward Includes
-class QNetworkRequest;
-class QString;
-
-
-enum RuleTypes
-{
- TextRule,
- FallbackRule,
- NullRule
-};
-
-
-class AdBlockRule
-{
-public:
- AdBlockRule(const QString &filter);
-
- bool match(const QNetworkRequest &request, const QString &encodedUrl, const QString &encodedUrlLowerCase) const
- {
- Q_ASSERT(encodedUrl.toLower() == encodedUrlLowerCase);
- bool b = m_implementation->match(request, encodedUrl, encodedUrlLowerCase);
- if (b)
- {
- kDebug() << m_implementation->ruleType() << ": rule string = " << m_implementation->ruleString();
- }
- return b;
- }
-
- static RuleTypes ruleType(const QString &filter);
-
-private:
- QSharedPointer<AdBlockRuleImpl> m_implementation;
-};
-
-
-#endif // ADBLOCKRULE_H
diff --git a/src/adblock/adblockrulefallbackimpl.cpp b/src/adblock/adblockrulefallbackimpl.cpp
deleted file mode 100644
index b547beb0..00000000
--- a/src/adblock/adblockrulefallbackimpl.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com>
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "adblockrulefallbackimpl.h"
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QWebFrame>
-#include <QNetworkReply>
-#include <QStringList>
-
-
-
-static inline bool isRegExpFilter(const QString &filter)
-{
- return filter.startsWith(QL1C('/')) && filter.endsWith(QL1C('/'));
-}
-
-
-AdBlockRuleFallbackImpl::AdBlockRuleFallbackImpl(const QString &filter)
- : AdBlockRuleImpl(filter)
- , m_thirdPartyOption(false)
-{
- m_regExp.setCaseSensitivity(Qt::CaseInsensitive);
- m_regExp.setPatternSyntax(QRegExp::RegExp2);
-
- QString parsedLine = filter;
-
- const int optionsNumber = parsedLine.lastIndexOf(QL1C('$'));
- if (optionsNumber >= 0 && !isRegExpFilter(parsedLine))
- {
- const QStringList options(parsedLine.mid(optionsNumber + 1).split(QL1C(',')));
- parsedLine = parsedLine.left(optionsNumber);
-
- if (options.contains(QL1S("match-case")))
- m_regExp.setCaseSensitivity(Qt::CaseSensitive);
-
- if (options.contains(QL1S("third-party")))
- m_thirdPartyOption = true;
-
- Q_FOREACH(const QString & option, options)
- {
- // Domain restricted filter
- const QString domainKeyword(QL1S("domain="));
- if (option.startsWith(domainKeyword))
- {
- QStringList domainList = option.mid(domainKeyword.length()).split(QL1C('|'));
- Q_FOREACH(const QString & domain, domainList)
- {
- if (domain.startsWith(QL1C('~')))
- m_whiteDomains.insert(domain.toLower());
- else
- m_blackDomains.insert(domain.toLower());
- }
- }
- }
- }
-
- if (isRegExpFilter(parsedLine))
- parsedLine = parsedLine.mid(1, parsedLine.length() - 2);
- else
- parsedLine = convertPatternToRegExp(parsedLine);
-
- m_regExp.setPattern(parsedLine);
-}
-
-
-bool AdBlockRuleFallbackImpl::match(const QNetworkRequest &request, const QString &encodedUrl, const QString &) const
-{
- if (m_thirdPartyOption)
- {
- const QString referer = request.rawHeader("referer");
- const QString host = request.url().host();
-
- if (referer.contains(host)) // is NOT third party
- return false;
- }
-
- const bool regexpMatch = m_regExp.indexIn(encodedUrl) != -1;
-
- if (regexpMatch && (!m_whiteDomains.isEmpty() || !m_blackDomains.isEmpty()))
- {
- Q_ASSERT(qobject_cast<QWebFrame*>(request.originatingObject()));
- const QWebFrame *const origin = static_cast<QWebFrame * const>(request.originatingObject());
-
- const QString originDomain = origin->url().host();
-
- if (!m_whiteDomains.isEmpty())
- {
- // In this context, white domains means we block anything but what is in the list.
- if (m_whiteDomains.contains(originDomain))
- return false;
- return true;
- }
- else if (m_blackDomains.contains(originDomain))
- {
- return true;
- }
- return false;
- }
- return regexpMatch;
-}
-
-
-QString AdBlockRuleFallbackImpl::convertPatternToRegExp(const QString &wildcardPattern)
-{
- QString pattern = wildcardPattern;
-
- // remove multiple wildcards
- pattern.replace(QRegExp(QL1S("\\*+")), QL1S("*"));
-
- // remove anchors following separator placeholder
- pattern.replace(QRegExp(QL1S("\\^\\|$")), QL1S("^"));
-
- // remove leading wildcards
- pattern.replace(QRegExp(QL1S("^(\\*)")), QL1S(""));
-
- // remove trailing wildcards
- pattern.replace(QRegExp(QL1S("(\\*)$")), QL1S(""));
-
- // escape special symbols
- pattern.replace(QRegExp(QL1S("(\\W)")), QL1S("\\\\1"));
-
- // process extended anchor at expression start
- pattern.replace(QRegExp(QL1S("^\\\\\\|\\\\\\|")), QL1S("^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?"));
-
- // process separator placeholders
- pattern.replace(QRegExp(QL1S("\\\\\\^")), QL1S("(?:[^\\w\\d\\-.%]|$)"));
-
- // process anchor at expression start
- pattern.replace(QRegExp(QL1S("^\\\\\\|")), QL1S("^"));
-
- // process anchor at expression end
- pattern.replace(QRegExp(QL1S("\\\\\\|$")), QL1S("$"));
-
- // replace wildcards by .*
- pattern.replace(QRegExp(QL1S("\\\\\\*")), QL1S(".*"));
-
- // Finally, return...
- return pattern;
-}
-
-
-QString AdBlockRuleFallbackImpl::ruleString() const
-{
- return m_regExp.pattern();
-}
-
-
-QString AdBlockRuleFallbackImpl::ruleType() const
-{
- return QL1S("AdBlockRuleFallbackImpl");
-}
diff --git a/src/adblock/adblockrulefallbackimpl.h b/src/adblock/adblockrulefallbackimpl.h
deleted file mode 100644
index 4b5716f8..00000000
--- a/src/adblock/adblockrulefallbackimpl.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com>
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-#ifndef ADBLOCKRULEFALLBACKIMPL_H
-#define ADBLOCKRULEFALLBACKIMPL_H
-
-#include "adblockruleimpl.h"
-
-// Qt Includes
-#include <QRegExp>
-#include <QString>
-#include <QSet>
-
-class AdBlockRuleFallbackImpl : public AdBlockRuleImpl
-{
-public:
- AdBlockRuleFallbackImpl(const QString &filter);
- bool match(const QNetworkRequest &request, const QString &encodedUrl, const QString &encodedUrlLowerCase) const;
-
- QString ruleString() const;
- QString ruleType() const;
-
-private:
- QString convertPatternToRegExp(const QString &wildcardPattern);
-
- QRegExp m_regExp;
- QSet<QString> m_whiteDomains;
- QSet<QString> m_blackDomains;
-
- bool m_thirdPartyOption;
-};
-
-#endif // ADBLOCKRULEFALLBACKIMPL_H
diff --git a/src/adblock/adblockruleimpl.h b/src/adblock/adblockruleimpl.h
deleted file mode 100644
index f1d428d5..00000000
--- a/src/adblock/adblockruleimpl.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-#ifndef ADBLOCKRULEIMPL_H
-#define ADBLOCKRULEIMPL_H
-
-class QString;
-class QNetworkRequest;
-
-class AdBlockRuleImpl
-{
-public:
- AdBlockRuleImpl(const QString &) {}
- virtual ~AdBlockRuleImpl() {}
- virtual bool match(const QNetworkRequest &request, const QString &encodedUrl, const QString &encodedUrlLowerCase) const = 0;
-
- // This are added just for debugging purposes
- virtual QString ruleString() const = 0;
- virtual QString ruleType() const = 0;
-};
-
-#endif // ADBLOCKRULEIMPL_H
diff --git a/src/adblock/adblockrulenullimpl.cpp b/src/adblock/adblockrulenullimpl.cpp
deleted file mode 100644
index e16b56db..00000000
--- a/src/adblock/adblockrulenullimpl.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "adblockrulenullimpl.h"
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QStringList>
-
-
-AdBlockRuleNullImpl::AdBlockRuleNullImpl(const QString &filter)
- : AdBlockRuleImpl(filter)
-{
-}
-
-
-bool AdBlockRuleNullImpl::match(const QNetworkRequest &, const QString &, const QString &) const
-{
- return false;
-}
-
-
-bool AdBlockRuleNullImpl::isNullFilter(const QString &filter)
-{
- QString parsedLine = filter;
-
- const int optionsNumber = parsedLine.lastIndexOf(QL1C('$'));
- if (optionsNumber == 0)
- return false;
-
- const QStringList options(parsedLine.mid(optionsNumber + 1).split(QL1C(',')));
-
- Q_FOREACH(const QString & option, options)
- {
- // NOTE:
- // I moved the check from option == QL1S to option.endsWith()
- // to check option && ~option. Hope it will NOT be a problem...
-
- // third_party: managed inside adblockrulefallbackimpl
- if (option.endsWith(QL1S("third-party")))
- return false;
-
- // script
- if (option.endsWith(QL1S("script")))
- return true;
-
- // image
- if (option.endsWith(QL1S("image")))
- return true;
-
- // background
- if (option.endsWith(QL1S("background")))
- return true;
-
- // stylesheet
- if (option.endsWith(QL1S("stylesheet")))
- return true;
-
- // object
- if (option.endsWith(QL1S("object")))
- return true;
-
- // xbl
- if (option.endsWith(QL1S("xbl")))
- return true;
-
- // ping
- if (option.endsWith(QL1S("ping")))
- return true;
-
- // xmlhttprequest
- if (option.endsWith(QL1S("xmlhttprequest")))
- return true;
-
- // object_subrequest
- if (option.endsWith(QL1S("object-subrequest")))
- return true;
-
- // dtd
- if (option.endsWith(QL1S("dtd")))
- return true;
-
- // subdocument
- if (option.endsWith(QL1S("subdocument")))
- return true;
-
- // document
- if (option.endsWith(QL1S("document")))
- return true;
-
- // other
- if (option.endsWith(QL1S("other")))
- return true;
-
- // collapse
- if (option.endsWith(QL1S("collapse")))
- return true;
- }
-
- return false;
-}
-
-
-QString AdBlockRuleNullImpl::ruleString() const
-{
- return QString();
-}
-
-
-QString AdBlockRuleNullImpl::ruleType() const
-{
- return QL1S("AdBlockRuleNullImpl");
-}
diff --git a/src/adblock/adblockrulenullimpl.h b/src/adblock/adblockrulenullimpl.h
deleted file mode 100644
index a8f69652..00000000
--- a/src/adblock/adblockrulenullimpl.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef ADBLOCKRULE_NULL_IMPL_H
-#define ADBLOCKRULE_NULL_IMPL_H
-
-
-// Local Includes
-#include "adblockruleimpl.h"
-
-// Qt Includes
-#include <QString>
-
-
-class AdBlockRuleNullImpl : public AdBlockRuleImpl
-{
-
-public:
- AdBlockRuleNullImpl(const QString &filter);
- bool match(const QNetworkRequest &, const QString &, const QString &) const;
-
- static bool isNullFilter(const QString &filter);
-
- QString ruleString() const;
- QString ruleType() const;
-};
-
-#endif // ADBLOCKRULE_NULL_IMPL_H
diff --git a/src/adblock/adblockruletextmatchimpl.cpp b/src/adblock/adblockruletextmatchimpl.cpp
deleted file mode 100644
index fd901e9c..00000000
--- a/src/adblock/adblockruletextmatchimpl.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "adblockruletextmatchimpl.h"
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QNetworkRequest>
-
-
-AdBlockRuleTextMatchImpl::AdBlockRuleTextMatchImpl(const QString &filter)
- : AdBlockRuleImpl(filter)
-{
- Q_ASSERT(AdBlockRuleTextMatchImpl::isTextMatchFilter(filter));
-
- m_textToMatch = filter.toLower();
- m_textToMatch.remove(QL1C('*'));
-}
-
-
-bool AdBlockRuleTextMatchImpl::match(const QNetworkRequest &request, const QString &encodedUrl, const QString &encodedUrlLowerCase) const
-{
- Q_UNUSED(request);
- Q_UNUSED(encodedUrl);
- // Case sensitive compare is faster, but would be incorrect with encodedUrl since
- // we do want case insensitive.
- // What we do is work on a lowercase version of m_textToMatch, and compare to the lowercase
- // version of encodedUrl.
- return encodedUrlLowerCase.contains(m_textToMatch, Qt::CaseSensitive);
-}
-
-
-bool AdBlockRuleTextMatchImpl::isTextMatchFilter(const QString &filter)
-{
- // We don't deal with options just yet
- if (filter.contains(QL1C('$')))
- return false;
-
- // We don't deal with element matching
- if (filter.contains(QL1S("##")))
- return false;
-
- // We don't deal with the begin-end matching
- if (filter.startsWith(QL1C('|')) || filter.endsWith(QL1C('|')))
- return false;
-
- // We only handle * at the beginning or the end
- int starPosition = filter.indexOf(QL1C('*'));
- while (starPosition >= 0)
- {
- if (starPosition != 0 && starPosition != (filter.length() - 1))
- return false;
- starPosition = filter.indexOf(QL1C('*'), starPosition + 1);
- }
- return true;
-}
-
-
-QString AdBlockRuleTextMatchImpl::ruleString() const
-{
- return m_textToMatch;
-}
-
-
-QString AdBlockRuleTextMatchImpl::ruleType() const
-{
- return QL1S("AdBlockRuleTextMatchImpl");
-}
diff --git a/src/adblock/adblockruletextmatchimpl.h b/src/adblock/adblockruletextmatchimpl.h
deleted file mode 100644
index 8600543d..00000000
--- a/src/adblock/adblockruletextmatchimpl.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Benjamin Poulain <ikipou at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef ADBLOCKRULETEXTMATCHIMPL_H
-#define ADBLOCKRULETEXTMATCHIMPL_H
-
-#include "adblockruleimpl.h"
-
-// Qt Includes
-#include <QString>
-
-
-// Simple rule to find a string in the URL
-class AdBlockRuleTextMatchImpl : public AdBlockRuleImpl
-{
-public:
- AdBlockRuleTextMatchImpl(const QString &filter);
- bool match(const QNetworkRequest &request, const QString &encodedUrl, const QString &encodedUrlLowerCase) const;
-
- static bool isTextMatchFilter(const QString &filter);
-
- QString ruleString() const;
- QString ruleType() const;
-
-private:
- QString m_textToMatch;
-};
-
-#endif // ADBLOCKRULETEXTMATCHIMPL_H
diff --git a/src/adblock/adblockwidget.cpp b/src/adblock/adblockwidget.cpp
deleted file mode 100644
index 5ada506e..00000000
--- a/src/adblock/adblockwidget.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "adblockwidget.h"
-#include "adblockwidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// KDE Includes
-#include <KSharedConfig>
-#include <KStandardDirs>
-#include <KIcon>
-
-// Qt Includes
-#include <QString>
-#include <QWhatsThis>
-#include <QListWidgetItem>
-
-
-AdBlockWidget::AdBlockWidget(KSharedConfig::Ptr config, QWidget *parent)
- : QWidget(parent)
- , _changed(false)
- , _adblockConfig(config)
-{
- setupUi(this);
-
- hintLabel->setText(i18n("<qt>Filter expression (e.g. <tt>http://www.example.com/ad/*</tt>, <a href=\"filterhelp\">more information</a>):"));
- connect(hintLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotInfoLinkActivated(QString)));
-
- manualFiltersListWidget->setSortingEnabled(true);
- manualFiltersListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
-
- searchLine->setListWidget(manualFiltersListWidget);
-
- insertButton->setIcon(KIcon("list-add"));
- connect(insertButton, SIGNAL(clicked()), this, SLOT(insertRule()));
-
- removeButton->setIcon(KIcon("list-remove"));
- connect(removeButton, SIGNAL(clicked()), this, SLOT(removeRule()));
-
- load();
-
- spinBox->setSuffix(ki18np(" day", " days"));
-
- // emit changed signal
- connect(insertButton, SIGNAL(clicked()), this, SLOT(hasChanged()));
- connect(removeButton, SIGNAL(clicked()), this, SLOT(hasChanged()));
- connect(checkEnableAdblock, SIGNAL(stateChanged(int)), this, SLOT(hasChanged()));
- connect(checkHideAds, SIGNAL(stateChanged(int)), this, SLOT(hasChanged()));
- connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(hasChanged()));
-
- connect(automaticFiltersListWidget, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(hasChanged()));
-}
-
-
-void AdBlockWidget::slotInfoLinkActivated(const QString &url)
-{
- Q_UNUSED(url)
-
- QString hintHelpString = i18n("<qt><p>Enter an expression to filter. Filters can be defined as either:"
- "<ul><li>a shell-style wildcard, e.g. <tt>http://www.example.com/ads*</tt>, "
- "the wildcards <tt>*?[]</tt> may be used</li>"
- "<li>a full regular expression by surrounding the string with '<tt>/</tt>', "
- "e.g. <tt>/\\/(ad|banner)\\./</tt></li></ul>"
- "<p>Any filter string can be preceded by '<tt>@@</tt>' to whitelist (allow) any matching URL, "
- "which takes priority over any blacklist (blocking) filter.");
-
- QWhatsThis::showText(QCursor::pos(), hintHelpString);
-}
-
-
-void AdBlockWidget::insertRule()
-{
- QString rule = addFilterLineEdit->text();
- if (rule.isEmpty())
- return;
-
- manualFiltersListWidget->addItem(rule);
- addFilterLineEdit->clear();
-}
-
-
-void AdBlockWidget::removeRule()
-{
- manualFiltersListWidget->takeItem(manualFiltersListWidget->currentRow());
-}
-
-
-void AdBlockWidget::load()
-{
- // General settings
- KConfigGroup settingsGroup(_adblockConfig, "Settings");
-
- const bool isAdBlockEnabled = settingsGroup.readEntry("adBlockEnabled", false);
- checkEnableAdblock->setChecked(isAdBlockEnabled);
-
- // update enabled status
- checkHideAds->setEnabled(isAdBlockEnabled);
- tabWidget->setEnabled(isAdBlockEnabled);
-
- const bool areImageFiltered = settingsGroup.readEntry("hideAdsEnabled", false);
- checkHideAds->setChecked(areImageFiltered);
-
- const int days = settingsGroup.readEntry("updateInterval", 7);
- spinBox->setValue(days);
-
- // ------------------------------------------------------------------------------
-
- // automatic filters
- KConfigGroup autoFiltersGroup(_adblockConfig, "FiltersList");
-
- int i = 1;
- QString n = QString::number(i);
-
- while (autoFiltersGroup.hasKey("FilterName-" + n))
- {
- bool filterEnabled = autoFiltersGroup.readEntry("FilterEnabled-" + n, false);
- QString filterName = autoFiltersGroup.readEntry("FilterName-" + n, QString());
-
- QListWidgetItem *subItem = new QListWidgetItem(automaticFiltersListWidget);
- subItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
- if (filterEnabled)
- subItem->setCheckState(Qt::Checked);
- else
- subItem->setCheckState(Qt::Unchecked);
-
- subItem->setText(filterName);
-
- i++;
- n = QString::number(i);
- }
-
- // ------------------------------------------------------------------------------
-
- // local filters
- QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_local"));
-
- QFile ruleFile(localRulesFilePath);
- if (!ruleFile.open(QFile::ReadOnly | QFile::Text))
- {
- kDebug() << "Unable to open rule file" << localRulesFilePath;
- return;
- }
-
- QTextStream in(&ruleFile);
- while (!in.atEnd())
- {
- QString stringRule = in.readLine();
- QListWidgetItem *subItem = new QListWidgetItem(manualFiltersListWidget);
- subItem->setText(stringRule);
- }
-}
-
-
-void AdBlockWidget::save()
-{
- if (!_changed)
- return;
-
- // General settings
- KConfigGroup settingsGroup(_adblockConfig, "Settings");
-
- settingsGroup.writeEntry("adBlockEnabled", checkEnableAdblock->isChecked());
- settingsGroup.writeEntry("hideAdsEnabled", checkHideAds->isChecked());
- settingsGroup.writeEntry("updateInterval", spinBox->value());
-
- // automatic filters
- KConfigGroup autoFiltersGroup(_adblockConfig, "FiltersList");
- for (int i = 0; i < automaticFiltersListWidget->count(); i++)
- {
- QListWidgetItem *subItem = automaticFiltersListWidget->item(i);
- bool active = true;
- if (subItem->checkState() == Qt::Unchecked)
- active = false;
-
- QString n = QString::number(i + 1);
- autoFiltersGroup.writeEntry("FilterEnabled-" + n, active);
- }
-
- // local filters
- QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QL1S("adblockrules_local"));
-
- QFile ruleFile(localRulesFilePath);
- if (!ruleFile.open(QFile::WriteOnly | QFile::Text))
- {
- kDebug() << "Unable to open rule file" << localRulesFilePath;
- return;
- }
-
- QTextStream out(&ruleFile);
- for (int i = 0; i < manualFiltersListWidget->count(); i++)
- {
- QListWidgetItem *subItem = manualFiltersListWidget->item(i);
- QString stringRule = subItem->text();
- out << stringRule << '\n';
- }
-
- // -------------------------------------------------------------------------------
- _changed = false;
- emit changed(false);
-}
-
-
-void AdBlockWidget::hasChanged()
-{
- // update enabled status
- checkHideAds->setEnabled(checkEnableAdblock->isChecked());
- tabWidget->setEnabled(checkEnableAdblock->isChecked());
- _changed = true;
- emit changed(true);
-}
-
-
-bool AdBlockWidget::changed()
-{
- return _changed;
-}
diff --git a/src/adblock/adblockwidget.h b/src/adblock/adblockwidget.h
deleted file mode 100644
index 37f29f93..00000000
--- a/src/adblock/adblockwidget.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef ADBLOCK_WIDGET_H
-#define ADBLOCK_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_settings_adblock.h"
-
-// KDE Includes
-#include <KSharedConfig>
-
-// Qt Includes
-#include <QWidget>
-
-
-class AdBlockWidget : public QWidget, private Ui::adblock
-{
- Q_OBJECT
-
-public:
- explicit AdBlockWidget(KSharedConfig::Ptr config, QWidget *parent = 0);
-
- bool changed();
-
-Q_SIGNALS:
- void changed(bool);
-
-public Q_SLOTS:
- void save();
-
-private Q_SLOTS:
- void hasChanged();
-
- void slotInfoLinkActivated(const QString &);
- void insertRule();
- void removeRule();
-
-private:
- void load();
-
- bool _changed;
- KSharedConfig::Ptr _adblockConfig;
-};
-
-#endif // ADBLOCK_WIDGET_H
diff --git a/src/adblock/blocked_elements.ui b/src/adblock/blocked_elements.ui
deleted file mode 100644
index 204bf81f..00000000
--- a/src/adblock/blocked_elements.ui
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>BlockedElements</class>
- <widget class="QWidget" name="BlockedElements">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>527</width>
- <height>407</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="BlockedLabel">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Blocked elements&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QFrame" name="frame">
- <property name="palette">
- <palette>
- <active>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- </active>
- <inactive>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- </inactive>
- <disabled>
- <colorrole role="Base">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- <colorrole role="Window">
- <brush brushstyle="SolidPattern">
- <color alpha="255">
- <red>255</red>
- <green>255</green>
- <blue>255</blue>
- </color>
- </brush>
- </colorrole>
- </disabled>
- </palette>
- </property>
- <property name="autoFillBackground">
- <bool>true</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="HidedLabel">
- <property name="text">
- <string>&lt;b&gt;Hidden elements&lt;/b&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/adblock/blockedelementswidget.cpp b/src/adblock/blockedelementswidget.cpp
deleted file mode 100644
index 141dd203..00000000
--- a/src/adblock/blockedelementswidget.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "blockedelementswidget.h"
-#include "blockedelementswidget.moc"
-
-// Local Includes
-#include "adblockmanager.h"
-
-// Qt Includes
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QPushButton>
-
-
-BlockedElementsWidget::BlockedElementsWidget(QObject *manager, QWidget *parent)
- : QWidget(parent)
- , _manager(manager)
- , _reloadPage(false)
-{
- setupUi(this);
-}
-
-
-void BlockedElementsWidget::setBlockedElements(const QStringList &list)
-{
- QVBoxLayout *frameLayout = new QVBoxLayout(frame);
-
- Q_FOREACH(const QString & block, list)
- {
- QString truncatedUrl = block;
- const int maxTextSize = 73;
- if (truncatedUrl.length() > maxTextSize)
- {
- const int truncateSize = 70;
- truncatedUrl.truncate(truncateSize);
- truncatedUrl += QL1S("...");
- }
- QWidget *w = new QWidget(this);
- QHBoxLayout *l = new QHBoxLayout(w);
- l->addWidget(new QLabel(truncatedUrl, this));
-
- QPushButton *button = new QPushButton(KIcon("dialog-ok-apply"), i18n("Unblock"), this);
- button->setProperty("URLTOUNBLOCK", block);
- button->setFixedWidth(100);
- connect(button, SIGNAL(clicked()), this, SLOT(unblockElement()));
- l->addWidget(button);
-
- w->setMinimumWidth(500);
- frameLayout->addWidget(w);
- }
-}
-
-
-void BlockedElementsWidget::setHidedElements(int n)
-{
- AdBlockManager *m = qobject_cast<AdBlockManager *>(_manager);
- if (m->isHidingElements())
- label->setText(i18np("There is %1 hidden element in this page.", "There are %1 hidden elements in this page.", QString::number(n)));
- else
- label->setText(i18n("Hiding elements is disabled."));
-}
-
-
-void BlockedElementsWidget::unblockElement()
-{
- QPushButton *buttonClicked = qobject_cast<QPushButton *>(sender());
- if (!buttonClicked)
- return;
-
- QString urlString = QL1S("@@") + buttonClicked->property("URLTOUNBLOCK").toString();
- kDebug() << "urlString: " << urlString;
-
- QString newText = i18n("Unblocked");
- QString buttonText = buttonClicked->text().remove('&');
- if (buttonText == newText)
- {
- buttonClicked->setText(i18n("Unblock"));
- buttonClicked->setIcon(KIcon("dialog-ok-apply"));
-
- _rulesToAdd.removeOne(urlString);
- }
- else
- {
- buttonClicked->setText(newText);
- buttonClicked->setIcon(KIcon("dialog-ok"));
-
- _rulesToAdd << urlString;
- }
-
- _reloadPage = true;
-}
diff --git a/src/adblock/blockedelementswidget.h b/src/adblock/blockedelementswidget.h
deleted file mode 100644
index d26ee849..00000000
--- a/src/adblock/blockedelementswidget.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef BLOCKED_ELEMENTS_WIDGET_H
-#define BLOCKED_ELEMENTS_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_blocked_elements.h"
-
-// Qt Includes
-#include <QWidget>
-
-
-class BlockedElementsWidget : public QWidget, private Ui::BlockedElements
-{
- Q_OBJECT
-
-public:
- explicit BlockedElementsWidget(QObject *manager, QWidget *parent = 0);
-
- void setBlockedElements(const QStringList &);
- void setHidedElements(int);
-
- bool pageNeedsReload()
- {
- return _reloadPage;
- };
-
- QStringList rulesToAdd()
- {
- return _rulesToAdd;
- };
-
-private Q_SLOTS:
- void unblockElement();
-
-private:
- QObject *_manager;
-
- bool _reloadPage;
- QStringList _rulesToAdd;
-};
-
-#endif // BLOCKED_ELEMENTS_WIDGET_H
diff --git a/src/adblock/settings_adblock.ui b/src/adblock/settings_adblock.ui
deleted file mode 100644
index e4f06339..00000000
--- a/src/adblock/settings_adblock.ui
+++ /dev/null
@@ -1,178 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>adblock</class>
- <widget class="QWidget" name="adblock">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>601</width>
- <height>507</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="checkEnableAdblock">
- <property name="text">
- <string>&amp;Enable Ad Block</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="checkHideAds">
- <property name="text">
- <string>&amp;Hide filtered elements</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KTabWidget" name="tabWidget">
- <property name="toolTip">
- <string/>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <widget class="QWidget" name="tab_3">
- <attribute name="title">
- <string>Automatic Filters</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QListWidget" name="automaticFiltersListWidget"/>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Update enabled automatic filters every:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KIntSpinBox" name="spinBox">
- <property name="minimumSize">
- <size>
- <width>120</width>
- <height>0</height>
- </size>
- </property>
- <property name="suffix">
- <string/>
- </property>
- <property name="value">
- <number>7</number>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>Manual Filters</string>
- </attribute>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Search:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KListWidgetSearchLine" name="searchLine"/>
- </item>
- </layout>
- </item>
- <item>
- <widget class="KListWidget" name="manualFiltersListWidget"/>
- </item>
- <item>
- <widget class="QLabel" name="hintLabel">
- <property name="text">
- <string comment="KDE::DoNotExtract">TextLabel</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="KLineEdit" name="addFilterLineEdit"/>
- </item>
- <item>
- <widget class="QToolButton" name="insertButton">
- <property name="toolTip">
- <string>Add filter expression</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="removeButton">
- <property name="toolTip">
- <string>Remove filter expression</string>
- </property>
- <property name="text">
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KListWidgetSearchLine</class>
- <extends>KLineEdit</extends>
- <header>klistwidgetsearchline.h</header>
- </customwidget>
- <customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- <customwidget>
- <class>KIntSpinBox</class>
- <extends>QSpinBox</extends>
- <header>knuminput.h</header>
- </customwidget>
- <customwidget>
- <class>KListWidget</class>
- <extends>QListWidget</extends>
- <header>klistwidget.h</header>
- </customwidget>
- <customwidget>
- <class>KTabWidget</class>
- <extends>QTabWidget</extends>
- <header>ktabwidget.h</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/adblock/tests/RULES b/src/adblock/tests/RULES
deleted file mode 100644
index 8dfdf8fa..00000000
--- a/src/adblock/tests/RULES
+++ /dev/null
@@ -1,19 +0,0 @@
-! cancel ALL your rules in the adblock,
-! load these and test rekonq against
-! the proposed sites
-! Good Luck!
-!
-! This rule will block EVERY site containing adv
-adv
-!
-! This one will wildcard EVERY site containing the word "advice"
-@@advice
-!
-! Block every google site :)
-||http://google*
-!
-! Block every pdf file!
-*pdf||
-!
-! Block every div of the class "advise"
-##div.advise \ No newline at end of file
diff --git a/src/adblock/tests/divhidingtest.html b/src/adblock/tests/divhidingtest.html
deleted file mode 100644
index a38e9ea1..00000000
--- a/src/adblock/tests/divhidingtest.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<html>
-
-<head>
-</head>
-
-<body>
-
-<div class="advise">
-<h1>Oh oh.. an advise!!</h1>
-</div>
-<h2>no advises here :)</h2>
-At least, I hope so...
-</body>
-
-</html> \ No newline at end of file
diff --git a/src/analyzer/analyzerpanel.cpp b/src/analyzer/analyzerpanel.cpp
deleted file mode 100644
index 5f9fc00d..00000000
--- a/src/analyzer/analyzerpanel.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Matthieu Gicquel <matgic78 at gmail dot com>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "analyzerpanel.h"
-#include "analyzerpanel.moc"
-
-// Local Includes
-#include "mainwindow.h"
-#include "networkanalyzer.h"
-#include "networkaccessmanager.h"
-#include "webtab.h"
-#include "webview.h"
-#include "webpage.h"
-
-// KDE Includes
-#include "KAction"
-
-
-NetworkAnalyzerPanel::NetworkAnalyzerPanel(const QString &title, QWidget *parent)
- : QDockWidget(title, parent)
- , _viewer(new NetworkAnalyzer(this))
-{
- setObjectName("networkAnalyzerDock");
- setWidget(_viewer);
-}
-
-
-void NetworkAnalyzerPanel::closeEvent(QCloseEvent *event)
-{
- Q_UNUSED(event);
- toggle(false);
-}
-
-
-MainWindow* NetworkAnalyzerPanel::mainWindow()
-{
- return qobject_cast<MainWindow *>(parentWidget());
-}
-
-
-void NetworkAnalyzerPanel::toggle(bool enable)
-{
- mainWindow()->actionByName("net_analyzer")->setChecked(enable);
- WebPage *page = mainWindow()->currentTab()->page();
- NetworkAccessManager *manager = qobject_cast<NetworkAccessManager *>(page->networkAccessManager());
-
- page->enableNetworkAnalyzer(enable);
-
- if (enable)
- {
- connect(page, SIGNAL(loadStarted()), _viewer, SLOT(clear()));
- connect(manager, SIGNAL(networkData(QNetworkAccessManager::Operation, QNetworkRequest, QNetworkReply*)),
- _viewer, SLOT(addRequest(QNetworkAccessManager::Operation, QNetworkRequest, QNetworkReply*)));
- }
- else
- {
- disconnect(page, SIGNAL(loadStarted()), _viewer, SLOT(clear()));
- disconnect(manager, SIGNAL(networkData(QNetworkAccessManager::Operation, QNetworkRequest, QNetworkReply*)),
- _viewer, SLOT(addRequest(QNetworkAccessManager::Operation, QNetworkRequest, QNetworkReply*)));
- }
-
- setVisible(enable);
-}
-
-
-void NetworkAnalyzerPanel::changeCurrentPage()
-{
- bool enable = mainWindow()->currentTab()->page()->hasNetworkAnalyzerEnabled();
- toggle(enable);
-}
diff --git a/src/analyzer/analyzerpanel.h b/src/analyzer/analyzerpanel.h
deleted file mode 100644
index 591e5947..00000000
--- a/src/analyzer/analyzerpanel.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef ANALYZER_PANEL_H
-#define ANALYZER_PANEL_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QDockWidget>
-
-// Forward Declarations
-class MainWindow;
-class NetworkAnalyzer;
-
-
-/**
- Docked network analyzer
- behaviour : hide/show by tab, not globally
-*/
-class REKONQ_TESTS_EXPORT NetworkAnalyzerPanel : public QDockWidget
-{
- Q_OBJECT
-
-public:
- NetworkAnalyzerPanel(const QString &title, QWidget *parent);
-
-public Q_SLOTS:
- void toggle(bool enable);
- void changeCurrentPage();
-
-protected:
- virtual void closeEvent(QCloseEvent *event);
-
- MainWindow *mainWindow();
-
-private:
- NetworkAnalyzer *_viewer;
-};
-
-#endif // NET_ANALYZER_PANEL_H
diff --git a/src/analyzer/networkanalyzer.cpp b/src/analyzer/networkanalyzer.cpp
deleted file mode 100644
index 61ab69a5..00000000
--- a/src/analyzer/networkanalyzer.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2010 by Richard J. Moore <rich@kde.org>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "networkanalyzer.h"
-#include "networkanalyzer.moc"
-
-// KDE Includes
-#include <KAction>
-#include <klocalizedstring.h>
-#include <KMenu>
-#include <KIcon>
-#include <KPassivePopup>
-
-// Qt Includes
-#include <QTreeWidget>
-#include <QVBoxLayout>
-#include <QHeaderView>
-#include <QLabel>
-#include <QApplication>
-#include <QSignalMapper>
-#include <QClipboard>
-
-#include <QNetworkReply>
-#include <QNetworkRequest>
-
-
-NetworkAnalyzer::NetworkAnalyzer(QWidget *parent)
- : QWidget(parent)
- , _mapper(new QSignalMapper(this))
- , _requestList(new QTreeWidget(this))
-{
- QStringList headers;
- headers << i18n("Method") << i18n("URL") << i18n("Response") << i18n("Length") << i18n("Content Type") << i18n("Info");
- _requestList->setHeaderLabels(headers);
-
- _requestList->header()->setResizeMode(0, QHeaderView::Interactive);
- _requestList->header()->setResizeMode(1, QHeaderView::Interactive);
- _requestList->header()->setResizeMode(2, QHeaderView::Interactive);
- _requestList->header()->setResizeMode(3, QHeaderView::Interactive);
- _requestList->header()->setResizeMode(4, QHeaderView::Interactive);
-
- _requestList->setAlternatingRowColors(true);
-
- QVBoxLayout *lay = new QVBoxLayout(this);
- lay->addWidget(_requestList);
-
- _requestList->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(_mapper, SIGNAL(mapped(QObject*)), this, SLOT(requestFinished(QObject*)));
- connect(_requestList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(showItemDetails(QTreeWidgetItem*)));
- connect(_requestList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(popupContextMenu(QPoint)));
-}
-
-
-void NetworkAnalyzer::popupContextMenu(const QPoint& pos)
-{
- if (_requestList->topLevelItemCount() >= 1)
- {
- KMenu menu(_requestList);
- KAction *copy;
- copy = new KAction(KIcon("edit-copy"), i18n("Copy URL"), this);
- connect(copy, SIGNAL(triggered(bool)), this, SLOT(copyURL()));
- menu.addAction(copy);
- menu.exec(mapToGlobal(pos));
- }
-}
-
-void NetworkAnalyzer::copyURL()
-{
- QClipboard *clipboard = QApplication::clipboard();
- clipboard->setText(_requestList->currentItem()->text(1));
-}
-
-void NetworkAnalyzer::addRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QNetworkReply *reply)
-{
- // Add to list of requests
- QStringList cols;
- switch (op)
- {
- case QNetworkAccessManager::HeadOperation:
- cols << QL1S("HEAD");
- break;
- case QNetworkAccessManager::GetOperation:
- cols << QL1S("GET");
- break;
- case QNetworkAccessManager::PutOperation:
- cols << QL1S("PUT");
- break;
- case QNetworkAccessManager::PostOperation:
- cols << QL1S("POST");
- break;
- case QNetworkAccessManager::DeleteOperation:
- cols << QL1S("DELETE");
- break;
- case QNetworkAccessManager::CustomOperation:
- cols << QL1S("CUSTOM");
- break;
-
- default:
- kDebug() << "Unknown network operation";
- }
- cols << req.url().toString();
- cols << i18n("Pending");
-
- QTreeWidgetItem *item = new QTreeWidgetItem(cols);
- _requestList->addTopLevelItem(item);
-
- // Add to maps
- _requestMap.insert(reply, req);
- _itemMap.insert(reply, item);
- _itemRequestMap.insert(item, req);
-
- _mapper->setMapping(reply, reply);
- connect(reply, SIGNAL(finished()), _mapper, SLOT(map()));
-
- _requestList->header()->resizeSections(QHeaderView::ResizeToContents);
-}
-
-
-void NetworkAnalyzer::clear()
-{
- _requestMap.clear();
- _itemMap.clear();
- _itemReplyMap.clear();
- _itemRequestMap.clear();
- _requestList->clear();
-}
-
-
-void NetworkAnalyzer::requestFinished(QObject *replyObject)
-{
- QNetworkReply *reply = qobject_cast<QNetworkReply *>(replyObject);
- if (!reply)
- {
- kDebug() << "Failed to downcast reply";
- return;
- }
-
- QTreeWidgetItem *item = _itemMap[reply];
- if (!item)
- {
- kDebug() << "No Item mapped. Returning...";
- return;
- }
-
- // Record the reply headers
- QList<QByteArray> headerValues;
- Q_FOREACH(const QByteArray & header, reply->rawHeaderList())
- {
- headerValues += reply->rawHeader(header);
- }
-
- QPair< QList<QByteArray>, QList<QByteArray> > replyHeaders;
- replyHeaders.first = reply->rawHeaderList();
- replyHeaders.second = headerValues;
- _itemReplyMap[item] = replyHeaders;
-
- // Display the request
- int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
- QString reason = reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();
- item->setText(2, i18n("%1 %2", status, reason));
-
- QString length = reply->header(QNetworkRequest::ContentLengthHeader).toString();
- item->setText(3, length);
-
- QString contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString();
- item->setText(4, contentType);
-
- if (status == 302)
- {
- QUrl target = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
- item->setText(5, i18n("Redirect: %1", target.toString()));
- }
-}
-
-
-void NetworkAnalyzer::showItemDetails(QTreeWidgetItem *item)
-{
- // Show request details
- QString details;
-
- QNetworkRequest req = _itemRequestMap[item];
- details += i18n("<h3>Request Details</h3>");
- details += QL1S("<ul>");
- Q_FOREACH(const QByteArray & header, req.rawHeaderList())
- {
- details += QL1S("<li>");
- details += QL1S(header);
- details += QL1S(": ");
- details += QL1S(req.rawHeader(header));
- details += QL1S("</li>");
- }
- details += QL1S("</ul>");
-
- QPair< QList<QByteArray>, QList<QByteArray> > replyHeaders = _itemReplyMap[item];
- details += i18n("<h3>Response Details</h3>");
- details += QL1S("<ul>");
- for (int i = 0; i < replyHeaders.first.count(); i++)
- {
- details += QL1S("<li>");
- details += QL1S(replyHeaders.first[i]);
- details += QL1S(": ");
- details += QL1S(replyHeaders.second[i]);
- details += QL1S("</li>");
- }
- details += QL1S("</ul>");
-
-// QLabel *label = new QLabel(details, this);
-// KPassivePopup *popup = new KPassivePopup(this);
-// popup->setView(label);
-// popup->show(_requestList->mapToGlobal(_requestList->pos()));
- KPassivePopup::message(details, this);
-}
diff --git a/src/analyzer/networkanalyzer.h b/src/analyzer/networkanalyzer.h
deleted file mode 100644
index af1e1145..00000000
--- a/src/analyzer/networkanalyzer.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2010 by Richard J. Moore <rich@kde.org>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-
-#ifndef NETWORK_ANALYZER_H
-#define NETWORK_ANALYZER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QWidget>
-
-#include <QMap>
-#include <QList>
-
-#include <QNetworkAccessManager>
-
-// Forward Declarations
-class QTreeWidgetItem;
-class QSignalMapper;
-class QTreeWidget;
-
-class QNetworkReply;
-class QNetworkRequest;
-
-
-class NetworkAnalyzer : public QWidget
-{
- Q_OBJECT
-
-public:
- NetworkAnalyzer(QWidget *parent = 0);
-
-private Q_SLOTS:
- void addRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QNetworkReply *reply);
-
- void clear();
- void requestFinished(QObject *replyObject);
- void showItemDetails(QTreeWidgetItem *item);
- void copyURL();
- void popupContextMenu(const QPoint &pos);
-
-private:
- QMap<QNetworkReply *, QNetworkRequest> _requestMap;
- QMap<QTreeWidgetItem *, QNetworkRequest> _itemRequestMap;
- QMap<QNetworkReply *, QTreeWidgetItem *> _itemMap;
- QMap<QTreeWidgetItem *, QPair< QList<QByteArray>, QList<QByteArray> > > _itemReplyMap;
-
- QSignalMapper *_mapper;
- QTreeWidget *_requestList;
-};
-
-#endif // NETWORK_ANALYZER_H
diff --git a/src/application.cpp b/src/application.cpp
deleted file mode 100644
index 18e3cad7..00000000
--- a/src/application.cpp
+++ /dev/null
@@ -1,883 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "application.h"
-#include "application.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Ui Includes
-#include "ui_webappcreation.h"
-
-// Local Includes
-#include "adblockmanager.h"
-#include "bookmarkmanager.h"
-#include "downloadmanager.h"
-#include "historymanager.h"
-#include "iconmanager.h"
-#include "mainview.h"
-#include "mainwindow.h"
-#include "opensearchmanager.h"
-#include "searchengine.h"
-#include "sessionmanager.h"
-#include "syncmanager.h"
-#include "stackedurlbar.h"
-#include "tabbar.h"
-#include "urlbar.h"
-#include "urlresolver.h"
-#include "useragentmanager.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KCmdLineArgs>
-#include <KIcon>
-#include <KMessageBox>
-#include <KStandardDirs>
-#include <KStartupInfo>
-#include <ThreadWeaver/Weaver>
-#include <KAction>
-#include <KWindowSystem>
-#include <KWindowInfo>
-#include <KGlobal>
-#include <KCharsets>
-#include <KPushButton>
-#include <KMimeType>
-
-// Qt Includes
-#include <QVBoxLayout>
-#include <QTimer>
-
-
-using namespace ThreadWeaver;
-
-
-Application::Application()
- : KUniqueApplication()
- , _privateBrowsingAction(0)
-{
- _privateBrowsingAction = new KAction(KIcon("view-media-artist"), i18n("Private &Browsing"), this);
- _privateBrowsingAction->setCheckable(true);
- connect(_privateBrowsingAction, SIGNAL(triggered(bool)), this, SLOT(setPrivateBrowsingMode(bool)));
-}
-
-
-Application::~Application()
-{
- // ok, we are closing well.
- // Don't recover on next load..
- ReKonfig::setRecoverOnCrash(0);
- saveConfiguration();
-
- Q_FOREACH(QWeakPointer<MainWindow> window, m_mainWindows)
- {
- kDebug() << "deleting windows...";
- delete window.data();
- window.clear();
- }
-
- if (!m_historyManager.isNull())
- {
- kDebug() << "deleting history manager";
- delete m_historyManager.data();
- m_historyManager.clear();
- }
-
- if (!m_bookmarkManager.isNull())
- {
- kDebug() << "deleting bookmark Manager";
- delete m_bookmarkManager.data();
- m_bookmarkManager.clear();
- }
-
- if (!m_sessionManager.isNull())
- {
- kDebug() << "deleting session manager";
- delete m_sessionManager.data();
- m_sessionManager.clear();
- }
-
- if (!m_opensearchManager.isNull())
- {
- kDebug() << "deleting opensearch manager";
- delete m_opensearchManager.data();
- m_opensearchManager.clear();
- }
-
- if (!m_iconManager.isNull())
- {
- kDebug() << "deleting icon manager";
- delete m_iconManager.data();
- m_iconManager.clear();
- }
-
- if (!m_adblockManager.isNull())
- {
- kDebug() << "deleting adblock manager";
- delete m_adblockManager.data();
- m_adblockManager.clear();
- }
-
- if (!m_userAgentManager.isNull())
- {
- kDebug() << "deleting user agent manager";
- delete m_userAgentManager.data();
- m_userAgentManager.clear();
- }
-
- if (!m_syncManager.isNull())
- {
- kDebug() << "deleting sync manager";
- delete m_syncManager.data();
- m_syncManager.clear();
- }
-
- // TODO:
- // add a check to NOT close rekonq
- // until last download is finished
- if (!m_downloadManager.isNull())
- {
- kDebug() << "deleting download manager";
- delete m_downloadManager.data();
- m_downloadManager.clear();
- }
-
- kDebug() << "Bye bye...";
-}
-
-
-int Application::newInstance()
-{
- KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
-
- // not that easy, indeed
- // We have to consider 3 variables here:
- // 1) Is first load?
- // 2) Are there arguments?
- // 3) Is rekonq recovering from crash?
- // so, we have 8 possible cases...
- static bool isFirstLoad = true;
- bool areThereArguments = (args->count() > 0);
- bool hasToBeRecoveredFromCrash = (ReKonfig::recoverOnCrash() > 0);
- // note that hasToBeRecoveredFromCrash is always true if it is not the first load
- // !isFirstLoad -> hasToBeRecovered
-
- kDebug() << "is first load? " << isFirstLoad;
- kDebug() << "are there arguments? " << areThereArguments;
- kDebug() << "is rekonq crashed? " << hasToBeRecoveredFromCrash;
-
- if (areThereArguments)
- {
- // prepare URLS to load
- KUrl::List urlList;
- for (int i = 0; i < args->count(); ++i)
- {
- const KUrl u = args->url(i);
-
- if (u.isLocalFile() && QFile::exists(u.toLocalFile())) // "rekonq somefile.html" case
- urlList += u;
- else
- {
- // "rekonq kde.org" || "rekonq kde:kdialog" case
- UrlResolver res(args->arg(i));
- UrlSearchList list = res.orderedSearchItems();
- if (list.isEmpty())
- {
- urlList += u;
- }
- else
- {
- urlList += list.first().url;
- }
- }
- }
-
- if (isFirstLoad && (ReKonfig::startupBehaviour() == 2) && sessionManager()->restoreSessionFromScratch())
- {
- isFirstLoad = false;
- }
-
- // first argument: 99% of the time we have just that...
- if (isFirstLoad)
- {
- // No windows in the current desktop? No windows at all?
- // Create a new one and load there sites...
- loadUrl(urlList.at(0), Rekonq::NewWindow);
- }
- else
- {
- if (!ReKonfig::openExternalLinksInNewWindow())
- {
- loadUrl(urlList.at(0), Rekonq::NewFocusedTab);
- }
- else
- {
- loadUrl(urlList.at(0), Rekonq::NewWindow);
- }
-
- if (!mainWindow()->isActiveWindow())
- KWindowSystem::demandAttention(mainWindow()->winId(), true);
- }
-
- // following arguments: what's best behavior here?
- // I'm pretty sure no one has real opinion about...
- if (!ReKonfig::openExternalLinksInNewWindow())
- {
- for (int i = 1; i < urlList.count(); ++i)
- loadUrl(urlList.at(i), Rekonq::NewFocusedTab);
- }
- else
- {
- for (int i = 1; i < urlList.count(); ++i)
- loadUrl(urlList.at(i), Rekonq::NewWindow);
- }
- }
- else
- {
- if (isFirstLoad)
- {
- if (hasToBeRecoveredFromCrash)
- {
- loadUrl(KUrl("about:closedTabs"), Rekonq::NewWindow);
- }
- else
- {
- // NOTE: just load new tabs/windows without arguments
- // if NOT is Session restored...
- if (!isSessionRestored())
- {
- switch (ReKonfig::startupBehaviour())
- {
- case 0: // open home page
- newMainWindow()->homePage();
- break;
- case 1: // open new tab page
- loadUrl(KUrl("about:home"), Rekonq::NewWindow);
- break;
- case 2: // restore session
- if (sessionManager()->restoreSessionFromScratch())
- {
- break;
- }
- default:
- newMainWindow()->homePage();
- break;
- }
- }
- }
- }
- else
- {
- switch (ReKonfig::newTabsBehaviour())
- {
- case 0: // new tab page
- loadUrl(KUrl("about:home") , Rekonq::NewWindow);
- break;
- case 2: // homepage
- loadUrl(KUrl(ReKonfig::homePage()) , Rekonq::NewWindow);
- break;
- case 1: // blank page
- default:
- loadUrl(KUrl("about:blank") , Rekonq::NewWindow);
- break;
- }
- }
- }
-
- if (isFirstLoad)
- {
- if (hasToBeRecoveredFromCrash)
- {
- QTimer::singleShot(1000, mainWindow()->currentTab(), SLOT(showMessageBar()));
- }
- else
- {
- sessionManager()->setSessionManagementEnabled(true);
- }
-
- if (ReKonfig::checkDefaultSearchEngine()
- && !hasToBeRecoveredFromCrash
- && SearchEngine::defaultEngine().isNull())
- QTimer::singleShot(2000, mainWindow()->currentTab(), SLOT(showSearchEngineBar()));
-
- // updating rekonq configuration
- updateConfiguration();
-
- setWindowIcon(KIcon("rekonq"));
-
- historyManager();
-
- ReKonfig::setRecoverOnCrash(ReKonfig::recoverOnCrash() + 1);
- saveConfiguration();
- }
-
- KStartupInfo::appStarted();
- isFirstLoad = false;
-
- return 0;
-}
-
-
-Application *Application::instance()
-{
- return (qobject_cast<Application *>(QCoreApplication::instance()));
-}
-
-
-void Application::saveConfiguration() const
-{
- ReKonfig::self()->writeConfig();
-}
-
-
-MainWindow *Application::mainWindow()
-{
- MainWindow *active = qobject_cast<MainWindow*>(QApplication::activeWindow());
-
- if (!active)
- {
- if (m_mainWindows.isEmpty())
- return 0;
-
- Q_FOREACH(const QWeakPointer<MainWindow> &pointer, m_mainWindows)
- {
- if (KWindowInfo(pointer.data()->effectiveWinId(), NET::WMDesktop, 0).isOnCurrentDesktop())
- return pointer.data();
- }
- return m_mainWindows.at(0).data();
- }
- return active;
-}
-
-
-HistoryManager *Application::historyManager()
-{
- if (m_historyManager.isNull())
- {
- m_historyManager = new HistoryManager;
- }
- return m_historyManager.data();
-}
-
-
-BookmarkManager *Application::bookmarkManager()
-{
- if (m_bookmarkManager.isNull())
- {
- m_bookmarkManager = new BookmarkManager;
- }
- return m_bookmarkManager.data();
-}
-
-
-SessionManager *Application::sessionManager()
-{
- if (m_sessionManager.isNull())
- {
- m_sessionManager = new SessionManager;
- }
- return m_sessionManager.data();
-}
-
-
-OpenSearchManager *Application::opensearchManager()
-{
- if (m_opensearchManager.isNull())
- {
- m_opensearchManager = new OpenSearchManager;
- }
- return m_opensearchManager.data();
-}
-
-
-IconManager *Application::iconManager()
-{
- if (m_iconManager.isNull())
- {
- m_iconManager = new IconManager;
- }
- return m_iconManager.data();
-}
-
-
-DownloadManager *Application::downloadManager()
-{
- if (m_downloadManager.isNull())
- {
- m_downloadManager = new DownloadManager(instance());
- }
- return m_downloadManager.data();
-}
-
-
-UserAgentManager *Application::userAgentManager()
-{
- if (m_userAgentManager.isNull())
- {
- m_userAgentManager = new UserAgentManager(instance());
- }
- return m_userAgentManager.data();
-}
-
-
-SyncManager *Application::syncManager()
-{
- if (m_syncManager.isNull())
- {
- m_syncManager = new SyncManager(instance());
- }
- return m_syncManager.data();
-}
-
-
-void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
-{
- if (url.isEmpty())
- return;
-
- if (!url.isValid())
- {
- KMessageBox::error(0, i18n("Malformed URL:\n%1", url.url(KUrl::RemoveTrailingSlash)));
- return;
- }
-
- Rekonq::OpenType newType = type;
- // Don't open useless tabs or windows for actions in about: pages
- if (url.url().contains("about:") && url.url().contains("/"))
- newType = Rekonq::CurrentTab;
-
- MainWindow *w = 0;
- if (newType == Rekonq::NewWindow
- || (newType == Rekonq::NewTab && ReKonfig::openLinksInNewWindow()))
- {
- w = newMainWindow();
- newType = Rekonq::CurrentTab;
- }
- else
- {
- w = mainWindow();
- }
-
- // be SURE window exists
- if (!w)
- w = newMainWindow();
-
- w->loadCheckedUrl(url, newType);
-}
-
-
-MainWindow *Application::newMainWindow(bool withTab)
-{
- MainWindow *w = new MainWindow();
- // This is used to track which window was activated most recently
- w->installEventFilter(this);
-
- m_mainWindows.prepend(w);
-
- if (withTab)
- w->mainView()->newWebTab(); // remember using newWebTab and NOT newTab here!!
-
- w->show();
-
- return w;
-}
-
-
-void Application::removeMainWindow(MainWindow *window)
-{
- m_mainWindows.removeOne(window);
- kDebug() << "Removing Window from app window list...";
-
- // bye bye...
- if (m_mainWindows.count() == 0)
- quit();
-}
-
-
-MainWindowList Application::mainWindowList()
-{
- return m_mainWindows;
-}
-
-
-AdBlockManager *Application::adblockManager()
-{
- if (m_adblockManager.isNull())
- {
- m_adblockManager = new AdBlockManager;
- }
- return m_adblockManager.data();
-}
-
-
-void Application::newWindow()
-{
- loadUrl(KUrl("about:home"), Rekonq::NewWindow);
- mainWindow()->mainView()->currentUrlBar()->setFocus();
-}
-
-
-bool Application::eventFilter(QObject* watched, QEvent* event)
-{
- // Track which window was activated most recently to prefer it on window choosing
- // (e.g. when another application opens a link)
- if (event->type() == QEvent::WindowActivate)
- {
- MainWindow *window = qobject_cast<MainWindow*>(watched);
- if (window)
- {
- if (m_mainWindows.at(0).data() != window)
- {
- int index = m_mainWindows.indexOf(QWeakPointer<MainWindow>(window));
- Q_ASSERT(index != -1);
- m_mainWindows.prepend(m_mainWindows.takeAt(index));
- }
- }
- }
-
- return QObject::eventFilter(watched, event);
-}
-
-
-void Application::updateConfiguration()
-{
- // ============== Tabs ==================
- bool b = ReKonfig::closeTabSelectPrevious();
- Q_FOREACH(const QWeakPointer<MainWindow> &w, m_mainWindows)
- {
- MainView *mv = w.data()->mainView();
- mv->updateTabBarVisibility();
-
- mv->tabBar()->setAnimatedTabHighlighting(ReKonfig::animatedTabHighlighting());
-
- if (b)
- mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab);
- else
- mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab);
- }
-
- QWebSettings *defaultSettings = QWebSettings::globalSettings();
-
- // =========== Fonts ==============
- defaultSettings->setFontFamily(QWebSettings::StandardFont, ReKonfig::standardFontFamily());
- defaultSettings->setFontFamily(QWebSettings::FixedFont, ReKonfig::fixedFontFamily());
- defaultSettings->setFontFamily(QWebSettings::SerifFont, ReKonfig::serifFontFamily());
- defaultSettings->setFontFamily(QWebSettings::SansSerifFont, ReKonfig::sansSerifFontFamily());
- defaultSettings->setFontFamily(QWebSettings::CursiveFont, ReKonfig::cursiveFontFamily());
- defaultSettings->setFontFamily(QWebSettings::FantasyFont, ReKonfig::fantasyFontFamily());
-
- // compute font size
- // (I have to admit I know nothing about these DPI questions..: copied from kwebkitpart, as someone suggested)
- // font size in pixels = font size in inches × screen dpi
- if (mainWindow() && mainWindow()->currentTab())
- {
- int logDpiY = mainWindow()->currentTab()->view()->logicalDpiY();
- float toPix = (logDpiY < 96.0)
- ? 96.0 / 72.0
- : logDpiY / 72.0 ;
-
- int defaultFontSize = ReKonfig::defaultFontSize();
- int minimumFontSize = ReKonfig::minFontSize();
-
- defaultSettings->setFontSize(QWebSettings::DefaultFontSize, qRound(defaultFontSize * toPix));
- defaultSettings->setFontSize(QWebSettings::MinimumFontSize, qRound(minimumFontSize * toPix));
- }
-
- // encodings
- QString enc = ReKonfig::defaultEncoding();
- defaultSettings->setDefaultTextEncoding(enc);
-
- // ================ WebKit ============================
- defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, ReKonfig::dnsPrefetch());
- defaultSettings->setAttribute(QWebSettings::PrintElementBackgrounds, ReKonfig::printElementBackgrounds());
-
- defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, ReKonfig::javascriptEnabled());
- defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, ReKonfig::javascriptCanOpenWindows());
- defaultSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, ReKonfig::javascriptCanAccessClipboard());
-
- defaultSettings->setAttribute(QWebSettings::JavaEnabled, ReKonfig::javaEnabled());
-
- if (ReKonfig::pluginsEnabled() == 2)
- defaultSettings->setAttribute(QWebSettings::PluginsEnabled, false);
- else
- defaultSettings->setAttribute(QWebSettings::PluginsEnabled, true);
-
- // Enabling WebKit "Page Cache" feature: http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
- defaultSettings->setMaximumPagesInCache(3);
-
- // ===== HTML 5 features WebKit support ======
- defaultSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, ReKonfig::offlineStorageDatabaseEnabled());
- defaultSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, ReKonfig::offlineWebApplicationCacheEnabled());
- defaultSettings->setAttribute(QWebSettings::LocalStorageEnabled, ReKonfig::localStorageEnabled());
- if (ReKonfig::localStorageEnabled())
- {
- QString path = KStandardDirs::locateLocal("cache", QString("WebkitLocalStorage/rekonq"), true);
- path.remove("rekonq");
- QWebSettings::setOfflineStoragePath(path);
- QWebSettings::setOfflineStorageDefaultQuota(50000);
- }
-
- // ================= WebGl ===================
- defaultSettings->setAttribute(QWebSettings::WebGLEnabled, ReKonfig::webGL());
- defaultSettings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, ReKonfig::webGL());
-
- // Applies user defined CSS to all open webpages.
- defaultSettings->setUserStyleSheetUrl(ReKonfig::userCSS());
-
- // ====== load Settings on main classes
- historyManager()->loadSettings();
-
- defaultSettings = 0;
-
- if (!mainWindow())
- return;
-
- ReKonfig::useFavicon()
- ? mainWindow()->changeWindowIcon(mainWindow()->mainView()->currentIndex())
- : mainWindow()->setWindowIcon(KIcon("rekonq"))
- ;
-
- // hovering unfocused tabs options
- switch (ReKonfig::hoveringTabOption())
- {
- case 0: // tab previews
- case 3: // nothing
- for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++)
- {
- mainWindow()->mainView()->tabBar()->setTabToolTip(i, QL1S(""));
- }
- break;
-
- case 1: // title previews
- for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++)
- {
- mainWindow()->mainView()->tabBar()->setTabToolTip(i, mainWindow()->mainView()->tabText(i).remove('&'));
- }
- break;
-
- case 2: // url previews
- for (int i = 0; i < mainWindow()->mainView()->tabBar()->count(); i++)
- {
- mainWindow()->mainView()->tabBar()->setTabToolTip(i, mainWindow()->mainView()->webTab(i)->url().toMimeDataString());
- }
- break;
-
- default: // non extant case
- ASSERT_NOT_REACHED(unknown hoveringTabOption);
- break;
- }
-
-}
-
-
-void Application::setPrivateBrowsingMode(bool b)
-{
-// NOTE
-// to let work nicely Private Browsing, we need the following:
-// - enable WebKit Private Browsing mode :)
-// - treat all cookies as session cookies
-// (so that they do not get saved to a persistent storage). Available from KDE SC 4.5.72, see BUG: 250122
-// - favicons (fixed in rekonq 0.5.87)
-// - save actual session (to restore it when Private Mode is closed) and stop storing it
-// - disable history saving
-
- QWebSettings *settings = QWebSettings::globalSettings();
- bool isJustEnabled = settings->testAttribute(QWebSettings::PrivateBrowsingEnabled);
- if (isJustEnabled == b)
- return; // uhm... something goes wrong...
-
- if (b)
- {
- QString caption = i18n("Are you sure you want to turn on private browsing?");
- QString text = i18n("<b>%1</b>"
- "<p>rekonq will save your current tabs for when you'll stop private browsing the net.</p>", caption);
-
- int button = KMessageBox::warningContinueCancel(mainWindow(),
- text, caption, KStandardGuiItem::cont(), KStandardGuiItem::cancel(),
- i18n("don't ask again"));
- if (button != KMessageBox::Continue)
- {
- // The user canceled so we should uncheck the box
- _privateBrowsingAction->setChecked(false);
- return;
- }
-
- sessionManager()->setSessionManagementEnabled(false);
- settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
- _privateBrowsingAction->setChecked(true);
-
- loadUrl(KUrl("about:home"), Rekonq::NewWindow);
-
- MainWindow *activeOne = m_mainWindows.at(0).data();
-
- Q_FOREACH(const QWeakPointer<MainWindow> &w, m_mainWindows)
- {
- if (w.data() != activeOne)
- w.data()->close();
- }
- }
- else
- {
- settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false);
- _privateBrowsingAction->setChecked(false);
-
- int newWindows = sessionManager()->restoreSavedSession();
- if (newWindows == 0)
- {
- loadUrl(KUrl("about:home"), Rekonq::NewWindow);
- newWindows++;
- }
-
- for (int i = newWindows; i < m_mainWindows.count(); ++i)
- {
- m_mainWindows.at(i).data()->close();
- }
-
- sessionManager()->setSessionManagementEnabled(true);
- }
-}
-
-
-void Application::queryQuit()
-{
- if (mainWindowList().count() > 1)
- {
- int answer = KMessageBox::questionYesNoCancel(
- mainWindow(),
- i18n("Do you want to close the window or the whole application?"),
- i18n("Application/Window closing..."),
- KGuiItem(i18n("C&lose Current Window"),
- KIcon("window-close")),
- KStandardGuiItem::quit(),
- KStandardGuiItem::cancel(),
- "confirmClosingMultipleWindows"
- );
-
- switch (answer)
- {
- case KMessageBox::Yes:
- mainWindow()->close();
- return;
-
- case KMessageBox::No:
- break;
-
- default:
- return;
- }
- }
-
- // in case of just one window...
- quit();
-}
-
-
-void Application::createWebAppShortcut()
-{
- KUrl u = mainWindow()->currentTab()->url();
- QString h = u.host();
-
- QPointer<KDialog> dialog = new KDialog(mainWindow());
- dialog->setCaption(i18nc("@title:window", "Create Application Shortcut"));
- dialog->setButtons(KDialog::Ok | KDialog::Cancel);
- dialog->button(KDialog::Ok)->setText(i18n("Create"));
- dialog->setMinimumSize(400, 50);
- dialog->setWindowIcon(QIcon(iconManager()->iconForUrl(u).pixmap(16)));
-
- Ui::webAppCreation wAppWidget;
- QWidget widget;
- wAppWidget.setupUi(&widget);
-
- const QString title = mainWindow()->currentTab()->view()->title().remove('&');
- wAppWidget.nameLineEdit->setText(title);
- wAppWidget.kcfg_createDesktopAppShortcut->setChecked(ReKonfig::createDesktopAppShortcut());
- wAppWidget.kcfg_createMenuAppShortcut->setChecked(ReKonfig::createMenuAppShortcut());
-
- dialog->setMainWidget(&widget);
- dialog->exec();
-
- if (dialog->result() == QDialog::Accepted)
- {
- ReKonfig::setCreateDesktopAppShortcut(wAppWidget.kcfg_createDesktopAppShortcut->isChecked());
- ReKonfig::setCreateMenuAppShortcut(wAppWidget.kcfg_createMenuAppShortcut->isChecked());
-
- iconManager()->saveDesktopIconForUrl(u);
- QString iconPath = KStandardDirs::locateLocal("cache" , "favicons/" , true) + h + QL1S("_WEBAPPICON.png");
-
- QString shortcutString = QL1S("#!/usr/bin/env xdg-open\n")
- + QL1S("[Desktop Entry]\n")
- + QL1S("Name=") + (wAppWidget.nameLineEdit->text().isEmpty() ? QL1S("kwebapp") : wAppWidget.nameLineEdit->text()) + QL1S("\n")
- + QL1S("GenericName=") + (wAppWidget.descriptionLineEdit->text().isEmpty() ? QL1S("") : wAppWidget.descriptionLineEdit->text()) + QL1S("\n")
- + QL1S("Icon=") + iconPath + QL1S("\n")
- + QL1S("Exec=kwebapp ") + u.url() + QL1S("\n")
- + QL1S("Type=Application\n")
- + QL1S("Categories=Application;Network\n")
- ;
-
- if (ReKonfig::createDesktopAppShortcut())
- {
- QString desktop = KGlobalSettings::desktopPath();
- QFile wAppFile(desktop + QL1C('/') + title);
-
- if (!wAppFile.open(QIODevice::WriteOnly | QIODevice::Text))
- {
- kDebug() << "Unable to open file: " << wAppFile.errorString();
- return;
- }
-
- QTextStream out(&wAppFile);
- out.setCodec("UTF-8");
- out << shortcutString;
-
- wAppFile.setPermissions(QFile::ReadUser | QFile::WriteUser | QFile::ExeUser | QFile::ReadGroup | QFile::ReadOther);
- wAppFile.close();
- }
-
- if (ReKonfig::createMenuAppShortcut())
- {
- QString appMenuDir = KStandardDirs::locateLocal("xdgdata-apps", QString());
- QFile wAppFile(appMenuDir + QL1C('/') + title + QL1S(".desktop"));
-
- if (!wAppFile.open(QIODevice::WriteOnly | QIODevice::Text))
- {
- kDebug() << "Unable to open file: " << wAppFile.errorString();
- return;
- }
-
- QTextStream out(&wAppFile);
- out.setCodec("UTF-8");
- out << shortcutString;
-
- wAppFile.close();
- }
-
- }
-
- dialog->deleteLater();
-}
diff --git a/src/application.h b/src/application.h
deleted file mode 100644
index 168a9dcd..00000000
--- a/src/application.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef APPLICATION_H
-#define APPLICATION_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "downloaditem.h"
-
-// KDE Includes
-#include <KUniqueApplication>
-
-// Qt Includes
-#include <QWeakPointer>
-
-// Forward Declarations
-class KAction;
-
-class QWebHistory;
-
-class AdBlockManager;
-class BookmarkManager;
-class DownloadManager;
-class HistoryManager;
-class IconManager;
-class MainWindow;
-class OpenSearchManager;
-class SessionManager;
-class UserAgentManager;
-class SyncManager;
-class WebTab;
-
-
-typedef QList< QWeakPointer<MainWindow> > MainWindowList;
-
-
-// ---------------------------------------------------------------------------------------------------------------
-
-
-#define rApp Application::instance()
-
-/**
- * Rekonq Application class
- */
-class REKONQ_TESTS_EXPORT Application : public KUniqueApplication
-{
- Q_OBJECT
-
-public:
- Application();
- ~Application();
-
- int newInstance();
- static Application *instance();
-
- MainWindow *mainWindow();
- MainWindow *newMainWindow(bool withTab = true);
- MainWindowList mainWindowList();
-
- HistoryManager *historyManager();
- BookmarkManager *bookmarkManager();
- SessionManager *sessionManager();
- AdBlockManager *adblockManager();
- OpenSearchManager *opensearchManager();
- IconManager *iconManager();
- DownloadManager *downloadManager();
- UserAgentManager *userAgentManager();
- SyncManager *syncManager();
-
- KAction *privateBrowsingAction()
- {
- return _privateBrowsingAction;
- };
-
-public Q_SLOTS:
- /**
- * Save application's configuration
- *
- * @see ReKonfig::self()->writeConfig();
- */
- void saveConfiguration() const;
-
- /**
- * @short load url
- *
- * @param url The url to load
- * @param type the type where loading the url. @see Rekonq::OpenType
- */
- void loadUrl(const KUrl& url,
- const Rekonq::OpenType& type = Rekonq::CurrentTab
- );
-
- void newWindow();
- void removeMainWindow(MainWindow *window);
-
-protected:
- // This is used to track which window was activated most recently
- bool eventFilter(QObject *watched, QEvent *event);
-
-private Q_SLOTS:
- void updateConfiguration();
-
- // the general place to set private browsing
- void setPrivateBrowsingMode(bool);
-
- void queryQuit();
-
- void createWebAppShortcut();
-
-private:
- QWeakPointer<HistoryManager> m_historyManager;
- QWeakPointer<BookmarkManager> m_bookmarkManager;
- QWeakPointer<SessionManager> m_sessionManager;
- QWeakPointer<AdBlockManager> m_adblockManager;
- QWeakPointer<OpenSearchManager> m_opensearchManager;
- QWeakPointer<IconManager> m_iconManager;
- QWeakPointer<DownloadManager> m_downloadManager;
- QWeakPointer<UserAgentManager> m_userAgentManager;
- QWeakPointer<SyncManager> m_syncManager;
-
- MainWindowList m_mainWindows;
-
- KAction *_privateBrowsingAction;
-};
-
-#endif // APPLICATION_H
diff --git a/src/bookmarks/bookmarkmanager.cpp b/src/bookmarks/bookmarkmanager.cpp
deleted file mode 100644
index 33f3c662..00000000
--- a/src/bookmarks/bookmarkmanager.cpp
+++ /dev/null
@@ -1,353 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2010 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "bookmarkmanager.h"
-#include "bookmarkmanager.moc"
-
-// Local Includes
-#include "application.h"
-#include "bookmarkspanel.h"
-#include "bookmarkstoolbar.h"
-#include "bookmarkowner.h"
-#include "iconmanager.h"
-#include "mainwindow.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KActionCollection>
-#include <KStandardDirs>
-
-// Qt Includes
-#include <QtCore/QFile>
-
-
-BookmarkManager::BookmarkManager(QObject *parent)
- : QObject(parent)
- , m_manager(0)
- , m_owner(0)
- , m_actionCollection(new KActionCollection(this))
-{
- m_manager = KBookmarkManager::userBookmarksManager();
- const QString bookmarksFile = KStandardDirs::locateLocal("data", QString::fromLatin1("konqueror/bookmarks.xml"));
-
- if (!QFile::exists(bookmarksFile))
- {
- kDebug() << "copying of defaultbookmarks.xbel ...";
-
- QString bookmarksDefaultPath = KStandardDirs::locate("appdata" , "defaultbookmarks.xbel");
- KBookmarkManager *tempManager = KBookmarkManager::managerForExternalFile(bookmarksDefaultPath);
-
- copyBookmarkGroup(tempManager->root(), rootGroup());
- m_manager->emitChanged();
- delete tempManager;
- }
-
- connect(m_manager, SIGNAL(changed(QString, QString)), this, SLOT(slotBookmarksChanged()));
-
- // setup menu
- m_owner = new BookmarkOwner(m_manager, this);
- connect(m_owner, SIGNAL(openUrl(KUrl, Rekonq::OpenType)),
- this, SIGNAL(openUrl(KUrl, Rekonq::OpenType)));
-
- // bookmarks loading
- connect(this, SIGNAL(openUrl(KUrl, Rekonq::OpenType)), rApp, SLOT(loadUrl(KUrl, Rekonq::OpenType)));
-}
-
-
-BookmarkManager::~BookmarkManager()
-{
- delete m_manager;
-}
-
-
-KActionMenu* BookmarkManager::bookmarkActionMenu(QWidget *parent)
-{
- KMenu *menu = new KMenu(parent);
- KActionMenu *bookmarkActionMenu = new KActionMenu(menu);
- bookmarkActionMenu->setMenu(menu);
- bookmarkActionMenu->setText(i18n("&Bookmarks"));
- BookmarkMenu *bMenu = new BookmarkMenu(m_manager, m_owner, menu, m_actionCollection);
- bMenu->setParent(menu);
-
- return bookmarkActionMenu;
-}
-
-
-void BookmarkManager::registerBookmarkBar(BookmarkToolBar *toolbar)
-{
- if (m_bookmarkToolBars.contains(toolbar))
- return;
-
- m_bookmarkToolBars.append(toolbar);
-}
-
-
-void BookmarkManager::removeBookmarkBar(BookmarkToolBar *toolbar)
-{
- m_bookmarkToolBars.removeOne(toolbar);
-}
-
-
-void BookmarkManager::registerBookmarkPanel(BookmarksPanel *panel)
-{
- if (panel && !m_bookmarkPanels.contains(panel))
- {
- m_bookmarkPanels.append(panel);
- connect(panel, SIGNAL(expansionChanged()), this, SLOT(slotPanelChanged()));
- }
-}
-
-
-void BookmarkManager::removeBookmarkPanel(BookmarksPanel *panel)
-{
- if (!panel)
- return;
-
- m_bookmarkPanels.removeOne(panel);
- panel->disconnect(this);
-
- if (m_bookmarkPanels.isEmpty())
- emitChanged();
-}
-
-
-QAction* BookmarkManager::actionByName(const QString &name)
-{
- QAction *action = m_actionCollection->action(name);
- if (action)
- return action;
- return new QAction(this);
-}
-
-
-KBookmarkGroup BookmarkManager::rootGroup()
-{
- return m_manager->root();
-}
-
-
-QList<KBookmark> BookmarkManager::find(const QString &text)
-{
- QList<KBookmark> list;
-
- KBookmarkGroup root = rootGroup();
- if (!root.isNull())
- for (KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
- find(&list, bookmark, text);
-
- return list;
-}
-
-
-KBookmark BookmarkManager::bookmarkForUrl(const KUrl &url)
-{
- KBookmarkGroup root = rootGroup();
- if (root.isNull())
- return KBookmark();
-
- return bookmarkForUrl(root, url);
-}
-
-
-void BookmarkManager::slotBookmarksChanged()
-{
- Q_FOREACH(BookmarkToolBar * bookmarkToolBar, m_bookmarkToolBars)
- {
- if (bookmarkToolBar)
- {
- bookmarkToolBar->toolBar()->clear();
- fillBookmarkBar(bookmarkToolBar);
- }
- }
-
- // this update about:bookmarks page...
- if (rApp->mainWindow()
- && rApp->mainWindow()->currentTab()
- && rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks")
- )
- rApp->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab);
-
- emit bookmarksUpdated();
-}
-
-
-void BookmarkManager::fillBookmarkBar(BookmarkToolBar *toolBar)
-{
- KBookmarkGroup root = m_manager->toolbar();
- if (root.isNull())
- return;
-
- for (KBookmark bookmark = root.first(); !bookmark.isNull(); bookmark = root.next(bookmark))
- {
- if (bookmark.isGroup())
- {
- KBookmarkActionMenu *menuAction = new KBookmarkActionMenu(bookmark.toGroup(), this);
- menuAction->setDelayed(false);
- BookmarkMenu *bMenu = new BookmarkMenu(m_manager, m_owner, menuAction->menu(), bookmark.address());
- bMenu->setParent(menuAction->menu());
-
- connect(menuAction->menu(), SIGNAL(aboutToShow()), toolBar, SLOT(menuDisplayed()));
- connect(menuAction->menu(), SIGNAL(aboutToHide()), toolBar, SLOT(menuHidden()));
-
- toolBar->toolBar()->addAction(menuAction);
- toolBar->toolBar()->widgetForAction(menuAction)->installEventFilter(toolBar);
- }
- else if (bookmark.isSeparator())
- {
- toolBar->toolBar()->addSeparator();
- }
- else
- {
- KBookmarkAction *action = new KBookmarkAction(bookmark, m_owner, this);
- action->setIcon(rApp->iconManager()->iconForUrl(KUrl(bookmark.url())));
- connect(action, SIGNAL(hovered()), toolBar, SLOT(actionHovered()));
- toolBar->toolBar()->addAction(action);
- toolBar->toolBar()->widgetForAction(action)->installEventFilter(toolBar);
- }
- }
-}
-
-
-void BookmarkManager::slotPanelChanged()
-{
- Q_FOREACH(BookmarksPanel * panel, m_bookmarkPanels)
- {
- if (panel && panel != sender())
- panel->loadFoldedState();
- }
- if (rApp->mainWindow()
- && rApp->mainWindow()->currentTab()
- && rApp->mainWindow()->currentTab()->url().toMimeDataString().contains("about:bookmarks")
- )
- rApp->loadUrl(KUrl("about:bookmarks"), Rekonq::CurrentTab);
-}
-
-
-void BookmarkManager::find(QList<KBookmark> *list, const KBookmark &bookmark, const QString &text)
-{
- if (bookmark.isGroup())
- {
- KBookmarkGroup group = bookmark.toGroup();
- for (KBookmark bm = group.first(); !bm.isNull(); bm = group.next(bm))
- find(list, bm, text);
- }
- else
- {
- QStringList words = text.split(' ');
- bool matches = true;
- Q_FOREACH(const QString & word, words)
- {
- if (!bookmark.url().url().contains(word, Qt::CaseInsensitive)
- && !bookmark.fullText().contains(word, Qt::CaseInsensitive))
- {
- matches = false;
- break;
- }
- }
- if (matches)
- *list << bookmark;
- }
-}
-
-
-KBookmark BookmarkManager::bookmarkForUrl(const KBookmark &bookmark, const KUrl &url)
-{
- KBookmark found;
-
- if (bookmark.isGroup())
- {
- KBookmarkGroup group = bookmark.toGroup();
- KBookmark bookmark = group.first();
-
- while (!bookmark.isNull() && found.isNull())
- {
- found = bookmarkForUrl(bookmark, url);
- bookmark = group.next(bookmark);
- }
- }
- else if (!bookmark.isSeparator() && bookmark.url() == url)
- {
- found = bookmark;
- }
-
- return found;
-}
-
-
-void BookmarkManager::copyBookmarkGroup(const KBookmarkGroup &groupToCopy, KBookmarkGroup destGroup)
-{
- KBookmark bookmark = groupToCopy.first();
- while (!bookmark.isNull())
- {
- if (bookmark.isGroup())
- {
- KBookmarkGroup newDestGroup = destGroup.createNewFolder(bookmark.text());
- if (bookmark.toGroup().isToolbarGroup())
- {
- newDestGroup.internalElement().setAttribute("toolbar", "yes");
- newDestGroup.setIcon("bookmark-toolbar");
- }
- copyBookmarkGroup(bookmark.toGroup(), newDestGroup);
- }
- else if (bookmark.isSeparator())
- {
- destGroup.createNewSeparator();
- }
- else
- {
- destGroup.addBookmark(bookmark.text(), bookmark.url());
- }
- bookmark = groupToCopy.next(bookmark);
- }
-}
-
-
-void BookmarkManager::slotEditBookmarks()
-{
- m_manager->slotEditBookmarks();
-}
-
-
-KBookmark BookmarkManager::findByAddress(const QString &address)
-{
- return m_manager->findByAddress(address);
-}
-
-
-void BookmarkManager::openFolderinTabs(const KBookmarkGroup &bm)
-{
- m_owner->openFolderinTabs(bm);
-}
-
-
-void BookmarkManager::emitChanged()
-{
- m_manager->emitChanged();
-}
diff --git a/src/bookmarks/bookmarkmanager.h b/src/bookmarks/bookmarkmanager.h
deleted file mode 100644
index e5528a8a..00000000
--- a/src/bookmarks/bookmarkmanager.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2010 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef BOOKMARK_MANAGER_H
-#define BOOKMARK_MANAGER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KBookmark>
-
-// Qt Includes
-#include <QObject>
-
-// Forward Declarations
-class BookmarksPanel;
-class BookmarkToolBar;
-class BookmarkOwner;
-class BookmarkMenu;
-
-class KAction;
-class KActionCollection;
-class KActionMenu;
-class KBookmarkGroup;
-class KBookmarkManager;
-class KUrl;
-
-class QAction;
-
-
-/**
- * This class represent the interface to rekonq bookmarks system.
- * All rekonq needs (Bookmarks Menu, Bookmarks Toolbar) is provided
- * from this class.
- * So it implements code to have each one.
- */
-class BookmarkManager : public QObject
-{
- Q_OBJECT
-
-public:
- /**
- * @short Class constructor.
- * Connect BookmarksProvider with bookmarks source
- * (actually konqueror's bookmarks).
- * @param parent The MainWindow to provide bookmarks objects.
- */
- BookmarkManager(QObject *parent = 0);
- ~BookmarkManager();
-
- /**
- * @short Get the Bookmarks Menu Action
- * @param the parent widget
- * @return the Bookmarks Menu
- */
- KActionMenu* bookmarkActionMenu(QWidget *parent);
-
- /**
- * @short set the Bookmarks Toolbar Action
- */
- void registerBookmarkBar(BookmarkToolBar *toolbar);
- void removeBookmarkBar(BookmarkToolBar *toolbar);
-
- void registerBookmarkPanel(BookmarksPanel *panel);
- void removeBookmarkPanel(BookmarksPanel *panel);
-
- /**
- * @short Get action by name
- * This method returns poiner bookmark action of given name.
- * @pre m_actionCollection != NULL
- * @param name Name of action you want to get
- * @return It returns actions if one exists or empty object
- */
- QAction* actionByName(const QString &name);
-
- /**
- * returns Bookmark Manager root group
- *
- * @return the root bookmark group
- */
- KBookmarkGroup rootGroup();
-
- inline KBookmarkManager* manager()
- {
- return m_manager;
- }
-
- inline BookmarkOwner* owner()
- {
- return m_owner;
- }
-
- QList<KBookmark> find(const QString &text);
-
- KBookmark bookmarkForUrl(const KUrl &url);
-
- KBookmark findByAddress(const QString &);
- void openFolderinTabs(const KBookmarkGroup &bm);
- void emitChanged();
-
- static inline QString bookmark_mime_type()
- {
- return QL1S("application/x-rekonq-bookmark");
- }
-
-public Q_SLOTS:
- /**
- * @short Waits for signal that the group with the address has been modified by the caller.
- * Waits for signal that the group (or any of its children) with the address
- * @p groupAddress (e.g. "/4/5") has been modified by the caller @p caller.
- * @param groupAddress bookmark group address
- * @param caller caller that modified the bookmarks
- * @see KBookmarkManager::changed
- */
- void slotBookmarksChanged();
- void fillBookmarkBar(BookmarkToolBar *toolBar);
-
- void slotEditBookmarks();
-
-private Q_SLOTS:
- void slotPanelChanged();
-
-Q_SIGNALS:
- /**
- * @short This signal is emitted when an url has to be loaded
- */
- void openUrl(const KUrl &, const Rekonq::OpenType &);
-
- void bookmarksUpdated();
-
-private:
- void find(QList<KBookmark> *list, const KBookmark &bookmark, const QString &text);
- KBookmark bookmarkForUrl(const KBookmark &bookmark, const KUrl &url);
- void copyBookmarkGroup(const KBookmarkGroup &groupToCopy, KBookmarkGroup destGroup);
-
- KBookmarkManager *m_manager;
- BookmarkOwner *m_owner;
- KActionCollection *m_actionCollection;
- QList<BookmarkToolBar *> m_bookmarkToolBars;
- QList<BookmarksPanel *> m_bookmarkPanels;
-};
-
-
-#endif // BOOKMARK_MANAGER_H
diff --git a/src/bookmarks/bookmarkowner.cpp b/src/bookmarks/bookmarkowner.cpp
deleted file mode 100644
index 430ec5c3..00000000
--- a/src/bookmarks/bookmarkowner.cpp
+++ /dev/null
@@ -1,428 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2010 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "bookmarkowner.h"
-#include "bookmarkowner.moc"
-
-// Local Includes
-#include "application.h"
-#include "bookmarkmanager.h"
-#include "mainview.h"
-#include "mainwindow.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KBookmarkDialog>
-#include <KLocalizedString>
-#include <KMessageBox>
-
-// Qt Includes
-#include <QClipboard>
-
-// Nepomuk config include
-#include "config-nepomuk.h"
-
-#ifdef HAVE_NEPOMUK
-// Local Nepomuk Includes
-#include "resourcelinkdialog.h"
-
-// Nepomuk Includes
-#include <Nepomuk/Resource>
-#include <Nepomuk/Vocabulary/NFO>
-#endif
-
-
-BookmarkOwner::BookmarkOwner(KBookmarkManager *manager, QObject *parent)
- : QObject(parent)
- , KBookmarkOwner()
- , m_manager(manager)
-{
-}
-
-
-KAction* BookmarkOwner::createAction(const KBookmark &bookmark, const BookmarkAction &bmAction)
-{
- switch (bmAction)
- {
- case OPEN:
- return createAction(i18n("Open"), "tab-new",
- i18n("Open bookmark in current tab"), SLOT(openBookmark(KBookmark)), bookmark);
- case OPEN_IN_TAB:
- return createAction(i18n("Open in New Tab"), "tab-new",
- i18n("Open bookmark in new tab"), SLOT(openBookmarkInNewTab(KBookmark)), bookmark);
- case OPEN_IN_WINDOW:
- return createAction(i18n("Open in New Window"), "window-new",
- i18n("Open bookmark in new window"), SLOT(openBookmarkInNewWindow(KBookmark)), bookmark);
- case OPEN_FOLDER:
- return createAction(i18n("Open Folder in Tabs"), "tab-new",
- i18n("Open all the bookmarks in folder in tabs"), SLOT(openBookmarkFolder(KBookmark)), bookmark);
- case BOOKMARK_PAGE:
- return createAction(i18n("Add Bookmark"), "bookmark-new",
- i18n("Bookmark current page"), SLOT(bookmarkCurrentPage(KBookmark)), bookmark);
- case NEW_FOLDER:
- return createAction(i18n("New Folder"), "folder-new",
- i18n("Create a new bookmark folder"), SLOT(newBookmarkFolder(KBookmark)), bookmark);
- case NEW_SEPARATOR:
- return createAction(i18n("New Separator"), "edit-clear",
- i18n("Create a new bookmark separator"), SLOT(newSeparator(KBookmark)), bookmark);
- case COPY:
- return createAction(i18n("Copy Link"), "edit-copy",
- i18n("Copy the bookmark's link address"), SLOT(copyLink(KBookmark)), bookmark);
- case EDIT:
- return createAction(i18n("Edit"), "configure",
- i18n("Edit the bookmark"), SLOT(editBookmark(KBookmark)), bookmark);
-#ifdef HAVE_NEPOMUK
- case FANCYBOOKMARK:
- return createAction(i18n("Fancy Bookmark"), "nepomuk",
- i18n("Link Nepomuk resources"), SLOT(fancyBookmark(KBookmark)), bookmark);
-#endif
- case DELETE:
- return createAction(i18n("Delete"), "edit-delete",
- i18n("Delete the bookmark"), SLOT(deleteBookmark(KBookmark)), bookmark);
- case SET_TOOLBAR_FOLDER:
- return createAction(i18n("Set as toolbar folder"), "bookmark-toolbar",
- "", SLOT(setToolBarFolder(KBookmark)), bookmark);
- case UNSET_TOOLBAR_FOLDER:
- return createAction(i18n("Unset this folder as the toolbar folder"), "bookmark-toolbar",
- "", SLOT(unsetToolBarFolder()), bookmark);
- default:
- ASSERT_NOT_REACHED(unknown BookmarkAction);
- return 0;
- }
-}
-
-
-QString BookmarkOwner::currentTitle() const
-{
- return rApp->mainWindow()->currentTab()->view()->title();
-}
-
-
-QString BookmarkOwner::currentUrl() const
-{
- return rApp->mainWindow()->currentTab()->url().url();
-}
-
-
-QList< QPair<QString, QString> > BookmarkOwner::currentBookmarkList() const
-{
- QList< QPair<QString, QString> > bkList;
- MainView *view = rApp->mainWindow()->mainView();
- int tabNumber = view->count();
-
- for (int i = 0; i < tabNumber; ++i)
- {
- QPair<QString, QString> item;
- item.first = view->webTab(i)->view()->title();
- item.second = view->webTab(i)->url().url();
- bkList << item;
- }
-
- return bkList;
-}
-
-
-void BookmarkOwner::openBookmark(const KBookmark &bookmark,
- Qt::MouseButtons mouseButtons,
- Qt::KeyboardModifiers keyboardModifiers)
-{
- if (keyboardModifiers & Qt::ControlModifier || mouseButtons & Qt::MidButton)
- openBookmarkInNewTab(bookmark);
- else
- openBookmark(bookmark);
-}
-
-
-void BookmarkOwner::openFolderinTabs(const KBookmarkGroup &bkGoup)
-{
- QList<KUrl> urlList = bkGoup.groupUrlList();
-
- if (urlList.length() > 8)
- {
- if (KMessageBox::warningContinueCancel(
- rApp->mainWindow(),
- i18ncp("%1=Number of tabs. Value is always >=8",
- "You are about to open %1 tabs.\nAre you sure?",
- "You are about to open %1 tabs.\nAre you sure?", urlList.length()))
- != KMessageBox::Continue
- )
- return;
- }
-
- Q_FOREACH(const KUrl & url, urlList)
- {
- emit openUrl(url, Rekonq::NewFocusedTab);
- }
-}
-
-
-void BookmarkOwner::openBookmark(const KBookmark &bookmark)
-{
- emit openUrl(bookmark.url(), Rekonq::CurrentTab);
-}
-
-
-void BookmarkOwner::openBookmarkInNewTab(const KBookmark &bookmark)
-{
- emit openUrl(bookmark.url(), Rekonq::NewTab);
-}
-
-
-void BookmarkOwner::openBookmarkInNewWindow(const KBookmark &bookmark)
-{
- emit openUrl(bookmark.url(), Rekonq::NewWindow);
-}
-
-
-void BookmarkOwner::openBookmarkFolder(const KBookmark &bookmark)
-{
- Q_ASSERT(bookmark.isGroup());
- openFolderinTabs(bookmark.toGroup());
-}
-
-
-KBookmark BookmarkOwner::bookmarkCurrentPage(const KBookmark &bookmark)
-{
- KBookmarkGroup parent;
-
- if (!bookmark.isNull())
- {
- if (bookmark.isGroup())
- parent = bookmark.toGroup();
- else
- parent = bookmark.parentGroup();
- }
- else
- {
- parent = rApp->bookmarkManager()->rootGroup();
-#ifdef HAVE_NEPOMUK
- Nepomuk::Resource nfoResource;
- nfoResource = ((QUrl)currentUrl());
- nfoResource.addType(Nepomuk::Vocabulary::NFO::Website());
- nfoResource.setLabel(currentTitle());
-#endif
- }
-
- KBookmark newBk = parent.addBookmark(currentTitle(), KUrl(currentUrl()));
- if (!bookmark.isNull())
- parent.moveBookmark(newBk, bookmark);
-
- m_manager->emitChanged(parent);
- return newBk;
-}
-
-
-KBookmarkGroup BookmarkOwner::newBookmarkFolder(const KBookmark &bookmark)
-{
- KBookmarkGroup newBk;
- KBookmarkDialog *dialog = bookmarkDialog(m_manager, 0);
- QString folderName = i18n("New folder");
-
- if (!bookmark.isNull())
- {
- if (bookmark.isGroup())
- {
- newBk = dialog->createNewFolder(folderName, bookmark);
- }
- else
- {
- newBk = dialog->createNewFolder(folderName, bookmark.parentGroup());
- if (!newBk.isNull())
- {
- KBookmarkGroup parent = newBk.parentGroup();
- parent.moveBookmark(newBk, bookmark);
- m_manager->emitChanged(parent);
- }
- }
- }
- else
- {
- newBk = dialog->createNewFolder(folderName);
- }
-
- delete dialog;
- return newBk;
-}
-
-
-KBookmark BookmarkOwner::newSeparator(const KBookmark &bookmark)
-{
- KBookmark newBk;
-
- if (!bookmark.isNull())
- {
- if (bookmark.isGroup())
- {
- newBk = bookmark.toGroup().createNewSeparator();
- }
- else
- {
- newBk = bookmark.parentGroup().createNewSeparator();
- newBk.parentGroup().moveBookmark(newBk, bookmark);
- }
- }
- else
- {
- newBk = rApp->bookmarkManager()->rootGroup().createNewSeparator();
- }
-
- newBk.setIcon("edit-clear");
-
- m_manager->emitChanged(newBk.parentGroup());
- return newBk;
-}
-
-
-void BookmarkOwner::copyLink(const KBookmark &bookmark)
-{
- if (bookmark.isNull())
- return;
-
- QApplication::clipboard()->setText(bookmark.url().url());
-}
-
-
-void BookmarkOwner::editBookmark(KBookmark bookmark)
-{
- if (bookmark.isNull())
- return;
-
- KBookmarkDialog *dialog = bookmarkDialog(m_manager, 0);
- dialog->editBookmark(bookmark);
-
- delete dialog;
-}
-
-
-#ifdef HAVE_NEPOMUK
-void BookmarkOwner::fancyBookmark(KBookmark bookmark)
-{
- Nepomuk::Resource nfoResource = (KUrl)bookmark.url();
- Nepomuk::ResourceLinkDialog r(nfoResource);
- r.exec();
-
-}
-#endif
-
-bool BookmarkOwner::deleteBookmark(const KBookmark &bookmark)
-{
- if (bookmark.isNull())
- return false;
-
- KBookmarkGroup bmg = bookmark.parentGroup();
- QString dialogCaption, dialogText;
-
- if (bookmark.isGroup())
- {
- dialogCaption = i18n("Bookmark Folder Deletion");
- dialogText = i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bookmark.fullText());
- }
- else if (bookmark.isSeparator())
- {
- dialogCaption = i18n("Separator Deletion");
- dialogText = i18n("Are you sure you wish to remove this separator?");
- }
- else
- {
- dialogCaption = i18n("Bookmark Deletion");
- dialogText = i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bookmark.fullText());
- }
-
- if (KMessageBox::warningContinueCancel(
- 0,
- dialogText,
- dialogCaption,
- KStandardGuiItem::del(),
- KStandardGuiItem::cancel(),
- "bookmarkDeletition_askAgain")
- != KMessageBox::Continue
- )
- return false;
-
- bmg.deleteBookmark(bookmark);
-#ifdef HAVE_NEPOMUK
- Nepomuk::Resource nfoResource(bookmark.url());
- nfoResource.remove();
-#endif
- m_manager->emitChanged(bmg);
- return true;
-}
-
-
-void BookmarkOwner::setToolBarFolder(KBookmark bookmark)
-{
- if (!bookmark.isGroup())
- return;
-
- unsetToolBarFolder();
- bookmark.internalElement().setAttribute("toolbar", "yes");
- bookmark.setIcon("bookmark-toolbar");
-
- m_manager->emitChanged();
-}
-
-
-void BookmarkOwner::unsetToolBarFolder()
-{
- KBookmarkGroup toolbar = m_manager->toolbar();
- if (!toolbar.isNull())
- {
- toolbar.internalElement().setAttribute("toolbar", "no");
- toolbar.setIcon("");
- }
- m_manager->emitChanged();
-}
-
-
-KAction* BookmarkOwner::createAction(const QString &text, const QString &icon,
- const QString &help, const char *slot,
- const KBookmark &bookmark)
-{
- CustomBookmarkAction *act = new CustomBookmarkAction(bookmark, KIcon(icon), text, this);
- act->setHelpText(help);
- connect(act, SIGNAL(triggered(KBookmark)), this, slot);
- return act;
-}
-
-
-// -------------------------------------------------------------------------------------------------
-
-
-CustomBookmarkAction::CustomBookmarkAction(const KBookmark &bookmark, const KIcon &icon, const QString &text, QObject *parent)
- : KAction(icon, text, parent)
- , m_bookmark(bookmark)
-{
- connect(this, SIGNAL(triggered()), this, SLOT(onActionTriggered()));
-}
-
-void CustomBookmarkAction::onActionTriggered()
-{
- emit triggered(m_bookmark);
-}
diff --git a/src/bookmarks/bookmarkowner.h b/src/bookmarks/bookmarkowner.h
deleted file mode 100644
index f0b238b9..00000000
--- a/src/bookmarks/bookmarkowner.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2010 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef BOOKMARKOWNER_H
-#define BOOKMARKOWNER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Nepomuk config include
-#include "config-nepomuk.h"
-
-// KDE Includes
-#include <KAction>
-#include <KBookmarkOwner>
-
-
-/**
- * This class allows to manage bookmarks as actions.
- */
-class REKONQ_TESTS_EXPORT BookmarkOwner : public QObject, public KBookmarkOwner
-{
- Q_OBJECT
-
-public:
- explicit BookmarkOwner(KBookmarkManager *manager, QObject *parent = 0);
-
- enum BookmarkAction
- {
- OPEN = 0,
- OPEN_IN_TAB,
- OPEN_IN_WINDOW,
- OPEN_FOLDER,
- BOOKMARK_PAGE,
- NEW_FOLDER,
- NEW_SEPARATOR,
- COPY,
- EDIT,
-#ifdef HAVE_NEPOMUK
- FANCYBOOKMARK,
-#endif
- DELETE,
- NUM_ACTIONS,
- SET_TOOLBAR_FOLDER,
- UNSET_TOOLBAR_FOLDER
- };
-
- /**
- * @return A new action for the given bookmark.
- */
- KAction* createAction(const KBookmark &bookmark, const BookmarkAction &bmAction);
-
- // @{
- /**
- * Functions to get current information.
- */
- virtual QString currentTitle() const;
- virtual QString currentUrl() const;
- virtual QList< QPair<QString, QString> > currentBookmarkList() const;
- // @}
-
- virtual bool supportsTabs() const
- {
- return true;
- }
-
- // @{
- /**
- * This functions emit signals that open the selected URLs
- */
- virtual void openBookmark(const KBookmark &bookmark,
- Qt::MouseButtons mouseButtons,
- Qt::KeyboardModifiers keyboardModifiers);
- virtual void openFolderinTabs(const KBookmarkGroup &bkGoup);
- // @}
-
-public Q_SLOTS:
- void openBookmark(const KBookmark &bookmark);
- void openBookmarkInNewTab(const KBookmark &bookmark);
- void openBookmarkInNewWindow(const KBookmark &bookmark);
- void openBookmarkFolder(const KBookmark &bookmark);
-
- KBookmark bookmarkCurrentPage(const KBookmark &bookmark = KBookmark());
- KBookmarkGroup newBookmarkFolder(const KBookmark &bookmark = KBookmark());
- KBookmark newSeparator(const KBookmark &bookmark = KBookmark());
-
- void copyLink(const KBookmark &bookmark);
- void editBookmark(KBookmark bookmark);
-#ifdef HAVE_NEPOMUK
- void fancyBookmark(KBookmark bookmark);
-#endif
- bool deleteBookmark(const KBookmark &bookmark);
- void setToolBarFolder(KBookmark bookmark = KBookmark());
- void unsetToolBarFolder();
-
-Q_SIGNALS:
- /**
- * This signal is emitted when an url has to be loaded
- * @param url the URL to load
- */
- void openUrl(const KUrl &, const Rekonq::OpenType &);
-
-private:
- KAction* createAction(const QString &text, const QString &icon,
- const QString &help, const char *slot,
- const KBookmark &bookmark);
-
- KBookmarkManager *m_manager;
-};
-
-
-// -----------------------------------------------------------------------------------------------
-
-
-class CustomBookmarkAction : public KAction
-{
- Q_OBJECT
-
-public:
- CustomBookmarkAction(const KBookmark &bookmark, const KIcon &icon, const QString &text, QObject *parent);
-
-Q_SIGNALS:
- void triggered(const KBookmark &);
-
-private Q_SLOTS:
- void onActionTriggered();
-
-private:
- KBookmark m_bookmark;
-};
-
-#endif // BOOKMARKOWNER_H
diff --git a/src/bookmarks/bookmarkscontextmenu.cpp b/src/bookmarks/bookmarkscontextmenu.cpp
deleted file mode 100644
index 65f7994f..00000000
--- a/src/bookmarks/bookmarkscontextmenu.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "bookmarkscontextmenu.h"
-
-// Nepomuk config include
-#include "config-nepomuk.h"
-
-// Local Includes
-#include "bookmarkowner.h"
-#include "bookmarkmanager.h"
-#include "application.h"
-
-// KDE Includes
-#include <KBookmarkManager>
-
-
-BookmarksContextMenu::BookmarksContextMenu(const KBookmark &bookmark,
- KBookmarkManager *manager,
- BookmarkOwner *owner,
- bool nullForced,
- QWidget *parent
- )
- : KBookmarkContextMenu(bookmark, manager, owner, parent)
- , m_bmOwner(owner)
- , m_nullForced(nullForced)
-{
-}
-
-
-void BookmarksContextMenu::addBookmarkActions()
-{
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::OPEN_IN_TAB));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::OPEN_IN_WINDOW));
-
- addSeparator();
-
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::BOOKMARK_PAGE));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_FOLDER));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_SEPARATOR));
-
- addSeparator();
-
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::COPY));
-
- addSeparator();
-
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::EDIT));
-#ifdef HAVE_NEPOMUK
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::FANCYBOOKMARK));
-#endif
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::DELETE));
-}
-
-
-void BookmarksContextMenu::addFolderActions()
-{
- KBookmarkGroup group = bookmark().toGroup();
-
- if (bookmark().internalElement().attributeNode("toolbar").value() == "yes")
- {
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::UNSET_TOOLBAR_FOLDER));
- }
- else
- {
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::SET_TOOLBAR_FOLDER));
- }
-
- if (!group.first().isNull())
- {
- KBookmark child = group.first();
-
- while (child.isGroup() || child.isSeparator())
- {
- child = group.next(child);
- }
-
- if (!child.isNull())
- {
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::OPEN_FOLDER));
- addSeparator();
- }
- }
-
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::BOOKMARK_PAGE));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_FOLDER));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_SEPARATOR));
-
- addSeparator();
-
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::EDIT));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::DELETE));
-}
-
-
-void BookmarksContextMenu::addSeparatorActions()
-{
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::BOOKMARK_PAGE));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_FOLDER));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_SEPARATOR));
-
- addSeparator();
-
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::DELETE));
-}
-
-
-void BookmarksContextMenu::addNullActions()
-{
- KBookmarkManager *mngr = rApp->bookmarkManager()->manager();
- if (mngr->toolbar().hasParent())
- {
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::UNSET_TOOLBAR_FOLDER));
- }
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::BOOKMARK_PAGE));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_FOLDER));
- addAction(m_bmOwner->createAction(bookmark(), BookmarkOwner::NEW_SEPARATOR));
-}
-
-
-void BookmarksContextMenu::addActions()
-{
- if (bookmark().isNull() || m_nullForced)
- {
- addNullActions();
- }
- else if (bookmark().isSeparator())
- {
- addSeparatorActions();
- }
- else if (bookmark().isGroup())
- {
- addFolderActions();
- }
- else
- {
- addBookmarkActions();
- }
-}
diff --git a/src/bookmarks/bookmarkscontextmenu.h b/src/bookmarks/bookmarkscontextmenu.h
deleted file mode 100644
index c927f3a6..00000000
--- a/src/bookmarks/bookmarkscontextmenu.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef BOOKMARKS_CONTEXT_MENU_H
-#define BOOKMARKS_CONTEXT_MENU_H
-
-// KDE Includes
-#include <KBookmarkMenu>
-
-// Forward Declarations
-class BookmarkOwner;
-
-
-class BookmarksContextMenu : public KBookmarkContextMenu
-{
-public:
- BookmarksContextMenu(const KBookmark &bookmark,
- KBookmarkManager *manager,
- BookmarkOwner *owner,
- bool nullForced = false,
- QWidget *parent = 0);
- virtual void addActions();
-
-private:
- void addFolderActions();
- void addBookmarkActions();
- void addSeparatorActions();
- void addNullActions();
-
- BookmarkOwner *m_bmOwner;
- bool m_nullForced;
-};
-
-#endif // BOOKMARKS_CONTEXT_MENU_H
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp
deleted file mode 100644
index 2b2a7ea9..00000000
--- a/src/bookmarks/bookmarkspanel.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Nils Weigel <nehlsen at gmail dot com>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "bookmarkspanel.h"
-#include "bookmarkspanel.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "bookmarkmanager.h"
-#include "bookmarkstreemodel.h"
-#include "bookmarkscontextmenu.h"
-#include "bookmarkowner.h"
-#include "paneltreeview.h"
-#include "urlfilterproxymodel.h"
-
-
-BookmarksPanel::BookmarksPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
- : UrlPanel(title, parent, flags)
- , _bkTreeModel(new BookmarksTreeModel(this))
- , _loadingState(false)
-{
- setObjectName("bookmarksPanel");
- setVisible(ReKonfig::showBookmarksPanel());
- panelTreeView()->setDragEnabled(true);
- panelTreeView()->setAcceptDrops(true);
- connect(_bkTreeModel, SIGNAL(bookmarksUpdated()), this, SLOT(loadFoldedState()));
-}
-
-
-BookmarksPanel::~BookmarksPanel()
-{
- ReKonfig::setShowBookmarksPanel(!isHidden());
-}
-
-
-void BookmarksPanel::loadFoldedState()
-{
- _loadingState = true;
- loadFoldedState(QModelIndex());
- _loadingState = false;
-}
-
-
-void BookmarksPanel::contextMenu(const QPoint &pos)
-{
- if (_loadingState)
- return;
-
- BookmarksContextMenu menu(bookmarkForIndex(panelTreeView()->indexAt(pos)),
- rApp->bookmarkManager()->manager(),
- rApp->bookmarkManager()->owner()
- );
-
- menu.exec(panelTreeView()->mapToGlobal(pos));
-}
-
-
-void BookmarksPanel::deleteBookmark()
-{
- QModelIndex index = panelTreeView()->currentIndex();
- if (_loadingState || !index.isValid())
- return;
-
- rApp->bookmarkManager()->owner()->deleteBookmark(bookmarkForIndex(index));
-}
-
-
-void BookmarksPanel::onCollapse(const QModelIndex &index)
-{
- if (_loadingState)
- return;
-
- bookmarkForIndex(index).internalElement().setAttribute("folded", "yes");
- emit expansionChanged();
-}
-
-
-void BookmarksPanel::onExpand(const QModelIndex &index)
-{
- if (_loadingState)
- return;
-
- bookmarkForIndex(index).internalElement().setAttribute("folded", "no");
- emit expansionChanged();
-}
-
-
-void BookmarksPanel::setup()
-{
- UrlPanel::setup();
-
- connect(panelTreeView(), SIGNAL(delKeyPressed()), this, SLOT(deleteBookmark()));
- connect(panelTreeView(), SIGNAL(collapsed(QModelIndex)), this, SLOT(onCollapse(QModelIndex)));
- connect(panelTreeView(), SIGNAL(expanded(QModelIndex)), this, SLOT(onExpand(QModelIndex)));
-
- loadFoldedState();
-}
-
-
-void BookmarksPanel::loadFoldedState(const QModelIndex &root)
-{
- QAbstractItemModel *model = panelTreeView()->model();
- if (!model)
- return;
-
- int count = model->rowCount(root);
- QModelIndex index;
-
- for (int i = 0; i < count; ++i)
- {
- index = model->index(i, 0, root);
- if (index.isValid())
- {
- KBookmark bm = bookmarkForIndex(index);
- if (bm.isGroup())
- {
- panelTreeView()->setExpanded(index, bm.toGroup().isOpen());
- loadFoldedState(index);
- }
- }
- }
-}
-
-
-KBookmark BookmarksPanel::bookmarkForIndex(const QModelIndex &index)
-{
- if (!index.isValid())
- return KBookmark();
-
- const UrlFilterProxyModel *proxyModel = static_cast<const UrlFilterProxyModel*>(index.model());
- QModelIndex originalIndex = proxyModel->mapToSource(index);
-
- BtmItem *node = static_cast<BtmItem*>(originalIndex.internalPointer());
- return node->getBkm();
-}
-
-
-QAbstractItemModel* BookmarksPanel::model()
-{
- return _bkTreeModel;
-}
diff --git a/src/bookmarks/bookmarkspanel.h b/src/bookmarks/bookmarkspanel.h
deleted file mode 100644
index 796b8315..00000000
--- a/src/bookmarks/bookmarkspanel.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Nils Weigel <nehlsen at gmail dot com>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef BOOKMARKSPANEL_H
-#define BOOKMARKSPANEL_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "urlpanel.h"
-
-// Forward Declarations
-class BookmarksTreeModel;
-
-class KBookmark;
-class QModelIndex;
-
-
-class REKONQ_TESTS_EXPORT BookmarksPanel : public UrlPanel
-{
- Q_OBJECT
-
-public:
- explicit BookmarksPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
- ~BookmarksPanel();
-
-public Q_SLOTS:
- void loadFoldedState();
-
-Q_SIGNALS:
- void expansionChanged();
-
-private Q_SLOTS:
- void contextMenu(const QPoint &pos);
-
- virtual void contextMenuItem(const QPoint &pos)
- {
- contextMenu(pos);
- }
- virtual void contextMenuGroup(const QPoint &pos)
- {
- contextMenu(pos);
- }
- virtual void contextMenuEmpty(const QPoint &pos)
- {
- contextMenu(pos);
- }
-
- void deleteBookmark();
- void onCollapse(const QModelIndex &index);
- void onExpand(const QModelIndex &index);
-
-private:
- virtual void setup();
-
- void loadFoldedState(const QModelIndex &root);
-
- KBookmark bookmarkForIndex(const QModelIndex &index);
-
- virtual QAbstractItemModel* model();
-
- BookmarksTreeModel *_bkTreeModel;
- bool _loadingState;
-};
-
-#endif // BOOKMARKSPANEL_H
diff --git a/src/bookmarks/bookmarkstoolbar.cpp b/src/bookmarks/bookmarkstoolbar.cpp
deleted file mode 100644
index ad8af326..00000000
--- a/src/bookmarks/bookmarkstoolbar.cpp
+++ /dev/null
@@ -1,624 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "bookmarkstoolbar.h"
-#include "bookmarkstoolbar.moc"
-
-// Local Includes
-#include "iconmanager.h"
-#include "bookmarkscontextmenu.h"
-#include "mainwindow.h"
-#include "application.h"
-#include "bookmarkmanager.h"
-#include "bookmarkowner.h"
-#include "webtab.h"
-
-// Qt Includes
-#include <QtGui/QFrame>
-#include <QtGui/QActionEvent>
-
-
-BookmarkMenu::BookmarkMenu(KBookmarkManager *manager,
- KBookmarkOwner *owner,
- KMenu *menu,
- KActionCollection* actionCollection)
- : KBookmarkMenu(manager, owner, menu, actionCollection)
-{
-}
-
-
-BookmarkMenu::BookmarkMenu(KBookmarkManager *manager,
- KBookmarkOwner *owner,
- KMenu *parentMenu,
- const QString &parentAddress)
- : KBookmarkMenu(manager, owner, parentMenu, parentAddress)
-{
-}
-
-
-BookmarkMenu::~BookmarkMenu()
-{
- kDebug() << "Deleting BookmarkMenu.. See http://svn.reviewboard.kde.org/r/5606/ about.";
-}
-
-
-KMenu * BookmarkMenu::contextMenu(QAction *act)
-{
- KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(act);
- if (!action)
- return 0;
- return new BookmarksContextMenu(action->bookmark(), manager(), static_cast<BookmarkOwner*>(owner()));
-}
-
-
-QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark)
-{
- if (bookmark.isGroup())
- {
- KBookmarkActionMenu *actionMenu = new KBookmarkActionMenu(bookmark, this);
- BookmarkMenu *menu = new BookmarkMenu(manager(), owner(), actionMenu->menu(), bookmark.address());
- // An hack to get rid of bug 219274
- connect(actionMenu, SIGNAL(hovered()), menu, SLOT(slotAboutToShow()));
- return actionMenu;
- }
- else if (bookmark.isSeparator())
- {
- return KBookmarkMenu::actionForBookmark(bookmark);
- }
- else
- {
- KBookmarkAction *action = new KBookmarkAction(bookmark, owner(), this);
- action->setIcon(rApp->iconManager()->iconForUrl(KUrl(bookmark.url())));
- connect(action, SIGNAL(hovered()), this, SLOT(actionHovered()));
- return action;
- }
-}
-
-
-void BookmarkMenu::refill()
-{
- clear();
- fillBookmarks();
-
- if (parentMenu()->actions().count() > 0)
- parentMenu()->addSeparator();
-
- if (isRoot())
- {
- addAddBookmarksList();
- addEditBookmarks();
- }
- else
- {
- addOpenFolderInTabs();
- addAddBookmarksList();
- }
-}
-
-
-void BookmarkMenu::addOpenFolderInTabs()
-{
- KBookmarkGroup group = manager()->findByAddress(parentAddress()).toGroup();
-
- if (!group.first().isNull())
- {
- KBookmark bookmark = group.first();
-
- while (bookmark.isGroup() || bookmark.isSeparator())
- {
- bookmark = group.next(bookmark);
- }
-
- if (!bookmark.isNull())
- {
- parentMenu()->addAction(rApp->bookmarkManager()->owner()->createAction(group, BookmarkOwner::OPEN_FOLDER));
- }
- }
-}
-
-
-void BookmarkMenu::actionHovered()
-{
- KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(sender());
- if (action)
- rApp->mainWindow()->notifyMessage(action->bookmark().url().url());
-}
-
-
-// ------------------------------------------------------------------------------------------------------
-
-
-BookmarkToolBar::BookmarkToolBar(KToolBar *toolBar, QObject *parent)
- : QObject(parent)
- , m_toolBar(toolBar)
- , m_currentMenu(0)
- , m_dragAction(0)
- , m_dropAction(0)
- , m_checkedAction(0)
- , m_filled(false)
-{
- toolBar->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(toolBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
- connect(rApp->bookmarkManager()->manager(), SIGNAL(changed(QString, QString)), this, SLOT(hideMenu()));
- toolBar->setAcceptDrops(true);
- toolBar->installEventFilter(this);
- toolBar->setShortcutEnabled(false);
-
- if (toolBar->isVisible())
- {
- rApp->bookmarkManager()->fillBookmarkBar(this);
- m_filled = true;
- }
-}
-
-
-KToolBar* BookmarkToolBar::toolBar()
-{
- return m_toolBar;
-}
-
-
-void BookmarkToolBar::contextMenu(const QPoint &point)
-{
- KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface*>(toolBar()->actionAt(point));
- KBookmark bookmark = rApp->bookmarkManager()->manager()->toolbar();
- bool nullAction = true;
- if (action)
- {
- bookmark = action->bookmark();
- nullAction = false;
- }
-
- BookmarksContextMenu menu(bookmark,
- rApp->bookmarkManager()->manager(),
- rApp->bookmarkManager()->owner(),
- nullAction);
- menu.exec(toolBar()->mapToGlobal(point));
-}
-
-
-void BookmarkToolBar::menuDisplayed()
-{
- qApp->installEventFilter(this);
- m_currentMenu = qobject_cast<KMenu*>(sender());
-}
-
-
-void BookmarkToolBar::menuHidden()
-{
- qApp->removeEventFilter(this);
- m_currentMenu = 0;
-}
-
-
-void BookmarkToolBar::hideMenu()
-{
- if (m_currentMenu)
- m_currentMenu->hide();
-}
-
-
-bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
-{
- if (m_currentMenu && m_currentMenu->isVisible()
- && !m_currentMenu->rect().contains(m_currentMenu->mapFromGlobal(QCursor::pos())))
- {
- // To switch root folders as in a menubar
-
- KBookmarkActionMenu* act = dynamic_cast<KBookmarkActionMenu *>(toolBar()->actionAt(toolBar()->mapFromGlobal(QCursor::pos())));
-
- if (event->type() == QEvent::MouseMove && act && act->menu() != m_currentMenu)
- {
- m_currentMenu->hide();
- QPoint pos = toolBar()->mapToGlobal(toolBar()->widgetForAction(act)->pos());
- act->menu()->popup(QPoint(pos.x(), pos.y() + toolBar()->widgetForAction(act)->height()));
- }
- else if (event->type() == QEvent::MouseButtonPress && act)
- {
- m_currentMenu->hide();
- }
-
- return QObject::eventFilter(watched, event);
- }
-
- switch (event->type())
- {
- case QEvent::Show:
- {
- if (!m_filled)
- {
- rApp->bookmarkManager()->fillBookmarkBar(this);
- m_filled = true;
- }
- }
- break;
-
- case QEvent::ActionRemoved:
- {
- QActionEvent *actionEvent = static_cast<QActionEvent*>(event);
- if (actionEvent && actionEvent->action() != m_dropAction)
- {
- QWidget *widget = toolBar()->widgetForAction(actionEvent->action());
- if (widget)
- {
- widget->removeEventFilter(this);
- }
- }
- }
- break;
-
- case QEvent::ParentChange:
- {
- QActionEvent *actionEvent = static_cast<QActionEvent*>(event);
- if (actionEvent && actionEvent->action() != m_dropAction)
- {
- QWidget *widget = toolBar()->widgetForAction(actionEvent->action());
- if (widget)
- {
- widget->removeEventFilter(this);
- }
- }
- }
- break;
-
- case QEvent::DragEnter:
- {
- QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent*>(event);
- if (dragEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type())
- || dragEvent->mimeData()->hasFormat("text/uri-list")
- || dragEvent->mimeData()->hasFormat("text/plain"))
- {
- QFrame* dropIndicatorWidget = new QFrame(toolBar());
- dropIndicatorWidget->setFrameShape(QFrame::VLine);
- m_dropAction = toolBar()->insertWidget(toolBar()->actionAt(dragEvent->pos()), dropIndicatorWidget);
-
- dragEvent->accept();
- }
- }
- break;
-
- case QEvent::DragLeave:
- {
- QDragLeaveEvent *dragEvent = static_cast<QDragLeaveEvent*>(event);
-
- if (m_checkedAction)
- {
- m_checkedAction->setCheckable(false);
- m_checkedAction->setChecked(false);
- }
-
- delete m_dropAction;
- m_dropAction = 0;
- dragEvent->accept();
- }
- break;
-
- case QEvent::DragMove:
- {
- QDragMoveEvent *dragEvent = static_cast<QDragMoveEvent*>(event);
- if (dragEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type())
- || dragEvent->mimeData()->hasFormat("text/uri-list")
- || dragEvent->mimeData()->hasFormat("text/plain"))
- {
- QAction *overAction = toolBar()->actionAt(dragEvent->pos());
- KBookmarkActionInterface *overActionBK = dynamic_cast<KBookmarkActionInterface*>(overAction);
- QWidget *widgetAction = toolBar()->widgetForAction(overAction);
-
- if (overAction != m_dropAction && overActionBK && widgetAction && m_dropAction)
- {
- toolBar()->removeAction(m_dropAction);
- if (m_checkedAction)
- {
- m_checkedAction->setCheckable(false);
- m_checkedAction->setChecked(false);
- }
-
- if (!overActionBK->bookmark().isGroup())
- {
- if ((dragEvent->pos().x() - widgetAction->pos().x()) > (widgetAction->width() / 2))
- {
- if (toolBar()->actions().count() > toolBar()->actions().indexOf(overAction) + 1)
- {
- toolBar()->insertAction(toolBar()->actions().at(toolBar()->actions().indexOf(overAction) + 1), m_dropAction);
- }
- else
- {
- toolBar()->addAction(m_dropAction);
- }
- }
- else
- {
- toolBar()->insertAction(overAction, m_dropAction);
- }
- }
- else
- {
- if ((dragEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() * 0.75))
- {
- if (toolBar()->actions().count() > toolBar()->actions().indexOf(overAction) + 1)
- {
- toolBar()->insertAction(toolBar()->actions().at(toolBar()->actions().indexOf(overAction) + 1), m_dropAction);
- }
- else
- {
- toolBar()->addAction(m_dropAction);
- }
- }
- else if ((dragEvent->pos().x() - widgetAction->pos().x()) <= (widgetAction->width() * 0.25))
- {
- toolBar()->insertAction(overAction, m_dropAction);
- }
- else
- {
- overAction->setCheckable(true);
- overAction->setChecked(true);
- m_checkedAction = overAction;
- }
- }
-
- dragEvent->accept();
- }
- }
- }
- break;
-
-
- case QEvent::Drop:
- {
- QDropEvent *dropEvent = static_cast<QDropEvent*>(event);
- KBookmark bookmark;
- KBookmarkGroup root = rApp->bookmarkManager()->manager()->toolbar();
-
- if (m_checkedAction)
- {
- m_checkedAction->setCheckable(false);
- m_checkedAction->setChecked(false);
- }
-
- if (dropEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type()))
- {
- QByteArray addresses = dropEvent->mimeData()->data(BookmarkManager::bookmark_mime_type());
- bookmark = rApp->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data()));
- if (bookmark.isNull())
- return false;
- }
- else if (dropEvent->mimeData()->hasFormat("text/uri-list"))
- {
- // DROP is URL
- QString url = dropEvent->mimeData()->urls().at(0).toString();
- QString title = url.contains(rApp->mainWindow()->currentTab()->url().url())
- ? rApp->mainWindow()->currentTab()->view()->title()
- : url;
- bookmark = root.addBookmark(title, url);
- }
- else if (dropEvent->mimeData()->hasFormat("text/plain"))
- {
- // DROP is TEXT
- QString url = dropEvent->mimeData()->text();
- KUrl u(url);
- if (u.isValid())
- {
- QString title = url.contains(rApp->mainWindow()->currentTab()->url().url())
- ? rApp->mainWindow()->currentTab()->view()->title()
- : url;
- bookmark = root.addBookmark(title, url);
- }
- }
- else
- {
- return false;
- }
-
- QAction *destAction = toolBar()->actionAt(dropEvent->pos());
- if (destAction && destAction == m_dropAction)
- {
- if (toolBar()->actions().indexOf(m_dropAction) > 0)
- {
- destAction = toolBar()->actions().at(toolBar()->actions().indexOf(m_dropAction) - 1);
- }
- else
- {
- destAction = toolBar()->actions().at(1);
- }
- }
-
- if (destAction)
- {
- KBookmarkActionInterface *destBookmarkAction = dynamic_cast<KBookmarkActionInterface *>(destAction);
- QWidget *widgetAction = toolBar()->widgetForAction(destAction);
-
- if (destBookmarkAction && !destBookmarkAction->bookmark().isNull() && widgetAction
- && bookmark.address() != destBookmarkAction->bookmark().address())
- {
- KBookmark destBookmark = destBookmarkAction->bookmark();
-
- if (!destBookmark.isGroup())
- {
- if ((dropEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() / 2))
- {
- root.moveBookmark(bookmark, destBookmark);
- }
- else
- {
- root.moveBookmark(bookmark, destBookmark.parentGroup().previous(destBookmark));
- }
- }
- else
- {
- if ((dropEvent->pos().x() - widgetAction->pos().x()) >= (widgetAction->width() * 0.75))
- {
- root.moveBookmark(bookmark, destBookmark);
- }
- else if ((dropEvent->pos().x() - widgetAction->pos().x()) <= (widgetAction->width() * 0.25))
- {
- root.moveBookmark(bookmark, destBookmark.parentGroup().previous(destBookmark));
- }
- else
- {
- destBookmark.toGroup().addBookmark(bookmark);
- }
- }
-
-
- rApp->bookmarkManager()->emitChanged();
- }
- }
- else
- {
- root.deleteBookmark(bookmark);
- bookmark = root.addBookmark(bookmark);
- if (dropEvent->pos().x() < toolBar()->widgetForAction(toolBar()->actions().first())->pos().x())
- {
- root.moveBookmark(bookmark, KBookmark());
- }
-
- rApp->bookmarkManager()->emitChanged();
- }
- dropEvent->accept();
- }
- break;
-
- default:
- break;
- }
-
- QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
-
- // These events need to be handled only for Bookmark actions and not the bar
- if (watched != toolBar() && mouseEvent)
- {
- switch (event->type())
- {
- case QEvent::MouseButtonPress: // drag handling
- {
- QPoint pos = toolBar()->mapFromGlobal(QCursor::pos());
- KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(toolBar()->actionAt(pos));
-
- if (action && mouseEvent->button() != Qt::MidButton)
- {
- m_dragAction = toolBar()->actionAt(pos);
- m_startDragPos = pos;
-
- // The menu is displayed only when the mouse button is released
- if (action->bookmark().isGroup())
- return true;
- }
- }
- break;
-
- case QEvent::MouseMove:
- {
- int distance = (toolBar()->mapFromGlobal(QCursor::pos()) - m_startDragPos).manhattanLength();
- if (!m_currentMenu && distance >= QApplication::startDragDistance())
- {
- startDrag();
- }
- }
- break;
-
- case QEvent::MouseButtonRelease:
- {
- QPoint destPos = toolBar()->mapFromGlobal(QCursor::pos());
- int distance = (destPos - m_startDragPos).manhattanLength();
- KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(toolBar()->actionAt(destPos));
-
- if (action && action->bookmark().isGroup())
- {
- if (mouseEvent->button() == Qt::MidButton)
- {
- rApp->bookmarkManager()->owner()->openBookmarkFolder(action->bookmark());
- }
- else if (distance < QApplication::startDragDistance())
- {
- KBookmarkActionMenu *menu = dynamic_cast<KBookmarkActionMenu *>(toolBar()->actionAt(m_startDragPos));
- QPoint actionPos = toolBar()->mapToGlobal(toolBar()->widgetForAction(menu)->pos());
- menu->menu()->popup(QPoint(actionPos.x(), actionPos.y() + toolBar()->widgetForAction(menu)->height()));
- }
- }
- }
- break;
-
- default:
- break;
- }
- }
-
- return QObject::eventFilter(watched, event);
-}
-
-
-void BookmarkToolBar::actionHovered()
-{
- KBookmarkActionInterface* action = dynamic_cast<KBookmarkActionInterface *>(sender());
- if (action)
- rApp->mainWindow()->notifyMessage(action->bookmark().url().url());
-}
-
-
-void BookmarkToolBar::startDrag()
-{
- KBookmarkActionInterface *action = dynamic_cast<KBookmarkActionInterface *>(m_dragAction);
- if (action)
- {
- QMimeData *mimeData = new QMimeData;
- KBookmark bookmark = action->bookmark();
-
- QByteArray address = bookmark.address().toLatin1();
- mimeData->setData(BookmarkManager::bookmark_mime_type(), address);
- bookmark.populateMimeData(mimeData);
-
- QDrag *drag = new QDrag(toolBar());
- drag->setMimeData(mimeData);
-
- if (bookmark.isGroup())
- {
- drag->setPixmap(KIcon(bookmark.icon()).pixmap(24, 24));
- }
- else
- {
- drag->setPixmap(rApp->iconManager()->iconForUrl(action->bookmark().url()).pixmap(24, 24));
- }
-
- drag->start(Qt::MoveAction);
- connect(drag, SIGNAL(destroyed()), this, SLOT(dragDestroyed()));
- }
-}
-
-
-void BookmarkToolBar::dragDestroyed()
-{
- // A workaround to get rid of the checked state of the dragged action
- if (m_dragAction)
- {
- m_dragAction->setVisible(false);
- m_dragAction->setVisible(true);
- m_dragAction = 0;
- }
- delete m_dropAction;
- m_dropAction = 0;
-}
diff --git a/src/bookmarks/bookmarkstoolbar.h b/src/bookmarks/bookmarkstoolbar.h
deleted file mode 100644
index b96085ee..00000000
--- a/src/bookmarks/bookmarkstoolbar.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-#ifndef BOOKMARKSTOOLBAR_H
-#define BOOKMARKSTOOLBAR_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KBookmarkMenu>
-
-/**
- * This class represent the rekonq bookmarks menu.
- * It's just a simple class inherited from KBookmarkMenu
- *
- */
-class BookmarkMenu : public KBookmarkMenu
-{
- Q_OBJECT
-
-public:
- BookmarkMenu(KBookmarkManager* manager,
- KBookmarkOwner* owner,
- KMenu* menu,
- KActionCollection* actionCollection);
- BookmarkMenu(KBookmarkManager *manager,
- KBookmarkOwner *owner,
- KMenu *parentMenu,
- const QString &parentAddress);
- ~BookmarkMenu();
-
-protected:
- virtual KMenu * contextMenu(QAction * act);
- virtual void refill();
- virtual QAction* actionForBookmark(const KBookmark &bookmark);
-
-private Q_SLOTS:
- void actionHovered();
-
-private:
- void addOpenFolderInTabs();
-
-};
-
-
-// ------------------------------------------------------------------------------
-
-
-// KDE Includes
-#include <KToolBar>
-
-
-/**
- * This class manage the bookmark toolbar.
- * Some events from the toolbar are handled to allow the drag and drop
- */
-
-class BookmarkToolBar : public QObject
-{
- Q_OBJECT
-
-public:
- BookmarkToolBar(KToolBar *toolBar, QObject *parent);
-
- KToolBar* toolBar();
-
-protected:
- bool eventFilter(QObject *watched, QEvent *event);
-
-private Q_SLOTS:
- void contextMenu(const QPoint &);
- void actionHovered();
- void menuDisplayed();
- void menuHidden();
- void hideMenu();
- void dragDestroyed();
-
-private:
- void startDrag();
-
- KToolBar *m_toolBar;
- KMenu *m_currentMenu;
- QPoint m_startDragPos;
- QAction *m_dragAction;
- QAction *m_dropAction;
- QAction *m_checkedAction;
- bool m_filled;
-};
-
-#endif // BOOKMARKSTOOLBAR_H
diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp
deleted file mode 100644
index 9e54f010..00000000
--- a/src/bookmarks/bookmarkstreemodel.cpp
+++ /dev/null
@@ -1,407 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Nils Weigel <nehlsen at gmail dot com>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "bookmarkstreemodel.h"
-#include "bookmarkstreemodel.moc"
-
-// Local Includes
-#include "application.h"
-#include "bookmarkmanager.h"
-#include "iconmanager.h"
-
-// KDE Includes
-#include <KBookmarkManager>
-#include <KLocalizedString>
-#include <KIcon>
-
-// Qt Includes
-#include <QtCore/QMimeData>
-
-
-BtmItem::BtmItem(const KBookmark &bm)
- : m_parent(0)
- , m_kbm(bm)
-{
-}
-
-
-BtmItem::~BtmItem()
-{
- qDeleteAll(m_children);
-}
-
-
-QVariant BtmItem::data(int role) const
-{
- if (m_kbm.isNull())
- return QVariant(); // should only happen for root item
-
- if (role == Qt::DisplayRole)
- return m_kbm.text();
-
- if (role == Qt::DecorationRole)
- {
- // NOTE
- // this should be:
- // return KIcon(m_kbm.icon());
- // but I cannot let it work :(
- // I really cannot understand how let this work properly...
- if (m_kbm.isGroup() || m_kbm.isSeparator())
- return KIcon(m_kbm.icon());
- else
- return rApp->iconManager()->iconForUrl(KUrl(m_kbm.url()));
- }
-
- if (role == Qt::UserRole)
- return m_kbm.url();
-
- if (role == Qt::ToolTipRole)
- {
- QString tooltip = m_kbm.fullText();
- if (m_kbm.isGroup())
- tooltip += i18ncp("%1=Number of items in bookmark folder", " (1 item)", " (%1 items)", childCount());
-
- QString url = m_kbm.url().url();
- if (!url.isEmpty())
- {
- if (!tooltip.isEmpty())
- tooltip += '\n';
- tooltip += url;
- }
-
- if (!m_kbm.description().isEmpty())
- {
- if (!tooltip.isEmpty())
- tooltip += '\n';
- tooltip += m_kbm.description();
- }
-
- return tooltip;
- }
-
- return QVariant();
-}
-
-
-int BtmItem::row() const
-{
- if (m_parent)
- return m_parent->m_children.indexOf(const_cast< BtmItem* >(this));
- return 0;
-}
-
-
-int BtmItem::childCount() const
-{
- return m_children.count();
-}
-
-
-BtmItem* BtmItem::child(int n)
-{
- Q_ASSERT(n >= 0);
- Q_ASSERT(n < childCount());
-
- return m_children.at(n);
-}
-
-
-BtmItem* BtmItem::parent() const
-{
- return m_parent;
-}
-
-
-void BtmItem::appendChild(BtmItem *child)
-{
- if (!child)
- return;
-
- child->m_parent = this;
- m_children << child;
-}
-
-
-void BtmItem::clear()
-{
- qDeleteAll(m_children);
- m_children.clear();
-}
-
-KBookmark BtmItem::getBkm() const
-{
- return m_kbm;
-}
-
-
-// -------------------------------------------------------------------------------------
-
-
-BookmarksTreeModel::BookmarksTreeModel(QObject *parent)
- : QAbstractItemModel(parent)
- , m_root(0)
-{
- resetModel();
- connect(rApp->bookmarkManager()->manager(), SIGNAL(changed(QString, QString)),
- this, SLOT(bookmarksChanged(QString)));
-}
-
-
-BookmarksTreeModel::~BookmarksTreeModel()
-{
- delete m_root;
-}
-
-
-int BookmarksTreeModel::rowCount(const QModelIndex &parent) const
-{
- BtmItem *parentItem = 0;
- if (!parent.isValid())
- {
- parentItem = m_root;
- }
- else
- {
- parentItem = static_cast<BtmItem*>(parent.internalPointer());
- }
-
- return parentItem->childCount();
-}
-
-
-int BookmarksTreeModel::columnCount(const QModelIndex& /*parent*/) const
-{
- return 1;
-}
-
-
-Qt::ItemFlags BookmarksTreeModel::flags(const QModelIndex &index) const
-{
- Qt::ItemFlags flags = QAbstractItemModel::flags(index);
-
- if (!index.isValid())
- return flags | Qt::ItemIsDropEnabled;
-
- flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
-
- if (bookmarkForIndex(index).isGroup())
- flags |= Qt::ItemIsDropEnabled;
-
- return flags;
-}
-
-
-QModelIndex BookmarksTreeModel::index(int row, int column, const QModelIndex &parent) const
-{
- if (!hasIndex(row, column, parent))
- return QModelIndex();
-
- BtmItem *parentItem;
-
- if (!parent.isValid())
- parentItem = m_root;
- else
- parentItem = static_cast<BtmItem*>(parent.internalPointer());
-
- BtmItem *childItem = parentItem->child(row);
- if (childItem)
- return createIndex(row, column, childItem);
-
- return QModelIndex();
-}
-
-
-QModelIndex BookmarksTreeModel::parent(const QModelIndex &index) const
-{
- if (!index.isValid())
- return QModelIndex();
-
- BtmItem *childItem = static_cast<BtmItem*>(index.internalPointer());
- BtmItem *parentItem = childItem->parent();
-
- if (parentItem == m_root)
- return QModelIndex();
-
- return createIndex(parentItem->row(), 0, parentItem);
-}
-
-
-QVariant BookmarksTreeModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- BtmItem *node = static_cast<BtmItem*>(index.internalPointer());
- if (node && node == m_root)
- {
- if (role == Qt::DisplayRole)
- return i18n("Bookmarks");
- if (role == Qt::DecorationRole)
- return KIcon("bookmarks");
- }
- else
- {
- if (node)
- return node->data(role);
- }
-
- return QVariant();
-}
-
-
-QStringList BookmarksTreeModel::mimeTypes() const
-{
- return QStringList(BookmarkManager::bookmark_mime_type());
-}
-
-
-bool BookmarksTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
-{
- if (action != Qt::MoveAction || !data->hasFormat(BookmarkManager::bookmark_mime_type()))
- return false;
-
- QByteArray addresses = data->data(BookmarkManager::bookmark_mime_type());
- KBookmark bookmark = rApp->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data()));
-
- KBookmarkGroup root;
- if (parent.isValid())
- root = bookmarkForIndex(parent).toGroup();
- else
- root = rApp->bookmarkManager()->rootGroup();
-
- QModelIndex destIndex = index(row, column, parent);
-
- if (destIndex.isValid() && row != -1)
- {
- root.moveBookmark(bookmark, root.previous(bookmarkForIndex(destIndex)));
- }
- else
- {
- root.deleteBookmark(bookmark);
- root.addBookmark(bookmark);
- }
-
- rApp->bookmarkManager()->emitChanged();
-
- return true;
-}
-
-
-Qt::DropActions BookmarksTreeModel::supportedDropActions() const
-{
- return Qt::MoveAction;
-}
-
-
-QMimeData* BookmarksTreeModel::mimeData(const QModelIndexList &indexes) const
-{
- QMimeData *mimeData = new QMimeData;
-
- QByteArray address = bookmarkForIndex(indexes.first()).address().toLatin1();
- mimeData->setData(BookmarkManager::bookmark_mime_type(), address);
- bookmarkForIndex(indexes.first()).populateMimeData(mimeData);
-
- return mimeData;
-}
-
-
-void BookmarksTreeModel::bookmarksChanged(const QString &groupAddress)
-{
- if (groupAddress.isEmpty())
- {
- resetModel();
- }
- else
- {
- beginResetModel();
- BtmItem *node = m_root;
- QModelIndex nodeIndex;
-
- QStringList indexChain(groupAddress.split('/', QString::SkipEmptyParts));
- bool ok;
- int i;
- Q_FOREACH(const QString & sIndex, indexChain)
- {
- i = sIndex.toInt(&ok);
- if (!ok)
- break;
-
- if (i < 0 || i >= node->childCount())
- break;
-
- node = node->child(i);
- nodeIndex = index(i, 0, nodeIndex);
- }
- populate(node, rApp->bookmarkManager()->findByAddress(groupAddress).toGroup());
- endResetModel();
- }
-
- emit bookmarksUpdated();
-}
-
-
-void BookmarksTreeModel::resetModel()
-{
- setRoot(rApp->bookmarkManager()->rootGroup());
-}
-
-
-void BookmarksTreeModel::setRoot(KBookmarkGroup bmg)
-{
- beginResetModel();
- delete m_root;
- m_root = new BtmItem(KBookmark());
- populate(m_root, bmg);
- endResetModel();
-}
-
-
-void BookmarksTreeModel::populate(BtmItem *node, KBookmarkGroup bmg)
-{
- node->clear();
-
- if (bmg.isNull())
- return;
-
- KBookmark bm = bmg.first();
- while (!bm.isNull())
- {
- BtmItem *newChild = new BtmItem(bm);
- if (bm.isGroup())
- populate(newChild, bm.toGroup());
-
- node->appendChild(newChild);
- bm = bmg.next(bm);
- }
-}
-
-
-KBookmark BookmarksTreeModel::bookmarkForIndex(const QModelIndex &index) const
-{
- return static_cast<BtmItem*>(index.internalPointer())->getBkm();
-}
diff --git a/src/bookmarks/bookmarkstreemodel.h b/src/bookmarks/bookmarkstreemodel.h
deleted file mode 100644
index f433ccaf..00000000
--- a/src/bookmarks/bookmarkstreemodel.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Nils Weigel <nehlsen at gmail dot com>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef BOOKMARKSTREEMODEL_H
-#define BOOKMARKSTREEMODEL_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE includes
-#include <KBookmark>
-
-// Qt Includes
-#include <QtCore/QAbstractItemModel>
-
-
-class BtmItem
-{
-public:
- BtmItem(const KBookmark &bm);
- ~BtmItem();
-
- QVariant data(int role = Qt::DisplayRole) const;
- int row() const;
- int childCount() const;
- BtmItem* child(int n);
- BtmItem* parent() const;
- void appendChild(BtmItem *child);
- void clear();
- KBookmark getBkm() const;
-
-private:
- BtmItem *m_parent;
- QList< BtmItem* > m_children;
- KBookmark m_kbm;
-};
-
-
-// -------------------------------------------------------------------------------------------------
-
-
-class REKONQ_TESTS_EXPORT BookmarksTreeModel : public QAbstractItemModel
-{
- Q_OBJECT
-
-public:
- explicit BookmarksTreeModel(QObject *parent = 0);
- virtual ~BookmarksTreeModel();
-
- /**
- * @return number of rows under the given parent.
- */
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
- /**
- * @return number of columns (always 1).
- */
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
-
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
-
- /**
- * @return index in the model specified by the given row, column and parent.
- */
- virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- /**
- * @return parent of the given index.
- */
- virtual QModelIndex parent(const QModelIndex &index) const;
- virtual QVariant data(const QModelIndex &index, int role) const;
-
- virtual QStringList mimeTypes() const;
- virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
- virtual Qt::DropActions supportedDropActions() const;
- virtual QMimeData *mimeData(const QModelIndexList &indexes) const;
-
-private Q_SLOTS:
- void bookmarksChanged(const QString &groupAddress);
-
-Q_SIGNALS:
- void bookmarksUpdated();
-
-private:
- void resetModel();
- void setRoot(KBookmarkGroup bmg);
- void populate(BtmItem *node, KBookmarkGroup bmg);
- KBookmark bookmarkForIndex(const QModelIndex &index) const;
-
- BtmItem *m_root;
-};
-
-#endif // BOOKMARKSTREEMODEL_H
diff --git a/src/cleardata.ui b/src/cleardata.ui
deleted file mode 100644
index 2ceb3354..00000000
--- a/src/cleardata.ui
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>ClearDataWidget</class>
- <widget class="QWidget" name="ClearDataWidget">
- <property name="windowModality">
- <enum>Qt::WindowModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>245</width>
- <height>226</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string comment="@title:window">Clear Private Data</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&lt;h3&gt;Clear the following items:&lt;/h3&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QCheckBox" name="clearHistory">
- <property name="text">
- <string>Visited pages history</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="clearDownloads">
- <property name="text">
- <string>Downloads history</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="clearCookies">
- <property name="text">
- <string>Cookies</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="clearCachedPages">
- <property name="text">
- <string>Cached web pages</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="clearWebIcons">
- <property name="text">
- <string>Website icons</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="homePageThumbs">
- <property name="text">
- <string>Home page thumbs</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::MinimumExpanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>15</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/clicktoflash.cpp b/src/clicktoflash.cpp
deleted file mode 100644
index baa61367..00000000
--- a/src/clicktoflash.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2010-2011 by Matthieu Gicquel <matgic78@gmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "clicktoflash.h"
-#include "clicktoflash.moc"
-
-// KDE Includes
-#include <KLocalizedString>
-
-// Qt Includes
-#include <QHBoxLayout>
-#include <QToolButton>
-
-#include <QWebElement>
-#include <QWebFrame>
-#include <QWebView>
-
-
-ClickToFlash::ClickToFlash(const QUrl &pluginUrl, QWidget *parent)
- : QWidget(parent)
- , m_url(pluginUrl)
-{
- QHBoxLayout *l = new QHBoxLayout(this);
- setLayout(l);
-
- QToolButton *button = new QToolButton(this);
- button->setPopupMode(QToolButton::InstantPopup);
- button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
- button->setText(i18n("Load Plugin"));
- button->setAutoRaise(false);
- layout()->addWidget(button);
- connect(button, SIGNAL(clicked(bool)), this, SLOT(load()));
-}
-
-
-void ClickToFlash::load()
-{
- QWidget *parent = parentWidget();
- QWebView *view = 0;
- while (parent)
- {
- if (QWebView *aView = qobject_cast<QWebView*>(parent))
- {
- view = aView;
- break;
- }
- parent = parent->parentWidget();
- }
- if (!view)
- return;
-
- const QString selector = QL1S("%1[type=\"application/x-shockwave-flash\"]");
-
- hide();
-
- QList<QWebFrame*> frames;
- frames.append(view->page()->mainFrame());
- while (!frames.isEmpty())
- {
- QWebFrame *frame = frames.takeFirst();
- QWebElement docElement = frame->documentElement();
-
- QWebElementCollection elements;
- elements.append(docElement.findAll(selector.arg(QL1S("object"))));
- elements.append(docElement.findAll(selector.arg(QL1S("embed"))));
-
- Q_FOREACH(QWebElement element, elements)
- {
- if (checkElement(element))
- {
- QWebElement substitute = element.clone();
- emit signalLoadClickToFlash(true);
- element.replace(substitute);
- deleteLater();
- return;
- }
- }
- frames += frame->childFrames();
- }
-}
-
-
-bool ClickToFlash::checkElement(QWebElement el)
-{
- QString checkString;
- QString urlString;
-
- checkString = QUrl(el.attribute("src")).toString(QUrl::RemoveQuery);
- urlString = m_url.toString(QUrl::RemoveQuery);
-
- if (urlString.contains(checkString))
- return true;
-
- QWebElementCollection collec = el.findAll("*");
- int i = 0;
- while (i < collec.count())
- {
- QWebElement el = collec.at(i);
-
- checkString = QUrl(el.attribute("src")).toString(QUrl::RemoveQuery);
- urlString = m_url.toString(QUrl::RemoveQuery);
-
- if (urlString.contains(checkString))
- return true;
-
- i++;
- }
-
- return false;
-}
diff --git a/src/clicktoflash.h b/src/clicktoflash.h
deleted file mode 100644
index fcafea59..00000000
--- a/src/clicktoflash.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2010-2011 by Matthieu Gicquel <matgic78@gmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef CLICKTOFLASH_H
-#define CLICKTOFLASH_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QUrl>
-#include <QWidget>
-
-// Forward Declarations
-class QWebElement;
-
-
-class REKONQ_TESTS_EXPORT ClickToFlash : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit ClickToFlash(const QUrl &pluginUrl, QWidget *parent = 0);
-
-Q_SIGNALS:
- void signalLoadClickToFlash(bool);
-
-private Q_SLOTS:
- void load();
-
-private:
- bool checkElement(QWebElement el);
-
- /**
- used to find the right QWebElement between the ones of the different plugins
- */
- const QUrl m_url;
-};
-
-#endif // CLICKTOFLASH_H
diff --git a/src/data/rekonq.desktop b/src/data/rekonq.desktop
index 445ae302..27286810 100755
--- a/src/data/rekonq.desktop
+++ b/src/data/rekonq.desktop
@@ -1,31 +1,18 @@
[Desktop Entry]
Name=Rekonq
-Name[bg]=Rekonq
-Name[ca]=Rekonq
Name[cs]=Rekonq
Name[da]=Rekonq
Name[de]=Rekonq
Name[el]=Rekonq
-Name[es]=Rekonq
Name[et]=Rekonq
Name[fi]=Rekonq
Name[fr]=Rekonq
-Name[ga]=Rekonq
-Name[gl]=Rekonq
Name[hu]=Rekonq
Name[km]=Rekonq
-Name[lt]=Rekonq
-Name[nb]=Rekonq
Name[nl]=Rekonq
Name[pt]=Rekonq
Name[pt_BR]=Rekonq
-Name[ru]=Rekonq
Name[sk]=Rekonq
-Name[sl]=Rekonq
-Name[sr]=Реконк
-Name[sr@ijekavian]=Реконк
-Name[sr@ijekavianlatin]=Rekonq
-Name[sr@latin]=Rekonq
Name[sv]=Rekonq
Name[uk]=Rekonq
Name[x-test]=xxRekonqxx
@@ -50,14 +37,12 @@ GenericName[ga]=Brabhsálaí Gréasáin
GenericName[gl]=Navegador web
GenericName[hu]=Webböngésző
GenericName[it]=Browser Web
-GenericName[kk]=Веб браузеры
GenericName[km]=កម្មវិធី​រុករក​បណ្ដាញ
GenericName[ko]=웹 브ë¼ìš°ì €
GenericName[lt]=Žiniatinklio naršyklė
GenericName[nb]=Nettleser
GenericName[nds]=Nettkieker
GenericName[nl]=Webbrowser
-GenericName[pa]=ਵੈੱਬ ਬਰਾਊਜ਼ਰ
GenericName[pl]=PrzeglÄ…darka internetowa
GenericName[pt]=Navegador Web
GenericName[pt_BR]=Navegador Web
diff --git a/src/downloaditem.cpp b/src/downloaditem.cpp
deleted file mode 100644
index 38edbf1e..00000000
--- a/src/downloaditem.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2011 by Pierre Rossi <pierre dot rossi at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self includes
-#include "downloaditem.h"
-#include "downloaditem.moc"
-
-// Qt Includes
-#include <QDBusInterface>
-#include <QTimer>
-
-// KDE Includes
-#include <KIconLoader>
-#include <KJob>
-#include <KMimeType>
-#include <KUrl>
-
-
-DownloadItem::DownloadItem(const QString &srcUrl, const QString &destUrl, const QDateTime &d, QObject *parent)
- : QObject(parent)
- , m_srcUrlString(srcUrl)
- , m_destUrl(KUrl(destUrl))
- , m_dateTime(d)
- , m_job(0)
- , m_state(0)
-{
-}
-
-
-DownloadItem::DownloadItem(KIO::CopyJob *job, const QDateTime &d, QObject *parent)
- : QObject(parent)
- , m_srcUrlString(job->srcUrls().at(0).url())
- , m_destUrl(job->destUrl())
- , m_dateTime(d)
- , m_job(job)
- , m_state(0)
-{
- QObject::connect(job, SIGNAL(percent(KJob*, ulong)), this, SLOT(updateProgress(KJob*, ulong)));
- QObject::connect(job, SIGNAL(finished(KJob*)), this, SLOT(onFinished(KJob*)));
- QObject::connect(job, SIGNAL(suspended(KJob*)), this, SLOT(onSuspended(KJob*)));
-}
-
-
-KUrl DownloadItem::destUrl() const
-{
- return m_destUrl;
-}
-
-
-QString DownloadItem::originUrl() const
-{
- return m_srcUrlString;
-}
-
-
-QString DownloadItem::fileDirectory() const
-{
- KUrl u = destUrl();
- return (QL1S("file://") + u.directory());
-}
-
-
-QString DownloadItem::fileName() const
-{
- return destUrl().fileName();
-}
-
-
-QString DownloadItem::destinationUrlString() const
-{
- return destUrl().url(KUrl::RemoveTrailingSlash);
-}
-
-
-QString DownloadItem::icon() const
-{
- KIconLoader *loader = KIconLoader::global();
- QString iconForMimeType = KMimeType::iconNameForUrl(destUrl());
- return (QL1S("file://") + loader->iconPath(iconForMimeType, KIconLoader::Desktop));
-}
-
-
-void DownloadItem::setIsKGetDownload()
-{
- m_state = KGetManaged;
-}
-
-
-// update progress for the plain KIO::Job backend
-void DownloadItem::updateProgress(KJob *job, unsigned long value)
-{
- Q_UNUSED(job);
-
- if (value > 0 && value < 100)
- m_state = Downloading;
-
- emit downloadProgress(value);
-}
-
-
-// emit downloadFinished signal in KJob case
-void DownloadItem::onFinished(KJob *job)
-{
- if (job->error())
- {
- m_state = Errors;
- m_errorString = job->errorString();
- }
- else
- {
- m_state = Done;
- emit downloadProgress(100);
- }
-
- emit downloadFinished(!job->error());
-}
-
-
-void DownloadItem::onSuspended(KJob *job)
-{
- Q_UNUSED(job);
-
- m_state = Suspended;
-
- // TODO:
- // connect to job->resume() to let rekonq resume it
-}
-
-
-QString DownloadItem::errorString() const
-{
- return m_errorString;
-}
diff --git a/src/downloaditem.h b/src/downloaditem.h
deleted file mode 100644
index 0b244c34..00000000
--- a/src/downloaditem.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2011 by Pierre Rossi <pierre dot rossi at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef DOWNLOADITEM_H
-#define DOWNLOADITEM_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QDateTime>
-#include <QObject>
-#include <QString>
-
-// KDE Includes
-#include <KLocalizedString>
-#include <KUrl>
-#include <KIO/CopyJob>
-
-
-class DownloadItem : public QObject
-{
- Q_OBJECT
-
-public:
-
- enum JobState
- {
- Done = 0,
- Downloading = 1,
- Errors = 2,
- Suspended = 3,
- KGetManaged = 4
- };
-
- explicit DownloadItem(const QString &srcUrl, const QString &destUrl, const QDateTime &d, QObject *parent = 0);
-
- // This is used to add a DownloadItem managed with KIO
- explicit DownloadItem(KIO::CopyJob *job, const QDateTime &d, QObject *parent = 0);
-
-
- inline QDateTime dateTime() const
- {
- return m_dateTime;
- }
-
- KUrl destUrl() const;
-
- QString originUrl() const;
- QString destinationUrlString() const;
- QString fileName() const;
- QString fileDirectory() const;
- QString icon() const;
- QString errorString() const;
-
- inline int state() const
- {
- return m_state;
- }
-
- void setIsKGetDownload();
-
-
-Q_SIGNALS:
- void downloadProgress(int percent);
- void downloadFinished(bool success);
-
-public Q_SLOTS:
- void updateProgress(KJob *job, unsigned long value);
- void onFinished(KJob *job);
- void onSuspended(KJob*);
-
-private:
- QString m_srcUrlString;
- KUrl m_destUrl;
-
- QDateTime m_dateTime;
-
- KIO::CopyJob *m_job;
- int m_state;
-
- QString m_errorString;
-};
-
-
-Q_DECLARE_METATYPE(DownloadItem*)
-
-
-typedef QList<DownloadItem*> DownloadList;
-
-
-#endif //DOWNLAODITEM_H
diff --git a/src/downloadmanager.cpp b/src/downloadmanager.cpp
deleted file mode 100644
index 8070ed58..00000000
--- a/src/downloadmanager.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2011 by Pierre Rossi <pierre dot rossi at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "downloadmanager.h"
-#include "downloadmanager.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// KDE Includes
-#include <KStandardDirs>
-#include <KToolInvocation>
-#include <KFileDialog>
-
-#include <kio/scheduler.h>
-
-#include <KIO/Job>
-#include <KIO/CopyJob>
-#include <KIO/JobUiDelegate>
-
-// Qt Includes
-#include <QDataStream>
-#include <QDateTime>
-#include <QFile>
-#include <QFileInfo>
-#include <QString>
-#include <QWebSettings>
-#include <QNetworkReply>
-
-#include <QDBusConnection>
-#include <QDBusConnectionInterface>
-#include <QDBusInterface>
-
-
-DownloadManager::DownloadManager(QObject *parent)
- : QObject(parent)
- , m_needToSave(false)
-{
- init();
-}
-
-
-DownloadManager::~DownloadManager()
-{
- if (!m_needToSave)
- return;
-
- QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
- QFile downloadFile(downloadFilePath);
-
- if (!downloadFile.open(QFile::WriteOnly))
- {
- kDebug() << "Unable to open download file (WRITE mode)..";
- return;
- }
-
- QDataStream out(&downloadFile);
- Q_FOREACH(DownloadItem * item, m_downloadList)
- {
- out << item->originUrl();
- out << item->destinationUrlString();
- out << item->dateTime();
- }
-
- downloadFile.close();
-}
-
-
-void DownloadManager::init()
-{
- QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
- QFile downloadFile(downloadFilePath);
- if (!downloadFile.open(QFile::ReadOnly))
- {
- kDebug() << "Unable to open download file (READ mode)..";
- return;
- }
-
- QDataStream in(&downloadFile);
- while (!in.atEnd())
- {
- QString srcUrl;
- in >> srcUrl;
- QString destUrl;
- in >> destUrl;
- QDateTime dt;
- in >> dt;
- DownloadItem *item = new DownloadItem(srcUrl, destUrl, dt, this);
- m_downloadList.append(item);
- }
-}
-
-
-DownloadItem* DownloadManager::addDownload(KIO::CopyJob *job)
-{
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- return 0;
-
- KIO::CopyJob *cJob = qobject_cast<KIO::CopyJob *>(job);
-
- QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
- QFile downloadFile(downloadFilePath);
- if (!downloadFile.open(QFile::WriteOnly | QFile::Append))
- {
- kDebug() << "Unable to open download file (WRITE mode)..";
- return 0;
- }
- QDataStream out(&downloadFile);
- out << cJob->srcUrls().at(0).url();
- out << cJob->destUrl().url();
- out << QDateTime::currentDateTime();
- downloadFile.close();
- DownloadItem *item = new DownloadItem(job, QDateTime::currentDateTime(), this);
- m_downloadList.append(item);
- emit newDownloadAdded(item);
- return item;
-}
-
-
-DownloadItem* DownloadManager::addKGetDownload(const QString &srcUrl, const QString &destUrl)
-{
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- return 0;
-
- QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
- QFile downloadFile(downloadFilePath);
- if (!downloadFile.open(QFile::WriteOnly | QFile::Append))
- {
- kDebug() << "Unable to open download file (WRITE mode)..";
- return 0;
- }
- QDataStream out(&downloadFile);
- out << srcUrl;
- out << destUrl;
- out << QDateTime::currentDateTime();
- downloadFile.close();
- DownloadItem *item = new DownloadItem(srcUrl, destUrl, QDateTime::currentDateTime(), this);
- item->setIsKGetDownload();
- m_downloadList.append(item);
- emit newDownloadAdded(item);
- return item;
-}
-
-
-bool DownloadManager::clearDownloadsHistory()
-{
- m_downloadList.clear();
- QString downloadFilePath = KStandardDirs::locateLocal("appdata" , "downloads");
- QFile downloadFile(downloadFilePath);
- return downloadFile.remove();
-}
-
-
-void DownloadManager::downloadLinksWithKGet(const QVariant &contentList)
-{
- if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget"))
- {
- KToolInvocation::kdeinitExecWait("kget");
- }
- QDBusInterface kget("org.kde.kget", "/KGet", "org.kde.kget.main");
- if (kget.isValid())
- {
- kget.call("importLinks", contentList);
- }
-}
-
-
-void DownloadManager::removeDownloadItem(int index)
-{
- DownloadItem *item = m_downloadList.takeAt(index);
- delete item;
-
- m_needToSave = true;
-}
-
-
-// NOTE
-// These 2 functions have been copied from the KWebPage class to implement a local version of the downloadResponse method.
-// In this way, we can easily provide the extra functionality we need:
-// 1. KGet Integration
-// 2. Save downloads history
-bool DownloadManager::downloadResource(const KUrl &srcUrl, const KIO::MetaData &metaData,
- QWidget *parent, bool forceDirRequest, const QString &suggestedName)
-{
- KUrl destUrl;
-
- const QString fileName((suggestedName.isEmpty() ? srcUrl.fileName() : suggestedName));
-
- if (forceDirRequest || ReKonfig::askDownloadPath())
- {
- // follow bug:184202 fixes
- destUrl = KFileDialog::getSaveFileName(KUrl::fromPath(fileName), QString(), parent);
- }
- else
- {
- destUrl = KUrl(ReKonfig::downloadPath().path() + QL1C('/') + fileName);
- }
-
- kDebug() << "DEST URL: " << destUrl;
-
- if (!destUrl.isValid())
- return false;
-
- // manage downloads with KGet if found
- if (ReKonfig::kgetDownload() && !KStandardDirs::findExe("kget").isNull())
- {
- //KGet integration:
- if (!QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.kget"))
- {
- KToolInvocation::kdeinitExecWait("kget");
- }
- QDBusInterface kget("org.kde.kget", "/KGet", "org.kde.kget.main");
- if (!kget.isValid())
- return false;
-
- QDBusMessage transfer = kget.call(QL1S("addTransfer"), srcUrl.prettyUrl(), destUrl.prettyUrl(), true);
-
- addKGetDownload(srcUrl.pathOrUrl(), destUrl.pathOrUrl());
- emit notifyDownload(fileName);
- return true;
- }
-
- KIO::CopyJob *job = KIO::copy(srcUrl, destUrl);
-
- if (!metaData.isEmpty())
- job->setMetaData(metaData);
-
- job->addMetaData(QL1S("MaxCacheSize"), QL1S("0")); // Don't store in http cache.
- job->addMetaData(QL1S("cache"), QL1S("cache")); // Use entry from cache if available.
- job->ui()->setWindow((parent ? parent->window() : 0));
- job->ui()->setAutoErrorHandlingEnabled(true);
-
- addDownload(job);
- emit notifyDownload(fileName);
- return true;
-}
diff --git a/src/downloadmanager.h b/src/downloadmanager.h
deleted file mode 100644
index 4cbd5fd6..00000000
--- a/src/downloadmanager.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Pierre Rossi <pierre dot rossi at gmail dot com>
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef DOWNLOADMANAGER_H
-#define DOWNLOADMANAGER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "downloaditem.h"
-
-// KDE Includes
-#include <kio/accessmanager.h>
-#include <KIO/CopyJob>
-
-// Qt Includes
-#include <QObject>
-#include <QWidget>
-
-// Forward Includes
-class KUrl;
-class QNetworkReply;
-
-
-class REKONQ_TESTS_EXPORT DownloadManager : public QObject
-{
- Q_OBJECT
-
-public:
- DownloadManager(QObject *parent = 0);
- ~DownloadManager();
-
- DownloadList downloads() const
- {
- return m_downloadList;
- }
-
- bool clearDownloadsHistory();
-
- bool downloadResource(const KUrl &url, const KIO::MetaData &metaData = KIO::MetaData(),
- QWidget *parent = 0, bool forceDirRequest = false, const QString &suggestedName = QString());
-
- void downloadLinksWithKGet(const QVariant &contentList);
-
- void removeDownloadItem(int index);
-
-private:
- void init();
-
- DownloadItem* addDownload(KIO::CopyJob *job);
- DownloadItem* addKGetDownload(const QString &srcUrl, const QString &destUrl);
-
-Q_SIGNALS:
- void newDownloadAdded(QObject *item);
- void notifyDownload(const QString&, Rekonq::Notify = Rekonq::Download);
-
-private:
- DownloadList m_downloadList;
-
- bool m_needToSave;
-};
-
-#endif // DOWNLOADMANAGER_H
diff --git a/src/findbar.cpp b/src/findbar.cpp
deleted file mode 100644
index d218340f..00000000
--- a/src/findbar.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "findbar.h"
-#include "findbar.moc"
-
-// Local Includes
-#include "mainwindow.h"
-#include "webtab.h"
-#include "webpage.h"
-
-// KDE Includes
-#include <KApplication>
-#include <KIcon>
-#include <KLineEdit>
-#include <KLocalizedString>
-#include <KPushButton>
-#include <KColorScheme>
-
-// Qt Includes
-#include <QTimer>
-
-#include <QCheckBox>
-#include <QHBoxLayout>
-#include <QKeyEvent>
-#include <QLabel>
-#include <QToolButton>
-
-
-FindBar::FindBar(MainWindow *window)
- : QWidget(window)
- , m_mainWindow(window)
- , m_lineEdit(new KLineEdit(this))
- , m_hideTimer(new QTimer(this))
- , m_matchCase(new QCheckBox(i18n("&Match case"), this))
- , m_highlightAll(new QCheckBox(i18n("&Highlight all"), this))
-{
- QHBoxLayout *layout = new QHBoxLayout;
-
- // cosmetic
- layout->setContentsMargins(2, 0, 2, 0);
-
- // hide button
- QToolButton *hideButton = new QToolButton(this);
- hideButton->setAutoRaise(true);
- hideButton->setIcon(KIcon("dialog-close"));
- connect(hideButton, SIGNAL(clicked()), this, SLOT(hide()));
- layout->addWidget(hideButton);
- layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);
-
- // hide timer
- connect(m_hideTimer, SIGNAL(timeout()), this, SLOT(hide()));
- m_hideTimer->setSingleShot(true);
-
- // label
- QLabel *label = new QLabel(i18n("Find:"));
- layout->addWidget(label);
-
- // lineEdit, focusProxy
- setFocusProxy(m_lineEdit);
- m_lineEdit->setMaximumWidth(250);
- connect(m_lineEdit, SIGNAL(textChanged(QString)), window, SLOT(find(QString)));
- layout->addWidget(m_lineEdit);
-
- // buttons
- KPushButton *findNext = new KPushButton(KIcon("go-down"), i18n("&Next"), this);
- KPushButton *findPrev = new KPushButton(KIcon("go-up"), i18n("&Previous"), this);
- connect(findNext, SIGNAL(clicked()), window, SLOT(findNext()));
- connect(findPrev, SIGNAL(clicked()), window, SLOT(findPrevious()));
- layout->addWidget(findNext);
- layout->addWidget(findPrev);
-
- // Case sensitivity. Deliberately set so this is off by default.
- m_matchCase->setCheckState(Qt::Unchecked);
- m_matchCase->setTristate(false);
- connect(m_matchCase, SIGNAL(toggled(bool)), window, SLOT(matchCaseUpdate()));
- layout->addWidget(m_matchCase);
-
- // Hightlight All. On by default
- m_highlightAll->setCheckState(Qt::Checked);
- m_highlightAll->setTristate(false);
- connect(m_highlightAll, SIGNAL(toggled(bool)), window, SLOT(updateHighlight()));
- layout->addWidget(m_highlightAll);
-
- // stretching widget on the left
- layout->addStretch();
-
- setLayout(layout);
-
- // we start off hidden
- hide();
-}
-
-
-void FindBar::keyPressEvent(QKeyEvent *event)
-{
- if (event->key() == Qt::Key_Return)
- {
- if (event->modifiers() == Qt::ShiftModifier)
- {
- m_mainWindow->findPrevious();
- }
- else
- {
- m_mainWindow->findNext();
- }
- }
- QWidget::keyPressEvent(event);
-}
-
-
-bool FindBar::matchCase() const
-{
- return m_matchCase->isChecked();
-}
-
-
-bool FindBar::highlightAllState() const
-{
- return m_highlightAll->isChecked();
-}
-
-
-void FindBar::setVisible(bool visible)
-{
- if (visible && m_mainWindow->currentTab()->page()->isOnRekonqPage() && m_mainWindow->currentTab()->part() != 0)
- {
- // findNext is the slot containing part integration code
- m_mainWindow->findNext();
- return;
- }
-
- QWidget::setVisible(visible);
-
- if (visible)
- {
- const QString selectedText = m_mainWindow->selectedText();
- if (!hasFocus() && !selectedText.isEmpty())
- {
- const QString previousText = m_lineEdit->text();
- m_lineEdit->setText(selectedText);
-
- if (m_lineEdit->text() != previousText)
- m_mainWindow->findPrevious();
- else
- m_mainWindow->updateHighlight();;
- }
- else if (selectedText.isEmpty())
- {
- emit searchString(m_lineEdit->text());
- }
-
- m_hideTimer->start(60000);
-
- m_lineEdit->setFocus();
- m_lineEdit->selectAll();
- }
- else
- {
- m_mainWindow->updateHighlight();;
- m_hideTimer->stop();
- }
-}
-
-void FindBar::notifyMatch(bool match)
-{
- QPalette p = m_lineEdit->palette();
- KColorScheme colorScheme(p.currentColorGroup());
-
- if (m_lineEdit->text().isEmpty())
- {
- p.setColor(QPalette::Base, colorScheme.background(KColorScheme::NormalBackground).color());
- }
- else
- {
- if (match)
- {
- p.setColor(QPalette::Base, colorScheme.background(KColorScheme::PositiveBackground).color());
- }
- else
- {
- p.setColor(QPalette::Base, colorScheme.background(KColorScheme::NegativeBackground).color()); // previous were 247, 230, 230
- }
- }
- m_lineEdit->setPalette(p);
- m_hideTimer->start(60000);
-}
diff --git a/src/findbar.h b/src/findbar.h
deleted file mode 100644
index 04a6bd15..00000000
--- a/src/findbar.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef FINDBAR_H
-#define FINDBAR_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QWidget>
-
-// Forward Declarations
-class MainWindow;
-
-class KLineEdit;
-
-class QString;
-class QCheckBox;
-
-
-class REKONQ_TESTS_EXPORT FindBar : public QWidget
-{
- Q_OBJECT
-
-public:
- FindBar(MainWindow *parent);
-
- bool matchCase() const;
- void notifyMatch(bool match);
- bool highlightAllState() const;
-
- void setVisible(bool visible);
-
-protected:
- void keyPressEvent(QKeyEvent *event);
-
-Q_SIGNALS:
- void searchString(const QString &);
-
-private:
- MainWindow *m_mainWindow;
- KLineEdit *m_lineEdit;
- QTimer *m_hideTimer;
- QCheckBox *m_matchCase;
- QCheckBox *m_highlightAll;
-};
-
-#endif
diff --git a/src/history/autosaver.cpp b/src/history/autosaver.cpp
deleted file mode 100644
index ee84e299..00000000
--- a/src/history/autosaver.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "autosaver.h"
-#include "autosaver.moc"
-
-// Qt Includes
-#include <QMetaObject>
-#include <QTimerEvent>
-#include <QBasicTimer>
-#include <QTime>
-
-
-const int AUTOSAVE_TIME = 1000 * 3; // seconds
-const int MAX_TIME_LIMIT = 1000 * 15; // seconds
-
-
-AutoSaver::AutoSaver(QObject *parent)
- : QObject(parent)
- , m_timer(new QBasicTimer)
- , m_firstChange(new QTime)
-{
-}
-
-
-AutoSaver::~AutoSaver()
-{
- if (m_timer->isActive())
- kDebug() << "AutoSaver: still active when destroyed, changes not saved.";
-
- delete m_firstChange;
- delete m_timer;
-}
-
-
-void AutoSaver::saveIfNeccessary()
-{
- if (m_timer->isActive())
- save();
-}
-
-
-void AutoSaver::changeOccurred()
-{
- if (m_firstChange->isNull())
- m_firstChange->start();
-
- if (m_firstChange->elapsed() > MAX_TIME_LIMIT)
- save();
- else
- m_timer->start(AUTOSAVE_TIME, this);
-}
-
-
-void AutoSaver::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() == m_timer->timerId())
- save();
- else
- QObject::timerEvent(event);
-}
-
-
-void AutoSaver::save()
-{
- m_timer->stop();
- delete m_firstChange;
- m_firstChange = new QTime;
-
- emit saveNeeded();
-}
diff --git a/src/history/autosaver.h b/src/history/autosaver.h
deleted file mode 100644
index 4c385ed6..00000000
--- a/src/history/autosaver.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef AUTOSAVER_H
-#define AUTOSAVER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QObject>
-
-// Forward Declarations
-class QBasicTimer;
-
-/**
- * This class emits the saveNeeded() signal.
- * It will wait several seconds after changeOccurred() to combine
- * multiple changes preventing continuous writing to disk.
- */
-class REKONQ_TESTS_EXPORT AutoSaver : public QObject
-{
- Q_OBJECT
-
-public:
- explicit AutoSaver(QObject *parent);
- virtual ~AutoSaver();
-
- /**
- * Emits the saveNeeded() signal if there's been any change since we last saved.
- */
- void saveIfNeccessary();
-
-Q_SIGNALS:
- void saveNeeded();
-
-public Q_SLOTS:
- void changeOccurred();
-
-protected:
- virtual void timerEvent(QTimerEvent *event);
-
-private:
- void save();
-
- QBasicTimer *m_timer;
- QTime *m_firstChange;
-};
-
-#endif // AUTOSAVER_H
diff --git a/src/history/historymanager.cpp b/src/history/historymanager.cpp
deleted file mode 100644
index 5acb180e..00000000
--- a/src/history/historymanager.cpp
+++ /dev/null
@@ -1,455 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "historymanager.h"
-#include "historymanager.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "historymodels.h"
-#include "autosaver.h"
-#include "application.h"
-
-// KDE Includes
-#include <KStandardDirs>
-#include <KLocale>
-#include <KCompletion>
-
-// Qt Includes
-#include <QList>
-#include <QUrl>
-#include <QDate>
-#include <QDateTime>
-#include <QString>
-#include <QFile>
-#include <QDataStream>
-#include <QBuffer>
-#include <QTemporaryFile>
-#include <QTimer>
-
-#include <QClipboard>
-
-// generic algorithms
-#include <QtAlgorithms>
-
-
-static const unsigned int HISTORY_VERSION = 25;
-
-
-HistoryManager::HistoryManager(QObject *parent)
- : QObject(parent)
- , m_saveTimer(new AutoSaver(this))
- , m_historyLimit(0)
- , m_historyTreeModel(0)
-{
- connect(this, SIGNAL(entryAdded(HistoryItem)), m_saveTimer, SLOT(changeOccurred()));
- connect(this, SIGNAL(entryRemoved(HistoryItem)), m_saveTimer, SLOT(changeOccurred()));
- connect(m_saveTimer, SIGNAL(saveNeeded()), this, SLOT(save()));
-
- load();
-
- HistoryModel *historyModel = new HistoryModel(this, this);
- m_historyFilterModel = new HistoryFilterModel(historyModel, this);
- m_historyTreeModel = new HistoryTreeModel(m_historyFilterModel, this);
-}
-
-
-HistoryManager::~HistoryManager()
-{
- if (ReKonfig::expireHistory() == 4)
- {
- m_history.clear();
- save();
- return;
- }
- m_saveTimer->saveIfNeccessary();
-}
-
-
-bool HistoryManager::historyContains(const QString &url) const
-{
- return m_historyFilterModel->historyContains(url);
-}
-
-
-void HistoryManager::addHistoryEntry(const KUrl &url, const QString &title)
-{
- if (ReKonfig::expireHistory() == 5) // DON'T STORE HISTORY!
- return;
-
- QWebSettings *globalSettings = QWebSettings::globalSettings();
- if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- return;
-
- if (url.isEmpty())
- return;
-
- QUrl urlToClean(url);
-
- // don't store about: urls (home page related)
- if (urlToClean.scheme() == QString("about"))
- return;
-
- urlToClean.setPassword(QString());
- urlToClean.setHost(urlToClean.host().toLower());
- QString urlString = urlToClean.toString();
-
- HistoryItem item;
-
- // NOTE
- // check if the url has just been visited.
- // if so, remove previous entry from history, update and prepend it
- if (historyContains(urlString))
- {
- int index = m_historyFilterModel->historyLocation(urlString);
- item = m_history.at(index);
- m_history.removeOne(item);
- emit entryRemoved(item);
-
- item.lastDateTimeVisit = QDateTime::currentDateTime();
- item.visitCount++;
- }
- else
- {
- item = HistoryItem(urlString, QDateTime::currentDateTime(), title);
- }
-
- m_history.prepend(item);
- emit entryAdded(item);
-
- if (m_history.count() == 1)
- checkForExpired();
-}
-
-
-void HistoryManager::setHistory(const QList<HistoryItem> &history, bool loadedAndSorted)
-{
- m_history = history;
-
- // verify that it is sorted by date
- if (!loadedAndSorted)
- qSort(m_history.begin(), m_history.end());
-
- checkForExpired();
-
- if (loadedAndSorted)
- {
- m_lastSavedUrl = m_history.value(0).url;
- }
- else
- {
- m_lastSavedUrl.clear();
- m_saveTimer->changeOccurred();
- }
-
- emit historyReset();
-}
-
-
-void HistoryManager::checkForExpired()
-{
- if (m_historyLimit < 0 || m_history.isEmpty())
- return;
-
- QDateTime now = QDateTime::currentDateTime();
- int nextTimeout = 0;
-
- while (!m_history.isEmpty())
- {
- QDateTime checkForExpired = m_history.last().lastDateTimeVisit;
- checkForExpired.setDate(checkForExpired.date().addDays(m_historyLimit));
- if (now.daysTo(checkForExpired) > 7)
- {
- // check at most in a week to prevent int overflows on the timer
- nextTimeout = 7 * 86400;
- }
- else
- {
- nextTimeout = now.secsTo(checkForExpired);
- }
- if (nextTimeout > 0)
- break;
- HistoryItem item = m_history.takeLast();
- // remove from saved file also
- m_lastSavedUrl.clear();
- emit entryRemoved(item);
- }
-
- if (nextTimeout > 0)
- QTimer::singleShot(nextTimeout * 1000, this, SLOT(checkForExpired()));
-}
-
-
-void HistoryManager::removeHistoryEntry(const KUrl &url, const QString &title)
-{
- HistoryItem item;
- for (int i = 0; i < m_history.count(); ++i)
- {
- if (url == m_history.at(i).url
- && (title.isEmpty() || title == m_history.at(i).title))
- {
- item = m_history.at(i);
- m_lastSavedUrl.clear();
- m_history.removeOne(item);
- emit entryRemoved(item);
- break;
- }
- }
-}
-
-
-QList<HistoryItem> HistoryManager::find(const QString &text)
-{
- QList<HistoryItem> list;
-
- QStringList urlKeys = m_historyFilterModel->keys();
- Q_FOREACH(const QString & url, urlKeys)
- {
- int index = m_historyFilterModel->historyLocation(url);
- HistoryItem item = m_history.at(index);
-
- QStringList words = text.split(' ');
- bool matches = true;
- Q_FOREACH(const QString & word, words)
- {
- if (!url.contains(word, Qt::CaseInsensitive)
- && !item.title.contains(word, Qt::CaseInsensitive))
- {
- matches = false;
- break;
- }
- }
- if (matches)
- list << item;
- }
-
- return list;
-}
-
-
-void HistoryManager::clear()
-{
- m_history.clear();
- m_lastSavedUrl.clear();
- m_saveTimer->changeOccurred();
- m_saveTimer->saveIfNeccessary();
- historyReset();
-}
-
-
-void HistoryManager::loadSettings()
-{
- int historyExpire = ReKonfig::expireHistory();
- int days;
- switch (historyExpire)
- {
- case 1:
- days = 90;
- break;
- case 2:
- days = 30;
- break;
- case 3:
- days = 1;
- break;
- case 0:
- case 4:
- case 5:
- default:
- days = -1;
- break;
- }
- m_historyLimit = days;
-}
-
-
-void HistoryManager::load()
-{
- loadSettings();
-
- QString historyFilePath = KStandardDirs::locateLocal("appdata" , "history");
- QFile historyFile(historyFilePath);
- if (!historyFile.exists())
- return;
- if (!historyFile.open(QFile::ReadOnly))
- {
- kDebug() << "Unable to open history file" << historyFile.fileName();
- return;
- }
-
- QList<HistoryItem> list;
- QDataStream in(&historyFile);
- // Double check that the history file is sorted as it is read in
- bool needToSort = false;
- HistoryItem lastInsertedItem;
- QByteArray data;
- QDataStream stream;
- QBuffer buffer;
- stream.setDevice(&buffer);
- while (!historyFile.atEnd())
- {
- in >> data;
- buffer.close();
- buffer.setBuffer(&data);
- buffer.open(QIODevice::ReadOnly);
- quint32 version;
- stream >> version;
-
- HistoryItem item;
-
- switch (version)
- {
- case HISTORY_VERSION: // default case
- stream >> item.url;
- stream >> item.firstDateTimeVisit;
- stream >> item.lastDateTimeVisit;
- stream >> item.title;
- stream >> item.visitCount;
- break;
-
- case 24: // this was history structure for rekonq < 0.8
- stream >> item.url;
- stream >> item.lastDateTimeVisit;
- stream >> item.title;
- stream >> item.visitCount;
- item.firstDateTimeVisit = item.lastDateTimeVisit;
- break;
-
- case 23: // this will be used to upgrade previous structure...
- stream >> item.url;
- stream >> item.lastDateTimeVisit;
- stream >> item.title;
- item.visitCount = 1;
- item.firstDateTimeVisit = item.lastDateTimeVisit;
- break;
-
- default:
- continue;
- };
-
- if (!item.lastDateTimeVisit.isValid())
- continue;
-
- if (item == lastInsertedItem)
- {
- if (lastInsertedItem.title.isEmpty() && !list.isEmpty())
- list[0].title = item.title;
- continue;
- }
-
- if (!needToSort && !list.isEmpty() && lastInsertedItem < item)
- needToSort = true;
-
- list.prepend(item);
- lastInsertedItem = item;
- }
- if (needToSort)
- qSort(list.begin(), list.end());
-
- setHistory(list, true);
-
- // If we had to sort re-write the whole history sorted
- if (needToSort)
- {
- m_lastSavedUrl.clear();
- m_saveTimer->changeOccurred();
- }
-}
-
-
-void HistoryManager::save()
-{
- bool saveAll = m_lastSavedUrl.isEmpty();
- int first = m_history.count() - 1;
- if (!saveAll)
- {
- // find the first one to save
- for (int i = 0; i < m_history.count(); ++i)
- {
- if (m_history.at(i).url == m_lastSavedUrl)
- {
- first = i - 1;
- break;
- }
- }
- }
- if (first == m_history.count() - 1)
- saveAll = true;
-
- QString historyFilePath = KStandardDirs::locateLocal("appdata" , "history");
- QFile historyFile(historyFilePath);
-
- // When saving everything use a temporary file to prevent possible data loss.
- QTemporaryFile tempFile;
- tempFile.setAutoRemove(false);
- bool open = false;
- if (saveAll)
- {
- open = tempFile.open();
- }
- else
- {
- open = historyFile.open(QFile::Append);
- }
-
- if (!open)
- {
- kDebug() << "Unable to open history file for saving"
- << (saveAll ? tempFile.fileName() : historyFile.fileName());
- return;
- }
-
- QDataStream out(saveAll ? &tempFile : &historyFile);
- for (int i = first; i >= 0; --i)
- {
- QByteArray data;
- QDataStream stream(&data, QIODevice::WriteOnly);
- HistoryItem item = m_history.at(i);
- stream << HISTORY_VERSION << item.url << item.firstDateTimeVisit << item.lastDateTimeVisit << item.title << item.visitCount;
- out << data;
- }
- tempFile.close();
-
- if (saveAll)
- {
- if (historyFile.exists() && !historyFile.remove())
- {
- kDebug() << "History: error removing old history." << historyFile.errorString();
- }
- if (!tempFile.rename(historyFile.fileName()))
- {
- kDebug() << "History: error moving new history over old." << tempFile.errorString() << historyFile.fileName();
- }
- }
- m_lastSavedUrl = m_history.value(0).url;
-
- emit historySaved();
-}
diff --git a/src/history/historymanager.h b/src/history/historymanager.h
deleted file mode 100644
index 4e727400..00000000
--- a/src/history/historymanager.h
+++ /dev/null
@@ -1,206 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef HISTORY_H
-#define HISTORY_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KUrl>
-
-// Qt Includes
-#include <QDateTime>
-#include <QHash>
-#include <QObject>
-#include <QWebHistory>
-
-#include <math.h>
-
-// Forward Declarations
-class AutoSaver;
-class HistoryFilterModel;
-class HistoryTreeModel;
-
-class QWebHistory;
-
-
-/**
- * Elements in this class represent an history item
- *
- */
-class HistoryItem
-{
-public:
- HistoryItem() : visitCount(1)
- {}
-
- explicit HistoryItem(const QString &u,
- const QDateTime &d = QDateTime(),
- const QString &t = QString()
- )
- : title(t)
- , url(u)
- , firstDateTimeVisit(d)
- , lastDateTimeVisit(d)
- , visitCount(1)
- {}
-
- inline bool operator==(const HistoryItem &other) const
- {
- return other.title == title
- && other.url == url
- && other.firstDateTimeVisit == firstDateTimeVisit
- && other.lastDateTimeVisit == lastDateTimeVisit;
- }
-
- inline qreal relevance() const
- {
- return log(visitCount) - log(lastDateTimeVisit.daysTo(QDateTime::currentDateTime()) + 1);
- }
-
- // history is sorted in reverse
- inline bool operator <(const HistoryItem &other) const
- {
- return lastDateTimeVisit > other.lastDateTimeVisit;
- }
-
- QString title;
- QString url;
- QDateTime firstDateTimeVisit;
- QDateTime lastDateTimeVisit;
- int visitCount;
-};
-
-
-// ---------------------------------------------------------------------------------------------------------------
-
-
-class TabHistory
-{
-public:
- explicit TabHistory(QWebHistory *h = 0)
- {
- if (h)
- {
- title = h->currentItem().title();
- url = h->currentItem().url().toString();
- QDataStream stream(&history, QIODevice::ReadWrite);
- stream << *h;
- }
- }
-
- inline bool operator ==(const TabHistory &other) const
- {
- return history == other.history;
- }
-
- void applyHistory(QWebHistory *h)
- {
- if (h)
- {
- QDataStream stream(&history, QIODevice::ReadOnly);
- stream >> *h;
- }
- }
-
- QString title;
- QString url;
- QByteArray history;
-};
-
-
-// ---------------------------------------------------------------------------------------------------------------
-
-
-/**
- * THE History Manager:
- * It manages rekonq history
- *
- */
-class REKONQ_TESTS_EXPORT HistoryManager : public QObject
-{
- Q_OBJECT
-
-public:
- HistoryManager(QObject *parent = 0);
- ~HistoryManager();
-
- bool historyContains(const QString &url) const;
- void addHistoryEntry(const KUrl &url, const QString &title);
- void removeHistoryEntry(const KUrl &url, const QString &title = QString());
-
- QList<HistoryItem> find(const QString &text);
-
- QList<HistoryItem> history() const
- {
- return m_history;
- };
- void setHistory(const QList<HistoryItem> &history, bool loadedAndSorted = false);
-
- // History manager keeps around these models for use by the completer and other classes
- HistoryFilterModel *historyFilterModel() const
- {
- return m_historyFilterModel;
- };
- HistoryTreeModel *historyTreeModel() const
- {
- return m_historyTreeModel;
- };
-
-Q_SIGNALS:
- void historyReset();
- void entryAdded(const HistoryItem &item);
- void entryRemoved(const HistoryItem &item);
-
- void historySaved();
-
-public Q_SLOTS:
- void clear();
- void loadSettings();
-
-private Q_SLOTS:
- void save();
- void checkForExpired();
-
-private:
- void load();
-
- AutoSaver *m_saveTimer;
- int m_historyLimit;
- QList<HistoryItem> m_history;
- QString m_lastSavedUrl;
-
- HistoryFilterModel *m_historyFilterModel;
- HistoryTreeModel *m_historyTreeModel;
-};
-
-
-#endif // HISTORY_H
diff --git a/src/history/historymodels.cpp b/src/history/historymodels.cpp
deleted file mode 100644
index 93a7b941..00000000
--- a/src/history/historymodels.cpp
+++ /dev/null
@@ -1,744 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "historymodels.h"
-#include "historymodels.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "historymanager.h"
-#include "iconmanager.h"
-
-// KDE Includes
-#include <KStandardDirs>
-#include <KLocale>
-#include <KIcon>
-
-// Qt Includes
-#include <QList>
-#include <QUrl>
-#include <QDate>
-#include <QDateTime>
-#include <QString>
-#include <QFile>
-#include <QDataStream>
-#include <QBuffer>
-
-#include <QClipboard>
-#include <QFileInfo>
-
-// generic algorithms
-#include <QtAlgorithms>
-
-
-HistoryModel::HistoryModel(HistoryManager *history, QObject *parent)
- : QAbstractTableModel(parent)
- , m_historyManager(history)
-{
- Q_ASSERT(m_historyManager);
- connect(m_historyManager, SIGNAL(historyReset()), this, SLOT(historyReset()));
- connect(m_historyManager, SIGNAL(entryRemoved(HistoryItem)), this, SLOT(historyReset()));
- connect(m_historyManager, SIGNAL(entryAdded(HistoryItem)), this, SLOT(entryAdded()));
-}
-
-
-void HistoryModel::historyReset()
-{
- reset();
-}
-
-
-void HistoryModel::entryAdded()
-{
- beginInsertRows(QModelIndex(), 0, 0);
- endInsertRows();
-}
-
-
-QVariant HistoryModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- if (orientation == Qt::Horizontal
- && role == Qt::DisplayRole)
- {
- switch (section)
- {
- case 0: return i18n("Title");
- case 1: return i18n("Address");
- }
- }
- return QAbstractTableModel::headerData(section, orientation, role);
-}
-
-
-QVariant HistoryModel::data(const QModelIndex &index, int role) const
-{
- QList<HistoryItem> lst = m_historyManager->history();
- if (index.row() < 0 || index.row() >= lst.size())
- return QVariant();
-
- const HistoryItem &item = lst.at(index.row());
- switch (role)
- {
- case DateTimeRole:
- return item.lastDateTimeVisit;
- case DateRole:
- return item.lastDateTimeVisit.date();
- case FirstDateTimeVisitRole:
- return item.firstDateTimeVisit;
- case UrlRole:
- return QUrl(item.url);
- case Qt::UserRole:
- return KUrl(item.url);
- case UrlStringRole:
- return item.url;
- case Qt::DisplayRole:
- case Qt::EditRole:
- {
- switch (index.column())
- {
- case 0:
- // when there is no title try to generate one from the url
- if (item.title.isEmpty())
- {
- QString page = QFileInfo(QUrl(item.url).path()).fileName();
- if (!page.isEmpty())
- return page;
- return item.url;
- }
- return item.title;
- case 1:
- return item.url;
- }
- }
- case Qt::DecorationRole:
- if (index.column() == 0)
- {
- return rApp->iconManager()->iconForUrl(item.url);
- }
- case Qt::ToolTipRole:
- QString tooltip = "";
- if (!item.title.isEmpty())
- tooltip = item.title + "<br/>";
-
- QString lastVisit = item.firstDateTimeVisit.toString(Qt::SystemLocaleDate);
- QString firstVisit = item.lastDateTimeVisit.toString(Qt::SystemLocaleDate);
- int visitCount = item.visitCount;
- tooltip += "<center> <b>" + item.url + "</b> </center>";
- tooltip += "<hr/>";
- tooltip += i18n("First Visit: ") + firstVisit + "<br/>";
- tooltip += i18n("Last Visit: ") + lastVisit + "<br/>";
- tooltip += i18n("Number of Visits: ") + QString::number(visitCount);
-
- return tooltip;
- }
- return QVariant();
-}
-
-
-int HistoryModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : 2;
-}
-
-
-int HistoryModel::rowCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : m_historyManager->history().count();
-}
-
-
-bool HistoryModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (parent.isValid())
- return false;
- int lastRow = row + count - 1;
- beginRemoveRows(parent, row, lastRow);
- QList<HistoryItem> lst = m_historyManager->history();
- for (int i = lastRow; i >= row; --i)
- lst.removeAt(i);
- disconnect(m_historyManager, SIGNAL(historyReset()), this, SLOT(historyReset()));
- m_historyManager->setHistory(lst);
- connect(m_historyManager, SIGNAL(historyReset()), this, SLOT(historyReset()));
- endRemoveRows();
- return true;
-}
-
-
-// ------------------------------------------------------------------------------------------------------------------
-
-
-HistoryFilterModel::HistoryFilterModel(QAbstractItemModel *sourceModel, QObject *parent)
- : QAbstractProxyModel(parent)
- , m_loaded(false)
-{
- setSourceModel(sourceModel);
-}
-
-
-int HistoryFilterModel::historyLocation(const QString &url) const
-{
- load();
- if (!m_historyHash.contains(url))
- return 0;
- return sourceModel()->rowCount() - m_historyHash.value(url);
-}
-
-
-QVariant HistoryFilterModel::data(const QModelIndex &index, int role) const
-{
- return QAbstractProxyModel::data(index, role);
-}
-
-
-void HistoryFilterModel::setSourceModel(QAbstractItemModel *newSourceModel)
-{
- if (sourceModel())
- {
- disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset()));
- disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex, QModelIndex)),
- this, SLOT(dataChanged(QModelIndex, QModelIndex)));
- disconnect(sourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)),
- this, SLOT(sourceRowsInserted(QModelIndex, int, int)));
- disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)),
- this, SLOT(sourceRowsRemoved(QModelIndex, int, int)));
- }
-
- QAbstractProxyModel::setSourceModel(newSourceModel);
-
- if (sourceModel())
- {
- m_loaded = false;
- connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset()));
- connect(sourceModel(), SIGNAL(dataChanged(QModelIndex, QModelIndex)),
- this, SLOT(sourceDataChanged(QModelIndex, QModelIndex)));
- connect(sourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)),
- this, SLOT(sourceRowsInserted(QModelIndex, int, int)));
- connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)),
- this, SLOT(sourceRowsRemoved(QModelIndex, int, int)));
- }
-}
-
-
-void HistoryFilterModel::sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
-{
- emit dataChanged(mapFromSource(topLeft), mapFromSource(bottomRight));
-}
-
-
-QVariant HistoryFilterModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- return sourceModel()->headerData(section, orientation, role);
-}
-
-
-void HistoryFilterModel::sourceReset()
-{
- m_loaded = false;
- reset();
-}
-
-
-int HistoryFilterModel::rowCount(const QModelIndex &parent) const
-{
- load();
- if (parent.isValid())
- return 0;
- return m_historyHash.count();
-}
-
-
-int HistoryFilterModel::columnCount(const QModelIndex &parent) const
-{
- return (parent.isValid()) ? 0 : 2;
-}
-
-
-QModelIndex HistoryFilterModel::mapToSource(const QModelIndex &proxyIndex) const
-{
- load();
- int sourceRow = sourceModel()->rowCount() - proxyIndex.internalId();
- return sourceModel()->index(sourceRow, proxyIndex.column());
-}
-
-
-QModelIndex HistoryFilterModel::mapFromSource(const QModelIndex &sourceIndex) const
-{
- load();
- QString url = sourceIndex.data(HistoryModel::UrlStringRole).toString();
- if (!m_historyHash.contains(url))
- return QModelIndex();
-
- // This can be done in a binary search, but we can't use qBinary find
- // because it can't take: qBinaryFind(m_sourceRow.end(), m_sourceRow.begin(), v);
- // so if this is a performance bottlneck then convert to binary search, until then
- // the cleaner/easier to read code wins the day.
- int realRow = -1;
- int sourceModelRow = sourceModel()->rowCount() - sourceIndex.row();
-
- for (int i = 0; i < m_sourceRow.count(); ++i)
- {
- if (m_sourceRow.at(i) == sourceModelRow)
- {
- realRow = i;
- break;
- }
- }
- if (realRow == -1)
- return QModelIndex();
-
- return createIndex(realRow, sourceIndex.column(), sourceModel()->rowCount() - sourceIndex.row());
-}
-
-
-QModelIndex HistoryFilterModel::index(int row, int column, const QModelIndex &parent) const
-{
- load();
- if (row < 0 || row >= rowCount(parent)
- || column < 0 || column >= columnCount(parent))
- return QModelIndex();
-
- return createIndex(row, column, m_sourceRow[row]);
-}
-
-
-QModelIndex HistoryFilterModel::parent(const QModelIndex &) const
-{
- return QModelIndex();
-}
-
-
-void HistoryFilterModel::load() const
-{
- if (m_loaded)
- return;
- m_sourceRow.clear();
- m_historyHash.clear();
- m_historyHash.reserve(sourceModel()->rowCount());
- for (int i = 0; i < sourceModel()->rowCount(); ++i)
- {
- QModelIndex idx = sourceModel()->index(i, 0);
- QString url = idx.data(HistoryModel::UrlStringRole).toString();
- if (!m_historyHash.contains(url))
- {
- m_sourceRow.append(sourceModel()->rowCount() - i);
- m_historyHash[url] = sourceModel()->rowCount() - i;
- }
- }
- m_loaded = true;
-}
-
-
-void HistoryFilterModel::sourceRowsInserted(const QModelIndex &parent, int start, int end)
-{
- Q_UNUSED(end);
-
- if (start != 0)
- {
- kDebug() << "STARTING from a NON zero position...";
- return;
- }
-
- if (!m_loaded)
- return;
-
- QModelIndex idx = sourceModel()->index(start, 0, parent);
- QString url = idx.data(HistoryModel::UrlStringRole).toString();
- if (m_historyHash.contains(url))
- {
- int sourceRow = sourceModel()->rowCount() - m_historyHash[url];
- int realRow = mapFromSource(sourceModel()->index(sourceRow, 0)).row();
- beginRemoveRows(QModelIndex(), realRow, realRow);
- m_sourceRow.removeAt(realRow);
- m_historyHash.remove(url);
- endRemoveRows();
- }
- beginInsertRows(QModelIndex(), 0, 0);
- m_historyHash.insert(url, sourceModel()->rowCount() - start);
- m_sourceRow.insert(0, sourceModel()->rowCount());
- endInsertRows();
-}
-
-
-void HistoryFilterModel::sourceRowsRemoved(const QModelIndex &, int start, int end)
-{
- Q_UNUSED(start);
- Q_UNUSED(end);
- sourceReset();
-}
-
-
-/*
- Removing a continuous block of rows will remove filtered rows too as this is
- the users intention.
-*/
-bool HistoryFilterModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (row < 0 || count <= 0 || row + count > rowCount(parent) || parent.isValid())
- return false;
- int lastRow = row + count - 1;
- disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)),
- this, SLOT(sourceRowsRemoved(QModelIndex, int, int)));
- beginRemoveRows(parent, row, lastRow);
- int oldCount = rowCount();
- int start = sourceModel()->rowCount() - m_sourceRow.value(row);
- int end = sourceModel()->rowCount() - m_sourceRow.value(lastRow);
- sourceModel()->removeRows(start, end - start + 1);
- endRemoveRows();
- connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)),
- this, SLOT(sourceRowsRemoved(QModelIndex, int, int)));
- m_loaded = false;
- if (oldCount - count != rowCount())
- reset();
- return true;
-}
-
-
-// ----------------------------------------------------------------------------------------------------------
-
-
-HistoryTreeModel::HistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent)
- : QAbstractProxyModel(parent)
-{
- setSourceModel(sourceModel);
-}
-
-
-QVariant HistoryTreeModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
- return sourceModel()->headerData(section, orientation, role);
-}
-
-
-QVariant HistoryTreeModel::data(const QModelIndex &index, int role) const
-{
- if (role == Qt::EditRole || role == Qt::DisplayRole)
- {
- int start = index.internalId();
- if (start == 0)
- {
- int offset = sourceDateRow(index.row());
- if (index.column() == 0)
- {
- QModelIndex idx = sourceModel()->index(offset, 0);
- QDate date = idx.data(HistoryModel::DateRole).toDate();
- if (date == QDate::currentDate())
- return i18n("Earlier Today");
- return date.toString(QL1S("dddd, MMMM d, yyyy"));
- }
- if (index.column() == 1)
- {
- return i18np("1 item", "%1 items", rowCount(index.sibling(index.row(), 0)));
- }
- }
- }
-
- if (role == Qt::DecorationRole && index.column() == 0 && !index.parent().isValid())
- return KIcon("view-history");
-
- if (role == HistoryModel::DateRole && index.column() == 0 && index.internalId() == 0)
- {
- int offset = sourceDateRow(index.row());
- QModelIndex idx = sourceModel()->index(offset, 0);
- return idx.data(HistoryModel::DateRole);
- }
-
- if (role == HistoryModel::FirstDateTimeVisitRole && index.column() == 0 && index.internalId() == 0)
- {
- int offset = sourceDateRow(index.row());
- QModelIndex idx = sourceModel()->index(offset, 0);
- return idx.data(HistoryModel::FirstDateTimeVisitRole);
- }
-
- return QAbstractProxyModel::data(index, role);
-}
-
-
-int HistoryTreeModel::columnCount(const QModelIndex &parent) const
-{
- return sourceModel()->columnCount(mapToSource(parent));
-}
-
-
-int HistoryTreeModel::rowCount(const QModelIndex &parent) const
-{
- if (parent.internalId() != 0
- || parent.column() > 0
- || !sourceModel())
- return 0;
-
- // row count OF dates
- if (!parent.isValid())
- {
- if (!m_sourceRowCache.isEmpty())
- return m_sourceRowCache.count();
- QDate currentDate;
- int rows = 0;
- int totalRows = sourceModel()->rowCount();
-
- for (int i = 0; i < totalRows; ++i)
- {
- QDate rowDate = sourceModel()->index(i, 0).data(HistoryModel::DateRole).toDate();
- if (rowDate != currentDate)
- {
- m_sourceRowCache.append(i);
- currentDate = rowDate;
- ++rows;
- }
- }
- Q_ASSERT(m_sourceRowCache.count() == rows);
- return rows;
- }
-
- // row count FOR a date
- int start = sourceDateRow(parent.row());
- int end = sourceDateRow(parent.row() + 1);
- return (end - start);
-}
-
-
-// Translate the top level date row into the offset where that date starts
-int HistoryTreeModel::sourceDateRow(int row) const
-{
- if (row <= 0)
- return 0;
-
- if (m_sourceRowCache.isEmpty())
- rowCount(QModelIndex());
-
- if (row >= m_sourceRowCache.count())
- {
- if (!sourceModel())
- return 0;
- return sourceModel()->rowCount();
- }
- return m_sourceRowCache.at(row);
-}
-
-
-QModelIndex HistoryTreeModel::mapToSource(const QModelIndex &proxyIndex) const
-{
- int offset = proxyIndex.internalId();
- if (offset == 0)
- return QModelIndex();
- int startDateRow = sourceDateRow(offset - 1);
- return sourceModel()->index(startDateRow + proxyIndex.row(), proxyIndex.column());
-}
-
-
-QModelIndex HistoryTreeModel::index(int row, int column, const QModelIndex &parent) const
-{
- if (row < 0
- || column < 0 || column >= columnCount(parent)
- || parent.column() > 0)
- return QModelIndex();
-
- if (!parent.isValid())
- return createIndex(row, column, 0);
- return createIndex(row, column, parent.row() + 1);
-}
-
-
-QModelIndex HistoryTreeModel::parent(const QModelIndex &index) const
-{
- int offset = index.internalId();
- if (offset == 0 || !index.isValid())
- return QModelIndex();
- return createIndex(offset - 1, 0, 0);
-}
-
-
-bool HistoryTreeModel::hasChildren(const QModelIndex &parent) const
-{
- QModelIndex grandparent = parent.parent();
- if (!grandparent.isValid())
- return true;
- return false;
-}
-
-
-Qt::ItemFlags HistoryTreeModel::flags(const QModelIndex &index) const
-{
- if (!index.isValid())
- return Qt::NoItemFlags;
- return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled;
-}
-
-
-bool HistoryTreeModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- if (row < 0 || count <= 0 || row + count > rowCount(parent))
- return false;
-
- if (parent.isValid())
- {
- // removing pages
- int offset = sourceDateRow(parent.row());
- return sourceModel()->removeRows(offset + row, count);
- }
- else
- {
- // removing whole dates
- for (int i = row + count - 1; i >= row; --i)
- {
- QModelIndex dateParent = index(i, 0);
- int offset = sourceDateRow(dateParent.row());
- if (!sourceModel()->removeRows(offset, rowCount(dateParent)))
- return false;
- }
- }
- return true;
-}
-
-
-void HistoryTreeModel::setSourceModel(QAbstractItemModel *newSourceModel)
-{
- if (sourceModel())
- {
- disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset()));
- disconnect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(sourceReset()));
- disconnect(sourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)),
- this, SLOT(sourceRowsInserted(QModelIndex, int, int)));
- disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)),
- this, SLOT(sourceRowsRemoved(QModelIndex, int, int)));
- }
-
- QAbstractProxyModel::setSourceModel(newSourceModel);
-
- if (newSourceModel)
- {
- connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset()));
- connect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(sourceReset()));
- connect(sourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)),
- this, SLOT(sourceRowsInserted(QModelIndex, int, int)));
- connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)),
- this, SLOT(sourceRowsRemoved(QModelIndex, int, int)));
- }
-
- reset();
-}
-
-
-void HistoryTreeModel::sourceReset()
-{
- m_sourceRowCache.clear();
- reset();
-}
-
-
-void HistoryTreeModel::sourceRowsInserted(const QModelIndex &parent, int start, int end)
-{
- Q_UNUSED(parent); // Avoid warnings when compiling release
- Q_ASSERT(!parent.isValid());
- if (start != 0 || start != end)
- {
- m_sourceRowCache.clear();
- reset();
- return;
- }
-
- m_sourceRowCache.clear();
- QModelIndex treeIndex = mapFromSource(sourceModel()->index(start, 0));
- QModelIndex treeParent = treeIndex.parent();
- if (rowCount(treeParent) == 1)
- {
- beginInsertRows(QModelIndex(), 0, 0);
- endInsertRows();
- }
- else
- {
- beginInsertRows(treeParent, treeIndex.row(), treeIndex.row());
- endInsertRows();
- }
-}
-
-
-QModelIndex HistoryTreeModel::mapFromSource(const QModelIndex &sourceIndex) const
-{
- if (!sourceIndex.isValid())
- return QModelIndex();
-
- if (m_sourceRowCache.isEmpty())
- rowCount(QModelIndex());
-
- QList<int>::iterator it;
- it = qLowerBound(m_sourceRowCache.begin(), m_sourceRowCache.end(), sourceIndex.row());
- if (*it != sourceIndex.row())
- --it;
-
- int dateRow = qMax(0, it - m_sourceRowCache.begin());
- int row = sourceIndex.row() - m_sourceRowCache.at(dateRow);
- return createIndex(row, sourceIndex.column(), dateRow + 1);
-}
-
-
-void HistoryTreeModel::sourceRowsRemoved(const QModelIndex &parent, int start, int end)
-{
- Q_UNUSED(parent); // Avoid warnings when compiling release
- Q_ASSERT(!parent.isValid());
- if (m_sourceRowCache.isEmpty())
- return;
- for (int i = end; i >= start;)
- {
- QList<int>::iterator it;
- it = qLowerBound(m_sourceRowCache.begin(), m_sourceRowCache.end(), i);
- // playing it safe
- if (it == m_sourceRowCache.end())
- {
- m_sourceRowCache.clear();
- reset();
- return;
- }
-
- if (*it != i)
- --it;
- int row = qMax(0, it - m_sourceRowCache.begin());
- int offset = m_sourceRowCache[row];
- QModelIndex dateParent = index(row, 0);
- // If we can remove all the rows in the date do that and skip over them
- int rc = rowCount(dateParent);
- if (i - rc + 1 == offset && start <= i - rc + 1)
- {
- beginRemoveRows(QModelIndex(), row, row);
- m_sourceRowCache.removeAt(row);
- i -= rc + 1;
- }
- else
- {
- beginRemoveRows(dateParent, i - offset, i - offset);
- ++row;
- --i;
- }
- for (int j = row; j < m_sourceRowCache.count(); ++j)
- --m_sourceRowCache[j];
- endRemoveRows();
- }
-}
diff --git a/src/history/historymodels.h b/src/history/historymodels.h
deleted file mode 100644
index d8f20818..00000000
--- a/src/history/historymodels.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef HISTORYMODELS_H
-#define HISTORYMODELS_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KUrl>
-
-// Qt Includes
-#include <QHash>
-#include <QAbstractTableModel>
-#include <QAbstractProxyModel>
-
-// Forward Declarations
-class HistoryManager;
-
-
-class REKONQ_TESTS_EXPORT HistoryModel : public QAbstractTableModel
-{
- Q_OBJECT
-
-public:
- enum Roles
- {
- DateRole = Qt::UserRole + 1,
- DateTimeRole = Qt::UserRole + 2,
- UrlRole = Qt::UserRole + 3,
- UrlStringRole = Qt::UserRole + 4,
- FirstDateTimeVisitRole = Qt::UserRole + 5
- };
-
- explicit HistoryModel(HistoryManager *history, QObject *parent = 0);
-
-public Q_SLOTS:
- void historyReset();
- void entryAdded();
-
-public:
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
-
-private:
- HistoryManager *m_historyManager;
-};
-
-
-// ----------------------------------------------------------------------------------------------------
-
-
-/**
- * Proxy model that will remove any duplicate entries.
- * Both m_sourceRow and m_historyHash store their offsets not from
- * the front of the list, but as offsets from the back.
- *
- */
-class REKONQ_TESTS_EXPORT HistoryFilterModel : public QAbstractProxyModel
-{
- Q_OBJECT
-
-public:
- explicit HistoryFilterModel(QAbstractItemModel *sourceModel, QObject *parent = 0);
-
- inline bool historyContains(const QString &url) const
- {
- load();
- return m_historyHash.contains(url);
- }
-
- inline QList<QString> keys() const
- {
- load();
- return m_historyHash.keys();
- }
-
- int historyLocation(const QString &url) const;
-
- QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
- QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
- void setSourceModel(QAbstractItemModel *sourceModel);
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
- QModelIndex index(int, int, const QModelIndex& = QModelIndex()) const;
- QModelIndex parent(const QModelIndex& index = QModelIndex()) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
-private Q_SLOTS:
- void sourceReset();
- void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
- void sourceRowsInserted(const QModelIndex &parent, int start, int end);
- void sourceRowsRemoved(const QModelIndex &, int, int);
-
-private:
- void load() const;
-
- mutable QList<int> m_sourceRow;
- mutable QHash<QString, int> m_historyHash;
- mutable bool m_loaded;
-};
-
-
-// ----------------------------------------------------------------------------------------------------------------------
-
-
-/**
- * Proxy model for the history model that converts the list
- * into a tree, one top level node per day.
- *
- * Used in the HistoryDialog.
- *
- */
-
-class HistoryTreeModel : public QAbstractProxyModel
-{
- Q_OBJECT
-
-public:
- explicit HistoryTreeModel(QAbstractItemModel *sourceModel, QObject *parent = 0);
-
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
- int columnCount(const QModelIndex &parent) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
- QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &index = QModelIndex()) const;
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
-
- void setSourceModel(QAbstractItemModel *sourceModel);
-
-private Q_SLOTS:
- void sourceReset();
- void sourceRowsInserted(const QModelIndex &parent, int start, int end);
- void sourceRowsRemoved(const QModelIndex &parent, int start, int end);
-
-private:
- int sourceDateRow(int row) const;
- mutable QList<int> m_sourceRowCache;
-};
-
-
-#endif // HISTORYMODELS_H
diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp
deleted file mode 100644
index 5037a4d1..00000000
--- a/src/history/historypanel.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com>
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "historypanel.h"
-#include "historypanel.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "paneltreeview.h"
-#include "historymanager.h"
-#include "historymodels.h"
-#include "urlfilterproxymodel.h"
-
-// KDE Includes
-#include <KLocalizedString>
-#include <KMenu>
-#include <KAction>
-#include <KMessageBox>
-
-// Qt Includes
-#include <QHeaderView>
-
-
-HistoryPanel::HistoryPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
- : UrlPanel(title, parent, flags)
-{
- setObjectName("historyPanel");
- setVisible(ReKonfig::showHistoryPanel());
-}
-
-
-HistoryPanel::~HistoryPanel()
-{
- ReKonfig::setShowHistoryPanel(!isHidden());
-}
-
-
-void HistoryPanel::contextMenuItem(const QPoint &pos)
-{
- KMenu menu;
- KAction* action;
-
- action = new KAction(KIcon("tab-new"), i18n("Open"), this);
- connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInCurrentTab()));
- menu.addAction(action);
-
- action = new KAction(KIcon("tab-new"), i18n("Open in New Tab"), this);
- connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewTab()));
- menu.addAction(action);
-
- action = new KAction(KIcon("window-new"), i18n("Open in New Window"), this);
- connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(openInNewWindow()));
- menu.addAction(action);
-
- action = new KAction(KIcon("edit-copy"), i18n("Copy Link Address"), this);
- connect(action, SIGNAL(triggered()), panelTreeView(), SLOT(copyToClipboard()));
- menu.addAction(action);
-
- action = new KAction(KIcon("edit-clear"), i18n("Remove Entry"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(deleteEntry()));
- menu.addAction(action);
-
- action = new KAction(KIcon("edit-clear"), i18n("Remove all occurrences"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(forgetSite()));
- menu.addAction(action);
-
- menu.exec(panelTreeView()->mapToGlobal(pos));
-}
-
-
-void HistoryPanel::contextMenuGroup(const QPoint &pos)
-{
- KMenu menu;
- KAction* action;
-
- action = new KAction(KIcon("tab-new"), i18n("Open Folder in Tabs"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(openAll()));
- menu.addAction(action);
-
- action = new KAction(KIcon("edit-clear"), i18n("Remove Folder"), this);
- connect(action, SIGNAL(triggered()), this, SLOT(deleteGroup()));
- menu.addAction(action);
-
- menu.exec(panelTreeView()->mapToGlobal(pos));
-}
-
-
-void HistoryPanel::contextMenuEmpty(const QPoint& /*pos*/)
-{
-}
-
-
-void HistoryPanel::openAll()
-{
- QModelIndex index = panelTreeView()->currentIndex();
- if (!index.isValid())
- return;
-
- QList<KUrl> allChild;
-
- for (int i = 0; i < index.model()->rowCount(index); i++)
- allChild << qVariantValue<KUrl>(index.child(i, 0).data(Qt::UserRole));
-
- if (allChild.length() > 8)
- {
- if (!(KMessageBox::warningContinueCancel(this,
- i18ncp("%1=Number of tabs. Value is always >=8",
- "You are about to open %1 tabs.\nAre you sure?",
- "You are about to open %1 tabs.\nAre you sure?",
- allChild.length())) == KMessageBox::Continue)
- )
- return;
- }
-
- for (int i = 0; i < allChild.length(); i++)
- emit openUrl(allChild.at(i).url(), Rekonq::NewTab);
-}
-
-void HistoryPanel::deleteGroup()
-{
- QModelIndex index = panelTreeView()->currentIndex();
- if (!index.isValid())
- return;
-
- //Getting all URLs of sub items.
- QList<KUrl> allChild;
- for (int i = 0; i < index.model()->rowCount(index); i++)
- allChild << qVariantValue<KUrl>(index.child(i, 0).data(Qt::UserRole));
-
- for (int i = 0; i < allChild.length(); i++)
- rApp->historyManager()->removeHistoryEntry(allChild.at(i));
-
-}
-
-void HistoryPanel::setup()
-{
- UrlPanel::setup();
-
- panelTreeView()->header()->hideSection(1);
-
- const UrlFilterProxyModel *proxy = static_cast<const UrlFilterProxyModel*>(panelTreeView()->model());
- panelTreeView()->expand(proxy->index(0, 0));
-}
-
-void HistoryPanel::deleteEntry()
-{
- QModelIndex index = panelTreeView()->currentIndex();
- if (!index.isValid())
- return;
- removedFolderIndex = index.parent().row();
-
- rApp->historyManager()->removeHistoryEntry(qVariantValue< KUrl >(index.data(Qt::UserRole)));
-
- QModelIndex expandItem = panelTreeView()->model()->index(removedFolderIndex, 0);
- if (expandItem.isValid())
- panelTreeView()->expand(expandItem);
-}
-
-void HistoryPanel::forgetSite()
-{
- QModelIndex index = panelTreeView()->currentIndex();
- if (!index.isValid())
- return;
- removedFolderIndex = index.row();
-
- QString site = qVariantValue< KUrl >(index.data(Qt::UserRole)).host();
- QList<HistoryItem> toRemove = rApp->historyManager()->find(site);
- for (int i = 0; i < toRemove.length(); i++)
- {
- rApp->historyManager()->removeHistoryEntry(KUrl(toRemove.at(i).url));
- }
-
- QModelIndex expandItem = panelTreeView()->model()->index(removedFolderIndex, 0);
- if (expandItem.isValid())
- panelTreeView()->expand(expandItem);
-}
-
-
-
-QAbstractItemModel* HistoryPanel::model()
-{
- return rApp->historyManager()->historyTreeModel();
-}
diff --git a/src/history/historypanel.h b/src/history/historypanel.h
deleted file mode 100644
index f78ec5e1..00000000
--- a/src/history/historypanel.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com>
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef HISTORYPANEL_H
-#define HISTORYPANEL_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "urlpanel.h"
-
-
-class REKONQ_TESTS_EXPORT HistoryPanel : public UrlPanel
-{
- Q_OBJECT
-
-public:
- explicit HistoryPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
- virtual ~HistoryPanel();
-
-private Q_SLOTS:
- virtual void contextMenuItem(const QPoint &pos);
- virtual void contextMenuGroup(const QPoint &pos);
- virtual void contextMenuEmpty(const QPoint &pos);
-
- void openAll();
- void deleteEntry();
- void deleteGroup();
- void forgetSite();
-
-private:
- virtual void setup();
- virtual QAbstractItemModel* model();
- int removedFolderIndex;
-};
-
-#endif // HISTORYPANEL_H
diff --git a/src/icondownloader.cpp b/src/icondownloader.cpp
deleted file mode 100644
index 6d1f3a5e..00000000
--- a/src/icondownloader.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "icondownloader.h"
-#include "icondownloader.moc"
-
-// Qt Includes
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QNetworkRequest>
-#include <QFile>
-#include <QPixmap>
-
-
-IconDownloader::IconDownloader(const KUrl &srcUrl, const KUrl &destUrl, QObject *parent)
- : QObject(parent)
- , m_srcUrl(srcUrl)
- , m_destUrl(destUrl)
-{
- QNetworkAccessManager *manager = new QNetworkAccessManager(this);
- connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
- manager->get(QNetworkRequest(srcUrl));
-}
-
-
-void IconDownloader::replyFinished(QNetworkReply *reply)
-{
- if (reply->error())
- {
- kDebug() << "FAVICON JOB ERROR";
- emit iconReady();
- this->deleteLater();
- return;
- }
-
- QString s = m_destUrl.url().remove(QL1S("file://"));
- QFile favicon(s);
- if (!favicon.open(QIODevice::WriteOnly))
- {
- kDebug() << "FAVICON FILE NOT OPENED";
- emit iconReady();
- this->deleteLater();
- return;
- }
-
- favicon.write(reply->readAll());
- favicon.close();
-
- if (favicon.size() == 0)
- {
- kDebug() << "SIZE ZERO FAVICON";
- favicon.remove();
- emit iconReady();
- this->deleteLater();
- return;
- }
-
- QPixmap px;
- if (!px.load(s))
- {
- kDebug() << "PIXMAP NOT LOADED";
- emit iconReady();
- this->deleteLater();
- return;
- }
-
- if (px.isNull())
- {
- kDebug() << "PIXMAP IS NULL";
- favicon.remove();
- emit iconReady();
- this->deleteLater();
- return;
- }
-
- px = px.scaled(16, 16);
- if (!px.save(s + QL1S(".png"), "PNG"))
- {
- kDebug() << "PIXMAP NOT SAVED";
- emit iconReady();
- this->deleteLater();
- return;
- }
-
- QFile::remove(s);
- emit iconReady();
- this->deleteLater();
-}
diff --git a/src/icondownloader.h b/src/icondownloader.h
deleted file mode 100644
index 54fd60fb..00000000
--- a/src/icondownloader.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef ICON_DOWNLOADER_H
-#define ICON_DOWNLOADER_H
-
-// rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QObject>
-
-// KDE Includes
-#include <KUrl>
-
-// Forward Declarations
-class QNetworkReply;
-
-
-class IconDownloader : public QObject
-{
- Q_OBJECT
-
-public:
- IconDownloader(const KUrl &srcUrl, const KUrl &destUrl, QObject *parent = 0);
-
-private Q_SLOTS:
- void replyFinished(QNetworkReply *);
-
-Q_SIGNALS:
- void iconReady();
-
-private:
- KUrl m_srcUrl;
- KUrl m_destUrl;
-};
-
-#endif // ICON_DOWNLOADER_H
diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp
deleted file mode 100644
index 2876aa27..00000000
--- a/src/iconmanager.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "iconmanager.h"
-#include "iconmanager.moc"
-
-// Local Includes
-#include "application.h"
-#include "icondownloader.h"
-#include "webicon.h"
-
-// KDE Includes
-#include <KIO/Job>
-
-#include <KIcon>
-#include <KStandardDirs>
-#include <KUrl>
-
-// Qt Includes
-#include <QDir>
-
-#include <QWebElement>
-#include <QWebFrame>
-#include <QWebSettings>
-
-
-IconManager::IconManager(QObject *parent)
- : QObject(parent)
-{
- _faviconsDir = KStandardDirs::locateLocal("cache" , "favicons/" , true);
-}
-
-
-KIcon IconManager::iconForUrl(const KUrl &url)
-{
- // first things first.. avoid infinite loop at startup
- if (url.isEmpty() || rApp->mainWindowList().isEmpty())
- return KIcon("text-html");
-
- QByteArray encodedUrl = url.toEncoded();
- // rekonq icons..
- if (encodedUrl == QByteArray("about:home"))
- return KIcon("go-home");
- if (encodedUrl == QByteArray("about:closedTabs"))
- return KIcon("tab-close");
- if (encodedUrl == QByteArray("about:history"))
- return KIcon("view-history");
- if (encodedUrl == QByteArray("about:bookmarks"))
- return KIcon("bookmarks");
- if (encodedUrl == QByteArray("about:favorites"))
- return KIcon("emblem-favorite");
- if (encodedUrl == QByteArray("about:downloads"))
- return KIcon("download");
- if (encodedUrl == QByteArray("about:tabs"))
- return KIcon("tab-duplicate");
-
- // TODO: return other mimetype icons
- if (url.isLocalFile())
- {
- return KIcon("folder");
- }
-
- QString i = favIconForUrl(url);
- if (!i.isEmpty())
- {
- return KIcon(QIcon(_faviconsDir + i));
- }
-
- // Not found icon. Return default one.
- return KIcon("text-html");
-}
-
-
-void IconManager::provideIcon(QWebFrame *mFrame, const KUrl &url, bool notify)
-{
- // provide icons just for http/https sites
- if (!url.scheme().startsWith(QL1S("http")))
- {
- if (notify)
- emit iconChanged();
- return;
- }
-
- // do not load new icons in private browsing..
- if (QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- {
- if (notify)
- emit iconChanged();
- return;
- }
-
- // check if icon exists
- if (!favIconForUrl(url).isEmpty())
- {
- if (notify)
- emit iconChanged();
- return;
- }
-
- // the simplest way..
- const QString rootUrlString = url.scheme() + QL1S("://") + url.host();
-
- // find favicon url
- KUrl faviconUrl(rootUrlString + QL1S("/favicon.ico"));
-
-
- QWebElement root = mFrame->documentElement();
- QWebElement e = root.findFirst(QL1S("link[rel~=\"icon\"]"));
- QString relUrlString = e.attribute(QL1S("href"));
- if (relUrlString.isEmpty())
- {
- e = root.findFirst(QL1S("link[rel~=\"shortcut icon\"]"));
- relUrlString = e.attribute(QL1S("href"));
- }
-
- if (!relUrlString.isEmpty())
- {
- faviconUrl = relUrlString.startsWith(QL1S("http"))
- ? KUrl(relUrlString)
- : KUrl(rootUrlString + QL1C('/') + relUrlString);
- }
-
- // dest url
- KUrl destUrl(_faviconsDir + url.host());
-
- IconDownloader *id = new IconDownloader(faviconUrl, destUrl, this);
- if (notify)
- connect(id, SIGNAL(iconReady()), this, SIGNAL(iconChanged()));
-}
-
-
-void IconManager::downloadIconFromUrl(const KUrl &url)
-{
- new WebIcon(url, this);
-}
-
-
-void IconManager::clearIconCache()
-{
- QDir d(_faviconsDir);
- QStringList favicons = d.entryList();
- Q_FOREACH(const QString & fav, favicons)
- {
- d.remove(fav);
- }
-}
-
-
-void IconManager::saveDesktopIconForUrl(const KUrl &u)
-{
- KIcon icon = iconForUrl(u);
- QString destPath = _faviconsDir + u.host() + QL1S("_WEBAPPICON.png");
-
- QPixmap pix = icon.pixmap(16, 16);
- int s = KIconLoader::global()->currentSize(KIconLoader::Desktop);
- pix = pix.scaled(s, s);
-
- pix.save(destPath);
-}
-
-
-// NOTE: this function is builded "around" the iconForurl one. It basically returns the same things
-// with an important difference: this one returns paths while the other one returns KIcons
-QString IconManager::iconPathForUrl(const KUrl &url)
-{
- // first things first.. avoid infinite loop at startup
- if (url.isEmpty() || rApp->mainWindowList().isEmpty())
- {
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/mimetypes/text-html.png");
- return icon;
- }
-
- QByteArray encodedUrl = url.toEncoded();
- // rekonq icons..
- if (encodedUrl == QByteArray("about:home"))
- {
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/actions/go-home.png");
- return icon;
- }
- if (encodedUrl == QByteArray("about:closedTabs"))
- {
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/actions/tab-close.png");
- return icon;
- }
- if (encodedUrl == QByteArray("about:history"))
- {
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/actions/view-history.png");
- return icon;
- }
- if (encodedUrl == QByteArray("about:bookmarks"))
- {
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/places/bookmarks.png");
- return icon;
- }
- if (encodedUrl == QByteArray("about:favorites"))
- {
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/emblems/emblem-favorite.png");
- return icon;
- }
- if (encodedUrl == QByteArray("about:downloads"))
- {
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/actions/download.png");
- return icon;
- }
- if (encodedUrl == QByteArray("about:tabs"))
- {
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/actions/tab-duplicate.png");
- return icon;
- }
-
- // TODO: return other mimetype icons
- if (url.isLocalFile())
- {
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/places/folder.png");
- return icon;
- }
-
- QString i = favIconForUrl(url);
- if (!i.isEmpty())
- {
- return QL1S("file://") + _faviconsDir + i;
- }
-
- // Not found icon. Return default one.
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/mimetypes/text-html.png");
- return icon;
-}
-
-
-QString IconManager::favIconForUrl(const KUrl &url)
-{
- if (url.isLocalFile()
- || !url.protocol().startsWith(QL1S("http")))
- return QString();
-
- if (QFile::exists(_faviconsDir + url.host() + QL1S(".png")))
- return url.host() + QL1S(".png");
- else
- return QString();
-}
diff --git a/src/iconmanager.h b/src/iconmanager.h
deleted file mode 100644
index f5416a95..00000000
--- a/src/iconmanager.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef ICON_MANAGER_H
-#define ICON_MANAGER_H
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QObject>
-#include <QString>
-
-// Forward Declarations
-class KIcon;
-class QWebFrame;
-class KJob;
-
-
-class REKONQ_TESTS_EXPORT IconManager : public QObject
-{
- Q_OBJECT
-
-public:
- IconManager(QObject *parent = 0);
-
- KIcon iconForUrl(const KUrl &url);
- QString iconPathForUrl(const KUrl &url);
-
- void provideIcon(QWebFrame *mFrame, const KUrl &url, bool notify = true);
-
- void downloadIconFromUrl(const KUrl &url);
-
- void clearIconCache();
-
- void saveDesktopIconForUrl(const KUrl &u);
-
-Q_SIGNALS:
- void iconChanged();
-
-private:
- bool existsIconForUrl(const KUrl &url);
- QString favIconForUrl(const KUrl &url);
-
- QString _faviconsDir;
-};
-
-
-#endif // ICON_MANAGER_H
diff --git a/src/kspellplugin.cpp b/src/kspellplugin.cpp
deleted file mode 100644
index 6772ef63..00000000
--- a/src/kspellplugin.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Lindsay Mathieson <lindsay dot mathieson at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <stdio.h>
-#include <KDebug>
-#include "kspellplugin.h"
-#include <QTextBoundaryFinder>
-
-#include "rekonq.h"
-
-#define methodDebug() kDebug("KWebSpellChecker: %s", __FUNCTION__)
-
-/////////////////////////////
-// KWebSpellChecker
-
-
-KWebSpellChecker::KWebSpellChecker()
-{
- m_speller = new Sonnet::Speller();
-}
-
-KWebSpellChecker::~KWebSpellChecker()
-{
- delete m_speller;
-}
-
-bool KWebSpellChecker::isContinousSpellCheckingEnabled() const
-{
- return ReKonfig::automaticSpellChecking();
-}
-
-void KWebSpellChecker::toggleContinousSpellChecking()
-{
- ReKonfig::setAutomaticSpellChecking(! ReKonfig::automaticSpellChecking());
-}
-
-void KWebSpellChecker::learnWord(const QString& word)
-{
- Q_UNUSED(word);
-}
-
-void KWebSpellChecker::ignoreWordInSpellDocument(const QString& word)
-{
- Q_UNUSED(word);
-}
-
-static bool isValidWord(const QString &str)
-{
- if (str.isEmpty() || (str.length() == 1 && !str[0].isLetter()))
- {
- return false;
- }
- const int length = str.length();
- for (int i = 0; i < length; ++i)
- {
- if (!str[i].isNumber())
- {
- return true;
- }
- }
- // 'str' only contains numbers
- return false;
-}
-
-void KWebSpellChecker::checkSpellingOfString(const QString& word, int* misspellingLocation, int* misspellingLength)
-{
- // sanity check
- if (misspellingLocation == NULL || misspellingLength == NULL)
- return;
-
- *misspellingLocation = -1;
- *misspellingLength = 0;
-
- kDebug() << word << endl;
-
- QTextBoundaryFinder finder = QTextBoundaryFinder(QTextBoundaryFinder::Word, word);
-
- QTextBoundaryFinder::BoundaryReasons boundary = finder.boundaryReasons();
- int start = finder.position(), end = finder.position();
- bool inWord = (boundary & QTextBoundaryFinder::StartWord) != 0;
- while (finder.toNextBoundary() > 0)
- {
- boundary = finder.boundaryReasons();
- if ((boundary & QTextBoundaryFinder::EndWord) && inWord)
- {
- end = finder.position();
- QString str = finder.string().mid(start, end - start);
- if (isValidWord(str))
- {
-#if 1
- qDebug() << "Word at " << start << " word = '"
- << str << "', len = " << str.length();
-#endif
- if (m_speller->isMisspelled(str))
- {
- *misspellingLocation = start;
- *misspellingLength = end - start;
- }
- return;
- }
- inWord = false;
- }
- if ((boundary & QTextBoundaryFinder::StartWord))
- {
- start = finder.position();
- inWord = true;
- }
- }
-}
-
-QString KWebSpellChecker::autoCorrectSuggestionForMisspelledWord(const QString& word)
-{
- /*
- QStringList words = m_speller->suggest(word);
- if (words.size() > 0)
- return words[0];
- else
- return QString("");
- */
-
-
- return QString("");
-}
-
-void KWebSpellChecker::guessesForWord(const QString& word, const QString& context, QStringList& guesses)
-{
- Q_UNUSED(context);
-
- QStringList words = m_speller->suggest(word);
- guesses = words;
-}
-
-bool KWebSpellChecker::isGrammarCheckingEnabled()
-{
- return false;
-}
-
-void KWebSpellChecker::toggleGrammarChecking()
-{
-}
-
-void KWebSpellChecker::checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength)
-{
- Q_UNUSED(badGrammarLocation);
- Q_UNUSED(badGrammarLength);
-}
-
-
-////////////////////////////////////////////
-// KWebKitPlatformPlugin
-KWebKitPlatformPlugin::KWebKitPlatformPlugin()
-{
-}
-
-KWebKitPlatformPlugin::~KWebKitPlatformPlugin()
-{
-}
-
-
-bool KWebKitPlatformPlugin::supportsExtension(Extension ext) const
-{
- return ext == SpellChecker;
-}
-
-QObject* KWebKitPlatformPlugin::createExtension(Extension ext) const
-{
- if (ext == SpellChecker)
- return new KWebSpellChecker();
- else
- return NULL;
-}
-
-Q_EXPORT_PLUGIN2(kwebspellchecker, KWebKitPlatformPlugin);
-Q_IMPORT_PLUGIN(kwebspellchecker)
-
diff --git a/src/kspellplugin.h b/src/kspellplugin.h
deleted file mode 100644
index faa83106..00000000
--- a/src/kspellplugin.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Lindsay Mathieson <lindsay dot mathieson at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef TESTQWEBSPELLCHECKER_H
-#define TESTQWEBSPELLCHECKER_H
-
-
-#include <QtGlobal>
-#include <QtPlugin>
-#include <sonnet/speller.h>
-#include "qwebkitplatformplugin.h"
-
-
-
-
-class KWebSpellChecker : public QWebSpellChecker
-{
- Q_OBJECT
-public:
- Sonnet::Speller *m_speller;
-
- KWebSpellChecker();
- ~KWebSpellChecker();
-
- virtual bool isContinousSpellCheckingEnabled() const;
- virtual void toggleContinousSpellChecking();
- virtual void learnWord(const QString& word);
- virtual void ignoreWordInSpellDocument(const QString& word);
- virtual void checkSpellingOfString(const QString& word, int* misspellingLocation, int* misspellingLength);
- virtual QString autoCorrectSuggestionForMisspelledWord(const QString& word);
- virtual void guessesForWord(const QString& word, const QString& context, QStringList& guesses);
-
- virtual bool isGrammarCheckingEnabled();
- virtual void toggleGrammarChecking();
- virtual void checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
-};
-
-
-class KWebKitPlatformPlugin : public QObject, public QWebKitPlatformPlugin
-{
- Q_OBJECT
- Q_INTERFACES(QWebKitPlatformPlugin)
-
-public:
- KWebKitPlatformPlugin();
- ~KWebKitPlatformPlugin();
-
- virtual bool supportsExtension(Extension) const;
- virtual QObject* createExtension(Extension) const;
-
-};
-
-#endif \ No newline at end of file
diff --git a/src/main.cpp b/src/main.cpp
deleted file mode 100644
index 6ede3ac3..00000000
--- a/src/main.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// version include
-#include "config-version.h"
-
-// Local Includes
-#include "application.h"
-#include "mainwindow.h"
-
-// KDE Includes
-#include <KAboutData>
-#include <KCmdLineArgs>
-
-// Qt Includes
-#include <QDir>
-
-static const char description[] =
- I18N_NOOP("A lightweight Web Browser for KDE based on WebKit");
-
-
-extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
-{
- KAboutData about("rekonq",
- 0,
- ki18n("rekonq"),
- REKONQ_VERSION,
- ki18n(description),
- KAboutData::License_GPL_V3,
- ki18n("(C) 2008-2012 Andrea Diamantini"),
- KLocalizedString(),
- "http://rekonq.kde.org"
- );
-
- // --------------- about authors -----------------------------
- about.addAuthor(ki18n("Andrea Diamantini"),
- ki18n("Project Lead, Developer, Maintainer"),
- "adjam7@gmail.com",
- "http://www.adjam.org");
-
- about.addAuthor(ki18n("Johannes Tröscher"),
- ki18n("QGraphicsEffect expert. Tabbar highlight animation"),
- "fritz_van_tom@hotmail.com",
- "");
-
- about.addAuthor(ki18n("Furkan Uzumcu"),
- ki18n("A lot of improvements, especially on usability"),
- "furkanuzumcu@gmail.com",
- "");
-
- about.addAuthor(ki18n("Yoann Laissus"),
- ki18n("Developer, History & Bookmarks Improvements"),
- "yoann.laissus@gmail.com",
- "");
-
- about.addAuthor(ki18n("Cédric Bellegarde"),
- ki18n("Patched code quite everywhere :)"),
- "gnumdk@adishatz.1s.fr",
- "");
-
- about.addAuthor(ki18n("Jon Ander Peñalba"),
- ki18n("Bookmarks code peer reviewer. A fantastic help"),
- "jonan88@gmail.com",
- "http://identi.ca/jonan");
-
- about.addAuthor(ki18n("Pierre Rossi"),
- ki18n("Urlbar, tests, new tab page, bars... and more"),
- "pierre.rossi@gmail.com",
- "");
-
- about.addAuthor(ki18n("Lionel Chauvin"),
- ki18n("Development, Ideas, Mockups, rekonq Icon"),
- "megabigbug@yahoo.fr",
- "");
-
- about.addAuthor(ki18n("Siteshwar Vashisht"),
- ki18n("Code, Ideas, sync... and IRC chats!"),
- "siteshwar@gmail.com",
- "");
-
- about.addAuthor(ki18n("Tirtha Chatterjee"),
- ki18n("A lot of nice work, here and there in the code :)"),
- "tirtha.p.chatterjee@gmail.com",
- "");
-
- about.addAuthor(ki18n("Lindsay Mathieson"),
- ki18n("Implemented inline spellcheck, provided hints, discovered bugs"),
- "lindsay.mathieson@gmail.com",
- "");
-
- // --------------- about credits -----------------------------
- about.addCredit(ki18n("Dawit Alemayehu"),
- ki18n("KDEWebKit (main) developer. And KIO. And KUriFilter. And more.."),
- "adawit@kde.org",
- "");
-
- about.addCredit(ki18n("Jekyll Wu"),
- ki18n("Bug triaging. Impressive job about..."),
- "adaptee@gmail.com",
- "");
-
- about.addCredit(ki18n("Panagiotis Papadopoulos"),
- ki18n("Quite everything but code"),
- "pano_90@gmx.net",
- "");
-
- about.addCredit(ki18n("Phaneendra Hedge"),
- ki18n("Nepomuk fancy bookmarking"),
- "pnh.pes@gmail.com",
- "");
-
- about.addCredit(ki18n("Jonathan Raphael Joachim Kolberg"),
- ki18n("Handbook, Maintains a Kubuntu PPA with rekonq git packages"),
- "bulldog98@freenet.de",
- "");
-
- about.addCredit(ki18n("Benjamin Poulain"),
- ki18n("The \"QtWebKit guy\". Adblock (new) implementation. Code quality improvements"),
- "ikipou@gmail.com",
- "http://www.openyourcode.org/");
-
- about.addCredit(ki18n("Rohan Garg"),
- ki18n("Handbook, Maintains a Kubuntu PPA with rekonq git packages."),
- "rohan16garg@gmail.com",
- "");
-
- about.addCredit(ki18n("Anton Kreuzkamp"),
- ki18n("Session Management, patches"),
- "akreuzkamp@web.de",
- "");
-
- about.addCredit(ki18n("David E. Narváez"),
- ki18n("Implemented User Session Management and cleaned up SessionManager code"),
- "david.narvaez@computer.org",
- "");
-
- about.addCredit(ki18n("Marc Deop"),
- ki18n("Access Keys Navigation"),
- "damnshock@gmail.com",
- "");
-
- about.addCredit(ki18n("Yuri Chornoivan"),
- ki18n("Checking rekonq strings, helping with docs"),
- "yurchor@ukr.net",
- "");
-
- about.addCredit(ki18n("Burkhard Lück"),
- ki18n("Checking rekonq strings, helping with docs"),
- "lueck@hube-lueck.de",
- "");
-
- about.addCredit(ki18n("Andrius da Costa Ribas"),
- ki18n("Helped letting rekonq compile on Windows/MSVC and Mac OS X"),
- "andriusmao@gmail.com",
- "");
-
- about.addCredit(ki18n("Pino Toscano"),
- ki18n("fixuifiles ;)"),
- "pino@kde.org",
- "");
-
- // Initialize command line args
- KCmdLineArgs::init(argc, argv, &about);
-
- // Define the command line options using KCmdLineOptions
- KCmdLineOptions options;
-
- // adding URL option
- options.add("+[URL]" , ki18n("Location to open"));
-
- // Register the supported options
- KCmdLineArgs::addCmdLineOptions(options);
-
- // Add options from Application class
- Application::addCmdLineOptions();
-
- if (!Application::start())
- {
- kWarning() << "rekonq is already running!";
- return 0;
- }
-
-#if defined(Q_WS_X11)
- // On X11, the raster engine gives better performance than native.
- QApplication::setGraphicsSystem(QL1S("raster"));
-#endif
-
- Application app;
-
- // set application data
- QCoreApplication::setApplicationName(QL1S("rekonq"));
- QCoreApplication::setApplicationVersion(REKONQ_VERSION);
-
- KCmdLineArgs::setCwd(QDir::currentPath().toUtf8());
-
- if (app.isSessionRestored())
- for (int i = 1; MainWindow::canBeRestored(i); i++)
- app.newMainWindow(false)->restore(i);
-
- return app.exec();
-}
diff --git a/src/mainview.cpp b/src/mainview.cpp
deleted file mode 100644
index aa6526e8..00000000
--- a/src/mainview.cpp
+++ /dev/null
@@ -1,848 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "mainview.h"
-#include "mainview.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "historymanager.h"
-#include "iconmanager.h"
-#include "mainwindow.h"
-#include "sessionmanager.h"
-#include "stackedurlbar.h"
-#include "tabbar.h"
-#include "urlbar.h"
-#include "webpage.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KAction>
-#include <KLocalizedString>
-#include <KMessageBox>
-#include <KStandardDirs>
-
-#include <config-kactivities.h>
-#ifdef HAVE_KACTIVITIES
-#include <KActivities/ResourceInstance>
-#endif
-
-// Qt Includes
-#include <QtGui/QLabel>
-#include <QtGui/QMovie>
-#include <QtGui/QToolButton>
-
-
-MainView::MainView(QWidget *parent)
- : KTabWidget(parent)
- , m_widgetBar(new StackedUrlBar(this))
- , m_addTabButton(0)
- , m_currentTabIndex(0)
-{
- // setting tabbar
- TabBar *tabBar = new TabBar(this);
- m_addTabButton = new QToolButton(this);
- setTabBar(tabBar);
-
- tabBar->show();
- // set mouse tracking for tab previews
- setMouseTracking(true);
-
- // loading pixmap path
- m_loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.mng");
-
- // connecting tabbar signals
- connect(tabBar, SIGNAL(closeTab(int)), this, SLOT(closeTab(int)));
- connect(tabBar, SIGNAL(mouseMiddleClick(int)), this, SLOT(closeTab(int)));
- connect(tabBar, SIGNAL(newTabRequest()), this, SLOT(newTab()));
-
- connect(tabBar, SIGNAL(cloneTab(int)), this, SLOT(cloneTab(int)));
- connect(tabBar, SIGNAL(closeOtherTabs(int)), this, SLOT(closeOtherTabs(int)));
- connect(tabBar, SIGNAL(reloadTab(int)), this, SLOT(reloadTab(int)));
- connect(tabBar, SIGNAL(reloadAllTabs()), this, SLOT(reloadAllTabs()));
- connect(tabBar, SIGNAL(detachTab(int)), this, SLOT(detachTab(int)));
-
- connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
- connect(tabBar, SIGNAL(tabMoved(int, int)), m_widgetBar, SLOT(moveBar(int, int)));
-
- // Update the add tab button for each tabbar layout change
- connect(tabBar, SIGNAL(tabLayoutChanged()), this, SLOT(updateAddTabButton()));
-
- // current page index changing
- connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentChanged(int)));
- connect(this, SIGNAL(currentChanged(int)), rApp->sessionManager(), SLOT(saveSession()));
-
- QList<TabHistory> list = rApp->sessionManager()->closedSites();
- Q_FOREACH(const TabHistory & tab, list)
- {
- if (tab.url.startsWith(QL1S("about")))
- continue;
- m_recentlyClosedTabs.removeAll(tab);
- m_recentlyClosedTabs.prepend(tab);
- }
-}
-
-
-MainView::~MainView()
-{
- // NOTE
- // we wanna delete m_widgetBar later to get sure
- // all its children (i.e. the urlbars) got deleted in
- // WebTab dtor.
- m_widgetBar->deleteLater();
-}
-
-
-void MainView::addNewTabButton(QAction *newTabAction)
-{
- m_addTabButton->setDefaultAction(newTabAction);
-
- m_addTabButton->setAutoRaise(true);
- m_addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
-}
-
-
-TabBar *MainView::tabBar() const
-{
- TabBar *tabBar = qobject_cast<TabBar *>(KTabWidget::tabBar());
- return tabBar;
-}
-
-
-UrlBar *MainView::currentUrlBar() const
-{
- return currentWebTab()->urlBar();
-}
-
-
-WebTab *MainView::currentWebTab() const
-{
- int i = currentIndex();
- WebTab *b = webTab(i);
- if (b)
- return b;
-
- kDebug() << "We failed to find the current tab!!! Let's go sure with the first one...";
- return webTab(0);
-}
-
-
-QList<TabHistory> MainView::recentlyClosedTabs()
-{
- return m_recentlyClosedTabs;
-}
-
-
-void MainView::updateTabBarVisibility()
-{
- // Get sure tabbar is well shown (and hided) during fullscreen navigation
- // NOTE: don't ask me why, but it seems that using code like:
- // MainWindow *w = qobject_cast<MainWindow *>(parent());
- // does NOT work here. So, I'm asking you: WHY???
- MainWindow *w = rApp->mainWindow();
- if (w && !w->isFullScreen())
- {
- if (tabBar()->isHidden())
- {
- tabBar()->show();
- }
-
- // this to ensure tab button visibility also on new window creation
- if (m_addTabButton->isHidden())
- {
- m_addTabButton->show();
- }
- }
-}
-
-
-void MainView::updateAddTabButton()
-{
- if (!ReKonfig::alwaysShowTabBar())
- {
- bool b = (count() == 1);
-
- tabBar()->setVisible(!b);
- m_addTabButton->setVisible(!b);
- if (b)
- return;
- }
-
- // update tab button position
- int tabWidgetWidth = frameSize().width();
- int tabBarWidth = tabBar()->sizeHint().width();
-
- if (tabBarWidth + m_addTabButton->width() > tabWidgetWidth)
- {
- setCornerWidget(m_addTabButton);
- }
- else
- {
- setCornerWidget(0);
- m_addTabButton->move(tabBarWidth, 0);
- }
-}
-
-
-void MainView::webReload()
-{
- reloadTab(currentIndex());
-}
-
-
-void MainView::webStop()
-{
- WebTab *tabToStop = currentWebTab();
- QAction *action = tabToStop->view()->page()->action(QWebPage::Stop);
- action->trigger();
-}
-
-
-// When index is -1 index chooses the current tab
-void MainView::reloadTab(int index)
-{
- if (index < 0)
- index = currentIndex();
- if (index < 0 || index >= count())
- return;
-
- WebTab *reloadingTab = webTab(index);
- if (reloadingTab->view()->url().scheme() != QL1S("about"))
- {
- QAction *action = reloadingTab->view()->page()->action(QWebPage::Reload);
- action->trigger();
- }
- else
- {
- reloadingTab->view()->setUrl(reloadingTab->page()->loadingUrl());
- }
-}
-
-
-// this slot is called on tab switching
-void MainView::currentChanged(int index)
-{
- // retrieve the webview related to the index
- WebTab *tab = this->webTab(index);
- if (!tab)
- return;
-
- // retrieve the old webview (that where we move from)
- WebTab *oldTab = this->webTab(m_currentTabIndex);
-
- WebView *view = tab->view();
-
-#ifdef HAVE_KACTIVITIES
- if (!QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
- if (oldTab) {
- WebView *oldView = oldTab->view();
- if (activityResourceInstance(oldView)) {
- activityResourceInstance(oldView)->notifyFocusedOut();
- }
- }
-
- if (activityResourceInstance(view)) {
- activityResourceInstance(view)->notifyFocusedIn();
- }
- }
-#endif
-
- // set current index
- m_currentTabIndex = index;
-
- if (oldTab)
- {
- // disconnecting webpage from mainview
- disconnect(oldTab->page(), SIGNAL(statusBarMessage(QString)),
- this, SIGNAL(showStatusBarMessage(QString)));
- disconnect(oldTab->page(), SIGNAL(linkHovered(QString, QString, QString)),
- this, SIGNAL(linkHovered(QString)));
- }
-
- connect(tab->page(), SIGNAL(statusBarMessage(QString)),
- this, SIGNAL(showStatusBarMessage(QString)));
- connect(tab->page(), SIGNAL(linkHovered(QString, QString, QString)),
- this, SIGNAL(linkHovered(QString)));
-
- emit currentTitle(view->title());
- m_widgetBar->setCurrentIndex(index);
-
- // clean up "status bar"
- emit showStatusBarMessage(QString());
-
- // notify UI to eventually switch stop/reload button
- emit currentTabStateChanged();
-
- // set focus to the current webview
- if (tab->url().scheme() == QL1S("about"))
- m_widgetBar->currentWidget()->setFocus();
- else
- view->setFocus();
-
- tabBar()->resetTabHighlighted(index);
-}
-
-
-WebTab *MainView::webTab(int index) const
-{
- WebTab *tab = qobject_cast<WebTab *>(this->widget(index));
- if (tab)
- {
- return tab;
- }
-
- kDebug() << "WebTab with index " << index << "not found. Returning NULL." ;
- return 0;
-}
-
-
-WebTab *MainView::newWebTab(bool focused)
-{
- WebTab *tab = new WebTab(this);
-
- // connecting webview with mainview
- connect(tab->view(), SIGNAL(loadStarted()), this, SLOT(webViewLoadStarted()));
- connect(tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(webViewLoadFinished(bool)));
- connect(tab, SIGNAL(titleChanged(QString)), this, SLOT(webViewTitleChanged(QString)));
- connect(tab->view(), SIGNAL(urlChanged(QUrl)), this, SLOT(webViewUrlChanged(QUrl)));
- connect(tab->view(), SIGNAL(iconChanged()), this, SLOT(webViewIconChanged()));
- connect(tab->view(), SIGNAL(openPreviousInHistory()), this, SIGNAL(openPreviousInHistory()));
- connect(tab->view(), SIGNAL(openNextInHistory()), this, SIGNAL(openNextInHistory()));
-
- // connecting webPage signals with mainview
- connect(tab->page(), SIGNAL(windowCloseRequested()), this, SLOT(windowCloseRequested()));
- connect(tab->page(), SIGNAL(printRequested(QWebFrame*)), this, SIGNAL(printRequested(QWebFrame*)));
-
- bool openNearCurrent = true;
- if (sender())
- openNearCurrent = sender()->objectName() != "new_tab" ? true : false;
- if (ReKonfig::openNewTabsNearCurrent() && openNearCurrent)
- {
- insertTab(currentIndex() + 1, tab, i18n("(Untitled)"));
- m_widgetBar->insertWidget(currentIndex() + 1, tab->urlBar());
- }
- else
- {
- addTab(tab, i18n("(Untitled)"));
- m_widgetBar->addWidget(tab->urlBar());
- }
-
- if (focused)
- {
- setCurrentWidget(tab);
- }
-
- return tab;
-}
-
-
-void MainView::newTab()
-{
- WebView *w = newWebTab()->view();
-
- currentUrlBar()->setFocus();
-
- switch (ReKonfig::newTabsBehaviour())
- {
- case 0: // new tab page
- w->load(KUrl("about:home"));
- break;
- case 1: // blank page
- currentUrlBar()->clear();
- break;
- case 2: // homepage
- w->load(KUrl(ReKonfig::homePage()));
- break;
- default:
- break;
- }
-}
-
-
-void MainView::reloadAllTabs()
-{
- for (int i = 0; i < count(); ++i)
- {
- reloadTab(i);
- }
-}
-
-
-void MainView::windowCloseRequested()
-{
- WebPage *page = qobject_cast<WebPage *>(sender());
- if (!page)
- return;
-
- WebView *view = qobject_cast<WebView *>(page->view());
- int index = indexOf(view->parentWidget());
-
- if (index >= 0)
- {
- if (count() == 1)
- {
- MainWindow *w = qobject_cast<MainWindow *>(parent());
- w->close();
- }
- else
- {
- closeTab(index);
- }
- return;
- }
-}
-
-
-void MainView::closeOtherTabs(int index)
-{
- if (index < 0)
- index = currentIndex();
- if (index < 0 || index >= count())
- return;
-
- for (int i = count() - 1; i > index; --i)
- {
- closeTab(i);
- }
-
- for (int i = index - 1; i >= 0; --i)
- {
- closeTab(i);
- }
-}
-
-
-void MainView::cloneTab(int index)
-{
- if (index < 0)
- index = currentIndex();
- if (index < 0 || index >= count())
- return;
-
- KUrl url = webTab(index)->url();
- QWebHistory* history = webTab(index)->view()->history();
-
- rApp->mainWindow()->loadUrl(url, Rekonq::NewTab, history);
-}
-
-
-// When index is -1 index chooses the current tab
-void MainView::closeTab(int index, bool del)
-{
- if (index < 0)
- index = currentIndex();
- if (index < 0 || index >= count())
- return;
-
- WebTab *tabToClose = webTab(index);
- if (!tabToClose)
- return;
-
- if (tabToClose->view()->isModified())
- {
- int risp = KMessageBox::warningContinueCancel(this,
- i18n("This tab contains changes that have not been submitted.\n"
- "Closing the tab will discard these changes.\n"
- "Do you really want to close this tab?\n"),
- i18n("Closing Modified Tab"), KGuiItem(i18n("Close &Tab"), "tab-close"), KStandardGuiItem::cancel());
- if (risp != KMessageBox::Continue)
- return;
- }
-
- if (!tabToClose->url().isEmpty()
- && tabToClose->url().scheme() != QL1S("about")
- && !QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)
- )
- {
- const int recentlyClosedTabsLimit = 8;
- TabHistory history(tabToClose->view()->history());
- history.title = tabToClose->view()->title();
- history.url = tabToClose->url().url();
-
- m_recentlyClosedTabs.removeAll(history);
- if (m_recentlyClosedTabs.count() == recentlyClosedTabsLimit)
- m_recentlyClosedTabs.removeLast();
- m_recentlyClosedTabs.prepend(history);
- }
-
- // what to do if there is just one tab...
- if (count() == 1)
- {
- if (ReKonfig::lastTabClosesWindow())
- {
- emit closeWindow();
- return;
- }
-
- // open default homePage if just one tab is opened
- WebView *w = currentWebTab()->view();
-
- if (currentWebTab()->url().protocol() == QL1S("about"))
- return;
-
- switch (ReKonfig::newTabsBehaviour())
- {
- case 0: // new tab page
- case 1: // blank page
- w->load(KUrl("about:home"));
- currentUrlBar()->setFocus();
- break;
- case 2: // homepage
- w->load(KUrl(ReKonfig::homePage()));
- break;
- default:
- break;
- }
- return;
- }
- // else...
-
- removeTab(index);
-
- m_widgetBar->removeWidget(tabToClose->urlBar());
- m_widgetBar->setCurrentIndex(m_currentTabIndex);
-
- if (del)
- {
- tabToClose->deleteLater();
- }
-}
-
-
-void MainView::webViewLoadStarted()
-{
- WebView *view = qobject_cast<WebView *>(sender());
- if (!view)
- return;
-
- int index = indexOf(view->parentWidget());
- if (-1 != index)
- {
- QLabel *label = animatedLoading(index, true);
- if (label->movie())
- {
- label->movie()->start();
- }
- }
-
- if (index != currentIndex())
- return;
-
- emit currentTabStateChanged();
- emit showStatusBarMessage(i18n("Loading..."), Rekonq::Info);
-
- if (view == currentWebTab()->view()
- && !currentUrlBar()->hasFocus()
- && view->url().scheme() != QL1S("about"))
- {
- view->setFocus();
- }
-}
-
-
-void MainView::webViewLoadFinished(bool ok)
-{
- WebView *view = qobject_cast<WebView *>(sender());
- int index = -1;
- if (view)
- index = indexOf(view->parentWidget());
-
- if (-1 != index)
- {
- QLabel *label = animatedLoading(index, true);
- QMovie *movie = label->movie();
- if (movie)
- movie->stop();
- }
-
- webViewIconChanged();
- emit currentTabStateChanged();
-
- // don't display messages for background tabs
- if (index != currentIndex())
- {
- return;
- }
-
- if (ok)
- emit showStatusBarMessage(i18n("Done"), Rekonq::Info);
-// else
-// emit showStatusBarMessage(i18n("Failed to load"), Rekonq::Error);
-}
-
-
-void MainView::webViewIconChanged()
-{
- WebView *view = qobject_cast<WebView *>(sender());
- if (!view)
- return;
-
- WebTab *tab = qobject_cast<WebTab *>(view->parent());
- const int index = indexOf(tab);
-
- if (-1 != index)
- {
- KIcon icon = rApp->iconManager()->iconForUrl(tab->url());
- QLabel *label = animatedLoading(index, false);
- QMovie *movie = label->movie();
- delete movie;
- label->setMovie(0);
- label->setPixmap(icon.pixmap(16, 16));
- }
-}
-
-
-void MainView::webViewTitleChanged(const QString &title)
-{
- QString viewTitle = title.isEmpty() ? i18n("(Untitled)") : title;
- QString tabTitle = viewTitle;
- tabTitle.replace('&', "&&");
-
- WebTab *tab = qobject_cast<WebTab *>(sender());
- if (!tab)
- return;
-
- int index = indexOf(tab);
- if (-1 != index)
- {
- setTabText(index, tabTitle);
- }
-
- if (currentIndex() == index)
- {
- emit currentTitle(viewTitle);
- }
- else
- {
- if (tabTitle != i18n("(Untitled)"))
- tabBar()->setTabHighlighted(index);
- }
-
- if (ReKonfig::hoveringTabOption() == 1)
- tabBar()->setTabToolTip(index, tabTitle.remove('&'));
-}
-
-
-void MainView::webViewUrlChanged(const QUrl &url)
-{
- WebView *view = qobject_cast<WebView *>(sender());
- if (!view)
- return;
-
- WebTab *tab = qobject_cast<WebTab *>(view->parentWidget());
- if (!tab)
- return;
-
-#ifdef HAVE_KACTIVITIES
- if (
- !QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled) &&
- !url.isEmpty() &&
- url.scheme() != "about"
- )
- {
- if (!activityResourceInstance(view)) {
- new KActivities::ResourceInstance(window()->winId(), view);
- }
-
- activityResourceInstance(view)->setUri(url);
- }
-#endif
-
- int index = indexOf(tab);
- if (ReKonfig::hoveringTabOption() == 2)
- tabBar()->setTabToolTip(index, url.toString());
-
- if (tab == rApp->mainWindow()->currentTab())
- rApp->mainWindow()->updateHistoryActions();
-}
-
-
-void MainView::nextTab()
-{
- int next = currentIndex() + 1;
- if (next == count())
- next = 0;
- setCurrentIndex(next);
-}
-
-
-void MainView::previousTab()
-{
- int next = currentIndex() - 1;
- if (next < 0)
- next = count() - 1;
- setCurrentIndex(next);
-}
-
-
-void MainView::openClosedTab()
-{
- KAction *action = qobject_cast<KAction *>(sender());
- if (!action)
- return;
-
- int index = action->data().toInt();
- kDebug() << "TAB INDEX TO RESTORE:" << index;
- restoreClosedTab(index);
-}
-
-
-void MainView::restoreClosedTab(int i, bool inNewTab)
-{
- if (m_recentlyClosedTabs.isEmpty())
- return;
-
- TabHistory history = m_recentlyClosedTabs.takeAt(i);
-
- WebView *view = inNewTab
- ? newWebTab()->view()
- : currentWebTab()->view()
- ;
-
- history.applyHistory(view->history());
- view->load(KUrl(history.url));
-
- // just to get sure...
- m_recentlyClosedTabs.removeAll(history);
-}
-
-
-void MainView::switchToTab(const int index)
-{
- if (index <= 0 || index > count())
- return;
- setCurrentIndex(index - 1);
-}
-
-
-void MainView::loadFavorite(const int index)
-{
- QStringList urls = ReKonfig::previewUrls();
- if (index < 0 || index > urls.length())
- return;
- KUrl url = KUrl(urls.at(index - 1));
- rApp->loadUrl(url);
- currentWebTab()->setFocus();
-}
-
-
-QLabel *MainView::animatedLoading(int index, bool addMovie)
-{
- if (index == -1)
- return 0;
-
- QLabel *label = qobject_cast<QLabel* >(tabBar()->tabButton(index, QTabBar::LeftSide));
- if (!label)
- {
- label = new QLabel(this);
- }
- if (addMovie && !label->movie())
- {
- QMovie *movie = new QMovie(m_loadingGitPath, QByteArray(), label);
- movie->setSpeed(50);
- label->setMovie(movie);
- movie->start();
- }
- tabBar()->setTabButton(index, QTabBar::LeftSide, 0);
- tabBar()->setTabButton(index, QTabBar::LeftSide, label);
- return label;
-}
-
-
-void MainView::detachTab(int index, MainWindow *toWindow)
-{
- if (index < 0)
- index = currentIndex();
- if (index < 0 || index >= count())
- return;
-
- WebTab *tab = webTab(index);
- KUrl u = tab->url();
- if (u.scheme() == QL1S("about"))
- {
- closeTab(index);
- rApp->loadUrl(u, Rekonq::NewWindow);
- }
- else
- {
- QString label = tab->view()->title();
- UrlBar *bar = tab->urlBar();
- closeTab(index, false);
-
- MainWindow *w;
- if (toWindow == NULL)
- w = rApp->newMainWindow(false);
- else
- w = toWindow;
-
- w->mainView()->addTab(tab, label);
- w->mainView()->widgetBar()->insertWidget(0, bar);
-
- // reconnect signals to the new mainview
- // Code copied from newWebTab(), any new changes there should be applied here
-
- // disconnecting webview with old mainview
- disconnect(tab->view(), SIGNAL(loadStarted()));
- disconnect(tab->view(), SIGNAL(loadFinished(bool)));
- disconnect(tab, SIGNAL(titleChanged(QString)));
- disconnect(tab->view(), SIGNAL(urlChanged(QUrl)));
- disconnect(tab->view(), SIGNAL(iconChanged()));
- disconnect(tab->view(), SIGNAL(openPreviousInHistory()));
- disconnect(tab->view(), SIGNAL(openNextInHistory()));
-
- // disconnecting webPage signals with old mainview
- disconnect(tab->page(), SIGNAL(windowCloseRequested()));
- disconnect(tab->page(), SIGNAL(printRequested(QWebFrame*)));
-
- // connecting webview with new mainview
- connect(tab->view(), SIGNAL(loadStarted()), w->mainView(), SLOT(webViewLoadStarted()));
- connect(tab->view(), SIGNAL(loadFinished(bool)), w->mainView(), SLOT(webViewLoadFinished(bool)));
- connect(tab, SIGNAL(titleChanged(QString)), w->mainView(), SLOT(webViewTitleChanged(QString)));
- connect(tab->view(), SIGNAL(urlChanged(QUrl)), w->mainView(), SLOT(webViewUrlChanged(QUrl)));
- connect(tab->view(), SIGNAL(iconChanged()), w->mainView(), SLOT(webViewIconChanged()));
- connect(tab->view(), SIGNAL(openPreviousInHistory()), w->mainView(), SIGNAL(openPreviousInHistory()));
- connect(tab->view(), SIGNAL(openNextInHistory()), w->mainView(), SIGNAL(openNextInHistory()));
-
- // connecting webPage signals with new mainview
- connect(tab->page(), SIGNAL(windowCloseRequested()), w->mainView(), SLOT(windowCloseRequested()));
- connect(tab->page(), SIGNAL(printRequested(QWebFrame*)), w->mainView(), SIGNAL(printRequested(QWebFrame*)));
- }
-}
-
-#ifdef HAVE_KACTIVITIES
-KActivities::ResourceInstance * MainView::activityResourceInstance(WebView * view)
-{
- return view->findChild<KActivities::ResourceInstance*> ();
-}
-#endif
-
diff --git a/src/mainview.h b/src/mainview.h
deleted file mode 100644
index d8547530..00000000
--- a/src/mainview.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef MAINVIEW_H
-#define MAINVIEW_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-#include "historymanager.h"
-
-// KDE Includes
-#include <KTabWidget>
-
-// Config
-#include <config-kactivities.h>
-
-// Forward Declarations
-class MainWindow;
-class StackedUrlBar;
-class TabBar;
-class UrlBar;
-class WebTab;
-class WebView;
-
-class QLabel;
-class QToolButton;
-class QUrl;
-class QWebFrame;
-
-#ifdef HAVE_KACTIVITIES
-namespace KActivities { class ResourceInstance; }
-#endif
-
-
-/**
- * This class represent rekonq Main View.
- * It contains all WebViews and the url bar.
- *
- */
-
-class REKONQ_TESTS_EXPORT MainView : public KTabWidget
-{
- Q_OBJECT
-
-public:
- MainView(QWidget *parent);
- ~MainView();
-
- inline StackedUrlBar *widgetBar() const
- {
- return m_widgetBar;
- }
-
- TabBar *tabBar() const;
-
- WebTab *currentWebTab() const;
- UrlBar *currentUrlBar() const;
-
- WebTab *webTab(int index) const;
-
- void addNewTabButton(QAction *);
-
- void updateTabBarVisibility();
-
- inline QToolButton *addTabButton() const
- {
- return m_addTabButton;
- }
-
- /**
- * This function creates a new empty tab
- * with a webview inside
- * @param focused decide if you wannna give focus
- * (or not) to this new tab (default true)
- * @return the webview embedded in the new tab
- */
- WebTab *newWebTab(bool focused = true);
-
- QList<TabHistory> recentlyClosedTabs();
-
- void restoreClosedTab(int i, bool inNewTab = true);
-
-Q_SIGNALS:
- // current tab signals
- void currentTitle(const QString &url);
- void showStatusBarMessage(const QString &message, Rekonq::Notify status = Rekonq::Info);
- void linkHovered(const QString &link);
- void openPreviousInHistory();
- void openNextInHistory();
- void closeWindow();
-
- void printRequested(QWebFrame *frame);
-
- /**
- * Current tab state changed:
- * 1. tab is loading
- * 2. tab finished loading
- * 3. tab urlbar got focus
- */
- void currentTabStateChanged();
-
-public Q_SLOTS:
- /**
- * Core browser slot. This create a new tab with a WebView inside
- * for browsing and follows rekonq settings about opening there a
- * home/blank/rekonq page
- *
- */
- void newTab();
-
- // Indexed slots
- void cloneTab(int index = -1);
- void closeTab(int index = -1, bool del = true);
- void closeOtherTabs(int index = -1);
- void reloadTab(int index = -1);
-
- /**
- * Detaches tab at @c index to a new window.
- * If @c toWindow is not null, the tab is instead
- * added to existing MainWindow @c toWindow.
- */
- void detachTab(int index = -1, MainWindow *toWindow = NULL);
-
- void reloadAllTabs();
- void nextTab();
- void previousTab();
-
- void switchToTab(const int index);
- void loadFavorite(const int index);
-
- // WEB slot actions
- void webReload();
- void webStop();
-
-private Q_SLOTS:
- void currentChanged(int index);
- void updateAddTabButton();
-
- void webViewLoadStarted();
- void webViewLoadFinished(bool ok);
- void webViewIconChanged();
- void webViewTitleChanged(const QString &title);
- void webViewUrlChanged(const QUrl &url);
-
- void windowCloseRequested();
-
- void openClosedTab();
-
-private:
- /**
- * This function creates (if not exists) and returns a QLabel
- * with a loading QMovie.
- * Imported from Arora's code.
- *
- * @param index the tab index where inserting the animated label
- * @param addMovie creates or not a loading movie
- *
- * @return animated label's pointer
- */
- QLabel *animatedLoading(int index, bool addMovie);
-
-
-// --------------------------------------------------------------------------
-
- StackedUrlBar *m_widgetBar;
-
- QString m_loadingGitPath;
-
- // The original width hint of the mainview for tabs width
- int m_originalWidthHint;
-
- // the new tab button
- QToolButton *m_addTabButton;
-
- int m_currentTabIndex;
-
- QList<TabHistory> m_recentlyClosedTabs;
-
-#ifdef HAVE_KACTIVITIES
- KActivities::ResourceInstance * activityResourceInstance(WebView * view);
-#endif
-};
-
-#endif // MAINVIEW_H
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
deleted file mode 100644
index 7e42e6c1..00000000
--- a/src/mainwindow.cpp
+++ /dev/null
@@ -1,1694 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "mainwindow.h"
-#include "mainwindow.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "adblockmanager.h"
-#include "analyzerpanel.h"
-#include "application.h"
-#include "bookmarkmanager.h"
-#include "bookmarkspanel.h"
-#include "bookmarkstoolbar.h"
-#include "downloadmanager.h"
-#include "findbar.h"
-#include "historymanager.h"
-#include "historypanel.h"
-#include "iconmanager.h"
-#include "mainview.h"
-#include "rekonqmenu.h"
-#include "sessionmanager.h"
-#include "settingsdialog.h"
-#include "stackedurlbar.h"
-#include "syncmanager.h"
-#include "tabbar.h"
-#include "urlbar.h"
-#include "webinspectorpanel.h"
-#include "webpage.h"
-#include "webtab.h"
-#include "zoombar.h"
-#include "useragentmanager.h"
-
-// Ui Includes
-#include "ui_cleardata.h"
-
-// KDE Includes
-#include <KIO/Job>
-
-#include <KAction>
-#include <KEditToolBar>
-#include <KFileDialog>
-#include <KJobUiDelegate>
-#include <KMenu>
-#include <KMenuBar>
-#include <KMessageBox>
-#include <KProcess>
-#include <KPushButton>
-#include <KProtocolManager>
-#include <KStandardDirs>
-#include <KTemporaryFile>
-#include <KToggleFullScreenAction>
-#include <KXMLGUIFactory>
-#include <kdeprintdialog.h>
-
-#include <KParts/Part>
-#include <KParts/BrowserExtension>
-#include <KMimeTypeTrader>
-
-
-// Qt Includes
-#include <QtCore/QTimer>
-
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusReply>
-
-#include <QtGui/QDesktopWidget>
-#include <QtGui/QLabel>
-#include <QtGui/QPrintDialog>
-#include <QtGui/QPrinter>
-#include <QtGui/QVBoxLayout>
-
-#include <QtWebKit/QWebHistory>
-
-#include <QSignalMapper>
-#include <QTextDocument>
-
-
-MainWindow::MainWindow()
- : KXmlGuiWindow()
- , m_view(new MainView(this))
- , m_findBar(new FindBar(this))
- , m_zoomBar(new ZoomBar(this))
- , m_historyPanel(0)
- , m_bookmarksPanel(0)
- , m_webInspectorPanel(0)
- , m_analyzerPanel(0)
- , m_loadStopReloadAction(0)
- , m_historyBackMenu(0)
- , m_historyForwardMenu(0)
- , m_tabListMenu(0)
- , m_bookmarksBar(0)
- , m_popup(new QLabel(this))
- , m_hidePopupTimer(new QTimer(this))
- , m_rekonqMenu(0)
-{
- // Setting attributes (just to be sure...)
- setAttribute(Qt::WA_DeleteOnClose, true);
- setAttribute(Qt::WA_QuitOnClose, true);
-
- // creating a centralWidget containing panel, m_view and the hidden findbar
- QWidget *centralWidget = new QWidget;
- centralWidget->setContentsMargins(0, 0, 0, 0);
-
- // setting layout
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setContentsMargins(0, 0, 0, 0);
- layout->addWidget(m_view);
- layout->addWidget(m_findBar);
- layout->addWidget(m_zoomBar);
- centralWidget->setLayout(layout);
-
- // central widget
- setCentralWidget(centralWidget);
-
- // setting size policies
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-
- // then, setup our actions
- setupActions();
-
- // BEFORE setupGUI, AFTER setupActions!!
- m_view->addNewTabButton(actionByName("new_tab"));
-
- // setting Panels
- setupPanels();
-
- // setting up rekonq tools
- setupTools();
-
- // setting up rekonq toolbar(s)
- setupToolbars();
-
- // a call to KXmlGuiWindow::setupGUI() populates the GUI
- // with actions, using KXMLGUI.
- // It also applies the saved mainwindow settings, if any, and ask the
- // mainwindow to automatically save settings if changed: window size,
- // toolbar position, icon size, etc.
- setupGUI();
-
- // no menu bar in rekonq: we have other plans..
- menuBar()->setVisible(false);
-
- // no more status bar..
- setStatusBar(0);
-
- // setting popup notification
- connect(rApp, SIGNAL(focusChanged(QWidget*, QWidget*)), m_popup, SLOT(hide()));
- m_popup->setAutoFillBackground(true);
- m_popup->setMargin(4);
- m_popup->raise();
- m_popup->hide();
- connect(m_hidePopupTimer, SIGNAL(timeout()), m_popup, SLOT(hide()));
-
- // notification system
- connect(m_view, SIGNAL(showStatusBarMessage(QString, Rekonq::Notify)), this, SLOT(notifyMessage(QString, Rekonq::Notify)));
- connect(m_view, SIGNAL(linkHovered(QString)), this, SLOT(notifyMessage(QString)));
- connect(rApp->downloadManager(), SIGNAL(notifyDownload(QString, Rekonq::Notify)),
- this, SLOT(notifyMessage(QString, Rekonq::Notify)));
-
- // connect signals and slots
- connect(m_view, SIGNAL(currentTitle(QString)), this, SLOT(updateWindowTitle(QString)));
- connect(m_view, SIGNAL(printRequested(QWebFrame*)), this, SLOT(printRequested(QWebFrame*)));
- connect(m_view, SIGNAL(closeWindow()), this, SLOT(close()));
-
- // (shift +) ctrl + tab switching
- connect(this, SIGNAL(ctrlTabPressed()), m_view, SLOT(nextTab()));
- connect(this, SIGNAL(shiftCtrlTabPressed()), m_view, SLOT(previousTab()));
-
- // wheel history navigation
- connect(m_view, SIGNAL(openPreviousInHistory()), this, SLOT(openPrevious()));
- connect(m_view, SIGNAL(openNextInHistory()), this, SLOT(openNext()));
-
- // update actions
- connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(updateHistoryActions()));
- connect(m_view, SIGNAL(currentTabStateChanged()), this, SLOT(updateTabActions()));
-
- // Change window icon according to tab icon
- connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(changeWindowIcon(int)));
-
- // Find Bar signal
- connect(m_findBar, SIGNAL(searchString(QString)), this, SLOT(find(QString)));
-
- // Zoom Bar signal
- connect(m_view, SIGNAL(currentChanged(int)), m_zoomBar, SLOT(updateSlider(int)));
-
- // Save session on window closing
- connect(this, SIGNAL(windowClosing()), rApp->sessionManager(), SLOT(saveSession()));
-
- // Adblock Manager changed rules. Reload current page
- connect(rApp->adblockManager(), SIGNAL(reloadCurrentPage()), m_view, SLOT(webReload()));
-
- // setting up toolbars to NOT have context menu enabled
- setContextMenuPolicy(Qt::DefaultContextMenu);
-
- // accept d'n'd
- setAcceptDrops(true);
-
- // Things that need to be setup after the call to setupGUI() and after ctor call
- QTimer::singleShot(1, this, SLOT(postLaunch()));
-}
-
-
-MainWindow::~MainWindow()
-{
- m_hidePopupTimer->stop();
-
- rApp->bookmarkManager()->removeBookmarkBar(m_bookmarksBar);
- rApp->bookmarkManager()->removeBookmarkPanel(m_bookmarksPanel);
-
- rApp->removeMainWindow(this);
-}
-
-
-void MainWindow::setupToolbars()
-{
- KAction *a;
-
- // location bar
- a = new KAction(i18n("Location Bar"), this);
- a->setDefaultWidget(m_view->widgetBar());
- actionCollection()->addAction(QL1S("url_bar"), a);
-}
-
-
-void MainWindow::postLaunch()
-{
- setupBookmarksAndToolsShortcuts();
-
- // this just to fix reopening rekonq after fullscreen close
- KToolBar *mainBar = toolBar("mainToolBar");
- mainBar->show();
-
- // Bookmarks Bar
- KToolBar *XMLGUIBkBar = toolBar("bookmarkToolBar");
- if (!XMLGUIBkBar)
- return;
-
- if (m_bookmarksBar)
- {
- rApp->bookmarkManager()->removeBookmarkBar(m_bookmarksBar);
- delete m_bookmarksBar;
- }
- m_bookmarksBar = new BookmarkToolBar(XMLGUIBkBar, this);
- rApp->bookmarkManager()->registerBookmarkBar(m_bookmarksBar);
-
- QAction *a;
-
- // Bookmarks bar action
- a = actionByName(QL1S("show_bookmarks_toolbar"));
- a->setChecked(XMLGUIBkBar->isVisible());
- connect(XMLGUIBkBar, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool)));
-
- // History panel action
- a = actionByName(QL1S("show_history_panel"));
- a->setChecked(m_historyPanel->isVisible());
-
- // Bookmarks panel action
- a = actionByName(QL1S("show_bookmarks_panel"));
- a->setChecked(m_bookmarksPanel->isVisible());
-}
-
-
-void MainWindow::toggleBookmarkBarVisible(bool visible)
-{
- if (m_bookmarksBar)
- m_bookmarksBar->toolBar()->setVisible(visible);
-}
-
-
-void MainWindow::configureToolbars()
-{
- if (autoSaveSettings())
- saveAutoSaveSettings();
-
- KEditToolBar dlg(factory(), this);
- // The bookmark bar needs to be refill after the UI changes are finished
- connect(&dlg, SIGNAL(newToolBarConfig()), this, SLOT(postLaunch()));
- dlg.exec();
-}
-
-
-QSize MainWindow::sizeHint() const
-{
- QRect desktopRect = QApplication::desktop()->screenGeometry();
- QSize size = desktopRect.size() * 0.8;
- return size;
-}
-
-
-void MainWindow::changeWindowIcon(int index)
-{
- if (ReKonfig::useFavicon())
- {
- KUrl url = mainView()->webTab(index)->url();
- QIcon icon = rApp->iconManager()->iconForUrl(url).pixmap(QSize(32, 32));
- setWindowIcon(icon);
- }
-}
-
-
-void MainWindow::setupActions()
-{
- // this let shortcuts work..
- actionCollection()->addAssociatedWidget(this);
-
- KAction *a;
-
- // new window action
- a = new KAction(KIcon("window-new"), i18n("&New Window"), this);
- a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_N));
- actionCollection()->addAction(QL1S("new_window"), a);
- connect(a, SIGNAL(triggered(bool)), rApp, SLOT(newWindow()));
-
- // Standard Actions
- KStandardAction::open(this, SLOT(fileOpen()), actionCollection());
- KStandardAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
- KStandardAction::print(this, SLOT(printRequested()), actionCollection());
- KStandardAction::quit(rApp, SLOT(queryQuit()), actionCollection());
-
- a = KStandardAction::find(m_findBar, SLOT(show()), actionCollection());
- KShortcut findShortcut = KStandardShortcut::find();
- a->setShortcut(findShortcut);
-
- KStandardAction::findNext(this, SLOT(findNext()) , actionCollection());
- KStandardAction::findPrev(this, SLOT(findPrevious()) , actionCollection());
-
- a = KStandardAction::fullScreen(this, SLOT(viewFullScreen(bool)), this, actionCollection());
- KShortcut fullScreenShortcut = KStandardShortcut::fullScreen();
- fullScreenShortcut.setAlternate(Qt::Key_F11);
- a->setShortcut(fullScreenShortcut);
-
- a = actionCollection()->addAction(KStandardAction::Home);
- connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(homePage()));
- KStandardAction::preferences(this, SLOT(preferences()), actionCollection());
-
- a = KStandardAction::redisplay(m_view, SLOT(webReload()), actionCollection());
- a->setText(i18n("Reload"));
- KShortcut reloadShortcut = KStandardShortcut::reload();
- reloadShortcut.setAlternate(Qt::CTRL + Qt::Key_R);
- a->setShortcut(reloadShortcut);
-
- a = new KAction(KIcon("process-stop"), i18n("&Stop"), this);
- a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Period));
- actionCollection()->addAction(QL1S("stop"), a);
- connect(a, SIGNAL(triggered(bool)), m_view, SLOT(webStop()));
-
- // load stop reload Action
- m_loadStopReloadAction = new KAction(this);
- actionCollection()->addAction(QL1S("load_stop_reload") , m_loadStopReloadAction);
- m_loadStopReloadAction->setShortcutConfigurable(false);
-
- // Open location action
- a = new KAction(i18n("Open Location"), this);
- KShortcut openLocationShortcut(Qt::CTRL + Qt::Key_L);
- openLocationShortcut.setAlternate(Qt::ALT + Qt::Key_D);
- a->setShortcut(openLocationShortcut);
- actionCollection()->addAction(QL1S("open_location"), a);
- connect(a, SIGNAL(triggered(bool)) , this, SLOT(openLocation()));
-
- // set zoom bar actions
- m_zoomBar->setupActions(this);
-
- // tab list
- m_tabListMenu = new KMenu();
- m_tabListMenu->addAction("hack"); // necessary to show the menu on the right side the first time
- connect(m_tabListMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowTabListMenu()));
- connect(m_tabListMenu, SIGNAL(triggered(QAction*)), this, SLOT(openActionTab(QAction*)));
- KActionMenu *tabAction = new KActionMenu(i18n("Tab List"), this);
- tabAction->setMenu(m_tabListMenu);
- tabAction->setIcon(KIcon("document-multiple"));
- tabAction->setDelayed(false);
- actionCollection()->addAction(QL1S("tab_list"), tabAction);
-
- // ============================== Bookmark =======================================
- a = KStandardAction::addBookmark(this, SLOT(bookmarkCurrentPage()), actionCollection());
- KShortcut bkShortcut(Qt::CTRL + Qt::Key_D);
- a->setShortcut(bkShortcut);
-
- //================================Download========================================
- a = new KAction(KIcon("download"), i18n("Downloads"), this);
- a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_J));
- actionCollection()->addAction(QL1S("openDownloadsPage"), a);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(openDownloadsPage()));
-
- // =============================== Tools Actions =================================
- a = new KAction(i18n("View Page S&ource"), this);
- a->setIcon(KIcon("application-xhtml+xml"));
- a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_U));
- actionCollection()->addAction(QL1S("page_source"), a);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(viewPageSource()));
-
- a = rApp->privateBrowsingAction();
- a->setShortcut(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_P);
- actionCollection()->addAction(QL1S("private_browsing"), a);
-
- a = new KAction(KIcon("edit-clear"), i18n("Clear Private Data..."), this);
- a->setShortcut(Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_Delete);
- actionCollection()->addAction(QL1S("clear_private_data"), a);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(clearPrivateData()));
-
- // ========================= History related actions ==============================
- a = actionCollection()->addAction(KStandardAction::Back);
- connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)),
- this, SLOT(openPrevious(Qt::MouseButtons, Qt::KeyboardModifiers)));
-
- m_historyBackMenu = new KMenu(this);
- a->setMenu(m_historyBackMenu);
- connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowBackMenu()));
- connect(m_historyBackMenu, SIGNAL(triggered(QAction*)), this, SLOT(openActionUrl(QAction*)));
-
- a = actionCollection()->addAction(KStandardAction::Forward);
- connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)),
- this, SLOT(openNext(Qt::MouseButtons, Qt::KeyboardModifiers)));
-
- m_historyForwardMenu = new KMenu(this);
- a->setMenu(m_historyForwardMenu);
- connect(m_historyForwardMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowForwardMenu()));
- connect(m_historyForwardMenu, SIGNAL(triggered(QAction*)), this, SLOT(openActionUrl(QAction*)));
-
- // ============================== General Tab Actions ====================================
- a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this);
- a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_T));
- actionCollection()->addAction(QL1S("new_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab()));
-
- a = new KAction(KIcon("view-refresh"), i18n("Reload All Tabs"), this);
- actionCollection()->addAction(QL1S("reload_all_tabs"), a);
- connect(a, SIGNAL(triggered(bool)), m_view, SLOT(reloadAllTabs()));
-
- a = new KAction(i18n("Show Next Tab"), this);
- a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext());
- actionCollection()->addAction(QL1S("show_next_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view, SLOT(nextTab()));
-
- a = new KAction(i18n("Show Previous Tab"), this);
- a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev());
- actionCollection()->addAction(QL1S("show_prev_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab()));
-
- a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this);
- a->setData(0); // last tab has always index = 0
- a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T));
- actionCollection()->addAction(QL1S("open_last_closed_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view, SLOT(openClosedTab()));
-
- // shortcuts for quickly switching to a tab
- QSignalMapper *tabSignalMapper = new QSignalMapper(this);
- for (int i = 1; i <= 9; i++)
- {
- a = new KAction(i18n("Switch to Tab %1", i), this);
- a->setShortcut(KShortcut(QString("Alt+%1").arg(i)));
- actionCollection()->addAction(QL1S(QString("switch_tab_" + QString::number(i)).toAscii()), a);
- connect(a, SIGNAL(triggered(bool)), tabSignalMapper, SLOT(map()));
- tabSignalMapper->setMapping(a, i);
- }
- connect(tabSignalMapper, SIGNAL(mapped(int)), m_view, SLOT(switchToTab(int)));
-
- // shortcuts for loading favorite pages
- QSignalMapper *favoritesSignalMapper = new QSignalMapper(this);
- for (int i = 1; i <= 9; ++i)
- {
- a = new KAction(i18n("Switch to Favorite Page %1", i), this);
- a->setShortcut(KShortcut(QString("Ctrl+%1").arg(i)));
- actionCollection()->addAction(QL1S(QString("switch_favorite_" + QString::number(i)).toAscii()), a);
- connect(a, SIGNAL(triggered(bool)), favoritesSignalMapper, SLOT(map()));
- favoritesSignalMapper->setMapping(a, i);
- }
- connect(favoritesSignalMapper, SIGNAL(mapped(int)), m_view, SLOT(loadFavorite(int)));
-
- // ============================== Indexed Tab Actions ====================================
- a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this);
- a->setShortcuts(KStandardShortcut::close());
- actionCollection()->addAction(QL1S("close_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeTab()));
-
- a = new KAction(KIcon("tab-duplicate"), i18n("Clone Tab"), this);
- actionCollection()->addAction(QL1S("clone_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(cloneTab()));
-
- a = new KAction(KIcon("tab-close-other"), i18n("Close &Other Tabs"), this);
- actionCollection()->addAction(QL1S("close_other_tabs"), a);
- connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeOtherTabs()));
-
- a = new KAction(KIcon("view-refresh"), i18n("Reload Tab"), this);
- actionCollection()->addAction(QL1S("reload_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(reloadTab()));
-
- a = new KAction(KIcon("tab-detach"), i18n("Detach Tab"), this);
- actionCollection()->addAction(QL1S("detach_tab"), a);
- connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(detachTab()));
-
- // Bookmark Menu
- KActionMenu *bmMenu = rApp->bookmarkManager()->bookmarkActionMenu(this);
- bmMenu->setIcon(KIcon("bookmarks"));
- bmMenu->setDelayed(false);
- bmMenu->setShortcutConfigurable(true);
- bmMenu->setShortcut(KShortcut(Qt::ALT + Qt::Key_B));
- actionCollection()->addAction(QL1S("bookmarksActionMenu"), bmMenu);
-
- // Bookmark Toolbar
- a = new KAction(KIcon("bookmarks-bar"), i18n("Bookmarks Toolbar"), this);
- a->setCheckable(true);
- actionCollection()->addAction(QL1S("show_bookmarks_toolbar"), a);
- connect(a, SIGNAL(toggled(bool)), this, SLOT(toggleBookmarkBarVisible(bool)));
-
- // User Agent
- a = new KAction(KIcon("preferences-web-browser-identification"), i18n("Browser Identification"), this);
- actionCollection()->addAction(QL1S("useragent"), a);
- KMenu *uaMenu = new KMenu(this);
- a->setMenu(uaMenu);
- connect(uaMenu, SIGNAL(aboutToShow()), this, SLOT(populateUserAgentMenu()));
-
- // Editable Page
- a = new KAction(KIcon("document-edit"), i18n("Set Editable"), this);
- a->setCheckable(true);
- actionCollection()->addAction(QL1S("set_editable"), a);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(setEditable(bool)));
-
- // Adblock
- a = new KAction(KIcon("preferences-web-browser-adblock"), i18n("Ad Block"), this);
- actionCollection()->addAction(QL1S("adblock"), a);
- connect(a, SIGNAL(triggered(bool)), rApp->adblockManager(), SLOT(showSettings()));
-
- // Web Applications
- a = new KAction(KIcon("applications-internet"), i18n("Create application shortcut"), this);
- actionCollection()->addAction(QL1S("webapp_shortcut"), a);
- connect(a, SIGNAL(triggered(bool)), rApp, SLOT(createWebAppShortcut()));
-
- // Sync action
- a = new KAction(KIcon("tools-wizard"), i18n("Sync"), this); // FIXME sync icon!!
- actionCollection()->addAction(QL1S("sync"), a);
- connect(a, SIGNAL(triggered(bool)), rApp->syncManager(), SLOT(showSettings()));
-}
-
-
-void MainWindow::setupTools()
-{
- KActionMenu *toolsAction = new KActionMenu(KIcon("configure"), i18n("&Tools"), this);
- toolsAction->setDelayed(false);
- toolsAction->setShortcutConfigurable(true);
- toolsAction->setShortcut(KShortcut(Qt::ALT + Qt::Key_T));
- m_rekonqMenu = new RekonqMenu(this);
- toolsAction->setMenu(m_rekonqMenu); // dummy menu to have the dropdown arrow
-
- // adding rekonq_tools to rekonq actionCollection
- actionCollection()->addAction(QL1S("rekonq_tools"), toolsAction);
-}
-
-
-void MainWindow::setupPanels()
-{
- KAction* a;
-
- // STEP 1
- // Setup history panel
- const QString historyTitle = i18n("History Panel");
- m_historyPanel = new HistoryPanel(historyTitle, this);
- connect(m_historyPanel, SIGNAL(openUrl(KUrl, Rekonq::OpenType)),
- rApp, SLOT(loadUrl(KUrl, Rekonq::OpenType)));
- connect(m_historyPanel, SIGNAL(itemHovered(QString)), this, SLOT(notifyMessage(QString)));
- connect(m_historyPanel, SIGNAL(destroyed()), rApp, SLOT(saveConfiguration()));
-
- addDockWidget(Qt::LeftDockWidgetArea, m_historyPanel);
-
- // setup history panel action
- a = new KAction(KIcon("view-history"), historyTitle, this);
- a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H));
- actionCollection()->addAction(QL1S("show_history_panel"), a);
- a->setCheckable(true);
- connect(a, SIGNAL(triggered(bool)), m_historyPanel, SLOT(setVisible(bool)));
- connect(m_historyPanel, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool)));
-
- // STEP 2
- // Setup bookmarks panel
- const QString bookmarksTitle = i18n("Bookmarks Panel");
- m_bookmarksPanel = new BookmarksPanel(bookmarksTitle, this);
- connect(m_bookmarksPanel, SIGNAL(openUrl(KUrl, Rekonq::OpenType)),
- rApp, SLOT(loadUrl(KUrl, Rekonq::OpenType)));
- connect(m_bookmarksPanel, SIGNAL(itemHovered(QString)), this, SLOT(notifyMessage(QString)));
- connect(m_bookmarksPanel, SIGNAL(destroyed()), rApp, SLOT(saveConfiguration()));
-
- addDockWidget(Qt::LeftDockWidgetArea, m_bookmarksPanel);
-
- rApp->bookmarkManager()->registerBookmarkPanel(m_bookmarksPanel);
-
- // setup bookmarks panel action
- a = new KAction(KIcon("bookmarks-organize"), bookmarksTitle, this);
- a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
- actionCollection()->addAction(QL1S("show_bookmarks_panel"), a);
- a->setCheckable(true);
- connect(a, SIGNAL(triggered(bool)), m_bookmarksPanel, SLOT(setVisible(bool)));
- connect(m_bookmarksPanel, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool)));
-
- // STEP 3
- // Setup webinspector panel
- m_webInspectorPanel = new WebInspectorPanel(i18n("Web Inspector"), this);
- connect(mainView(), SIGNAL(currentChanged(int)), m_webInspectorPanel, SLOT(changeCurrentPage()));
-
- a = new KAction(KIcon("tools-report-bug"), i18n("Web &Inspector"), this);
- a->setCheckable(true);
- actionCollection()->addAction(QL1S("web_inspector"), a);
- connect(a, SIGNAL(triggered(bool)), m_webInspectorPanel, SLOT(toggle(bool)));
-
- addDockWidget(Qt::BottomDockWidgetArea, m_webInspectorPanel);
- m_webInspectorPanel->hide();
-
- // STEP 4
- // Setup Network analyzer panel
- m_analyzerPanel = new NetworkAnalyzerPanel(i18n("Network Analyzer"), this);
- connect(mainView(), SIGNAL(currentChanged(int)), m_analyzerPanel, SLOT(changeCurrentPage()));
-
- a = new KAction(KIcon("document-edit-decrypt-verify"), i18n("Network Analyzer"), this);
- a->setCheckable(true);
- actionCollection()->addAction(QL1S("net_analyzer"), a);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(enableNetworkAnalysis(bool)));
-
- addDockWidget(Qt::BottomDockWidgetArea, m_analyzerPanel);
- m_analyzerPanel->hide();
-}
-
-
-void MainWindow::finalizeGUI(KXMLGUIClient* client)
-{
- KXmlGuiWindow::finalizeGUI(client);
-
- // update rekonqMenu when GUI has changed
- KMenu *m = qobject_cast<KMenu*>(factory()->container("rekonqMenu", this));
- if (m)
- m_rekonqMenu->addActions(m->actions());
- else
- kDebug() << " ====================== "
- << "Could not get the rekonqMenu menu. Maybe the rekonqui.rc file wasn't found."
- << "Was rekonq installed correctly?"
- << " ====================== ";
-}
-
-
-void MainWindow::readProperties(const KConfigGroup& config)
-{
- Q_UNUSED(config)
-
- Application::instance()->sessionManager()->restoreMainWindow(this);
-}
-
-
-void MainWindow::openLocation()
-{
- if (isFullScreen())
- {
- setWidgetsVisible(true);
- }
- m_view->currentUrlBar()->selectAll();
- m_view->currentUrlBar()->setFocus();
-}
-
-
-void MainWindow::fileSaveAs()
-{
- WebTab *w = currentTab();
- KUrl srcUrl = w->url();
-
- if (currentTab()->page()->isOnRekonqPage())
- {
- KParts::ReadOnlyPart *p = currentTab()->part();
- if (p)
- {
- // if this is a KParts document then the w->url() will be empty and the srcUrl
- // must be set to the document url
- srcUrl = p->url();
- }
- }
-
- // First, try with suggested file name...
- QString name = w->page()->suggestedFileName();
-
- // Second, with KUrl fileName...
- if (name.isEmpty())
- {
- name = srcUrl.fileName();
- }
-
- // Last chance...
- if (name.isEmpty())
- {
- name = srcUrl.host() + QString(".html");
- }
-
- const KUrl destUrl = KFileDialog::getSaveUrl(name, QString(), this);
- if (destUrl.isEmpty())
- return;
-
- if (w->page()->isContentEditable())
- {
- QString code = w->page()->mainFrame()->toHtml();
- QFile file(destUrl.url());
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
- return;
-
- QTextStream out(&file);
- out << code;
-
- return;
- }
-
- KIO::Job *job = KIO::file_copy(srcUrl, destUrl, -1, KIO::Overwrite);
- job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache.
- job->addMetaData("cache", "cache"); // Use entry from cache if available.
- job->uiDelegate()->setAutoErrorHandlingEnabled(true);
-}
-
-
-void MainWindow::preferences()
-{
- // an instance the dialog could be already created and could be cached,
- // in which case you want to display the cached dialog
- if (SettingsDialog::showDialog("rekonfig"))
- return;
-
- // we didn't find an instance of this dialog, so lets create it
- QPointer<SettingsDialog> s = new SettingsDialog(this);
-
- // keep us informed when the user changes settings
- connect(s, SIGNAL(settingsChanged(QString)), rApp, SLOT(updateConfiguration()));
- connect(s, SIGNAL(finished(int)), s, SLOT(deleteLater()));
-
- s->show();
-}
-
-
-void MainWindow::updateHistoryActions()
-{
- bool rekonqPage = currentTab()->page()->isOnRekonqPage();
-
- QAction *historyBackAction = actionByName(KStandardAction::name(KStandardAction::Back));
- if (rekonqPage && currentTab()->view()->history()->count() > 0)
- historyBackAction->setEnabled(true);
- else
- historyBackAction->setEnabled(currentTab()->view()->history()->canGoBack());
-
- QAction *historyForwardAction = actionByName(KStandardAction::name(KStandardAction::Forward));
- historyForwardAction->setEnabled(currentTab()->view()->history()->canGoForward());
-}
-
-
-void MainWindow::updateWindowTitle(const QString &title)
-{
- QWebSettings *settings = QWebSettings::globalSettings();
- if (title.isEmpty())
- {
- if (settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- {
- setWindowTitle(i18nc("Window title when private browsing is activated", "rekonq (Private Browsing)"));
- }
- else
- {
- setWindowTitle("rekonq");
- }
- }
- else
- {
- if (settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- {
- setWindowTitle(i18nc("window title, %1 = title of the active website", "%1 – rekonq (Private Browsing)", title));
- }
- else
- {
- setWindowTitle(i18nc("window title, %1 = title of the active website", "%1 – rekonq", title));
- }
- }
-}
-
-
-void MainWindow::fileOpen()
-{
- QString filePath = KFileDialog::getOpenFileName(KUrl(),
- i18n("*.html *.htm *.svg *.png *.gif *.svgz|Web Resources (*.html *.htm *.svg *.png *.gif *.svgz)\n"
- "*.*|All files (*.*)"),
- this,
- i18n("Open Web Resource"));
-
- if (filePath.isEmpty())
- return;
-
- rApp->loadUrl(filePath);
-}
-
-
-void MainWindow::printRequested(QWebFrame *frame)
-{
- if (!currentTab())
- return;
-
- if (currentTab()->page()->isOnRekonqPage())
- {
- // trigger print part action instead of ours..
- KParts::ReadOnlyPart *p = currentTab()->part();
- if (p)
- {
- KParts::BrowserExtension *ext = p->browserExtension();
- if (ext)
- {
- KParts::BrowserExtension::ActionSlotMap *actionSlotMap = KParts::BrowserExtension::actionSlotMapPtr();
-
- connect(this, SIGNAL(triggerPartPrint()), ext, actionSlotMap->value("print"));
- emit triggerPartPrint();
-
- return;
- }
- }
- }
-
- QWebFrame *printFrame = 0;
- if (frame == 0)
- {
- printFrame = currentTab()->page()->mainFrame();
- }
- else
- {
- printFrame = frame;
- }
-
- QPrinter printer;
- printer.setDocName(printFrame->title());
- QPrintDialog *printDialog = KdePrint::createPrintDialog(&printer, this);
-
- if (printDialog) //check if the Dialog was created
- {
- if (printDialog->exec())
- printFrame->print(&printer);
-
- delete printDialog;
- }
-}
-
-
-void MainWindow::find(const QString & search)
-{
- if (!currentTab())
- return;
- m_lastSearch = search;
-
- updateHighlight();
- findNext();
-}
-
-
-void MainWindow::matchCaseUpdate()
-{
- if (!currentTab())
- return;
-
- currentTab()->view()->findText(m_lastSearch, QWebPage::FindBackward);
- findNext();
- updateHighlight();
-}
-
-
-void MainWindow::findNext()
-{
- if (!currentTab())
- return;
-
- if (currentTab()->page()->isOnRekonqPage())
- {
- // trigger part find action
- KParts::ReadOnlyPart *p = currentTab()->part();
- if (p)
- {
- connect(this, SIGNAL(triggerPartFind()), p, SLOT(slotFind()));
- emit triggerPartFind();
- return;
- }
- }
-
- if (m_findBar->isHidden())
- {
- QPoint previous_position = currentTab()->view()->page()->currentFrame()->scrollPosition();
- currentTab()->view()->page()->focusNextPrevChild(true);
- currentTab()->view()->page()->currentFrame()->setScrollPosition(previous_position);
- return;
- }
-
- QWebPage::FindFlags options = QWebPage::FindWrapsAroundDocument;
- if (m_findBar->matchCase())
- options |= QWebPage::FindCaseSensitively;
-
- bool found = currentTab()->view()->findText(m_lastSearch, options);
- m_findBar->notifyMatch(found);
-
- if (!found)
- {
- QPoint previous_position = currentTab()->view()->page()->currentFrame()->scrollPosition();
- currentTab()->view()->page()->focusNextPrevChild(true);
- currentTab()->view()->page()->currentFrame()->setScrollPosition(previous_position);
- }
-}
-
-
-void MainWindow::findPrevious()
-{
- if (!currentTab())
- return;
-
- QWebPage::FindFlags options = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument;
- if (m_findBar->matchCase())
- options |= QWebPage::FindCaseSensitively;
-
- bool found = currentTab()->view()->findText(m_lastSearch, options);
- m_findBar->notifyMatch(found);
-}
-
-
-void MainWindow::updateHighlight()
-{
- if (!currentTab())
- return;
-
- QWebPage::FindFlags options = QWebPage::HighlightAllOccurrences;
-
- currentTab()->view()->findText("", options); //Clear an existing highlight
-
- if (m_findBar->highlightAllState() && !m_findBar->isHidden())
- {
- if (m_findBar->matchCase())
- options |= QWebPage::FindCaseSensitively;
-
- currentTab()->view()->findText(m_lastSearch, options);
- }
-}
-
-
-void MainWindow::findSelectedText()
-{
- // FindBar::setVisible() gets the selected text by itself
- m_findBar->show();
-}
-
-
-void MainWindow::viewFullScreen(bool makeFullScreen)
-{
- setWidgetsVisible(!makeFullScreen);
- KToggleFullScreenAction::setFullScreen(this, makeFullScreen);
-}
-
-
-void MainWindow::openDownloadsPage()
-{
- rApp->loadUrl(KUrl("about:downloads"), Rekonq::NewFocusedTab);
-}
-
-
-void MainWindow::setWidgetsVisible(bool makeVisible)
-{
- // state flags
- static bool bookmarksToolBarFlag;
- static bool historyPanelFlag;
- static bool bookmarksPanelFlag;
-
- KToolBar *mainBar = toolBar("mainToolBar");
- KToolBar *bookBar = toolBar("bookmarkToolBar");
-
- if (!makeVisible)
- {
- // save current state, if in windowed mode
- if (!isFullScreen())
- {
- bookmarksToolBarFlag = bookBar->isHidden();
- historyPanelFlag = m_historyPanel->isHidden();
- bookmarksPanelFlag = m_bookmarksPanel->isHidden();
- }
-
- bookBar->hide();
- m_view->tabBar()->hide();
- m_historyPanel->hide();
- m_bookmarksPanel->hide();
-
- // hide main toolbar
- mainBar->hide();
- }
- else
- {
- // show main toolbar
- mainBar->show();
- m_view->tabBar()->show();
-
- // restore state of windowed mode
- if (!bookmarksToolBarFlag)
- bookBar->show();
- if (!historyPanelFlag)
- m_historyPanel->show();
- if (!bookmarksPanelFlag)
- m_bookmarksPanel->show();
- }
-}
-
-
-QString MainWindow::selectedText() const
-{
- if (!currentTab())
- return QString();
-
- return currentTab()->view()->selectedText();
-}
-
-
-void MainWindow::viewPageSource()
-{
- WebTab * w = currentTab();
-
- if (!w)
- return;
-
- KUrl url = w->url();
- QString code = w->page()->mainFrame()->toHtml();
-
- KTemporaryFile tmpFile;
- tmpFile.setAutoRemove(false);
- if (!tmpFile.open())
- return;
-
- QTextStream out(&tmpFile);
- out << code;
- tmpFile.close();
- KUrl tmpUrl(tmpFile.fileName());
-
- KParts::ReadOnlyPart *pa = KMimeTypeTrader::createPartInstanceFromQuery<KParts::ReadOnlyPart>(QL1S("text/plain"), w, this, QString());
- if (pa)
- {
- WebTab *srcTab = m_view->newWebTab(true);
- srcTab->page()->setIsOnRekonqPage(true);
- srcTab->setPart(pa, tmpUrl);
- srcTab->urlBar()->setQUrl(url.pathOrUrl());
- m_view->setTabText(m_view->currentIndex(), i18n("Source of: ") + url.prettyUrl());
- updateHistoryActions();
- }
- else
- KRun::runUrl(tmpUrl, QL1S("text/plain"), this, false);
-}
-
-
-void MainWindow::homePage()
-{
- KUrl homeUrl = ReKonfig::useNewTabPage()
- ? KUrl(QL1S("about:home"))
- : KUrl(ReKonfig::homePage());
-
- currentTab()->view()->load(homeUrl);
-}
-
-
-WebTab *MainWindow::currentTab() const
-{
- return m_view->currentWebTab();
-}
-
-
-void MainWindow::updateTabActions()
-{
- m_loadStopReloadAction->disconnect();
-
- if (m_view->currentUrlBar()->hasFocus())
- {
- m_loadStopReloadAction->disconnect();
-
- m_loadStopReloadAction->setIcon(KIcon("go-jump-locationbar"));
- m_loadStopReloadAction->setToolTip(i18n("Go"));
- m_loadStopReloadAction->setText(i18n("Go"));
-
- connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), m_view->currentUrlBar(), SLOT(loadDigitedUrl()));
- return;
- }
-
- QAction *stop = actionCollection()->action(QL1S("stop"));
- QAction *reload = actionCollection()->action(QL1S("view_redisplay"));
-
- if (currentTab()->isPageLoading())
- {
- m_loadStopReloadAction->setIcon(KIcon("process-stop"));
- m_loadStopReloadAction->setToolTip(i18n("Stop loading the current page"));
- m_loadStopReloadAction->setText(i18n("Stop"));
- connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool)));
- stop->setEnabled(true);
- }
- else
- {
- m_loadStopReloadAction->setIcon(KIcon("view-refresh"));
- m_loadStopReloadAction->setToolTip(i18n("Reload the current page"));
- m_loadStopReloadAction->setText(i18n("Reload"));
- connect(m_loadStopReloadAction, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool)));
- stop->setEnabled(false);
-
- updateHistoryActions();
- }
-}
-
-
-void MainWindow::openPrevious(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers)
-{
- QWebHistory *history = currentTab()->view()->history();
- QWebHistoryItem *item = 0;
-
- if (currentTab()->page()->isOnRekonqPage())
- {
- item = new QWebHistoryItem(history->currentItem());
- }
- else
- {
- if (history->canGoBack())
- {
- item = new QWebHistoryItem(history->backItem());
- }
- }
-
- if (!item)
- return;
-
- if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
- {
- rApp->loadUrl(item->url(), Rekonq::NewTab);
- }
- else
- {
- history->goToItem(*item);
- }
-
- updateHistoryActions();
-}
-
-
-void MainWindow::openNext(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers keyboardModifiers)
-{
- QWebHistory *history = currentTab()->view()->history();
- QWebHistoryItem *item = 0;
-
- if (currentTab()->view()->page()->isOnRekonqPage())
- {
- item = new QWebHistoryItem(history->currentItem());
- }
- else
- {
- if (history->canGoForward())
- {
- item = new QWebHistoryItem(history->forwardItem());
- }
- }
-
- if (!item)
- return;
-
- if (mouseButtons == Qt::MidButton || keyboardModifiers == Qt::ControlModifier)
- {
- rApp->loadUrl(item->url(), Rekonq::NewTab);
- }
- else
- {
- history->goToItem(*item);
- }
-
- updateHistoryActions();
-}
-
-
-void MainWindow::keyPressEvent(QKeyEvent *event)
-{
- // ctrl + tab action
- if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Tab))
- {
- emit ctrlTabPressed();
- event->accept();
- return;
- }
-
- // shift + ctrl + tab action
- if ((event->modifiers() == Qt::ControlModifier + Qt::ShiftModifier) && (event->key() == Qt::Key_Backtab))
- {
- emit shiftCtrlTabPressed();
- event->accept();
- return;
- }
-
- KMainWindow::keyPressEvent(event);
-}
-
-
-bool MainWindow::event(QEvent *event)
-{
- // Avoid a conflict with window-global actions
- if (event->type() == QEvent::ShortcutOverride || event->type() == QEvent::KeyPress)
- {
- QKeyEvent *kev = static_cast<QKeyEvent *>(event);
- if (kev->key() == Qt::Key_Escape)
- {
- // if zoombar is visible, hide it
- if (m_zoomBar->isVisible())
- {
- m_zoomBar->hide();
- event->accept();
- currentTab()->setFocus();
- return true;
- }
-
- // if findbar is visible, hide it
- if (m_findBar->isVisible())
- {
- m_findBar->hide();
- event->accept();
- currentTab()->setFocus();
- return true;
- }
- }
- }
-
- return KMainWindow::event(event);
-}
-
-
-void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
-{
- // deleting popus if empty msgs
- if (msg.isEmpty())
- {
- m_hidePopupTimer->start(250);
- return;
- }
-
- m_hidePopupTimer->stop();
-
- switch (status)
- {
- case Rekonq::Info:
- m_hidePopupTimer->start(500);
- break;
- case Rekonq::Url:
- case Rekonq::Success:
- case Rekonq::Error:
- case Rekonq::Download:
- m_hidePopupTimer->start(3000);
- break;
- default:
- break;
- }
-
- QString msgToShow = Qt::escape(msg);
-
- // useful values
- WebTab *tab = m_view->currentWebTab();
-
- // fix crash on window close
- if (!tab || !tab->page())
- return;
-
- const int margin = 4;
- const int halfWidth = width() / 2;
-
- // Set Popup size
- QFontMetrics fm = m_popup->fontMetrics();
- QSize labelSize(fm.width(msgToShow) + 2 * margin, fm.height() + 2 * margin);
-
- if (labelSize.width() > halfWidth)
- labelSize.setWidth(halfWidth);
-
- m_popup->setFixedSize(labelSize);
- m_popup->setText(fm.elidedText(msgToShow, Qt::ElideMiddle, labelSize.width() - 2 * margin));
-
- // NOTE: while currentFrame should NEVER be null
- // we are checking here its existence cause of bug:264187
- if (!tab->page()->currentFrame())
- return;
-
- const bool horizontalScrollbarIsVisible = tab->page()->currentFrame()->scrollBarMaximum(Qt::Horizontal);
- const bool verticalScrollbarIsVisible = tab->page()->currentFrame()->scrollBarMaximum(Qt::Vertical);
- const bool actionBarsVisible = m_findBar->isVisible() || m_zoomBar->isVisible();
-
- const int scrollbarExtent = style()->pixelMetric(QStyle::PM_ScrollBarExtent);
- const int hScrollbarSize = horizontalScrollbarIsVisible ? scrollbarExtent : 0;
- const int vScrollbarSize = verticalScrollbarIsVisible ? scrollbarExtent : 0;
-
- const QPoint mousePos = mapFromGlobal(QCursor::pos());
- const QPoint bottomPoint = m_view->mapTo(this, m_view->geometry().bottomLeft());
-
- int y = bottomPoint.y() + 1 - m_popup->height() - hScrollbarSize; // +1 because bottom() returns top() + height() - 1, see QRect doku
- int x = QRect(QPoint(0, y), labelSize).contains(mousePos) || actionBarsVisible
- ? width() - labelSize.width() - vScrollbarSize
- : 0;
-
- m_popup->move(x, y);
- m_popup->show();
-}
-
-
-void MainWindow::clearPrivateData()
-{
- QPointer<KDialog> dialog = new KDialog(this);
- dialog->setCaption(i18nc("@title:window", "Clear Private Data"));
- dialog->setButtons(KDialog::Ok | KDialog::Cancel);
-
- dialog->button(KDialog::Ok)->setIcon(KIcon("edit-clear"));
- dialog->button(KDialog::Ok)->setText(i18n("Clear"));
-
- Ui::ClearDataWidget clearWidget;
- QWidget widget;
- clearWidget.setupUi(&widget);
- clearWidget.clearHistory->setChecked(ReKonfig::clearHistory());
- clearWidget.clearDownloads->setChecked(ReKonfig::clearDownloads());
- clearWidget.clearCookies->setChecked(ReKonfig::clearCookies());
- clearWidget.clearCachedPages->setChecked(ReKonfig::clearCachedPages());
- clearWidget.clearWebIcons->setChecked(ReKonfig::clearWebIcons());
- clearWidget.homePageThumbs->setChecked(ReKonfig::clearHomePageThumbs());
-
- dialog->setMainWidget(&widget);
- dialog->exec();
-
- if (dialog->result() == QDialog::Accepted)
- {
- //Save current state
- ReKonfig::setClearHistory(clearWidget.clearHistory->isChecked());
- ReKonfig::setClearDownloads(clearWidget.clearDownloads->isChecked());
- ReKonfig::setClearCookies(clearWidget.clearDownloads->isChecked());
- ReKonfig::setClearCachedPages(clearWidget.clearCachedPages->isChecked());
- ReKonfig::setClearWebIcons(clearWidget.clearWebIcons->isChecked());
- ReKonfig::setClearHomePageThumbs(clearWidget.homePageThumbs->isChecked());
-
- if (clearWidget.clearHistory->isChecked())
- {
- rApp->historyManager()->clear();
- }
-
- if (clearWidget.clearDownloads->isChecked())
- {
- rApp->downloadManager()->clearDownloadsHistory();
- }
-
- if (clearWidget.clearCookies->isChecked())
- {
- QDBusInterface kcookiejar("org.kde.kded", "/modules/kcookiejar", "org.kde.KCookieServer");
- QDBusReply<void> reply = kcookiejar.call("deleteAllCookies");
- }
-
- if (clearWidget.clearCachedPages->isChecked())
- {
- KProcess::startDetached(KStandardDirs::findExe("kio_http_cache_cleaner"),
- QStringList(QL1S("--clear-all")));
- }
-
- if (clearWidget.clearWebIcons->isChecked())
- {
- rApp->iconManager()->clearIconCache();
- }
-
- if (clearWidget.homePageThumbs->isChecked())
- {
- QString path = KStandardDirs::locateLocal("cache", QString("thumbs/rekonq"), true);
- path.remove("rekonq");
- QDir cacheDir(path);
- QStringList fileList = cacheDir.entryList();
- Q_FOREACH(const QString & str, fileList)
- {
- QFile file(path + str);
- file.remove();
- }
- }
- }
-
- dialog->deleteLater();
-}
-
-
-void MainWindow::aboutToShowBackMenu()
-{
- m_historyBackMenu->clear();
- if (!currentTab())
- return;
- QWebHistory *history = currentTab()->view()->history();
- int pivot = history->currentItemIndex();
- int offset = 0;
- const int maxItemNumber = 8; // no more than 8 elements in the Back History Menu!
- QList<QWebHistoryItem> historyList = history->backItems(maxItemNumber);
- int listCount = historyList.count();
- if (pivot >= maxItemNumber)
- offset = pivot - maxItemNumber;
-
- if (currentTab()->view()->page()->isOnRekonqPage())
- {
- QWebHistoryItem item = history->currentItem();
- KAction *action = new KAction(this);
- action->setData(listCount + offset++);
- KIcon icon = rApp->iconManager()->iconForUrl(item.url());
- action->setIcon(icon);
- action->setText(item.title());
- m_historyBackMenu->addAction(action);
- }
-
- for (int i = listCount - 1; i >= 0; --i)
- {
- QWebHistoryItem item = historyList.at(i);
- KAction *action = new KAction(this);
- action->setData(i + offset);
- KIcon icon = rApp->iconManager()->iconForUrl(item.url());
- action->setIcon(icon);
- action->setText(item.title());
- m_historyBackMenu->addAction(action);
- }
-}
-
-
-void MainWindow::aboutToShowForwardMenu()
-{
- m_historyForwardMenu->clear();
-
- if (!currentTab())
- return;
-
- QWebHistory *history = currentTab()->view()->history();
- const int pivot = history->currentItemIndex();
- int offset = 0;
- const int maxItemNumber = 8; // no more than 8 elements in the Forward History Menu!
- QList<QWebHistoryItem> historyList = history->forwardItems(maxItemNumber);
- int listCount = historyList.count();
-
- if (pivot >= maxItemNumber)
- offset = pivot - maxItemNumber;
-
- if (currentTab()->view()->page()->isOnRekonqPage())
- {
- QWebHistoryItem item = history->currentItem();
- KAction *action = new KAction(this);
- action->setData(listCount + offset++);
- KIcon icon = rApp->iconManager()->iconForUrl(item.url());
- action->setIcon(icon);
- action->setText(item.title());
- m_historyForwardMenu->addAction(action);
- }
-
- for (int i = 1; i <= listCount; i++)
- {
- QWebHistoryItem item = historyList.at(i - 1);
- KAction *action = new KAction(this);
- action->setData(pivot + i + offset);
- KIcon icon = rApp->iconManager()->iconForUrl(item.url());
- action->setIcon(icon);
- action->setText(item.title());
- m_historyForwardMenu->addAction(action);
- }
-}
-
-
-void MainWindow::aboutToShowTabListMenu()
-{
- m_tabListMenu->clear();
- for (int i = 0; i < m_view->count(); ++i)
- {
- KAction *action = new KAction(m_view->tabText(i), this);
- action->setIcon(rApp->iconManager()->iconForUrl(m_view->webTab(i)->url()).pixmap(16, 16));
- action->setData(i);
- if (mainView()->tabBar()->currentIndex() == i)
- {
- QFont font = action->font();
- font.setBold(true);
- action->setFont(font);
- }
- m_tabListMenu->addAction(action);
- }
- m_tabListMenu->adjustSize();
-}
-
-
-void MainWindow::openActionUrl(QAction *action)
-{
- int index = action->data().toInt();
-
- QWebHistory *history = currentTab()->view()->history();
- if (!history->itemAt(index).isValid())
- {
- kDebug() << "Invalid Index!: " << index;
- return;
- }
-
- history->goToItem(history->itemAt(index));
-}
-
-
-void MainWindow::openActionTab(QAction* action)
-{
- int index = action->data().toInt();
- if (index < 0 || index >= m_view->count())
- {
- kDebug() << "Invalid Index!: " << index;
- return;
- }
- m_view->setCurrentIndex(index);
-}
-
-
-void MainWindow::enableNetworkAnalysis(bool b)
-{
- currentTab()->page()->enableNetworkAnalyzer(b);
- m_analyzerPanel->toggle(b);
-}
-
-
-void MainWindow::saveNewToolbarConfig()
-{
- KXmlGuiWindow::saveNewToolbarConfig();
- setupBookmarksAndToolsShortcuts();
-}
-
-
-void MainWindow::setupBookmarksAndToolsShortcuts()
-{
- KToolBar *mainBar = toolBar("mainToolBar");
-
- QToolButton *bookmarksButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName(QL1S("bookmarksActionMenu"))));
- if (bookmarksButton)
- {
- connect(actionByName(QL1S("bookmarksActionMenu")), SIGNAL(triggered()), bookmarksButton, SLOT(showMenu()));
- }
-
- QToolButton *toolsButton = qobject_cast<QToolButton*>(mainBar->widgetForAction(actionByName(QL1S("rekonq_tools"))));
- if (toolsButton)
- {
- connect(actionByName(QL1S("rekonq_tools")), SIGNAL(triggered()), toolsButton, SLOT(showMenu()));
-
- // HACK: set button widget in rekonq menu
- m_rekonqMenu->setButtonWidget(toolsButton);
- return;
- }
-
- kWarning() << "oh oh, something went wrong with rekonq tools button...";
-}
-
-
-void MainWindow::moveEvent(QMoveEvent *event)
-{
- if (m_hidePopupTimer)
- m_hidePopupTimer->stop();
- if (m_popup)
- m_popup->hide();
-
- KMainWindow::moveEvent(event);
-}
-
-
-void MainWindow::resizeEvent(QResizeEvent *event)
-{
- if (m_hidePopupTimer)
- m_hidePopupTimer->stop();
- if (m_popup)
- m_popup->hide();
-
- KMainWindow::resizeEvent(event);
-}
-
-
-void MainWindow::setEditable(bool on)
-{
- currentTab()->page()->setContentEditable(on);
-}
-
-
-void MainWindow::closeEvent(QCloseEvent *event)
-{
- emit windowClosing();
- kDebug() << "CLOSING WINDOW...";
- KXmlGuiWindow::closeEvent(event);
-}
-
-
-void MainWindow::populateUserAgentMenu()
-{
- KMenu *uaMenu = static_cast<KMenu *>(QObject::sender());
- if (!uaMenu)
- {
- kDebug() << "oops... NO user agent menu";
- return;
- }
- WebTab *w = currentTab();
- if (!w)
- {
- kDebug() << "oh oh... NO current tab. What is it happening here???";
- return;
- }
-
- rApp->userAgentManager()->populateUAMenuForTabUrl(uaMenu, w);
-}
-
-
-void MainWindow::loadUrl(const KUrl& url,
- const Rekonq::OpenType& type,
- QWebHistory *webHistory
- )
-{
- if (url.isEmpty())
- return;
-
- if (!url.isValid())
- {
- KMessageBox::error(0, i18n("Malformed URL:\n%1", url.url(KUrl::RemoveTrailingSlash)));
- return;
- }
-
- Rekonq::OpenType newType = type;
- // Don't open useless tabs or windows for actions in about: pages
- if (url.url().contains("about:") && url.url().contains("/"))
- newType = Rekonq::CurrentTab;
-
- loadCheckedUrl(url, newType, webHistory);
-}
-
-
-void MainWindow::loadCheckedUrl(const KUrl& url, const Rekonq::OpenType& type, QWebHistory *webHistory)
-{
- // NOTE: At this point, url should just be resolved via urlresolver.
- // No need to check it twice
-
- WebTab *tab = 0;
- switch (type)
- {
- case Rekonq::NewTab:
- tab = mainView()->newWebTab(!ReKonfig::openNewTabsInBackground());
- break;
- case Rekonq::NewFocusedTab:
- tab = mainView()->newWebTab(true);
- break;
- case Rekonq::NewBackGroundTab:
- tab = mainView()->newWebTab(false);
- break;
- case Rekonq::NewWindow:
- rApp->loadUrl(url, type);
- return;
- case Rekonq::CurrentTab:
- default:
- tab = mainView()->currentWebTab();
- break;
- };
-
- // rapidly show first loading url..
- int tabIndex = mainView()->indexOf(tab);
- Q_ASSERT(tabIndex != -1);
- UrlBar *barForTab = qobject_cast<UrlBar *>(mainView()->widgetBar()->widget(tabIndex));
- barForTab->activateSuggestions(false);
- barForTab->setQUrl(url);
-
- WebView *view = tab->view();
- if (view)
- {
- view->load(url);
-
- if (webHistory)
- {
- QByteArray historyBytes;
- QDataStream historyStream(&historyBytes, QIODevice::ReadWrite);
-
- historyStream << *webHistory;
- historyStream.device()->seek(0);
- historyStream >> *(view->history());
- }
- }
-}
-
-
-void MainWindow::bookmarkCurrentPage()
-{
- currentTab()->urlBar()->manageBookmarks();
-}
diff --git a/src/mainwindow.h b/src/mainwindow.h
deleted file mode 100644
index 1382046b..00000000
--- a/src/mainwindow.h
+++ /dev/null
@@ -1,235 +0,0 @@
-
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KActionCollection>
-#include <KXmlGuiWindow>
-
-// Forward Declarations
-class BookmarksPanel;
-class BookmarkToolBar;
-class FindBar;
-class HistoryPanel;
-class MainView;
-class NetworkAnalyzerPanel;
-class RekonqMenu;
-class WebInspectorPanel;
-class WebTab;
-class ZoomBar;
-
-class QWebFrame;
-class QWebHistory;
-class QLabel;
-
-
-/**
- * This class serves as the main window for rekonq.
- * It handles the menus, toolbars, and status bars.
- *
- */
-class REKONQ_TESTS_EXPORT MainWindow : public KXmlGuiWindow
-{
- Q_OBJECT
-
-public:
- MainWindow();
- ~MainWindow();
-
- inline MainView *mainView() const
- {
- return m_view;
- }
- inline QAction *actionByName(const QString &name)
- {
- return actionCollection()->action(name);
- }
-
- WebTab *currentTab() const;
- virtual QSize sizeHint() const;
- void setWidgetsVisible(bool makeFullScreen);
-
- QString selectedText() const;
-
- void loadCheckedUrl(const KUrl& url,
- const Rekonq::OpenType& type = Rekonq::CurrentTab,
- QWebHistory *webHistory = 0
- );
-private:
- void setupBookmarksAndToolsShortcuts();
- void setupActions();
- void setupTools();
- void setupToolbars();
- void setupPanels();
-
-public Q_SLOTS:
- void loadUrl(const KUrl& url,
- const Rekonq::OpenType& type = Rekonq::CurrentTab,
- QWebHistory *webHistory = 0
- );
-
- void openDownloadsPage();
- void homePage();
-
- /**
- * Notifies a message in a popup
- *
- * @param msg The message to notify
- *
- * @param status The status message
- *
- */
- void notifyMessage(const QString &msg, Rekonq::Notify status = Rekonq::Url);
-
- void printRequested(QWebFrame *frame = 0);
-
- void updateHistoryActions();
- void updateTabActions();
-
- virtual void configureToolbars();
-
- // Find Bar slots
- void findNext();
- void findPrevious();
- void updateHighlight();
- void findSelectedText();
-
- void changeWindowIcon(int index);
-
-Q_SIGNALS:
- // switching tabs
- void ctrlTabPressed();
- void shiftCtrlTabPressed();
-
- void triggerPartPrint();
- void triggerPartFind();
-
- void windowClosing();
-
-protected Q_SLOTS:
- void saveNewToolbarConfig();
-
-protected:
- /**
- * Filters (SHIFT + ) CTRL + TAB events and emit (shift)ctrlTabPressed()
- * to make switch tab
- * Filters out ESC key to show/hide the search bar
- */
- void keyPressEvent(QKeyEvent *event);
- void moveEvent(QMoveEvent *event);
- void resizeEvent(QResizeEvent *event);
- void closeEvent(QCloseEvent *event);
-
- bool event(QEvent *event);
-
- void readProperties(const KConfigGroup & config);
- void finalizeGUI(KXMLGUIClient *client);
-
-private Q_SLOTS:
- void updateWindowTitle(const QString &title = QString());
-
- // history related
- void openPrevious(Qt::MouseButtons = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier);
- void openNext(Qt::MouseButtons = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier);
-
- // Find Action slots
- void find(const QString &);
- void matchCaseUpdate();
-
- // File Menu slots
- void openLocation();
- void fileOpen();
- void fileSaveAs();
-
- void viewPageSource();
- void viewFullScreen(bool enable);
-
- // Settings Menu slot
- void preferences();
-
- // clear private data
- void clearPrivateData();
-
- void aboutToShowBackMenu();
- void aboutToShowForwardMenu();
-
- void aboutToShowTabListMenu();
- void openActionUrl(QAction *action);
- void openActionTab(QAction *action);
-
- void populateUserAgentMenu();
-
- void enableNetworkAnalysis(bool);
- void setEditable(bool);
-
- void toggleBookmarkBarVisible(bool);
-
- // add bookmark
- void bookmarkCurrentPage();
-
- /**
- * This is for the things to do ABSOLUTELY AFTER ctor launch:
- * the less, the better.
- */
- void postLaunch();
-
-private:
- MainView *m_view;
- FindBar *m_findBar;
- ZoomBar *m_zoomBar;
-
- HistoryPanel *m_historyPanel;
- BookmarksPanel *m_bookmarksPanel;
- WebInspectorPanel *m_webInspectorPanel;
- NetworkAnalyzerPanel *m_analyzerPanel;
-
- KAction *m_loadStopReloadAction;
-
- KMenu *m_historyBackMenu;
- KMenu *m_historyForwardMenu;
-
- KMenu *m_tabListMenu;
-
- BookmarkToolBar *m_bookmarksBar;
-
- QString m_lastSearch;
-
- QLabel *m_popup;
- QTimer *m_hidePopupTimer;
-
- RekonqMenu *m_rekonqMenu;
-};
-
-#endif // MAINWINDOW_H
diff --git a/src/messagebar.cpp b/src/messagebar.cpp
deleted file mode 100644
index 0e89ac56..00000000
--- a/src/messagebar.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Pierre Rossi <pierre dot rossi at gmail dot com>
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "messagebar.h"
-#include "messagebar.moc"
-
-// KDE Includes
-#include <KIcon>
-#include <KIconLoader>
-#include <KLocalizedString>
-
-// Qt Includes
-#include <QAction>
-
-
-MessageBar::MessageBar(const QString &message, QWidget *parent)
- : KMessageWidget(parent)
-{
- connect(this, SIGNAL(accepted()), this, SLOT(hideAndDelete()));
- connect(this, SIGNAL(rejected()), this, SLOT(hideAndDelete()));
-
- setMessageType(KMessageWidget::Warning);
-
- QSize sz = size();
- sz.setWidth(qobject_cast<QWidget *>(parent)->size().width());
- resize(sz);
-
- setCloseButtonVisible(false);
-
- setText(message);
-
- QAction *acceptAction = new QAction(i18n("Yes"), this);
- connect(acceptAction, SIGNAL(triggered(bool)), this, SIGNAL(accepted()));
- addAction(acceptAction);
-
- QAction *rejectAction = new QAction(i18n("No"), this);
- connect(rejectAction, SIGNAL(triggered(bool)), this, SIGNAL(rejected()));
- addAction(rejectAction);
-}
-
-
-void MessageBar::hideAndDelete()
-{
- animatedHide();
- deleteLater();
-}
diff --git a/src/messagebar.h b/src/messagebar.h
deleted file mode 100644
index bbf5d5d4..00000000
--- a/src/messagebar.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Pierre Rossi <pierre dot rossi at gmail dot com>
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef MESSAGEBAR_H
-#define MESSAGEBAR_H
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KMessageWidget>
-
-
-class REKONQ_TESTS_EXPORT MessageBar : public KMessageWidget
-{
- Q_OBJECT
-
-public:
- explicit MessageBar(const QString & message, QWidget *parent);
-
-private Q_SLOTS:
- void hideAndDelete();
-
-Q_SIGNALS:
- void accepted();
- void rejected();
-};
-
-
-#endif // MESSAGEBAR_H
diff --git a/src/networkaccessmanager.cpp b/src/networkaccessmanager.cpp
deleted file mode 100644
index dc10da1b..00000000
--- a/src/networkaccessmanager.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-
-// Self Includes
-#include "networkaccessmanager.h"
-#include "networkaccessmanager.moc"
-
-// Local Includes
-#include "adblockmanager.h"
-#include "application.h"
-#include "webpage.h"
-
-// KDE Includes
-#include <KLocale>
-#include <KProtocolManager>
-
-// Qt Includes
-#include <QNetworkReply>
-#include <QTimer>
-
-
-class NullNetworkReply : public QNetworkReply
-{
-public:
- NullNetworkReply(const QNetworkRequest &req, QObject* parent = 0)
- : QNetworkReply(parent)
- {
- setRequest(req);
- setUrl(req.url());
- setHeader(QNetworkRequest::ContentLengthHeader, 0);
- setHeader(QNetworkRequest::ContentTypeHeader, "text/plain");
- setError(QNetworkReply::ContentAccessDenied, i18n("Null reply"));
- setAttribute(QNetworkRequest::User, QNetworkReply::ContentAccessDenied);
- QTimer::singleShot(0, this, SIGNAL(finished()));
- }
-
- virtual void abort() {}
- virtual qint64 bytesAvailable() const
- {
- return 0;
- }
-
-protected:
- virtual qint64 readData(char*, qint64)
- {
- return -1;
- }
-};
-
-
-// ----------------------------------------------------------------------------------------------
-
-
-NetworkAccessManager::NetworkAccessManager(QObject *parent)
- : AccessManager(parent)
-{
- QString c = KGlobal::locale()->language();
-
- if (c == QL1S("C"))
- c = QL1S("en-US");
- else
- c = c.replace(QL1C('_') , QL1C('-'));
-
- c.append(QL1S(", en-US; q=0.8, en; q=0.6"));
-
- _acceptLanguage = c.toLatin1();
-}
-
-
-QNetworkReply *NetworkAccessManager::createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
-{
- WebPage *parentPage = qobject_cast<WebPage *>(parent());
-
- // NOTE: This to get sure we are NOT serving unused requests
- if (!parentPage)
- return new NullNetworkReply(request, this);
-
- QNetworkReply *reply = 0;
-
- // set our "nice" accept-language header...
- QNetworkRequest req = request;
- req.setRawHeader("Accept-Language", _acceptLanguage);
-
- // Handle GET operations with AdBlock
- if (op == QNetworkAccessManager::GetOperation)
- reply = rApp->adblockManager()->block(req, parentPage);
-
- if (!reply)
- reply = AccessManager::createRequest(op, req, outgoingData);
-
- if (parentPage->hasNetworkAnalyzerEnabled())
- emit networkData(op, req, reply);
-
- return reply;
-}
diff --git a/src/networkaccessmanager.h b/src/networkaccessmanager.h
deleted file mode 100644
index 5c877bdf..00000000
--- a/src/networkaccessmanager.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef NETWORKACCESSMANAGER_H
-#define NETWORKACCESSMANAGER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KIO/AccessManager>
-
-// Qt Includes
-#include <QByteArray>
-
-
-class REKONQ_TESTS_EXPORT NetworkAccessManager : public KIO::Integration::AccessManager
-{
- Q_OBJECT
-
-public:
- NetworkAccessManager(QObject *parent);
-
-protected:
- virtual QNetworkReply *createRequest(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0);
-
-Q_SIGNALS:
- void networkData(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QNetworkReply *reply);
-
-private:
- QByteArray _acceptLanguage;
-};
-
-#endif // NETWORKACCESSMANAGER_H
diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp
deleted file mode 100644
index a25f07a9..00000000
--- a/src/newtabpage.cpp
+++ /dev/null
@@ -1,1094 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "newtabpage.h"
-#include "newtabpage.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "bookmarkmanager.h"
-#include "downloadmanager.h"
-#include "iconmanager.h"
-#include "historymanager.h"
-#include "historymodels.h"
-#include "mainview.h"
-#include "mainwindow.h"
-#include "previewselectorbar.h"
-#include "thumbupdater.h"
-#include "urlfilterproxymodel.h"
-#include "websnap.h"
-#include "webpage.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KBookmarkManager>
-#include <KIconLoader>
-#include <KLocale>
-#include <KMimeType>
-#include <KRun>
-#include <KStandardDirs>
-
-// Qt Includes
-#include <QFile>
-#include <QAction>
-#include <QWebFrame>
-#include <QProcess>
-
-
-NewTabPage::NewTabPage(QWebFrame *frame)
- : QObject(frame)
- , m_root(frame->documentElement())
- , m_showFullHistory(false)
-{
- QString htmlFilePath = KStandardDirs::locate("data", "rekonq/htmls/home.html");
- QString dataPath = QL1S("file://") + htmlFilePath;
- dataPath.remove(QL1S("/htmls/home.html"));
-
- QFile file(htmlFilePath);
- bool isOpened = file.open(QIODevice::ReadOnly);
- if (!isOpened)
- {
- kDebug() << "Couldn't open the home.html file";
- }
- else
- {
- m_html = file.readAll();
- m_html.replace(QL1S("$DEFAULT_PATH"), dataPath);
- }
-}
-
-
-void NewTabPage::generate(const KUrl &url)
-{
- // about:preview links
- if (KUrl("about:settings").isParentOf(url))
- {
- if (url.fileName() == QL1S("network"))
- {
- QString program = QL1S("kcmshell4");
- QStringList arguments;
- arguments << QL1S("kcm_networkmanagement");
- QProcess *proc = new QProcess(parent());
- proc->start(program, arguments);
- return;
- }
-
- if (url.fileName() == QL1S("proxy"))
- {
- QString program = QL1S("kcmshell4");
- QStringList arguments;
- arguments << QL1S("proxy");
- QProcess *proc = new QProcess(parent());
- proc->start(program, arguments);
- return;
- }
-
- if (url.fileName() == QL1S("firewall"))
- {
- QString program = QL1S("kcmshell4");
- QStringList arguments;
- arguments << QL1S("kcm-ufw");
- QProcess *proc = new QProcess(parent());
- proc->start(program, arguments);
- return;
- }
- }
-
- // about:preview links
- if (KUrl("about:preview").isParentOf(url))
- {
- if (url.fileName() == QL1S("add"))
- {
- QStringList names = ReKonfig::previewNames();
- QStringList urls = ReKonfig::previewUrls();
-
- int index = urls.count();
-
- names.append("");
- urls.append("");
-
- ReKonfig::setPreviewNames(names);
- ReKonfig::setPreviewUrls(urls);
-
- loadPageForUrl(KUrl("about:favorites"));
-
- rApp->mainWindow()->currentTab()->createPreviewSelectorBar(index);
- return;
- }
-
- if (url.directory() == QL1S("preview/remove"))
- {
- int index = url.fileName().toInt();
- removePreview(index);
- return;
- }
-
- if (url.directory() == QL1S("preview/modify"))
- {
- int index = url.fileName().toInt();
- rApp->mainWindow()->currentTab()->createPreviewSelectorBar(index);
- return;
- }
-
- if (url.directory() == QL1S("preview/reload"))
- {
- int index = url.fileName().toInt();
- reloadPreview(index);
- return;
- }
- }
-
- // about:tabs links
- if (KUrl("about:tabs").isParentOf(url))
- {
- if (url.fileName() == QL1S("show"))
- {
- const int winIndex = url.queryItem(QL1S("win")).toInt();
- const int tabIndex = url.queryItem(QL1S("tab")).toInt();
-
- MainWindow *w = rApp->mainWindowList().at(winIndex).data();
-
- // close about:tabs tab
- rApp->mainWindow()->mainView()->closeTab(rApp->mainWindow()->mainView()->currentIndex());
-
- // show requested tab
- w->mainView()->setCurrentIndex(tabIndex);
- if (w != rApp->mainWindow())
- w->raise();
- return;
- }
-
- if (url.fileName() == QL1S("remove"))
- {
- const int winIndex = url.queryItem(QL1S("win")).toInt();
- const int tabIndex = url.queryItem(QL1S("tab")).toInt();
-
- MainWindow *w = rApp->mainWindowList().at(winIndex).data();
- w->mainView()->closeTab(tabIndex);
- loadPageForUrl(KUrl("about:tabs"));
- return;
- }
- }
-
- // about:closedTabs links
- if (KUrl("about:closedTabs").isParentOf(url))
- {
- if (url.fileName() == QL1S("restore"))
- {
- const int tabIndex = url.queryItem(QL1S("tab")).toInt();
-
- rApp->mainWindow()->mainView()->restoreClosedTab(tabIndex, false);
- return;
- }
- }
-
- // about:history links
- if (KUrl("about:history").isParentOf(url))
- {
- if (url.fileName() == QL1S("clear"))
- {
- rApp->historyManager()->clear();
- loadPageForUrl(KUrl("about:history"));
- return;
- }
-
- if (url.fileName() == QL1S("showAllItems"))
- {
- m_showFullHistory = true;
- loadPageForUrl(KUrl("about:history"));
- return;
- }
-
- if (url.fileName() == QL1S("search"))
- {
- QString value = url.queryItemValue(QL1S("q"));
- loadPageForUrl(KUrl("about:history"), value);
- return;
- }
-
- }
-
- // about:downloads links
- if (KUrl("about:downloads").isParentOf(url))
- {
- if (url.fileName() == QL1S("clear"))
- {
- rApp->downloadManager()->clearDownloadsHistory();
- loadPageForUrl(KUrl("about:downloads"));
- return;
- }
-
- if (url.fileName() == QL1S("search"))
- {
- QString value = url.queryItemValue(QL1S("q"));
- loadPageForUrl(KUrl("about:downloads"), value);
- return;
- }
-
- if (url.fileName() == QL1S("opendir"))
- {
- QString value = url.queryItemValue(QL1S("q"));
- KUrl dirUrl = KUrl(value);
- (void)new KRun(dirUrl, rApp->mainWindow(), 0, dirUrl.isLocalFile());
- return;
- }
-
- if (url.fileName() == QL1S("removeItem"))
- {
- int value = url.queryItemValue(QL1S("item")).toInt();
- rApp->downloadManager()->removeDownloadItem(value);
- loadPageForUrl(KUrl("about:downloads"));
- return;
- }
- }
-
- if (url == KUrl("about:bookmarks/edit"))
- {
- rApp->bookmarkManager()->slotEditBookmarks();
- return;
- }
-
-
- if (url == KUrl("about:favorites/save"))
- {
- saveFavorites();
- return;
- }
-
-
- loadPageForUrl(url);
-}
-
-
-void NewTabPage::loadPageForUrl(const KUrl &url, const QString & filter)
-{
- // webFrame can be null. See bug:282092
- QWebFrame *parentFrame = qobject_cast<QWebFrame *>(parent());
- if (!parentFrame)
- {
- kDebug() << "NULL PARENT FRAME: PAGE NOT LOADED";
- return;
- }
-
- parentFrame->setHtml(m_html);
-
- m_root = parentFrame->documentElement().findFirst(QL1S("#content"));
-
- browsingMenu(url);
-
- QString title;
- QByteArray encodedUrl = url.toEncoded();
- if (encodedUrl == QByteArray("about:favorites"))
- {
- favoritesPage();
- updateWindowIcon();
- title = i18n("Favorites");
- m_root.document().findFirst(QL1S("title")).setPlainText(title);
- initJS();
- return;
- }
- else if (encodedUrl == QByteArray("about:closedTabs"))
- {
- closedTabsPage();
- updateWindowIcon();
- title = i18n("Closed Tabs");
- }
- else if (encodedUrl == QByteArray("about:history"))
- {
- historyPage(filter);
- updateWindowIcon();
- title = i18n("History");
- }
- else if (encodedUrl == QByteArray("about:bookmarks"))
- {
- bookmarksPage();
- updateWindowIcon();
- title = i18n("Bookmarks");
- }
- else if (encodedUrl == QByteArray("about:downloads"))
- {
- downloadsPage(filter);
- updateWindowIcon();
- title = i18n("Downloads");
- }
- else if (encodedUrl == QByteArray("about:tabs"))
- {
- tabsPage();
- updateWindowIcon();
- title = i18n("Tabs");
- }
-
- m_root.document().findFirst(QL1S("title")).setPlainText(title);
-}
-
-
-// ----------------------------------------------------------------------------
-// HIGH-LEVEL FUNCTIONS
-
-
-void NewTabPage::browsingMenu(const KUrl &currentUrl)
-{
- QList<QWebElement> navItems;
-
- // Favorites
- navItems.append(createLinkItem(i18n("Favorites"),
- QL1S("about:favorites"),
- QL1S("emblem-favorite"),
- KIconLoader::Toolbar));
-
- // Closed Tabs
- navItems.append(createLinkItem(i18n("Closed Tabs"),
- QL1S("about:closedTabs"),
- QL1S("tab-close"),
- KIconLoader::Toolbar));
-
- // Bookmarks
- navItems.append(createLinkItem(i18n("Bookmarks"),
- QL1S("about:bookmarks"),
- QL1S("bookmarks"),
- KIconLoader::Toolbar));
-
- // History
- navItems.append(createLinkItem(i18n("History"),
- QL1S("about:history"),
- QL1S("view-history"),
- KIconLoader::Toolbar));
-
- // Downloads
- navItems.append(createLinkItem(i18n("Downloads"),
- QL1S("about:downloads"),
- QL1S("download"),
- KIconLoader::Toolbar));
-
- // Tabs
- navItems.append(createLinkItem(i18n("Tabs"),
- QL1S("about:tabs"),
- QL1S("tab-duplicate"),
- KIconLoader::Toolbar));
-
- Q_FOREACH(QWebElement it, navItems)
- {
- const QString aTagString(QL1C('a'));
- const QString hrefAttributeString(QL1S("href"));
-
- if (it.findFirst(aTagString).attribute(hrefAttributeString) == currentUrl.toMimeDataString())
- it.addClass(QL1S("current"));
- else if (currentUrl == QL1S("about:home") && it.findFirst(aTagString).attribute(hrefAttributeString) == QL1S("about:favorites"))
- it.addClass(QL1S("current"));
- m_root.document().findFirst(QL1S("#navigation")).appendInside(it);
- }
-}
-
-
-void NewTabPage::favoritesPage()
-{
- m_root.addClass(QL1S("favorites"));
-
- QWebElement add = createLinkItem(i18n("Add Favorite"),
- QL1S("about:preview/add"),
- QL1S("list-add"),
- KIconLoader::Toolbar);
- add.setAttribute(QL1S("class"), QL1S("right"));
- m_root.document().findFirst("#actions").appendInside(add);
-
- QStringList names = ReKonfig::previewNames();
- QStringList urls = ReKonfig::previewUrls();
-
- if (urls.isEmpty())
- {
- m_root.addClass(QL1S("empty"));
- m_root.setPlainText(i18n("You can add a favorite by clicking the \"Add Favorite\" button in the top-right corner of this page"));
- return;
- }
-
- for (int i = 0; i < urls.count() ; ++i)
- {
- KUrl url = KUrl(urls.at(i));
-
- QWebElement prev = url.isEmpty()
- ? emptyPreview(i)
- : validPreview(i, url, QString::number(i + 1) + QL1S(" - ") + names.at(i));
-
- m_root.appendInside(prev);
- }
-}
-
-
-void NewTabPage::historyPage(const QString & filter)
-{
- m_root.addClass(QL1S("history"));
-
- QWebElement searchForm = createFormItem(i18n("Search History"), QL1S("about:history/search"));
- searchForm.setAttribute(QL1S("class"), QL1S("left"));
-
- m_root.document().findFirst(QL1S("#actions")).appendInside(searchForm);
-
- QWebElement clearHistory = createLinkItem(i18n("Clear History"),
- QL1S("about:history/clear"),
- QL1S("edit-clear"),
- KIconLoader::Toolbar);
- clearHistory.setAttribute(QL1S("class"), QL1S("right"));
- m_root.document().findFirst(QL1S("#actions")).appendInside(clearHistory);
-
- HistoryTreeModel *model = rApp->historyManager()->historyTreeModel();
- UrlFilterProxyModel *proxy = new UrlFilterProxyModel(this);
- proxy->setSourceModel(model);
-
- bool filterIsEmpty = filter.isEmpty();
-
- if (!filterIsEmpty)
- proxy->setFilterFixedString(filter);
-
- if (proxy->rowCount() == 0)
- {
- if (filterIsEmpty)
- {
- m_root.addClass(QL1S("empty"));
- m_root.setPlainText(i18n("Your browsing history is empty"));
- }
- else
- {
- m_root.addClass(QL1S("empty"));
- m_root.setPlainText(i18n("No matches for string %1 in history", filter));
- }
- return;
- }
-
- int i = 0;
- const int maxTextSize = 103;
- const int truncateSize = 100;
- do
- {
- QModelIndex index = proxy->index(i, 0, QModelIndex());
- if (proxy->hasChildren(index))
- {
- m_root.appendInside(markup(QL1S("h3")));
- m_root.lastChild().setPlainText(index.data().toString());
-
- m_root.appendInside(markup(QL1S(".historyfolder")));
- QWebElement little = m_root.lastChild();
- for (int j = 0; j < proxy->rowCount(index); ++j)
- {
- QModelIndex son = proxy->index(j, 0, index);
- KUrl u = son.data(HistoryModel::UrlStringRole).toUrl();
-
- little.appendInside(son.data(HistoryModel::DateTimeRole).toDateTime().toString("hh:mm"));
- little.appendInside(QL1S("&nbsp;&nbsp;"));
- little.appendInside(markup(QL1S("img")));
- little.lastChild().setAttribute(QL1S("src"), rApp->iconManager()->iconPathForUrl(u));
- little.lastChild().setAttribute(QL1S("width"), QL1S("16"));
- little.lastChild().setAttribute(QL1S("height"), QL1S("16"));
- little.appendInside(QL1S("&nbsp;&nbsp;"));
- little.appendInside(markup(QL1S("a")));
- little.lastChild().setAttribute(QL1S("href") , u.url());
-
- QString shownUrl = son.data().toString();
- if (shownUrl.length() > maxTextSize)
- {
- shownUrl.truncate(truncateSize);
- shownUrl += QL1S("...");
- }
- little.lastChild().appendInside(shownUrl);
-
- little.appendInside(QL1S("<br />"));
- }
- }
- i++;
- if (filterIsEmpty && m_showFullHistory == false && (i == 2))
- {
- m_root.appendInside(markup(QL1S("a")));
- m_root.lastChild().setAttribute(QL1S("class") , QL1S("greybox"));
- m_root.lastChild().setAttribute(QL1S("href") , QL1S("about:history/showAllItems"));
- m_root.lastChild().setPlainText(i18n("Show full History"));
- return;
- }
- }
- while (proxy->hasIndex(i , 0 , QModelIndex()));
-
- m_showFullHistory = false;
-}
-
-
-void NewTabPage::bookmarksPage()
-{
- m_root.addClass(QL1S("bookmarks"));
-
- QWebElement editBookmarks = createLinkItem(i18n("Edit Bookmarks"),
- QL1S("about:bookmarks/edit"),
- QL1S("bookmarks-organize"),
- KIconLoader::Toolbar);
- editBookmarks.setAttribute(QL1S("class"), QL1S("right"));
- m_root.document().findFirst(QL1S("#actions")).appendInside(editBookmarks);
-
- KBookmarkGroup bookGroup = rApp->bookmarkManager()->rootGroup();
- if (bookGroup.isNull())
- {
- m_root.addClass(QL1S("empty"));
- m_root.setPlainText(i18n("You have no bookmarks"));
- return;
- }
-
- KBookmark bookmark = bookGroup.first();
-
- m_root.appendInside(markup(QL1S(".bookmarkfolder")));
- QWebElement rootFolder = m_root.lastChild();
- rootFolder.appendInside(markup(QL1S("h4")));
- rootFolder.lastChild().setPlainText(i18n("Unsorted"));
-
- while (!bookmark.isNull())
- {
- createBookmarkItem(bookmark, rootFolder);
- bookmark = bookGroup.next(bookmark);
- }
-}
-
-
-void NewTabPage::closedTabsPage()
-{
- m_root.addClass(QL1S("closedTabs"));
-
- QList<TabHistory> links = rApp->mainWindow()->mainView()->recentlyClosedTabs();
-
- if (links.isEmpty())
- {
- m_root.addClass(QL1S("empty"));
- m_root.setPlainText(i18n("There are no recently closed tabs"));
- return;
- }
-
- for (int i = 0; i < links.count(); ++i)
- {
- TabHistory item = links.at(i);
- QWebElement prev;
-
- if (item.url.isEmpty())
- continue;
-
- prev = closedTabPreview(i, item.url, item.title);
-
- prev.setAttribute(QL1S("id"), QL1S("preview") + QVariant(i).toString());
-
- // hide controls
- prev.findFirst(QL1S(".right")).setStyleProperty(QL1S("visibility"), QL1S("hidden"));
- prev.findFirst(QL1S(".left")).setStyleProperty(QL1S("visibility"), QL1S("hidden"));
-
- m_root.appendInside(prev);
- }
-}
-
-
-void NewTabPage::downloadsPage(const QString & filter)
-{
- m_root.addClass(QL1S("downloads"));
-
- QWebElement searchForm = createFormItem(i18n("Search Downloads"), QL1S("about:downloads/search"));
- searchForm.setAttribute(QL1S("class"), QL1S("left"));
- m_root.document().findFirst(QL1S("#actions")).appendInside(searchForm);
-
- QWebElement clearDownloads = createLinkItem(i18n("Clear Downloads"),
- QL1S("about:downloads/clear"),
- QL1S("edit-clear"),
- KIconLoader::Toolbar);
- clearDownloads.setAttribute(QL1S("class"), QL1S("right"));
- m_root.document().findFirst(QL1S("#actions")).appendInside(clearDownloads);
-
- DownloadList list = rApp->downloadManager()->downloads();
-
- bool filterIsEmpty = filter.isEmpty();
-
- if (list.isEmpty())
- {
- m_root.addClass(QL1S("empty"));
- m_root.setPlainText(i18n("There are no recently downloaded files to show"));
- return;
- }
-
- int i = 0;
-
- Q_FOREACH(DownloadItem * item, list)
- {
- KUrl u = item->destUrl();
- QString fName = u.fileName();
-
- QString srcUrl = item->originUrl();
-
- if (!filterIsEmpty)
- {
- if (!fName.contains(filter, Qt::CaseInsensitive) && !srcUrl.contains(filter, Qt::CaseInsensitive))
- continue;
- }
-
- m_root.prependInside(markup(QL1S("div")));
-
- QWebElement div = m_root.firstChild();
- div.addClass(QL1S("download"));
-
- QString dir = u.directory();
- QString file = dir + QL1C('/') + fName;
-
- KIconLoader *loader = KIconLoader::global();
- QString iconPath = QL1S("file://") + loader->iconPath(KMimeType::iconNameForUrl(u), KIconLoader::Desktop);
-
- div.appendInside(markup(QL1S("img")));
- div.lastChild().setAttribute(QL1S("src"), iconPath);
-
- div.appendInside(QL1S("<strong>") + fName + QL1S("</strong>"));
- div.appendInside(QL1S(" - "));
- QString date = KGlobal::locale()->formatDateTime(item->dateTime(), KLocale::FancyLongDate);
- div.appendInside(QL1S("<em>") + date + QL1S("</em>"));
- div.appendInside(QL1S("<br />"));
-
- div.appendInside(QL1S("<a href=") + srcUrl + QL1C('>') + srcUrl + QL1S("</a>"));
- div.appendInside(QL1S("<br />"));
-
- switch (item->state())
- {
- case DownloadItem::KGetManaged:
- div.appendInside(QL1S("<em>") + i18n("This download is managed by KGet. Check it to grab information about its state") + QL1S("</em>"));
- break;
-
- case DownloadItem::Suspended:
- div.appendInside(QL1S("<em>") + i18n("Suspended") + QL1S("</em>"));
- break;
-
- case DownloadItem::Downloading:
- div.appendInside(QL1S("<em>") + i18n("Downloading now...") + QL1S("</em>"));
- break;
-
- case DownloadItem::Errors:
- div.appendInside(QL1S("<em>") + i18nc("%1 = Error description", "Error: %1", item->errorString()) + QL1S("</em>"));
- break;
-
- case DownloadItem::Done:
- default:
- if (QFile::exists(file))
- {
- div.appendInside(markup(QL1S("a")));
- div.lastChild().setAttribute(QL1S("class"), QL1S("greylink"));
- div.lastChild().setAttribute(QL1S("href"), QL1S("about:downloads/opendir?q=") + QL1S("file://") + dir);
- div.lastChild().setPlainText(i18n("Open directory"));
-
- div.appendInside(QL1S(" - "));
-
- div.appendInside(markup(QL1S("a")));
- div.lastChild().setAttribute(QL1S("class"), QL1S("greylink"));
- div.lastChild().setAttribute(QL1S("href"), QL1S("file://") + file);
- div.lastChild().setPlainText(i18n("Open file"));
- }
- else
- {
- div.appendInside(QL1S("<em>") + QL1S("Removed") + QL1S("</em>"));
- }
-
- div.appendInside(QL1S(" - "));
-
- div.appendInside(markup(QL1S("a")));
- div.lastChild().setAttribute(QL1S("class"), QL1S("greylink"));
- div.lastChild().setAttribute(QL1S("href"), QL1S("about:downloads/removeItem?item=") + QString::number(i));
- div.lastChild().setPlainText(i18n("Remove from list"));
-
- break;
- }
-
- i++;
- }
-
- if (i == 0)
- {
- m_root.addClass(QL1S("empty"));
- m_root.setPlainText(i18n("No matches for string %1 in downloads", filter));
- }
-}
-
-
-void NewTabPage::tabsPage()
-{
- m_root.addClass(QL1S("tabs"));
-
- int wins = 0;
- Q_FOREACH(const QWeakPointer<MainWindow> &wPointer, rApp->mainWindowList())
- {
- m_root.appendInside(markup(QL1S("h3")));
- m_root.lastChild().setPlainText(i18n("Window"));
-
- MainWindow *w = wPointer.data();
-
- const int tabCount = w->mainView()->count();
- for (int i = 0; i < tabCount; ++i)
- {
- KUrl url = w->mainView()->webTab(i)->url();
-
- if (!WebSnap::existsImage(url))
- {
- kDebug() << "image doesn't exist for url: " << url;
- QPixmap preview = WebSnap::renderPagePreview(*w->mainView()->webTab(i)->page());
- QString path = WebSnap::imagePathFromUrl(url.url());
- preview.save(path);
- }
- QString name = w->mainView()->webTab(i)->view()->title();
- QWebElement prev;
-
- prev = tabPreview(wins, i, url, name);
-
- m_root.appendInside(prev);
- }
-
- wins++;
- }
-}
-
-
-// ----------------------------------------------------------------------------
-// LOW-LEVEL FUNCTIONS
-
-
-QWebElement NewTabPage::emptyPreview(int index)
-{
- QWebElement prev = markup(QL1S(".thumbnail"));
-
- prev.findFirst(QL1S(".preview img")).setAttribute(QL1S("src") ,
- QL1S("file:///") + KIconLoader::global()->iconPath("insert-image", KIconLoader::Desktop));
- prev.findFirst(QL1S("span a")).setPlainText(i18n("Set a Preview..."));
- prev.findFirst(QL1S("a")).setAttribute(QL1S("href"),
- QL1S("about:preview/modify/") + QVariant(index).toString());
-
- setupPreview(prev, index, false);
-
- return prev;
-}
-
-
-void NewTabPage::reloadPreview(int index)
-{
- QString id = QL1S("#preview") + QString::number(index);
- QWebElement thumb = m_root.document().findFirst(id);
-
- QString urlString = ReKonfig::previewUrls().at(index);
- QString nameString = ReKonfig::previewNames().at(index);
-
- QString title = checkTitle(QString::number(index + 1) + QL1S(" - ") + nameString);
-
- ThumbUpdater *t = new ThumbUpdater(thumb, urlString, title);
- t->updateThumb();
-}
-
-
-QWebElement NewTabPage::validPreview(int index, const KUrl &url, const QString &title)
-{
- QWebElement prev = markup(QL1S(".thumbnail"));
-
- QString previewPath = WebSnap::existsImage(url)
- ? QL1S("file://") + WebSnap::imagePathFromUrl(url)
- : rApp->iconManager()->iconPathForUrl(url)
- ;
-
- prev.findFirst(QL1S(".preview img")).setAttribute(QL1S("src") , previewPath);
- prev.findFirst(QL1S("a")).setAttribute(QL1S("href"), url.toMimeDataString());
- prev.findFirst(QL1S("span a")).setAttribute(QL1S("href"), url.toMimeDataString());
- prev.findFirst(QL1S("span a")).setPlainText(checkTitle(title));
-
- setupPreview(prev, index, true);
- return prev;
-}
-
-
-QWebElement NewTabPage::tabPreview(int winIndex, int tabIndex, const KUrl &url, const QString &title)
-{
- QWebElement prev = markup(QL1S(".thumbnail"));
- QString previewPath = QL1S("file://") + WebSnap::imagePathFromUrl(url);
-
- QString href = QL1S("about:tabs/show?win=") + QString::number(winIndex) + QL1S("&tab=") + QString::number(tabIndex);
-
- prev.findFirst(QL1S(".preview img")).setAttribute(QL1S("src") , previewPath);
- prev.findFirst(QL1S("a")).setAttribute(QL1S("href"), href);
- prev.findFirst(QL1S("span a")).setAttribute(QL1S("href"), href);
- prev.findFirst(QL1S("span a")).setPlainText(checkTitle(title));
-
- setupTabPreview(prev, winIndex, tabIndex);
-
- prev.findFirst(QL1S(".right")).setStyleProperty(QL1S("visibility"), QL1S("visible"));
- prev.findFirst(QL1S(".left")).setStyleProperty(QL1S("visibility"), QL1S("hidden"));
-
- return prev;
-}
-
-
-QWebElement NewTabPage::closedTabPreview(int index, const KUrl &url, const QString &title)
-{
- QWebElement prev = markup(QL1S(".thumbnail"));
-
- QString previewPath = WebSnap::existsImage(url)
- ? QL1S("file://") + WebSnap::imagePathFromUrl(url)
- : rApp->iconManager()->iconPathForUrl(url)
- ;
-
- QString href = QL1S("about:closedTabs/restore?tab=") + QString::number(index);
-
- prev.findFirst(QL1S(".preview img")).setAttribute(QL1S("src") , previewPath);
- prev.findFirst(QL1S("a")).setAttribute(QL1S("href"), href);
- prev.findFirst(QL1S("span a")).setAttribute(QL1S("href"), href);
- prev.findFirst(QL1S("span a")).setPlainText(checkTitle(title));
-
- setupPreview(prev, index, true);
- return prev;
-}
-
-
-void NewTabPage::setupPreview(QWebElement e, int index, bool showControls)
-{
- e.findFirst(QL1S(".right img")).setAttribute(QL1S("src"),
- QL1S("file:///") + KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState));
-
- e.findFirst(QL1S(".right")).setAttribute(QL1S("title"), i18n("Remove favorite"));
-
- e.findFirst(QL1S(".left img")).setAttribute(QL1S("src"),
- QL1S("file:///") + KIconLoader::global()->iconPath("view-refresh", KIconLoader::DefaultState));
-
- e.findFirst(QL1S(".left")).setAttribute(QL1S("title"), i18n("Reload thumbnail"));
-
- e.findFirst(QL1S(".left")).setAttribute(QL1S("href"), QL1S("about:preview/reload/") + QVariant(index).toString());
- e.findFirst(QL1S(".right")).setAttribute(QL1S("href"), QL1S("about:preview/remove/") + QVariant(index).toString());
-
- e.setAttribute(QL1S("id"), QL1S("preview") + QVariant(index).toString());
-
- if (showControls)
- {
- e.findFirst(QL1S(".right")).setStyleProperty(QL1S("visibility"), QL1S("visible"));
- e.findFirst(QL1S(".left")).setStyleProperty(QL1S("visibility"), QL1S("visible"));
- }
-}
-
-
-void NewTabPage::setupTabPreview(QWebElement e, int winIndex, int tabIndex)
-{
- e.findFirst(QL1S(".right img")).setAttribute(QL1S("src"),
- QL1S("file:///") + KIconLoader::global()->iconPath("edit-delete", KIconLoader::DefaultState));
- e.findFirst(QL1S(".right")).setAttribute(QL1S("title"), QL1S("Close Tab"));
-
- QString href = QL1S("about:tabs/remove?win=") + QString::number(winIndex) + QL1S("&tab=") + QString::number(tabIndex);
- e.findFirst(QL1S(".right")).setAttribute(QL1S("href"), href);
-
- e.setAttribute(QL1S("id"), QL1S("win") + QString::number(winIndex) + QL1S("tab") + QString::number(tabIndex));
-}
-
-
-void NewTabPage::removePreview(int index)
-{
- QStringList names = ReKonfig::previewNames();
- QStringList urls = ReKonfig::previewUrls();
-
- urls.removeAt(index);
- names.removeAt(index);
-
- ReKonfig::setPreviewNames(names);
- ReKonfig::setPreviewUrls(urls);
-
- loadPageForUrl(KUrl("about:favorites"));
-
- ReKonfig::self()->writeConfig();
-}
-
-
-void NewTabPage::createBookmarkGroup(const KBookmark &bookmark, QWebElement parent)
-{
- KBookmarkGroup group = bookmark.toGroup();
- KBookmark bm = group.first();
-
- parent.appendInside(markup(QL1S(".bookmarkfolder")));
- QWebElement folder = parent.lastChild();
- folder.appendInside(markup(QL1S("h4")));
- folder.lastChild().setPlainText(group.fullText());
-
- while (!bm.isNull())
- {
- createBookmarkItem(bm, folder);
- bm = group.next(bm);
- }
-}
-
-
-void NewTabPage::createBookmarkItem(const KBookmark &bookmark, QWebElement parent)
-{
- QString cacheDir = QL1S("file://") + KStandardDirs::locateLocal("cache" , "" , true);
- QString icon = QL1S("file://") + KGlobal::dirs()->findResource("icon", "oxygen/16x16/mimetypes/text-html.png");
-
- if (bookmark.isGroup())
- {
- createBookmarkGroup(bookmark, m_root);
- return;
- }
- else if (bookmark.isSeparator())
- {
- kDebug() << "SEPARATOR";
- parent.appendInside(QL1S("<hr />"));
- }
- else
- {
- QString b = bookmark.icon();
- if (b.contains(QL1S("favicons")))
- icon = cacheDir + bookmark.icon() + QL1S(".png");
-
- parent.appendInside(markup(QL1S("a")));
- QWebElement bookmarkElement = parent.lastChild();
- bookmarkElement.setAttribute(QL1S("href") , bookmark.url().prettyUrl());
- bookmarkElement.addClass("bookmark");
-
- bookmarkElement.appendInside(markup(QL1S("img")));
- bookmarkElement.lastChild().setAttribute(QL1S("src") , icon);
- bookmarkElement.lastChild().setAttribute(QL1S("width") , QL1S("16"));
- bookmarkElement.lastChild().setAttribute(QL1S("height") , QL1S("16"));
- bookmarkElement.appendInside(QL1S(" "));
- bookmarkElement.appendInside(checkTitle(bookmark.fullText(), 40));
- }
-}
-
-
-QString NewTabPage::checkTitle(const QString &title, int max)
-{
- QString t(title);
- if (t.length() > max)
- {
- t.truncate(max - 3);
- t += QL1S("...");
- }
- return t;
-}
-
-
-QWebElement NewTabPage::createLinkItem(const QString &title, const QString &urlString, const QString &iconPath, int groupOrSize) const
-{
- const KIconLoader * const loader = KIconLoader::global();
-
- QWebElement nav = markup(QL1S(".link"));
- nav.findFirst(QL1S("a")).setAttribute(QL1S("href"), urlString);
- nav.findFirst(QL1S("img")).setAttribute(QL1S("src"), QL1S("file://") + loader->iconPath(iconPath, groupOrSize));
- nav.findFirst(QL1S("span")).appendInside(title);
- return nav;
-}
-
-
-QWebElement NewTabPage::createFormItem(const QString &title, const QString &urlString) const
-{
- QWebElement form = markup(QL1S("form"));
-
- form.setAttribute(QL1S("method"), QL1S("GET"));
- form.setAttribute(QL1S("action"), urlString);
-
- form.appendInside(markup(QL1S("input")));
- form.lastChild().setAttribute(QL1S("type"), QL1S("text"));
- form.lastChild().setAttribute(QL1S("name"), QL1S("q"));
-
- form.appendInside(markup(QL1S("input")));
- form.lastChild().setAttribute(QL1S("type"), QL1S("submit"));
- form.lastChild().setAttribute(QL1S("value"), title);
-
- return form;
-}
-
-
-void NewTabPage::updateWindowIcon()
-{
- int currentIndex = rApp->mainWindow()->mainView()->currentIndex();
- rApp->mainWindow()->changeWindowIcon(currentIndex);
-}
-
-
-void NewTabPage::initJS()
-{
- QWebFrame *parentFrame = qobject_cast<QWebFrame *>(parent());
- QString oldHTML = parentFrame->toHtml();
-
- QString includes;
- includes += QL1S("<head>");
- includes += QL1S("<script src=\"$DEFAULT_PATH/htmls/jquery-1.7.2.min.js\" type=\"text/javascript\"></script>");
- includes += QL1S("<script src=\"$DEFAULT_PATH/htmls/jquery-ui-1.8.20.custom.min.js\" type=\"text/javascript\"></script>");
-
- QString htmlFilePath = KStandardDirs::locate("data", "rekonq/htmls/home.html");
- QString dataPath = QL1S("file://") + htmlFilePath;
- dataPath.remove(QL1S("/htmls/home.html"));
-
- includes.replace(QL1S("$DEFAULT_PATH"), dataPath);
-
- oldHTML.replace(QL1S("<head>"), includes);
-
- QString javascript;
- javascript += QL1S("<body>");
- javascript += QL1S("<script>");
- javascript += QL1S("$(function() {");
- javascript += QL1S(" $( \"#content\" ).sortable({");
- javascript += QL1S(" revert: true,");
- javascript += QL1S(" cursor: \"move\",");
- javascript += QL1S(" distance: 30,");
- javascript += QL1S(" update: function(event, ui) { window.location.href = \"about:favorites/save\"; }");
- javascript += QL1S(" });");
- javascript += QL1S(" $( \".thumbnail\" ).disableSelection();");
- javascript += QL1S("});");
- javascript += QL1S("</script>");
-
- oldHTML.replace(QL1S("<body>"), javascript);
-
- parentFrame->setHtml(oldHTML);
-}
-
-
-void NewTabPage::saveFavorites()
-{
- QStringList names = ReKonfig::previewNames();
- QStringList urls = ReKonfig::previewUrls();
-
- QStringList newNames = names;
- QStringList newUrls = urls;
-
- QWebElementCollection coll = m_root.document().findAll(QL1S(".thumbnail"));
- QList<QWebElement> list = coll.toList();
-
- int i = 0;
-
- Q_FOREACH(QWebElement e, list)
- {
- if (!e.hasAttribute(QL1S("id")))
- continue;
-
- QString id = e.attribute(QL1S("id"));
- kDebug() << "id: " << id;
- int index = id.remove(QL1S("preview")).toInt();
- kDebug() << "INDEX: " << index;
-
- newNames.replace(i, names.at(index));
- newUrls.replace(i, urls.at(index));
- i++;
- }
-
- ReKonfig::setPreviewNames(newNames);
- ReKonfig::setPreviewUrls(newUrls);
-
- loadPageForUrl(KUrl("about:favorites"));
-}
diff --git a/src/newtabpage.h b/src/newtabpage.h
deleted file mode 100644
index 1c8d423d..00000000
--- a/src/newtabpage.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef REKONQ_NEW_TAB_PAGE
-#define REKONQ_NEW_TAB_PAGE
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KUrl>
-
-// Qt Includes
-#include <QObject>
-#include <QString>
-#include <QWebElement>
-
-// Forward Declarations
-class KBookmark;
-class QWebFrame;
-
-
-class REKONQ_TESTS_EXPORT NewTabPage : public QObject
-{
- Q_OBJECT
-
-public:
- NewTabPage(QWebFrame *frame);
-
- /**
- * This method takes an about: url and loads
- * the corresponding part of the new tab page
- */
- void generate(const KUrl &url = KUrl("about:home"));
-
-private:
- // these are the "high-level" functions to build the new tab page.
- // Basically, you call browsingMenu + one of the *Page methods
- // to load a page
- void browsingMenu(const KUrl &currentUrl);
-
- void favoritesPage();
- void historyPage(const QString & filter = QString());
- void bookmarksPage();
- void closedTabsPage();
- void downloadsPage(const QString & filter = QString());
- void tabsPage();
-
- void loadPageForUrl(const KUrl &url, const QString & filter = QString());
-
- // --------------------------------------------------------------------------
- // "low-level" functions
- // we use these to create the pages over
-
- // Previews handling
- QWebElement emptyPreview(int index);
- QWebElement validPreview(int index, const KUrl &url, const QString &title);
- QWebElement tabPreview(int winIndex, int tabIndex, const KUrl &url, const QString &title);
- QWebElement closedTabPreview(int index, const KUrl &url, const QString &title);
-
- void reloadPreview(int index);
- void removePreview(int index);
-
- void setupPreview(QWebElement e, int index, bool showControls);
- void setupTabPreview(QWebElement e, int winIndex, int tabIndex);
-
- void createBookmarkItem(const KBookmark &bookmark, QWebElement parent);
- void createBookmarkGroup(const KBookmark &bookmark, QWebElement parent);
-
- QWebElement createLinkItem(const QString &title, const QString &urlString, const QString &iconPath, int groupOrSize) const;
- QWebElement createFormItem(const QString &title, const QString &urlString) const;
-
- /**
- * This function helps to get faster a new markup of one type,
- * it isn't easy to create one with QWebElement.
- *
- * It gets it in the #models div of home.html.
- * It works for all elements defined here.
- *
- */
- inline QWebElement markup(const QString &selector) const
- {
- return m_root.document().findFirst("#models > " + selector).clone();
- }
-
- QString checkTitle(const QString &title, int max = 20);
-
- void updateWindowIcon();
-
- void initJS();
- void saveFavorites();
-
-private:
- QString m_html;
- QWebElement m_root;
-
- bool m_showFullHistory;
-};
-
-#endif // REKONQ_NEW_TAB_PAGE
diff --git a/src/opensearch/opensearchengine.cpp b/src/opensearch/opensearchengine.cpp
deleted file mode 100644
index 28027828..00000000
--- a/src/opensearch/opensearchengine.cpp
+++ /dev/null
@@ -1,314 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Jakub Wieczorek <faw217@gmail.com>
-* Copyright (C) 2009 by Christian Franke <cfchris6@ts2server.com>
-* Copyright (C) 2009 by Fredy Yanardi <fyanardi@gmail.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "opensearchengine.h"
-#include "opensearchengine.moc"
-
-// Qt Includes
-#include <QtCore/QRegExp>
-#include <QtCore/QFile>
-#include <QtCore/QFileInfo>
-#include <QtCore/QDateTime>
-
-// KDE Includes
-#include <KStandardDirs>
-
-
-OpenSearchEngine::OpenSearchEngine(QObject *parent)
- : QObject(parent)
- , m_parser(0)
-{
-}
-
-
-OpenSearchEngine::~OpenSearchEngine()
-{
- if (m_parser)
- {
- delete m_parser;
- }
-}
-
-
-QString OpenSearchEngine::parseTemplate(const QString &searchTerm, const QString &searchTemplate)
-{
- QString language = QLocale().name();
- // Simple conversion to RFC 3066.
- language = language.replace(QL1C('_'), QL1C('-'));
- QString country = language;
- country = (country.remove(0, country.indexOf(QL1C('-')) + 1)).toLower();
- const int firstDashPosition = country.indexOf(QL1C('-'));
- if (firstDashPosition >= 0)
- country = country.mid(firstDashPosition + 1);
-
- QString result = searchTemplate;
- result.replace(QL1S("{count}"), QL1S("20"));
- result.replace(QL1S("{startIndex}"), QL1S("0"));
- result.replace(QL1S("{startPage}"), QL1S("0"));
- result.replace(QL1S("{language}"), language);
- result.replace(QL1S("{country}"), country.toLower());
- result.replace(QL1S("{inputEncoding}"), QL1S("UTF-8"));
- result.replace(QL1S("{outputEncoding}"), QL1S("UTF-8"));
- result.replace(QL1S("{searchTerms}"), searchTerm);
-
- return result;
-}
-
-
-QString OpenSearchEngine::name() const
-{
- return m_name;
-}
-
-
-void OpenSearchEngine::setName(const QString &name)
-{
- m_name = name;
-}
-
-
-QString OpenSearchEngine::description() const
-{
- return m_description;
-}
-
-
-void OpenSearchEngine::setDescription(const QString &description)
-{
- m_description = description;
-}
-
-
-QString OpenSearchEngine::searchUrlTemplate() const
-{
- return m_searchUrlTemplate;
-}
-
-
-void OpenSearchEngine::setSearchUrlTemplate(const QString &searchUrlTemplate)
-{
- m_searchUrlTemplate = searchUrlTemplate;
-}
-
-
-KUrl OpenSearchEngine::searchUrl(const QString &searchTerm) const
-{
- if (m_searchUrlTemplate.isEmpty())
- {
- return KUrl();
- }
-
- KUrl retVal = KUrl::fromEncoded(parseTemplate(searchTerm, m_searchUrlTemplate).toUtf8());
-
- QList<Parameter>::const_iterator i;
- for (i = m_searchParameters.constBegin(); i != m_searchParameters.constEnd(); ++i)
- {
- retVal.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
- }
-
- return retVal;
-}
-
-
-bool OpenSearchEngine::providesSuggestions() const
-{
- return !m_suggestionsUrlTemplate.isEmpty();
-}
-
-
-QString OpenSearchEngine::suggestionsUrlTemplate() const
-{
- return m_suggestionsUrlTemplate;
-}
-
-
-void OpenSearchEngine::setSuggestionsUrlTemplate(const QString &suggestionsUrlTemplate)
-{
- m_suggestionsUrlTemplate = suggestionsUrlTemplate;
-}
-
-
-KUrl OpenSearchEngine::suggestionsUrl(const QString &searchTerm) const
-{
- if (m_suggestionsUrlTemplate.isEmpty())
- {
- return KUrl();
- }
-
- KUrl retVal = KUrl::fromEncoded(parseTemplate(searchTerm, m_suggestionsUrlTemplate).toUtf8());
-
- QList<Parameter>::const_iterator i;
- for (i = m_suggestionsParameters.constBegin(); i != m_suggestionsParameters.constEnd(); ++i)
- {
- retVal.addQueryItem(i->first, parseTemplate(searchTerm, i->second));
- }
- return retVal;
-}
-
-
-QList<OpenSearchEngine::Parameter> OpenSearchEngine::searchParameters() const
-{
- return m_searchParameters;
-}
-
-
-void OpenSearchEngine::setSearchParameters(const QList<Parameter> &searchParameters)
-{
- m_searchParameters = searchParameters;
-}
-
-
-QList<OpenSearchEngine::Parameter> OpenSearchEngine::suggestionsParameters() const
-{
- return m_suggestionsParameters;
-}
-
-
-void OpenSearchEngine::setSuggestionsParameters(const QList<Parameter> &suggestionsParameters)
-{
- m_suggestionsParameters = suggestionsParameters;
-}
-
-
-void OpenSearchEngine::setSuggestionParser(SuggestionParser *parser)
-{
- m_parser = parser;
-}
-
-
-QString OpenSearchEngine::imageUrl() const
-{
- return m_imageUrl;
-}
-
-
-void OpenSearchEngine::setImageUrl(const QString &imageUrl)
-{
- m_imageUrl = imageUrl;
-}
-
-
-QImage OpenSearchEngine::image() const
-{
- return m_image;
-}
-
-
-void OpenSearchEngine::setImage(const QImage &image)
-{
- m_image = image;
-}
-
-
-bool OpenSearchEngine::isValid() const
-{
- return (!m_name.isEmpty() && !m_searchUrlTemplate.isEmpty());
-}
-
-
-bool OpenSearchEngine::operator==(const OpenSearchEngine &other) const
-{
- return (m_name == other.m_name
- && m_description == other.m_description
- && m_imageUrl == other.m_imageUrl
- && m_searchUrlTemplate == other.m_searchUrlTemplate
- && m_suggestionsUrlTemplate == other.m_suggestionsUrlTemplate
- && m_searchParameters == other.m_searchParameters
- && m_suggestionsParameters == other.m_suggestionsParameters);
-}
-
-
-bool OpenSearchEngine::operator<(const OpenSearchEngine &other) const
-{
- return (m_name < other.m_name);
-}
-
-
-ResponseList OpenSearchEngine::parseSuggestion(const QString &searchTerm, const QByteArray &resp)
-{
- if (!searchTerm.isEmpty() && !resp.isEmpty())
- {
- QFile file(suggestionPathFor(searchTerm));
- if (file.open(QIODevice::WriteOnly | QIODevice::Text))
- {
- file.write(resp, resp.size());
- file.close();
- }
- }
-
- return parseSuggestion(resp);
-}
-
-
-ResponseList OpenSearchEngine::parseSuggestion(const QByteArray &resp)
-{
- if (!m_parser)
- return ResponseList();
-
- if (resp.isEmpty())
- return ResponseList();
-
- return m_parser->parse(resp);
-}
-
-
-QString OpenSearchEngine::type()
-{
- return m_parser->type();
-}
-
-
-QString OpenSearchEngine::suggestionPathFor(const QString &searchTerm)
-{
- return KStandardDirs::locateLocal("cache", QL1S("opensearch/") + m_name + QL1S("/") + searchTerm, true);
-}
-
-
-bool OpenSearchEngine::hasCachedSuggestionsFor(const QString &searchTerm)
-{
- QFileInfo info(suggestionPathFor(searchTerm));
- return info.exists() && info.lastModified().daysTo(QDateTime::currentDateTime()) < 7;
-}
-
-
-ResponseList OpenSearchEngine::cachedSuggestionsFor(const QString &searchTerm)
-{
- QFile file(suggestionPathFor(searchTerm));
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
- return ResponseList();
-
- QByteArray resp;
- while (!file.atEnd())
- {
- resp += file.readLine();
- }
- return parseSuggestion(resp);
-}
diff --git a/src/opensearch/opensearchengine.h b/src/opensearch/opensearchengine.h
deleted file mode 100644
index cc826aec..00000000
--- a/src/opensearch/opensearchengine.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Jakub Wieczorek <faw217@gmail.com>
-* Copyright (C) 2009 by Christian Franke <cfchris6@ts2server.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef OPENSEARCHENGINE_H
-#define OPENSEARCHENGINE_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "suggestionparser.h"
-
-// KDE Includes
-#include <KUrl>
-
-// Qt Includes
-#include <QtCore/QPair>
-#include <QtGui/QImage>
-
-
-class OpenSearchEngine : public QObject
-{
- Q_OBJECT
-
-public:
- typedef QPair<QString, QString> Parameter;
-
- OpenSearchEngine(QObject *parent = 0);
- ~OpenSearchEngine();
-
- QString name() const;
- void setName(const QString &name);
-
- QString description() const;
- void setDescription(const QString &description);
-
- QString searchUrlTemplate() const;
- void setSearchUrlTemplate(const QString &searchUrl);
- KUrl searchUrl(const QString &searchTerm) const;
-
- bool providesSuggestions() const;
-
- QString suggestionsUrlTemplate() const;
- void setSuggestionsUrlTemplate(const QString &suggestionsUrl);
- KUrl suggestionsUrl(const QString &searchTerm) const;
-
- QList<Parameter> searchParameters() const;
- void setSearchParameters(const QList<Parameter> &searchParameters);
-
- QList<Parameter> suggestionsParameters() const;
- void setSuggestionsParameters(const QList<Parameter> &suggestionsParameters);
-
- void setSuggestionParser(SuggestionParser *parser);
-
- QString imageUrl() const;
- void setImageUrl(const QString &url);
-
- QImage image() const;
- void setImage(const QImage &image);
-
- bool isValid() const;
-
- bool operator==(const OpenSearchEngine &other) const;
- bool operator<(const OpenSearchEngine &other) const;
-
- ResponseList parseSuggestion(const QString &searchTerm, const QByteArray &response);
-
- static QString parseTemplate(const QString &searchTerm, const QString &searchTemplate);
-
- QString type();
-
- bool hasCachedSuggestionsFor(const QString &searchTerm);
-
- ResponseList cachedSuggestionsFor(const QString &searchTerm);
-
-private:
- QString m_name;
- QString m_description;
-
- QString m_imageUrl;
- QImage m_image;
-
- QString m_searchUrlTemplate;
- QString m_suggestionsUrlTemplate;
- QList<Parameter> m_searchParameters;
- QList<Parameter> m_suggestionsParameters;
-
- SuggestionParser *m_parser;
-
- QString suggestionPathFor(const QString &searchTerm);
-
- ResponseList parseSuggestion(const QByteArray &resp);
-};
-
-#endif // OPENSEARCHENGINE_H
diff --git a/src/opensearch/opensearchmanager.cpp b/src/opensearch/opensearchmanager.cpp
deleted file mode 100644
index 5fad35ac..00000000
--- a/src/opensearch/opensearchmanager.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Fredy Yanardi <fyanardi@gmail.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "opensearchmanager.h"
-#include "opensearchmanager.moc"
-
-// Local Includes
-#include "application.h"
-#include "opensearchengine.h"
-#include "opensearchreader.h"
-#include "opensearchwriter.h"
-
-// KDE Includes
-#include <KGlobal>
-#include <KStandardDirs>
-#include <KUrl>
-#include <kio/scheduler.h>
-#include <KService>
-#include <KDE/KMessageBox>
-#include <KUriFilterData>
-#include <KConfigGroup>
-
-// Qt Includes
-#include <QFile>
-#include <QFileInfo>
-#include <QDBusMessage>
-#include <QDBusConnection>
-
-
-OpenSearchManager::OpenSearchManager(QObject *parent)
- : QObject(parent)
- , m_activeEngine(0)
- , m_currentJob(0)
-{
- m_state = IDLE;
- loadEngines();
-}
-
-
-OpenSearchManager::~OpenSearchManager()
-{
- qDeleteAll(m_engineCache);
- m_engineCache.clear();
- m_engines.clear();
-}
-
-
-void OpenSearchManager::setSearchProvider(const QString &searchProvider)
-{
- m_activeEngine = 0;
-
- if (!m_engineCache.contains(searchProvider))
- {
- const QString fileName = KGlobal::dirs()->findResource("data", "rekonq/opensearch/" + trimmedEngineName(searchProvider) + ".xml");
- kDebug() << searchProvider << " trimmed name: " << trimmedEngineName(searchProvider) << " file name path: " << fileName;
- if (fileName.isEmpty())
- {
- return;
- }
- QFile file(fileName);
-
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
- {
- return;
- }
-
- OpenSearchReader reader;
- OpenSearchEngine *engine = reader.read(&file);
-
- if (engine)
- {
- m_engineCache.insert(searchProvider, engine);
- }
- else
- {
- return;
- }
- }
-
- m_activeEngine = m_engineCache.value(searchProvider);
-}
-
-
-bool OpenSearchManager::isSuggestionAvailable()
-{
- return m_activeEngine != 0;
-}
-
-
-void OpenSearchManager::addOpenSearchEngine(const KUrl &url, const QString &title, const QString &shortcut)
-{
- m_shortcut = shortcut;
- m_title = trimmedEngineName(title);
-
- if (m_state != IDLE)
- {
- idleJob();
- }
-
- m_currentJob = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo);
- m_jobUrl = url;
- m_state = REQ_DESCRIPTION;
- connect(m_currentJob, SIGNAL(data(KIO::Job*, QByteArray)), this, SLOT(dataReceived(KIO::Job*, QByteArray)));
- connect(m_currentJob, SIGNAL(result(KJob*)), this, SLOT(jobFinished(KJob*)));
-}
-
-
-void OpenSearchManager::requestSuggestion(const QString &searchText)
-{
- if (!m_activeEngine)
- return;
-
- if (m_state != IDLE)
- {
- // NOTE:
- // changing OpenSearchManager behavior
- // using idleJob here lets opensearchmanager to start another search, while
- // if we want in any case lets it finish its previous job we can just return here.
- idleJob();
- }
-
- if (m_activeEngine->hasCachedSuggestionsFor(searchText))
- {
- emit suggestionsReceived(searchText, m_activeEngine->cachedSuggestionsFor(searchText));
- }
- else
- {
- KUrl url = m_activeEngine->suggestionsUrl(searchText);
- _typedText = searchText;
- m_currentJob = KIO::get(url, KIO::NoReload, KIO::HideProgressInfo);
- m_state = REQ_SUGGESTION;
- connect(m_currentJob, SIGNAL(data(KIO::Job*, QByteArray)), this, SLOT(dataReceived(KIO::Job*, QByteArray)));
- connect(m_currentJob, SIGNAL(result(KJob*)), this, SLOT(jobFinished(KJob*)));
- }
-}
-
-
-void OpenSearchManager::dataReceived(KIO::Job *job, const QByteArray &data)
-{
- Q_UNUSED(job);
- m_jobData.append(data);
-}
-
-
-void OpenSearchManager::jobFinished(KJob *job)
-{
- if (!job->error() && m_state == REQ_DESCRIPTION)
- {
- OpenSearchReader reader;
- OpenSearchEngine *engine = reader.read(m_jobData);
- if (engine)
- {
- m_engineCache.insert(m_title, engine);
- m_engines.insert(m_jobUrl, m_shortcut);
- saveEngines();
-
- QString path;
- if (engine->providesSuggestions())
- {
- // save opensearch description only if it provides suggestions
- OpenSearchWriter writer;
- path = KGlobal::dirs()->findResource("data", "rekonq/opensearch/");
- QFile file(path + trimmedEngineName(engine->name()) + ".xml");
- writer.write(&file, engine);
-
- // save desktop file here
- QString searchUrl = OpenSearchEngine::parseTemplate("\\{@}", engine->searchUrlTemplate());
- m_currentJob = NULL;
-
- path = KGlobal::mainComponent().dirs()->saveLocation("services", "searchproviders/");
- KConfig _service(path + m_title + ".desktop", KConfig::SimpleConfig);
- KConfigGroup service(&_service, "Desktop Entry");
- service.writeEntry("Type", "Service");
- service.writeEntry("ServiceTypes", "SearchProvider");
- service.writeEntry("Name", m_title);
- service.writeEntry("Query", searchUrl);
- service.writeEntry("Keys", m_shortcut);
- // TODO charset
- service.writeEntry("Charset", "" /* provider->charset() */);
- // we might be overwriting a hidden entry
- service.writeEntry("Hidden", false);
- service.sync();
-
- // Update filters in running applications...
- QDBusMessage msg = QDBusMessage::createSignal("/", "org.kde.KUriFilterPlugin", "configure");
- QDBusConnection::sessionBus().send(msg);
-
- emit openSearchEngineAdded(engine->name());
- }
- }
- else
- {
- kFatal() << "Error while adding new open search engine";
- }
-
- idleJob();
- return;
- }
-
- // Do NOT parse if job had same errors or the typed string is empty
- if (job->error() || _typedText.isEmpty())
- {
- emit suggestionsReceived(_typedText, ResponseList());
- m_state = IDLE;
- return; // just silently return
- }
-
- if (m_state == REQ_SUGGESTION)
- {
- ResponseList suggestionsList;
- if (isSuggestionAvailable())
- {
- suggestionsList = m_activeEngine->parseSuggestion(_typedText, m_jobData);
- }
- emit suggestionsReceived(_typedText, suggestionsList);
- idleJob();
- return;
- }
-}
-
-
-void OpenSearchManager::loadEngines()
-{
- QFile file(KStandardDirs::locate("appdata", "opensearch/db_opensearch.json"));
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
- {
- return;
- }
-
- QString fileContent = QString::fromUtf8(file.readAll());
- QScriptEngine reader;
- if (!reader.canEvaluate(fileContent))
- {
- return;
- }
-
- QScriptValue responseParts = reader.evaluate(fileContent);
- QVariantList list;
- qScriptValueToSequence(responseParts, list);
- QStringList l;
- Q_FOREACH(const QVariant & e, list)
- {
- l = e.toStringList();
- m_engines.insert(KUrl(l.first()), l.last());
- }
- file.close();
-}
-
-
-void OpenSearchManager::saveEngines()
-{
- QFile file(KStandardDirs::locateLocal("appdata", "opensearch/db_opensearch.json"));
- if (!file.open(QIODevice::WriteOnly))
- {
- return;
- }
- QTextStream out(&file);
- out << "[";
- int i = 0;
- QList<KUrl> urls = m_engines.keys();
- Q_FOREACH(const KUrl & url, urls)
- {
- out << "[\"" << url.url() << "\",\"" << m_engines.value(url) << "\"]";
- i++;
- if (i != urls.size())
- {
- out << ",\n";
- }
- }
- out << "]\n";
- file.close();
-}
-
-
-void OpenSearchManager::removeDeletedEngines()
-{
- KService::Ptr service;
- Q_FOREACH(const KUrl & url, m_engines.keys())
- {
- service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(m_engines.value(url)));
- if (!service)
- {
- QString path = KStandardDirs::locateLocal("appdata", "opensearch/" + trimmedEngineName(m_engines.value(url)) + ".xml");
- QFile::remove(path + trimmedEngineName(m_engines.value(url)) + ".xml");
- m_engines.remove(url);
- }
- }
- saveEngines();
-}
-
-
-bool OpenSearchManager::engineExists(const KUrl &url)
-{
- return m_engines.contains(url);
-}
-
-
-QString OpenSearchManager::trimmedEngineName(const QString &engineName) const
-{
- QString trimmed;
- QString::ConstIterator constIter = engineName.constBegin();
- while (constIter != engineName.constEnd())
- {
- if (constIter->isSpace())
- {
- trimmed.append('_');
- }
- else
- {
- if (*constIter != '.')
- {
- trimmed.append(constIter->toLower());
- }
- }
- constIter++;
- }
-
- return trimmed;
-}
-
-
-void OpenSearchManager::idleJob()
-{
- if (m_currentJob)
- {
- disconnect(m_currentJob);
- m_currentJob->kill();
- }
-
- m_jobData.clear();
- m_state = IDLE;
-}
diff --git a/src/opensearch/opensearchmanager.h b/src/opensearch/opensearchmanager.h
deleted file mode 100644
index 3f99a06e..00000000
--- a/src/opensearch/opensearchmanager.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Fredy Yanardi <fyanardi@gmail.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef OPENSEARCHMANAGER_H
-#define OPENSEARCHMANAGER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "suggestionparser.h"
-
-// KDE Includes
-#include <kio/jobclasses.h>
-
-// Qt Includes
-#include <QObject>
-
-// Forward Declarations
-class OpenSearchEngine;
-
-
-/**
- * This class acts as a proxy between the SearchBar plugin
- * and the individual suggestion engine.
- * This class has a map of all available engines,
- * and route the suggestion request to the correct engine.
- */
-class OpenSearchManager : public QObject
-{
- Q_OBJECT
-
- enum STATE
- {
- REQ_SUGGESTION,
- REQ_DESCRIPTION,
- IDLE
- };
-
-public:
- /**
- * Constructor
- */
- explicit OpenSearchManager(QObject *parent = 0);
-
- virtual ~OpenSearchManager();
-
- void setSearchProvider(const QString &searchProvider);
-
- /**
- * Check whether a search suggestion engine is available for the given search provider
- * @param searchProvider the queried search provider
- */
- bool isSuggestionAvailable();
-
- bool engineExists(const KUrl &url);
-
-public Q_SLOTS:
- /**
- * Ask the specific suggestion engine to request for suggestion for the search text
- *
- * @param searchText the text to be queried to the suggestion service
- */
- void requestSuggestion(const QString &searchText);
- void addOpenSearchEngine(const KUrl &url, const QString &title, const QString &shortcut);
- void removeDeletedEngines();
-
-private Q_SLOTS:
- void dataReceived(KIO::Job *job, const QByteArray &data);
- void jobFinished(KJob *job);
-
-Q_SIGNALS:
- void suggestionsReceived(const QString &text, const ResponseList &suggestion);
- void openSearchEngineAdded(const QString &name);
-
-private:
- QString trimmedEngineName(const QString &engineName) const;
- void loadEngines();
- void saveEngines();
- void idleJob();
-
- // QString substitutueSearchText(const QString &searchText, const QString &requestURL) const;
- QByteArray m_jobData;
- QMap<QString, OpenSearchEngine*> m_engineCache;
- QMap<KUrl, QString> m_engines;
-
- OpenSearchEngine *m_activeEngine;
- STATE m_state;
-
- KIO::TransferJob *m_currentJob;
- KUrl m_jobUrl;
-
- QString _typedText;
-
- QString m_shortcut;
- QString m_title;
-};
-
-#endif // OPENSEARCHMANAGER_H
diff --git a/src/opensearch/opensearchreader.cpp b/src/opensearch/opensearchreader.cpp
deleted file mode 100644
index a4f43b7a..00000000
--- a/src/opensearch/opensearchreader.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Jakub Wieczorek <faw217@gmail.com>
-* Copyright (C) 2009 by Fredy Yanardi <fyanardi@gmail.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "opensearchreader.h"
-
-// Local Includes
-#include "opensearchengine.h"
-#include "suggestionparser.h"
-
-// KDE Includes
-#include <KLocalizedString>
-
-// Qt Includes
-#include <QIODevice>
-
-
-OpenSearchReader::OpenSearchReader()
- : QXmlStreamReader()
-{
-}
-
-
-OpenSearchEngine *OpenSearchReader::read(const QByteArray &data)
-{
- clear();
- addData(data);
-
- return read();
-}
-
-
-OpenSearchEngine *OpenSearchReader::read(QIODevice *device)
-{
- clear();
-
- if (!device->isOpen())
- {
- device->open(QIODevice::ReadOnly);
- }
-
- setDevice(device);
- return read();
-}
-
-
-OpenSearchEngine *OpenSearchReader::read()
-{
- OpenSearchEngine *engine = new OpenSearchEngine();
-
- while (!isStartElement() && !atEnd())
- {
- readNext();
- }
-
- if (name() != QL1S("OpenSearchDescription")
- || namespaceUri() != QL1S("http://a9.com/-/spec/opensearch/1.1/")
- )
- {
- kDebug() << "The file is not an OpenSearch 1.1 file: " << name();
- raiseError(i18n("The file is not an OpenSearch 1.1 file."));
- return engine;
- }
-
- while (!(isEndElement() && name() == QL1S("OpenSearchDescription")) && !atEnd())
- {
- readNext();
-
- if (!isStartElement())
- continue;
-
- // ShortName
- if (name() == QL1S("ShortName"))
- {
- engine->setName(readElementText());
- continue;
- }
-
- // Description
- if (name() == QL1S("Description"))
- {
- engine->setDescription(readElementText());
- continue;
- }
-
- // Url
- if (name() == QL1S("Url"))
- {
- QString type = attributes().value(QL1S("type")).toString();
- QString url = attributes().value(QL1S("template")).toString();
-
- if (url.isEmpty())
- continue;
-
- QList<OpenSearchEngine::Parameter> parameters;
-
- readNext();
-
- while (!(isEndElement() && name() == QL1S("Url")))
- {
- if (!isStartElement()
- || (name() != QL1S("Param")
- && name() != QL1S("Parameter")))
- {
- readNext();
- continue;
- }
-
- QString key = attributes().value(QL1S("name")).toString();
- QString value = attributes().value(QL1S("value")).toString();
-
- if (!key.isEmpty() && !value.isEmpty())
- {
- parameters.append(OpenSearchEngine::Parameter(key, value));
- }
-
- while (!isEndElement())
- {
- readNext();
- }
- }
-
- if (type == QL1S("text/html"))
- {
- engine->setSearchUrlTemplate(url);
- engine->setSearchParameters(parameters);
- }
- else
- {
- if (engine->suggestionsUrlTemplate().isEmpty()
- && type == QL1S("application/x-suggestions+json")) //note: xml is preferred
- {
- engine->setSuggestionsUrlTemplate(url);
- engine->setSuggestionsParameters(parameters);
- engine->setSuggestionParser(new JSONParser());
- }
- else if (type == QL1S("application/x-suggestions+xml"))
- {
- engine->setSuggestionsUrlTemplate(url);
- engine->setSuggestionsParameters(parameters);
- engine->setSuggestionParser(new XMLParser());
- }
- }
-
- continue;
- }
-
- // Image
- if (name() == QL1S("Image"))
- {
- engine->setImageUrl(readElementText());
- continue;
- }
-
- // Engine check
- if (!engine->name().isEmpty()
- && !engine->description().isEmpty()
- && !engine->suggestionsUrlTemplate().isEmpty()
- && !engine->searchUrlTemplate().isEmpty()
- && !engine->imageUrl().isEmpty()
- )
- {
- break;
- }
- }
-
- return engine;
-}
diff --git a/src/opensearch/opensearchreader.h b/src/opensearch/opensearchreader.h
deleted file mode 100644
index d1c644ae..00000000
--- a/src/opensearch/opensearchreader.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Jakub Wieczorek <faw217@gmail.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef OPENSEARCHREADER_H
-#define OPENSEARCHREADER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QXmlStreamReader>
-
-// Forward Declarations
-class OpenSearchEngine;
-
-
-class OpenSearchReader : public QXmlStreamReader
-{
-public:
- OpenSearchReader();
-
- OpenSearchEngine *read(const QByteArray &data);
- OpenSearchEngine *read(QIODevice *device);
-
-private:
- OpenSearchEngine *read();
-};
-
-#endif // OPENSEARCHREADER_H
diff --git a/src/opensearch/opensearchwriter.cpp b/src/opensearch/opensearchwriter.cpp
deleted file mode 100644
index 0b50ca6a..00000000
--- a/src/opensearch/opensearchwriter.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Jakub Wieczorek <faw217@gmail.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "opensearchwriter.h"
-
-// Local Includes
-#include "opensearchengine.h"
-
-// Qt Includes
-#include <QtCore/QIODevice>
-
-
-OpenSearchWriter::OpenSearchWriter()
- : QXmlStreamWriter()
-{
- setAutoFormatting(true);
-}
-
-
-bool OpenSearchWriter::write(QIODevice *device, OpenSearchEngine *engine)
-{
- if (!engine)
- return false;
-
- if (!device->isOpen())
- device->open(QIODevice::WriteOnly);
-
- setDevice(device);
- write(engine);
- return true;
-}
-
-
-void OpenSearchWriter::write(OpenSearchEngine *engine)
-{
- writeStartDocument();
- writeStartElement(QL1S("OpenSearchDescription"));
- writeDefaultNamespace(QL1S("http://a9.com/-/spec/opensearch/1.1/"));
-
- if (!engine->name().isEmpty())
- {
- writeTextElement(QL1S("ShortName"), engine->name());
- }
-
- if (!engine->description().isEmpty())
- {
- writeTextElement(QL1S("Description"), engine->description());
- }
-
- if (!engine->searchUrlTemplate().isEmpty())
- {
- writeStartElement(QL1S("Url"));
- writeAttribute(QL1S("method"), QL1S("get"));
- writeAttribute(QL1S("template"), engine->searchUrlTemplate());
-
- if (!engine->searchParameters().empty())
- {
- writeNamespace(QL1S("http://a9.com/-/spec/opensearch/extensions/parameters/1.0/"), QL1S("p"));
-
- QList<OpenSearchEngine::Parameter>::const_iterator end = engine->searchParameters().constEnd();
- QList<OpenSearchEngine::Parameter>::const_iterator i = engine->searchParameters().constBegin();
- for (; i != end; ++i)
- {
- writeStartElement(QL1S("p:Parameter"));
- writeAttribute(QL1S("name"), i->first);
- writeAttribute(QL1S("value"), i->second);
- writeEndElement();
- }
- }
-
- writeEndElement();
- }
-
- if (!engine->suggestionsUrlTemplate().isEmpty())
- {
- writeStartElement(QL1S("Url"));
- writeAttribute(QL1S("method"), QL1S("get"));
- writeAttribute(QL1S("type"), engine->type());
- writeAttribute(QL1S("template"), engine->suggestionsUrlTemplate());
-
- if (!engine->suggestionsParameters().empty())
- {
- writeNamespace(QL1S("http://a9.com/-/spec/opensearch/extensions/parameters/1.0/"), QL1S("p"));
-
- QList<OpenSearchEngine::Parameter>::const_iterator end = engine->suggestionsParameters().constEnd();
- QList<OpenSearchEngine::Parameter>::const_iterator i = engine->suggestionsParameters().constBegin();
- for (; i != end; ++i)
- {
- writeStartElement(QL1S("p:Parameter"));
- writeAttribute(QL1S("name"), i->first);
- writeAttribute(QL1S("value"), i->second);
- writeEndElement();
- }
- }
-
- writeEndElement();
- }
-
- if (!engine->imageUrl().isEmpty())
- writeTextElement(QL1S("Image"), engine->imageUrl());
-
- writeEndElement();
- writeEndDocument();
-}
diff --git a/src/opensearch/opensearchwriter.h b/src/opensearch/opensearchwriter.h
deleted file mode 100644
index 525044b9..00000000
--- a/src/opensearch/opensearchwriter.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Jakub Wieczorek <faw217@gmail.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef OPENSEARCHWRITER_H
-#define OPENSEARCHWRITER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QtCore/QXmlStreamWriter>
-
-// Forward Declarations
-class QIODevice;
-class OpenSearchEngine;
-
-
-class OpenSearchWriter : public QXmlStreamWriter
-{
-public:
- OpenSearchWriter();
-
- bool write(QIODevice *device, OpenSearchEngine *engine);
-
-private:
- void write(OpenSearchEngine *engine);
-};
-
-#endif
-
diff --git a/src/opensearch/searchengine.cpp b/src/opensearch/searchengine.cpp
deleted file mode 100644
index 2614b603..00000000
--- a/src/opensearch/searchengine.cpp
+++ /dev/null
@@ -1,157 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-//local includes
-#include "searchengine.h"
-#include "application.h"
-#include "iconmanager.h"
-
-// Auto Includes
-#include "rekonq.h"
-
-//KDE includes
-#include <KConfigGroup>
-#include <KServiceTypeTrader>
-
-
-struct SearchEnginePrivate
-{
- SearchEnginePrivate() : isLoaded(false) {}
- bool isLoaded;
- QString delimiter;
- KService::List favorites;
- KService::Ptr defaultEngine;
-};
-
-
-K_GLOBAL_STATIC(SearchEnginePrivate, d)
-
-
-void SearchEngine::reload()
-{
- KConfig config("kuriikwsfilterrc");
- KConfigGroup cg = config.group("General");
-
- // load delimiter
- d->delimiter = cg.readEntry("KeywordDelimiter", ":");
-
- // load favorite engines
- QStringList favoriteEngines;
-#if KDE_IS_VERSION(4,9,0)
- favoriteEngines = cg.readEntry("PreferredWebShortcuts", favoriteEngines);
-#else
- favoriteEngines = cg.readEntry("FavoriteSearchEngines", favoriteEngines);
-#endif
-
- KService::List favorites;
- KService::Ptr service;
- Q_FOREACH(const QString & engine, favoriteEngines)
- {
- service = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(engine));
- if (service)
- {
- QUrl url = service->property("Query").toUrl();
- rApp->iconManager()->downloadIconFromUrl(url);
-
- favorites << service;
- }
- }
- d->favorites = favorites;
-
- // load default engine
- QString dse;
-#if KDE_IS_VERSION(4,9,0)
- dse = cg.readEntry("DefaultWebShortcut");
-#else
- dse = cg.readEntry("DefaultSearchEngine");
-#endif
- d->defaultEngine = KService::serviceByDesktopPath(QString("searchproviders/%1.desktop").arg(dse));
-
- d->isLoaded = true;
-}
-
-
-QString SearchEngine::delimiter()
-{
- if (!d->isLoaded)
- reload();
-
- return d->delimiter;
-}
-
-
-KService::List SearchEngine::favorites()
-{
- if (!d->isLoaded)
- reload();
-
- return d->favorites;
-}
-
-
-KService::Ptr SearchEngine::defaultEngine()
-{
- if (!d->isLoaded)
- reload();
-
- return d->defaultEngine;
-}
-
-
-KService::Ptr SearchEngine::fromString(const QString &text)
-{
- KService::List providers = KServiceTypeTrader::self()->query("SearchProvider");
- int i = 0;
- bool found = false;
- KService::Ptr service;
- while (!found && i < providers.size())
- {
- QStringList list = providers.at(i)->property("Keys").toStringList();
- Q_FOREACH(const QString & key, list)
- {
- const QString searchPrefix = key + delimiter();
- if (text.startsWith(searchPrefix))
- {
- service = providers.at(i);
- found = true;
- }
- }
- i++;
- }
-
- return service;
-}
-
-
-QString SearchEngine::buildQuery(KService::Ptr engine, const QString &text)
-{
- if (!engine)
- return QString();
- QString query = engine->property("Query").toString();
- query = query.replace("\\{@}", KUrl::toPercentEncoding(text));
- return query;
-}
diff --git a/src/opensearch/searchengine.h b/src/opensearch/searchengine.h
deleted file mode 100644
index 21678e9d..00000000
--- a/src/opensearch/searchengine.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SEARCHENGINE_H
-#define SEARCHENGINE_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KService>
-
-//Qt Includes
-#include <QString>
-
-
-namespace SearchEngine
-{
-void reload();
-
-QString delimiter();
-
-KService::Ptr defaultEngine();
-
-KService::List favorites();
-
-KService::Ptr fromString(const QString &text);
-
-QString buildQuery(KService::Ptr engine, const QString &text);
-
-QString extractQuery(const QString &text);
-}
-
-#endif
diff --git a/src/opensearch/suggestionparser.cpp b/src/opensearch/suggestionparser.cpp
deleted file mode 100644
index 3c5350bf..00000000
--- a/src/opensearch/suggestionparser.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/* ============================================================
- *
- * This file is a part of the rekonq project
- *
- * Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
- * Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * ============================================================ */
-
-
-// Self Includes
-#include "suggestionparser.h"
-
-// Qt Includes
-#include<QByteArray>
-#include<QStringList>
-
-
-ResponseList SuggestionParser::parse(const QByteArray &)
-{
- return ResponseList();
-}
-
-
-SuggestionParser::~SuggestionParser()
-{
-}
-
-
-ResponseList XMLParser::parse(const QByteArray &resp)
-{
- ResponseList rlist;
-
- m_reader.clear();
- m_reader.addData(resp);
-
- while (!m_reader.atEnd() && !m_reader.hasError())
- {
- m_reader.readNext();
-
- if (m_reader.isStartDocument())
- continue;
-
- if (m_reader.isStartElement() && m_reader.name() == QL1S("Item"))
- {
- QString title;
- QString description;
- QString url;
- QString image;
- int image_width = 0;
- int image_height = 0;
-
- m_reader.readNext();
-
- while (!(m_reader.isEndElement() && m_reader.name() == QL1S("Item")))
- {
- if (m_reader.isStartElement())
- {
-
- if (m_reader.name() == QL1S("Text"))
- title = m_reader.readElementText();
- if (m_reader.name() == QL1S("Url"))
- url = m_reader.readElementText();
-
- if (m_reader.name() == QL1S("Image"))
- {
- image = m_reader.attributes().value("source").toString();
- image_width = m_reader.attributes().value("width").toString().toInt();
- image_height = m_reader.attributes().value("height").toString().toInt();
- }
-
- if (m_reader.name() == QL1S("Description"))
- description = m_reader.readElementText();
- }
-
- m_reader.readNext();
- }
- rlist << Response(title, description, url, image, image_width, image_height);
- }
- }
-
- return rlist;
-}
-
-
-ResponseList JSONParser::parse(const QByteArray &resp)
-{
- QString response = QString::fromLocal8Bit(resp);
- response = response.trimmed();
-
- if (response.isEmpty())
- {
- // RESPONSE IS EMPTY
- return ResponseList();
- }
-
- if (!response.startsWith(QL1C('['))
- || !response.endsWith(QL1C(']'))
- )
- {
- // RESPONSE is NOT well FORMED
- return ResponseList();
- }
-
- // Evaluate the JSON response using QtScript.
- if (!m_reader.canEvaluate(response))
- {
- // m_reader cannot evaluate the response
- return ResponseList();
- }
-
- QScriptValue responseParts = m_reader.evaluate(response);
-
- if (!responseParts.property(1).isArray())
- {
- // RESPONSE is not an array
- return ResponseList();
- }
-
- ResponseList rlist;
- QStringList responsePartsList;
- qScriptValueToSequence(responseParts.property(1), responsePartsList);
-
- Q_FOREACH(const QString & s, responsePartsList)
- {
- rlist << Response(s);
- }
-
- return rlist;
-}
diff --git a/src/opensearch/suggestionparser.h b/src/opensearch/suggestionparser.h
deleted file mode 100644
index 01ec7c98..00000000
--- a/src/opensearch/suggestionparser.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* ============================================================
- *
- * This file is a part of the rekonq project
- *
- * Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
- * Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License or (at your option) version 3 or any later version
- * accepted by the membership of KDE e.V. (or its successor approved
- * by the membership of KDE e.V.), which shall act as a proxy
- * defined in Section 14 of version 3 of the license.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * ============================================================ */
-
-
-#ifndef SUGGESTIONPARSER_H
-#define SUGGESTIONPARSER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QtCore/QList>
-#include <QtCore/QXmlStreamReader>
-
-#include <QtScript/QScriptEngine>
-
-
-class Response
-{
-public:
- QString title;
- QString description;
- QString url;
- QString image;
- int image_width;
- int image_height;
-
- Response(const Response &item) : title(item.title),
- description(item.description),
- url(item.url),
- image(item.image),
- image_width(item.image_width),
- image_height(item.image_height)
-
- {};
-
- explicit Response(const QString &_title = QString(),
- const QString &_description = QString(),
- const QString &_url = QString(),
- const QString &_image = QString(),
- const int &_image_width = 0,
- const int &_image_height = 0) : title(_title),
- description(_description),
- url(_url),
- image(_image),
- image_width(_image_width),
- image_height(_image_height)
- {};
-};
-
-
-// -----------------------------------------------------------------
-
-
-typedef QList <Response> ResponseList;
-
-
-class SuggestionParser
-{
-public:
- virtual ~SuggestionParser();
- virtual ResponseList parse(const QByteArray &resp);
- virtual QString type() = 0;
-};
-
-
-class XMLParser : public SuggestionParser
-{
-protected:
- QXmlStreamReader m_reader;
-
-public:
- ResponseList parse(const QByteArray &resp);
- inline QString type()
- {
- return QL1S("application/x-suggestions+xml");
- }
-};
-
-
-class JSONParser : public SuggestionParser
-{
-private:
- QScriptEngine m_reader;
-
-public:
- ResponseList parse(const QByteArray &resp);
- inline QString type()
- {
- return QL1S("application/x-suggestions+json");
- }
-};
-
-#endif //SUGGESTIONPARSER_H
diff --git a/src/paneltreeview.cpp b/src/paneltreeview.cpp
deleted file mode 100644
index 21fc01c8..00000000
--- a/src/paneltreeview.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010 by Yoann Laissus <yoann dot laissus at gmail dot com>
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "paneltreeview.h"
-#include "paneltreeview.moc"
-
-// Local Includes
-#include "application.h"
-
-// KDE Includes
-#include <KUrl>
-
-// Qt Includes
-#include <QClipboard>
-#include <QMouseEvent>
-
-
-PanelTreeView::PanelTreeView(QWidget *parent)
- : QTreeView(parent)
-{
- connect(this, SIGNAL(itemHovered(QString)), parent, SIGNAL(itemHovered(QString)));
- connect(this, SIGNAL(openUrl(KUrl, Rekonq::OpenType)), parent, SIGNAL(openUrl(KUrl, Rekonq::OpenType)));
- setMouseTracking(true);
- setExpandsOnDoubleClick(false);
-}
-
-
-void PanelTreeView::mousePressEvent(QMouseEvent *event)
-{
- const QModelIndex index = indexAt(event->pos());
- bool expanded = isExpanded(index);
-
- QTreeView::mousePressEvent(event);
-
- // A change of an item expansion is handle by mouseReleaseEvent()
- // So toggle again the item
- if (expanded != isExpanded(index))
- setExpanded(index, !isExpanded(index));
-
- if (!index.isValid())
- {
- clearSelection();
- setCurrentIndex(QModelIndex());
-
- if (event->button() == Qt::RightButton)
- emit contextMenuEmptyRequested(event->pos());
- return;
- }
-
- if (event->button() == Qt::RightButton)
- {
- if (model()->rowCount(index) == 0)
- {
- // An empty group needs to be handle by the panels
- emit contextMenuItemRequested(event->pos());
- }
- else
- {
- emit contextMenuGroupRequested(event->pos());
- }
- }
-}
-
-
-void PanelTreeView::mouseReleaseEvent(QMouseEvent *event)
-{
- QTreeView::mouseReleaseEvent(event);
-
- const QModelIndex index = indexAt(event->pos());
- if (!index.isValid())
- return;
-
- if (event->button() == Qt::MidButton || event->modifiers() == Qt::ControlModifier)
- emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewTab);
-
- else if (event->button() == Qt::LeftButton)
- {
- if (model()->rowCount(index) == 0)
- emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
- else
- setExpanded(index, !isExpanded(index));
- }
-}
-
-
-void PanelTreeView::keyPressEvent(QKeyEvent *event)
-{
- QTreeView::keyPressEvent(event);
- QModelIndex index = currentIndex();
-
- if (!index.isValid())
- return;
-
- if (event->key() == Qt::Key_Return)
- {
- if (model()->rowCount(index) == 0)
- openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
- else
- setExpanded(index, !isExpanded(index));
- }
-
- else if (event->key() == Qt::Key_Delete)
- {
- emit delKeyPressed();
- }
-}
-
-
-void PanelTreeView::mouseMoveEvent(QMouseEvent *event)
-{
- QTreeView::mouseMoveEvent(event);
- const QModelIndex index = indexAt(event->pos());
- if (!index.isValid())
- {
- emit itemHovered("");
- return;
- }
- emit itemHovered(qVariantValue< KUrl >(index.data(Qt::UserRole)).url());
-}
-
-
-void PanelTreeView::openInCurrentTab()
-{
- QModelIndex index = currentIndex();
- if (!index.isValid())
- return;
-
- emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)));
-}
-
-
-void PanelTreeView::copyToClipboard()
-{
- QModelIndex index = currentIndex();
- if (!index.isValid())
- return;
-
- QClipboard *cb = QApplication::clipboard();
- cb->setText(qVariantValue< KUrl >(index.data(Qt::UserRole)).url());
-}
-
-
-void PanelTreeView::openInNewTab()
-{
- QModelIndex index = currentIndex();
- if (!index.isValid())
- return;
-
- emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewTab);
-}
-
-
-void PanelTreeView::openInNewWindow()
-{
- QModelIndex index = currentIndex();
- if (!index.isValid())
- return;
-
- emit openUrl(qVariantValue< KUrl >(index.data(Qt::UserRole)), Rekonq::NewWindow);
-}
diff --git a/src/paneltreeview.h b/src/paneltreeview.h
deleted file mode 100644
index 1b640310..00000000
--- a/src/paneltreeview.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Yoann Laissus <yoann dot laissus at gmail dot com>
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef PANELTREEVIEW_H
-#define PANELTREEVIEW_H
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QTreeView>
-
-// Forward Declarations
-class KUrl;
-
-
-class REKONQ_TESTS_EXPORT PanelTreeView : public QTreeView
-{
- Q_OBJECT
-
-public:
- PanelTreeView(QWidget *parent = 0);
-
-Q_SIGNALS:
- void openUrl(const KUrl &, const Rekonq::OpenType & = Rekonq::CurrentTab);
- void itemHovered(const QString &);
- void delKeyPressed();
- void contextMenuItemRequested(const QPoint &pos);
- void contextMenuGroupRequested(const QPoint &pos);
- void contextMenuEmptyRequested(const QPoint &pos);
-
-public Q_SLOTS:
- void copyToClipboard();
- void openInCurrentTab();
- void openInNewTab();
- void openInNewWindow();
-
-protected:
- void mouseReleaseEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void keyPressEvent(QKeyEvent *event);
-};
-
-#endif // PANELTREEVIEW_H
diff --git a/src/previewselectorbar.cpp b/src/previewselectorbar.cpp
deleted file mode 100644
index b743e3c9..00000000
--- a/src/previewselectorbar.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "previewselectorbar.h"
-#include "previewselectorbar.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Include
-#include "application.h"
-#include "mainwindow.h"
-#include "webpage.h"
-#include "webtab.h"
-#include "websnap.h"
-
-// KDE Includes
-#include <KIcon>
-#include <KLocalizedString>
-
-// Qt Includes
-#include <QAction>
-
-
-PreviewSelectorBar::PreviewSelectorBar(int index, QWidget* parent)
- : KMessageWidget(parent)
- , m_previewIndex(index)
- , m_insertAction(0)
-{
- setMessageType(KMessageWidget::Information);
-
- QSize sz = size();
- sz.setWidth(qobject_cast<QWidget *>(parent)->size().width());
- resize(sz);
-
- setCloseButtonVisible(false);
-
- setText(i18n("Please open up the webpage you want to add as favorite"));
-
- m_insertAction = new QAction(KIcon("insert-image"), i18n("Set to This Page"), this);
- connect(m_insertAction, SIGNAL(triggered(bool)), this, SLOT(clicked()));
- addAction(m_insertAction);
-}
-
-
-void PreviewSelectorBar::verifyUrl()
-{
-
- if (rApp->mainWindow()->currentTab()->page()->mainFrame()->url().scheme() != "about")
- {
- m_insertAction->setEnabled(true);
- m_insertAction->setToolTip("");
- }
- else
- {
- m_insertAction->setEnabled(false);
- m_insertAction->setToolTip(i18n("You cannot add this webpage as favorite"));
- }
-}
-
-
-void PreviewSelectorBar::loadProgress()
-{
- m_insertAction->setEnabled(false);
- m_insertAction->setToolTip(i18n("Page is loading..."));
-}
-
-
-void PreviewSelectorBar::loadFinished()
-{
- m_insertAction->setEnabled(true);
- m_insertAction->setToolTip("");
-
- verifyUrl();
-}
-
-
-void PreviewSelectorBar::clicked()
-{
- WebPage *page = rApp->mainWindow()->currentTab()->page();
-
- if (page)
- {
- KUrl url = page->mainFrame()->url();
- QStringList names = ReKonfig::previewNames();
- QStringList urls = ReKonfig::previewUrls();
-
- //cleanup the previous image from the cache (useful to refresh the snapshot)
- QFile::remove(WebSnap::imagePathFromUrl(urls.at(m_previewIndex)));
- QPixmap preview = WebSnap::renderPagePreview(*page);
- preview.save(WebSnap::imagePathFromUrl(url));
-
- urls.replace(m_previewIndex, url.toMimeDataString());
- names.replace(m_previewIndex, page->mainFrame()->title());
-
- ReKonfig::setPreviewNames(names);
- ReKonfig::setPreviewUrls(urls);
-
- ReKonfig::self()->writeConfig();
-
-
- page->mainFrame()->load(KUrl("about:favorites"));
- }
-
- animatedHide();
- deleteLater();
-}
diff --git a/src/previewselectorbar.h b/src/previewselectorbar.h
deleted file mode 100644
index fa54303d..00000000
--- a/src/previewselectorbar.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef PREVIEWSELECTORBAR_H
-#define PREVIEWSELECTORBAR_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KMessageWidget>
-
-// Forward Declarations
-class QAction;
-
-
-class REKONQ_TESTS_EXPORT PreviewSelectorBar : public KMessageWidget
-{
- Q_OBJECT
-
-public:
- PreviewSelectorBar(int index, QWidget *parent);
-
- inline void setIndex(int index)
- {
- m_previewIndex = index;
- }
-
-private Q_SLOTS:
- void clicked();
-
- void loadProgress();
- void loadFinished();
-
- void verifyUrl();
-
-private:
- int m_previewIndex;
- QAction *m_insertAction;
-};
-
-#endif // PREVIEWSELECTORBAR_H
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
deleted file mode 100644
index 186b93d3..00000000
--- a/src/protocolhandler.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "protocolhandler.h"
-#include "protocolhandler.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "historymanager.h"
-#include "mainview.h"
-#include "mainwindow.h"
-#include "newtabpage.h"
-#include "urlbar.h"
-#include "webpage.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KIO/Job>
-#include <KDirLister>
-#include <KLocale>
-#include <KLocalizedString>
-#include <KMessageBox>
-#include <KProcess>
-#include <KStandardDirs>
-#include <KToolInvocation>
-#include <KProtocolInfo>
-#include <KRun>
-
-// Qt Includes
-#include <QNetworkRequest>
-#include <QWebFrame>
-#include <QTextDocument>
-
-
-static bool fileItemListLessThan(const KFileItem &s1, const KFileItem &s2)
-{
- return s1.name().toLower() < s2.name().toLower();
-}
-
-
-static KFileItemList sortFileList(const KFileItemList &list)
-{
- KFileItemList orderedList, dirList, fileList;
-
- // order dirs before files..
- Q_FOREACH(const KFileItem & item, list)
- {
- if (item.isDir())
- dirList << item;
- else
- fileList << item;
- }
- qStableSort(dirList.begin(), dirList.end(), fileItemListLessThan);
- qStableSort(fileList.begin(), fileList.end(), fileItemListLessThan);
-
- orderedList << dirList;
- orderedList << fileList;
-
- return orderedList;
-}
-
-
-// -------------------------------------------------------------------------------------------
-
-
-ProtocolHandler::ProtocolHandler(QObject *parent)
- : QObject(parent)
- , _lister(new KDirLister(this))
- , _frame(0)
-{
- _lister->setMainWindow(rApp->mainWindow());
-}
-
-
-bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *frame)
-{
- _url = request.url();
- _frame = frame;
-
- // javascript handling
- if (_url.protocol() == QL1S("javascript"))
- {
- QString scriptSource = _url.authority();
- if (scriptSource.isEmpty())
- {
- // if javascript:<code here> then authority() returns
- // an empty string. Extract the source manually
- // Use the prettyUrl() since that is unencoded
-
- // 11 is length of 'javascript:'
- // fromPercentEncoding() is used to decode all the % encoded
- // characters to normal, so that it is treated as valid javascript
- scriptSource = QUrl::fromPercentEncoding(_url.url().mid(11).toAscii());
- if (scriptSource.isEmpty())
- return false;
- }
-
- QVariant result = frame->evaluateJavaScript(scriptSource);
- return true;
- }
-
- // "about" handling
- if (_url.protocol() == QL1S("about"))
- {
- QByteArray encodedUrl = _url.toEncoded();
- // let webkit manage the about:blank url...
- if (encodedUrl.startsWith(QByteArray("about:blank")))
- {
- return false;
- }
-
- if (encodedUrl == QByteArray("about:home"))
- {
- switch (ReKonfig::newTabStartPage())
- {
- case 0: // favorites
- _url = KUrl("about:favorites");
- break;
- case 1: // closed tabs
- _url = KUrl("about:closedTabs");
- break;
- case 2: // bookmarks
- _url = KUrl("about:bookmarks");
- break;
- case 3: // history
- _url = KUrl("about:history");
- break;
- case 4: // downloads
- _url = KUrl("about:downloads");
- break;
- case 5: // tabs
- _url = KUrl("about:tabs");
- default: // unuseful
- break;
- }
- }
-
- WebPage *page = qobject_cast<WebPage *>(frame->page());
- page->setIsOnRekonqPage(true);
-
- NewTabPage p(frame);
- p.generate(_url);
-
- return true;
- }
-
- // "mailto" handling: It needs to be handled both in preHandling (mail url launched)
- // and in postHandling (mail links clicked)
- if (_url.protocol() == QL1S("mailto"))
- {
- KToolInvocation::invokeMailer(_url);
- return true;
- }
-
- // "apt" handling
- // NOTE: this is a stupid workaround to ensure apt protocol works
- if (_url.protocol() == QL1S("apt"))
- {
- kDebug() << "APT URL: " << _url;
- (void)new KRun(_url, rApp->mainWindow(), 0, _url.isLocalFile());
- return true;
- }
-
- // let webkit try to load a known (or missing) protocol...
- if (KProtocolInfo::isKnownProtocol(_url))
- return false;
-
- // Error Message, for those protocols we cannot handle
- KMessageBox::error(rApp->mainWindow(), i18nc("@info", "rekonq does not know how to handle this protocol: %1", _url.protocol()));
-
- return true;
-}
-
-
-bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *frame)
-{
- _url = request.url();
- _frame = frame;
-
- // "http(s)" (fast) handling
- if (_url.protocol() == QL1S("http") || _url.protocol() == QL1S("https"))
- return false;
-
- // "mailto" handling: It needs to be handled both here(mail links clicked)
- // and in prehandling (mail url launched)
- if (_url.protocol() == QL1S("mailto"))
- {
- KToolInvocation::invokeMailer(_url);
- return true;
- }
-
- // "ftp" handling. A little bit "hard" handling this. Hope I found
- // the best solution.
- // My idea is: webkit cannot handle in any way ftp. So we have surely to return true here.
- // We start trying to guess what the url represent: it's a dir? show its contents (and download them).
- // it's a file? download it. It's another thing? beat me, but I don't know what to do...
- if (_url.protocol() == QL1S("ftp"))
- {
- KIO::StatJob *job = KIO::stat(_url);
- connect(job, SIGNAL(result(KJob*)), this, SLOT(slotMostLocalUrlResult(KJob*)));
- return true;
- }
-
- // "file" handling. This is quite trivial :)
- if (_url.protocol() == QL1S("file"))
- {
- QFileInfo fileInfo(_url.path());
- if (fileInfo.isDir())
- {
- connect(_lister, SIGNAL(newItems(KFileItemList)), this, SLOT(showResults(KFileItemList)));
- _lister->openUrl(_url);
-
- return true;
- }
-
- return false;
- }
-
- // we cannot handle this protocol in any way.
- // Try KRunning it...
- if (KProtocolInfo::isKnownProtocol(_url))
- {
- (void)new KRun(_url, rApp->mainWindow(), 0, _url.isLocalFile());
- return true;
- }
-
- return false;
-}
-
-
-// ---------------------------------------------------------------------------------------------------------------------------
-
-
-void ProtocolHandler::showResults(const KFileItemList &list)
-{
- if (!_lister->rootItem().isNull() && _lister->rootItem().isReadable() && _lister->rootItem().isFile())
- {
- emit downloadUrl(_lister->rootItem().url());
- }
- else
- {
- QString html = dirHandling(list);
- _frame->setHtml(html);
- qobject_cast<WebPage *>(_frame->page())->setIsOnRekonqPage(true);
-
- rApp->mainWindow()->mainView()->currentUrlBar()->setQUrl(_url);
- rApp->mainWindow()->currentTab()->setFocus();
- rApp->historyManager()->addHistoryEntry(_url, _url.prettyUrl());
- }
-}
-
-
-QString ProtocolHandler::dirHandling(const KFileItemList &list)
-{
- if (!_lister)
- {
- return QString("rekonq error, sorry :(");
- }
-
- // let me modify it..
- KUrl rootUrl = _url;
-
- // display "rekonq info" page
- QString infoFilePath = KStandardDirs::locate("data", "rekonq/htmls/rekonqinfo.html");
- QFile file(infoFilePath);
-
- bool isOpened = file.open(QIODevice::ReadOnly);
- if (!isOpened)
- {
- return QString("rekonq error, sorry :(");
- }
-
- // 1. default data path
- QString dataPath = QL1S("file://") + infoFilePath;
- dataPath.remove(QL1S("/htmls/rekonqinfo.html"));
-
- // 2. title
- QString title = _url.prettyUrl();
-
- // 3. main content
- QString msg = i18nc("%1=an URL", "<h2>Index of %1</h2>", _url.prettyUrl());
-
-
- if (rootUrl.cd(".."))
- {
- QString path = rootUrl.prettyUrl();
- QString uparrow = KIconLoader::global()->iconPath("arrow-up", KIconLoader::Small);
- msg += "<img src=\"file://" + uparrow + "\" alt=\"up-arrow\" />";
- msg += "<a href=\"" + path + "\">" + i18n("Up to higher level directory") + "</a><br /><br />";
- }
-
- msg += QL1S("<table width=\"95%\" align=\"center\">");
- msg += QL1S("<tr>");
- msg += QL1S("<th align=\"left\">") + i18n("Name") + QL1S("</th>");
- msg += QL1S("<th align=\"center\">") + i18n("Size") + QL1S("</th>");
- msg += QL1S("<th align=\"right\">") + i18n("Last Modified") + QL1S("</th>");
- msg += QL1S("</tr>");
-
- KFileItemList orderedList = sortFileList(list);
- Q_FOREACH(const KFileItem & item, orderedList)
- {
- msg += QL1S("<tr>");
- QString fullPath = Qt::escape(item.url().prettyUrl());
-
- QString iconName = item.iconName();
- QString icon = QString("file://") + KIconLoader::global()->iconPath(iconName, KIconLoader::Small);
-
- msg += QL1S("<td width=\"70%\">");
- msg += QL1S("<img src=\"") + icon + QL1S("\" alt=\"") + iconName + QL1S("\" /> ");
- msg += QL1S("<a href=\"") + fullPath + QL1S("\">") + Qt::escape(item.name()) + QL1S("</a>");
- msg += QL1S("</td>");
-
- msg += QL1S("<td align=\"right\">");
- if (item.isFile())
- {
- msg += KGlobal::locale()->formatByteSize(item.size(), 1);
- }
- msg += QL1S("</td>");
-
- msg += QL1S("<td align=\"right\">");
- msg += item.timeString();
- msg += QL1S("</td>");
-
- msg += QL1S("</tr>");
- }
- msg += QL1S("</table>");
-
- // done. Replace variables and show it
- QString html = QL1S(file.readAll());
-
- html.replace(QL1S("$DEFAULT_PATH"), dataPath);
- html.replace(QL1S("$PAGE_TITLE"), title);
- html.replace(QL1S("$MAIN_CONTENT"), msg);
-
- return html;
-}
-
-
-void ProtocolHandler::slotMostLocalUrlResult(KJob *job)
-{
- if (job->error())
- {
- kDebug() << "JOB ERROR: " << job->errorString();
- // TODO
- }
- else
- {
- KIO::StatJob *statJob = static_cast<KIO::StatJob*>(job);
- KIO::UDSEntry entry = statJob->statResult();
- if (entry.isDir())
- {
- connect(_lister, SIGNAL(newItems(KFileItemList)), this, SLOT(showResults(KFileItemList)));
- _lister->openUrl(_url);
- }
- else
- {
- emit downloadUrl(_url);
- }
- }
-}
diff --git a/src/protocolhandler.h b/src/protocolhandler.h
deleted file mode 100644
index f35fdcc6..00000000
--- a/src/protocolhandler.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-
-#ifndef PROTOCOL_HANDLER_H
-#define PROTOCOL_HANDLER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KUrl>
-
-// Qt Includes
-#include <QObject>
-
-// Forward Declarations
-class KDirLister;
-class KFileItemList;
-class KJob;
-
-class QNetworkRequest;
-class QWebFrame;
-
-
-class REKONQ_TESTS_EXPORT ProtocolHandler : public QObject
-{
- Q_OBJECT
-
-public:
- ProtocolHandler(QObject *parent = 0);
-
- /**
- * This function handles all the protocols that have to be handled before
- * WebKit does
- */
- bool preHandling(const QNetworkRequest &request, QWebFrame *frame);
-
- /**
- * This function handles all the protocols that have to be handled after
- * WebKit tried to
- */
- bool postHandling(const QNetworkRequest &request, QWebFrame *frame);
-
-Q_SIGNALS:
- void downloadUrl(const KUrl &);
-
-private Q_SLOTS:
- void showResults(const KFileItemList &);
- void slotMostLocalUrlResult(KJob *);
-
-private:
- QString dirHandling(const KFileItemList &list);
-
- KDirLister *_lister;
- QWebFrame *_frame;
- KUrl _url;
-};
-
-#endif // PROTOCOL_HANDLER_H
diff --git a/src/qwebkitplatformplugin.h b/src/qwebkitplatformplugin.h
deleted file mode 100644
index a1f25fdb..00000000
--- a/src/qwebkitplatformplugin.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2012 by Lindsay Mathieson <lindsay dot mathieson at gmail dot com>
- *
- * 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.
- *
- */
-
-#ifndef QWEBKITPLATFORMPLUGIN_H
-#define QWEBKITPLATFORMPLUGIN_H
-
-/*
- * Warning: The contents of this file is not part of the public QtWebKit API
- * and may be changed from version to version or even be completely removed.
-*/
-
-#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
-#include <QMediaPlayer>
-#endif
-#include <QtCore/QObject>
-#include <QtCore/QRect>
-#include <QtCore/QUrl>
-#include <QtGui/QColor>
-#include <QtGui/QFont>
-
-class QWebSelectData
-{
-public:
- virtual ~QWebSelectData() {}
-
- enum ItemType { Option, Group, Separator };
-
- virtual ItemType itemType(int) const = 0;
- virtual QString itemText(int index) const = 0;
- virtual QString itemToolTip(int index) const = 0;
- virtual bool itemIsEnabled(int index) const = 0;
- virtual bool itemIsSelected(int index) const = 0;
- virtual int itemCount() const = 0;
- virtual bool multiple() const = 0;
- virtual QColor backgroundColor() const = 0;
- virtual QColor foregroundColor() const = 0;
- virtual QColor itemBackgroundColor(int index) const = 0;
- virtual QColor itemForegroundColor(int index) const = 0;
-};
-
-class QWebSelectMethod : public QObject
-{
- Q_OBJECT
-public:
- virtual ~QWebSelectMethod() {}
-
- virtual void show(const QWebSelectData&) = 0;
- virtual void hide() = 0;
- virtual void setGeometry(const QRect&) = 0;
- virtual void setFont(const QFont&) = 0;
-
-Q_SIGNALS:
- void selectItem(int index, bool allowMultiplySelections, bool shift);
- void didHide();
-};
-
-class QWebNotificationData
-{
-public:
- virtual ~QWebNotificationData() {}
-
- virtual const QString title() const = 0;
- virtual const QString message() const = 0;
- virtual const QUrl iconUrl() const = 0;
- virtual const QUrl openerPageUrl() const = 0;
-};
-
-class QWebNotificationPresenter : public QObject
-{
- Q_OBJECT
-public:
- QWebNotificationPresenter() {}
- virtual ~QWebNotificationPresenter() {}
-
- virtual void showNotification(const QWebNotificationData*) = 0;
-
-Q_SIGNALS:
- void notificationClosed();
- void notificationClicked();
-};
-
-class QWebHapticFeedbackPlayer: public QObject
-{
- Q_OBJECT
-public:
- QWebHapticFeedbackPlayer() {}
- virtual ~QWebHapticFeedbackPlayer() {}
-
- enum HapticStrength
- {
- None, Weak, Medium, Strong
- };
-
- enum HapticEvent
- {
- Press, Release
- };
-
- virtual void playHapticFeedback(const HapticEvent, const QString& hapticType, const HapticStrength) = 0;
-};
-
-class QWebTouchModifier : public QObject
-{
- Q_OBJECT
-public:
- virtual ~QWebTouchModifier() {}
-
- enum PaddingDirection
- {
- Up, Right, Down, Left
- };
-
- virtual unsigned hitTestPaddingForTouch(const PaddingDirection) const = 0;
-};
-
-#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
-class QWebFullScreenVideoHandler : public QObject
-{
- Q_OBJECT
-public:
- QWebFullScreenVideoHandler() {}
- virtual ~QWebFullScreenVideoHandler() {}
- virtual bool requiresFullScreenForVideoPlayback() const = 0;
-
-Q_SIGNALS:
- void fullScreenClosed();
-
-public Q_SLOTS:
- virtual void enterFullScreen(QMediaPlayer*) = 0;
- virtual void exitFullScreen() = 0;
-};
-#endif
-
-class QWebSpellChecker : public QObject
-{
- Q_OBJECT
-public:
- struct GrammarDetail
- {
- int location;
- int length;
- QStringList guesses;
- QString userDescription;
- };
-
- virtual bool isContinousSpellCheckingEnabled() const = 0;
- virtual void toggleContinousSpellChecking() = 0;
-
- virtual void learnWord(const QString& word) = 0;
- virtual void ignoreWordInSpellDocument(const QString& word) = 0;
- virtual void checkSpellingOfString(const QString& word, int* misspellingLocation, int* misspellingLength) = 0;
- virtual QString autoCorrectSuggestionForMisspelledWord(const QString& word) = 0;
- virtual void guessesForWord(const QString& word, const QString& context, QStringList& guesses) = 0;
-
- virtual bool isGrammarCheckingEnabled() = 0;
- virtual void toggleGrammarChecking() = 0;
- virtual void checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
-};
-
-class QWebKitPlatformPlugin
-{
-public:
- virtual ~QWebKitPlatformPlugin() {}
-
- enum Extension
- {
- MultipleSelections,
- Notifications,
- Haptics,
- TouchInteraction,
- FullScreenVideoPlayer,
- SpellChecker
- };
-
- virtual bool supportsExtension(Extension) const = 0;
- virtual QObject* createExtension(Extension) const = 0;
-};
-
-QT_BEGIN_NAMESPACE
-Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.9");
-QT_END_NAMESPACE
-
-#endif // QWEBKITPLATFORMPLUGIN_H
diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg
deleted file mode 100644
index 18dea24e..00000000
--- a/src/rekonq.kcfg
+++ /dev/null
@@ -1,294 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
-<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
- http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
-
-<!-- Includes -->
-<include>QtWebKit</include>
-<include>QDateTime</include>
-<include>KUrl</include>
-<include>KGlobalSettings</include>
-
-<kcfgfile name="rekonqrc" />
-
-<!-- Miscellaneuos (not config UI) settings -->
-<group name="misc">
- <entry name="FirstExecution" type="Bool">
- <default>true</default>
- </entry>
- <entry name="showHistoryPanel" type="Bool">
- <default>false</default>
- </entry>
- <entry name="showBookmarksPanel" type="Bool">
- <default>false</default>
- </entry>
- <entry name="walletBlackList" type="StringList">
- <default></default>
- </entry>
- <entry name="recoverOnCrash" type="Int">
- <default>0</default>
- </entry>
- <entry name="createDesktopAppShortcut" type="Bool">
- <default>true</default>
- </entry>
- <entry name="createMenuAppShortcut" type="Bool">
- <default>false</default>
- </entry>
- <entry name="checkDefaultSearchEngine" type="Bool">
- <default>true</default>
- </entry>
- <entry name="clearHistory" type="Bool">
- <default>true</default>
- </entry>
- <entry name="clearDownloads" type="Bool">
- <default>true</default>
- </entry>
- <entry name="clearCookies" type="Bool">
- <default>true</default>
- </entry>
- <entry name="clearCachedPages" type="Bool">
- <default>true</default>
- </entry>
- <entry name="clearWebIcons" type="Bool">
- <default>true</default>
- </entry>
- <entry name="clearHomePageThumbs" type="Bool">
- <default>true</default>
- </entry>
-</group>
-
-
-<!-- New Tab Page Settings -->
-<group name="NewTabPage">
- <entry name="previewNames" type="StringList">
- <default>KDE Homepage,rekonq site</default>
- </entry>
- <entry name="previewUrls" type="StringList">
- <default>http://www.kde.org/,http://rekonq.kde.org/</default>
- </entry>
-</group>
-
-
-<!-- General Settings -->
-<group name="General">
- <entry name="startupBehaviour" type="Int">
- <default>1</default>
- </entry>
- <entry name="useNewTabPage" type="Bool">
- <default>false</default>
- </entry>
- <entry name="homePage" type="String">
- <default>http://www.kde.org/</default>
- </entry>
- <entry name="downloadPath" type="Url">
- <default code="true">KGlobalSettings::downloadPath()</default>
- </entry>
- <entry name="askDownloadPath" type="Bool">
- <default>false</default>
- </entry>
- <entry name="kgetDownload" type="Bool">
- <default>false</default>
- </entry>
- <entry name="kgetList" type="Bool">
- <default>false</default>
- </entry>
-</group>
-
-
-<!-- Tabs Settings -->
-<group name="Tabs">
- <!-- xxx -->
- <entry name="newTabsBehaviour" type="Int">
- <default>0</default>
- </entry>
- <entry name="newTabStartPage" type="Int">
- <default>0</default>
- </entry>
- <!-- xxx -->
- <entry name="hoveringTabOption" type="Int">
- <default>0</default>
- </entry>
- <!-- xxx -->
- <entry name="alwaysShowTabBar" type="Bool">
- <default>true</default>
- </entry>
- <entry name="openLinksInNewWindow" type="Bool">
- <default>false</default>
- </entry>
- <entry name="openExternalLinksInNewWindow" type="Bool">
- <default>false</default>
- </entry>
- <entry name="lastTabClosesWindow" type="Bool">
- <default>false</default>
- </entry>
- <entry name="openNewTabsInBackground" type="Bool">
- <default>true</default>
- </entry>
- <entry name="openNewTabsNearCurrent" type="Bool">
- <default>false</default>
- </entry>
- <entry name="closeTabSelectPrevious" type="Bool">
- <default>false</default>
- </entry>
- <entry name="animatedTabHighlighting" type="Bool">
- <default>true</default>
- </entry>
-</group>
-
-
-<!-- Fonts Settings -->
-<group name="Appearance">
- <entry name="standardFontFamily" type="String">
- <default code="true">KGlobalSettings::generalFont().family()</default>
- </entry>
- <entry name="fixedFontFamily" type="String">
- <default code="true">KGlobalSettings::fixedFont().family()</default>
- </entry>
- <entry name="serifFontFamily" type="String">
- <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::SerifFont)</default>
- </entry>
- <entry name="sansSerifFontFamily" type="String">
- <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::SansSerifFont)</default>
- </entry>
- <entry name="cursiveFontFamily" type="String">
- <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::CursiveFont)</default>
- </entry>
- <entry name="fantasyFontFamily" type="String">
- <default code="true">QWebSettings::globalSettings()->fontFamily(QWebSettings::FantasyFont)</default>
- </entry>
- <entry name="defaultFontSize" type="Int">
- <default>12</default>
- </entry>
- <entry name="minFontSize" type="Int">
- <default>7</default>
- </entry>
- <entry name="defaultEncoding" type="String">
- <default>ISO 8859-1</default>
- </entry>
- <entry name="userCSS" type="Url">
- <default></default>
- </entry>
-</group>
-
-
-<!-- Privacy Settings -->
-<group name="Privacy">
- <entry name="javascriptCanOpenWindows" type="Bool">
- <default>false</default>
- </entry>
- <entry name="javascriptCanAccessClipboard" type="Bool">
- <default>false</default>
- </entry>
- <entry name="expireHistory" type="Int">
- <default>0</default>
- </entry>
- <entry name="passwordSavingEnabled" type="Bool">
- <default>true</default>
- </entry>
-</group>
-
-
-<!-- WebKit Settings -->
-<group name="Webkit">
- <!-- xxx -->
- <entry name="javascriptEnabled" type="Bool">
- <default>true</default>
- </entry>
- <!-- xxx -->
- <entry name="pluginsEnabled" type="Int">
- <default>0</default>
- </entry>
- <!-- xxx -->
- <entry name="offlineStorageDatabaseEnabled" type="Bool">
- <default>false</default>
- </entry>
- <entry name="offlineWebApplicationCacheEnabled" type="Bool">
- <default>false</default>
- </entry>
- <entry name="localStorageEnabled" type="Bool">
- <default>false</default>
- </entry>
- <!-- xxx -->
- <entry name="javaEnabled" type="Bool">
- <default>true</default>
- </entry>
- <entry name="webGL" type="Bool">
- <default>false</default>
- </entry>
- <entry name="spatialNavigation" type="Bool">
- <default>false</default>
- </entry>
- <entry name="frameFlattening" type="Bool">
- <default>false</default>
- </entry>
- <entry name="dnsPrefetch" type="Bool">
- <default>true</default>
- </entry>
- <entry name="printElementBackgrounds" type="Bool">
- <default>true</default>
- </entry>
-</group>
-
-<!-- Advanced Settings -->
-<group name="Advanced">
- <entry name="hScrollWheelHistory" type="Bool">
- <default>false</default>
- </entry>
- <entry name="enableViShortcuts" type="Bool">
- <default>false</default>
- </entry>
- <entry name="accessKeysEnabled" type="Bool">
- <default>false</default>
- </entry>
- <entry name="smoothScrolling" type="Bool">
- <default>true</default>
- </entry>
- <entry name="useFavicon" type="Bool">
- <default>false</default>
- </entry>
- <entry name="middleClickAction" type="Int">
- <default>2</default>
- </entry>
- <entry name="automaticSpellChecking" type="Bool">
- <default>true</default>
- </entry>
-</group>
-
-
-<!-- Sync Settings -->
-<group name="Sync">
- <entry name="syncEnabled" type="Bool">
- <default>false</default>
- </entry>
- <entry name="syncBookmarks" type="Bool">
- <default>false</default>
- </entry>
- <entry name="syncHistory" type="Bool">
- <default>false</default>
- </entry>
- <entry name="syncPasswords" type="Bool">
- <default>false</default>
- </entry>
- <entry name="syncType" type="Int">
- <default>0</default>
- </entry>
- <entry name="syncHost" type="String">
- <default></default>
- </entry>
- <entry name="syncUser" type="String">
- <default></default>
- </entry>
- <entry name="syncPass" type="String">
- <default></default>
- </entry>
- <entry name="syncPath" type="String">
- <default></default>
- </entry>
- <entry name="syncPort" type="Int">
- <default>21</default>
- </entry>
-</group>
-
-</kcfg>
diff --git a/src/rekonq.kcfgc b/src/rekonq.kcfgc
deleted file mode 100644
index 50a9817d..00000000
--- a/src/rekonq.kcfgc
+++ /dev/null
@@ -1,5 +0,0 @@
-File=rekonq.kcfg
-ClassName=ReKonfig
-Singleton=true
-Mutators=true
-UseEnumTypes=true
diff --git a/src/rekonq_defines.h b/src/rekonq_defines.h
deleted file mode 100644
index e01fa964..00000000
--- a/src/rekonq_defines.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2007 David Faure <faure@kde.org>
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef REKONQ_DEFINES_H
-#define REKONQ_DEFINES_H
-
-
-// ----------------------------------------------------------------------------------------------------
-// UNIT TESTS NEED
-
-/* needed for KDE_EXPORT and KDE_IMPORT macros */
-#include <kdemacros.h>
-
-/* Classes from the rekonq application, which are exported only for unit tests */
-#ifndef REKONQ_TESTS_EXPORT
-/* We are building this library */
-#define REKONQ_TESTS_EXPORT KDE_EXPORT
-#else
-/* We are using this library */
-#define REKONQ_TESTS_EXPORT KDE_IMPORT
-#endif
-
-
-// ----------------------------------------------------------------------------------------------------
-// DEFINES
-
-#define QL1S(x) QLatin1String(x)
-#define QL1C(x) QLatin1Char(x)
-
-#ifndef ASSERT_NOT_REACHED
-# ifndef QT_NO_DEBUG
-# define ASSERT_NOT_REACHED(msg) qt_assert(#msg,__FILE__,__LINE__); kDebug() << #msg
-# else
-# define ASSERT_NOT_REACHED(msg) kDebug() << #msg
-# endif
-#endif //ASSERT_NOT_REACHED
-
-// ----------------------------------------------------------------------------------------------------
-// ENUMS
-
-namespace Rekonq
-{
-
-/**
-* @short notifying message status
-* Different message status
-*/
-enum Notify
-{
- Success, ///< url successfully (down)loaded
- Error, ///< url failed to (down)load
- Download, ///< downloading url
- Info, ///< information
- Url ///< url string shown (default)
-};
-
-/**
-* @short Open link options
-* Different modes of opening new tab
-*/
-enum OpenType
-{
- CurrentTab, ///< open url in current tab
- NewTab, ///< open url according to users settings
- NewFocusedTab, ///< open url in new tab and focus it
- NewBackGroundTab, ///< open url in new background tab
- NewWindow ///< open url in new window
-};
-
-/**
-* @short data to be synced
-* Different data we can sync
-*/
-enum SyncData
-{
- Bookmarks,
- History,
- Passwords
-};
-
-}
-
-
-// ----------------------------------------------------------------------------------------------------
-// INCLUDES
-
-#include <KDebug>
-
-
-
-// ----------------------------------------------------------------------------------------------------
-
-#endif // REKONQ_DEFINES_H
diff --git a/src/rekonqmenu.cpp b/src/rekonqmenu.cpp
deleted file mode 100644
index a5cea784..00000000
--- a/src/rekonqmenu.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com>
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "rekonqmenu.h"
-#include "rekonqmenu.moc"
-
-// Qt Includes
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QWidget>
-
-
-RekonqMenu::RekonqMenu(QWidget *parent)
- : KMenu(parent)
-{
-}
-
-
-void RekonqMenu::setButtonWidget(QWidget *w)
-{
- m_button = w;
-}
-
-
-void RekonqMenu::showEvent(QShowEvent* event)
-{
- KMenu::showEvent(event);
-
- if (!m_button)
- return;
-
- // Adjust the position of the menu to be shown within the
- // rekonq window to reduce the cases that sub-menus might overlap
- // the right screen border.
- QPoint pos;
- if (layoutDirection() == Qt::RightToLeft)
- {
- pos = m_button->mapToGlobal(QPoint(0, m_button->height()));
- }
- else
- {
- pos = m_button->mapToGlobal(QPoint(m_button->width(), m_button->height()));
- pos.rx() -= width();
- }
-
- // Assure that the menu is not shown outside the screen boundaries and
- // that it does not overlap with the parent button.
- const QRect screen = QApplication::desktop()->screenGeometry(QCursor::pos());
- if (pos.x() < screen.x())
- {
- pos.rx() = screen.x();
- }
- else
- {
- if (pos.x() + width() > screen.x() + screen.width())
- {
- pos.rx() = screen.x() + screen.width() - width();
- }
- }
-
- if (pos.y() < screen.y())
- {
- pos.ry() = screen.y();
- }
- else
- {
- if (pos.y() + height() > screen.y() + screen.height())
- {
- pos.ry() = m_button->mapToGlobal(QPoint(0, 0)).y() + height();
- }
- }
-
- move(pos);
-}
diff --git a/src/rekonqmenu.h b/src/rekonqmenu.h
deleted file mode 100644
index 8bda008b..00000000
--- a/src/rekonqmenu.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Peter Penz <peter.penz19@gmail.com>
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-
-#ifndef REKONQ_MENU_H
-#define REKONQ_MENU_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KMenu>
-
-// Forward Declarations
-class QWidget;
-
-
-/**
- * Menu shown inside rekonq window.
- * Inspired by Dolphin solution.
- *
- */
-class REKONQ_TESTS_EXPORT RekonqMenu : public KMenu
-{
- Q_OBJECT
-
-public:
- RekonqMenu(QWidget *parent);
-
- void setButtonWidget(QWidget *);
-
-protected:
- virtual void showEvent(QShowEvent* event);
-
-private:
- QWidget *m_button;
-};
-
-#endif // REKONQ_MENU_H
diff --git a/src/rekonqui.rc b/src/rekonqui.rc
deleted file mode 100644
index 1c6f26a5..00000000
--- a/src/rekonqui.rc
+++ /dev/null
@@ -1,155 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui name="rekonq" version="61">
-
-<!--- =========== Rekonq Menu ============= -->
-<Menu name="rekonqMenu" noMerge="1">
- <Action name="new_tab" />
- <Action name="new_window" />
- <Action name="private_browsing" />
- <Separator/>
- <Action name="file_open" />
- <Action name="file_save_as" />
- <Action name="file_print" />
- <Action name="edit_find" />
- <Action name="view_zoom" />
- <Separator/>
-
- <Menu name="toolsMenu" icon="preferences-other" noMerge="1">
- <text>&amp;Tools</text>
- <Action name="clear_private_data" />
- <Separator/>
- <Action name="webapp_shortcut" />
- <Action name="web_inspector" />
- <Action name="page_source" />
- <Action name="net_analyzer" />
- <Action name="set_editable" />
- <Separator/>
- <Action name="useragent" />
- <Action name="sync" />
- <Action name="adblock" />
- </Menu>
-
- <Separator/>
- <Action name="show_history_panel" />
- <Action name="show_bookmarks_toolbar" />
- <Action name="show_bookmarks_panel" />
- <Action name="fullscreen" />
- <Separator/>
-
- <Menu name="help" icon="help-browser">
- <text>&amp;Help</text>
- <Action name="help_contents"/>
- <Action name="help_whats_this"/>
- <Separator weakSeparator="1"/>
- <Action name="help_report_bug"/>
- <Separator weakSeparator="1"/>
- <Action name="switch_application_language"/>
- <Separator weakSeparator="1"/>
- <Action name="help_about_app"/>
- <Action name="help_about_kde"/>
- </Menu>
-
- <Action name="options_configure" />
-</Menu>
-<!--- ====================================== -->
-
-
-<MenuBar>
- <!-- ============ FILE menu =========== -->
- <Menu name="file" noMerge="1"><text>&amp;File</text>
- <Action name="file_open" />
- <Action name="open_location" />
- <Separator/>
- <Action name="new_tab" />
- <Action name="close_tab" />
- <Separator/>
- <Action name="file_save_as" />
- <Separator/>
- <Action name="file_print_preview" />
- <Action name="file_print" />
- <Separator/>
- <Action name="file_quit" />
- </Menu>
-
- <!-- ============ EDIT menu =========== -->
- <Menu name="edit" noMerge="1"><text>&amp;Edit</text>
- <Action name="edit_undo" />
- <Action name="edit_redo" />
- <Separator/>
- <Action name="edit_cut" />
- <Action name="edit_copy" />
- <Action name="edit_paste" />
- <Separator/>
- <Action name="edit_find" />
- <Action name="edit_find_next" />
- <Action name="edit_find_prev" />
- </Menu>
-
- <!-- ============ VIEW menu =========== -->
- <Menu name="view" noMerge="1"><text>&amp;View</text>
- <Action name="view_redisplay" />
- <Action name="go_home" />
- <Separator/>
- <Action name="bigger_font" />
- <Action name="normal_font" />
- <Action name="smaller_font" />
- <Separator/>
- <Action name="page_source" />
- </Menu>
-
- <!-- ============ GO menu =========== -->
- <Menu name="go" deleted="true">
- </Menu>
-
- <!-- ============ HISTORY menu =========== -->
- <Action name="history" ><text>Hi&amp;story</text>
- </Action>
-
- <!-- ============ BOOKMARKS menu =========== -->
- <Action name="bookmarksActionMenu" ><text>&amp;Bookmarks</text>
- </Action>
-
- <!-- ============ TOOLS menu =========== -->
- <Menu name="tools" noMerge="1"><text>&amp;Tools</text>
- <Action name="web_inspector" />
- <Action name="private_browsing" />
- <Action name="clear_private_data" />
- <Action name="page_source" />
- <Action name="net_analyzer" />
- <Action name="set_editable" />
- <Separator/>
- <Action name="useragent" />
- <Action name="adblock" />
- </Menu>
-
- <!-- ============ SETTINGS menu =========== -->
- <Menu name="settings" noMerge="1"><text>&amp;Settings</text>
- <Action name="options_show_menubar" />
- <Merge name="StandardToolBarMenuHandler" />
- <Merge/>
- <Separator/>
- <Action name="fullscreen" />
- <Separator/>
- <Action name="options_configure_keybinding" />
- <Action name="options_configure_toolbars" />
- <Action name="options_configure" />
- </Menu>
-</MenuBar>
-
-<!-- ============ Main ToolBar =========== -->
-<ToolBar name="mainToolBar" position="top" iconText="iconOnly" newline="true" noMerge="1">
-<text>Main Toolbar</text>
- <Action name="go_back" />
- <Action name="go_forward" />
- <Action name="url_bar" />
- <Action name="load_stop_reload" />
- <Action name="rekonq_tools" />
-</ToolBar>
-
-<!-- ============ Bookmarks ToolBar =========== -->
-<ToolBar noEdit="true" iconText="icontextright" fullWidth="true" name="bookmarkToolBar" iconSize="16" newline="true">
- <text>Bookmark Toolbar</text>
-</ToolBar>
-
-</gui>
diff --git a/src/searchenginebar.cpp b/src/searchenginebar.cpp
deleted file mode 100644
index 441facf7..00000000
--- a/src/searchenginebar.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "searchenginebar.h"
-#include "searchenginebar.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// KDE Includes
-#include <KIcon>
-#include <KIconLoader>
-#include <KAction>
-#include <KLocalizedString>
-
-// Qt Includes
-#include <QProcess>
-
-
-SearchEngineBar::SearchEngineBar(QWidget *parent)
- : KMessageWidget(parent)
-{
- connect(this, SIGNAL(accepted()), this, SLOT(hideAndDelete()));
- connect(this, SIGNAL(accepted()), this, SLOT(slotAccepted()));
-
- connect(this, SIGNAL(rejected()), this, SLOT(hideAndDelete()));
- connect(this, SIGNAL(rejected()), this, SLOT(slotRejected()));
-
- setMessageType(KMessageWidget::Information);
-
- QSize sz = size();
- sz.setWidth(qobject_cast<QWidget *>(parent)->size().width());
- resize(sz);
-
- setCloseButtonVisible(false);
-
- setText(i18n("You don't have a default search engine set. Without it, rekonq will not show proper url suggestions."));
-
- KAction *acceptAction = new KAction(i18n("Set it"), this);
- connect(acceptAction, SIGNAL(triggered(bool)), this, SIGNAL(accepted()));
- addAction(acceptAction);
-
- KAction *rejectAction = new KAction(i18n("Ignore"), this);
- connect(rejectAction, SIGNAL(triggered(bool)), this, SIGNAL(rejected()));
- addAction(rejectAction);
-}
-
-
-void SearchEngineBar::hideAndDelete()
-{
- animatedHide();
- deleteLater();
-}
-
-
-void SearchEngineBar::slotAccepted()
-{
- QProcess *proc = new QProcess(parent());
- QStringList args;
- args << QL1S("ebrowsing");
- proc->start(QL1S("kcmshell4"), args);
-}
-
-
-void SearchEngineBar::slotRejected()
-{
- // Remember users choice
- ReKonfig::setCheckDefaultSearchEngine(false);
-}
diff --git a/src/searchenginebar.h b/src/searchenginebar.h
deleted file mode 100644
index 7ee1f90c..00000000
--- a/src/searchenginebar.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SEARCH_ENGINE_BAR_H
-#define SEARCH_ENGINE_BAR_H
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KMessageWidget>
-
-
-class REKONQ_TESTS_EXPORT SearchEngineBar : public KMessageWidget
-{
- Q_OBJECT
-
-public:
- explicit SearchEngineBar(QWidget *parent);
-
-private Q_SLOTS:
- void hideAndDelete();
- void slotAccepted();
- void slotRejected();
-
-Q_SIGNALS:
- void accepted();
- void rejected();
-};
-
-
-#endif // SEARCH_ENGINE_BAR_H
diff --git a/src/sessionmanager.cpp b/src/sessionmanager.cpp
deleted file mode 100644
index b825ac28..00000000
--- a/src/sessionmanager.cpp
+++ /dev/null
@@ -1,298 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Yoram Bar-Haim <<yoram.b at zend dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "sessionmanager.h"
-#include "sessionmanager.moc"
-
-// Local Includes
-#include "application.h"
-#include "historymanager.h"
-#include "mainview.h"
-#include "mainwindow.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KStandardDirs>
-
-// Qt Includes
-#include <QFile>
-
-
-// Only used internally
-bool readSessionDocument(QDomDocument & document, const QString & sessionFilePath)
-{
- QFile sessionFile(sessionFilePath);
-
- if (!sessionFile.exists())
- return false;
-
- if (!sessionFile.open(QFile::ReadOnly))
- {
- kDebug() << "Unable to open session file" << sessionFile.fileName();
- return false;
- }
-
- if (!document.setContent(&sessionFile, false))
- {
- kDebug() << "Unable to parse session file" << sessionFile.fileName();
- return false;
- }
-
- return true;
-}
-
-
-int loadViewTabs(MainView *mv, QDomElement & window, bool checkViewExists)
-{
- int currentTab = 0;
-
- for (unsigned int tabNo = 0; tabNo < window.elementsByTagName("tab").length(); tabNo++)
- {
- QDomElement tab = window.elementsByTagName("tab").at(tabNo).toElement();
- if (tab.hasAttribute("currentTab"))
- currentTab = tabNo;
-
- WebView * view = 0;
- if (tabNo == 0 && checkViewExists)
- view = mv->webTab(0)->view();
- else
- view = mv->newWebTab()->view();
-
- QDomCDATASection historySection = tab.firstChild().toCDATASection();
- QByteArray history = QByteArray::fromBase64(historySection.data().toAscii());
-
- QDataStream readingStream(&history, QIODevice::ReadOnly);
- readingStream >> *(view->history());
-
- // Get sure about urls and/or pdf are loaded
- KUrl u = KUrl(tab.attribute("url"));
- view->load(u);
- }
-
- return currentTab;
-}
-
-
-// ---------------------------------------------------------------------
-
-
-SessionManager::SessionManager(QObject *parent)
- : QObject(parent)
- , m_safe(true)
- , m_isSessionEnabled(false)
-{
- m_sessionFilePath = KStandardDirs::locateLocal("appdata" , "session");
-}
-
-
-void SessionManager::saveSession()
-{
- if (!m_isSessionEnabled || !m_safe)
- return;
-
- m_safe = false;
-
- kDebug() << "SAVING SESSION...";
-
- QFile sessionFile(m_sessionFilePath);
- if (!sessionFile.open(QFile::WriteOnly | QFile::Truncate))
- {
- kDebug() << "Unable to open session file" << sessionFile.fileName();
- return;
- }
- MainWindowList wl = rApp->mainWindowList();
- QDomDocument document("session");
- QDomElement session = document.createElement("session");
- document.appendChild(session);
-
- Q_FOREACH(const QWeakPointer<MainWindow> &w, wl)
- {
- MainView *mv = w.data()->mainView();
- QDomElement window = document.createElement("window");
- int tabInserted = 0;
-
- window.setAttribute("name", w.data()->objectName());
-
- for (signed int tabNo = 0; tabNo < mv->count(); tabNo++)
- {
- KUrl u = mv->webTab(tabNo)->url();
-
- tabInserted++;
- QDomElement tab = document.createElement("tab");
- tab.setAttribute("title", mv->webTab(tabNo)->view()->title()); // redundant, but needed for closedSites()
- // as there's not way to read out the historyData
- tab.setAttribute("url", u.url());
- if (mv->currentIndex() == tabNo)
- {
- tab.setAttribute("currentTab", 1);
- }
- QByteArray history;
- QDataStream historyStream(&history, QIODevice::ReadWrite);
- historyStream << *(mv->webTab(tabNo)->view()->history());
- QDomCDATASection historySection = document.createCDATASection(history.toBase64());
-
- tab.appendChild(historySection);
- window.appendChild(tab);
- }
- if (tabInserted > 0)
- session.appendChild(window);
- }
-
- QTextStream TextStream(&sessionFile);
- document.save(TextStream, 2);
- sessionFile.close();
-
- m_safe = true;
- return;
-}
-
-
-bool SessionManager::restoreSessionFromScratch()
-{
- QDomDocument document("session");
-
- if (!readSessionDocument(document, m_sessionFilePath))
- return false;
-
- for (unsigned int winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++)
- {
- QDomElement window = document.elementsByTagName("window").at(winNo).toElement();
-
- MainView *mv = rApp->newMainWindow(false)->mainView();
-
- int currentTab = loadViewTabs(mv, window, false);
-
- mv->setCurrentIndex(currentTab);
- }
-
- return true;
-}
-
-
-void SessionManager::restoreCrashedSession()
-{
- QDomDocument document("session");
-
- if (!readSessionDocument(document, m_sessionFilePath))
- return;
-
- for (unsigned int winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++)
- {
- QDomElement window = document.elementsByTagName("window").at(winNo).toElement();
-
- MainView *mv = (winNo == 0) ? rApp->mainWindow()->mainView() : rApp->newMainWindow()->mainView();
-
- bool useCurrentTab = (!mv->currentWebTab()->url().isValid() || (mv->currentWebTab()->url().protocol() == QL1S("about")));
- int currentTab = loadViewTabs(mv, window, useCurrentTab);
-
- mv->setCurrentIndex(currentTab);
- }
-
- setSessionManagementEnabled(true);
-}
-
-
-int SessionManager::restoreSavedSession()
-{
- QDomDocument document("session");
-
- if (!readSessionDocument(document, m_sessionFilePath))
- return 0;
-
- unsigned int winNo;
-
- for (winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++)
- {
- QDomElement window = document.elementsByTagName("window").at(winNo).toElement();
-
- MainView *mv = rApp->newMainWindow()->mainView();
-
- int currentTab = loadViewTabs(mv, window, true);
-
- mv->setCurrentIndex(currentTab);
- }
-
- return winNo;
-}
-
-
-bool SessionManager::restoreMainWindow(MainWindow* window)
-{
- QDomDocument document("session");
-
- if (!readSessionDocument(document, m_sessionFilePath))
- return false;
-
- unsigned int winNo;
-
- for (winNo = 0; winNo < document.elementsByTagName("window").length(); winNo++)
- {
- QDomElement savedWindowElement = document.elementsByTagName("window").at(winNo).toElement();
-
- if (window->objectName() != savedWindowElement.attribute("name", ""))
- continue;
-
- MainView *mv = window->mainView();
-
- int currentTab = loadViewTabs(mv, savedWindowElement, false);
-
- mv->setCurrentIndex(currentTab);
-
- return true;
- }
-
- return false;
-}
-
-
-QList<TabHistory> SessionManager::closedSites()
-{
- QList<TabHistory> list;
- QDomDocument document("session");
-
- if (!readSessionDocument(document, m_sessionFilePath))
- return list;
-
- for (unsigned int tabNo = 0; tabNo < document.elementsByTagName("tab").length(); tabNo++)
- {
- QDomElement tab = document.elementsByTagName("tab").at(tabNo).toElement();
-
- TabHistory tabHistory;
-
- tabHistory.title = tab.attribute("title");
- tabHistory.url = tab.attribute("url");
-
- QDomCDATASection historySection = tab.firstChild().toCDATASection();
- tabHistory.history = QByteArray::fromBase64(historySection.data().toAscii());
-
- list << tabHistory;
- }
-
- return list;
-}
diff --git a/src/sessionmanager.h b/src/sessionmanager.h
deleted file mode 100644
index 810d9b5c..00000000
--- a/src/sessionmanager.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Yoram Bar-Haim <<yoram.b at zend dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SESSION_MANAGER_H
-#define SESSION_MANAGER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QObject>
-#include <QString>
-
-// Forward Declarations
-class TabHistory;
-class MainWindow;
-
-/**
- * Session Management: Needs clean up :)
- */
-class REKONQ_TESTS_EXPORT SessionManager : public QObject
-{
- Q_OBJECT
-public:
- SessionManager(QObject *parent = 0);
-
- inline void setSessionManagementEnabled(bool on)
- {
- m_isSessionEnabled = on;
- }
-
- QList<TabHistory> closedSites();
-
- // This method restores session
- // while turning back from Private mode
- int restoreSavedSession();
-
- // This method restores a single MainWindow
- bool restoreMainWindow(MainWindow * window);
-
-public Q_SLOTS:
- // This method restores session
- // on restart when restore at startup is chosen
- bool restoreSessionFromScratch();
-
-private Q_SLOTS:
- void saveSession();
-
- // This method restores session
- // after a crash
- void restoreCrashedSession();
-
-private:
- QString m_sessionFilePath;
-
- bool m_safe;
- bool m_isSessionEnabled;
-};
-
-
-#endif // SESSION_MANAGER_H
diff --git a/src/settings/advancedwidget.cpp b/src/settings/advancedwidget.cpp
deleted file mode 100644
index 73c889dc..00000000
--- a/src/settings/advancedwidget.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Local Includes
-#include "advancedwidget.h"
-#include "advancedwidget.moc"
-
-// Qt Includes
-#include <QProcess>
-
-
-AdvancedWidget::AdvancedWidget(QWidget *parent)
- : QWidget(parent)
- , _changed(false)
-{
- setupUi(this);
-
- connect(proxyButton, SIGNAL(clicked()), this, SLOT(launchProxySettings()));
-}
-
-
-void AdvancedWidget::save()
-{
-}
-
-
-bool AdvancedWidget::changed()
-{
- return _changed;
-}
-
-
-void AdvancedWidget::hasChanged()
-{
- _changed = true;
- emit changed(true);
-}
-
-
-void AdvancedWidget::launchProxySettings()
-{
- QString program = QL1S("kcmshell4");
- QStringList arguments;
- arguments << QL1S("proxy");
- QProcess *proc = new QProcess(this);
- proc->start(program, arguments);
-}
diff --git a/src/settings/advancedwidget.h b/src/settings/advancedwidget.h
deleted file mode 100644
index c9509c9d..00000000
--- a/src/settings/advancedwidget.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef ADVANCED_WIDGET_H
-#define ADVANCED_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_settings_advanced.h"
-
-// Qt Includes
-#include <QWidget>
-
-
-class AdvancedWidget : public QWidget, private Ui::advanced
-{
- Q_OBJECT
-
-public:
- AdvancedWidget(QWidget *parent = 0);
-
- void save();
- bool changed();
-
-Q_SIGNALS:
- void changed(bool);
-
-private Q_SLOTS:
- void hasChanged();
- void launchProxySettings();
-
-private:
- bool _changed;
-};
-
-#endif // ADVANCED_WIDGET_H
diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp
deleted file mode 100644
index 42c9db14..00000000
--- a/src/settings/appearancewidget.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "appearancewidget.h"
-#include "appearancewidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// KDE Includes
-#include <KGlobal>
-#include <KCharsets>
-
-AppearanceWidget::AppearanceWidget(QWidget *parent)
- : QWidget(parent)
- , _changed(false)
-{
- setupUi(this);
-
- fixedFontChooser->setOnlyFixed(true);
-
- standardFontChooser->setCurrentFont(QFont(ReKonfig::standardFontFamily()));
- fixedFontChooser->setCurrentFont(QFont(ReKonfig::fixedFontFamily()));
- serifFontChooser->setCurrentFont(QFont(ReKonfig::serifFontFamily()));
- sansSerifFontChooser->setCurrentFont(QFont(ReKonfig::sansSerifFontFamily()));
- cursiveFontChooser->setCurrentFont(QFont(ReKonfig::cursiveFontFamily()));
- fantasyFontChooser->setCurrentFont(QFont(ReKonfig::fantasyFontFamily()));
-
- connect(standardFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged()));
- connect(fixedFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged()));
- connect(serifFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged()));
- connect(sansSerifFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged()));
- connect(cursiveFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged()));
- connect(fantasyFontChooser, SIGNAL(currentFontChanged(QFont)), this, SLOT(hasChanged()));
-
- populateEncodingMenu();
-}
-
-
-void AppearanceWidget::save()
-{
- ReKonfig::setStandardFontFamily(standardFontChooser->currentFont().family());
- ReKonfig::setFixedFontFamily(fixedFontChooser->currentFont().family());
- ReKonfig::setSerifFontFamily(serifFontChooser->currentFont().family());
- ReKonfig::setSansSerifFontFamily(sansSerifFontChooser->currentFont().family());
- ReKonfig::setCursiveFontFamily(cursiveFontChooser->currentFont().family());
- ReKonfig::setFantasyFontFamily(fantasyFontChooser->currentFont().family());
-}
-
-
-bool AppearanceWidget::changed()
-{
- return _changed;
-}
-
-
-void AppearanceWidget::hasChanged()
-{
- _changed = true;
- emit changed(true);
-}
-
-
-bool AppearanceWidget::isDefault()
-{
- bool def = true;
-
- // TODO: implement me!!
-
- return def;
-}
-
-
-void AppearanceWidget::populateEncodingMenu()
-{
- encodingCombo->setEditable(false);
- QStringList encodings = KGlobal::charsets()->availableEncodingNames();
- encodingCombo->addItems(encodings);
-
- encodingCombo->setWhatsThis(i18n("Select the default encoding to be used; normally, you will be fine with 'Use language encoding' "
- "and should not have to change this."));
-
- connect(encodingCombo, SIGNAL(activated(QString)), this, SLOT(setEncoding(QString)));
- connect(encodingCombo, SIGNAL(activated(QString)), this, SLOT(hasChanged()));
-
- QString enc = ReKonfig::defaultEncoding();
- int indexOfEnc = encodings.indexOf(enc);
- encodingCombo->setCurrentIndex(indexOfEnc);
-}
-
-
-void AppearanceWidget::setEncoding(const QString &enc)
-{
- ReKonfig::setDefaultEncoding(enc);
-}
diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h
deleted file mode 100644
index 86f6d66a..00000000
--- a/src/settings/appearancewidget.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef APPEARANCE_WIDGET_H
-#define APPEARANCE_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_settings_appearance.h"
-
-// Qt Includes
-#include <QtGui/QWidget>
-
-
-class AppearanceWidget : public QWidget, private Ui::appearance
-{
- Q_OBJECT
-
-public:
- AppearanceWidget(QWidget *parent = 0);
-
- void save();
- bool changed();
- bool isDefault();
-
-Q_SIGNALS:
- void changed(bool);
-
-private Q_SLOTS:
- void hasChanged();
- void setEncoding(const QString &);
-
-private:
- void populateEncodingMenu();
-
- bool _changed;
-};
-
-#endif // APPEARANCE_WIDGET_H
diff --git a/src/settings/generalwidget.cpp b/src/settings/generalwidget.cpp
deleted file mode 100644
index 439aa5f3..00000000
--- a/src/settings/generalwidget.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "generalwidget.h"
-#include "generalwidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "mainwindow.h"
-#include "webtab.h"
-
-//KDE Includes
-#include <kstandarddirs.h>
-#include <KUrlRequester>
-
-
-GeneralWidget::GeneralWidget(QWidget *parent)
- : QWidget(parent)
- , _changed(false)
-{
- setupUi(this);
-
- connect(setHomeToCurrentPageButton, SIGNAL(clicked()), this, SLOT(setHomeToCurrentPage()));
-
- disableHomeSettings(ReKonfig::useNewTabPage());
-
- connect(kcfg_useNewTabPage, SIGNAL(toggled(bool)), this, SLOT(disableHomeSettings(bool)));
-
- checkKGetPresence();
-
- connect(kcfg_homePage, SIGNAL(editingFinished()), this, SLOT(fixHomePageURL()));
-
- kcfg_downloadPath->setMode(KFile::Directory);
-
- askDownloadYes->setChecked(ReKonfig::askDownloadPath());
- askDownloadNo->setChecked(!ReKonfig::askDownloadPath());
-
- kcfg_downloadPath->setEnabled(!ReKonfig::askDownloadPath());
- connect(askDownloadNo, SIGNAL(toggled(bool)), kcfg_downloadPath, SLOT(setEnabled(bool)));
- connect(askDownloadNo, SIGNAL(toggled(bool)), this, SLOT(hasChanged()));
-}
-
-
-void GeneralWidget::save()
-{
- ReKonfig::setAskDownloadPath(askDownloadYes->isChecked());
-
- _changed = false;
-}
-
-
-bool GeneralWidget::changed()
-{
- return _changed;
-}
-
-
-void GeneralWidget::hasChanged()
-{
- _changed = true;
- emit changed(true);
-}
-
-
-void GeneralWidget::setHomeToCurrentPage()
-{
- MainWindow *mw = rApp->mainWindow();
- WebTab *webTab = mw->currentTab();
- if (webTab)
- {
- kcfg_homePage->setText(webTab->url().prettyUrl());
- }
-}
-
-
-void GeneralWidget::disableHomeSettings(bool b)
-{
- kcfg_homePage->setEnabled(!b);
- setHomeToCurrentPageButton->setEnabled(!b);
-}
-
-
-void GeneralWidget::checkKGetPresence()
-{
- if (KStandardDirs::findExe("kget").isNull())
- {
- kcfg_kgetDownload->setDisabled(true);
- kcfg_kgetList->setDisabled(true);
- kcfg_kgetDownload->setToolTip(i18n("Install KGet to enable rekonq to use it as download manager"));
- }
- else
- {
- kcfg_kgetDownload->setDisabled(false);
- kcfg_kgetList->setDisabled(false);
- }
-}
-
-
-void GeneralWidget::fixHomePageURL()
-{
- QString fixedURL = QUrl::fromUserInput(kcfg_homePage->text()).toString();
- kcfg_homePage->setText(fixedURL);
-}
diff --git a/src/settings/generalwidget.h b/src/settings/generalwidget.h
deleted file mode 100644
index 3170f7b2..00000000
--- a/src/settings/generalwidget.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef GENERAL_WIDGET_H
-#define GENERAL_WIDGET_H
-
-
-// Ui Includes
-#include "ui_settings_general.h"
-
-// Qt Includes
-#include <QtGui/QWidget>
-
-
-class GeneralWidget : public QWidget, private Ui::general
-{
- Q_OBJECT
-
-public:
- GeneralWidget(QWidget *parent = 0);
-
- void save();
- bool changed();
- void checkKGetPresence();
-
-Q_SIGNALS:
- void changed(bool);
-
-private Q_SLOTS:
- void hasChanged();
- void setHomeToCurrentPage();
- void disableHomeSettings(bool);
- void fixHomePageURL();
-
-private:
- bool _changed;
-};
-
-#endif // GENERAL_WIDGET_H
diff --git a/src/settings/networkwidget.cpp b/src/settings/networkwidget.cpp
deleted file mode 100644
index c2988eb1..00000000
--- a/src/settings/networkwidget.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "networkwidget.h"
-#include "networkwidget.moc"
-
-// KDE Includes
-#include <KTabWidget>
-#include <KCModuleInfo>
-
-// Qt Includes
-#include <QVBoxLayout>
-
-
-NetworkWidget::NetworkWidget(QWidget *parent)
- : QWidget(parent)
- , _cacheModule(0)
- , _cookiesModule(0)
- , _proxyModule(0)
- , _changed(false)
-{
- QVBoxLayout *l = new QVBoxLayout(this);
- l->setMargin(0);
- l->setSpacing(0);
-
- KTabWidget *tabWidget = new KTabWidget(this);
- l->addWidget(tabWidget);
-
- KCModuleInfo cacheInfo("cache.desktop");
- _cacheModule = new KCModuleProxy(cacheInfo, parent);
- tabWidget->addTab(_cacheModule, i18n(cacheInfo.moduleName().toUtf8()));
-
- KCModuleInfo cookiesInfo("cookies.desktop");
- _cookiesModule = new KCModuleProxy(cookiesInfo, parent);
- tabWidget->addTab(_cookiesModule, i18n(cookiesInfo.moduleName().toUtf8()));
-
- KCModuleInfo proxyInfo("proxy.desktop");
- _proxyModule = new KCModuleProxy(proxyInfo, parent);
- tabWidget->addTab(_proxyModule, i18n(proxyInfo.moduleName().toUtf8()));
-
- connect(_cacheModule, SIGNAL(changed(bool)), this, SLOT(hasChanged()));
- connect(_cookiesModule, SIGNAL(changed(bool)), this, SLOT(hasChanged()));
- connect(_proxyModule, SIGNAL(changed(bool)), this, SLOT(hasChanged()));
-}
-
-
-NetworkWidget::~NetworkWidget()
-{
- delete _cacheModule;
- delete _cookiesModule;
- delete _proxyModule;
-}
-
-
-void NetworkWidget::save()
-{
- _cookiesModule->save();
- _proxyModule->save();
- _cacheModule->save();
-
- _changed = false;
- emit changed(false);
-}
-
-
-void NetworkWidget::hasChanged()
-{
- _changed = true;
- emit changed(true);
-}
-
-
-bool NetworkWidget::changed()
-{
- return _changed;
-}
diff --git a/src/settings/networkwidget.h b/src/settings/networkwidget.h
deleted file mode 100644
index 74a0e312..00000000
--- a/src/settings/networkwidget.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef NETWORK_WIDGET_H
-#define NETWORK_WIDGET_H
-
-
-// KDE Includes
-#include <KCModuleProxy>
-
-// Qt Includes
-#include <QWidget>
-
-
-class NetworkWidget : public QWidget
-{
- Q_OBJECT
-
-public:
- NetworkWidget(QWidget *parent = 0);
- ~NetworkWidget();
-
- void save();
- bool changed();
-
-Q_SIGNALS:
- void changed(bool);
-
-private Q_SLOTS:
- void hasChanged();
-
-private:
- KCModuleProxy *_cacheModule;
- KCModuleProxy *_cookiesModule;
- KCModuleProxy *_proxyModule;
-
- bool _changed;
-};
-
-#endif // NETWORK_WIDGET_H
diff --git a/src/settings/passexceptionswidget.cpp b/src/settings/passexceptionswidget.cpp
deleted file mode 100644
index fe20e711..00000000
--- a/src/settings/passexceptionswidget.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "passexceptionswidget.h"
-#include "passexceptionswidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-
-PassExWidget::PassExWidget(QWidget *parent)
- : QWidget(parent)
-{
- setupUi(this);
-
- setAttribute(Qt::WA_DeleteOnClose, true);
-
- connect(removeOneButton, SIGNAL(clicked()), this, SLOT(removeOne()));
- connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll()));
-
- QStringList exList = ReKonfig::walletBlackList();
- Q_FOREACH(const QString & str, exList)
- {
- QListWidgetItem *item = new QListWidgetItem(str, listWidget);
- listWidget->addItem(item);
- }
-}
-
-
-void PassExWidget::removeOne()
-{
- const int currentRow(listWidget->currentRow());
- if (currentRow == -1)
- return;
- QString item = listWidget->takeItem(currentRow)->text();
-
- QStringList exList = ReKonfig::walletBlackList();
- exList.removeOne(item);
- ReKonfig::setWalletBlackList(exList);
-}
-
-
-void PassExWidget::removeAll()
-{
- listWidget->clear();
-
- QStringList clearList;
- ReKonfig::setWalletBlackList(clearList);
-}
diff --git a/src/settings/passexceptionswidget.h b/src/settings/passexceptionswidget.h
deleted file mode 100644
index 6b02c4e6..00000000
--- a/src/settings/passexceptionswidget.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef PASS_EX_WIDGET_H
-#define PASS_EX_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_password_exceptions.h"
-
-// Qt Includes
-#include <QWidget>
-
-
-class PassExWidget : public QWidget, private Ui::PassExceptions
-{
- Q_OBJECT
-
-public:
- PassExWidget(QWidget *parent = 0);
-
-private Q_SLOTS:
- void removeOne();
- void removeAll();
-};
-
-#endif // PASS_EX_WIDGET_H
diff --git a/src/settings/password_exceptions.ui b/src/settings/password_exceptions.ui
deleted file mode 100644
index 97cf621b..00000000
--- a/src/settings/password_exceptions.ui
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>PassExceptions</class>
- <widget class="QWidget" name="PassExceptions">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Password Exceptions</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QListWidget" name="listWidget"/>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="removeOneButton">
- <property name="text">
- <string>Remove one</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="removeAllButton">
- <property name="text">
- <string>Remove all</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/settings/privacywidget.cpp b/src/settings/privacywidget.cpp
deleted file mode 100644
index 46774a63..00000000
--- a/src/settings/privacywidget.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "privacywidget.h"
-#include "privacywidget.moc"
-
-// Local Includes
-#include "passexceptionswidget.h"
-
-// Auto Includes
-#include "rekonq.h"
-
-// KDE Includes
-#include <KDialog>
-#include <KPushButton>
-
-// Qt Includes
-#include <QProcess>
-
-
-PrivacyWidget::PrivacyWidget(QWidget *parent)
- : QWidget(parent)
- , _changed(false)
-{
- setupUi(this);
-
- reload();
-
- // DO NOT TRACK
- KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("kioslaverc", KConfig::NoGlobals), QString());
- doNotTrackCheckBox->setChecked(cg.readEntry("DoNotTrack", false));
- connect(doNotTrackCheckBox, SIGNAL(clicked()), this, SLOT(hasChanged()));
-
- // CACHE & COOKIES
- connect(cacheButton, SIGNAL(clicked()), this, SLOT(launchCacheSettings()));
- connect(cookiesButton, SIGNAL(clicked()), this, SLOT(launchCookieSettings()));
-
- // PASSWORDS
- connect(managePassExceptionsButton, SIGNAL(clicked()), this, SLOT(showPassExceptions()));
-}
-
-
-void PrivacyWidget::save()
-{
- KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("kioslaverc", KConfig::NoGlobals), QString());
- cg.writeEntry("DoNotTrack", doNotTrackCheckBox->isChecked());
- cg.sync();
-
- reload();
-}
-
-
-void PrivacyWidget::reload()
-{
- bool b = ReKonfig::javascriptEnabled();
-
- kcfg_javascriptCanAccessClipboard->setEnabled(b);
- kcfg_javascriptCanOpenWindows->setEnabled(b);
-
- if (b)
- {
- kcfg_javascriptCanOpenWindows->setToolTip(i18n("If enabled, JavaScript programs are allowed to open new windows."));
- kcfg_javascriptCanAccessClipboard->setToolTip(i18n("If enabled, JavaScript programs are allowed to read from and to write to the clipboard."));
- }
- else
- {
- QString str = i18n("Javascript is NOT enabled, cannot change these settings");
- kcfg_javascriptCanOpenWindows->setToolTip(str);
- kcfg_javascriptCanAccessClipboard->setToolTip(str);
- }
-}
-
-
-bool PrivacyWidget::changed()
-{
- return _changed;
-}
-
-
-void PrivacyWidget::hasChanged()
-{
- _changed = true;
- emit changed(true);
-}
-
-
-void PrivacyWidget::launchCacheSettings()
-{
- QString program = QL1S("kcmshell4");
- QStringList arguments;
- arguments << QL1S("cache");
- QProcess *proc = new QProcess(this);
- proc->start(program, arguments);
-}
-
-
-void PrivacyWidget::launchCookieSettings()
-{
- QString program = QL1S("kcmshell4");
- QStringList arguments;
- arguments << QL1S("cookies");
- QProcess *proc = new QProcess(this);
- proc->start(program, arguments);
-}
-
-
-void PrivacyWidget::showPassExceptions()
-{
- PassExWidget *widg = new PassExWidget;
- widg->show();
-}
diff --git a/src/settings/privacywidget.h b/src/settings/privacywidget.h
deleted file mode 100644
index 229cb7df..00000000
--- a/src/settings/privacywidget.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef PRIVACY_WIDGET_H
-#define PRIVACY_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_settings_privacy.h"
-
-// Qt Includes
-#include <QWidget>
-
-
-class PrivacyWidget : public QWidget, private Ui::privacy
-{
- Q_OBJECT
-
-public:
- PrivacyWidget(QWidget *parent = 0);
-
- void save();
- void reload();
-
- bool changed();
-
-Q_SIGNALS:
- void changed(bool);
-
-private Q_SLOTS:
- void hasChanged();
-
- void launchCacheSettings();
- void launchCookieSettings();
- void showPassExceptions();
-
-private:
- bool _changed;
-};
-
-#endif // PRIVACY_WIDGET_H
diff --git a/src/settings/settings_advanced.ui b/src/settings/settings_advanced.ui
deleted file mode 100644
index 03891e2c..00000000
--- a/src/settings/settings_advanced.ui
+++ /dev/null
@@ -1,172 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>advanced</class>
- <widget class="QWidget" name="advanced">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>555</width>
- <height>440</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Proxy</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Rekonq is using your system's proxy settings</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>60</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="proxyButton">
- <property name="text">
- <string>Change them!</string>
- </property>
- <property name="icon">
- <iconset theme="preferences-system-network">
- <normaloff/>
- </iconset>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Misc</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="kcfg_hScrollWheelHistory">
- <property name="text">
- <string>Use horizontal scroll wheel to go through web history</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_useFavicon">
- <property name="text">
- <string>Use favicon of the current website as window icon</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_smoothScrolling">
- <property name="toolTip">
- <string>Scroll pages with an eye candy effect</string>
- </property>
- <property name="text">
- <string>Enable smooth scrolling</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_enableViShortcuts">
- <property name="text">
- <string>Enable Vi-like navigation shortcuts</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_accessKeysEnabled">
- <property name="text">
- <string>Enable keyboard navigation using the Ctrl key</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>Middle click should:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="kcfg_middleClickAction">
- <item>
- <property name="text">
- <string>Auto-scroll</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Load Clipboard URL</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Do Nothing</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_automaticSpellChecking">
- <property name="text">
- <string>Automatic Spell Check</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>155</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>proxyButton</tabstop>
- <tabstop>kcfg_hScrollWheelHistory</tabstop>
- <tabstop>kcfg_useFavicon</tabstop>
- <tabstop>kcfg_smoothScrolling</tabstop>
- <tabstop>kcfg_enableViShortcuts</tabstop>
- <tabstop>kcfg_accessKeysEnabled</tabstop>
- <tabstop>kcfg_middleClickAction</tabstop>
- <tabstop>kcfg_automaticSpellChecking</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui
deleted file mode 100644
index b0232089..00000000
--- a/src/settings/settings_appearance.ui
+++ /dev/null
@@ -1,284 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>appearance</class>
- <widget class="QWidget" name="appearance">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>570</width>
- <height>562</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Appearance</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Fonts</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Standard font:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Fixed font:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Serif font:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KFontComboBox" name="standardFontChooser"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Sans Serif font:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KFontComboBox" name="fixedFontChooser"/>
- </item>
- <item row="2" column="1">
- <widget class="KFontComboBox" name="serifFontChooser"/>
- </item>
- <item row="3" column="1">
- <widget class="KFontComboBox" name="sansSerifFontChooser"/>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Cursive font:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="KFontComboBox" name="cursiveFontChooser"/>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Fantasy font:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="KFontComboBox" name="fantasyFontChooser"/>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Font size</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="label_9">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Default font size:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KIntNumInput" name="kcfg_defaultFontSize"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_4">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Minimal font size:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KIntNumInput" name="kcfg_minFontSize"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>Character Encoding</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label_10">
- <property name="text">
- <string>Default character encoding:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KComboBox" name="encodingCombo"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>Custom Style Sheet</string>
- </property>
- <layout class="QFormLayout" name="formLayout_3">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_5">
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Path to custom CSS file:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KUrlRequester" name="kcfg_userCSS">
- <property name="filter">
- <string>*.css</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>149</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KFontComboBox</class>
- <extends>KComboBox</extends>
- <header>kfontcombobox.h</header>
- </customwidget>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- <customwidget>
- <class>KUrlRequester</class>
- <extends>QFrame</extends>
- <header>kurlrequester.h</header>
- </customwidget>
- <customwidget>
- <class>KIntNumInput</class>
- <extends>QWidget</extends>
- <header>knuminput.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/settings/settings_general.ui b/src/settings/settings_general.ui
deleted file mode 100644
index 7d4419b8..00000000
--- a/src/settings/settings_general.ui
+++ /dev/null
@@ -1,267 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>general</class>
- <widget class="QWidget" name="general">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>573</width>
- <height>410</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>General</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>Startup</string>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
- </property>
- <property name="text">
- <string>When starting rekonq:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KComboBox" name="kcfg_startupBehaviour">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <item>
- <property name="text">
- <string>Open the Home Page</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Open the New Tab Page</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Restore the Last Opened Tabs</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Home Page</string>
- </property>
- <layout class="QFormLayout" name="formLayout_2">
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Home page URL:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KLineEdit" name="kcfg_homePage">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QPushButton" name="setHomeToCurrentPageButton">
- <property name="text">
- <string>Set to Current Page</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="kcfg_useNewTabPage">
- <property name="text">
- <string>Use the New Tab Page as home page</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>Download Manager</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QRadioButton" name="askDownloadNo">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Save files to:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KUrlRequester" name="kcfg_downloadPath">
- <property name="sizePolicy">
- <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QRadioButton" name="askDownloadYes">
- <property name="text">
- <string>Always ask me where to save files</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>10</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_kgetDownload">
- <property name="text">
- <string>Use KGet for downloading files</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_kgetList">
- <property name="whatsThis">
- <string>If enabled, rekonq will display an additional context menu entry, which, when selected, lists all available links of the current website in KGet.</string>
- </property>
- <property name="text">
- <string>List links with KGet</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>179</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- <customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- <customwidget>
- <class>KUrlRequester</class>
- <extends>QFrame</extends>
- <header>kurlrequester.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/settings/settings_privacy.ui b/src/settings/settings_privacy.ui
deleted file mode 100644
index 04f36bad..00000000
--- a/src/settings/settings_privacy.ui
+++ /dev/null
@@ -1,260 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>privacy</class>
- <widget class="QWidget" name="privacy">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>535</width>
- <height>520</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_7">
- <item>
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>Javascript</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_5">
- <item>
- <widget class="QCheckBox" name="kcfg_javascriptCanOpenWindows">
- <property name="text">
- <string>Let Javascript open new windows</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_javascriptCanAccessClipboard">
- <property name="text">
- <string>Let Javascript access clipboard</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>Tracking</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QCheckBox" name="doNotTrackCheckBox">
- <property name="text">
- <string>Tell websites you do not want to be tracked</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>History</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Remove history items:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="kcfg_expireHistory">
- <item>
- <property name="text">
- <string>never</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>every 3 months</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>every month</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>every day</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>at application exit</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>don't even store them</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_5">
- <property name="title">
- <string>Passwords</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <item>
- <widget class="QCheckBox" name="kcfg_passwordSavingEnabled">
- <property name="text">
- <string>Remember passwords for sites</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="managePassExceptionsButton">
- <property name="text">
- <string>Manage Exceptions</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>Cookies</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Rekonq is sharing cookies settings with all other KDE applications</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
- <item>
- <widget class="QPushButton" name="cookiesButton">
- <property name="text">
- <string>Manage Cookies</string>
- </property>
- <property name="icon">
- <iconset theme="preferences-web-browser-cookies">
- <normaloff/>
- </iconset>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_6">
- <property name="title">
- <string>Cache</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_6">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Rekonq is sharing cache settings with all other KDE applications</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_5">
- <item>
- <widget class="QPushButton" name="cacheButton">
- <property name="text">
- <string>Manage Cache</string>
- </property>
- <property name="icon">
- <iconset theme="preferences-web-browser-cache">
- <normaloff/>
- </iconset>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_4">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>135</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/settings/settings_tabs.ui b/src/settings/settings_tabs.ui
deleted file mode 100644
index 4e19545f..00000000
--- a/src/settings/settings_tabs.ui
+++ /dev/null
@@ -1,290 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>tabs</class>
- <widget class="QWidget" name="tabs">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>483</width>
- <height>427</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Tabs</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="title">
- <string>New Tab Behavior</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_4">
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>New tab opens:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="kcfg_newTabsBehaviour">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <item>
- <property name="text">
- <string>New Tab Page</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Blank Page</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string comment="@item:inlistbox">Home Page</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_5">
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>New Tab Page starts with:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KComboBox" name="kcfg_newTabStartPage">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <item>
- <property name="text">
- <string>Favorites</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Closed Tabs</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Bookmarks</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>History</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Downloads</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Tabs</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>Tabbed Browsing</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label_6">
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>When hovering a tab show:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="KComboBox" name="kcfg_hoveringTabOption">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <item>
- <property name="text">
- <string>Tab Preview</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Tab's Title in a Tooltip</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Tab's URL in a Tooltip</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string comment="@item:inlistbox">Nothing</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_alwaysShowTabBar">
- <property name="text">
- <string>Always show tab bar</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_openLinksInNewWindow">
- <property name="text">
- <string>Don't use tabs: open links in new windows</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_openExternalLinksInNewWindow">
- <property name="text">
- <string>Open as new window when URL is called externally</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_lastTabClosesWindow">
- <property name="text">
- <string>Closing last tab closes window</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_openNewTabsInBackground">
- <property name="text">
- <string>Open new tabs in the background</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_openNewTabsNearCurrent">
- <property name="text">
- <string>Open new tabs after currently active one</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_closeTabSelectPrevious">
- <property name="text">
- <string>Activate previously used tab when closing the current one</string>
- </property>
- <property name="checked">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_animatedTabHighlighting">
- <property name="text">
- <string>Animated tab highlighting</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>120</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/settings/settings_webkit.ui b/src/settings/settings_webkit.ui
deleted file mode 100644
index 62f3bafd..00000000
--- a/src/settings/settings_webkit.ui
+++ /dev/null
@@ -1,200 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>webkit</class>
- <widget class="QWidget" name="webkit">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>503</width>
- <height>514</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_4">
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>General</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QCheckBox" name="kcfg_javascriptEnabled">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Enable JavaScript</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_javaEnabled">
- <property name="text">
- <string>Load java applets</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_webGL">
- <property name="text">
- <string>WebGL</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_spatialNavigation">
- <property name="text">
- <string>Spatial Navigation</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_frameFlattening">
- <property name="text">
- <string>Frame Flattening</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_dnsPrefetch">
- <property name="text">
- <string>Prefetch DNS entries</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_printElementBackgrounds">
- <property name="text">
- <string>Print element backgrounds</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_3">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title">
- <string>Plugins</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>150</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>When loading web pages:</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KComboBox" name="kcfg_pluginsEnabled">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <item>
- <property name="text">
- <string>Autoload Plugins</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Manually Load Plugins</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Never Load Plugins</string>
- </property>
- </item>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_4">
- <property name="title">
- <string>HTML 5</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <item>
- <widget class="QCheckBox" name="kcfg_offlineStorageDatabaseEnabled">
- <property name="text">
- <string>Offline storage database</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_offlineWebApplicationCacheEnabled">
- <property name="text">
- <string>Offline web application cache</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_localStorageEnabled">
- <property name="text">
- <string>Local Storage</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KComboBox</class>
- <extends>QComboBox</extends>
- <header>kcombobox.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp
deleted file mode 100644
index 6629f10c..00000000
--- a/src/settings/settingsdialog.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "settingsdialog.h"
-#include "settingsdialog.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "mainwindow.h"
-#include "webtab.h"
-#include "searchengine.h"
-#include "opensearchmanager.h"
-
-// Widget Includes
-#include "advancedwidget.h"
-#include "appearancewidget.h"
-#include "generalwidget.h"
-#include "privacywidget.h"
-#include "tabswidget.h"
-#include "webkitwidget.h"
-
-// KDE Includes
-#include <KConfig>
-#include <KStandardDirs>
-#include <KPageWidgetItem>
-#include <KShortcutsEditor>
-#include <KCModuleInfo>
-#include <KCModuleProxy>
-
-// Qt Includes
-#include <QtGui/QWidget>
-
-
-class Private
-{
-private:
- Private(SettingsDialog *parent);
-
-private:
- GeneralWidget *generalWidg;
- TabsWidget *tabsWidg;
- AppearanceWidget *appearanceWidg;
- WebKitWidget *webkitWidg;
- PrivacyWidget *privacyWidg;
- AdvancedWidget *advancedWidg;
-
- KCModuleProxy *ebrowsingModule;
-
- KShortcutsEditor *shortcutsEditor;
-
- friend class SettingsDialog;
-};
-
-
-Private::Private(SettingsDialog *parent)
-{
- KPageWidgetItem *pageItem;
-
- // -- 1
- generalWidg = new GeneralWidget(parent);
- generalWidg->layout()->setMargin(0);
- pageItem = parent->addPage(generalWidg, i18n("General"));
- pageItem->setIcon(KIcon("rekonq"));
-
- // -- 2
- tabsWidg = new TabsWidget(parent);
- tabsWidg->layout()->setMargin(0);
- pageItem = parent->addPage(tabsWidg, i18n("Tabs"));
- pageItem->setIcon(KIcon("tab-duplicate"));
-
- // -- 3
- appearanceWidg = new AppearanceWidget(parent);
- appearanceWidg->layout()->setMargin(0);
- pageItem = parent->addPage(appearanceWidg, i18n("Appearance"));
- pageItem->setIcon(KIcon("preferences-desktop-font"));
-
- // -- 4
- webkitWidg = new WebKitWidget(parent);
- webkitWidg->layout()->setMargin(0);
- pageItem = parent->addPage(webkitWidg, i18n("WebKit"));
- QString webkitIconPath = KStandardDirs::locate("appdata", "pics/webkit-icon.png");
- KIcon webkitIcon = KIcon(QIcon(webkitIconPath));
- pageItem->setIcon(webkitIcon);
-
- // -- 5
- privacyWidg = new PrivacyWidget(parent);
- privacyWidg->layout()->setMargin(0);
- pageItem = parent->addPage(privacyWidg, i18n("Privacy"));
- pageItem->setIcon(KIcon("view-media-artist"));
-
- // -- 6
- advancedWidg = new AdvancedWidget(parent);
- advancedWidg->layout()->setMargin(0);
- pageItem = parent->addPage(advancedWidg, i18n("Advanced"));
- pageItem->setIcon(KIcon("applications-system"));
-
- // -- 7
- shortcutsEditor = new KShortcutsEditor(rApp->mainWindow()->actionCollection(), parent);
- pageItem = parent->addPage(shortcutsEditor , i18n("Shortcuts"));
- pageItem->setIcon(KIcon("configure-shortcuts"));
-
- // -- 8
- KCModuleInfo ebrowsingInfo("ebrowsing.desktop");
- ebrowsingModule = new KCModuleProxy(ebrowsingInfo, parent);
- pageItem = parent->addPage(ebrowsingModule, i18n("Search Engines"));
- KIcon wsIcon("edit-web-search");
- if (wsIcon.isNull())
- {
- wsIcon = KIcon("preferences-web-browser-shortcuts");
- }
- pageItem->setIcon(wsIcon);
-
- // WARNING
- // remember wheh changing here that the smallest netbooks
- // have a 1024x576 resolution. So DON'T bother that limits!!
- parent->setMinimumSize(700, 525);
-}
-
-
-// -----------------------------------------------------------------------------------------------------
-
-
-SettingsDialog::SettingsDialog(QWidget *parent)
- : KConfigDialog(parent, "rekonfig", ReKonfig::self())
- , d(new Private(this))
-{
- showButtonSeparator(false);
- setWindowTitle(i18nc("Window title of the settings dialog", "Configure – rekonq"));
-
- // update buttons
- connect(d->generalWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
- connect(d->tabsWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
- connect(d->appearanceWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
- connect(d->webkitWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
- connect(d->ebrowsingModule, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
- connect(d->advancedWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
- connect(d->privacyWidg, SIGNAL(changed(bool)), this, SLOT(updateButtons()));
-
- connect(d->shortcutsEditor, SIGNAL(keyChange()), this, SLOT(updateButtons()));
-
- // save settings
- connect(this, SIGNAL(applyClicked()), this, SLOT(saveSettings()));
- connect(this, SIGNAL(okClicked()), this, SLOT(saveSettings()));
- setHelp("Config-rekonq", "rekonq");
-}
-
-
-SettingsDialog::~SettingsDialog()
-{
- kDebug() << "bye bye settings...";
- delete d;
-}
-
-
-// we need this function to SAVE settings in rc file..
-void SettingsDialog::saveSettings()
-{
- ReKonfig::self()->writeConfig();
-
- d->generalWidg->save();
- d->tabsWidg->save();
- d->appearanceWidg->save();
- d->webkitWidg->save();
- d->advancedWidg->save();
- d->privacyWidg->save();
- d->shortcutsEditor->save();
- d->ebrowsingModule->save();
-
- d->privacyWidg->reload();
-
- SearchEngine::reload();
- rApp->opensearchManager()->removeDeletedEngines();
-
- updateButtons();
- emit settingsChanged("ReKonfig");
-}
-
-
-bool SettingsDialog::hasChanged()
-{
- return KConfigDialog::hasChanged()
- || d->generalWidg->changed()
- || d->tabsWidg->changed()
- || d->appearanceWidg->changed()
- || d->webkitWidg->changed()
- || d->advancedWidg->changed()
- || d->privacyWidg->changed()
- || d->ebrowsingModule->changed()
- || d->shortcutsEditor->isModified();
- ;
-}
-
-
-bool SettingsDialog::isDefault()
-{
- bool isDef = KConfigDialog::isDefault();
-
- if (isDef)
- {
- // check our private widget values
- isDef = d->appearanceWidg->isDefault();
- }
- return isDef;
-}
diff --git a/src/settings/settingsdialog.h b/src/settings/settingsdialog.h
deleted file mode 100644
index ad03602b..00000000
--- a/src/settings/settingsdialog.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SETTINGS_DIALOG_H
-#define SETTINGS_DIALOG_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KConfigDialog>
-
-// Forward Declarations
-class QWidget;
-class Private;
-
-
-class REKONQ_TESTS_EXPORT SettingsDialog : public KConfigDialog
-{
- Q_OBJECT
-
-public:
- SettingsDialog(QWidget *parent = 0);
- ~SettingsDialog();
-
- virtual bool hasChanged();
-
-protected:
- virtual bool isDefault();
-
-private:
- Private* const d;
-
-private Q_SLOTS:
- void saveSettings();
-};
-
-#endif // SETTINGS_DIALOG_H
diff --git a/src/settings/tabswidget.cpp b/src/settings/tabswidget.cpp
deleted file mode 100644
index 67829f82..00000000
--- a/src/settings/tabswidget.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Local Includes
-#include "tabswidget.h"
-#include "tabswidget.moc"
-
-
-TabsWidget::TabsWidget(QWidget *parent)
- : QWidget(parent)
- , _changed(false)
-{
- setupUi(this);
-}
-
-
-void TabsWidget::save()
-{
-}
-
-bool TabsWidget::changed()
-{
- return _changed;
-}
-
-
-void TabsWidget::hasChanged()
-{
-}
diff --git a/src/settings/tabswidget.h b/src/settings/tabswidget.h
deleted file mode 100644
index 056f030c..00000000
--- a/src/settings/tabswidget.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef TABS_WIDGET_H
-#define TABS_WIDGET_H
-
-
-// Ui Includes
-#include "ui_settings_tabs.h"
-
-// Qt Includes
-#include <QtGui/QWidget>
-
-
-class TabsWidget : public QWidget, private Ui::tabs
-{
- Q_OBJECT
-
-public:
- TabsWidget(QWidget *parent = 0);
-
- void save();
- bool changed();
-
-Q_SIGNALS:
- void changed(bool);
-
-private Q_SLOTS:
- void hasChanged();
-
-private:
- bool _changed;
-};
-
-#endif // TABS_WIDGET_H
diff --git a/src/settings/webkitwidget.cpp b/src/settings/webkitwidget.cpp
deleted file mode 100644
index 31224f05..00000000
--- a/src/settings/webkitwidget.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Local Includes
-#include "webkitwidget.h"
-#include "webkitwidget.moc"
-
-
-WebKitWidget::WebKitWidget(QWidget *parent)
- : QWidget(parent)
- , _changed(false)
-{
- setupUi(this);
- setWebSettingsToolTips();
-}
-
-
-void WebKitWidget::save()
-{
-}
-
-
-bool WebKitWidget::changed()
-{
- return _changed;
-}
-
-
-void WebKitWidget::hasChanged()
-{
- _changed = true;
- emit changed(true);
-}
-
-
-void WebKitWidget::setWebSettingsToolTips()
-{
- kcfg_webGL->setToolTip(i18n("Enables WebGL technology"));
- kcfg_spatialNavigation->setToolTip(i18n("Lets you navigating between focusable elements using arrow keys."));
- kcfg_frameFlattening->setToolTip(i18n("Flatten all the frames to become one scrollable page."));
- kcfg_dnsPrefetch->setToolTip(i18n("Specifies whether WebKit will try to prefetch DNS entries to speed up browsing."));
- kcfg_printElementBackgrounds->setToolTip(i18n("If enabled, background colors and images are also drawn when the page is printed."));
- kcfg_javascriptEnabled->setToolTip(i18n("Enables the execution of JavaScript programs."));
- kcfg_javaEnabled->setToolTip(i18n("Enables support for Java applets."));
- kcfg_offlineStorageDatabaseEnabled->setToolTip(i18n("Enables support for the HTML 5 offline storage feature."));
- kcfg_offlineWebApplicationCacheEnabled->setToolTip(i18n("Enables support for the HTML 5 web application cache feature."));
- kcfg_localStorageEnabled->setToolTip(i18n("Enables support for the HTML 5 local storage feature."));
-}
diff --git a/src/settings/webkitwidget.h b/src/settings/webkitwidget.h
deleted file mode 100644
index 1a41a6a1..00000000
--- a/src/settings/webkitwidget.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEBKIT_WIDGET_H
-#define WEBKIT_WIDGET_H
-
-
-// Ui Includes
-#include "ui_settings_webkit.h"
-
-// Qt Includes
-#include <QtGui/QWidget>
-
-
-class WebKitWidget : public QWidget, private Ui::webkit
-{
- Q_OBJECT
-
-public:
- WebKitWidget(QWidget *parent = 0);
-
- void save();
- bool changed();
-
-Q_SIGNALS:
- void changed(bool);
-
-private Q_SLOTS:
- void hasChanged();
-
-private:
- void setWebSettingsToolTips();
-
- bool _changed;
-};
-
-#endif // WEBKIT_WIDGET_H
diff --git a/src/sslinfo.ui b/src/sslinfo.ui
deleted file mode 100644
index c1c67b47..00000000
--- a/src/sslinfo.ui
+++ /dev/null
@@ -1,392 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SslInfo</class>
- <widget class="QWidget" name="SslInfo">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>539</width>
- <height>459</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&lt;h2&gt;Certificate Information&lt;/h2&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_6">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Certificate Chain:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="comboBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_4">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="certInfoLabel">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_5">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string/>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QLabel" name="label_20">
- <property name="text">
- <string>&lt;h4&gt;Issued To:&lt;/h4&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_6">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>160</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Common Name (CN):</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="subjectCN">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>Organization (O):</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="subjectO">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Organizational Unit (OU):</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="subjectOU">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Serial Number:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QLabel" name="subjectSN">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_21">
- <property name="text">
- <string>&lt;h4&gt;Issued By:&lt;/h4&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="label_10">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>160</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Common Name (CN):</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="issuerCN">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_12">
- <property name="text">
- <string>Organization (O):</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_16">
- <property name="text">
- <string>Organizational Unit (OU):</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="issuerOU">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="issuerO">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_22">
- <property name="text">
- <string>&lt;h4&gt;Validity Period:&lt;/h4&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="0" column="0">
- <widget class="QLabel" name="label_14">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>160</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Issued on:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="issuedOn">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_18">
- <property name="text">
- <string>Expires on:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="expiresOn">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_3">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label_23">
- <property name="text">
- <string>&lt;h4&gt;Digests:&lt;/h4&gt;</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QGridLayout" name="gridLayout_5">
- <item row="0" column="0">
- <widget class="QLabel" name="label_36">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>160</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>Md5:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="md5">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_38">
- <property name="text">
- <string>SHA-1:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="sha1">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/sslinfodialog.cpp b/src/sslinfodialog.cpp
deleted file mode 100644
index 2f0b44e4..00000000
--- a/src/sslinfodialog.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "sslinfodialog.h"
-#include "sslinfodialog.moc"
-
-// KDE Includes
-#include <KFileDialog>
-
-#include <kglobal.h>
-#include <klocale.h>
-#include <ktcpsocket.h>
-
-// Qt Includes
-#include <QDate>
-#include <QFile>
-
-#include <QLabel>
-#include <QTextDocument>
-
-#include <QSslCertificate>
-
-
-SslInfoDialog::SslInfoDialog(const QString &host, const WebSslInfo &info, QWidget *parent)
- : KDialog(parent)
- , m_host(host)
- , m_info(info)
-{
- setCaption(i18n("Rekonq SSL Information"));
- setAttribute(Qt::WA_DeleteOnClose);
-
- setMinimumWidth(300);
-
- setButtons(KDialog::User1 | KDialog::Close);
-
- setButtonGuiItem(User1, KGuiItem(i18n("Export"), QL1S("view-certificate-export")));
- connect(this, SIGNAL(user1Clicked()), this, SLOT(exportCert()));
-
- ui.setupUi(mainWidget());
-
- // ------------------------------------------------
- QList<QSslCertificate> caList = m_info.certificateChain();
-
- Q_FOREACH(const QSslCertificate & cert, caList)
- {
- QString name = cert.subjectInfo(QSslCertificate::CommonName);
- if (name.isEmpty())
- name = cert.subjectInfo(QSslCertificate::Organization);
- if (name.isEmpty())
- name = cert.serialNumber();
- ui.comboBox->addItem(name);
- }
- connect(ui.comboBox, SIGNAL(activated(int)), this, SLOT(displayFromChain(int)));
-
- displayFromChain(0);
-}
-
-
-void SslInfoDialog::showCertificateInfo(QSslCertificate subjectCert, const QStringList &certErrors)
-{
- QStringList sl = certErrors;
- QString c = sl.takeFirst();
- c += QL1S("<ul>");
- Q_FOREACH(const QString & s, sl)
- {
- c += QL1S("<li>") + s + QL1S("</li>");
- }
- c += QL1S("</ul>");
- ui.certInfoLabel->setText(c);
-
- ui.subjectCN->setText(Qt::escape(subjectCert.subjectInfo(QSslCertificate::CommonName)));
- ui.subjectO->setText(Qt::escape(subjectCert.subjectInfo(QSslCertificate::Organization)));
- ui.subjectOU->setText(Qt::escape(subjectCert.subjectInfo(QSslCertificate::OrganizationalUnitName)));
- ui.subjectSN->setText(Qt::escape(subjectCert.serialNumber()));
-
- ui.issuerCN->setText(Qt::escape(subjectCert.issuerInfo(QSslCertificate::CommonName)));
- ui.issuerO->setText(Qt::escape(subjectCert.issuerInfo(QSslCertificate::Organization)));
- ui.issuerOU->setText(Qt::escape(subjectCert.issuerInfo(QSslCertificate::OrganizationalUnitName)));
-
- ui.issuedOn->setText(Qt::escape(subjectCert.effectiveDate().date().toString(Qt::SystemLocaleShortDate)));
- ui.expiresOn->setText(Qt::escape(subjectCert.expiryDate().date().toString(Qt::SystemLocaleShortDate)));
-
- ui.md5->setText(Qt::escape(subjectCert.digest(QCryptographicHash::Md5).toHex()));
- ui.sha1->setText(Qt::escape(subjectCert.digest(QCryptographicHash::Sha1).toHex()));
-}
-
-
-void SslInfoDialog::displayFromChain(int i)
-{
- QList<QSslCertificate> caList = m_info.certificateChain();
- QSslCertificate cert = caList.at(i);
-
- QStringList errors = SslInfoDialog::errorsFromString(m_info.certificateErrors()).at(i);
-
- if (cert.isValid() && errors.isEmpty())
- {
- QStringList certInfo;
- certInfo << i18n("The Certificate is Valid!");
- showCertificateInfo(cert, certInfo);
- }
- else
- {
- errors.prepend(i18n("The certificate for this site is NOT valid for the following reasons:"));
- showCertificateInfo(cert, errors);
- }
-}
-
-
-void SslInfoDialog::exportCert()
-{
- QSslCertificate cert = m_info.certificateChain().at(ui.comboBox->currentIndex());
-
- if (cert.isNull())
- return;
-
- QString name = m_host + QL1S(".pem");
-
- QString certPath = KFileDialog::getSaveFileName(name, QString(), this);
-
- QFile file(certPath);
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
- return;
-
- QTextStream out(&file);
- out << cert.toPem();
-}
-
-
-// static -------------------------------------------------------------------------------------------
-QList<QStringList> SslInfoDialog::errorsFromString(const QString &s)
-{
- QList<QStringList> resultList;
-
- QStringList sl1 = s.split('\n', QString::KeepEmptyParts);
-
- Q_FOREACH(const QString & certErrors, sl1)
- {
- QStringList errors;
- QStringList sl = certErrors.split('\t', QString::SkipEmptyParts);
- Q_FOREACH(const QString & s, sl)
- {
- bool didConvert;
- KSslError::Error error = static_cast<KSslError::Error>(s.trimmed().toInt(&didConvert));
- if (didConvert)
- {
- errors << KSslError(error).errorString();
- }
- }
- resultList << errors;
- }
- return resultList;
-}
diff --git a/src/sslinfodialog.h b/src/sslinfodialog.h
deleted file mode 100644
index 94f610c6..00000000
--- a/src/sslinfodialog.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SSL_INFO_DIALOG_H
-#define SSL_INFO_DIALOG_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "websslinfo.h"
-
-// Ui Includes
-#include "ui_sslinfo.h"
-
-// KDE Includes
-#include <KDialog>
-
-// Qt Includes
-#include <QString>
-
-// Forward Declarations
-class QSslCertificate;
-
-
-/**
- * Rekonq SSL Information Dialog
- *
- * This class creates a dialog that can be used to display information about
- * an SSL session.
- *
- */
-class SslInfoDialog : public KDialog
-{
- Q_OBJECT
-
-public:
- explicit SslInfoDialog(const QString &host, const WebSslInfo &info, QWidget *parent = 0);
-
- static QList<QStringList> errorsFromString(const QString &s);
-
-private Q_SLOTS:
- void displayFromChain(int);
- void exportCert();
-
-private:
- void showCertificateInfo(QSslCertificate, const QStringList &certErrors);
-
- QString m_host;
- WebSslInfo m_info;
-
- Ui::SslInfo ui;
-};
-
-#endif // SSL_INFO_DIALOG_H
diff --git a/src/sync/ftpsynchandler.cpp b/src/sync/ftpsynchandler.cpp
deleted file mode 100644
index ad845d09..00000000
--- a/src/sync/ftpsynchandler.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "ftpsynchandler.h"
-#include "ftpsynchandler.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// KDE Includes
-#include <KStandardDirs>
-#include <klocalizedstring.h>
-
-#include <KIO/Job>
-
-
-FTPSyncHandler::FTPSyncHandler(QObject *parent)
- : SyncHandler(parent)
-{
- kDebug() << "creating FTP handler...";
-}
-
-
-void FTPSyncHandler::initialLoadAndCheck()
-{
- if (!ReKonfig::syncEnabled())
- {
- _firstTimeSynced = false;
- return;
- }
-
- // Bookmarks
- if (ReKonfig::syncBookmarks())
- {
- _remoteBookmarksUrl = QUrl();
- _remoteBookmarksUrl.setHost(ReKonfig::syncHost());
- _remoteBookmarksUrl.setScheme("ftp");
- _remoteBookmarksUrl.setUserName(ReKonfig::syncUser());
- _remoteBookmarksUrl.setPassword(ReKonfig::syncPass());
- _remoteBookmarksUrl.setPort(ReKonfig::syncPort());
- _remoteBookmarksUrl.setPath(ReKonfig::syncPath() + QL1S("/bookmarks.xml"));
-
- const QString bookmarksFilePath = KStandardDirs::locateLocal("data", QL1S("konqueror/bookmarks.xml"));
- _localBookmarksUrl = KUrl(bookmarksFilePath);
-
- KIO::StatJob *job = KIO::stat(_remoteBookmarksUrl, KIO::StatJob::DestinationSide, 0, KIO::HideProgressInfo);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onBookmarksStatFinished(KJob*)));
- }
-
- // History
- if (ReKonfig::syncHistory())
- {
- _remoteHistoryUrl = QUrl();
- _remoteHistoryUrl.setHost(ReKonfig::syncHost());
- _remoteHistoryUrl.setScheme("ftp");
- _remoteHistoryUrl.setUserName(ReKonfig::syncUser());
- _remoteHistoryUrl.setPassword(ReKonfig::syncPass());
- _remoteHistoryUrl.setPort(ReKonfig::syncPort());
- _remoteHistoryUrl.setPath(ReKonfig::syncPath() + QL1S("/history"));
-
- const QString historyFilePath = KStandardDirs::locateLocal("appdata", "history");
- _localHistoryUrl = KUrl(historyFilePath);
-
- KIO::StatJob *job = KIO::stat(_remoteHistoryUrl, KIO::StatJob::DestinationSide, 0, KIO::HideProgressInfo);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onHistoryStatFinished(KJob*)));
- }
-
- // Passwords
- if (ReKonfig::syncPasswords())
- {
- _remotePasswordsUrl = QUrl();
- _remotePasswordsUrl.setHost(ReKonfig::syncHost());
- _remotePasswordsUrl.setScheme("ftp");
- _remotePasswordsUrl.setUserName(ReKonfig::syncUser());
- _remotePasswordsUrl.setPassword(ReKonfig::syncPass());
- _remotePasswordsUrl.setPort(ReKonfig::syncPort());
- _remotePasswordsUrl.setPath(ReKonfig::syncPath() + QL1S("/kdewallet.kwl"));
-
- const QString passwordsFilePath = KStandardDirs::locateLocal("data", QL1S("kwallet/kdewallet.kwl"));
- _localPasswordsUrl = KUrl(passwordsFilePath);
-
- KIO::StatJob *job = KIO::stat(_remotePasswordsUrl, KIO::StatJob::DestinationSide, 0, KIO::HideProgressInfo);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onPasswordsStatFinished(KJob*)));
- }
-}
-
-
-bool FTPSyncHandler::syncRelativeEnabled(bool check)
-{
- if (!ReKonfig::syncEnabled())
- return false;
-
- if (!_firstTimeSynced)
- return false;
-
- return check;
-}
-
-
-// ---------------------------------------------------------------------------------------
-
-
-void FTPSyncHandler::syncBookmarks()
-{
- kDebug() << "syncing now...";
-
- if (!syncRelativeEnabled(ReKonfig::syncBookmarks()))
- return;
-
- KIO::Job *job = KIO::file_copy(_localBookmarksUrl, _remoteBookmarksUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onBookmarksSyncFinished(KJob*)));
-}
-
-
-void FTPSyncHandler::onBookmarksStatFinished(KJob *job)
-{
- if (job->error())
- {
- if (job->error() == KIO::ERR_DOES_NOT_EXIST)
- {
- KIO::Job *job = KIO::file_copy(_localBookmarksUrl, _remoteBookmarksUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onBookmarksSyncFinished(KJob*)));
-
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Remote bookmarks file does NOT exists. Exporting local copy..."));
- _firstTimeSynced = true;
- }
- else
- {
- emit syncStatus(Rekonq::Bookmarks, false, job->errorString());
- }
- }
- else
- {
- KIO::Job *job = KIO::file_copy(_remoteBookmarksUrl, _localBookmarksUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onBookmarksSyncFinished(KJob*)));
-
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Remote bookmarks file exists! Syncing local copy..."));
- _firstTimeSynced = true;
- }
-}
-
-
-void FTPSyncHandler::onBookmarksSyncFinished(KJob *job)
-{
- if (job->error())
- {
- emit syncStatus(Rekonq::Bookmarks, false, job->errorString());
- emit syncBookmarksFinished(false);
- return;
- }
-
- emit syncBookmarksFinished(true);
-}
-
-
-// ---------------------------------------------------------------------------------------
-
-
-void FTPSyncHandler::syncHistory()
-{
- kDebug() << "syncing now...";
-
- if (!syncRelativeEnabled(ReKonfig::syncHistory()))
- return;
-
- KIO::Job *job = KIO::file_copy(_localHistoryUrl, _remoteHistoryUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onHistorySyncFinished(KJob*)));
-}
-
-
-void FTPSyncHandler::onHistoryStatFinished(KJob *job)
-{
- if (job->error())
- {
- if (job->error() == KIO::ERR_DOES_NOT_EXIST)
- {
- KIO::Job *job = KIO::file_copy(_localHistoryUrl, _remoteHistoryUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onHistorySyncFinished(KJob*)));
-
- emit syncStatus(Rekonq::History, true, i18n("Remote history file does NOT exists. Exporting local copy..."));
- _firstTimeSynced = true;
- }
- else
- {
- emit syncStatus(Rekonq::History, false, job->errorString());
- }
- }
- else
- {
- KIO::Job *job = KIO::file_copy(_remoteHistoryUrl, _localHistoryUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onHistorySyncFinished(KJob*)));
-
- emit syncStatus(Rekonq::History, true, i18n("Remote history file exists! Syncing local copy..."));
- _firstTimeSynced = true;
- }
-}
-
-
-void FTPSyncHandler::onHistorySyncFinished(KJob *job)
-{
- if (job->error())
- {
- emit syncStatus(Rekonq::History, false, job->errorString());
- emit syncHistoryFinished(false);
- return;
- }
-
- emit syncHistoryFinished(true);
-}
-
-
-// ---------------------------------------------------------------------------------------
-
-
-void FTPSyncHandler::syncPasswords()
-{
- kDebug() << "syncing now...";
-
- if (!syncRelativeEnabled(ReKonfig::syncPasswords()))
- return;
-
- KIO::Job *job = KIO::file_copy(_localPasswordsUrl, _remotePasswordsUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onPasswordsSyncFinished(KJob*)));
-}
-
-
-void FTPSyncHandler::onPasswordsStatFinished(KJob *job)
-{
- if (job->error())
- {
- if (job->error() == KIO::ERR_DOES_NOT_EXIST)
- {
- KIO::Job *job = KIO::file_copy(_localPasswordsUrl, _remotePasswordsUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onPasswordsSyncFinished(KJob*)));
-
- emit syncStatus(Rekonq::Passwords, true, i18n("Remote passwords file does NOT exists. Exporting local copy..."));
- _firstTimeSynced = true;
- }
- else
- {
- emit syncStatus(Rekonq::Passwords, false, job->errorString());
- }
- }
- else
- {
- KIO::Job *job = KIO::file_copy(_remotePasswordsUrl, _localPasswordsUrl, -1, KIO::HideProgressInfo | KIO::Overwrite);
- connect(job, SIGNAL(finished(KJob*)), this, SLOT(onPasswordsSyncFinished(KJob*)));
-
- emit syncStatus(Rekonq::Passwords, true, i18n("Remote passwords file exists! Syncing local copy..."));
- _firstTimeSynced = true;
- }
-}
-
-
-void FTPSyncHandler::onPasswordsSyncFinished(KJob *job)
-{
- if (job->error())
- {
- emit syncStatus(Rekonq::Passwords, false, job->errorString());
- emit syncPasswordsFinished(false);
- return;
- }
-
- emit syncPasswordsFinished(true);
-}
diff --git a/src/sync/ftpsynchandler.h b/src/sync/ftpsynchandler.h
deleted file mode 100644
index 2cb1227a..00000000
--- a/src/sync/ftpsynchandler.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef FTP_SYNC_HANDLER_H
-#define FTP_SYNC_HANDLER_H
-
-
-// Local Includes
-#include "synchandler.h"
-
-// KDE Includes
-#include <KUrl>
-
-// Forward Declarations
-class KJob;
-
-
-class FTPSyncHandler : public SyncHandler
-{
- Q_OBJECT
-
-public:
- FTPSyncHandler(QObject *parent = 0);
-
- void syncHistory();
- void syncBookmarks();
- void syncPasswords();
-
- void initialLoadAndCheck();
-
-private Q_SLOTS:
- void onBookmarksSyncFinished(KJob *);
- void onBookmarksStatFinished(KJob *);
-
- void onHistorySyncFinished(KJob *);
- void onHistoryStatFinished(KJob *);
-
- void onPasswordsSyncFinished(KJob *);
- void onPasswordsStatFinished(KJob *);
-
-Q_SIGNALS:
- void syncBookmarksFinished(bool);
- void syncHistoryFinished(bool);
- void syncPasswordsFinished(bool);
-
-private:
- bool syncRelativeEnabled(bool);
-
- QUrl _remoteBookmarksUrl;
- KUrl _localBookmarksUrl;
-
- QUrl _remoteHistoryUrl;
- KUrl _localHistoryUrl;
-
- QUrl _remotePasswordsUrl;
- KUrl _localPasswordsUrl;
-};
-
-#endif // FTP_SYNC_HANDLER_H
diff --git a/src/sync/googlesynchandler.cpp b/src/sync/googlesynchandler.cpp
deleted file mode 100644
index 90de34b4..00000000
--- a/src/sync/googlesynchandler.cpp
+++ /dev/null
@@ -1,437 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Siteshwar Vashisht <siteshwar at gmail dot com>
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "googlesynchandler.h"
-#include "googlesynchandler.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "bookmarkmanager.h"
-
-// KDE Includes
-#include <KStandardDirs>
-#include <klocalizedstring.h>
-#include <kbookmarkmanager.h>
-
-#include <QList>
-#include <QWebPage>
-#include <QWebFrame>
-#include <QWebElement>
-#include <QUrl>
-#include <QWebSettings>
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QDomDocument>
-
-
-GoogleSyncHandler::GoogleSyncHandler(QObject *parent)
- : SyncHandler(parent)
- , _mode(RECEIVE_CHANGES)
- , _doLogin(false)
- , _isSyncing(false)
- , _reply(0)
- , _requestCount(0)
-{
- kDebug() << "Creating Google Bookmarks handler...";
- _webPage.settings()->setAttribute(QWebSettings::AutoLoadImages, false);
- _webPage.settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
- connect(&_webPage, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
-}
-
-
-void GoogleSyncHandler::initialLoadAndCheck()
-{
- if (!ReKonfig::syncEnabled())
- {
- _firstTimeSynced = false;
- return;
- }
-
- // Bookmarks
- if (ReKonfig::syncBookmarks())
- {
- _mode = RECEIVE_CHANGES;
- startLogin();
- }
-
- if (ReKonfig::syncHistory())
- {
- emit syncStatus(Rekonq::History, false, i18n("Not supported!"));
- }
-
- if (ReKonfig::syncHistory())
- {
- emit syncStatus(Rekonq::Passwords, false, i18n("Not supported!"));
- }
-}
-
-
-bool GoogleSyncHandler::syncRelativeEnabled(bool check)
-{
- if (!ReKonfig::syncEnabled())
- return false;
-
- if (!_firstTimeSynced)
- return false;
-
- return check;
-}
-
-
-// ---------------------------------------------------------------------------------------
-
-
-void GoogleSyncHandler::syncHistory()
-{
- kDebug() << "Syncing history not supported!";
- emit syncStatus(Rekonq::History, false, i18n("Syncing history not supported!"));
- emit syncHistoryFinished(false);
-}
-
-
-void GoogleSyncHandler::syncPasswords()
-{
- kDebug() << "Syncing passwords not supported!";
- emit syncStatus(Rekonq::Passwords, false, i18n("Syncing passwords not supported!"));
- emit syncPasswordsFinished(false);
-}
-
-
-void GoogleSyncHandler::syncBookmarks()
-{
-
- if (_isSyncing)
- {
- kDebug() << "Sync already in progress!";
- return;
- }
- _mode = SEND_CHANGES;
- startLogin();
-}
-
-void GoogleSyncHandler::startLogin()
-{
- if (ReKonfig::syncUser().isEmpty() || ReKonfig::syncPass().isEmpty())
- {
- kDebug() << "No username or password!";
- emit syncStatus(Rekonq::Bookmarks, false, i18n("No username or password!"));
- emit syncBookmarksFinished(false);
- return;
- }
-
- _isSyncing = true;
-
- _doLogin = true;
-
- kDebug() << "Loading login page...";
- _webPage.mainFrame()->load(QUrl("http://bookmarks.google.com/"));
-}
-
-//Loading a webpage finished, what action to take is decided based on url we have loaded.
-void GoogleSyncHandler::loadFinished(bool ok)
-{
- kDebug() << "Load Finished" << ok;
- if (!ok)
- {
- kDebug() << "Error loading: " << _webPage.mainFrame()->url();
- emit syncStatus(Rekonq::Bookmarks, false, i18n("Error loading: " + _webPage.mainFrame()->url().toEncoded()));
-
- _isSyncing = false;
- return;
- }
-
- kDebug() << _webPage.mainFrame()->url();
- kDebug() << "Path : " << _webPage.mainFrame()->url().path();
-
- QString path = _webPage.mainFrame()->url().path();
-
- if (path == "/ServiceLogin" && _doLogin == true)
- {
- // Let's login to our Google account
- QWebFrame *frame = _webPage.mainFrame();
-
- QWebElement email = frame->findFirstElement("#Email");
- QWebElement passwd = frame->findFirstElement("#Passwd");
- QWebElement form = frame->findFirstElement("#gaia_loginform");
-
-
-
- email.setAttribute("value", ReKonfig::syncUser());
- passwd.setAttribute("value", ReKonfig::syncPass());
- form.evaluateJavaScript("this.submit();");
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Signing in..."));
-
- // Login only once
- _doLogin = false;
- }
- else if (path == "/bookmarks/")
- {
- // We get to this page after successful login, let's fetch the bookmark list in Xml format.
- QNetworkAccessManager *qnam = _webPage.networkAccessManager();
- QNetworkRequest request;
- request.setUrl(QUrl("http://www.google.com/bookmarks/?output=xml"));
- _reply = qnam->get(request);
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Fetching bookmarks from server..."));
- connect(_reply, SIGNAL(finished()), this, SLOT(fetchingBookmarksFinished()));
- }
- else if (path == "/ServiceLoginAuth")
- {
- emit syncStatus(Rekonq::Bookmarks, false, i18n("Login failed!"));
- _isSyncing = false;
- }
- else if (path == "/bookmarks/mark")
- {
- QWebFrame *frame = _webPage.mainFrame();
-
- QString sigKey = frame->findFirstElement("input[name=sig]").attribute("value");
- kDebug() << "Signature Key is : " << sigKey;
-
- QNetworkAccessManager *qnam = _webPage.networkAccessManager();
-
- if (!_bookmarksToDelete.isEmpty())
- {
-
- for (QSet<QString>::const_iterator iter = _bookmarksToDelete.constBegin(); iter != _bookmarksToDelete.end(); ++iter)
- {
- QNetworkRequest request;
- request.setUrl(QUrl("https://www.google.com/bookmarks/mark?dlq=" + *iter + "&sig=" + sigKey));
-
- kDebug() << "Delete url is : " << request.url();
- QNetworkReply *r = qnam->get(request);
- connect(r, SIGNAL(finished()), this, SLOT(updateBookmarkFinished()));
- ++_requestCount;
- }
- }
-
- if (!_bookmarksToAdd.isEmpty())
- {
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Adding bookmarks on server..."));
- for (QSet<KUrl>::const_iterator iter = _bookmarksToAdd.constBegin(); iter != _bookmarksToAdd.end(); ++iter)
- {
- KBookmark bookmark = rApp->bookmarkManager()->bookmarkForUrl(*iter);
- QByteArray postData;
- postData.append("bkmk=" + QUrl::toPercentEncoding(bookmark.url().url().toUtf8()));
- postData.append("&title=" + QUrl::toPercentEncoding(bookmark.text().toUtf8()));
- postData.append("&annotation=");
- postData.append("&labels=");
- postData.append("&prev=/lookup");
- postData.append("&sig=" + sigKey.toUtf8());
-
- QNetworkRequest request;
- request.setUrl(QUrl("https://www.google.com/bookmarks/mark?sig=" + sigKey + "&btnA"));
- request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
- kDebug() << "Url: " << request.url();
- kDebug() << "Post data is :" << postData;
- QNetworkReply *r = qnam->post(request, postData);
- connect(r, SIGNAL(finished()), this, SLOT(updateBookmarkFinished()));
- ++_requestCount;
- }
- }
-
- _bookmarksToDelete.clear();
- _bookmarksToAdd.clear();
-
- }
- else if (path == "/Logout")
- {
- //Session finished
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Done!"));
- emit syncBookmarksFinished(true);
- _isSyncing = false;
- }
- else
- {
- kDebug() << "Unknown Response!";
- _isSyncing = false;
- }
-
-}
-
-//We received bookmarks stored on server in xml format, now take the action based on which mode we are in.
-void GoogleSyncHandler::fetchingBookmarksFinished()
-{
- QString data = _reply->readAll();
-
- QDomDocument doc("bookmarks");
- doc.setContent(data);
-
- QDomNodeList bookmarksOnServer = doc.elementsByTagName("bookmark");
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Reading bookmarks..."));
-
- BookmarkManager *manager = rApp->bookmarkManager();
- KBookmarkGroup root = manager->rootGroup();
-
-
- if (_mode == RECEIVE_CHANGES)
- {
-
- for (int i = 0; i < bookmarksOnServer.size(); ++i)
- {
-
- QString title = getChildElement(bookmarksOnServer.at(i), "title");
- QString url = getChildElement(bookmarksOnServer.at(i), "url");
-
- KBookmark bookmark = manager->bookmarkForUrl(KUrl(url));
- if (bookmark.isNull())
- {
- //Add bookmark
- kDebug() << "Add bookmark";
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Adding bookmark "));
- root.addBookmark(title.isEmpty() ? url : title, KUrl(url));
- manager->manager()->emitChanged(root);
- }
-
- }
-
- // After receiving changes, we compare local bookmarks with Google bookmarks and if some bookmarks exist locally but not on Google Bookmarks, we add them.
- checkToAddGB(root, bookmarksOnServer);
-
- if (!_bookmarksToAdd.isEmpty())
- {
- kDebug() << "Getting sigkey";
- _webPage.mainFrame()->load(QUrl("https://www.google.com/bookmarks/mark?op=add&hl=en"));
- }
- else
- {
- _webPage.mainFrame()->load(QUrl("https://accounts.google.com/Logout?hl=en"));
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Signing out..."));
- }
- }
- else
- {
- checkToAddGB(root, bookmarksOnServer);
- checkToDeleteGB(manager, bookmarksOnServer);
-
- if (!_bookmarksToAdd.isEmpty() || !_bookmarksToDelete.isEmpty())
- {
- kDebug() << "Getting sigkey";
- _webPage.mainFrame()->load(QUrl("https://www.google.com/bookmarks/mark?op=add&hl=en"));
- }
- else
- {
- _webPage.mainFrame()->load(QUrl("https://accounts.google.com/Logout?hl=en"));
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Signing out..."));
- }
- }
-
- _reply->deleteLater();
-}
-
-//Get value of a child element of a dom node
-QString GoogleSyncHandler::getChildElement(const QDomNode &node, QString name)
-{
- QDomNodeList nodes = node.childNodes();
-
- for (int j = 0; j < nodes.size(); ++j)
- {
- QDomElement element = nodes.at(j).toElement();
-
- if (nodes.at(j).nodeName() == name)
- {
- //kDebug() << "Url : " << element.text();
- return element.text();
- }
- }
- return NULL;
-}
-
-//This method checks whether we have any other bookmarks than the ones which exist on the server
-void GoogleSyncHandler::checkToAddGB(const KBookmarkGroup &root, const QDomNodeList &bookmarksOnServer)
-{
- KBookmark current = root.first();
-
- while (!current.isNull())
- {
- kDebug() << "Checking Url to add on Google Bookmarks: " << current.url();
- bool found = false;
- for (int i = 0; i < bookmarksOnServer.count(); ++i)
- {
- if (current.isGroup())
- {
- kDebug() << "Checking group" << current.text();
- checkToAddGB(current.toGroup(), bookmarksOnServer);
- //skip adding a blank in _bookmarksToAdd
- found = true;
- break;
- }
- else if (current.url().url() == getChildElement(bookmarksOnServer.at(i), "url"))
- {
- found = true;
- }
- }
-
- if (!found)
- {
- kDebug() << "Adding to Google Bookmarks: " << current.url().url();
- _bookmarksToAdd.insert(current.url());
- }
- current = root.next(current);
- }
-}
-
-//Check whether we need to delete bookmarks while sending changes to Google Bookmarks
-void GoogleSyncHandler::checkToDeleteGB(BookmarkManager *manager, const QDomNodeList &bookmarksOnServer)
-{
-
- for (int i = 0; i < bookmarksOnServer.count(); ++i)
- {
- QString url = getChildElement(bookmarksOnServer.at(i), "url");
-
- KBookmark result = manager->bookmarkForUrl(KUrl(url));
- if (result.isNull())
- {
- kDebug() << "Deleting from Google Bookmarks: " << url;
- _bookmarksToDelete.insert(getChildElement(bookmarksOnServer.at(i), "id"));
- }
- }
-
-}
-
-
-//Added or deleted a bookmark on server, check whether we succeed here, and logout when all requests are done!
-void GoogleSyncHandler::updateBookmarkFinished()
-{
- --_requestCount;
- QNetworkReply *reply = dynamic_cast<QNetworkReply*>(sender());
- if (reply->error() != QNetworkReply::NoError)
- kDebug() << "Network Error while adding bookmark to server, code is: " << reply->error();
- else if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute) != 302)
- kDebug() << "Unexpected reply : " << reply->readAll();
- else
- kDebug() << "Success!";
-
- if (_requestCount <= 0)
- {
- _webPage.mainFrame()->load(QUrl("https://accounts.google.com/Logout?hl=en"));
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Signing out..."));
- }
-
-}
diff --git a/src/sync/googlesynchandler.h b/src/sync/googlesynchandler.h
deleted file mode 100644
index 459ce16e..00000000
--- a/src/sync/googlesynchandler.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Siteshwar Vashisht <siteshwar at gmail dot com>
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef GOOGLE_SYNC_HANDLER_H
-#define GOOGLE_SYNC_HANDLER_H
-
-#include <QWebPage>
-
-// Local Includes
-#include "synchandler.h"
-
-// KDE Includes
-#include <KUrl>
-#include <KBookmarkGroup>
-
-// Forward Declarations
-class QNetworkReply;
-class BookmarkManager;
-
-class GoogleSyncHandler : public SyncHandler
-{
- Q_OBJECT
-
-public:
- GoogleSyncHandler(QObject *parent = 0);
-
- void syncHistory();
- void syncBookmarks();
- void syncPasswords();
-
- void initialLoadAndCheck();
-
-private Q_SLOTS:
- void loadFinished(bool);
- void fetchingBookmarksFinished();
- void updateBookmarkFinished();
-
-Q_SIGNALS:
- void syncBookmarksFinished(bool);
- void syncHistoryFinished(bool);
- void syncPasswordsFinished(bool);
-
-private:
- bool syncRelativeEnabled(bool);
- void startLogin();
- void checkToAddGB(const KBookmarkGroup &root, const QDomNodeList &);
- void checkToDeleteGB(BookmarkManager *, const QDomNodeList &);
- QString getChildElement(const QDomNode &node, QString name);
- void checkRequestCount();
-
- enum {SEND_CHANGES, RECEIVE_CHANGES} _mode;
- QUrl _remoteBookmarksUrl;
- bool _doLogin;
- bool _isSyncing;
- QWebPage _webPage;
- QNetworkReply *_reply;
- QSet<KUrl> _bookmarksToAdd;
- QSet<QString> _bookmarksToDelete;
- int _requestCount;
-};
-
-#endif // GOOGLE_SYNC_HANDLER_H
diff --git a/src/sync/operasynchandler.cpp b/src/sync/operasynchandler.cpp
deleted file mode 100644
index b32e315f..00000000
--- a/src/sync/operasynchandler.cpp
+++ /dev/null
@@ -1,911 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Siteshwar Vashisht <siteshwar at gmail dot com>
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "operasynchandler.h"
-#include "operasynchandler.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "bookmarkmanager.h"
-
-// KDE Includes
-#include <KStandardDirs>
-#include <klocalizedstring.h>
-#include <kbookmarkmanager.h>
-
-
-#include <QList>
-#include <QWebPage>
-#include <QWebFrame>
-#include <QWebElement>
-#include <QUrl>
-#include <QWebSettings>
-#include <QNetworkAccessManager>
-#include <QNetworkReply>
-#include <QDomDocument>
-
-
-OperaSyncHandler::OperaSyncHandler(QObject *parent)
- : SyncHandler(parent)
- , _mode(RECEIVE_CHANGES)
- , _doLogin(false)
- , _requestCount(0)
- , _isSyncing(false)
-{
- kDebug() << "Creating Opera Bookmarks handler...";
- _webPage.settings()->setAttribute(QWebSettings::AutoLoadImages, false);
- _webPage.settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
- connect(&_webPage, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
-
- _qoauth.setConsumerKey("zCuj9aUcehaHsfKtcHcg2YYLX42CkxDX");
- _qoauth.setConsumerSecret("xApuyHdDd9DSbTXLDRXuZzwKI2lOYSsl");
-}
-
-
-void OperaSyncHandler::initialLoadAndCheck()
-{
- if (!ReKonfig::syncEnabled())
- {
- _firstTimeSynced = false;
- return;
- }
-
- // Bookmarks
- if (ReKonfig::syncBookmarks())
- {
- _mode = RECEIVE_CHANGES;
- startLogin();
- }
-
- if (ReKonfig::syncHistory())
- {
- emit syncStatus(Rekonq::History, false, i18n("Not supported!"));
- }
-
- if (ReKonfig::syncHistory())
- {
- emit syncStatus(Rekonq::Passwords, false, i18n("Not supported!"));
- }
-}
-
-
-bool OperaSyncHandler::syncRelativeEnabled(bool check)
-{
- if (!ReKonfig::syncEnabled())
- return false;
-
- if (!_firstTimeSynced)
- return false;
-
- return check;
-}
-
-
-// ---------------------------------------------------------------------------------------
-
-
-void OperaSyncHandler::syncHistory()
-{
- kDebug() << "Syncing history not supported!";
- emit syncStatus(Rekonq::History, false, i18n("Syncing history not supported!"));
- emit syncHistoryFinished(false);
-}
-
-
-void OperaSyncHandler::syncPasswords()
-{
- kDebug() << "Syncing passwords not supported!";
- emit syncStatus(Rekonq::Passwords, false, i18n("Syncing passwords not supported!"));
- emit syncPasswordsFinished(false);
-}
-
-
-void OperaSyncHandler::syncBookmarks()
-{
-
- if (_isSyncing)
- {
- kDebug() << "Sync already in progress!";
- return;
- }
- _mode = SEND_CHANGES;
- startLogin();
-}
-
-void OperaSyncHandler::startLogin()
-{
- if (ReKonfig::syncUser().isEmpty() || ReKonfig::syncPass().isEmpty())
- {
- kDebug() << "No username or password!";
- emit syncStatus(Rekonq::Bookmarks, false, i18n("No username or password!"));
- emit syncBookmarksFinished(false);
- return;
- }
-
- _isSyncing = true;
-
- _doLogin = true;
-
- _qoauth.setRequestTimeout(20000);
- _qoauth.ignoreSslErrors();
-
- if (_authToken.isEmpty() || _authTokenSecret.isEmpty())
- {
- // If we have not yet logged into server, we need to fetch OAuth access token and secret from server.
- kDebug() << "Loading login page...";
- QOAuth::ParamMap requestMap;
- requestMap.insert("oauth_callback", "oob");
-
- QOAuth::ParamMap requestParam = _qoauth.requestToken("https://auth.opera.com/service/oauth/request_token", QOAuth::POST,
- QOAuth::HMAC_SHA1, requestMap);
-
- if (_qoauth.error() != QOAuth::NoError)
- {
- kDebug() << "Error occured while fetching request tokens. Error code is : " << _qoauth.error();
- emit syncStatus(Rekonq::Bookmarks, false, i18n("OAuth : Error fetching request token."));
- _isSyncing = false;
- return;
- }
-
- _requestToken = requestParam.value("oauth_token");
- _requestTokenSecret = requestParam.value("oauth_token_secret");
-
- kDebug() << "OAuth Request Token : " << _requestToken;
- kDebug() << "OAuth Request Token Secret : " << _requestTokenSecret;
- kDebug() << QUrl("https://auth.opera.com/service/oauth/authorize?oauth_token=" + QString(_requestToken) + "&oauth_callback=oob");
-
- QString u = QL1S("https://auth.opera.com/service/oauth/authorize?oauth_token=") + QString(_requestToken) + QL1S("&oauth_callback=oob");
- _webPage.mainFrame()->load(QUrl(u));
- }
- else
- {
- // We already have OAuth access token and secret, let's fetch bookmarks from server directly.
- getBookmarks();
- }
-}
-
-
-// Loading a webpage finished, what action to take is decided based on url we have loaded.
-void OperaSyncHandler::loadFinished(bool ok)
-{
- kDebug() << "Load Finished" << ok;
- if (!ok)
- {
- kDebug() << "Error loading: " << _webPage.mainFrame()->url();
- emit syncStatus(Rekonq::Bookmarks, false, i18n("Error loading: " + _webPage.mainFrame()->url().toEncoded()));
-
- _isSyncing = false;
- return;
- }
-
- QString path = _webPage.mainFrame()->url().path();
-
- if (path == "/service/oauth/authorize")
- {
- QWebFrame *mainFrame = _webPage.mainFrame();
- QString html = mainFrame->toHtml();
-
- if (_doLogin == true && html.contains("login-form"))
- {
- kDebug() << "Login page";
- QWebElement form = mainFrame->findFirstElement("#login-form");
- if (form.isNull())
- {
- kDebug() << "form is null";
- }
-
- QWebElement username = form.findFirst("#username");
- QWebElement password = form.findFirst("#password");
- QWebElement button = form.findFirst("input[name=\"grant\"]");
-
- username.setAttribute("value", ReKonfig::syncUser());
- password.setAttribute("value", ReKonfig::syncPass());
-
- button.evaluateJavaScript("this.click();");
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Signing in..."));
-
- _doLogin = false;
- }
- else if (html.contains("verifier"))
- {
- QOAuth::ParamMap authParams;
- QWebElement authkey = mainFrame->findFirstElement("#verifier");
- QByteArray verifier = authkey.toPlainText().toUtf8();
-
- kDebug() << "OAuth verifier code is : " << verifier;
- authParams.insert("oauth_verifier", verifier);
-
- emit syncStatus(Rekonq::Bookmarks, true, i18n("OAuth : Sending verification code."));
- QOAuth::ParamMap resultParam = _qoauth.accessToken("https://auth.opera.com/service/oauth/access_token", QOAuth::POST,
- _requestToken, _requestTokenSecret, QOAuth::HMAC_SHA1, authParams);
-
- if (_qoauth.error() != QOAuth::NoError)
- {
- kDebug() << "Error occurred while fetching access tokens. Error code is : " << _qoauth.error();
- emit syncStatus(Rekonq::Bookmarks, false, i18n("OAuth : Error fetching access token."));
- _isSyncing = false;
- return;
- }
-
- _authToken = resultParam.value("oauth_token");
- _authTokenSecret = resultParam.value("oauth_token_secret");
-
- kDebug() << "OAuth Token : " << _authToken;
- kDebug() << "OAuth Token Secret : " << _authTokenSecret;
-
- _requestToken.clear();
- _requestTokenSecret.clear();
-
- getBookmarks();
- }
- else if (_doLogin == false)
- {
- //Login failed
- emit syncStatus(Rekonq::Bookmarks, false, i18n("Login failed!"));
- kDebug() << "Login failed!";
- _isSyncing = false;
- }
- else
- {
- kDebug() << "Unknown page : " << _webPage.mainFrame()->url();
- _isSyncing = false;
- }
- }
-}
-
-//Fetch all the bookmarks from server
-void OperaSyncHandler::getBookmarks()
-{
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Fetching bookmarks from server..."));
-
- QOAuth::ParamMap requestMap;
-
- requestMap.insert("api_output", "xml");
- kDebug() << "Auth Token : " << _authToken;
- kDebug() << "Auth Token Secret : " << _authTokenSecret;
-
- QByteArray fetchBookmarksUrl = "https://link.api.opera.com/rest/bookmark/descendants/";
- QByteArray urlParams = _qoauth.createParametersString(fetchBookmarksUrl, QOAuth::GET, _authToken, _authTokenSecret, QOAuth::HMAC_SHA1, requestMap, QOAuth::ParseForInlineQuery);
-
- QNetworkRequest request;
-
- fetchBookmarksUrl.append(urlParams);
- //kDebug() << urlstr;
- KIO::TransferJob *job = KIO::get(KUrl(fetchBookmarksUrl), KIO::Reload, KIO::HideProgressInfo);
-
- connect(job, SIGNAL(result(KJob*)), this, SLOT(fetchBookmarksResultSlot(KJob*)));
- connect(job, SIGNAL(data(KIO::Job*, QByteArray)), this, SLOT(fetchBookmarksDataSlot(KIO::Job*, QByteArray)));
-}
-
-void OperaSyncHandler::fetchBookmarksDataSlot(KIO::Job* job, QByteArray data)
-{
- Q_UNUSED(job);
-
- _xmlData += data;
-}
-
-//We have received all the bookmarks which exist on server, now we need to compare them with local bookmarks.
-void OperaSyncHandler::fetchBookmarksResultSlot(KJob* job)
-{
- if (job->error() != 0)
- {
- //Error could be because our OAuth token expired, let's reset it.
- _authToken = "";
- _authTokenSecret = "";
-
- _isSyncing = false;
-
- //Reset _xmlData for next request
- _xmlData = "";
- kDebug() << "Some error!" << job->error();
- return;
- }
-
-// kDebug() << _xmlData;
-
- QDomDocument doc("bookmarks");
- doc.setContent(_xmlData);
- QDomNodeList responseList = doc.elementsByTagName("response");
-
- KBookmarkGroup root = rApp->bookmarkManager()->rootGroup();
-
- if (_mode == RECEIVE_CHANGES)
- {
- handleResponse(responseList, root);
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Done!"));
-// _isSyncing = false;
- _mode = SEND_CHANGES;
- }
-
-
- //After receiving changes from server, send changes to server.
- handleResponse(responseList, root);
-
- QDomElement item = responseList.at(0).toElement();
- KBookmark current = root.first();
-
- while (!current.isNull())
- {
- if (current.isGroup())
- {
- QString groupName = current.fullText();
- QDomElement child = findOperaFolder(item, groupName);
-
- if (child.isNull())
- {
- //Add Opera group here
- kDebug() << "Add group " << groupName;
- KJob *job = addBookmarkFolderOnServer(current.fullText());
- _jobToGroupMap.insert(job, current.toGroup());
- }
- else
- {
- QDomElement grandChild = getChildElement(child, "children");
-
- QString id = getChildString(child, "id");
-
- kDebug() << grandChild.tagName() << id;
-
- if (grandChild.isNull())
- {
- kDebug() << "Grand child is null";
- handleLocalGroup(current.toGroup(), grandChild, id);
- }
- else
- {
- handleLocalGroup(current.toGroup(), grandChild, id);
- }
- }
- }
-
- else
- {
- KUrl url = current.url();
-
- QDomElement child = findOperaBookmark(item, url);
-
- if (child.isNull())
- {
- //Add bookmark on server
- kDebug() << "Add bookmark :" << url;
- addBookmarkOnServer(current.fullText(), current.url().url());
- }
- /* else
- {
- kDebug() << "Bookmark exists :" << url;
- }
- */
- }
-
- current = root.next(current);
- }
-
- decreaseRequestCount();
-
- _xmlData = "";
-}
-
-void OperaSyncHandler::createBookmarkDataSlot(KIO::Job* job, QByteArray data)
-{
- Q_UNUSED(job);
- Q_UNUSED(data);
-
- // kDebug() << data;
- // _xmlData += data;
-}
-
-
-// Check whether bookmark creation was successful on server
-void OperaSyncHandler::createBookmarkResultSlot(KJob* job)
-{
- decreaseRequestCount();
-
- if (job->error() != 0)
- {
- kDebug() << "Some error!" << job->error();
- return;
- }
-}
-
-
-void OperaSyncHandler::createBookmarkFolderDataSlot(KIO::Job* job, QByteArray data)
-{
- QByteArray &value = _jobToResponseMap[job];
- value.append(data);
-}
-
-
-// If bookmark folder (it's empty) was creted successfully on server,
-// we need to add all it's children (which exists in local bookmarks) on server.
-void OperaSyncHandler::createBookmarkFolderResultSlot(KJob* job)
-{
- QByteArray value = _jobToResponseMap[job];
- KBookmarkGroup root = _jobToGroupMap[job];
-
- _jobToResponseMap.remove(job);
- _jobToGroupMap.remove(job);
-
- if (job->error() != 0)
- {
- kDebug() << "Error occured while creating bookmark folder on server. Error code : " << job->error();
- decreaseRequestCount();
- return;
- }
-
- QDomDocument doc("new bookmark");
- doc.setContent(value);
- QDomNodeList responseList = doc.elementsByTagName("response");
-
- if (responseList.size() > 0)
- {
- QDomElement item = responseList.at(0).firstChildElement();
-
- QString parentId = getIdFromResource(item);
-
- handleLocalGroup(root, item, parentId);
-
- }
-
- decreaseRequestCount();
-}
-
-
-// Check whether we deleted a resource on server successfully.
-void OperaSyncHandler::deleteResourceResultSlot(KJob* job)
-{
- decreaseRequestCount();
-
- if (job->error() != 160)
- {
- kDebug() << "Error occurred while deleting resource on server. Error code : " << job->error();
- return;
- }
-}
-
-
-// This function is here just for debugging purpose. We don't need it's output.
-void OperaSyncHandler::deleteResourceDataSlot(KIO::Job* job, QByteArray data)
-{
- Q_UNUSED(job);
- kDebug() << data;
-}
-
-
-// Checks whether a bookmark exists locally or not, and either add it locally or delete from server
-void OperaSyncHandler::handleBookmark(const QDomElement &item, KBookmarkGroup root)
-{
- QString url = getUrlFromResourceProperties(item);
- QString title = getTitleFromResourceProperties(item);
- QString id = getChildString(item, "id");
-
- KBookmark bookmark = findLocalBookmark(root, KUrl(url));
-
- if (bookmark.isNull())
- {
- if (_mode == RECEIVE_CHANGES)
- {
- root.addBookmark(title, KUrl(url));
- rApp->bookmarkManager()->manager()->emitChanged(root);
- }
- else
- {
- //Delete bookmark from server
- kDebug() << "Deleting bookmark from server : " << title;
- deleteResourceOnServer(id);
- }
- }
-
-}
-
-//Traverse through all the children of a bookmark folder
-void OperaSyncHandler::handleBookmarkFolder(const QDomElement &item, KBookmarkGroup &root)
-{
- QDomNode child = item.firstChild();
-
- while (!child.isNull())
- {
- QDomNode resource = child.firstChild();
-
- while (!resource.isNull())
- {
- handleResource(resource, root);
- resource = resource.nextSibling();
- }
- child = child.nextSibling();
- }
-}
-
-//Handle resource tag of xml replied from server
-void OperaSyncHandler::handleResource(const QDomNode &item, KBookmarkGroup &root)
-{
- QDomElement element = item.toElement();
-
- QString itemType = getChildString(item, "item_type");
- if (itemType == "bookmark")
- {
- handleBookmark(element, root);
- }
- else if (itemType == "bookmark_folder")
- {
- QString title = getTitleFromResourceProperties(item.toElement());
- QString id = getChildString(item.toElement(), "id");
- if (title == "Trash") return;
-
- KBookmarkGroup childGroup = findLocalGroup(root, title);
-
- if (_mode == RECEIVE_CHANGES)
- {
- if (childGroup.isNull())
- {
- childGroup = root.createNewFolder(title);
- rApp->bookmarkManager()->manager()->emitChanged(root);
- }
-
- handleBookmarkFolder(element, childGroup);
- }
- else
- {
- if (childGroup.isNull())
- {
- //Delete bookmark folder on server
- kDebug() << "Deleting bookmark folder from server : " << title;
- deleteResourceOnServer(id);
- }
- else
- {
- handleBookmarkFolder(element, childGroup);
- }
- }
- }
-}
-
-//Start traversing the response received from server from <response> tag
-void OperaSyncHandler::handleResponse(const QDomNodeList &responseList, KBookmarkGroup &root)
-{
- if (responseList.size() > 0)
- {
- QDomNode item = responseList.at(0).firstChild();
-
- do
- {
- handleResource(item, root);
- item = item.nextSibling();
- }
- while (!item.isNull());
- }
-}
-
-//This method checks whether we need to add a bookmark or bookmark folder on server which exists only locally
-void OperaSyncHandler::handleLocalGroup(const KBookmarkGroup &root, const QDomElement &item, QString parentId)
-{
- KBookmark current = root.first();
-
- while (!current.isNull())
- {
- if (current.isGroup())
- {
- QString groupName = current.fullText();
- QDomElement child = findOperaFolder(item, groupName);
-
- if (child.isNull())
- {
- //Add Opera group here
- KJob *job = addBookmarkFolderOnServer(current.fullText(), parentId);
- _jobToGroupMap.insert(job, current.toGroup());
- }
- else
- {
- QDomElement grandChild = getChildElement(child, "children");
-
- QString id = getChildString(child, "id");
-
- // FIXME: What about here???
- if (grandChild.isNull())
- {
- handleLocalGroup(current.toGroup(), grandChild, id);
- }
- else
- {
- handleLocalGroup(current.toGroup(), grandChild, id);
- }
- }
- }
- else
- {
- KUrl url = current.url();
-
- QDomElement child = findOperaBookmark(item, url);
-
- if (child.isNull())
- {
- //Add bookmark on server
-
- addBookmarkOnServer(current.fullText(), current.url().url(), parentId);
- }
- /* else
- {
- kDebug() << "Bookmark exists :" << url;
- }
- */
- }
-
- current = root.next(current);
- }
-}
-
-//Add a bookmark on server
-void OperaSyncHandler::addBookmarkOnServer(QString title, QString url, QString parent)
-{
- QOAuth::ParamMap requestMap;
- requestMap.insert("api_output", "xml");
- requestMap.insert("api_method", "create");
- requestMap.insert("item_type", "bookmark");
- requestMap.insert("title", QUrl::toPercentEncoding(title.toUtf8()));
- requestMap.insert("uri", QUrl::toPercentEncoding(url.toUtf8()));
-
- QByteArray requestUrl = "https://link.api.opera.com/rest/bookmark/";
-
- if (!parent.isNull())
- {
- requestUrl.append(parent.toUtf8());
- }
-
- QByteArray postData = _qoauth.createParametersString(requestUrl, QOAuth::POST, _authToken, _authTokenSecret, QOAuth::HMAC_SHA1, requestMap, QOAuth::ParseForRequestContent);
-
- KIO::TransferJob *job = KIO::http_post(KUrl(requestUrl), postData, KIO::HideProgressInfo);
- job->addMetaData("Content-Type", "application/x-www-form-urlencoded");
-
- connect(job, SIGNAL(result(KJob*)), this, SLOT(createBookmarkResultSlot(KJob*)));
- connect(job, SIGNAL(data(KIO::Job*, QByteArray)), this, SLOT(createBookmarkDataSlot(KIO::Job*, QByteArray)));
-
- ++_requestCount;
-}
-
-//Add a bookmark folder on server
-KJob *OperaSyncHandler::addBookmarkFolderOnServer(QString title, QString parent)
-{
- QOAuth::ParamMap requestMap;
- requestMap.insert("api_output", "xml");
- requestMap.insert("api_method", "create");
- requestMap.insert("item_type", "bookmark_folder");
- requestMap.insert("title", QUrl::toPercentEncoding(title.toUtf8()));
-
- QByteArray requestUrl = "https://link.api.opera.com/rest/bookmark/";
- if (!parent.isNull())
- {
- requestUrl.append(parent.toUtf8());
- }
-
- QByteArray postData = _qoauth.createParametersString(requestUrl, QOAuth::POST, _authToken, _authTokenSecret, QOAuth::HMAC_SHA1, requestMap, QOAuth::ParseForRequestContent);
-
- KIO::TransferJob *job = KIO::http_post(KUrl(requestUrl), postData, KIO::HideProgressInfo);
- job->addMetaData("Content-Type", "application/x-www-form-urlencoded");
- _jobToResponseMap.insert(job, "");
-
- connect(job, SIGNAL(result(KJob*)), this, SLOT(createBookmarkFolderResultSlot(KJob*)));
- connect(job, SIGNAL(data(KIO::Job*, QByteArray)), this, SLOT(createBookmarkFolderDataSlot(KIO::Job*, QByteArray)));
-
- ++_requestCount;
- return job;
-}
-
-//Resource could be either a bookmark folder or bookmark.
-void OperaSyncHandler::deleteResourceOnServer(QString id)
-{
- QOAuth::ParamMap requestMap;
- requestMap.insert("api_method", "delete");
-
- QByteArray requestUrl = "https://link.api.opera.com/rest/bookmark/";
-
- if (id.isEmpty())
- {
- kDebug() << "Id is empty!";
- return;
- }
-
- requestUrl.append(id.toUtf8());
- QByteArray postData = _qoauth.createParametersString(requestUrl, QOAuth::POST, _authToken, _authTokenSecret, QOAuth::HMAC_SHA1, requestMap, QOAuth::ParseForRequestContent);
-
- kDebug() << "Deleting Resource : " << id;
-
- KIO::TransferJob *job = KIO::http_post(KUrl(requestUrl), postData, KIO::HideProgressInfo);
- job->addMetaData("Content-Type", "application/x-www-form-urlencoded");
-
- connect(job, SIGNAL(result(KJob*)), this, SLOT(deleteResourceResultSlot(KJob*)));
- connect(job, SIGNAL(data(KIO::Job*, QByteArray)), this, SLOT(deleteResourceDataSlot(KIO::Job*, QByteArray)));
-
- ++_requestCount;
-}
-
-//Get url for a bookmark from xml element of Opera bookmarks
-QString OperaSyncHandler::getUrlFromResourceProperties(const QDomElement &item)
-{
- if (item.tagName() != "resource") return QString();
- QDomNodeList propertiesList = item.elementsByTagName("properties");
-
- if (propertiesList.size() > 0)
- {
- QDomElement properties = propertiesList.at(0).toElement();
- QDomNodeList uriList = properties.elementsByTagName("uri");
- if (uriList.size() > 0)
- return uriList.at(0).toElement().text();
- }
-
- return QString();
-}
-
-//Get title for a bookmark or folder from xml element of Opera bookmarks
-QString OperaSyncHandler::getTitleFromResourceProperties(const QDomElement &item)
-{
- if (item.tagName() != "resource") return QString();
-
- QDomNodeList propertiesList = item.elementsByTagName("properties");
-
- if (propertiesList.size() > 0)
- {
- QDomElement properties = propertiesList.at(0).toElement();
- QDomNodeList titleList = properties.elementsByTagName("title");
- if (titleList.size() > 0)
- return titleList.at(0).toElement().text();
- }
-
- return QString();
-}
-
-//Get id for a bookmark or folder from xml element of Opera bookmarks
-QString OperaSyncHandler::getIdFromResource(const QDomElement &item)
-{
- if (item.tagName() != "resource") return QString();
-
- QDomNodeList idList = item.elementsByTagName("id");
-
- if (idList.size() > 0)
- {
- return idList.at(0).toElement().text();
- }
-
- return QString();
-}
-
-//Get text of a child element of a dom node
-QString OperaSyncHandler::getChildString(const QDomNode &node, const QString &name)
-{
- QDomNodeList nodes = node.childNodes();
-
- for (int j = 0; j < nodes.size(); ++j)
- {
- QDomElement element = nodes.at(j).toElement();
-
- if (nodes.at(j).nodeName() == name)
- {
- return element.text();
- }
- }
- return NULL;
-}
-
-//Get value of a child element of a dom node as an element
-QDomElement OperaSyncHandler::getChildElement(const QDomNode &node, const QString &name)
-{
- QDomNodeList nodes = node.childNodes();
-
- for (int j = 0; j < nodes.size(); ++j)
- {
- QDomElement element = nodes.at(j).toElement();
-
- if (nodes.at(j).nodeName() == name)
- {
- return element;
- }
- }
- return QDomElement();
-}
-
-//Find a bookmark group in a specifiec bookmark group of client
-KBookmarkGroup OperaSyncHandler::findLocalGroup(const KBookmarkGroup &root, const QString &name)
-{
- KBookmark child = root.first();
-
- while (!child.isNull())
- {
- if (child.isGroup() && name == child.fullText())
- {
- break;
- }
- child = root.next(child);
- }
-
- return child.toGroup();
-}
-
-//Find a bookmark in a specifiec bookmark group of client
-KBookmark OperaSyncHandler::findLocalBookmark(const KBookmarkGroup &root, const KUrl &url)
-{
- KBookmark child = root.first();
-
- while (!child.isNull())
- {
- if (!child.isGroup() && url == child.url())
- {
- break;
- }
- child = root.next(child);
- }
-
- return child;
-}
-
-//Find bookmark folder in xml returned by server
-QDomElement OperaSyncHandler::findOperaFolder(const QDomElement &root, const QString &name)
-{
- QDomElement current = root.firstChild().toElement();
-
- while (!current.isNull())
- {
- if ((getChildString(current, "item_type") == "bookmark_folder") && getTitleFromResourceProperties(current) == name)
- break;
- current = current.nextSibling().toElement();
- }
-
- return current;
-}
-
-//Find bookmark in xml returned by server
-QDomElement OperaSyncHandler::findOperaBookmark(const QDomElement &root, const KUrl &url)
-{
- QDomElement current = root.firstChild().toElement();
-
- while (!current.isNull())
- {
- if ((getChildString(current, "item_type") == "bookmark") && KUrl(getUrlFromResourceProperties(current)) == url)
- break;
- current = current.nextSibling().toElement();
- }
-
- return current;
-}
-
-/*While sending changes to server, we need to keep track of requests which have been sent to server
-to check whether syncing is finished.
-*/
-void OperaSyncHandler::decreaseRequestCount()
-{
- if (_requestCount > 0)
- {
- --_requestCount;
- }
-
- if (_requestCount <= 0)
- {
- emit syncStatus(Rekonq::Bookmarks, true, i18n("Done!"));
- _isSyncing = false;
- }
-}
diff --git a/src/sync/operasynchandler.h b/src/sync/operasynchandler.h
deleted file mode 100644
index 794164c1..00000000
--- a/src/sync/operasynchandler.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Siteshwar Vashisht <siteshwar at gmail dot com>
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef OPERA_SYNC_HANDLER_H
-#define OPERA_SYNC_HANDLER_H
-
-#include <QWebPage>
-
-// Local Includes
-#include "synchandler.h"
-
-// KDE Includes
-#include <KUrl>
-#include <KBookmarkGroup>
-#include <KIO/Job>
-
-// Qt Includes
-#include <QtOAuth/QtOAuth>
-
-// Forward Declarations
-class QNetworkReply;
-class BookmarkManager;
-class QWebView;
-
-
-class OperaSyncHandler : public SyncHandler
-{
- Q_OBJECT
-
-public:
- OperaSyncHandler(QObject *parent = 0);
-
- void syncHistory();
- void syncBookmarks();
- void syncPasswords();
-
- void initialLoadAndCheck();
-
-private Q_SLOTS:
- void loadFinished(bool);
-
- void fetchBookmarksDataSlot(KIO::Job*, QByteArray);
- void fetchBookmarksResultSlot(KJob*);
-
- void createBookmarkDataSlot(KIO::Job*, QByteArray);
- void createBookmarkResultSlot(KJob*);
-
- void createBookmarkFolderDataSlot(KIO::Job*, QByteArray);
- void createBookmarkFolderResultSlot(KJob*);
-
- void deleteResourceDataSlot(KIO::Job*, QByteArray);
- void deleteResourceResultSlot(KJob*);
-
-Q_SIGNALS:
- void syncBookmarksFinished(bool);
- void syncHistoryFinished(bool);
- void syncPasswordsFinished(bool);
-
-private:
- enum {SEND_CHANGES, RECEIVE_CHANGES} _mode;
-
- bool syncRelativeEnabled(bool);
- void startLogin();
- void getBookmarks();
-
- void handleBookmark(const QDomElement &item, KBookmarkGroup root);
- void handleBookmarkFolder(const QDomElement &item, KBookmarkGroup &root);
- void handleResource(const QDomNode &item, KBookmarkGroup &root);
- void handleResponse(const QDomNodeList &responseList, KBookmarkGroup &root);
-
- void handleLocalGroup(const KBookmarkGroup &root, const QDomElement &item, QString parentId);
-
- void addBookmarkOnServer(QString, QString, QString parent = QString());
- KJob *addBookmarkFolderOnServer(QString, QString parent = QString());
- void deleteResourceOnServer(QString id);
-
- static QString getUrlFromResourceProperties(const QDomElement &item);
- static QString getTitleFromResourceProperties(const QDomElement &item);
- static QString getIdFromResource(const QDomElement &item);
- static QString getChildString(const QDomNode &node, const QString &name);
- static QDomElement getChildElement(const QDomNode &node, const QString &name);
-
- static KBookmarkGroup findLocalGroup(const KBookmarkGroup &root, const QString &name);
- static KBookmark findLocalBookmark(const KBookmarkGroup &root, const KUrl &url);
-
- static QDomElement findOperaFolder(const QDomElement &root, const QString &name);
- static QDomElement findOperaBookmark(const QDomElement &root, const KUrl &url);
-
- void decreaseRequestCount();
-
-
- bool _doLogin;
-
- QWebPage _webPage;
-
- int _requestCount;
-
- bool _isSyncing;
-
- QOAuth::Interface _qoauth;
-
- QByteArray _requestToken, _requestTokenSecret;
- QByteArray _authToken, _authTokenSecret;
-
- QByteArray _xmlData;
- QMap<KJob*, QByteArray> _jobToResponseMap;
- QMap<KJob*, KBookmarkGroup> _jobToGroupMap;
-};
-
-#endif // OPERA_SYNC_HANDLER_H
diff --git a/src/sync/sync_check.ui b/src/sync/sync_check.ui
deleted file mode 100644
index 158e1e84..00000000
--- a/src/sync/sync_check.ui
+++ /dev/null
@@ -1,149 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SyncCheck</class>
- <widget class="QWidget" name="SyncCheck">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>645</width>
- <height>464</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox_2">
- <property name="title">
- <string>data</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>sync handler</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="syncLabel">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Host</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="hostLabel">
- <property name="text">
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>check</string>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Bookmarks</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="bkMsgLabel">
- <property name="acceptDrops">
- <bool>true</bool>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>History</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="hsLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLabel" name="hsMsgLabel">
- <property name="acceptDrops">
- <bool>true</bool>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Passwords</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLabel" name="psLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QLabel" name="psMsgLabel">
- <property name="acceptDrops">
- <bool>true</bool>
- </property>
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="bkLabel">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>154</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/sync/sync_data.ui b/src/sync/sync_data.ui
deleted file mode 100644
index 73058357..00000000
--- a/src/sync/sync_data.ui
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SyncData</class>
- <widget class="QWidget" name="SyncData">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>378</width>
- <height>369</height>
- </rect>
- </property>
- <property name="minimumSize">
- <size>
- <width>300</width>
- <height>0</height>
- </size>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QGroupBox" name="syncGroupBox">
- <property name="title">
- <string>sync</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QCheckBox" name="kcfg_syncBookmarks">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>bookmarks</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_syncHistory">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>history</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_syncPasswords">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>passwords</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>50</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/sync/sync_ftp_settings.ui b/src/sync/sync_ftp_settings.ui
deleted file mode 100644
index fc29bd4e..00000000
--- a/src/sync/sync_ftp_settings.ui
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SyncFTPSettings</class>
- <widget class="QWidget" name="SyncFTPSettings">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="ftpGroupBox">
- <property name="title">
- <string>remote FTP host settings</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Server:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KLineEdit" name="kcfg_syncHost"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KLineEdit" name="kcfg_syncUser"/>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="KLineEdit" name="kcfg_syncPass"/>
- </item>
- <item row="3" column="1">
- <widget class="KLineEdit" name="kcfg_syncPath"/>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Path:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="KIntNumInput" name="kcfg_syncPort"/>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>Port:</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>124</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- <customwidget>
- <class>KIntNumInput</class>
- <extends>QWidget</extends>
- <header>knuminput.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/sync/sync_google_settings.ui b/src/sync/sync_google_settings.ui
deleted file mode 100644
index d23d083b..00000000
--- a/src/sync/sync_google_settings.ui
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SyncGoogleSettings</class>
- <widget class="QWidget" name="SyncGoogleSettings">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="googleGroupBox">
- <property name="title">
- <string>Google Account Settings</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KLineEdit" name="kcfg_syncUser"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KLineEdit" name="kcfg_syncPass"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="infoLabel">
- <property name="styleSheet">
- <string notr="true">QLabel { color : red; }</string>
- </property>
- <property name="text">
- <string>Only bookmarks will be synchronized.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>124</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/sync/sync_host_type.ui b/src/sync/sync_host_type.ui
deleted file mode 100644
index 30656981..00000000
--- a/src/sync/sync_host_type.ui
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SyncHostType</class>
- <widget class="QWidget" name="SyncHostType">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
- <item>
- <widget class="QCheckBox" name="kcfg_syncEnabled">
- <property name="text">
- <string>Activate sync</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="hostGroupBox">
- <property name="title">
- <string>sync host type</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QRadioButton" name="ftpRadioButton">
- <property name="text">
- <string>FTP</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="googleRadioButton">
- <property name="text">
- <string>Google Sync</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="operaRadioButton">
- <property name="text">
- <string>Opera Sync</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QRadioButton" name="nullRadioButton">
- <property name="text">
- <string>/dev/null</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/sync/sync_opera_settings.ui b/src/sync/sync_opera_settings.ui
deleted file mode 100644
index 86da1cb3..00000000
--- a/src/sync/sync_opera_settings.ui
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>SyncOperaSettings</class>
- <widget class="QWidget" name="SyncOperaSettings">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="operaGroupBox">
- <property name="title">
- <string>Opera Account Settings</string>
- </property>
- <layout class="QFormLayout" name="formLayout">
- <property name="fieldGrowthPolicy">
- <enum>QFormLayout::ExpandingFieldsGrow</enum>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="KLineEdit" name="kcfg_syncUser"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="KLineEdit" name="kcfg_syncPass"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="infoLabel">
- <property name="styleSheet">
- <string notr="true">QLabel { color : red; }</string>
- </property>
- <property name="text">
- <string>Only bookmarks will be synchronized.</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignCenter</set>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>124</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <customwidgets>
- <customwidget>
- <class>KLineEdit</class>
- <extends>QLineEdit</extends>
- <header>klineedit.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/sync/syncassistant.cpp b/src/sync/syncassistant.cpp
deleted file mode 100644
index 7edc1f67..00000000
--- a/src/sync/syncassistant.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "syncassistant.h"
-#include "syncassistant.moc"
-
-// Local Includes
-#include "synccheckwidget.h"
-#include "syncdatawidget.h"
-#include "synchosttypewidget.h"
-
-#include "syncftpsettingswidget.h"
-#include "syncgooglesettingswidget.h"
-#include "syncoperasettingswidget.h"
-
-
-SyncAssistant::SyncAssistant(QWidget *parent)
- : QWizard(parent)
-{
- setWindowTitle(i18n("sync assistant"));
-
- setPage(Page_Type, new SyncHostTypeWidget(this));
- setPage(Page_FTP_Settings, new SyncFTPSettingsWidget(this));
- setPage(Page_Google_Settings, new SyncGoogleSettingsWidget(this));
- setPage(Page_Opera_Settings, new SyncOperaSettingsWidget(this));
- setPage(Page_Data, new SyncDataWidget(this));
- setPage(Page_Check, new SyncCheckWidget(this));
-}
diff --git a/src/sync/syncassistant.h b/src/sync/syncassistant.h
deleted file mode 100644
index f373a5f8..00000000
--- a/src/sync/syncassistant.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SYNC_ASSISTANT_H
-#define SYNC_ASSISTANT_H
-
-
-// KDE Includes
-#include <QWizard>
-
-
-class SyncAssistant : public QWizard
-{
- Q_OBJECT
-
-public:
- enum
- {
- Page_Type,
- Page_FTP_Settings,
- Page_Google_Settings,
- Page_Opera_Settings,
- Page_Data,
- Page_Check
- };
-
- SyncAssistant(QWidget *parent = 0);
-};
-
-#endif
diff --git a/src/sync/synccheckwidget.cpp b/src/sync/synccheckwidget.cpp
deleted file mode 100644
index 4874377f..00000000
--- a/src/sync/synccheckwidget.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "synccheckwidget.h"
-#include "synccheckwidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "syncassistant.h"
-#include "syncmanager.h"
-
-#include "application.h"
-
-// KDE Includes
-#include <KStandardDirs>
-#include <KIcon>
-
-// Qt Includes
-#include <QMovie>
-
-
-SyncCheckWidget::SyncCheckWidget(QWidget *parent)
- : QWizardPage(parent)
-{
- setupUi(this);
-}
-
-
-void SyncCheckWidget::initializePage()
-{
- // set initial values
- if (ReKonfig::syncType() == 0)
- {
- syncLabel->setText(i18n("FTP"));
- hostLabel->setText(ReKonfig::syncHost());
- }
- else if (ReKonfig::syncType() == 1)
- {
- syncLabel->setText(i18n("Google"));
- hostLabel->setText(ReKonfig::syncHost());
- }
- else if (ReKonfig::syncType() == 2)
- {
- syncLabel->setText(i18n("Opera"));
- hostLabel->setText(ReKonfig::syncHost());
- }
- else
- {
- syncLabel->setText(i18n("No sync"));
- hostLabel->setText(i18n("none"));
- }
-
- bkMsgLabel->setText(QString());
- hsMsgLabel->setText(QString());
- psMsgLabel->setText(QString());
-
- KIcon notSyncedIcon(QL1S("dialog-cancel"));
-
- if (!ReKonfig::syncEnabled())
- {
- bkLabel->setPixmap(notSyncedIcon.pixmap(16));
- hsLabel->setPixmap(notSyncedIcon.pixmap(16));
- psLabel->setPixmap(notSyncedIcon.pixmap(16));
- return;
- }
-
- QString loadingGitPath = KStandardDirs::locate("appdata" , "pics/loading.mng");
-
- // Now, load syncManager settings...
- rApp->syncManager()->loadSettings();
-
- SyncHandler *h = rApp->syncManager()->handler();
-
- if (!h)
- {
- bkLabel->setPixmap(notSyncedIcon.pixmap(16));
- hsLabel->setPixmap(notSyncedIcon.pixmap(16));
- psLabel->setPixmap(notSyncedIcon.pixmap(16));
- return;
- }
-
- connect(h, SIGNAL(syncStatus(Rekonq::SyncData, bool, QString)), this, SLOT(updateWidget(Rekonq::SyncData, bool, QString)));
-
-
- // bookmarks
- if (ReKonfig::syncBookmarks())
- {
- QMovie *movie = new QMovie(loadingGitPath, QByteArray(), bkLabel);
- movie->setSpeed(50);
- bkLabel->setMovie(movie);
- movie->start();
- }
- else
- {
- bkLabel->setPixmap(notSyncedIcon.pixmap(16));
- }
-
- // history
- if (ReKonfig::syncHistory())
- {
- QMovie *movie = new QMovie(loadingGitPath, QByteArray(), hsLabel);
- movie->setSpeed(50);
- hsLabel->setMovie(movie);
- movie->start();
- }
- else
- {
- hsLabel->setPixmap(notSyncedIcon.pixmap(16));
- }
-
- // passwords
- if (ReKonfig::syncPasswords())
- {
- QMovie *movie = new QMovie(loadingGitPath, QByteArray(), psLabel);
- movie->setSpeed(50);
- psLabel->setMovie(movie);
- movie->start();
- }
- else
- {
- psLabel->setPixmap(notSyncedIcon.pixmap(16));
- }
-}
-
-
-
-
-void SyncCheckWidget::updateWidget(Rekonq::SyncData type, bool done, QString msg)
-{
- KIcon doneIcon(QL1S("dialog-ok-apply"));
- KIcon failIcon(QL1S("edit-delete"));
-
- switch (type)
- {
- case Rekonq::Bookmarks:
- if (done)
- {
- bkLabel->setPixmap(doneIcon.pixmap(16));
- }
- else
- {
- bkLabel->setPixmap(failIcon.pixmap(16));
- }
- bkMsgLabel->setText(msg);
- break;
-
- case Rekonq::History:
- if (done)
- {
- hsLabel->setPixmap(doneIcon.pixmap(16));
- }
- else
- {
- hsLabel->setPixmap(failIcon.pixmap(16));
- }
- hsMsgLabel->setText(msg);
- break;
-
- case Rekonq::Passwords:
- if (done)
- {
- psLabel->setPixmap(doneIcon.pixmap(16));
- }
- else
- {
- psLabel->setPixmap(failIcon.pixmap(16));
- }
- psMsgLabel->setText(msg);
- break;
-
- default:
- // nothing to do here...
- break;
- };
-}
diff --git a/src/sync/synccheckwidget.h b/src/sync/synccheckwidget.h
deleted file mode 100644
index 312fe9b4..00000000
--- a/src/sync/synccheckwidget.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SYNC_CHECK_WIDGET_H
-#define SYNC_CHECK_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_sync_check.h"
-
-// Qt Includes
-#include <QWizardPage>
-
-
-class SyncCheckWidget : public QWizardPage, private Ui::SyncCheck
-{
- Q_OBJECT
-
-public:
- SyncCheckWidget(QWidget *parent = 0);
- void initializePage();
-
-private Q_SLOTS:
- void updateWidget(Rekonq::SyncData, bool, QString);
-};
-
-#endif // SYNC_CHECK_WIDGET_H
diff --git a/src/sync/syncdatawidget.cpp b/src/sync/syncdatawidget.cpp
deleted file mode 100644
index 635c6239..00000000
--- a/src/sync/syncdatawidget.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "syncdatawidget.h"
-#include "syncdatawidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "syncmanager.h"
-#include "syncassistant.h"
-
-
-SyncDataWidget::SyncDataWidget(QWidget *parent)
- : QWizardPage(parent)
-{
- setupUi(this);
-}
-
-void SyncDataWidget::initializePage()
-{
-
- kcfg_syncBookmarks->setDisabled(true);
- kcfg_syncHistory->setDisabled(true);
- kcfg_syncPasswords->setDisabled(true);
-
- switch (ReKonfig::syncType())
- {
- //Ftp Sync Handler
- case 0:
- kcfg_syncBookmarks->setEnabled(true);
- kcfg_syncHistory->setEnabled(true);
- kcfg_syncPasswords->setEnabled(true);
- break;
- //Google Sync Handler
- case 1:
- //Opera Sync Handler
- case 2:
- kcfg_syncBookmarks->setEnabled(true);
- break;
- default:
- kDebug() << "Unknown sync type!";
- }
-
- kcfg_syncBookmarks->setChecked(ReKonfig::syncBookmarks());
- kcfg_syncHistory->setChecked(ReKonfig::syncHistory());
- kcfg_syncPasswords->setChecked(ReKonfig::syncPasswords());
-
-}
-
-
-int SyncDataWidget::nextId() const
-{
- // save
-
- ReKonfig::setSyncBookmarks(kcfg_syncBookmarks->isChecked());
- ReKonfig::setSyncHistory(kcfg_syncHistory->isChecked());
- ReKonfig::setSyncPasswords(kcfg_syncPasswords->isChecked());
-
- return SyncAssistant::Page_Check;
-}
diff --git a/src/sync/syncdatawidget.h b/src/sync/syncdatawidget.h
deleted file mode 100644
index cfec1d49..00000000
--- a/src/sync/syncdatawidget.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SYNC_DATA_WIDGET_H
-#define SYNC_DATA_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_sync_data.h"
-
-// Qt Includes
-#include <QWizardPage>
-
-
-class SyncDataWidget : public QWizardPage, private Ui::SyncData
-{
- Q_OBJECT
-
-public:
- SyncDataWidget(QWidget *parent = 0);
-
- int nextId() const;
-
- void initializePage();
-
-};
-
-#endif // SYNC_WIDGET_H
diff --git a/src/sync/syncftpsettingswidget.cpp b/src/sync/syncftpsettingswidget.cpp
deleted file mode 100644
index 5eb6bfdc..00000000
--- a/src/sync/syncftpsettingswidget.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "syncftpsettingswidget.h"
-#include "syncftpsettingswidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "syncassistant.h"
-
-
-SyncFTPSettingsWidget::SyncFTPSettingsWidget(QWidget *parent)
- : QWizardPage(parent)
-{
- setupUi(this);
-
- kcfg_syncHost->setText(ReKonfig::syncHost());
- kcfg_syncUser->setText(ReKonfig::syncUser());
- kcfg_syncPass->setText(ReKonfig::syncPass());
- kcfg_syncPath->setText(ReKonfig::syncPath());
- kcfg_syncPort->setValue(ReKonfig::syncPort());
-
- kcfg_syncPass->setPasswordMode(true);
-}
-
-
-int SyncFTPSettingsWidget::nextId() const
-{
- // save
- ReKonfig::setSyncHost(kcfg_syncHost->text());
- ReKonfig::setSyncUser(kcfg_syncUser->text());
- ReKonfig::setSyncPass(kcfg_syncPass->text());
- ReKonfig::setSyncPath(kcfg_syncPath->text());
- ReKonfig::setSyncPort(kcfg_syncPort->value());
-
- return SyncAssistant::Page_Data;
-}
diff --git a/src/sync/syncftpsettingswidget.h b/src/sync/syncftpsettingswidget.h
deleted file mode 100644
index d067eef4..00000000
--- a/src/sync/syncftpsettingswidget.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SYNC_FTP_SETTINGS_WIDGET_H
-#define SYNC_FTP_SETTINGS_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_sync_ftp_settings.h"
-
-// Qt Includes
-#include <QWizardPage>
-
-
-class SyncFTPSettingsWidget : public QWizardPage, private Ui::SyncFTPSettings
-{
- Q_OBJECT
-
-public:
- SyncFTPSettingsWidget(QWidget *parent = 0);
-
- int nextId() const;
-};
-
-#endif // SYNC_FTP_SETTINGS_WIDGET_H
diff --git a/src/sync/syncgooglesettingswidget.cpp b/src/sync/syncgooglesettingswidget.cpp
deleted file mode 100644
index 6c364b38..00000000
--- a/src/sync/syncgooglesettingswidget.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Siteshwar Vashisht <siteshwar at gmail dot com>
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "syncgooglesettingswidget.h"
-#include "syncgooglesettingswidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "syncassistant.h"
-
-
-SyncGoogleSettingsWidget::SyncGoogleSettingsWidget(QWidget *parent)
- : QWizardPage(parent)
-{
- setupUi(this);
- kcfg_syncUser->setText(ReKonfig::syncUser());
- kcfg_syncPass->setText(ReKonfig::syncPass());
-
- kcfg_syncPass->setPasswordMode(true);
-}
-
-
-int SyncGoogleSettingsWidget::nextId() const
-{
- // save
- ReKonfig::setSyncHost("http://bookmarks.google.com/");
- ReKonfig::setSyncUser(kcfg_syncUser->text());
- ReKonfig::setSyncPass(kcfg_syncPass->text());
-
- ReKonfig::setSyncHistory(false);
- ReKonfig::setSyncPasswords(false);
-
- return SyncAssistant::Page_Data;
-}
diff --git a/src/sync/syncgooglesettingswidget.h b/src/sync/syncgooglesettingswidget.h
deleted file mode 100644
index a51b1d2c..00000000
--- a/src/sync/syncgooglesettingswidget.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Siteshwar Vashisht <siteshwar AT gmail.com>
-* Copyright (C) 2011-20112 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SYNC_GOOGLE_SETTINGS_WIDGET_H
-#define SYNC_GOOGLE_SETTINGS_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_sync_google_settings.h"
-
-// Qt Includes
-#include <QWizardPage>
-
-
-class SyncGoogleSettingsWidget : public QWizardPage, private Ui::SyncGoogleSettings
-{
- Q_OBJECT
-
-public:
- SyncGoogleSettingsWidget(QWidget *parent = 0);
-
- int nextId() const;
-};
-
-#endif // SYNC_GOOGLE_SETTINGS_WIDGET_H
diff --git a/src/sync/synchandler.cpp b/src/sync/synchandler.cpp
deleted file mode 100644
index 759af064..00000000
--- a/src/sync/synchandler.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "synchandler.h"
-#include "synchandler.moc"
-
-
-SyncHandler::SyncHandler(QObject *parent)
- : QObject(parent)
- , _firstTimeSynced(false)
-{
-}
-
-
-SyncHandler::~SyncHandler()
-{
-}
diff --git a/src/sync/synchandler.h b/src/sync/synchandler.h
deleted file mode 100644
index 32266d7c..00000000
--- a/src/sync/synchandler.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SYNC_HANDLER_H
-#define SYNC_HANDLER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QObject>
-
-
-class SyncHandler : public QObject
-{
- Q_OBJECT
-
-public:
- SyncHandler(QObject *parent = 0);
- virtual ~SyncHandler();
-
- virtual void syncHistory() = 0;
- virtual void syncBookmarks() = 0;
- virtual void syncPasswords() = 0;
-
- virtual void initialLoadAndCheck() = 0;
-
-Q_SIGNALS:
- void syncStatus(Rekonq::SyncData type, bool syncDone, QString message);
-
-protected:
- bool _firstTimeSynced;
-
-
-};
-
-#endif // SYNC_HANDLER_H
diff --git a/src/sync/synchosttypewidget.cpp b/src/sync/synchosttypewidget.cpp
deleted file mode 100644
index 289f5e5e..00000000
--- a/src/sync/synchosttypewidget.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "synchosttypewidget.h"
-#include "synchosttypewidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "syncassistant.h"
-
-
-SyncHostTypeWidget::SyncHostTypeWidget(QWidget *parent)
- : QWizardPage(parent)
- , _changed(false)
-{
- setupUi(this);
- connect(kcfg_syncEnabled, SIGNAL(clicked()), this, SLOT(hasChanged()));
-
- kcfg_syncEnabled->setChecked(ReKonfig::syncEnabled());
- if (ReKonfig::syncType() == 0)
- ftpRadioButton->setChecked(true);
- else if (ReKonfig::syncType() == 1)
- googleRadioButton->setChecked(true);
- else if (ReKonfig::syncType() == 2)
- operaRadioButton->setChecked(true);
- else
- nullRadioButton->setChecked(true);
-
- enablewidgets(ReKonfig::syncEnabled());
-}
-
-
-bool SyncHostTypeWidget::changed()
-{
- return _changed;
-}
-
-
-void SyncHostTypeWidget::hasChanged()
-{
- enablewidgets(kcfg_syncEnabled->isChecked());
-
- _changed = true;
- emit changed(true);
-}
-
-int SyncHostTypeWidget::nextId() const
-{
- ReKonfig::setSyncEnabled(kcfg_syncEnabled->isChecked());
-
- if (!ReKonfig::syncEnabled())
- return SyncAssistant::Page_Check;
-
- // save
- if (ftpRadioButton->isChecked())
- {
- ReKonfig::setSyncType(0);
- return SyncAssistant::Page_FTP_Settings;
- }
- else if (googleRadioButton->isChecked())
- {
- ReKonfig::setSyncType(1);
- return SyncAssistant::Page_Google_Settings;
- }
- else if (operaRadioButton->isChecked())
- {
- ReKonfig::setSyncType(2);
- return SyncAssistant::Page_Opera_Settings;
- }
- else
- {
- ReKonfig::setSyncType(3);
- return SyncAssistant::Page_Check;
- }
-
-}
-
-void SyncHostTypeWidget::enablewidgets(bool b)
-{
- hostGroupBox->setEnabled(b);
-}
diff --git a/src/sync/synchosttypewidget.h b/src/sync/synchosttypewidget.h
deleted file mode 100644
index 4f577958..00000000
--- a/src/sync/synchosttypewidget.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SYNC_HOST_TYPE_WIDGET_H
-#define SYNC_HOST_TYPE_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_sync_host_type.h"
-
-// Qt Includes
-#include <QWizardPage>
-
-
-class SyncHostTypeWidget : public QWizardPage, private Ui::SyncHostType
-{
- Q_OBJECT
-
-public:
- SyncHostTypeWidget(QWidget *parent = 0);
-
- int nextId() const;
- bool changed();
-
-Q_SIGNALS:
- void changed(bool);
-
-private Q_SLOTS:
- void hasChanged();
-
-private:
- void enablewidgets(bool b);
- bool _changed;
-
-};
-
-#endif // SYNC_HOST_TYPE_WIDGET_H
diff --git a/src/sync/syncmanager.cpp b/src/sync/syncmanager.cpp
deleted file mode 100644
index 78cc4b4e..00000000
--- a/src/sync/syncmanager.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "syncmanager.h"
-#include "syncmanager.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Config Includes
-#include "config-qca2.h"
-#include "config-qtoauth.h"
-
-// Local Includes
-#include "application.h"
-#include "bookmarkmanager.h"
-#include "historymanager.h"
-
-#include "syncassistant.h"
-#include "ftpsynchandler.h"
-#include "googlesynchandler.h"
-
-#if (defined HAVE_QCA2 && defined HAVE_QTOAUTH)
-#include "operasynchandler.h"
-#endif
-
-// KDE Includes
-#include <klocalizedstring.h>
-
-// Qt Includes
-#include <QPointer>
-
-
-SyncManager::SyncManager(QObject *parent)
- : QObject(parent)
-{
- loadSettings();
-}
-
-
-SyncManager::~SyncManager()
-{
- if (!_syncImplementation.isNull())
- {
- delete _syncImplementation.data();
- _syncImplementation.clear();
- }
-}
-
-
-void SyncManager::loadSettings()
-{
- if (ReKonfig::syncEnabled())
- {
- // reset syncer
- if (!_syncImplementation.isNull())
- {
- delete _syncImplementation.data();
- _syncImplementation.clear();
- }
-
- switch (ReKonfig::syncType())
- {
- case 0:
- _syncImplementation = new FTPSyncHandler(this);
- break;
- case 1:
- _syncImplementation = new GoogleSyncHandler(this);
- break;
-#if (defined HAVE_QCA2 && defined HAVE_QTOAUTH)
- case 2:
- _syncImplementation = new OperaSyncHandler(this);
- break;
-#endif
- default:
- kDebug() << "/dev/null";
- return;
- }
-
-
- // --- Connect syncmanager to bookmarks & history manager
-
- // bookmarks
- ReKonfig::syncBookmarks()
- ? connect(rApp->bookmarkManager(), SIGNAL(bookmarksUpdated()), this, SLOT(syncBookmarks()))
- : disconnect(rApp->bookmarkManager(), SIGNAL(bookmarksUpdated()), this, SLOT(syncBookmarks()))
- ;
-
- // history
- ReKonfig::syncHistory()
- ? connect(rApp->historyManager(), SIGNAL(historySaved()), this, SLOT(syncHistory()))
- : disconnect(rApp->historyManager(), SIGNAL(historySaved()), this, SLOT(syncHistory()))
- ;
-
- _syncImplementation.data()->initialLoadAndCheck();
- // NOTE: password sync will be called just on save
- }
- else
- {
- // bookmarks
- disconnect(rApp->bookmarkManager(), SIGNAL(bookmarksUpdated()), this, SLOT(syncBookmarks()));
-
- // history
- disconnect(rApp->historyManager(), SIGNAL(historySaved()), this, SLOT(syncHistory()));
- }
-}
-
-
-void SyncManager::showSettings()
-{
- QPointer<SyncAssistant> dialog = new SyncAssistant();
- dialog->exec();
-
- dialog->deleteLater();
-}
-
-
-// ---------------------------------------------------------------------------------------
-
-
-void SyncManager::syncBookmarks()
-{
- if (!_syncImplementation.isNull())
- {
- _syncImplementation.data()->syncBookmarks();
- }
-}
-
-
-void SyncManager::syncHistory()
-{
- if (!_syncImplementation.isNull())
- {
- _syncImplementation.data()->syncHistory();
- }
-}
-
-
-void SyncManager::syncPasswords()
-{
- if (!_syncImplementation.isNull())
- {
- _syncImplementation.data()->syncPasswords();
- }
-}
-
diff --git a/src/sync/syncmanager.h b/src/sync/syncmanager.h
deleted file mode 100644
index 586f3c4d..00000000
--- a/src/sync/syncmanager.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SYNC_MANAGER_H
-#define SYNC_MANAGER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "synchandler.h"
-
-// Qt Includes
-#include <QObject>
-#include <QWeakPointer>
-
-
-class REKONQ_TESTS_EXPORT SyncManager : public QObject
-{
- Q_OBJECT
-
-public:
- SyncManager(QObject *parent = 0);
- ~SyncManager();
-
- SyncHandler *handler() const
- {
- return _syncImplementation.data();
- };
-
-public Q_SLOTS:
- void syncBookmarks();
- void syncHistory();
- void syncPasswords();
-
- void loadSettings();
- void showSettings();
-
-private:
- QWeakPointer<SyncHandler> _syncImplementation;
-};
-
-#endif // SYNC_MANAGER_H
diff --git a/src/sync/syncoperasettingswidget.cpp b/src/sync/syncoperasettingswidget.cpp
deleted file mode 100644
index a45ae70c..00000000
--- a/src/sync/syncoperasettingswidget.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Siteshwar Vashisht <siteshwar at gmail dot com>
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "syncoperasettingswidget.h"
-#include "syncoperasettingswidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Config Includes
-#include "config-qca2.h"
-#include "config-qtoauth.h"
-
-// Local Includes
-#include "syncassistant.h"
-
-
-SyncOperaSettingsWidget::SyncOperaSettingsWidget(QWidget *parent)
- : QWizardPage(parent)
-{
- setupUi(this);
-
-#if (defined HAVE_QCA2 && defined HAVE_QTOAUTH)
-
- kcfg_syncUser->setText(ReKonfig::syncUser());
- kcfg_syncPass->setText(ReKonfig::syncPass());
-
- kcfg_syncPass->setPasswordMode(true);
-
-#else
-
- kcfg_syncUser->setEnabled(false);
- kcfg_syncPass->setEnabled(false);
-
- infoLabel->setText(i18n("Rekonq has been compiled without support for Opera Sync"));
-
-#endif
-}
-
-
-int SyncOperaSettingsWidget::nextId() const
-{
-#if (defined HAVE_QCA2 && defined HAVE_QTOAUTH)
-
- // save
- ReKonfig::setSyncHost("http://link.opera.com/");
- ReKonfig::setSyncUser(kcfg_syncUser->text());
- ReKonfig::setSyncPass(kcfg_syncPass->text());
-
- ReKonfig::setSyncHistory(false);
- ReKonfig::setSyncPasswords(false);
-
- return SyncAssistant::Page_Data;
-
-#else
-
- return SyncAssistant::Page_Check;
-
-#endif
-}
diff --git a/src/sync/syncoperasettingswidget.h b/src/sync/syncoperasettingswidget.h
deleted file mode 100644
index 53e95699..00000000
--- a/src/sync/syncoperasettingswidget.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Siteshwar Vashisht <siteshwar AT gmail.com>
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SYNC_OPERA_SETTINGS_WIDGET_H
-#define SYNC_OPERA_SETTINGS_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Ui Includes
-#include "ui_sync_opera_settings.h"
-
-// Qt Includes
-#include <QWizardPage>
-
-
-class SyncOperaSettingsWidget : public QWizardPage, private Ui::SyncOperaSettings
-{
- Q_OBJECT
-
-public:
- SyncOperaSettingsWidget(QWidget *parent = 0);
-
- int nextId() const;
-};
-
-#endif // SYNC_OPERA_SETTINGS_WIDGET_H
diff --git a/src/tabbar.cpp b/src/tabbar.cpp
deleted file mode 100644
index 5339a7d0..00000000
--- a/src/tabbar.cpp
+++ /dev/null
@@ -1,568 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-//Self Includes
-#include "tabbar.h"
-#include "tabbar.moc"
-
-// Local Includes
-#include "rekonq.h"
-
-#include "application.h"
-#include "historymanager.h"
-#include "iconmanager.h"
-#include "mainview.h"
-#include "mainwindow.h"
-#include "webpage.h"
-#include "webtab.h"
-#include "websnap.h"
-#include "tabhighlighteffect.h"
-#include "tabpreviewpopup.h"
-#include "searchengine.h"
-
-// KDE Includes
-#include <KActionMenu>
-#include <KMenu>
-#include <KToolBar>
-#include <KColorScheme>
-#include <KAcceleratorManager>
-
-// Qt Includes
-#include <QLabel>
-#include <QLayout>
-#include <QMouseEvent>
-#include <QToolButton>
-#include <QPropertyAnimation>
-#include <QStyleOptionFrameV3>
-#include <QSignalMapper>
-#include <QTimer>
-
-
-static inline QByteArray highlightPropertyName(int index)
-{
- return QByteArray("hAnim").append(QByteArray::number(index));
-}
-
-
-// ----------------------------------------------
-
-
-TabBar::TabBar(QWidget *parent)
- : KTabBar(parent)
- , m_actualIndex(-1)
- , m_currentTabPreviewIndex(-1)
- , m_isFirstTimeOnTab(true)
- , m_tabHighlightEffect(new TabHighlightEffect(this))
- , m_animationMapper(new QSignalMapper(this))
-{
- setElideMode(Qt::ElideRight);
-
- setDocumentMode(true);
- setTabsClosable(true);
- setMovable(true);
-
- setContextMenuPolicy(Qt::CustomContextMenu);
-
- // avoid ambiguos shortcuts. See BUG:275858
- KAcceleratorManager::setNoAccel(this);
-
- connect(this, SIGNAL(contextMenu(int, QPoint)), this, SLOT(contextMenu(int, QPoint)));
- connect(this, SIGNAL(emptyAreaContextMenu(QPoint)), this, SLOT(emptyAreaContextMenu(QPoint)));
-
- connect(m_animationMapper, SIGNAL(mapped(int)), this, SLOT(removeAnimation(int)));
- setGraphicsEffect(m_tabHighlightEffect);
-
- setAnimatedTabHighlighting(ReKonfig::animatedTabHighlighting());
- setAcceptDrops(true);
-}
-
-
-QSize TabBar::tabSizeHint(int index) const
-{
- Q_UNUSED(index);
-
- MainView *view = qobject_cast<MainView *>(parent());
-
- int buttonSize = view->addTabButton()->size().width();
- int tabBarWidth = view->size().width() - buttonSize;
- int baseWidth = view->sizeHint().width() / baseWidthDivisor;
- int minWidth = view->sizeHint().width() / minWidthDivisor;
-
- int w;
- if (baseWidth * count() < tabBarWidth)
- {
- w = baseWidth;
- }
- else
- {
- if (count() > 0 && tabBarWidth / count() > minWidth)
- {
- w = tabBarWidth / count();
- }
- else
- {
- w = minWidth;
- }
- }
-
- int h = KTabBar::tabSizeHint(index).height();
-
- QSize ts = QSize(w, h);
- return ts;
-}
-
-
-void TabBar::cloneTab()
-{
- emit cloneTab(m_actualIndex);
- m_actualIndex = -1;
-}
-
-
-void TabBar::closeTab()
-{
- emit closeTab(m_actualIndex);
- m_actualIndex = -1;
-}
-
-
-void TabBar::closeOtherTabs()
-{
- emit closeOtherTabs(m_actualIndex);
- m_actualIndex = -1;
-}
-
-
-void TabBar::reloadTab()
-{
- emit reloadTab(m_actualIndex);
- m_actualIndex = -1;
-}
-
-
-void TabBar::detachTab()
-{
- emit detachTab(m_actualIndex);
- m_actualIndex = -1;
-}
-
-
-void TabBar::showTabPreview()
-{
- if (m_isFirstTimeOnTab)
- m_isFirstTimeOnTab = false;
-
- //delete previous tab preview
- delete m_previewPopup.data();
- m_previewPopup.clear();
-
- MainView *mv = qobject_cast<MainView *>(parent());
-
- WebTab *indexedTab = mv->webTab(m_currentTabPreviewIndex);
- WebTab *currentTab = mv->webTab(currentIndex());
-
- // check if view && currentView exist before using them :)
- if (!currentTab || !indexedTab)
- return;
-
- // no previews during load
- if (indexedTab->isPageLoading())
- return;
-
- // Make sure the hovered webtab match the current size
- // Only the active one is updated by window resize events
- indexedTab->resize(currentTab->size());
-
- m_previewPopup = new TabPreviewPopup(indexedTab , this);
-
- int tabWidth = tabSizeHint(m_currentTabPreviewIndex).width();
- int tabBarWidth = mv->size().width();
- int leftIndex = tabRect(m_currentTabPreviewIndex).x() + (tabRect(m_currentTabPreviewIndex).width() - tabWidth) / 2;
- int popupWidth = m_previewPopup.data()->thumbnailSize().width();
-
- // Center the popup if the tab width is bigger or smaller
- leftIndex += (tabWidth - popupWidth) / 2;
-
- if (leftIndex < 0)
- {
- leftIndex = 0;
- }
- else if (leftIndex + tabWidth > tabBarWidth)
- {
- leftIndex = tabBarWidth - tabWidth;
- }
-
- QPoint pos(leftIndex, tabRect(m_currentTabPreviewIndex).y() + tabRect(m_currentTabPreviewIndex).height());
- m_previewPopup.data()->show(mapToGlobal(pos));
-}
-
-
-void TabBar::hideEvent(QHideEvent *event)
-{
- if (!event->spontaneous())
- {
- qobject_cast<MainView *>(parent())->addTabButton()->hide();
- }
- KTabBar::hideEvent(event);
-}
-
-
-void TabBar::showEvent(QShowEvent *event)
-{
- KTabBar::showEvent(event);
- if (!event->spontaneous())
- {
- qobject_cast<MainView *>(parent())->addTabButton()->show();
- }
-}
-
-
-void TabBar::mouseMoveEvent(QMouseEvent *event)
-{
- if (count() == 1)
- {
- return;
- }
-
- KTabBar::mouseMoveEvent(event);
-
- if (ReKonfig::hoveringTabOption() == 0)
- {
- //Find the tab under the mouse
- const int tabIndex = tabAt(event->pos());
-
- // if found and not the current tab then show tab preview
- if (tabIndex != -1
- && tabIndex != currentIndex()
- && m_currentTabPreviewIndex != tabIndex
- && event->buttons() == Qt::NoButton
- )
- {
- m_currentTabPreviewIndex = tabIndex;
-
- // if first time over tab, apply a small delay. If not, show it now!
- m_isFirstTimeOnTab
- ? QTimer::singleShot(200, this, SLOT(showTabPreview()))
- : showTabPreview();
- }
-
- // if current tab or not found then hide previous tab preview
- if (tabIndex == currentIndex() || tabIndex == -1)
- {
- if (!m_previewPopup.isNull())
- {
- m_previewPopup.data()->hide();
- }
- m_currentTabPreviewIndex = -1;
- }
- }
-}
-
-
-void TabBar::leaveEvent(QEvent *event)
-{
- if (ReKonfig::hoveringTabOption() == 0)
- {
- //if leave tabwidget then hide previous tab preview
- if (!m_previewPopup.isNull())
- {
- m_previewPopup.data()->hide();
- }
- m_currentTabPreviewIndex = -1;
- m_isFirstTimeOnTab = true;
- }
-
- KTabBar::leaveEvent(event);
-}
-
-
-void TabBar::mousePressEvent(QMouseEvent *event)
-{
- if (ReKonfig::hoveringTabOption() == 0)
- {
- if (!m_previewPopup.isNull())
- {
- m_previewPopup.data()->hide();
- }
- m_currentTabPreviewIndex = -1;
- }
-
- // just close tab on middle mouse click
- if (event->button() == Qt::MidButton)
- return;
-
- KTabBar::mousePressEvent(event);
-}
-
-
-void TabBar::contextMenu(int tab, const QPoint &pos)
-{
- KActionMenu *closedTabsMenu = setupHistoryActions();
-
- m_actualIndex = tab;
-
- KMenu menu;
- MainWindow *mainWindow = rApp->mainWindow();
-
- menu.addAction(mainWindow->actionByName(QL1S("new_tab")));
- menu.addAction(mainWindow->actionByName(QL1S("clone_tab")));
- if (count() > 1)
- {
- menu.addAction(mainWindow->actionByName(QL1S("detach_tab")));
- }
- menu.addAction(mainWindow->actionByName(QL1S("open_last_closed_tab")));
- menu.addAction(closedTabsMenu);
- menu.addSeparator();
- menu.addAction(mainWindow->actionByName(QL1S("close_tab")));
- if (count() > 1)
- {
- menu.addAction(mainWindow->actionByName(QL1S("close_other_tabs")));
- }
- menu.addSeparator();
- menu.addAction(mainWindow->actionByName(QL1S("reload_tab")));
- if (count() > 1)
- {
- menu.addAction(mainWindow->actionByName(QL1S("reload_all_tabs")));
- }
- menu.exec(pos);
-}
-
-
-void TabBar::emptyAreaContextMenu(const QPoint &pos)
-{
- KActionMenu *closedTabsMenu = setupHistoryActions();
-
- KMenu menu;
- MainWindow *mainWindow = rApp->mainWindow();
-
- menu.addAction(mainWindow->actionByName(QL1S("new_tab")));
- menu.addAction(mainWindow->actionByName(QL1S("open_last_closed_tab")));
- menu.addAction(closedTabsMenu);
- menu.addSeparator();
- menu.addAction(mainWindow->actionByName(QL1S("reload_all_tabs")));
-
- KToolBar *mainBar = mainWindow->toolBar("mainToolBar");
- if (!mainBar->isVisible())
- {
- menu.addAction(mainBar->toggleViewAction());
- }
-
- menu.exec(pos);
-}
-
-
-void TabBar::tabRemoved(int index)
-{
- if (ReKonfig::hoveringTabOption() == 0)
- {
- if (!m_previewPopup.isNull())
- {
- m_previewPopup.data()->hide();
- }
- m_currentTabPreviewIndex = -1;
- }
-
- if (ReKonfig::animatedTabHighlighting())
- removeAnimation(index);
-}
-
-
-KActionMenu *TabBar::setupHistoryActions()
-{
- MainWindow *w = rApp->mainWindow();
- MainView *mv = qobject_cast<MainView *>(parent());
-
- QAction *openLastClosedTabAction = w->actionByName(QL1S("open_last_closed_tab"));
-
- bool closedTabsAvailable = (mv->recentlyClosedTabs().size() > 0);
- openLastClosedTabAction->setEnabled(closedTabsAvailable);
-
- KActionMenu *am = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this);
- am->setDelayed(false);
- am->setEnabled(closedTabsAvailable);
-
- if (am->menu())
- am->menu()->clear();
-
- if (!closedTabsAvailable)
- return am;
-
- for (int i = 0; i < mv->recentlyClosedTabs().count(); ++i)
- {
- TabHistory item = mv->recentlyClosedTabs().at(i);
- KAction *a = new KAction(rApp->iconManager()->iconForUrl(item.url), item.title, this);
- a->setData(i);
- connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab()));
- am->addAction(a);
- }
-
- return am;
-}
-
-
-QRect TabBar::tabTextRect(int index)
-{
- QStyleOptionTabV3 option;
- initStyleOption(&option, index);
- return style()->subElementRect(QStyle::SE_TabBarTabText, &option, this);
-}
-
-
-void TabBar::setTabHighlighted(int index)
-{
- const QByteArray propertyName = highlightPropertyName(index);
- const QColor highlightColor = KColorScheme(QPalette::Active, KColorScheme::Window).foreground(KColorScheme::PositiveText).color();
-
- if (tabTextColor(index) != highlightColor)
- {
- if (ReKonfig::animatedTabHighlighting())
- {
- m_tabHighlightEffect->setEnabled(true);
- m_tabHighlightEffect->setProperty(propertyName, qreal(0.9));
- QPropertyAnimation *anim = new QPropertyAnimation(m_tabHighlightEffect, propertyName);
- m_highlightAnimation.insert(propertyName, anim);
-
- //setup the animation
- anim->setStartValue(0.9);
- anim->setEndValue(0.0);
- anim->setDuration(500);
- anim->setLoopCount(2);
- anim->start(QAbstractAnimation::DeleteWhenStopped);
-
- m_animationMapper->setMapping(anim, index);
- connect(anim, SIGNAL(finished()), m_animationMapper, SLOT(map()));
- }
-
- setTabTextColor(index, highlightColor);
- }
-}
-
-
-void TabBar::resetTabHighlighted(int index)
-{
- if (ReKonfig::animatedTabHighlighting())
- removeAnimation(index);
-
- setTabTextColor(index, KColorScheme(QPalette::Active, KColorScheme::Window).foreground(KColorScheme::NormalText).color());
-}
-
-
-void TabBar::removeAnimation(int index)
-{
- const QByteArray propertyName = highlightPropertyName(index);
- m_tabHighlightEffect->setProperty(propertyName, QVariant()); //destroy the property
-
- QPropertyAnimation *anim = m_highlightAnimation.take(propertyName);
- m_animationMapper->removeMappings(anim);
- delete anim;
-
- if (m_highlightAnimation.isEmpty())
- m_tabHighlightEffect->setEnabled(false);
-}
-
-
-void TabBar::setAnimatedTabHighlighting(bool enabled)
-{
- if (enabled)
- m_tabHighlightEffect->setEnabled(true);
- else
- {
- m_tabHighlightEffect->setEnabled(false);
-
- //cleanup
- QHashIterator<QByteArray, QPropertyAnimation*> i(m_highlightAnimation);
- while (i.hasNext())
- {
- i.next();
- m_tabHighlightEffect->setProperty(i.key(), QVariant()); //destroy the property
-
- QPropertyAnimation *anim = m_highlightAnimation.take(i.key());
- m_animationMapper->removeMappings(anim);
- delete anim;
- }
- }
-}
-
-
-void TabBar::dropEvent(QDropEvent* event)
-{
- if (event->mimeData()->hasUrls())
- {
- int urlCount = event->mimeData()->urls().count();
- if (urlCount > 1)
- {
- Q_FOREACH(const QUrl & url, event->mimeData()->urls())
- rApp->loadUrl(url, Rekonq::NewTab);
- }
- else
- rApp->loadUrl(event->mimeData()->urls().first(), Rekonq::NewFocusedTab);
- }
- else if (event->mimeData()->hasText())
- {
- //In case the text is a valid URL
- if (isURLValid(event->mimeData()->text()))
- rApp->loadUrl(KUrl(event->mimeData()->text()), Rekonq::NewFocusedTab);
- else
- {
- KService::Ptr defaultSearchEngine = SearchEngine::defaultEngine();
- if (defaultSearchEngine)
- rApp->loadUrl(KUrl(SearchEngine::buildQuery(defaultSearchEngine, event->mimeData()->text())), Rekonq::NewFocusedTab);
- }
- }
- KTabBar::dropEvent(event);
-}
-
-
-void TabBar::dragEnterEvent(QDragEnterEvent* event)
-{
- if (event->mimeData()->hasUrls() || event->mimeData()->hasText())
- event->acceptProposedAction();
- else
- KTabBar::dragEnterEvent(event);
-}
-
-
-bool TabBar::isURLValid(const QString &url)
-{
- QString editedURL = url;
- bool isValid = false;
- if (editedURL.startsWith(QL1S("http://")) || editedURL.startsWith(QL1S("https://")) || editedURL.startsWith(QL1S("ftp://")))
- editedURL = editedURL.remove(QRegExp("(http|https|ftp)://"));
- if (editedURL.contains(QL1C('.')) && editedURL.indexOf(QL1C('.')) > 0 && editedURL.indexOf(QL1C('.')) < editedURL.length() && !editedURL.trimmed().contains(QL1C(' '))
- && QUrl::fromUserInput(editedURL).isValid())
- isValid = true;
- return isValid;
-}
-
-
-void TabBar::tabLayoutChange()
-{
- KTabBar::tabLayoutChange();
- emit tabLayoutChanged();
-}
diff --git a/src/tabbar.h b/src/tabbar.h
deleted file mode 100644
index 6bdbdc09..00000000
--- a/src/tabbar.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef TABBAR_H
-#define TABBAR_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KTabBar>
-
-// Forward Declarations
-class TabPreviewPopup;
-class TabHighlightEffect;
-
-class KActionMenu;
-
-class QPropertyAnimation;
-class QSignalMapper;
-
-/**
- * Tab bar with a few more features such as
- * a context menu and shortcuts
- *
- */
-class REKONQ_TESTS_EXPORT TabBar : public KTabBar
-{
- Q_OBJECT
-
-public:
- explicit TabBar(QWidget *parent);
-
- void setTabHighlighted(int index);
- void resetTabHighlighted(int index);
- QRect tabTextRect(int index);
- void setAnimatedTabHighlighting(bool enabled);
-
- //constants
- static const int baseWidthDivisor = 4;
- static const int minWidthDivisor = 8;
-
-Q_SIGNALS:
- void cloneTab(int index);
- void closeTab(int index);
- void closeOtherTabs(int index);
- void reloadTab(int index);
- void reloadAllTabs();
- void detachTab(int index);
- void tabLayoutChanged();
-
-protected:
- /**
- * Added to fix tab dimension
- */
- virtual QSize tabSizeHint(int index) const;
-
- virtual void hideEvent(QHideEvent *event);
- virtual void showEvent(QShowEvent *event);
- virtual void mouseMoveEvent(QMouseEvent *event);
- virtual void leaveEvent(QEvent *event);
- virtual void mousePressEvent(QMouseEvent *event);
-
- virtual void tabLayoutChange();
- virtual void tabRemoved(int index);
- void dropEvent(QDropEvent *event);
- void dragEnterEvent(QDragEnterEvent *event);
-
-private Q_SLOTS:
- void cloneTab();
- void closeTab();
- void closeOtherTabs();
- void reloadTab();
- void detachTab();
-
- void contextMenu(int, const QPoint &);
- void emptyAreaContextMenu(const QPoint &);
-
- void showTabPreview();
-
- void removeAnimation(int index);
- bool isURLValid(const QString &url);
-
-private:
- KActionMenu *setupHistoryActions();
-
- friend class MainView;
-
- /**
- * the index in which we are seeing a Context menu
- */
- int m_actualIndex;
-
- QWeakPointer<TabPreviewPopup> m_previewPopup;
-
- /**
- * the index of the tab preview shown
- */
- int m_currentTabPreviewIndex;
- bool m_isFirstTimeOnTab;
-
- //highlightAnimation
- TabHighlightEffect *m_tabHighlightEffect;
- QHash<QByteArray, QPropertyAnimation*> m_highlightAnimation;
- QSignalMapper *m_animationMapper;
-};
-
-#endif
diff --git a/src/tabhighlighteffect.cpp b/src/tabhighlighteffect.cpp
deleted file mode 100644
index 121afd15..00000000
--- a/src/tabhighlighteffect.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 Tröscher Johannes <fritz_van_tom@hotmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "tabhighlighteffect.h"
-#include "tabhighlighteffect.moc"
-
-// Local Includes
-#include "tabbar.h"
-
-// Qt Includes
-#include <QEvent>
-#include <QPainter>
-#include <QVariant>
-
-
-const QByteArray prep("hAnim");
-
-
-// ---------------------------------------------------------------------------
-
-
-TabHighlightEffect::TabHighlightEffect(TabBar *tabBar)
- : QGraphicsEffect(tabBar)
- , m_tabBar(tabBar)
- , m_highlightColor(tabBar->palette().highlight().color().lighter())
-{
- Q_ASSERT(m_tabBar);
-}
-
-
-void TabHighlightEffect::draw(QPainter *painter)
-{
- const QPixmap &pixmap = sourcePixmap();
-
- if (pixmap.isNull())
- return;
-
- painter->drawPixmap(QPoint(0, 0), pixmap);
-
- Q_FOREACH(const QByteArray & propertyName, dynamicPropertyNames())
- {
- if (!propertyName.startsWith(prep))
- continue;
-
- int index = propertyName.right(propertyName.size() - prep.size()).toInt();
- qreal opacity = property(propertyName).toReal();
- QRect textRect = m_tabBar->tabTextRect(index);
-
- if (!boundingRect().contains(textRect))
- continue;
-
- QString tabText = m_tabBar->fontMetrics().elidedText(m_tabBar->tabText(index), Qt::ElideRight,
- textRect.width(), Qt::TextShowMnemonic);
-
- painter->setOpacity(opacity);
- painter->setPen(m_highlightColor);
- painter->drawText(textRect, Qt::AlignCenter | Qt::TextShowMnemonic, tabText);
- }
-}
-
-
-bool TabHighlightEffect::event(QEvent* event)
-{
- if (event->type() == QEvent::DynamicPropertyChange)
- {
- QDynamicPropertyChangeEvent *pChangeEv = dynamic_cast<QDynamicPropertyChangeEvent*>(event);
-
- if (pChangeEv->propertyName().startsWith(prep))
- {
- update();
- return true;
- }
- }
-
- return QGraphicsEffect::event(event);
-}
diff --git a/src/tabhighlighteffect.h b/src/tabhighlighteffect.h
deleted file mode 100644
index 88302283..00000000
--- a/src/tabhighlighteffect.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 Tröscher Johannes <fritz_van_tom@hotmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef TABHIGHLIGHTEFFECT_H
-#define TABHIGHLIGHTEFFECT_H
-
-
-// Qt Includes
-#include <QGraphicsEffect>
-#include <QColor>
-
-// Forward Declarations
-class TabBar;
-
-class QEvent;
-class QPainter;
-
-
-class TabHighlightEffect : public QGraphicsEffect
-{
- Q_OBJECT
-
-public:
- explicit TabHighlightEffect(TabBar *tabBar = 0);
-
-protected:
- virtual void draw(QPainter *painter);
- virtual bool event(QEvent *event);
-
-private:
- TabBar * const m_tabBar;
- QColor m_highlightColor;
-};
-
-#endif // TABHIGHLIGHTEFFECT_H
diff --git a/src/tabpreviewpopup.cpp b/src/tabpreviewpopup.cpp
deleted file mode 100644
index a0311975..00000000
--- a/src/tabpreviewpopup.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Vyacheslav Blinov <blinov dot vyacheslav at gmail dot com>
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-//Self Includes
-#include "tabpreviewpopup.h"
-
-// Rekonq Includes
-#include "webtab.h"
-
-//Qt Includes
-#include <QLabel>
-#include <QVBoxLayout>
-#include <QPalette>
-#include <QBitmap>
-#include <QPoint>
-#include <QPaintEvent>
-#include <QStylePainter>
-#include <QStyleOptionFrame>
-
-
-TabPreviewPopup::TabPreviewPopup(WebTab* tab, QWidget* parent)
- : KPassivePopup(parent),
- m_thumbnail(new QLabel(this)),
- m_url(new QLabel(this))
-{
- m_thumbnail->setAlignment(Qt::AlignHCenter);
- m_url->setAlignment(Qt::AlignHCenter);
-
- QVBoxLayout *vb = new QVBoxLayout(this);
- vb->addWidget(m_thumbnail);
- vb->addWidget(m_url);
- this->setLayout(vb);
-
- layout()->setAlignment(Qt::AlignTop);
- layout()->setMargin(0);
-
- setPopupStyle(KPassivePopup::CustomStyle + 1);
-
- // use ToolTip appearance
- QPalette p;
-
- // adjust background color to use tooltip colors
- p.setColor(backgroundRole(), p.color(QPalette::ToolTipBase));
- p.setColor(QPalette::Base, p.color(QPalette::ToolTipBase));
-
- // adjust foreground color to use tooltip colors
- p.setColor(foregroundRole(), p.color(QPalette::ToolTipText));
- p.setColor(QPalette::Text, p.color(QPalette::ToolTipText));
-
- setPalette(p);
-
- // window flags and attributes
- setWindowFlags(Qt::ToolTip);
- setAttribute(Qt::WA_TranslucentBackground);
- setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
-
- // margins
- const int margin = 1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this);
- setContentsMargins(margin, margin, margin, margin);
-
- setWebTab(tab);
-}
-
-
-TabPreviewPopup::~TabPreviewPopup()
-{
- delete m_thumbnail;
- delete m_url;
-}
-
-
-QSize TabPreviewPopup::thumbnailSize() const
-{
- if (m_thumbnail->pixmap())
- return m_thumbnail->pixmap()->size();
-
- return QSize();
-}
-
-
-void TabPreviewPopup::setWebTab(WebTab* tab)
-{
- // The ratio of the tab
- double ratio = (double) tab->size().height() / tab->size().width();
-
- int w = previewBaseSize;
- int h = previewBaseSize;
-
- // Apply the ratio to the width or the weight to not exceed previewBaseSize
- if (ratio < 1)
- h *= ratio;
- else if (ratio > 1)
- w *= (1 / ratio);
-
- const QPixmap preview = tab->tabPreview(w, h);
-
- if (!preview.isNull())
- {
- setThumbnail(preview);
- setUrl(tab->url().prettyUrl());
- setFixedSize(preview.width(), preview.height() + m_url->heightForWidth(preview.width()));
- }
-}
-
-
-void TabPreviewPopup::setThumbnail(const QPixmap& pixmap)
-{
- m_thumbnail->setPixmap(pixmap);
-}
-
-
-void TabPreviewPopup::setUrl(const QString& text)
-{
- m_url->setText(text);
-}
-
-
-void TabPreviewPopup::setFixedSize(int w, int h)
-{
- KPassivePopup::setFixedSize(w, h);
- const int margin = 1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this);
- m_url->setText(m_url->fontMetrics().elidedText(m_url->text(), Qt::ElideMiddle, this->width() - margin * 2));
-
- //calculate mask
- QStyleOptionFrame opt;
- opt.init(this);
-
- QStyleHintReturnMask mask;
- style()->styleHint(QStyle::SH_ToolTip_Mask, &opt, this, &mask);
- setMask(mask.region);
-}
-
-
-void TabPreviewPopup::paintEvent(QPaintEvent* event)
-{
- QStyleOptionFrame opt;
- opt.init(this);
-
- QStylePainter painter(this);
- painter.setClipRegion(event->region());
- painter.drawPrimitive(QStyle::PE_PanelTipLabel, opt);
-}
diff --git a/src/tabpreviewpopup.h b/src/tabpreviewpopup.h
deleted file mode 100644
index 14f6f0ed..00000000
--- a/src/tabpreviewpopup.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Vyacheslav Blinov <blinov dot vyacheslav at gmail dot com>
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef TABPREVIEWPOPUP_H
-#define TABPREVIEWPOPUP_H
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KPassivePopup>
-
-// forward declatrations
-class WebTab;
-class QLabel;
-
-
-class REKONQ_TESTS_EXPORT TabPreviewPopup : public KPassivePopup
-{
-
-public:
- /**
- * @brief This constructs a new Tab Preview Popup witch will create a thumbnail and title with url from WebTab object
- *
- * @param tab a WebTab object witch will be used to create a preview
- * @param parent
- **/
- explicit TabPreviewPopup(WebTab *tab, QWidget *parent = 0);
- virtual ~TabPreviewPopup();
-
- QSize thumbnailSize() const;
-
- static const int previewBaseSize = 200;
-
-private:
- void setWebTab(WebTab *tab = 0);
- void setUrl(const QString& text);
- void setThumbnail(const QPixmap& pixmap);
- void setFixedSize(int w, int h);
-
-protected:
- void paintEvent(QPaintEvent *event);
-
-private:
- QLabel *m_thumbnail;
- QLabel *m_url;
-};
-
-#endif // TABPREVIEWPOPUP_H
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
deleted file mode 100644
index 560e7755..00000000
--- a/src/tests/CMakeLists.txt
+++ /dev/null
@@ -1,183 +0,0 @@
-##### ---------- General Settings ----------
-
-SET( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
-
-INCLUDE_DIRECTORIES ( ${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/..
- ${CMAKE_CURRENT_SOURCE_DIR}/..
- ${CMAKE_CURRENT_SOURCE_DIR}/../adblock
- ${CMAKE_CURRENT_SOURCE_DIR}/../analyzer
- ${CMAKE_CURRENT_SOURCE_DIR}/../bookmarks
- ${CMAKE_CURRENT_SOURCE_DIR}/../history
- ${CMAKE_CURRENT_SOURCE_DIR}/../opensearch
- ${CMAKE_CURRENT_SOURCE_DIR}/../settings
- ${CMAKE_CURRENT_SOURCE_DIR}/../urlbar
- ${KDE4_INCLUDES}
- ${QT4_INCLUDES}
-)
-
-##### ------------- findbar test
-
-kde4_add_unit_test( findbar_test findbar_test.cpp )
-
-target_link_libraries( findbar_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${QT_QTGUI_LIBRARY}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- mainwindow test
-
-kde4_add_unit_test( mainwindow_test mainwindow_test.cpp )
-
-target_link_libraries( mainwindow_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- mainview test
-
-kde4_add_unit_test( mainview_test mainview_test.cpp )
-
-target_link_libraries( mainview_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- networkaccessmanager test
-
-kde4_add_unit_test( networkaccessmanager_test networkaccessmanager_test.cpp )
-
-target_link_libraries( networkaccessmanager_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- protocolhandler test
-
-kde4_add_unit_test( protocolhandler_test protocolhandler_test.cpp )
-
-target_link_libraries( protocolhandler_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KDEWEBKIT_LIBS}
- ${QT_QTNETWORK_LIBRARY}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- sessionmanager test
-
-kde4_add_unit_test( sessionmanager_test sessionmanager_test.cpp )
-
-target_link_libraries( sessionmanager_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- tabbar test
-
-kde4_add_unit_test( tabbar_test tabbar_test.cpp )
-
-target_link_libraries( tabbar_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- walletbar test
-
-kde4_add_unit_test( walletbar_test walletbar_test.cpp )
-
-target_link_libraries( walletbar_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KDEWEBKIT_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- webpage test
-
-kde4_add_unit_test( webpage_test webpage_test.cpp )
-
-target_link_libraries( webpage_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KDEWEBKIT_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- websnap test
-
-kde4_add_unit_test( websnap_test websnap_test.cpp )
-
-target_link_libraries( websnap_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KDEWEBKIT_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- webtab test
-
-kde4_add_unit_test( webtab_test webtab_test.cpp )
-
-target_link_libraries( webtab_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KDEWEBKIT_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- webview test
-
-kde4_add_unit_test( webview_test webview_test.cpp )
-
-target_link_libraries( webview_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KDEWEBKIT_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- urlbar test
-
-kde4_add_unit_test( urlbar_test urlbar_test.cpp )
-
-target_link_libraries( urlbar_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KDEWEBKIT_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-##### ------------- listitem test
-
-kde4_add_unit_test( listitem_test listitem_test.cpp )
-
-target_link_libraries( listitem_test
- kdeinit_rekonq
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KDEUI_LIBS}
- ${KDE4_KDEWEBKIT_LIBS}
- ${QT_QTTEST_LIBRARY}
-)
-
-############################################################
diff --git a/src/tests/findbar_test.cpp b/src/tests/findbar_test.cpp
deleted file mode 100644
index 3efb2d7b..00000000
--- a/src/tests/findbar_test.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include <QtTest/QtTest>
-
-#include "findbar.h"
-#include "mainwindow.h"
-
-
-class FindBarTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
- void matchCase();
- void notifyMatch();
-
-private:
- FindBar *bar;
- MainWindow *w;
-};
-
-
-// -------------------------------------------
-
-
-void FindBarTest::initTestCase()
-{
- w = new MainWindow;
- bar = new FindBar(w);
-}
-
-
-void FindBarTest::cleanupTestCase()
-{
- delete bar;
-}
-
-void FindBarTest::matchCase()
-{
-
-}
-
-void FindBarTest::notifyMatch()
-{
-}
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(FindBarTest, GUI)
-#include "findbar_test.moc"
diff --git a/src/tests/html/HTTP_tests.html b/src/tests/html/HTTP_tests.html
deleted file mode 100644
index 7a5ac00d..00000000
--- a/src/tests/html/HTTP_tests.html
+++ /dev/null
@@ -1,601 +0,0 @@
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-<title>Test Cases for HTTP Content-Disposition header and RFC 2231/2047 Encoding</title>
-
-<style type="text/css">
-a.plain {
- color: black;
- text-decoration: none;
-}
-body {
- color: black;
- font-family: verdana, helvetica, arial, sans-serif;
- font-size: 10pt;
- margin-left: 2em;
-}
-h1 {
- font-size: 18pt;
-}
-h2 {
- font-size: 14pt;
-}
-h3 {
- font-size: 12pt;
-}
-h4 {
- font-size: 10pt;
-}
-pre {
- border-style: dotted;
- border-width: 1px;
- background-color: #f0f0f0;
-}
-pre.invalid {
- border-style: dotted;
- border-width: 1px;
- background-color: #ff8080;
-}
-table {
- font-size: 9pt;
-}
-table.aside {
- float: right;
- margin: 4px;
- border-style: dotted;
- border-width: 1px;
- background-color: #f0f0f0;
-}
-q {
- font-style: italic;
-}
-th {
- text-align: right;
- vertical-align: top;
-}
-h2, h3, h4 {
- clear: both;
-}
-.fail {
- background-color: #ffd0d0;
-}
-.warn {
- background-color: #ffff80;
-}
-.pass {
- background-color: #d0ffd0;
-}
-.unsupported {
- background-color: #e0e0e0;
-}
-
-</style>
-
-</head>
-
-<body>
-
-<h1>Test Cases for HTTP Content-Disposition header and RFC 2231/2047 Encoding</h1>
-
-
-<h2>Test Cases</h2><div id="c-d-inline"><h3><a href="#c-d-inline" class="plain">Content-Disposition: Disposition-Type Inline</a></h3>
- <p>
- Various tests relating to the "inline" disposition type, see
- <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.1">Section 2.1 of RFC 2183</a>.
- </p>
- <div id="inlonly"><h4><a href="#inlonly" class="plain">inlonly</a>
- [<a href="http://greenbytes.de/tech/tc2231/inlonly.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>inline</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>'inline' only</p><p><em>This should be equivalent to not including the header at all.</em></p></div><div id="inlwithasciifilename"><h4><a href="#inlwithasciifilename" class="plain">inlwithasciifilename</a>
- [<a href="http://greenbytes.de/tech/tc2231/inlwithasciifilename.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>inline; filename="<b>foo.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass
- (uses the filename in subsequent 'save' operation)
- </td></tr><tr class="pass"><td>MSIE8</td><td>pass
- (filename information not used)
- </td></tr><tr class="pass"><td>Op10</td><td>pass
- (filename information not used)
- </td></tr><tr class="pass"><td>Saf4</td><td>pass
- (filename information not used)
- </td></tr><tr class="pass"><td>Konq</td><td>pass
- (filename information not used)
- </td></tr><tr class="pass"><td>Chrome</td><td>pass
- (filename information not used)
- </td></tr></tbody></table><p>
- 'inline', specifying a filename of <code>foo.html</code>
- </p><p><em>
- Some UAs use this filename in a subsequent "save" operation.
- </em></p></div><div id="inlwithasciifilenamepdf"><h4><a href="#inlwithasciifilenamepdf" class="plain">inlwithasciifilenamepdf</a>
- [<a href="http://greenbytes.de/tech/tc2231/inlwithasciifilenamepdf.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>inline; filename="<b>foo.pdf</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass
- (filename information not used)
- </td></tr><tr class="pass"><td>MSIE8</td><td>pass
- (filename information not used)
- </td></tr><tr class="pass"><td>Op10</td><td>pass
- (filename information not used)
- </td></tr><tr class="pass"><td>Saf4</td><td>pass
- (filename information not used)
- </td></tr><tr class="pass"><td>Konq</td><td>pass
- (filename information not used)
- </td></tr><tr class="pass"><td>Chrome</td><td>pass
- (filename information not used)
- </td></tr></tbody></table><p>
- 'inline', specifying a filename of <code>foo.pdf</code>
- </p><p><em>
- Some UAs use this filename in a subsequent "save" operation.
- This variation of the test checks whether whatever handles PDF display
- receives the filename information, and acts upon it
- (this was tested with the latest Acrobat Reader plugin).
- </em></p></div></div><div id="c-d-attachment"><h3><a href="#c-d-attachment" class="plain">Content-Disposition: Disposition-Type Attachment</a></h3>
- <p>
- Various tests relating to the "attchment" disposition type, see
- <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.2">Section 2.2 of RFC 2183</a>.
- </p>
- <div id="attonly"><h4><a href="#attonly" class="plain">attonly</a>
- [<a href="http://greenbytes.de/tech/tc2231/attonly.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>'attachment' only</p><p><em>UA should offer to download the resource.</em></p></div><div id="attonlyucase"><h4><a href="#attonlyucase" class="plain">attonlyucase</a>
- [<a href="http://greenbytes.de/tech/tc2231/attonlyucase.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>ATTACHMENT</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="fail"><td>Konq</td><td>fail</td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>'ATTACHMENT' only</p><p><em>UA should offer to download the resource.</em></p></div><div id="attwithasciifilename"><h4><a href="#attwithasciifilename" class="plain">attwithasciifilename</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithasciifilename.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename="<b>foo.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo.html</code>
- </p><p><em>UA should offer to download the resource as "foo.html".</em></p></div><div id="attwithasciifnescapedchar"><h4><a href="#attwithasciifnescapedchar" class="plain">attwithasciifnescapedchar</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithasciifnescapedchar.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename="<b>f\oo.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="fail"><td>FF3</td><td>fail
- (apparently does not treat the backslash as escape character, replaces it with '_')
- </td></tr><tr class="fail"><td>MSIE8</td><td>fail
- (apparently does not treat the backslash as escape character, replaces it with '_')
- </td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="fail"><td>Saf4</td><td>fail
- (apparently does not treat the backslash as escape character, replaces it with '-')
- </td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="fail"><td>Chrome</td><td>fail
- (saves "oo.html" (what's going on here?))
- </td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>f\oo.html</code> (the first 'o' being escaped)
- </p><p><em>UA should offer to download the resource as "foo.html".</em></p></div><div id="attwithfilenameandextparam"><h4><a href="#attwithfilenameandextparam" class="plain">attwithfilenameandextparam</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfilenameandextparam.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; foo="bar"; filename="<b>foo.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo.html</code>
- and an extension parameter "foo" which should be ignored
- (see <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.8">Section 2.8 of RFC 2183</a>.).
- </p><p><em>UA should offer to download the resource as "foo.html".</em></p></div><div id="attwithasciifilenameucase"><h4><a href="#attwithasciifilenameucase" class="plain">attwithasciifilenameucase</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithasciifilenameucase.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; FILENAME="<b>foo.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="fail"><td>Konq</td><td>fail
- (filename parameter is ignored)
- </td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo.html</code>
- </p><p><em>UA should offer to download the resource as "foo.html".</em></p></div><div id="attwithasciifilenamenq"><h4><a href="#attwithasciifilenamenq" class="plain">attwithasciifilenamenq</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithasciifilenamenq.asis">TEST</a>]
- </h4><pre class="invalid"><b>Content-Disposition: </b>attachment; filename=<b>foo.html</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="warn"><td>FF3</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>MSIE8</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>Op10</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>Saf4</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>Konq</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>Chrome</td><td>warn
- (accepts the unquoted value)
- </td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo.html</code>, but missing
- the quotes.
- </p><p><em>This is invalid according to <a href="http://greenbytes.de/tech/webdav/rfc2616.html#rfc.section.19.5.1">Section 19.5.1 of RFC2616</a>, so UAs should
- ignore it.</em></p></div><div id="attwithisofnplain"><h4><a href="#attwithisofnplain" class="plain">attwithisofnplain</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithisofnplain.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename="<b>foo-ä.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>, using plain ISO-8859-1
- </p><p><em>UA should offer to download the resource as "foo-ä.html".</em></p></div><div id="attwithutf8fnplain"><h4><a href="#attwithutf8fnplain" class="plain">attwithutf8fnplain</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithutf8fnplain.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename="<b>foo-ä.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="fail"><td>FF3</td><td>fail
- (decodes as UTF-8)
- </td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="fail"><td>Chrome</td><td>fail
- (decodes as UTF-8)
- </td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>,
- which happens to be <code>foo-ä.html</code> using UTF-8 encoding.
- </p><p><em>UA should offer to download the resource as "foo-ä.html".
- Displaying "foo-ä.html" instead indicates that the UA tried to be smart by detecting
- something that happens to look like UTF-8.</em></p></div><div id="attwithfnrawpctenca"><h4><a href="#attwithfnrawpctenca" class="plain">attwithfnrawpctenca</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfnrawpctenca.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename="<b>foo-%41.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="fail"><td>MSIE8</td><td>fail
- (displays "foo-A.html")
- </td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="fail"><td>Chrome</td><td>fail
- (displays "foo-A.html" (see <a href="http://code.google.com/p/chromium/issues/detail?id=118">Chrome Issue 118</a>))
- </td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-%41.html</code>
- </p><p><em>UA should offer to download the resource as "foo-%41.html".
- Displaying "foo-A.html" instead would indicate that the UA has attempted
- to percent-decode the parameter.
- </em></p></div><div id="attwithfnrawpctenclong"><h4><a href="#attwithfnrawpctenclong" class="plain">attwithfnrawpctenclong</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfnrawpctenclong.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename="<b>foo-%c3%a4-%e2%82%ac.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="fail"><td>MSIE8</td><td>fail
- (displays "foo-ä-€.html")
- </td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="fail"><td>Chrome</td><td>fail
- (displays "foo-ä-€.html" (see <a href="http://code.google.com/p/chromium/issues/detail?id=118">Chrome Issue 118</a>))
- </td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-%c3%a4-%e2%82%ac.html</code>, using raw percent encoded UTF-8
- to represent <code>foo-ä-€.html</code>
- </p><p><em>UA should offer to download the resource as "foo-%c3%a4-%e2%82%ac.html".
- Displaying "foo-ä-€.html" instead would indicate that the UA has attempted
- to percent-decode the parameter (using UTF-8). Displaying something else
- would indicate that the UA tried to percent-decode, but used a different encoding.
- </em></p></div><div id="attwithasciifilenamews1"><h4><a href="#attwithasciifilenamews1" class="plain">attwithasciifilenamews1</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithasciifilenamews1.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename ="<b>foo.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo.html</code>, with one
- blank space <em>before</em> the equals character.
- </p><p><em>UA should offer to download the resource as "foo.html".</em></p></div><div id="attwithasciifilenamews2"><h4><a href="#attwithasciifilenamews2" class="plain">attwithasciifilenamews2</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithasciifilenamews2.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename= "<b>foo.html</b>"</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="pass"><td>MSIE8</td><td>pass</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="pass"><td>Saf4</td><td>pass</td></tr><tr class="pass"><td>Konq</td><td>pass</td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo.html</code>, with one
- blank space <em>after</em> the equals character.
- </p><p><em>UA should offer to download the resource as "foo.html".</em></p></div><div id="attfnbrokentoken"><h4><a href="#attfnbrokentoken" class="plain">attfnbrokentoken</a>
- [<a href="http://greenbytes.de/tech/tc2231/attfnbrokentoken.asis">TEST</a>]
- </h4><pre class="invalid"><b>Content-Disposition: </b>attachment; filename=<b>foo[1](2).html</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="warn"><td>FF3</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>MSIE8</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>Op10</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>Saf4</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>Konq</td><td>warn
- (accepts the unquoted value)
- </td></tr><tr class="warn"><td>Chrome</td><td>warn
- (accepts the unquoted value)
- </td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo[1](2).html</code>, but missing
- the quotes. Also, "[", "]", "(" and ")" are not allowed in the HTTP <a href="http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p1-messaging-latest.html#rfc.section.1.2.2">token</a>
- production.
- </p><p><em>This is invalid according to <a href="http://greenbytes.de/tech/webdav/rfc2616.html#rfc.section.19.5.1">Section 19.5.1 of RFC2616</a>,
- so UAs should ignore it.</em></p></div></div><div id="c-d-parms"><h3><a href="#c-d-parms" class="plain">Content-Disposition: Additional Parameters</a></h3>
- <p>
- Various tests relating to the additional parameters defined in
- <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2">Section 2 of RFC 2183</a>.
- </p>
- <div id="attcdate"><h4><a href="#attcdate" class="plain">attcdate</a>
- [<a href="http://greenbytes.de/tech/tc2231/attcdate.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; <b>creation-date="Wed, 12 Feb 1997 16:29:51 -0500"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="unsupported"><td>FF3</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>Op10</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>Konq</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr></tbody></table><p>'attachment', plus creation-date (see <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.4">Section 2.4 of RFC 2183</a>)</p><p><em>UA should offer to download the resource. When doing so,
- the creation date should be set to 12 Feb 1997.</em></p></div><div id="attmdate"><h4><a href="#attmdate" class="plain">attmdate</a>
- [<a href="http://greenbytes.de/tech/tc2231/attmdate.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; <b>modification-date="Wed, 12 Feb 1997 16:29:51 -0500"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="unsupported"><td>FF3</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>Op10</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>Konq</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported
- (seems to ignore the parameter)
- </td></tr></tbody></table><p>'attachment', plus modification-date (see <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.5">Section 2.5 of RFC 2183</a>)</p><p><em>UA should offer to download the resource. When doing so,
- the modification date should be set to 12 Feb 1997.</em></p></div></div><div id="c-d-extension"><h3><a href="#c-d-extension" class="plain">Content-Disposition: Disposition-Type Extension</a></h3>
- <p>
- A test checking behavior for disposition type extensions,
- which should be treated as "attachment", see
- <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.8">Section 2.8 of RFC 2183</a>.
- </p>
- <div id="dispext"><h4><a href="#dispext" class="plain">dispext</a>
- [<a href="http://greenbytes.de/tech/tc2231/dispext.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>foobar</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="fail (does not treat it as 'attachment')"><td>MSIE8</td><td>fail (does not treat it as 'attachment')</td></tr><tr class="fail (does not treat it as 'attachment')"><td>Op10</td><td>fail (does not treat it as 'attachment')</td></tr><tr class="fail (does not treat it as 'attachment')"><td>Saf4</td><td>fail (does not treat it as 'attachment')</td></tr><tr class="fail (does not treat it as 'attachment')"><td>Konq</td><td>fail (does not treat it as 'attachment')</td></tr><tr class="pass"><td>Chrome</td><td>pass</td></tr></tbody></table><p>'foobar' only</p><p><em>This should be equivalent to using "attachment".</em></p></div></div><div id="encoding-2231-char"><h3><a href="#encoding-2231-char" class="plain">RFC2231 Encoding: Character Sets</a></h3>
- <p>
- Various tests using the parameter value encoding defined
- in <a href="http://greenbytes.de/tech/webdav/rfc2231.html#rfc.section.4">Section 4 of RFC 2231</a>.
- </p>
- <div id="attwithisofn2231iso"><h4><a href="#attwithisofn2231iso" class="plain">attwithisofn2231iso</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithisofn2231iso.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*=<b>iso-8859-1''foo-%E4.html</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>, using RFC2231 encoded ISO-8859-1
- </p><p><em>UA should offer to download the resource as "foo-ä.html".
- </em></p></div><div id="attwithfn2231utf8"><h4><a href="#attwithfn2231utf8" class="plain">attwithfn2231utf8</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfn2231utf8.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*=<b>UTF-8''foo-%c3%a4-%e2%82%ac.html</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä-€.html</code>, using RFC2231 encoded UTF-8
- </p><p><em>UA should offer to download the resource as "foo-ä-€.html".
- </em></p></div><div id="attwithfn2231noc"><h4><a href="#attwithfn2231noc" class="plain">attwithfn2231noc</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfn2231noc.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*=<b>''foo-%c3%a4-%e2%82%ac.html</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="warn"><td>FF3</td><td>warn
- (decodes as UTF-8)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="warn"><td>Op10</td><td>warn
- (decodes as 8bit encoding (ISO-8859-1?))
- </td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- Behavior is undefined in RFC 2231, the charset part is missing, although UTF-8 was used.
- </p></div><div id="attwithfn2231utf8comp"><h4><a href="#attwithfn2231utf8comp" class="plain">attwithfn2231utf8comp</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfn2231utf8comp.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*=<b>UTF-8''foo-a%cc%88.html</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="warn"><td>Op10</td><td>warn
- (displays "foo-ä.html")
- </td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>, using RFC2231 encoded UTF-8, but
- choosing the decomposed form (lowercase a plus COMBINING DIAERESIS) --
- on a Windows target system, this should be translated to the preferred
- Unicode normal form (composed).
- </p><p><em>UA should offer to download the resource as "foo-ä.html".
- </em></p></div><div id="attwithfn2231utf8-bad"><h4><a href="#attwithfn2231utf8-bad" class="plain">attwithfn2231utf8-bad</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfn2231utf8-bad.asis">TEST</a>]
- </h4><pre class="invalid"><b>Content-Disposition: </b>attachment; filename*=<b>iso-8859-1''foo-%c3%a4-%e2%82%ac.html</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="fail"><td>FF3</td><td>fail
- (falls back to UTF-8)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="warn"><td>Op10</td><td>warn
- (displays the raw octet sequence as if it was ISO-8859-1 (which is internally
- treated as windows-1252, which <em>does</em> allow %82))
- </td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä-€.html</code>, using RFC2231 encoded UTF-8, but declaring ISO-8859-1
- </p><p><em>
- The octet %82 does not represent a valid ISO-8859-1 code point, so
- the UA should really ignore the parameter.
- </em></p></div><div id="attwithfn2231ws1"><h4><a href="#attwithfn2231ws1" class="plain">attwithfn2231ws1</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfn2231ws1.asis">TEST</a>]
- </h4><pre class="invalid"><b>Content-Disposition: </b>attachment; filename<b> *=</b>UTF-8''foo-%c3%a4.html</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="fail"><td>FF3</td><td>fail
- (displays garbage)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>, using RFC2231 encoded UTF-8, with whitespace before "*="
- </p><p><em>
- The parameter is invalid, thus should be ignored.
- </em></p></div><div id="attwithfn2231ws2"><h4><a href="#attwithfn2231ws2" class="plain">attwithfn2231ws2</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfn2231ws2.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename<b>*= </b>UTF-8''foo-%c3%a4.html</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>, using RFC2231 encoded UTF-8, with whitespace after "*="
- </p><p><em>
- UA should offer to download the resource as "foo-ä.html".
- </em></p></div><div id="attwithfn2231ws3"><h4><a href="#attwithfn2231ws3" class="plain">attwithfn2231ws3</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfn2231ws3.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename<b>* =</b>UTF-8''foo-%c3%a4.html</pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>, using RFC2231 encoded UTF-8, with whitespace inside "* ="
- </p><p><em>
- UA should offer to download the resource as "foo-ä.html".
- </em></p></div><div id="attwithfn2231quot"><h4><a href="#attwithfn2231quot" class="plain">attwithfn2231quot</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfn2231quot.asis">TEST</a>]
- </h4><pre class="invalid"><b>Content-Disposition: </b>attachment; filename*=<b>"</b>UTF-8''foo-%c3%a4.html<b>"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="fail"><td>FF3</td><td>fail
- (tries to be helpful by removing the quotes)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>, using RFC2231 encoded UTF-8, with double quotes
- around the parameter value.
- </p><p><em>
- The parameter is invalid, thus should be ignored.
- </em></p></div><div id="attwithfn2231encmissing"><h4><a href="#attwithfn2231encmissing" class="plain">attwithfn2231encmissing</a>
- [<a href="http://greenbytes.de/tech/tc2231/attwithfn2231encmissing.asis">TEST</a>]
- </h4><pre class="invalid"><b>Content-Disposition: </b>attachment; filename*=<b>''foo-%c3%a4.html</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="fail"><td>FF3</td><td>fail
- (sniffs the encoding as UTF-8)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="fail"><td>Op10</td><td>fail
- (assumes a default of ISO-8859-1)
- </td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>, using RFC2231 encoded UTF-8, but
- leaving out the charset field.
- </p><p><em>
- The parameter is invalid, thus should be ignored.
- </em></p></div></div><div id="encoding-2231-cont"><h3><a href="#encoding-2231-cont" class="plain">RFC2231 Encoding: Continuations</a></h3>
- <p>
- Various tests using the parameter value continuation efined
- in <a href="http://greenbytes.de/tech/webdav/rfc2231.html#rfc.section.3">Section 3 of RFC 2231</a>.
- </p>
- <div id="attfncont"><h4><a href="#attfncont" class="plain">attfncont</a>
- [<a href="http://greenbytes.de/tech/tc2231/attfncont.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*0=<b>"foo."</b>; filename*1=<b>"html"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo.html</code>, using RFC2231-style parameter continuations.
- </p><p><em>
- UA should offer to download the resource as "foo.html".
- </em></p></div><div id="attfncontenc"><h4><a href="#attfncontenc" class="plain">attfncontenc</a>
- [<a href="http://greenbytes.de/tech/tc2231/attfncontenc.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*0*=<b>UTF-8''foo-%c3%a4</b>; filename*1=<b>".html"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ä.html</code>, using both RFC2231-style parameter continuations
- and UTF-8 encoding.
- </p><p><em>
- UA should offer to download the resource as "foo-ä.html".
- </em></p></div><div id="attfncontlz"><h4><a href="#attfncontlz" class="plain">attfncontlz</a>
- [<a href="http://greenbytes.de/tech/tc2231/attfncontlz.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*0=<b>"foo"</b>; filename*01=<b>"bar"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="warn"><td>FF3</td><td>warn
- (accepts leading zeros)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="warn"><td>Op10</td><td>warn
- (accepts leading zeros)
- </td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo</code> (the parameter filename*01 should be ignored because of the leading zero)
- </p><p><em>
- UA should offer to download the resource as "foo".
- </em></p></div><div id="attfncontnc"><h4><a href="#attfncontnc" class="plain">attfncontnc</a>
- [<a href="http://greenbytes.de/tech/tc2231/attfncontnc.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*0=<b>"foo"</b>; filename*2=<b>"bar"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="warn"><td>FF3</td><td>warn
- (accepts gaps)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo</code> (the parameter filename*2 because there's no filename*1 parameter)
- </p><p><em>
- UA should offer to download the resource as "foo".
- </em></p></div><div id="attfnconts1"><h4><a href="#attfnconts1" class="plain">attfnconts1</a>
- [<a href="http://greenbytes.de/tech/tc2231/attfnconts1.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*1=<b>"foo."</b>; filename*2=<b>"html"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass</td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment' (the filename* parameters should be ignored because filename*0 is missing)
- </p><p><em>
- UA should offer to download, not getting the filename from the header.
- </em></p></div><div id="attfncontord"><h4><a href="#attfncontord" class="plain">attfncontord</a>
- [<a href="http://greenbytes.de/tech/tc2231/attfncontord.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*1=<b>"bar"</b>; filename*0=<b>"foo"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="fail"><td>FF3</td><td>fail
- (parameters are expected to be ordered)
- </td></tr><tr class="unsupported"><td>MSIE8</td><td>unsupported</td></tr><tr class="pass"><td>Op10</td><td>pass</td></tr><tr class="unsupported"><td>Saf4</td><td>unsupported</td></tr><tr class="unsupported"><td>Konq</td><td>unsupported</td></tr><tr class="unsupported"><td>Chrome</td><td>unsupported</td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foobar</code>
- </p><p><em>
- UA should offer to download the resource as "foobar".
- </em></p></div></div><div id="encoding-2231-fb"><h3><a href="#encoding-2231-fb" class="plain">RFC2231 Encoding: Fallback Behaviour</a></h3>
- <p>
- This tests how the UA behaves when the same parameter name appear
- both in traditional and RFC 2231 extended format.
- </p>
- <div id="attfnboth"><h4><a href="#attfnboth" class="plain">attfnboth</a>
- [<a href="http://greenbytes.de/tech/tc2231/attfnboth.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename="<b>foo-ae.html</b>"; filename*=<b>UTF-8''foo-%c3%a4.html</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass
- (picks the traditionally encoded value -- the first of both)
- </td></tr><tr class="pass"><td>MSIE8</td><td>pass
- (picks the traditionally encoded value -- the first of both)
- </td></tr><tr class="pass"><td>Op10</td><td>pass
- (picks the traditionally encoded value -- the first of both)
- </td></tr><tr class="pass"><td>Saf4</td><td>pass
- (picks the traditionally encoded value -- the first of both)
- </td></tr><tr class="pass"><td>Konq</td><td>pass
- (picks the traditionally encoded value -- the first of both)
- </td></tr><tr class="pass"><td>Chrome</td><td>pass
- (picks the traditionally encoded value -- the first of both)
- </td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ae.html</code> in
- the traditional format, and <code>foo-ä.html</code> in RFC2231 format.
- </p><p><em>
- The behaviour of this undefined. Thus UAs should one of the two values.
- </em></p></div><div id="attfnboth2"><h4><a href="#attfnboth2" class="plain">attfnboth2</a>
- [<a href="http://greenbytes.de/tech/tc2231/attfnboth2.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename*=<b>UTF-8''foo-%c3%a4.html</b>; filename=<b>"foo-ae.html"</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="pass"><td>FF3</td><td>pass
- (picks the RFC2231 encoded value -- the first of both)
- </td></tr><tr class="fail"><td>MSIE8</td><td>fail
- (ignores the parameter (this indicates a parsing bug))
- </td></tr><tr class="pass"><td>Op10</td><td>pass
- (picks the RFC2231 encoded value -- the first of both)
- </td></tr><tr class="pass"><td>Saf4</td><td>pass
- (picks the traditionally encoded value -- the one it understands)
- </td></tr><tr class="pass"><td>Konq</td><td>pass
- (picks the traditionally encoded value -- the one it understands)
- </td></tr><tr class="fail"><td>Chrome</td><td>fail
- (ignores the parameter (this indicates a parsing bug))
- </td></tr></tbody></table><p>
- 'attachment', specifying a filename of <code>foo-ae.html</code> in
- the traditional format, and <code>foo-ä.html</code> in RFC2231 format.
- </p><p><em>
- The behaviour of this undefined. Thus UAs should one of the two values.
- </em></p></div></div><div id="encoding-2047"><h3><a href="#encoding-2047" class="plain">RFC2047 Encoding</a></h3>
- <p>
- These tests RFC 2047 style encoding.
- </p>
- <p>
- Note that according to <a href="http://greenbytes.de/tech/webdav/rfc2047.html#rfc.section.5">Section 5 of RFC 2047</a>,
- this encoding does not apply here: <q cite="http://greenbytes.de/tech/webdav/rfc2047.html#rfc.section.5">An 'encoded-word' MUST NOT appear within a 'quoted-string'.</q>, and
- <q cite="http://greenbytes.de/tech/webdav/rfc2047.html#rfc.section.5">An 'encoded-word' MUST NOT be used in parameter of a MIME
- Content-Type or Content-Disposition field, or in any structured
- field body except within a 'comment' or 'phrase'.</q>
- </p>
- <p>
- Therefore, these tests are only be present in order to check
- whether the UA by mistake tries to implement RFC2047.
- </p>
- <div id="attrfc2047token"><h4><a href="#attrfc2047token" class="plain">attrfc2047token</a>
- [<a href="http://greenbytes.de/tech/tc2231/attrfc2047token.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename=<b>=?ISO-8859-1?Q?foo-=E4.html?=</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="fail"><td>FF3</td><td>fail
- (decodes it anyway to "foo-ä.html")
- </td></tr><tr class="pass"><td>MSIE8</td><td>pass
- (takes the whole value as filename, but does not decode it (replacing question marks by underscores))
- </td></tr><tr class="fail"><td>Op10</td><td>fail
- (displays garbage ("=.htm"))
- </td></tr><tr class="pass"><td>Saf4</td><td>pass
- (takes the whole value as filename, but does not decode it (replacing question marks by underscores))
- </td></tr><tr class="fail"><td>Konq</td><td>fail
- (decodes it anyway to "foo-ä.html")
- </td></tr><tr class="fail"><td>Chrome</td><td>fail
- (decodes it anyway to "foo-ä.html")
- </td></tr></tbody></table><p>
- Uses RFC 2047 style encoded word. "=" is invalid inside the <code>token</code>
- production, so this is invalid.
- </p></div><div id="attrfc2047quoted"><h4><a href="#attrfc2047quoted" class="plain">attrfc2047quoted</a>
- [<a href="http://greenbytes.de/tech/tc2231/attrfc2047quoted.asis">TEST</a>]
- </h4><pre><b>Content-Disposition: </b>attachment; filename=<b>"=?ISO-8859-1?Q?foo-=E4.html?="</b></pre><table class="aside"><thead><tr><th colspan="2">
- Test Results
- </th></tr></thead><tbody><tr class="fail"><td>FF3</td><td>fail
- (decodes it anyway to "foo-ä.html")
- </td></tr><tr class="pass"><td>MSIE8</td><td>pass
- (takes the whole value as filename, but does not decode it)
- </td></tr><tr class="fail"><td>Op10</td><td>fail
- (displays garbage ("=.htm"))
- </td></tr><tr class="pass"><td>Saf4</td><td>pass
- (takes the whole value as filename, but does not decode it)
- </td></tr><tr class="fail"><td>Konq</td><td>fail
- (decodes it anyway to "foo-ä.html")
- </td></tr><tr class="fail"><td>Chrome</td><td>fail
- (decodes it anyway to "foo-ä.html")
- </td></tr></tbody></table><p>
- Uses RFC 2047 style encoded word, using the <code>quoted-string</code> production.
- </p></div></div>
-</body></html> \ No newline at end of file
diff --git a/src/tests/html/charset_ISO_8859_1.html b/src/tests/html/charset_ISO_8859_1.html
deleted file mode 100644
index 587a8bb5..00000000
--- a/src/tests/html/charset_ISO_8859_1.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
-<title>Charset ISO-8859-1</title>
-</head>
-<body>
-CHARSET: ISO 8859 1<br />
-This document contains strange text: à è ì ò ù <br />
-Chinese text: ??, ????????? <br />
-</body>
-</html>
diff --git a/src/tests/html/charset_NULL.html b/src/tests/html/charset_NULL.html
deleted file mode 100644
index 6e5598fa..00000000
--- a/src/tests/html/charset_NULL.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<title>Charset NULL</title>
-</head>
-<body>
-CHARSET: NULL<br />
-This document contains strange text: à è ì ò ù <br />
-Chinese text: ??, ????????? <br />
-</body>
-</html>
diff --git a/src/tests/html/charset_UTF_8.html b/src/tests/html/charset_UTF_8.html
deleted file mode 100644
index cc63d0e1..00000000
--- a/src/tests/html/charset_UTF_8.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-<meta content="text/html; charset=utf8" http-equiv="content-type">
-<title>Charset UTF-8</title>
-</head>
-<body>
-CHARSET: UTF-8<br />
-This document contains strange text: à è ì ò ù <br />
-Chinese text: 激光, 這兩個字是甚麼æ„æ€ <br />
-</body>
-</html>
diff --git a/src/tests/html/font_test.html b/src/tests/html/font_test.html
deleted file mode 100644
index 2e889ea8..00000000
--- a/src/tests/html/font_test.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<html>
-
-<head>
-</head>
-
-<body>
-
-<p style="font-family:'Dejavu Sans'">
-This should be Dejavu Sans.
-</p>
-
-<p style="font-family:'Dejavu Sans Mono'">
-This should be Dejavu Sans Mono.
-</p>
-
-<p style="font-family:'Dejavu Serif'">
-This should be Dejavu Serif.
-</p>
-
-
-</body>
-
-
-</html>
diff --git a/src/tests/html/js_window_close.html b/src/tests/html/js_window_close.html
deleted file mode 100644
index bf945bbc..00000000
--- a/src/tests/html/js_window_close.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<form>
-<input type=button value="Chiudi" onClick="javascript:window.close()" name="button">
-</form> \ No newline at end of file
diff --git a/src/tests/html/link_test.html b/src/tests/html/link_test.html
deleted file mode 100644
index 8798f3bc..00000000
--- a/src/tests/html/link_test.html
+++ /dev/null
@@ -1,165 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
-<title>link tests</title>
-</head>
-
-<body>
-
-<h1>Usual Link Tests</h1>
-
-<table border="1" width="100%">
-<tr>
-<th>URL</th>
-<th>Description</th>
-<th>link</th>
-<th>_blank link</th>
-</tr>
-
-<tr>
-<td>file:///home</td>
-<td>Just a simple local url</td>
-<td><a href="file:///home">link</a></td>
-<td><a href="file:///home" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>gg:ciao</td>
-<td>KDE shortcut</td>
-<td><a href="gg:ciao">link</a></td>
-<td><a href="gg:ciao" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>ftp://ftp.eutelia.it/</td>
-<td>FTP test link</td>
-<td><a href="ftp://ftp.eutelia.it/">link</a></td>
-<td><a href="ftp://ftp.eutelia.it/" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://kde-apps.org</td>
-<td>kde apps let us test css, javascript, adblock, etc..</td>
-<td><a href="http://kde-apps.org">link</a></td>
-<td><a href="http://kde-apps.org" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://pcimpact.com</td>
-<td>PCImpact, a link to test adblock</td>
-<td><a href="http://pcimpact.com">link</a></td>
-<td><a href="http://pcimpact.com" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://www.redhat.com/magazine/015jan06/features/valgrind/</td>
-<td>Sporadic crashes here :(</td>
-<td><a href="http://www.redhat.com/magazine/015jan06/features/valgrind/">link</a></td>
-<td><a href="http://www.redhat.com/magazine/015jan06/features/valgrind/" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://upg.de/</td>
-<td>Doesn't work :(</td>
-<td><a href="http://upg.de/">link</a></td>
-<td><a href="http://upg.de/" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://shop.upg.de/</td>
-<td>The link the previous should open :(</td>
-<td><a href="http://shop.upg.de/">link</a></td>
-<td><a href="http://shop.upg.de/" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>https://launchpad.net/</td>
-<td>Test https link</td>
-<td><a href="https://launchpad.net/">link</a></td>
-<td><a href="https://launchpad.net/" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>https://koesterreich.de/rekonq-test</td>
-<td>SSL test link</td>
-<td><a href="https://koesterreich.de/rekonq-test">link</a></td>
-<td><a href="https://koesterreich.de/rekonq-test" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://www.packtpub.com/article/developing-the-joomla-com</td>
-<td>Some Crashes here :(</td>
-<td><a href="http://www.packtpub.com/article/developing-the-joomla-com">link</a></td>
-<td><a href="http://www.packtpub.com/article/developing-the-joomla-com" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://jamendo.com</td>
-<td>Bug 214321 (CSS hover popups)</td>
-<td><a href="http://jamendo.com">link</a></td>
-<td><a href="http://jamendo.com" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://npaste.de/4h</td>
-<td>WebKit problem with pre tag</td>
-<td><a href="http://npaste.de/4h">link</a></td>
-<td><a href="http://npaste.de/4h" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://wiki.ubuntuusers.de/Bfilter</td>
-<td>Some crashes signaled here (it works here!)</td>
-<td><a href="http://wiki.ubuntuusers.de/Bfilter">link</a></td>
-<td><a href="http://wiki.ubuntuusers.de/Bfilter" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://service.futuremark.com/peacekeeper/index.action</td>
-<td>rekonq 0.3 + Qt 4.6 seems crash here :(</td>
-<td><a href="http://service.futuremark.com/peacekeeper/index.action">link</a></td>
-<td><a href="http://service.futuremark.com/peacekeeper/index.action" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://reddit.com</td>
-<td>Bug 216738, difficult adding comments.</td>
-<td><a href="http://reddit.com">link</a></td>
-<td><a href="http://reddit.com" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://www.osnews.com</td>
-<td>AdBlock related problem</td>
-<td><a href="http://www.osnews.com">link</a></td>
-<td><a href="http://www.osnews.com" target="_blank">link</a></td>
-</tr>
-
-<tr>
-<td>http://ads.cnn.com/</td>
-<td>Again, adblock problem :(</td>
-<td><a href="http://ads.cnn.com/">link</a></td>
-<td><a href="http://ads.cnn.com/" target="_blank">link</a></td>
-</tr>
-
-
-<tr>
-<td>http://ja.wikipedia.org/wiki/特別:最近ã®æ›´æ–°</td>
-<td>KGet import links with particular encoding</td>
-<td><a href="http://ja.wikipedia.org/wiki/特別:最近ã®æ›´æ–°">link</a></td>
-</tr>
-
-<tr>
-<td></td>
-<td></td>
-<td><a href="">link</a></td>
-<td><a href="" target="_blank">link</a></td>
-</tr>
-
-
-</table>
-
-
-</body>
-
-</html>
diff --git a/src/tests/html/test_with_dark_colors.html b/src/tests/html/test_with_dark_colors.html
deleted file mode 100644
index 8bb20d74..00000000
--- a/src/tests/html/test_with_dark_colors.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html><head>
-<meta http-equiv="content-type" content="text/html; charset=UTF-8">
-
- </head><body><h1>Hello World!</h1>
- <p>No colours are set (text or background). This is not legible
-with a dark colour scheme in KDE.</p>
- </body></html> \ No newline at end of file
diff --git a/src/tests/listitem_test.cpp b/src/tests/listitem_test.cpp
deleted file mode 100644
index bfa22139..00000000
--- a/src/tests/listitem_test.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2010-2011 Pierre Rossi <pierre.rossi@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-
-
-#include <qtest_kde.h>
-
-#include "listitem.h"
-
-
-class ListItemTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
-
- void wordHighLighting_data();
- void wordHighLighting();
-
-};
-
-
-// -------------------------------------------
-
-void ListItemTest::initTestCase()
-{
-}
-
-
-void ListItemTest::cleanupTestCase()
-{
-}
-
-
-// -------------------------------------------
-
-void ListItemTest::wordHighLighting_data()
-{
- QTest::addColumn<QString>("string");
- QTest::addColumn<QString>("wordsToHighlight");
- QTest::addColumn<QString>("expected");
-
- QTest::newRow("plan b") << "<i>http://www.google.com/search?q=plan b&ie=UTF-8&oe=UTF-8</i>"
- << "plan b" << "<i>http://www.google.com/search?q=<b>plan</b> <b>b</b>&amp;ie=UTF-8&amp;oe=UTF-8</i>";
- QTest::newRow("plan b #2") << "<i>http://en.wikipedia.org/wiki/Plan_B_(British_musician)</i>"
- << "plan b" << "<i>http://en.wikipedia.org/wiki/<b>Plan</b>_<b>B</b>_(<b>B</b>ritish_musician)</i>";
- QTest::newRow("i") << "<i>http://i.imgur.com/jacoj.jpg</i>" << "i"
- << "<i>http://<b>i</b>.<b>i</b>mgur.com/jacoj.jpg</i>";
- QTest::newRow("i#2") << "KDE - Experience Freedom!" << "i" << "KDE - Exper<b>i</b>ence Freedom!";
- QTest::newRow("i#3") << "The WebKit Open Source Project" << "i" << "The WebK<b>i</b>t Open Source Project";
- QTest::newRow("i#4") << "<i>http://webkit.org/</i>" << "i" << "<i>http://webk<b>i</b>t.org/</i>";
- QTest::newRow("b") << "<i>http://mail.google.com/mail/#inbox</i>" << "b" << "<i>http://mail.google.com/mail/#in<b>b</b>ox</i>";
- QTest::newRow("b#2") << "rekonq, WebKit KDE browser" << "b" << "rekonq, We<b>b</b>Kit KDE <b>b</b>rowser";
- QTest::newRow("<") << "Subject < Section < Wiki" << "<" << "Subject <b>&lt;</b> Section <b>&lt;</b> Wiki";
- QTest::newRow("&") << "<i>http://www.google.com/search?q=qt test&ie=UTF-8&oe=UTF-8</i>" << "&"
- << "<i>http://www.google.com/search?q=qt test<b>&amp;</b>ie=UTF-8<b>&amp;</b>oe=UTF-8</i>";
- QTest::newRow("ciao") << "ciao" << "ciao" << "<b>ciao</b>";
- QTest::newRow("http://ciao") << "http://ciao" << "ciao" << "http://<b>ciao</b>";
-}
-
-void ListItemTest::wordHighLighting()
-{
- QFETCH(QString, string);
- QFETCH(QString, wordsToHighlight);
- QFETCH(QString, expected);
-
- TextLabel test(string, wordsToHighlight);
- QCOMPARE(test.text(), expected);
-}
-
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(ListItemTest, GUI)
-#include "listitem_test.moc"
diff --git a/src/tests/mainview_test.cpp b/src/tests/mainview_test.cpp
deleted file mode 100644
index 8426dba1..00000000
--- a/src/tests/mainview_test.cpp
+++ /dev/null
@@ -1,418 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008 by Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include "mainwindow.h"
-#include "mainview.h"
-#include "webview.h"
-
-
-class MainViewTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
- void tabwidget_data();
- void tabwidget();
-
- void closeTab_data();
- void closeTab();
-
- void currentWebView_data();
- void currentWebView();
-
- void newTab_data();
- void newTab();
-
- void nextTab_data();
- void nextTab();
-
- void previousTab_data();
- void previousTab();
-
- void recentlyClosedTabs_data();
- void recentlyClosedTabs();
-
- void setCurrentTitle_data();
- void setCurrentTitle(const QString &);
-
- void showStatusBarMessage_data();
- void showStatusBarMessage(const QString &);
-
- void currentChanged_data();
- void currentChanged();
-
-private:
- MainWindow *window;
- MainView *view;
-};
-
-
-// -------------------------------------------------------------------------------
-
-
-// This will be called before the first test function is executed.
-// It is only called once.
-void MainViewTest::initTestCase()
-{
- window = new MainWindow;
- view = window->mainView();
-}
-
-// This will be called after the last test function is executed.
-// It is only called once.
-void MainViewTest::cleanupTestCase()
-{
-// delete window; // FIXME: this let the test fail. Why??
-}
-
-// -------------------------------------------
-
-void MainViewTest::tabwidget_data()
-{
-}
-
-void MainViewTest::tabwidget()
-{
- QCOMPARE(view->currentIndex(), -1);
-
-// view->newTab();
-// QCOMPARE(view->currentIndex(), 1);
-// view->newTab();
-// view->nextTab();
-// QCOMPARE(view->currentIndex(), 0);
-//
-// view->previousTab();
-// QCOMPARE(view->currentIndex(), 0);
-}
-
-// -------------------------------------------
-
-void MainViewTest::closeTab_data()
-{
- QTest::addColumn<int>("index");
- QTest::newRow("null") << 0;
-}
-
-
-void MainViewTest::closeTab()
-{
-// QFETCH(int, index);
-//
-// QSignalSpy spy1(view, SIGNAL(linkHovered(QString)));
-// QSignalSpy spy2(view, SIGNAL(setCurrentTitle(QString)));
-// QSignalSpy spy3(view, SIGNAL(tabsChanged()));
-// QSignalSpy spy4(view, SIGNAL(lastTabClosed()));
-//
-// view->newTab();
-// view->closeTab(index);
-// view->newTab();
-// view->closeTab(index);
-// view->newTab();
-//
-// QCOMPARE(spy1.count(), 0);
-// QCOMPARE(spy2.count(), 2);
-// QCOMPARE(spy3.count(), 0);
-// QCOMPARE(spy4.count(), 0);
-}
-
-// -------------------------------------------
-
-void MainViewTest::currentWebView_data()
-{
- /*
- QTest::addColumn<WebView*>("currentWebView");
- QTest::newRow("null") << WebView*();
- */
-}
-
-void MainViewTest::currentWebView()
-{
- /*
- QFETCH(WebView*, currentWebView);
-
- SubMainView widget;
-
- QSignalSpy spy0(view, SIGNAL(linkHovered(QString)));
- QSignalSpy spy2(view, SIGNAL(loadProgress(int)));
- QSignalSpy spy3(view, SIGNAL(setCurrentTitle(QString)));
- QSignalSpy spy4(view, SIGNAL(showStatusBarMessage(QString)));
- QSignalSpy spy5(view, SIGNAL(tabsChanged()));
- QSignalSpy spy6(view, SIGNAL(lastTabClosed()));
-
- QCOMPARE(widget.currentWebView(), currentWebView);
-
- QCOMPARE(spy0.count(), 0);
- QCOMPARE(spy2.count(), 0);
- QCOMPARE(spy3.count(), 0);
- QCOMPARE(spy4.count(), 0);
- QCOMPARE(spy5.count(), 0);
- QCOMPARE(spy6.count(), 0);
- */
- QSKIP("Test is not implemented.", SkipAll);
-}
-
-// -------------------------------------------
-
-void MainViewTest::newTab_data()
-{
- QTest::addColumn<int>("foo");
- QTest::newRow("null") << 0;
-}
-
-
-void MainViewTest::newTab()
-{
-// QFETCH(int, foo);
-//
-// QSignalSpy spy0(view, SIGNAL(linkHovered(QString)));
-// QSignalSpy spy1(view, SIGNAL(setCurrentTitle(QString)));
-// QSignalSpy spy2(view, SIGNAL(showStatusBarMessage(QString)));
-// QSignalSpy spy3(view, SIGNAL(tabsChanged()));
-// QSignalSpy spy4(view, SIGNAL(lastTabClosed()));
-//
-// view->newTab();
-//
-// QCOMPARE(spy0.count(), 0);
-// QCOMPARE(spy1.count(), 0);
-// QCOMPARE(spy2.count(), 0);
-// QCOMPARE(spy3.count(), 0);
-// QCOMPARE(spy4.count(), 0);
-}
-
-// -------------------------------------------
-
-void MainViewTest::nextTab_data()
-{
- QTest::addColumn<int>("foo");
- QTest::newRow("null") << 0;
-}
-
-// public void nextTab()
-void MainViewTest::nextTab()
-{
- /*
- QFETCH(int, foo);
-
- SubMainView widget;
-
- QSignalSpy spy0(view, SIGNAL(linkHovered(QString)));
- QSignalSpy spy2(view, SIGNAL(loadProgress(int)));
- QSignalSpy spy3(view, SIGNAL(setCurrentTitle(QString)));
- QSignalSpy spy4(view, SIGNAL(showStatusBarMessage(QString)));
- QSignalSpy spy5(view, SIGNAL(tabsChanged()));
- QSignalSpy spy6(view, SIGNAL(lastTabClosed()));
-
- widget.nextTab();
-
- QCOMPARE(spy0.count(), 0);
- QCOMPARE(spy2.count(), 0);
- QCOMPARE(spy3.count(), 0);
- QCOMPARE(spy4.count(), 0);
- QCOMPARE(spy5.count(), 0);
- QCOMPARE(spy6.count(), 0);
- */
- QSKIP("Test is not implemented.", SkipAll);
-}
-
-// -------------------------------------------
-
-void MainViewTest::previousTab_data()
-{
- QTest::addColumn<int>("foo");
- QTest::newRow("null") << 0;
-}
-
-
-// public void previousTab()
-void MainViewTest::previousTab()
-{
- /*
- QFETCH(int, foo);
-
- SubMainView widget;
-
- QSignalSpy spy0(view, SIGNAL(linkHovered(QString)));
- QSignalSpy spy2(view, SIGNAL(loadProgress(int)));
- QSignalSpy spy3(view, SIGNAL(setCurrentTitle(QString)));
- QSignalSpy spy4(view, SIGNAL(showStatusBarMessage(QString)));
- QSignalSpy spy5(view, SIGNAL(tabsChanged()));
- QSignalSpy spy6(view, SIGNAL(lastTabClosed()));
-
- widget.previousTab();
-
- QCOMPARE(spy0.count(), 0);
- QCOMPARE(spy2.count(), 0);
- QCOMPARE(spy3.count(), 0);
- QCOMPARE(spy4.count(), 0);
- QCOMPARE(spy5.count(), 0);
- QCOMPARE(spy6.count(), 0);
- */
- QSKIP("Test is not implemented.", SkipAll);
-}
-
-// -------------------------------------------
-
-void MainViewTest::recentlyClosedTabs_data()
-{
-}
-
-void MainViewTest::recentlyClosedTabs()
-{
- /*
- SubMainView widget;
-
- QSignalSpy spy0(view, SIGNAL(linkHovered(QString)));
- QSignalSpy spy2(view, SIGNAL(loadProgress(int)));
- QSignalSpy spy3(view, SIGNAL(setCurrentTitle(QString)));
- QSignalSpy spy4(view, SIGNAL(showStatusBarMessage(QString)));
- QSignalSpy spy5(view, SIGNAL(tabsChanged()));
- QSignalSpy spy6(view, SIGNAL(lastTabClosed()));
-
- QCOMPARE(spy0.count(), 0);
- QCOMPARE(spy2.count(), 0);
- QCOMPARE(spy3.count(), 0);
- QCOMPARE(spy4.count(), 0);
- QCOMPARE(spy5.count(), 0);
- QCOMPARE(spy6.count(), 0);
- */
- QSKIP("Test is not implemented.", SkipAll);
-}
-
-// -------------------------------------------
-
-void MainViewTest::setCurrentTitle_data()
-{
- QTest::addColumn<QString>("url");
- QTest::newRow("null") << QString("foo");
-}
-
-// protected void setCurrentTitle(QString const &url)
-void MainViewTest::setCurrentTitle(const QString &)
-{
- /*
- QFETCH(QString, url);
-
- SubMainView widget;
-
- QSignalSpy spy0(view, SIGNAL(linkHovered(QString)));
- QSignalSpy spy2(view, SIGNAL(loadProgress(int)));
- QSignalSpy spy3(view, SIGNAL(setCurrentTitle(QString)));
- QSignalSpy spy4(view, SIGNAL(showStatusBarMessage(QString)));
- QSignalSpy spy5(view, SIGNAL(tabsChanged()));
- QSignalSpy spy6(view, SIGNAL(lastTabClosed()));
-
- widget.call_setCurrentTitle(url);
-
- QCOMPARE(spy0.count(), 0);
- QCOMPARE(spy2.count(), 0);
- QCOMPARE(spy3.count(), 0);
- QCOMPARE(spy4.count(), 0);
- QCOMPARE(spy5.count(), 0);
- QCOMPARE(spy6.count(), 0);
- */
- QSKIP("Test is not implemented.", SkipAll);
-}
-
-// -------------------------------------------
-
-void MainViewTest::showStatusBarMessage_data()
-{
- QTest::addColumn<QString>("message");
- QTest::newRow("null") << QString("foo");
-}
-
-// protected void showStatusBarMessage(QString const &message)
-void MainViewTest::showStatusBarMessage(const QString &)
-{
- /*
- QFETCH(QString, message);
-
- SubMainView widget;
-
- QSignalSpy spy0(view, SIGNAL(linkHovered(QString)));
- QSignalSpy spy2(view, SIGNAL(loadProgress(int)));
- QSignalSpy spy3(view, SIGNAL(setCurrentTitle(QString)));
- QSignalSpy spy4(view, SIGNAL(showStatusBarMessage(QString)));
- QSignalSpy spy5(view, SIGNAL(tabsChanged()));
- QSignalSpy spy6(view, SIGNAL(lastTabClosed()));
-
- widget.call_showStatusBarMessage(message);
-
- QCOMPARE(spy0.count(), 0);
- QCOMPARE(spy2.count(), 0);
- QCOMPARE(spy3.count(), 0);
- QCOMPARE(spy4.count(), 0);
- QCOMPARE(spy5.count(), 0);
- QCOMPARE(spy6.count(), 0);
- */
- QSKIP("Test is not implemented.", SkipAll);
-}
-
-// -------------------------------------------
-
-void MainViewTest::currentChanged_data()
-{
- QTest::addColumn<int>("foo");
- QTest::newRow("null") << 0;
-}
-
-void MainViewTest::currentChanged()
-{
- /*
- QFETCH(int, foo);
-
- SubMainView widget;
-
- QSignalSpy spy0(view, SIGNAL(linkHovered(QString)));
- QSignalSpy spy2(view, SIGNAL(loadProgress(int)));
- QSignalSpy spy3(view, SIGNAL(setCurrentTitle(QString)));
- QSignalSpy spy4(view, SIGNAL(showStatusBarMessage(QString)));
- QSignalSpy spy5(view, SIGNAL(tabsChanged()));
- QSignalSpy spy6(view, SIGNAL(lastTabClosed()));
-
- widget.call_tabsChanged();
-
- QCOMPARE(spy0.count(), 0);
- QCOMPARE(spy2.count(), 0);
- QCOMPARE(spy3.count(), 0);
- QCOMPARE(spy4.count(), 0);
- QCOMPARE(spy5.count(), 0);
- QCOMPARE(spy6.count(), 0);
- */
- QSKIP("Test is not implemented.", SkipAll);
-}
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(MainViewTest, GUI)
-#include "mainview_test.moc"
diff --git a/src/tests/mainwindow_test.cpp b/src/tests/mainwindow_test.cpp
deleted file mode 100644
index 44dde8b6..00000000
--- a/src/tests/mainwindow_test.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include <QtCore>
-#include <QtGui>
-#include <QtTest>
-
-#include "mainwindow.h"
-#include "application.h"
-
-
-class MainWindowTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
-
-
-private:
- MainWindow *window;
-};
-
-
-// -------------------------------------------
-
-
-void MainWindowTest::initTestCase()
-{
- window = new MainWindow;
-}
-
-
-void MainWindowTest::cleanupTestCase()
-{
-// delete window;
-}
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(MainWindowTest, GUI)
-#include "mainwindow_test.moc"
diff --git a/src/tests/networkaccessmanager_test.cpp b/src/tests/networkaccessmanager_test.cpp
deleted file mode 100644
index ed6856f7..00000000
--- a/src/tests/networkaccessmanager_test.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include "networkaccessmanager.h"
-
-
-class NetworkAccessManagerTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
-
-private:
- NetworkAccessManager *manager;
-};
-
-
-// -------------------------------------------
-
-void NetworkAccessManagerTest::initTestCase()
-{
- manager = new NetworkAccessManager(this);
-}
-
-
-void NetworkAccessManagerTest::cleanupTestCase()
-{
- delete manager;
-}
-
-
-// -------------------------------------------
-
-
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(NetworkAccessManagerTest, GUI)
-#include "networkaccessmanager_test.moc"
diff --git a/src/tests/protocolhandler_test.cpp b/src/tests/protocolhandler_test.cpp
deleted file mode 100644
index 2e73a1d2..00000000
--- a/src/tests/protocolhandler_test.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-#include <qtest_kde.h>
-
-#include "protocolhandler.h"
-
-#include <QWebView>
-#include <QNetworkRequest>
-
-
-class ProtocolhandlerTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
- void preHandling_data();
- void preHandling();
-
- void postHandling_data();
- void postHandling();
-
-private:
- ProtocolHandler *handler;
-};
-
-
-// -------------------------------------------
-
-void ProtocolhandlerTest::initTestCase()
-{
- handler = new ProtocolHandler;
-}
-
-
-void ProtocolhandlerTest::cleanupTestCase()
-{
- delete handler;
-}
-
-
-// -------------------------------------------
-
-
-void ProtocolhandlerTest::preHandling_data()
-{
- QTest::addColumn<QString>("urlString");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("mailto") << "mailto:me@here.com" << true ;
- QTest::newRow("relative") << "google.it" << false ;
- QTest::newRow("javascript") << "javascript:alertbox('hello')" << true ;
- QTest::newRow("aboutblank") << "about:blank" << false ;
- QTest::newRow("abouthome") << "about:home" << true ;
- QTest::newRow("ftp") << "ftp://ftp.kde.org" << false ;
- QTest::newRow("file") << "file:///home" << false ;
-}
-
-
-void ProtocolhandlerTest::preHandling()
-{
- QFETCH(QString, urlString);
- QFETCH(bool , result);
-
- QWebView *view = new QWebView;
- QWebFrame *frame = view->page()->mainFrame();
-
- QNetworkRequest request = QNetworkRequest(QUrl(urlString));
-
- QCOMPARE(handler->preHandling(request, frame) , result);
-}
-
-
-void ProtocolhandlerTest::postHandling_data()
-{
- QTest::addColumn<QString>("urlString");
- QTest::addColumn<bool>("result");
-
- QTest::newRow("mailto") << "mailto:me@here.com" << true ;
- QTest::newRow("relative") << "google.it" << false ;
- QTest::newRow("javascript") << "javascript:alertbox('hello')" << false ;
- QTest::newRow("aboutblank") << "about:blank" << false ;
- QTest::newRow("abouthome") << "about:home" << false ;
- QTest::newRow("ftp") << "ftp://ftp.kde.org" << true ;
- QTest::newRow("file") << "file:///home" << true ;
-}
-
-
-void ProtocolhandlerTest::postHandling()
-{
- QFETCH(QString, urlString);
- QFETCH(bool , result);
-
- QWebView *view = new QWebView;
- QWebFrame *frame = view->page()->mainFrame();
-
- QNetworkRequest request = QNetworkRequest(QUrl(urlString));
-
- QCOMPARE(handler->postHandling(request, frame) , result);
-}
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(ProtocolhandlerTest, GUI)
-#include "protocolhandler_test.moc"
diff --git a/src/tests/sessionmanager_test.cpp b/src/tests/sessionmanager_test.cpp
deleted file mode 100644
index a2ddbfe3..00000000
--- a/src/tests/sessionmanager_test.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-#include <qtest_kde.h>
-
-#include <QtCore>
-#include <QtGui>
-#include <QtTest>
-
-
-#include "sessionmanager.h"
-
-
-class SessionManagerTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
-
-private:
- SessionManager *sessman;
-};
-
-
-// -------------------------------------------
-
-
-void SessionManagerTest::initTestCase()
-{
- sessman = new SessionManager;
-}
-
-
-void SessionManagerTest::cleanupTestCase()
-{
- delete sessman;
-}
-
-
-// -------------------------------------------
-
-
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(SessionManagerTest, GUI)
-#include "sessionmanager_test.moc"
diff --git a/src/tests/tabbar_test.cpp b/src/tests/tabbar_test.cpp
deleted file mode 100644
index 0ff73c3f..00000000
--- a/src/tests/tabbar_test.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008 by Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include "mainwindow.h"
-#include "mainview.h"
-#include "tabbar.h"
-
-
-/**
- * Subclass that exposes the protected functions.
- */
-class SubTabBar : public TabBar
-{
-public:
-
- SubTabBar(QWidget *parent) : TabBar(parent) {};
-
- QSize call_tabSizeHint(int index) const
- {
- return SubTabBar::tabSizeHint(index);
- }
-
- void call_mouseMoveEvent(QMouseEvent* event)
- {
- return SubTabBar::mouseMoveEvent(event);
- }
-
- void call_leaveEvent(QEvent* event)
- {
- return SubTabBar::leaveEvent(event);
- }
-
- void call_mousePressEvent(QMouseEvent* event)
- {
- return SubTabBar::mousePressEvent(event);
- }
-
- void call_mouseReleaseEvent(QMouseEvent* event)
- {
- return SubTabBar::mouseReleaseEvent(event);
- }
-};
-
-
-// ------------------------------------------------------------------
-
-
-class TabBarTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
- void tabSizeHint_data();
- void tabSizeHint();
-
- void mousePress_data();
- void mousePress();
-
-private:
- SubTabBar *_bar;
-};
-
-
-// -------------------------------------------
-
-void TabBarTest::initTestCase()
-{
- MainWindow *w = new MainWindow;
- MainView *mv = new MainView(w);
- _bar = new SubTabBar(mv);
-}
-
-void TabBarTest::cleanupTestCase()
-{
- delete _bar;
-}
-
-// -------------------------------------------
-
-void TabBarTest::tabSizeHint_data()
-{
- QTest::addColumn<int>("index");
-
- QTest::newRow("1th") << 0;
- QTest::newRow("2nd") << 1;
- QTest::newRow("3rd") << 2;
- QTest::newRow("4th") << 3;
- QTest::newRow("5th") << 4;
- QTest::newRow("6th") << 5;
- QTest::newRow("7th") << 6;
- QTest::newRow("8th") << 7;
- QTest::newRow("9th") << 8;
- QTest::newRow("10th") << 9;
-}
-
-
-void TabBarTest::tabSizeHint()
-{
- QFETCH(int, index);
-
- QVERIFY(_bar->call_tabSizeHint(index).width() > 0);
-}
-
-
-void TabBarTest::mousePress_data()
-{
-}
-
-
-void TabBarTest::mousePress()
-{
-// QTest::mousePress(_bar, Qt::MidButton);
-// // QCOMPARE(); ?
-//
-// QTest::mousePress(_bar, Qt::LeftButton);
-// // QCOMPARE(); ?
-}
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(TabBarTest, GUI)
-#include "tabbar_test.moc"
diff --git a/src/tests/urlbar_test.cpp b/src/tests/urlbar_test.cpp
deleted file mode 100644
index 4e1aaae5..00000000
--- a/src/tests/urlbar_test.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include "webpage.h"
-#include "webview.h"
-#include "webtab.h"
-
-#include "urlbar.h"
-
-
-class UrlBarTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
-
-private:
- UrlBar *bar;
- WebTab *tab;
-};
-
-
-// -------------------------------------------
-
-void UrlBarTest::initTestCase()
-{
- tab = new WebTab;
- bar = new UrlBar(tab);
-}
-
-
-void UrlBarTest::cleanupTestCase()
-{
- delete bar;
- delete tab;
-}
-
-
-// -------------------------------------------
-
-
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(UrlBarTest, GUI)
-#include "urlbar_test.moc"
diff --git a/src/tests/walletbar_test.cpp b/src/tests/walletbar_test.cpp
deleted file mode 100644
index ac186bcc..00000000
--- a/src/tests/walletbar_test.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include "walletbar.h"
-
-
-class WalletBarTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
-
-private:
- WalletBar *bar;
-};
-
-
-// -------------------------------------------
-
-
-void WalletBarTest::initTestCase()
-{
- QWidget *w = new QWidget;
- bar = new WalletBar(w);
-}
-
-
-void WalletBarTest::cleanupTestCase()
-{
- delete bar;
-}
-
-
-// -------------------------------------------
-
-
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(WalletBarTest, GUI)
-#include "walletbar_test.moc"
diff --git a/src/tests/webpage_test.cpp b/src/tests/webpage_test.cpp
deleted file mode 100644
index 9b170329..00000000
--- a/src/tests/webpage_test.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include "webpage.h"
-#include "webview.h"
-#include "webtab.h"
-
-
-class WebPageTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
- void manageNetworkErrors();
- void downloadRequest();
- void downloadAllContentsWithKGet();
-
- void createWindow();
- void acceptNavigationRequest();
-
- void handleUnsupportedContent();
-
- void loadFinished();
-
-private:
- WebTab *tab;
- WebPage *page;
- WebView *view;
-};
-
-
-// -------------------------------------------
-
-
-void WebPageTest::initTestCase()
-{
- tab = new WebTab;
- view = tab->view();
- page = tab->page();
-}
-
-
-void WebPageTest::cleanupTestCase()
-{
- delete tab;
-}
-
-
-// -------------------------------------------
-
-
-void WebPageTest::manageNetworkErrors()
-{
-}
-
-void WebPageTest::downloadRequest()
-{
-}
-
-void WebPageTest::downloadAllContentsWithKGet()
-{
-}
-
-void WebPageTest::createWindow()
-{
-}
-
-void WebPageTest::acceptNavigationRequest()
-{
-}
-
-void WebPageTest::handleUnsupportedContent()
-{
-}
-
-void WebPageTest::loadFinished()
-{
-}
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(WebPageTest, GUI)
-#include "webpage_test.moc"
diff --git a/src/tests/websnap_test.cpp b/src/tests/websnap_test.cpp
deleted file mode 100644
index 31d2e5cf..00000000
--- a/src/tests/websnap_test.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include "websnap.h"
-
-
-class WebSnapTest : public QObject
-{
- Q_OBJECT
-
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
-
-private:
- WebSnap *snap;
-};
-
-
-// -------------------------------------------
-
-
-void WebSnapTest::initTestCase()
-{
-}
-
-
-void WebSnapTest::cleanupTestCase()
-{
- delete snap;
-}
-
-
-// -------------------------------------------
-
-
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(WebSnapTest, GUI)
-#include "websnap_test.moc"
diff --git a/src/tests/webtab_test.cpp b/src/tests/webtab_test.cpp
deleted file mode 100644
index 073f1521..00000000
--- a/src/tests/webtab_test.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008 by Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include "webpage.h"
-#include "webview.h"
-#include "webtab.h"
-
-
-class WebTabTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private:
- WebTab *tab;
-};
-
-
-// -------------------------------------------
-
-
-void WebTabTest::initTestCase()
-{
- tab = new WebTab;
-}
-
-
-void WebTabTest::cleanupTestCase()
-{
- delete tab;
-}
-
-
-// -------------------------------------------
-
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(WebTabTest, GUI)
-#include "webtab_test.moc"
diff --git a/src/tests/webview_test.cpp b/src/tests/webview_test.cpp
deleted file mode 100644
index 1846e142..00000000
--- a/src/tests/webview_test.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include <qtest_kde.h>
-
-#include "webview.h"
-#include "webtab.h"
-
-
-class WebViewTest : public QObject
-{
- Q_OBJECT
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private Q_SLOTS:
-
-private:
- WebView *view;
- WebTab *tab;
-};
-
-
-// -------------------------------------------
-
-
-void WebViewTest::initTestCase()
-{
- tab = new WebTab;
- view = tab->view();
-}
-
-
-void WebViewTest::cleanupTestCase()
-{
- delete tab;
-}
-
-
-// -------------------------------------------
-
-
-// -------------------------------------------
-
-QTEST_KDEMAIN(WebViewTest, GUI)
-#include "webview_test.moc"
diff --git a/src/thumbupdater.cpp b/src/thumbupdater.cpp
deleted file mode 100644
index 01323c44..00000000
--- a/src/thumbupdater.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#include "thumbupdater.h"
-#include "thumbupdater.moc"
-
-#include "application.h"
-#include "iconmanager.h"
-#include "websnap.h"
-
-#include <KLocale>
-#include <KStandardDirs>
-
-#include <QWebFrame>
-
-
-ThumbUpdater::ThumbUpdater(QWebElement el, const QString & urlString, const QString & nameString, QObject *parent)
- : QObject(parent)
- , _thumb(el)
- , _url(urlString)
- , _title(nameString)
-{
-}
-
-
-void ThumbUpdater::updateThumb()
-{
- // Set loading animation
- _thumb.findFirst(QL1S(".preview img")).setAttribute(QL1S("src"), QL1S("file:///") + KStandardDirs::locate("appdata", "pics/busywidget.gif"));
- _thumb.findFirst(QL1S("span a")).setPlainText(i18n("Loading Preview..."));
-
- // Load URL
- QWebFrame *frame = qobject_cast<QWebFrame *>(parent());
- WebSnap *snap = new WebSnap(KUrl(_url), frame);
- connect(snap, SIGNAL(snapDone(bool)), this, SLOT(updateImage(bool)), Qt::UniqueConnection);
-}
-
-
-ThumbUpdater::~ThumbUpdater()
-{
- kDebug() << "bye bye";
-}
-
-
-void ThumbUpdater::updateImage(bool ok)
-{
- KUrl u(_url);
-
- QString previewPath = ok
- ? QL1S("file://") + WebSnap::imagePathFromUrl(u)
- : rApp->iconManager()->iconPathForUrl(u)
- ;
-
- _thumb.findFirst(QL1S(".preview img")).setAttribute(QL1S("src"), previewPath);
- _thumb.findFirst(QL1S("span a")).setPlainText(_title);
-
- this->deleteLater();
-}
diff --git a/src/thumbupdater.h b/src/thumbupdater.h
deleted file mode 100644
index 2544969f..00000000
--- a/src/thumbupdater.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef THUMB_UPDATER_H
-#define THUMB_UPDATER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QObject>
-#include <QWebElement>
-
-
-class REKONQ_TESTS_EXPORT ThumbUpdater : public QObject
-{
- Q_OBJECT
-
-public:
- ThumbUpdater(QWebElement el, const QString & urlString, const QString & nameString, QObject *parent = 0);
- ~ThumbUpdater();
-
- void updateThumb();
-
-private Q_SLOTS:
- void updateImage(bool);
-
-private:
- QWebElement _thumb;
- QString _url;
- QString _title;
-};
-
-#endif // THUMB_UPDATER_H
diff --git a/src/urlbar/bookmarkwidget.cpp b/src/urlbar/bookmarkwidget.cpp
deleted file mode 100644
index c1963ff0..00000000
--- a/src/urlbar/bookmarkwidget.cpp
+++ /dev/null
@@ -1,383 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Yoann Laissus <yoann dot laissus at gmail dot com>
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Auto Includes
-#include "bookmarkwidget.h"
-#include "bookmarkwidget.moc"
-
-// Local includes
-#include "application.h"
-#include "bookmarkmanager.h"
-#include "bookmarkowner.h"
-
-// KDE Includes
-#include <KComboBox>
-#include <KLocalizedString>
-#include <KIcon>
-#include <KLineEdit>
-#include <KRatingWidget>
-#include <KBookmarkDialog>
-
-// Qt Includes
-#include <QDialogButtonBox>
-#include <QFormLayout>
-#include <QLabel>
-#include <QPushButton>
-#include <QCompleter>
-#include <QTextCursor>
-#include <QDBusConnection>
-#include <QDBusConnectionInterface>
-
-// Nepomuk config include
-#include "config-nepomuk.h"
-
-#ifdef HAVE_NEPOMUK
-// Local Nepomuk Includes
-#include "resourcelinkdialog.h"
-
-//Nepomuk Includes
-#include <Soprano/Vocabulary/NAO>
-#endif
-
-
-
-BookmarkWidget::BookmarkWidget(const KBookmark &bookmark, QWidget *parent)
- : QMenu(parent)
- , m_bookmark(bookmark)
-{
- setAttribute(Qt::WA_DeleteOnClose);
- setFixedWidth(320);
-
-#ifdef HAVE_NEPOMUK
- m_nfoResource = (QUrl)m_bookmark.url();
- m_isNepomukEnabled = QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.NepomukServer");
- kDebug() << "IS NEPOMUK ACTUALLY RUNNING? " << m_isNepomukEnabled;
-#endif
-
- QFormLayout *layout = new QFormLayout(this);
- layout->setHorizontalSpacing(20);
-
- // Title
- QHBoxLayout *hLayout = new QHBoxLayout;
- QLabel *bookmarkInfo = new QLabel(this);
- bookmarkInfo->setText(i18n(" Bookmark"));
- QFont f = bookmarkInfo->font();
- f.setBold(true);
- bookmarkInfo->setFont(f);
-
- // Remove button
- QLabel *removeLabel = new QLabel(this);
- removeLabel->setText(i18n("<a href='Remove'>Remove</a>"));
- removeLabel->setAlignment(Qt::AlignRight);
- hLayout->addWidget(bookmarkInfo);
- hLayout->addWidget(removeLabel);
- layout->addRow(hLayout);
-
- connect(removeLabel, SIGNAL(linkActivated(QString)), this, SLOT(removeBookmark()));
-
- //Bookmark Folder
- QLabel *folderLabel = new QLabel(this);
- folderLabel->setText(i18n("Folder:"));
-
- m_folder = new KComboBox(this);
- layout->addRow(folderLabel, m_folder);
- setupFolderComboBox();
- connect(m_folder, SIGNAL(currentIndexChanged(int)), this, SLOT(onFolderIndexChanged(int)));
-
- // Bookmark name
- QLabel *nameLabel = new QLabel(this);
- nameLabel->setText(i18n("Name:"));
- m_name = new KLineEdit(this);
- if (m_bookmark.isNull())
- {
- m_name->setEnabled(false);
- }
- else
- {
- m_name->setText(m_bookmark.text());
- m_name->setFocus();
- }
- layout->addRow(nameLabel, m_name);
-
-#ifdef HAVE_NEPOMUK
-
- if (m_isNepomukEnabled)
- {
- QLabel* rateLabel = new QLabel(this);
- rateLabel->setText(i18n("Rate:"));
- KRatingWidget *ratingWidget = new KRatingWidget(this);
- if (m_nfoResource.rating() != 0)
- {
- ratingWidget->setRating(m_nfoResource.rating());
- }
- connect(ratingWidget, SIGNAL(ratingChanged(int)), this, SLOT(setRatingSlot(int)));
- ratingWidget->setToolTip(i18n("Rate this page"));
- layout->addRow(rateLabel, ratingWidget);
-
- //Add comments
- QLabel *commentLabel = new QLabel(this);
- commentLabel->setText(i18n("Describe:"));
- commentLabel->setAlignment(Qt::AlignCenter);
- m_commentEdit = new QPlainTextEdit(this);
- if (!m_nfoResource.description().isEmpty())
- {
- m_commentEdit->setPlainText(m_nfoResource.description());
- }
- connect(m_commentEdit, SIGNAL(textChanged()), this, SLOT(addCommentSlot()));
- layout->addRow(commentLabel, m_commentEdit);
-
- // Create tags
- QLabel *tagLabel = new QLabel(this);
- tagLabel->setText(i18n("Tags:"));
- tagLabel->setAlignment(Qt::AlignLeft);
- m_tagLine = new KLineEdit(this);
- m_tagLine->setPlaceholderText(i18n("add tags(comma separated)"));
-
-
- QList<Nepomuk::Tag> tagList = Nepomuk::Tag::allTags();
- Q_FOREACH(Nepomuk::Tag t, tagList)
- {
- m_tList.append(t.label());
- }
- QCompleter *completeTag = new QCompleter(m_tList);
- completeTag->setCompletionMode(QCompleter::PopupCompletion);
- m_tagLine->setCompleter(completeTag);
- loadTags();
-
- layout->addRow(tagLabel, m_tagLine);
-
- QPushButton *linkToResource = new QPushButton(this);
- linkToResource->setText(i18n("Link Resources"));
- connect(linkToResource, SIGNAL(clicked()), this, SLOT(linkToResourceSlot()));
- layout->addWidget(linkToResource);
- }
- else
- {
- QLabel *nepomukLabel = new QLabel(this);
- QPalette p = nepomukLabel->palette();
- p.setColor(QPalette::WindowText, Qt::red);
- nepomukLabel->setPalette(p);
- nepomukLabel->setText(i18n("Nepomuk is actually disabled."));
- layout->addWidget(nepomukLabel);
- }
-#endif
-
- // Ok & Cancel buttons
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
- layout->addWidget(buttonBox);
-}
-
-
-void BookmarkWidget::showAt(const QPoint &pos)
-{
- adjustSize();
-
- QPoint p(pos.x() - width(), pos.y() + 10);
- move(p);
- show();
-}
-
-
-void BookmarkWidget::accept()
-{
- if (!m_bookmark.isNull() && m_name->text() != m_bookmark.fullText())
- {
- m_bookmark.setFullText(m_name->text());
- rApp->bookmarkManager()->emitChanged();
- }
- QString folderAddress = m_folder->itemData(m_folder->currentIndex()).toString();
- KBookmarkGroup a = rApp->bookmarkManager()->manager()->findByAddress(folderAddress).toGroup();
-
- KBookmarkGroup parent = m_bookmark.parentGroup();
- parent.deleteBookmark(m_bookmark);
- a.addBookmark(m_bookmark);
- rApp->bookmarkManager()->manager()->emitChanged(a);
-
-#ifdef HAVE_NEPOMUK
- if (m_isNepomukEnabled)
- {
- parseTags();
- }
-#endif
-
- close();
-}
-
-
-void BookmarkWidget::setupFolderComboBox()
-{
- KBookmarkGroup toolBarRoot = rApp->bookmarkManager()->manager()->toolbar();
- KBookmarkGroup root = rApp->bookmarkManager()->rootGroup();
-
- if (toolBarRoot.address() == root.address())
- {
- m_folder->addItem(KIcon("bookmark-toolbar"),
- i18n("Bookmark Toolbar"),
- toolBarRoot.address());
- }
- else
- {
- m_folder->addItem(KIcon("bookmark-toolbar"),
- toolBarRoot.text(),
- toolBarRoot.address());
- }
- m_folder->insertSeparator(1);
-
- if (m_bookmark.parentGroup().address() != toolBarRoot.address())
- {
- QString parentText = m_bookmark.parentGroup().text();
-
- if (m_bookmark.parentGroup().address() == root.address())
- {
- parentText = i18n("Root folder");
- }
-
- m_folder->addItem(parentText,
- m_bookmark.parentGroup().address());
- m_folder->insertSeparator(3);
- }
-
- for (KBookmark bookmark = toolBarRoot.first(); !bookmark.isNull(); bookmark = toolBarRoot.next(bookmark))
- {
- if (bookmark.isGroup() && bookmark.address() != m_bookmark.parentGroup().address())
- {
- m_folder->addItem(bookmark.text(), bookmark.address());
- }
- }
-
- m_folder->insertSeparator(m_folder->count());
- m_folder->addItem(KIcon("folder"), i18n("Choose..."));
-
- int index = m_folder->findData(m_bookmark.parentGroup().address());
- m_folder->setCurrentIndex(index);
-}
-
-
-void BookmarkWidget::onFolderIndexChanged(int index)
-{
- if (index == m_folder->count() - 1)
- {
- KBookmarkDialog dialog(rApp->bookmarkManager()->manager());
- KBookmarkGroup selectedGroup = dialog.selectFolder(m_bookmark.parentGroup());
-
- if (selectedGroup.address() != m_bookmark.parentGroup().address() && !selectedGroup.isNull())
- {
- m_bookmark.parentGroup().deleteBookmark(m_bookmark);
- selectedGroup.addBookmark(m_bookmark);
- rApp->bookmarkManager()->manager()->emitChanged();
- }
- }
-}
-
-
-void BookmarkWidget::removeBookmark()
-{
- rApp->bookmarkManager()->owner()->deleteBookmark(m_bookmark);
- close();
-
- emit updateIcon();
-}
-
-
-#ifdef HAVE_NEPOMUK
-void BookmarkWidget::addTags(QList<Nepomuk::Tag> tagList)
-{
- Q_FOREACH(const Nepomuk::Tag & tag, tagList)
- {
- if (!m_nfoResource.tags().contains(tag))
- {
- m_nfoResource.addTag(tag);
- }
- }
- Q_FOREACH(Nepomuk::Tag tag, m_nfoResource.tags())
- {
- if (!tagList.contains(tag))
- {
- tag.remove();
- }
- }
-}
-
-void BookmarkWidget::parseTags()
-{
- QList<Nepomuk::Tag> tagList;
- if (m_tagLine->text().contains(','))
- {
- QString text = m_tagLine->text();
- QStringList tagStringList = text.split(QChar::fromAscii(','));
-
- Q_FOREACH(const QString & tag, tagStringList)
- {
- QString trimmedTag = tag.trimmed();
- if (!trimmedTag.isEmpty())
- tagList << trimmedTag;
- }
- }
- else
- {
- tagList << m_tagLine->text().trimmed();
- }
- addTags(tagList);
-}
-
-
-void BookmarkWidget::loadTags()
-{
- QString list;
- if (!m_nfoResource.tags().isEmpty())
- {
- Q_FOREACH(const Nepomuk::Tag & tag, m_nfoResource.tags())
- {
- list.append(tag.genericLabel());
- list.append(",");
- }
- m_tagLine->setText(list);
- }
-}
-
-
-void BookmarkWidget::setRatingSlot(int rate)
-{
- m_nfoResource.setRating(rate);
-}
-
-
-void BookmarkWidget::addCommentSlot()
-{
- m_nfoResource.setDescription(m_commentEdit->toPlainText());
-}
-
-
-void BookmarkWidget::linkToResourceSlot()
-{
- Nepomuk::ResourceLinkDialog r(m_nfoResource);
- r.exec();
-}
-#endif
diff --git a/src/urlbar/bookmarkwidget.h b/src/urlbar/bookmarkwidget.h
deleted file mode 100644
index a57b2774..00000000
--- a/src/urlbar/bookmarkwidget.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Yoann Laissus <yoann dot laissus at gmail dot com>
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef BOOKMARKWIDGET_H
-#define BOOKMARKWIDGET_H
-
-// Qt Includes
-#include <QMenu>
-#include <QGridLayout>
-#include <QPlainTextEdit>
-
-// KDE Includes
-#include <KBookmark>
-
-// Nepomuk config include
-#include "config-nepomuk.h"
-
-#ifdef HAVE_NEPOMUK
-
-// Nepomuk Includes
-#include <Nepomuk/Resource>
-#include <Nepomuk/Tag>
-#include <Nepomuk/Vocabulary/NFO>
-
-#endif
-
-// Forward Declarations
-class KBookmark;
-class KLineEdit;
-class KComboBox;
-
-
-class BookmarkWidget : public QMenu
-{
- Q_OBJECT
-
-public:
- explicit BookmarkWidget(const KBookmark &bookmark, QWidget *parent = 0);
-
- void showAt(const QPoint &pos);
-
-#ifdef HAVE_NEPOMUK
- void addTags(QList<Nepomuk::Tag>);
- void parseTags();
- void loadTags();
-#endif
-
-Q_SIGNALS:
- void updateIcon();
-
-private:
- void setupFolderComboBox();
-
-private Q_SLOTS:
- void accept();
- void removeBookmark();
- void onFolderIndexChanged(int index);
-
-#ifdef HAVE_NEPOMUK
- void setRatingSlot(int rate);
- void addCommentSlot();
- void linkToResourceSlot();
-#endif
-
-private:
- KBookmark m_bookmark;
- KLineEdit *m_name;
- KComboBox *m_folder;
- KLineEdit *m_tagLine;
- QPlainTextEdit *m_commentEdit;
- QStringList m_tList;
-
-#ifdef HAVE_NEPOMUK
- Nepomuk::Resource m_nfoResource;
- bool m_isNepomukEnabled;
-#endif
-};
-
-#endif
diff --git a/src/urlbar/completionwidget.cpp b/src/urlbar/completionwidget.cpp
deleted file mode 100644
index 04f7bad0..00000000
--- a/src/urlbar/completionwidget.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "completionwidget.h"
-#include "completionwidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "listitem.h"
-#include "searchengine.h"
-#include "urlbar.h"
-
-// KDE Includes
-#include <KGlobalSettings>
-#include <KUrl>
-
-// Qt Includes
-#include <QPoint>
-#include <QSize>
-#include <QEvent>
-
-#include <QVBoxLayout>
-#include <QKeyEvent>
-
-
-
-CompletionWidget::CompletionWidget(QWidget *parent)
- : QFrame(parent, Qt::ToolTip)
- , _parent(parent)
- , _currentIndex(0)
- , _hasSuggestions(false)
-{
- setFrameStyle(QFrame::Panel);
- setLayoutDirection(Qt::LeftToRight);
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setMargin(0);
- layout->setSpacing(0);
- setLayout(layout);
-}
-
-
-void CompletionWidget::insertItems(const UrlSearchList &list, const QString& text, int offset)
-{
- Q_FOREACH(const UrlSearchItem & item, list)
- {
- ListItem *suggestion = ListItemFactory::create(item, text, this);
- suggestion->setBackgroundRole(offset % 2 ? QPalette::AlternateBase : QPalette::Base);
- connect(suggestion,
- SIGNAL(itemClicked(ListItem*, Qt::MouseButton, Qt::KeyboardModifiers)),
- this,
- SLOT(itemChosen(ListItem*, Qt::MouseButton, Qt::KeyboardModifiers)));
- connect(suggestion, SIGNAL(updateList()), this, SLOT(updateList()));
- connect(this, SIGNAL(nextItemSubChoice()), suggestion, SLOT(nextItemSubChoice()));
-
- suggestion->setObjectName(QString::number(offset++));
- layout()->addWidget(suggestion);
- }
-}
-
-
-void CompletionWidget::updateSearchList(const UrlSearchList &list, const QString& text)
-{
- if (_hasSuggestions || _typedString != text)
- return;
- _hasSuggestions = true;
-
- if (_resList.count() > 0)
- {
- clear();
-
- insertItems(_resList, text);
- _list = _resList;
-
- UrlSearchList sugList = list.mid(0, 4);
- insertItems(sugList, text, _list.count());
- _list.append(sugList);
- popup();
- }
-}
-
-
-void CompletionWidget::sizeAndPosition()
-{
- setFixedWidth(_parent->width());
-
- int h = 0;
- for (int i = 0; i < layout()->count(); i++)
- {
- QWidget *widget = layout()->itemAt(i)->widget();
- h += widget->sizeHint().height();
- }
- setFixedSize(_parent->width(), h + 5);
-
- // position
- QPoint p = _parent->mapToGlobal(QPoint(0, 0));
- move(p.x(), p.y() + _parent->height());
-}
-
-
-void CompletionWidget::popup()
-{
- findChild<ListItem *>(QString::number(0))->activate(); //activate first listitem
- sizeAndPosition();
- if (!isVisible())
- show();
-}
-
-
-void CompletionWidget::up()
-{
- if (_currentIndex >= 0)
- findChild<ListItem *>(QString::number(_currentIndex))->deactivate(); // deactivate previous
-
- --_currentIndex;
- if (_currentIndex < -1)
- {
- _currentIndex = _list.count() - 1;
- }
-
- activateCurrentListItem();
-}
-
-
-void CompletionWidget::down()
-{
- if (_currentIndex >= 0)
- findChild<ListItem *>(QString::number(_currentIndex))->deactivate(); // deactivate previous
-
- ++_currentIndex;
- if (_currentIndex == _list.count())
- _currentIndex = -1;
-
- activateCurrentListItem();
-}
-
-
-void CompletionWidget::activateCurrentListItem()
-{
- UrlBar *bar = qobject_cast<UrlBar *>(_parent);
-
- // activate "new" current
- ListItem *widget = findChild<ListItem *>(QString::number(_currentIndex));
-
- // update text of the url bar
- bar->blockSignals(true); // without compute suggestions
- if (widget)
- {
- widget->activate();
- bar->setQUrl(widget->text());
- }
- else
- {
- bar->setText(_typedString);
- }
- bar->blockSignals(false);
- bar->setFocus();
- bar->setCursorPosition(bar->text().length());
-}
-
-
-void CompletionWidget::clear()
-{
- QLayoutItem *child;
- while ((child = layout()->takeAt(0)) != 0)
- {
- delete child->widget();
- delete child;
- }
- _currentIndex = 0;
- _hasSuggestions = false;
-}
-
-
-bool CompletionWidget::eventFilter(QObject *obj, QEvent *ev)
-{
- int type = ev->type();
- QWidget *wid = qobject_cast<QWidget*>(obj);
-
- if (obj == this)
- {
- return false;
- }
-
- // hide conditions of the CompletionWidget
- if (wid
- && ((wid == _parent
- && (type == QEvent::Move || type == QEvent::Resize)) || ((wid->windowFlags() & Qt::Window)
- && (type == QEvent::Move || type == QEvent::Hide || type == QEvent::WindowDeactivate)
- && wid == _parent->window()) || (type == QEvent::MouseButtonPress && !isAncestorOf(wid)))
- )
- {
- hide();
- return false;
- }
-
- //actions on the CompletionWidget
- if (wid && wid->isAncestorOf(_parent) && isVisible())
- {
- ListItem *child;
- UrlBar *w;
-
- if (type == QEvent::KeyPress)
- {
- QKeyEvent *kev = static_cast<QKeyEvent *>(ev);
- switch (kev->key())
- {
- case Qt::Key_Up:
- case Qt::Key_Backtab:
- if (kev->modifiers() == Qt::NoButton || (kev->modifiers() & Qt::ShiftModifier))
- {
- up();
- kev->accept();
- return true;
- }
- break;
-
- case Qt::Key_Down:
- case Qt::Key_Tab:
- if (kev->modifiers() == Qt::NoButton)
- {
- down();
- kev->accept();
- return true;
- }
- if (kev->modifiers() & Qt::ControlModifier)
- {
- emit nextItemSubChoice();
- kev->accept();
- return true;
- }
- break;
-
- case Qt::Key_Enter:
- case Qt::Key_Return:
- w = qobject_cast<UrlBar *>(parent());
- if (kev->modifiers() == Qt::AltModifier)
- {
- if (kev->key() == Qt::Key_Return || kev->key() == Qt::Key_Enter)
- {
- emit chosenUrl(w->text(), Rekonq::NewFocusedTab);
- }
- }
-
- if (!w->text().startsWith(QL1S("http://"), Qt::CaseInsensitive))
- {
- QString append;
- if (kev->modifiers() == Qt::ControlModifier)
- {
- append = QL1S(".com");
- }
- else if (kev->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier))
- {
- append = QL1S(".org");
- }
- else if (kev->modifiers() == Qt::ShiftModifier)
- {
- append = QL1S(".net");
- }
-
- if (!append.isEmpty())
- {
- QUrl url(QL1S("http://") + w->text());
- QString host = url.host();
- if (!host.endsWith(append, Qt::CaseInsensitive))
- {
- host += append;
- url.setHost(host);
- }
-
- emit chosenUrl(url, Rekonq::CurrentTab);
- }
- }
-
- kDebug() << "Suggestion INDEX chosen: " << _currentIndex;
- if (_currentIndex == -1)
- _currentIndex = 0;
- child = findChild<ListItem *>(QString::number(_currentIndex));
-
- if (child) //the completionwidget is visible and the user had press down
- {
- //we can use the url of the listitem
- emit chosenUrl(child->url(), Rekonq::CurrentTab);
- }
- else //the user type too fast (completionwidget not visible or suggestion not downloaded)
- {
- UrlResolver res(w->text());
- UrlSearchList list = res.orderedSearchItems();
- if (list.isEmpty())
- {
- emit chosenUrl(KUrl(_typedString), Rekonq::CurrentTab);
- }
- else
- {
- emit chosenUrl(list.first().url, Rekonq::CurrentTab);
- }
- }
- kev->accept();
- hide();
- return true;
-
- case Qt::Key_Escape:
- hide();
- return true;
- }
- }
- }
-
- return QFrame::eventFilter(obj, ev);
-}
-
-
-void CompletionWidget::setVisible(bool visible)
-{
- if (visible)
- {
- rApp->installEventFilter(this);
- }
- else
- {
- rApp->removeEventFilter(this);
- }
-
-
- QFrame::setVisible(visible);
-}
-
-
-void CompletionWidget::itemChosen(ListItem *item, Qt::MouseButton button, Qt::KeyboardModifiers modifier)
-{
- if (button == Qt::MidButton
- || modifier == Qt::ControlModifier)
- {
- emit chosenUrl(item->url(), Rekonq::NewFocusedTab);
- }
- else
- {
- emit chosenUrl(item->url(), Rekonq::CurrentTab);
- }
- hide();
-}
-
-
-void CompletionWidget::updateList()
-{
- suggestUrls(_typedString);
-}
-
-
-void CompletionWidget::suggestUrls(const QString &text)
-{
- _typedString = text;
-
- QWidget *w = qobject_cast<QWidget *>(parent());
- if (!w->hasFocus())
- return;
-
- if (text.isEmpty())
- {
- hide();
- return;
- }
-
- if (!isVisible())
- {
- UrlResolver::setSearchEngine(SearchEngine::defaultEngine());
- }
-
- UrlResolver *res = new UrlResolver(text);
- connect(res, SIGNAL(suggestionsReady(UrlSearchList, QString)),
- this, SLOT(updateSearchList(UrlSearchList, QString)));
- _resList = res->orderedSearchItems();
-
- // NOTE: It's important to call this AFTER orderedSearchItems() to let everything work
- res->computeSuggestions();
-}
diff --git a/src/urlbar/completionwidget.h b/src/urlbar/completionwidget.h
deleted file mode 100644
index 92d1bd39..00000000
--- a/src/urlbar/completionwidget.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef COMPLETION_WIDGET_H
-#define COMPLETION_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "urlresolver.h"
-
-// KDE Includes
-#include <KService>
-
-// Qt Includes
-#include <QFrame>
-
-// Forward Declarations
-class ListItem;
-
-
-class CompletionWidget : public QFrame
-{
- Q_OBJECT
-
-public:
- CompletionWidget(QWidget *parent);
-
- virtual bool eventFilter(QObject *obj, QEvent *ev);
- void setVisible(bool visible);
-
- void suggestUrls(const QString &text);
-
-private Q_SLOTS:
- void itemChosen(ListItem *item, Qt::MouseButton = Qt::LeftButton, Qt::KeyboardModifiers = Qt::NoModifier);
- void updateSearchList(const UrlSearchList &list, const QString& text);
- void updateList();
-
-Q_SIGNALS:
- void chosenUrl(const KUrl &, Rekonq::OpenType);
- void nextItemSubChoice();
-
-private:
- void insertItems(const UrlSearchList &list, const QString& text, int offset = 0);
-
- void popup();
- void clear();
-
- void sizeAndPosition();
- void up();
- void down();
- void activateCurrentListItem();
-
- QWidget *_parent;
-
- UrlSearchList _list;
-
- int _currentIndex;
-
- KService::Ptr _searchEngine;
-
- QString _typedString;
- bool _hasSuggestions;
-
- UrlSearchList _resList;
-};
-
-#endif // COMPLETION_WIDGET_H
diff --git a/src/urlbar/favoritewidget.cpp b/src/urlbar/favoritewidget.cpp
deleted file mode 100644
index 6a4ffaba..00000000
--- a/src/urlbar/favoritewidget.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "favoritewidget.h"
-#include "favoritewidget.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local includes
-#include "application.h"
-#include "bookmarkmanager.h"
-#include "bookmarkowner.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KLocalizedString>
-#include <KIcon>
-#include <KLineEdit>
-
-// Qt Includes
-#include <QDialogButtonBox>
-#include <QFormLayout>
-#include <QLabel>
-#include <QPushButton>
-
-
-FavoriteWidget::FavoriteWidget(WebTab *tab, QWidget *parent)
- : QMenu(parent)
- , m_tab(tab)
-{
- setAttribute(Qt::WA_DeleteOnClose);
- setFixedWidth(350);
-
- QFormLayout *layout = new QFormLayout(this);
- QVBoxLayout *vLay = new QVBoxLayout;
-
- // Favorite icon
- QLabel *bookmarkIcon = new QLabel(this);
- bookmarkIcon->setPixmap(KIcon("emblem-favorite").pixmap(32, 32));
-
- // Title
- QLabel *favoriteInfo = new QLabel(this);
- favoriteInfo->setText(i18n("<h4>Remove this favorite?</h4>"));
- vLay->addWidget(favoriteInfo);
-
- // Favorite name
- QLabel *nameLabel = new QLabel(this);
- nameLabel->setText(i18n("Name: %1", m_tab->view()->title()));
- vLay->addWidget(nameLabel);
-
- // Favorite url
- QLabel *urlLabel = new QLabel(this);
- urlLabel->setText(i18n("URL: %1", m_tab->url().url()));
- vLay->addWidget(urlLabel);
-
- layout->addRow(bookmarkIcon, vLay);
-
- // Ok & Cancel buttons
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
- layout->addWidget(buttonBox);
-}
-
-
-void FavoriteWidget::showAt(const QPoint &pos)
-{
- adjustSize();
-
- QPoint p(pos.x() - width(), pos.y() + 10);
- move(p);
- show();
-}
-
-
-void FavoriteWidget::accept()
-{
- QStringList urls = ReKonfig::previewUrls();
- if (urls.removeOne(m_tab->url().url()))
- {
- ReKonfig::setPreviewUrls(urls);
- QStringList titles = ReKonfig::previewNames();
- titles.removeOne(m_tab->view()->title());
- ReKonfig::setPreviewNames(titles);
-
- emit updateIcon();
- }
-
- close();
-}
diff --git a/src/urlbar/favoritewidget.h b/src/urlbar/favoritewidget.h
deleted file mode 100644
index d0b05f14..00000000
--- a/src/urlbar/favoritewidget.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef FAVORITE_WIDGET_H
-#define FAVORITE_WIDGET_H
-
-
-// Qt Includes
-#include <QMenu>
-#include <QCheckBox>
-
-// Forward Declarations
-class WebTab;
-
-
-class FavoriteWidget : public QMenu
-{
- Q_OBJECT
-
-public:
- explicit FavoriteWidget(WebTab *tab, QWidget *parent = 0);
-
- void showAt(const QPoint &pos);
-
-Q_SIGNALS:
- void updateIcon();
-
-private Q_SLOTS:
- void accept();
-
-private:
- WebTab *m_tab;
-};
-
-#endif // FAVORITE_WIDGET_H
diff --git a/src/urlbar/listitem.cpp b/src/urlbar/listitem.cpp
deleted file mode 100644
index 8b753569..00000000
--- a/src/urlbar/listitem.cpp
+++ /dev/null
@@ -1,661 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "listitem.h"
-#include "listitem.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "urlresolver.h"
-#include "application.h"
-#include "websnap.h"
-#include "completionwidget.h"
-#include "searchengine.h"
-#include "iconmanager.h"
-
-// KDE Includes
-#include <KIcon>
-#include <KAction>
-#include <kio/jobclasses.h>
-#include <kio/scheduler.h>
-
-// Qt Includes
-#include <QActionGroup>
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QSizePolicy>
-#include <QPixmap>
-#include <QStylePainter>
-#include <QMouseEvent>
-#include <QWebSettings>
-#include <QFile>
-#include <QTextDocument>
-#include <QBitArray>
-
-
-ListItem::ListItem(const UrlSearchItem &item, QWidget *parent)
- : QWidget(parent)
- , m_option()
- , m_url(item.url)
-{
- m_option.initFrom(this);
- m_option.direction = Qt::LeftToRight;
-
- // use the same application palette (hence, the same colors)
- // Qt docs says that using this cctor is possible & fast (qt:qpalette)
- QPalette p(rApp->palette());
- setPalette(p);
-
- deactivate();
-}
-
-
-ListItem::~ListItem()
-{
- disconnect();
-}
-
-
-void ListItem::activate()
-{
- m_option.state |= QStyle::State_Selected;
- update();
-}
-
-
-void ListItem::deactivate()
-{
- m_option.state &= ~QStyle::State_Selected;
- update();
-}
-
-
-void ListItem::paintEvent(QPaintEvent *event)
-{
- Q_UNUSED(event);
-
- QWidget::paintEvent(event);
- QPainter painter(this);
- m_option.rect = QRect(QPoint(), size());
- painter.fillRect(m_option.rect, palette().brush(backgroundRole()));
-
- if (m_option.state.testFlag(QStyle::State_Selected) || m_option.state.testFlag(QStyle::State_MouseOver))
- {
- style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &m_option, &painter, this);
- }
-
-}
-
-
-void ListItem::enterEvent(QEvent *e)
-{
- m_option.state |= QStyle::State_MouseOver;
- update();
- QWidget::enterEvent(e);
-}
-
-
-void ListItem::leaveEvent(QEvent *e)
-{
- m_option.state &= ~QStyle::State_MouseOver;
- update();
- QWidget::enterEvent(e);
-}
-
-
-void ListItem::mousePressEvent(QMouseEvent *e)
-{
- emit itemClicked(this, e->button(), e->modifiers());
- QWidget::mousePressEvent(e);
-}
-
-
-KUrl ListItem::url()
-{
- return m_url;
-}
-
-
-QString ListItem::text()
-{
- return m_url.url();
-}
-
-
-void ListItem::nextItemSubChoice()
-{
- // will be override
-}
-
-
-// ---------------------------------------------------------------
-
-
-TypeIconLabel::TypeIconLabel(int type, QWidget *parent)
- : QLabel(parent)
-{
- setMinimumWidth(16);
- QHBoxLayout *hLayout = new QHBoxLayout;
- hLayout->setMargin(0);
- hLayout->setAlignment(Qt::AlignRight);
- setLayout(hLayout);
-
- if (type & UrlSearchItem::Search)
- hLayout->addWidget(getIcon("edit-find"));
- if (type & UrlSearchItem::Browse)
- hLayout->addWidget(getIcon("applications-internet"));
- if (type & UrlSearchItem::Bookmark)
- hLayout->addWidget(getIcon("rating"));
- if (type & UrlSearchItem::History)
- hLayout->addWidget(getIcon("view-history"));
- if (type & UrlSearchItem::Suggestion)
- hLayout->addWidget(getIcon("help-hint"));
-}
-
-
-QLabel *TypeIconLabel::getIcon(QString icon)
-{
- QLabel *iconLabel = new QLabel(this);
- iconLabel->setFixedSize(16, 16);
- QPixmap pixmap = KIcon(icon).pixmap(16);
- iconLabel->setPixmap(pixmap);
- return iconLabel;
-}
-
-
-// ---------------------------------------------------------------
-
-
-IconLabel::IconLabel(const QString &icon, QWidget *parent)
- : QLabel(parent)
-{
- QPixmap pixmapIcon = rApp->iconManager()->iconForUrl(KUrl(icon)).pixmap(16);
- setFixedSize(16, 16);
- setPixmap(pixmapIcon);
-}
-
-
-IconLabel::IconLabel(const KIcon &icon, QWidget *parent)
- : QLabel(parent)
-{
- QPixmap pixmapIcon = icon.pixmap(16);
- setFixedSize(16, 16);
- setPixmap(pixmapIcon);
-}
-
-
-// ---------------------------------------------------------------
-
-
-static QString highlightWordsInText(const QString &text, const QStringList &words)
-{
- QString ret = text;
- QBitArray boldSections(ret.size());
- Q_FOREACH(const QString & wordToPointOut, words)
- {
- int index = ret.indexOf(wordToPointOut, 0, Qt::CaseInsensitive);
- while (index > -1)
- {
- boldSections.fill(true, index, index + wordToPointOut.size());
- index = ret.indexOf(wordToPointOut, index + wordToPointOut.size(), Qt::CaseInsensitive);
- }
- }
-
-
- if (boldSections.isEmpty())
- return ret;
-
- int numSections = 0;
- for (int i = 0; i < boldSections.size() - 1; ++i)
- {
- if (boldSections.testBit(i) && !boldSections.testBit(i + 1))
- ++numSections;
- }
- if (boldSections.testBit(boldSections.size() - 1)) //last char was still part of a bold section
- ++numSections;
- const int tagLength = 7; // length of "<b>" and "</b>" we're going to add for each bold section.
- ret.reserve(ret.size() + numSections * tagLength);
- bool bold = false;
- for (int i = boldSections.size() - 1; i >= 0; --i)
- {
- if (!bold && boldSections.testBit(i))
- {
- ret.insert(i + 1, QL1S("</b>"));
- bold = true;
- }
- else if (bold && !boldSections.testBit(i))
- {
- ret.insert(i + 1, QL1S("<b>"));
- bold = false;
- }
- }
- if (bold)
- ret.insert(0, QL1S("<b>"));
- return ret;
-}
-
-
-TextLabel::TextLabel(const QString &text, const QString &textToPointOut, QWidget *parent)
- : QLabel(parent)
-{
- setTextFormat(Qt::RichText);
- setMouseTracking(false);
- QString t = text;
- const bool wasItalic = t.startsWith(QL1S("<i>"));
- if (wasItalic)
- t.remove(QRegExp(QL1S("<[/ib]*>")));
- t = Qt::escape(t);
- QStringList words = Qt::escape(textToPointOut.simplified()).split(QL1C(' '));
- t = highlightWordsInText(t, words);
- if (wasItalic)
- t = QL1S("<i>") + t + QL1S("</i>");
- setText(t);
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
-}
-
-
-TextLabel::TextLabel(QWidget *parent)
- : QLabel(parent)
-{
- setTextFormat(Qt::RichText);
- setMouseTracking(false);
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
-}
-
-
-void TextLabel::setEngineText(const QString &engine, const QString &text)
-{
- setText(i18nc("%1=search engine, e.g. Google, Wikipedia %2=text to search for", "Search %1 for <b>%2</b>", engine, Qt::escape(text)));
-}
-
-
-// ---------------------------------------------------------------
-
-
-DescriptionLabel::DescriptionLabel(const QString &text, QWidget *parent)
- : QLabel(parent)
-{
- QString t = text;
- const bool wasItalic = t.startsWith(QL1S("<i>"));
- if (wasItalic)
- t.remove(QRegExp("<[/ib]*>"));
-
- if (wasItalic)
- t = QL1S("<i>") + t + QL1S("</i>");
-
- setWordWrap(false); //NOTE: why setWordWrap(true) make items have a strange behavior ?
- setText(t);
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
-}
-
-
-//--------------------------------------------------------------------------------------------
-
-
-PreviewListItem::PreviewListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
-{
- QHBoxLayout *hLayout = new QHBoxLayout;
- hLayout->setSpacing(4);
-
- // icon
- hLayout->addWidget(new TypeIconLabel(item.type, this));
-
- // url + text
- QVBoxLayout *vLayout = new QVBoxLayout;
- vLayout->setMargin(0);
-
- QString title = item.title;
- if (title.isEmpty())
- {
- title = item.url;
- title = title.remove("http://");
- title.truncate(title.indexOf("/"));
- }
-
- vLayout->addWidget(new TextLabel(title, text, this));
- vLayout->addWidget(new TextLabel("<i>" + item.url + "</i>", text, this));
- hLayout->addLayout(vLayout);
-
- // preview label icon
- QLabel *previewLabelIcon = new QLabel(this);
- previewLabelIcon->setFixedSize(45, 33);
- new PreviewLabel(item.url, 38, 29, previewLabelIcon);
- IconLabel* icon = new IconLabel(item.url, previewLabelIcon);
- icon->move(27, 16);
- hLayout->addWidget(previewLabelIcon);
-
- setLayout(hLayout);
-}
-
-
-// ---------------------------------------------------------------
-
-
-PreviewLabel::PreviewLabel(const QString &url, int width, int height, QWidget *parent)
- : QLabel(parent)
-{
- setFixedSize(width, height);
- setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
-
- KUrl u = KUrl(url);
- if (WebSnap::existsImage(KUrl(u)))
- {
- QPixmap preview;
- preview.load(WebSnap::imagePathFromUrl(u));
- setPixmap(preview.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
- }
-}
-
-
-// ---------------------------------------------------------------
-
-
-ImageLabel::ImageLabel(const QString &url, int width, int height, QWidget *parent)
- : QLabel(parent),
- m_url(url)
-{
- setFixedSize(width, height);
- if (WebSnap::existsImage(KUrl(url)))
- {
- QPixmap pix;
- pix.load(WebSnap::imagePathFromUrl(url));
- setPixmap(pix);
- }
- else
- {
- KIO::TransferJob *job = KIO::get(KUrl(url), KIO::NoReload, KIO::HideProgressInfo);
- connect(job, SIGNAL(data(KIO::Job*, QByteArray)),
- this, SLOT(slotData(KJob*, QByteArray)));
- connect(job, SIGNAL(result(KJob*)),
- this, SLOT(slotResult(KJob*)));
- }
-}
-
-
-void ImageLabel::slotData(KJob *job, const QByteArray &data)
-{
- Q_UNUSED(job);
- m_data.append(data);
-}
-
-
-void ImageLabel::slotResult(KJob *)
-{
- QPixmap pix;
- if (!pix.loadFromData(m_data))
- kDebug() << "error while loading image: ";
- setPixmap(pix);
- pix.save(WebSnap::imagePathFromUrl(m_url), "PNG");
-}
-
-
-// ---------------------------------------------------------------
-
-
-SearchListItem::SearchListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
- , m_text(text)
-{
- m_iconLabel = new IconLabel(SearchEngine::buildQuery(UrlResolver::searchEngine(), ""), this);
- m_titleLabel = new TextLabel(this);
- m_titleLabel->setEngineText(UrlResolver::searchEngine()->name(), item.title);
- m_engineBar = new EngineBar(UrlResolver::searchEngine(), parent);
-
- QHBoxLayout *hLayout = new QHBoxLayout;
- hLayout->setSpacing(4);
-
- hLayout->addWidget(m_iconLabel);
- hLayout->addWidget(m_titleLabel);
- hLayout->addWidget(new QLabel(i18n("Engines: "), this));
- hLayout->addWidget(m_engineBar);
- hLayout->addWidget(new TypeIconLabel(item.type, this));
-
- setLayout(hLayout);
-
- connect(m_engineBar, SIGNAL(searchEngineChanged(KService::Ptr)), this, SLOT(changeSearchEngine(KService::Ptr)));
-}
-
-
-QString SearchListItem::text()
-{
- return m_text;
-}
-
-
-void SearchListItem::changeSearchEngine(KService::Ptr engine)
-{
- // NOTE: This to let rekonq loading text typed in the requested engine on click.
- // There probably is a better way to do it. I just cannot see it now...
- UrlSearchItem item = UrlSearchItem(UrlSearchItem::Search, SearchEngine::buildQuery(engine, m_text), m_text);
- SearchListItem sItem(item, m_text, this);
- emit itemClicked(&sItem, Qt::LeftButton, Qt::NoModifier);
-}
-
-
-void SearchListItem::nextItemSubChoice()
-{
- m_engineBar->selectNextEngine();
-}
-
-
-// -----------------------------------------------------------------------------------------------
-
-
-EngineBar::EngineBar(KService::Ptr selectedEngine, QWidget *parent)
- : KToolBar(parent)
-{
- setIconSize(QSize(16, 16));
- setToolButtonStyle(Qt::ToolButtonIconOnly);
-
- m_engineGroup = new QActionGroup(this);
- m_engineGroup->setExclusive(true);
-
- if (SearchEngine::defaultEngine().isNull())
- return;
- m_engineGroup->addAction(newEngineAction(SearchEngine::defaultEngine(), selectedEngine));
- Q_FOREACH(const KService::Ptr & engine, SearchEngine::favorites())
- {
- if (engine->desktopEntryName() != SearchEngine::defaultEngine()->desktopEntryName())
- {
- m_engineGroup->addAction(newEngineAction(engine, selectedEngine));
- }
- }
-
- addActions(m_engineGroup->actions());
-}
-
-
-KAction *EngineBar::newEngineAction(KService::Ptr engine, KService::Ptr selectedEngine)
-{
- QUrl u = engine->property("Query").toUrl();
- KUrl url = KUrl(u.toString(QUrl::RemovePath | QUrl::RemoveQuery));
-
- KAction *a = new KAction(rApp->iconManager()->iconForUrl(url), engine->name(), this);
- a->setCheckable(true);
- if (engine->desktopEntryName() == selectedEngine->desktopEntryName()) a->setChecked(true);
- a->setData(engine->entryPath());
- connect(a, SIGNAL(triggered(bool)), this, SLOT(changeSearchEngine()));
- return a;
-}
-
-
-void EngineBar::changeSearchEngine()
-{
- KAction *a = qobject_cast<KAction*>(sender());
- emit searchEngineChanged(KService::serviceByDesktopPath(a->data().toString()));
-}
-
-
-void EngineBar::selectNextEngine()
-{
- QList<QAction *> e = m_engineGroup->actions();
- int i = 0;
- while (i < e.count() && !e.at(i)->isChecked())
- {
- i++;
- }
-
- if (i + 1 == e.count())
- {
- e.at(0)->setChecked(true);
- e.at(0)->trigger();
- }
- else
- {
- e.at(i + 1)->setChecked(true);
- e.at(i + 1)->trigger();
- }
-}
-
-
-// ---------------------------------------------------------------
-
-
-SuggestionListItem::SuggestionListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
- , m_text(item.title)
-{
- QHBoxLayout *hLayout = new QHBoxLayout;
- hLayout->setSpacing(4);
-
- hLayout->addWidget(new IconLabel(item.url, this));
- hLayout->addWidget(new TextLabel(item.title, text, this));
- hLayout->addWidget(new TypeIconLabel(item.type, this));
-
- setLayout(hLayout);
-}
-
-
-QString SuggestionListItem::text()
-{
- return m_text;
-}
-
-
-// ---------------------------------------------------------------
-
-
-VisualSuggestionListItem::VisualSuggestionListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
- , m_text(item.title)
-{
-
- QHBoxLayout *hLayout = new QHBoxLayout;
- hLayout->setSpacing(4);
- QLabel *previewLabelIcon = new QLabel(this);
-
- if (!item.image.isEmpty())
- {
- previewLabelIcon->setFixedSize(item.image_width + 10, item.image_height + 10);
- new ImageLabel(item.image, item.image_width, item.image_height, previewLabelIcon);
- IconLabel* icon = new IconLabel(item.url, previewLabelIcon);
- icon->move(item.image_width - 10, item.image_height - 10);
- }
- else
- {
- previewLabelIcon->setFixedSize(18, 18);
- new IconLabel(item.url, previewLabelIcon);
- }
-
- hLayout->addWidget(previewLabelIcon);
- QVBoxLayout *vLayout = new QVBoxLayout;
- vLayout->setMargin(0);
- vLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
- vLayout->addWidget(new TextLabel(item.title, text, this));
- DescriptionLabel *d = new DescriptionLabel("", this);
- vLayout->addWidget(d);
- vLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::MinimumExpanding));
- hLayout->addLayout(vLayout);
- hLayout->addWidget(new TypeIconLabel(item.type, this));
- setLayout(hLayout);
- d->setText("<i>" + item.description + "</i>");
-}
-
-
-QString VisualSuggestionListItem::text()
-{
- return m_text;
-}
-
-
-// ---------------------------------------------------------------
-
-
-BrowseListItem::BrowseListItem(const UrlSearchItem &item, const QString &text, QWidget *parent)
- : ListItem(item, parent)
-{
- QHBoxLayout *hLayout = new QHBoxLayout;
- hLayout->setSpacing(4);
-
- hLayout->addWidget(new IconLabel(item.url, this));
- hLayout->addWidget(new TextLabel(item.url, text, this));
- hLayout->addWidget(new TypeIconLabel(item.type, this));
-
- setLayout(hLayout);
-}
-
-
-// ---------------------------------------------------------------
-
-
-ListItem *ListItemFactory::create(const UrlSearchItem &item, const QString &text, QWidget *parent)
-{
- if (item.type & UrlSearchItem::Search)
- {
- return new SearchListItem(item, text, parent);
- }
-
- if (item.type & UrlSearchItem::Browse)
- {
- return new BrowseListItem(item, text, parent);
- }
-
- if (item.type & UrlSearchItem::History)
- {
- return new PreviewListItem(item, text, parent);
- }
-
- if (item.type & UrlSearchItem::Bookmark)
- {
- return new PreviewListItem(item, text, parent);
- }
-
- if (item.type & UrlSearchItem::Suggestion)
- {
- if (item.description.isEmpty())
- {
- return new SuggestionListItem(item, text, parent);
- }
-
- return new VisualSuggestionListItem(item, text, parent);
- }
-
- return new PreviewListItem(item, text, parent);
-}
diff --git a/src/urlbar/listitem.h b/src/urlbar/listitem.h
deleted file mode 100644
index 84e3501b..00000000
--- a/src/urlbar/listitem.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef LISTITEM_H
-#define LISTITEM_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KToolBar>
-#include <KService>
-#include <KUrl>
-
-// Qt Includes
-#include <QWidget>
-#include <QLabel>
-#include <QStyleOptionViewItemV4>
-#include <QString>
-#include <QByteArray>
-
-// Forward Declarations
-class UrlSearchItem;
-
-class KAction;
-class KIcon;
-class KJob;
-
-class QActionGroup;
-
-
-class ListItem : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit ListItem(const UrlSearchItem &item, QWidget *parent = 0);
- virtual ~ListItem();
-
- void activate();
- void deactivate();
-
- KUrl url();
- virtual QString text();
-
-public Q_SLOTS:
- virtual void nextItemSubChoice();
-
-Q_SIGNALS:
- void itemClicked(ListItem *item, Qt::MouseButton, Qt::KeyboardModifiers);
- void updateList();
-
-protected:
- virtual void paintEvent(QPaintEvent *event);
- virtual void enterEvent(QEvent *);
- virtual void leaveEvent(QEvent *);
- virtual void mousePressEvent(QMouseEvent *e);
-
-private:
- QStyleOptionViewItemV4 m_option;
-
-protected:
- KUrl m_url;
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class TypeIconLabel : public QLabel
-{
- Q_OBJECT
-
-public:
- explicit TypeIconLabel(int type, QWidget *parent = 0);
-
-private:
- QLabel *getIcon(QString icon);
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class IconLabel : public QLabel
-{
- Q_OBJECT
-
-public:
- explicit IconLabel(const QString &icon, QWidget *parent = 0);
- explicit IconLabel(const KIcon &icon, QWidget *parent = 0);
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class REKONQ_TESTS_EXPORT TextLabel : public QLabel
-{
- Q_OBJECT
-
-public:
- explicit TextLabel(const QString &text, const QString &textToPointOut = QString(), QWidget *parent = 0);
- explicit TextLabel(QWidget *parent = 0);
-
- void setEngineText(const QString &engine, const QString &text);
-};
-
-// -------------------------------------------------------------------------
-
-
-class DescriptionLabel : public QLabel
-{
- Q_OBJECT
-
-public:
- explicit DescriptionLabel(const QString &text, QWidget *parent = 0);
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class EngineBar : public KToolBar
-{
- Q_OBJECT
-
-public:
- explicit EngineBar(KService::Ptr selectedEngine, QWidget *parent = 0);
- void selectNextEngine();
-
-Q_SIGNALS:
- void searchEngineChanged(KService::Ptr engine);
-
-private Q_SLOTS:
- void changeSearchEngine();
-
-private:
- KAction *newEngineAction(KService::Ptr engine, KService::Ptr selectedEngine);
- QActionGroup *m_engineGroup;
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class SearchListItem : public ListItem
-{
- Q_OBJECT
-
-public:
- explicit SearchListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0);
- QString text();
-
-public Q_SLOTS:
- virtual void nextItemSubChoice();
-
-private Q_SLOTS:
- void changeSearchEngine(KService::Ptr engine);
-
-private:
- TextLabel* m_titleLabel;
- IconLabel* m_iconLabel;
- EngineBar* m_engineBar;
- QString m_text;
- KService::Ptr m_currentEngine;
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class SuggestionListItem : public ListItem
-{
- Q_OBJECT
-
-public:
- SuggestionListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0);
- QString text();
-
-private:
- QString m_text;
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class VisualSuggestionListItem : public ListItem
-{
- Q_OBJECT
-
-public:
- VisualSuggestionListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0);
- QString text();
-
-private:
- QString m_text;
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class PreviewListItem : public ListItem
-{
- Q_OBJECT
-
-public:
- PreviewListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0);
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class PreviewLabel : public QLabel
-{
- Q_OBJECT
-
-public:
- PreviewLabel(const QString &url, int width, int height, QWidget *parent = 0);
-};
-
-
-// -------------------------------------------------------------------------
-
-class ImageLabel : public QLabel
-{
- Q_OBJECT
-
-public:
- ImageLabel(const QString &url, int width, int height, QWidget *parent);
-
-private:
- QString m_url;
- QByteArray m_data;
-
-private Q_SLOTS:
- void slotData(KJob* job, const QByteArray& data);
- void slotResult(KJob* job);
-};
-
-
-// -------------------------------------------------------------------------
-
-
-class BrowseListItem : public ListItem
-{
- Q_OBJECT
-
-public:
- BrowseListItem(const UrlSearchItem &item, const QString &text, QWidget *parent = 0);
-};
-
-
-//-------------------------------------------------------------------------------------------------
-
-
-class ListItemFactory
-{
-public:
- static ListItem *create(const UrlSearchItem &item, const QString &text, QWidget *parent);
-};
-
-
-#endif
diff --git a/src/urlbar/newresourcedialog.cpp b/src/urlbar/newresourcedialog.cpp
deleted file mode 100644
index 39cffc36..00000000
--- a/src/urlbar/newresourcedialog.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/* ============================================================
-*
-* This is a part of the GSoC project 2011 - Fancy Bookmarking
-*
-* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "newresourcedialog.h"
-#include "newresourcedialog.moc"
-
-// Nepomuk Includes
-#include <Nepomuk/Vocabulary/NCO>
-#include <Nepomuk/Vocabulary/PIMO>
-#include <Nepomuk/Resource>
-#include <Nepomuk/Tag>
-
-// Qt Includes
-#include <QPlainTextEdit>
-#include <QVBoxLayout>
-#include <QLabel>
-
-
-class Nepomuk::NewResourceDialog::Private
-{
-public:
- KLineEdit *m_resourceName;
- QPlainTextEdit *m_description;
- QLabel *m_titleResource;
- QLabel *m_desResource;
- Nepomuk::NewResourceDialog *q;
- Nepomuk::Resource m_nofResource;
- int m_index;
-};
-
-
-Nepomuk::NewResourceDialog::NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent):
- KDialog(parent),
- d(new Private())
-{
- d->q = this;
- d->m_index = index;
- d->m_nofResource = nfoResource;
- setWindowTitle(i18n("Link to new Resource"));
- setButtonText(Ok, i18n("Link"));
- setMinimumSize(200, 150);
-
- QVBoxLayout *layout = new QVBoxLayout(mainWidget());
- d->m_resourceName = new KLineEdit(mainWidget());
- d->m_titleResource = new QLabel(mainWidget());
- d->m_titleResource->setText(i18n("* Resource Name:"));
- layout->addWidget(d->m_titleResource);
- layout->addWidget(d->m_resourceName);
- d->m_description = new QPlainTextEdit(mainWidget());
- d->m_desResource = new QLabel(mainWidget());
- d->m_desResource->setText(i18n("Description (Optional)"));
- layout->addWidget(d->m_desResource);
- layout->addWidget(d->m_description);
-
- connect(this, SIGNAL(okClicked()), this, SLOT(newResourceSlot()));
-}
-
-
-Nepomuk::NewResourceDialog::~NewResourceDialog()
-{
- delete d;
-}
-
-
-void Nepomuk::NewResourceDialog::newResourceSlot()
-{
- if (d->m_index == 1)
- {
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Person());
- newResource.addSymbol("user-identity");
- d->m_nofResource.addIsRelated(newResource);
- }
- else if (d->m_index == 2)
- {
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Project());
- newResource.addSymbol("project-development");
- d->m_nofResource.addIsRelated(newResource);
- }
- else if (d->m_index == 3)
- {
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Task());
- newResource.addSymbol("view-pim-tasks");
- d->m_nofResource.addIsRelated(newResource);
- }
- else if (d->m_index == 4)
- {
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Location());
- newResource.addSymbol("user-location");
- d->m_nofResource.addIsRelated(newResource);
- }
- else if (d->m_index == 5)
- {
- Nepomuk::Resource newResource(d->m_resourceName->text(), Nepomuk::Vocabulary::PIMO::Note());
- newResource.addSymbol("knotes");
- d->m_nofResource.addIsRelated(newResource);
- }
-}
diff --git a/src/urlbar/newresourcedialog.h b/src/urlbar/newresourcedialog.h
deleted file mode 100644
index 651c631c..00000000
--- a/src/urlbar/newresourcedialog.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* ============================================================
-*
-* This is a part of the GSoC project 2011 - Fancy Bookmarking
-*
-* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef NEWRESOURCEDIALOG_H
-#define NEWRESOURCEDIALOG_H
-
-
-// KDE Includes
-#include <KDialog>
-#include <KLineEdit>
-
-#include <Nepomuk/Resource>
-
-
-namespace Nepomuk
-{
-class NewResourceDialog : public KDialog
-{
- Q_OBJECT
-
-public:
- explicit NewResourceDialog(int index, Nepomuk::Resource& nfoResource, QWidget* parent = 0);
- virtual ~NewResourceDialog();
-
-private Q_SLOTS:
- void newResourceSlot();
-
-private:
- class Private;
- Private* const d;
-};
-}
-
-#endif // NEWRESOURCEDIALOG_H
diff --git a/src/urlbar/resourcelinkdialog.cpp b/src/urlbar/resourcelinkdialog.cpp
deleted file mode 100644
index 8a4b5685..00000000
--- a/src/urlbar/resourcelinkdialog.cpp
+++ /dev/null
@@ -1,385 +0,0 @@
-/* ============================================================
-*
-* This is a part of the GSoC project 2011 - Fancy Bookmarking
-*
-* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "resourcelinkdialog.h"
-#include "resourcelinkdialog.moc"
-
-// Local Includes
-#include "newresourcedialog.h"
-
-// Qt Includes
-#include <QGridLayout>
-#include <QHBoxLayout>
-#include <QComboBox>
-#include <QAbstractItemView>
-#include <QLabel>
-#include <QListView>
-#include <QPushButton>
-#include <QColumnView>
-#include <QStringListModel>
-#include <QStandardItem>
-#include <QModelIndexList>
-#include <QItemSelectionModel>
-#include <QMenu>
-#include <QListWidget>
-
-// KDE Includes
-#include <KLocale>
-#include <KDebug>
-#include <KAction>
-#include <KIcon>
-
-// Nepomuk Includes
-#include <Nepomuk/Utils/SimpleResourceModel>
-#include <Nepomuk/Query/Term>
-#include <Nepomuk/Query/Result>
-#include <Nepomuk/Query/ResourceTypeTerm>
-#include <Nepomuk/Query/QueryServiceClient>
-#include <Nepomuk/Vocabulary/PIMO>
-#include <Nepomuk/Vocabulary/NCO>
-#include <Nepomuk/Query/QueryParser>
-#include <Nepomuk/Variant>
-
-
-class Nepomuk::ResourceLinkDialog::Private
-{
-public:
- void _k_selectionChanged();
-
- KLineEdit *m_searchBox;
- QListView *m_resourceView;
- QListView *m_linkedResources;
- KAction *m_removeResourceAction;
- QComboBox *m_resourceSelect;
- QLabel *m_resourceLabel;
- QLabel *m_linkedResourceLabel;
- QColumnView *m_leftPanel;
- QStringListModel *m_model;
- QPushButton *m_newResourceButton;
- Utils::SimpleResourceModel *m_resourceModel;
- Utils::SimpleResourceModel *m_linkedResourceModel;
- Nepomuk::ResourceLinkDialog *q;
-
- Nepomuk::Resource m_nfoResource;
-
-};
-
-
-void Nepomuk::ResourceLinkDialog::Private::_k_selectionChanged()
-{
- q->enableButton(KDialog::User1, !m_resourceView->selectionModel()->selectedRows().isEmpty());
-}
-
-
-Nepomuk::ResourceLinkDialog::ResourceLinkDialog(Nepomuk::Resource &nfoResource, QWidget* parent):
- KDialog(parent),
- d(new Private())
-{
- d->m_nfoResource = nfoResource;
- setWindowTitle(i18n("Resource Linker"));
- setButtons(Ok | User1 | User2 | Cancel);
- enableButtonCancel(true);
- enableButtonOk(true);
- enableButton(User1, false);
- setButtonText(Ok, i18n("Done"));
- setButtonText(User1, i18n("Link"));
- setButtonText(User2, "Unlink");
- setMinimumSize(400, 350);
-// d->m_resourceView->setSelectionMode(QAbstractItemView::ExtendedSelection);
- QGridLayout *mainLayout = new QGridLayout(mainWidget());
-
- d->q = this;
-
- d->m_linkedResources = new QListView(mainWidget());
- d->m_linkedResourceModel = new Utils::SimpleResourceModel(this);
- d->m_linkedResources->setModel(d->m_linkedResourceModel);
- setRelatedResources();
-
- d->m_searchBox = new KLineEdit(mainWidget());
- d->m_searchBox->setPlaceholderText(i18n("Search resources"));
- connect(d->m_searchBox, SIGNAL(textChanged(QString)), this, SLOT(dynamicSearchingSlot()));
-
- d->m_resourceView = new QListView(mainWidget());
- d->m_resourceView->setToolTip(i18n(" Double click to link resource "));
- d->m_resourceModel = new Utils::SimpleResourceModel(this);
- d->m_resourceView->setModel(d->m_resourceModel);
-
- d->m_resourceSelect = new QComboBox(mainWidget());
- QStringList rlist;
- rlist << i18n("Any resource") << i18n("Persons") << i18n("Projects") << i18n("Tasks") << i18n("Places") << i18n("Notes");
- d->m_resourceSelect->addItems(rlist);
- d->m_resourceSelect->setItemIcon(1, KIcon("user-identity"));
- d->m_resourceSelect->setItemIcon(2, KIcon("project-development"));
- d->m_resourceSelect->setItemIcon(3, KIcon("view-pim-tasks"));
- d->m_resourceSelect->setItemIcon(4, KIcon("user-location"));
- d->m_resourceSelect->setItemIcon(5, KIcon("knotes"));
- connect(d->m_resourceSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(resourceSelectedSlot(int)));
-
- d->m_resourceLabel = new QLabel(i18n("Matching resources:"), mainWidget());
- d->m_linkedResourceLabel = new QLabel(i18n("Linked Resources:"), mainWidget());
-
-
- d->m_newResourceButton = new QPushButton(mainWidget());
- d->m_newResourceButton->setText(i18n("Create New Resource"));
- if (d->m_resourceSelect->currentIndex() == 0)
- {
- d->m_newResourceButton->setEnabled(false);
- }
- connect(d->m_newResourceButton, SIGNAL(clicked()), this, SLOT(createNewResourceSlot()));
-
- QVBoxLayout *vlayoutR = new QVBoxLayout;
- QVBoxLayout *vlayoutL = new QVBoxLayout;
- vlayoutL->addWidget(d->m_searchBox);
- vlayoutL->addWidget(d->m_resourceLabel);
- vlayoutL->addWidget(d->m_resourceView);
- vlayoutR->addWidget(d->m_resourceSelect);
- vlayoutR->addWidget(d->m_linkedResourceLabel);
- vlayoutR->addWidget(d->m_linkedResources);
- vlayoutR->addWidget(d->m_newResourceButton);
- mainLayout->addLayout(vlayoutL, 1 , 1);
- mainLayout->addLayout(vlayoutR, 1, 2);
- mainLayout->setColumnMinimumWidth(1, 100);
-
- d->m_linkedResources->setContextMenuPolicy(Qt::CustomContextMenu);
-
- connect(d->m_resourceView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
- this, SLOT(_k_selectionChanged()));
- connect(d->m_linkedResources->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
- this, SLOT(_k_selectionChanged()));
- connect(this, SIGNAL(user1Clicked()), this, SLOT(linkResourceSlot()));
- connect(this, SIGNAL(user2Clicked()), this, SLOT(unlinkResourceSlot()));
- connect(d->m_resourceView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(linkResourceSlot()));
- connect(d->m_linkedResources, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
-
- if (!d->m_linkedResources->selectionModel()->selectedRows().isEmpty())
- {
- enableButton(User2, true);
- }
-}
-
-
-Nepomuk::ResourceLinkDialog::~ResourceLinkDialog()
-{
- delete d;
-}
-
-
-void Nepomuk::ResourceLinkDialog::setRelatedResources()
-{
- QList<Nepomuk::Resource> relatedResourceList = d->m_nfoResource.isRelateds();
- d->m_linkedResourceModel->setResources(relatedResourceList);
-
-}
-
-
-void Nepomuk::ResourceLinkDialog::linkResourceSlot()
-{
- QModelIndexList selectedResourceList;
- selectedResourceList << d->m_resourceView->selectionModel()->selectedIndexes();
- Q_FOREACH(const QModelIndex & i, selectedResourceList)
- {
- d->m_resourceView->selectionModel()->setCurrentIndex(i, QItemSelectionModel::NoUpdate);
- d->m_nfoResource.addIsRelated(d->m_resourceModel->resourceForIndex(d->m_resourceView->selectionModel()->currentIndex()));
- }
- setRelatedResources();
-}
-
-
-void Nepomuk::ResourceLinkDialog::unlinkResourceSlot()
-{
- d->m_nfoResource.removeProperty(Nepomuk::Resource::isRelatedUri(),
- d->m_linkedResourceModel->resourceForIndex(
- d->m_linkedResources->selectionModel()->currentIndex()));
- setRelatedResources();
-}
-
-
-void Nepomuk::ResourceLinkDialog::showContextMenu(const QPoint &pos)
-{
- d->m_removeResourceAction = new KAction(this);
- d->m_removeResourceAction->setText(i18n("&Unlink "));
- d->m_removeResourceAction->setIcon(KIcon("edit-delete"));
- connect(d->m_removeResourceAction, SIGNAL(triggered(bool)), this, SLOT(unlinkResourceSlot()));
-
- QMenu myMenu;
- QPoint globalPos = d->m_linkedResources->mapToGlobal(pos);
- myMenu.addAction(d->m_removeResourceAction);
- myMenu.exec(globalPos);
-}
-
-
-void Nepomuk::ResourceLinkDialog::createNewResourceSlot()
-{
- Nepomuk::NewResourceDialog newResource(d->m_resourceSelect->currentIndex(), d->m_nfoResource);
- //close();
- newResource.exec();
- setRelatedResources();
-}
-
-
-void Nepomuk::ResourceLinkDialog::dynamicSearchingSlot()
-{
- Nepomuk::Query::Query query;
- Nepomuk::Query::QueryServiceClient *test;
- switch (d->m_resourceSelect->currentIndex())
- {
- case 1:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person());
- test = new Nepomuk::Query::QueryServiceClient(this);
- test->query(query);
- d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
- break;
-
- case 2:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project());
- test = new Nepomuk::Query::QueryServiceClient(this);
- test->query(query);
- d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
- break;
-
- case 3:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task());
- test = new Nepomuk::Query::QueryServiceClient(this);
- test->query(query);
- d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
- break;
-
- case 4:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location());
- test = new Nepomuk::Query::QueryServiceClient(this);
- test->query(query);
- d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
- break;
-
- case 5:
- query = Nepomuk::Query::QueryParser::parseQuery(d->m_searchBox->text());
- query = query && Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note());
- test = new Nepomuk::Query::QueryServiceClient(this);
- test->query(query);
- d->m_resourceModel->clear();
- connect(test, SIGNAL(newEntries(QList<Nepomuk::Query::Result>)),
- d->m_resourceModel, SLOT(addResults(QList<Nepomuk::Query::Result>)));
- break;
-
- default:
- break;
- }
-}
-
-
-void Nepomuk::ResourceLinkDialog::resourceSelectedSlot(int index)
-{
- enableButton(User1, true);
- d->m_newResourceButton->setEnabled(true);
- if (index == 0)
- {
- d->m_resourceModel->clear();
- d->m_newResourceButton->setEnabled(false);
- }
- //List Personal Contacts
- if (index == 1)
- {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Person());
- Nepomuk::Query::Query query(term);
- query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
- {
- resource.append(result.resource());
- }
- d->m_resourceModel->setResources(resource);
- }
- //List Projects
- else if (index == 2)
- {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Project());
- Nepomuk::Query::Query query(term);
- query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
- {
- resource.append(result.resource());
- }
- d->m_resourceModel->setResources(resource);
- }
- //List Tasks
- else if (index == 3)
- {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Task());
- Nepomuk::Query::Query query(term);
- query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
- {
- resource.append(result.resource());
- }
- d->m_resourceModel->setResources(resource);
- }
- //List Places
- else if (index == 4)
- {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Location());
- Nepomuk::Query::Query query(term);
- query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
- {
- resource.append(result.resource());
- }
- d->m_resourceModel->setResources(resource);
- }
- //List Notes
- else if (index == 5)
- {
- Nepomuk::Query::Term term = Nepomuk::Query::ResourceTypeTerm(Nepomuk::Vocabulary::PIMO::Note());
- Nepomuk::Query::Query query(term);
- query.setLimit(20);
- QList<Nepomuk::Query::Result>results = Nepomuk::Query::QueryServiceClient::syncQuery(query);
- QList <Nepomuk::Resource> resource;
- Q_FOREACH(const Nepomuk::Query::Result & result, results)
- {
- resource.append(result.resource());
- }
- d->m_resourceModel->setResources(resource);
- }
-}
diff --git a/src/urlbar/resourcelinkdialog.h b/src/urlbar/resourcelinkdialog.h
deleted file mode 100644
index e628aa10..00000000
--- a/src/urlbar/resourcelinkdialog.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* ============================================================
-*
-* This is a part of the GSoC project 2011 - Fancy Bookmarking
-*
-* Copyright (c) 2011-2012 by Phaneendra Hegde <pnh.pes@gmail.com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef RESOURCELINKDIALOG_H
-#define RESOURCELINKDIALOG_H
-
-//Qt includes
-#include <QListView>
-
-//kde includes
-#include <KDialog>
-#include <KLineEdit>
-#include <KConfigDialog>
-
-
-namespace Nepomuk
-{
-class Resource;
-
-namespace Query
-{
-class Query;
-}
-
-class ResourceLinkDialog : public KDialog
-{
- Q_OBJECT
-
-public:
- explicit ResourceLinkDialog(Nepomuk::Resource& nfoResource, QWidget* parent = 0);
- virtual ~ResourceLinkDialog();
- void setRelatedResources();
-
-private Q_SLOTS:
- void dynamicSearchingSlot();
- void resourceSelectedSlot(int);
- void linkResourceSlot();
- void unlinkResourceSlot();
- void createNewResourceSlot();
- void showContextMenu(const QPoint&);
-
-
-private:
- class Private;
- Private* const d;
-
-};
-}
-
-#endif // RESOURCELINKDIALOG_H
diff --git a/src/urlbar/rsswidget.cpp b/src/urlbar/rsswidget.cpp
deleted file mode 100644
index 2e452fbb..00000000
--- a/src/urlbar/rsswidget.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Auto Includes
-#include "rsswidget.h"
-#include "rsswidget.moc"
-
-// Local includes
-#include "application.h"
-#include "iconmanager.h"
-#include "mainwindow.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KComboBox>
-#include <KLocalizedString>
-#include <KMessageBox>
-#include <KProcess>
-#include <KUrl>
-
-// Qt Includes
-#include <QDBusConnectionInterface>
-#include <QDBusInterface>
-
-#include <QDialogButtonBox>
-#include <QFormLayout>
-#include <QLabel>
-#include <QPushButton>
-
-
-RSSWidget::RSSWidget(const QMap< KUrl, QString > &map, QWidget *parent)
- : QMenu(parent)
- , m_map(map)
-{
- setAttribute(Qt::WA_DeleteOnClose);
- setFixedWidth(350);
-
- QFormLayout *layout = new QFormLayout(this);
-
- // Title
- QLabel *title = new QLabel(this);
- title->setText(i18n("Subscribe to RSS Feeds"));
- QFont f = title->font();
- f.setBold(true);
- title->setFont(f);
- layout->addRow(title);
-
- // Agregators
- QLabel *agregator = new QLabel(this);
- agregator->setText(i18n("Aggregator:"));
-
- m_agregators = new KComboBox(this);
- m_agregators->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-
- m_agregators->addItem(KIcon("akregator"), QString("Akregator"));
- m_agregators->addItem(rApp->iconManager()->iconForUrl(KUrl("http://google.com/reader")), i18n("Google Reader"));
-
- layout->addRow(agregator, m_agregators);
-
- // Feeds List
- QLabel *feed = new QLabel(this);
- feed->setText(i18n("Feed:"));
-
- m_feeds = new KComboBox(this);
- m_feeds->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-
- Q_FOREACH(const QString & title, m_map)
- {
- m_feeds->addItem(title);
- }
-
- layout->addRow(feed, m_feeds);
-
- // Buttons
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel, Qt::Horizontal, this);
-
- QPushButton *addFeed = new QPushButton(KIcon("list-add"), i18n("Add Feed"), buttonBox);
- buttonBox->addButton(addFeed, QDialogButtonBox::AcceptRole);
-
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
-
- layout->addRow(buttonBox);
-}
-
-
-void RSSWidget::showAt(const QPoint &pos)
-{
- adjustSize();
-
- QPoint p(pos.x() - width(), pos.y() + 10);
- move(p);
- show();
-}
-
-
-void RSSWidget::accept()
-{
- QString url = m_map.key(m_feeds->currentText()).toMimeDataString();
-
- if (m_agregators->currentIndex() == 0)
- addWithAkregator(url);
- else
- addWithGoogleReader(url);
-
- close();
-}
-
-
-void RSSWidget::addWithGoogleReader(const QString &url)
-{
- KUrl toLoad = KUrl("http://www.google.com/ig/add?feedurl=" + url);
- rApp->mainWindow()->currentTab()->view()->load(toLoad);
-}
-
-
-void RSSWidget::addWithAkregator(const QString &url)
-{
- // Akregator is running
- if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.akregator"))
- {
- QDBusInterface akregator("org.kde.akregator", "/Akregator", "org.kde.akregator.part");
- QDBusReply<void> reply = akregator.call("addFeedsToGroup", QStringList(url) , i18n("Imported Feeds"));
-
- if (!reply.isValid())
- {
- KMessageBox::error(0, QString(i18n("Could not add feed to Akregator. Please add it manually:")
- + "<br /><br /> <a href=\"" + url + "\">" + url + "</a>"));
- }
- }
- // Akregator is not running
- else
- {
- KProcess proc;
- proc << "akregator" << "-g" << i18n("Imported Feeds");
- proc << "-a" << url;
- if (proc.startDetached() == 0)
- {
- KMessageBox::error(0, QString(i18n("There was an error. Please verify Akregator is installed on your system.")
- + "<br /><br /> <a href=\"" + url + "\">" + url + "</a>"));
- }
- }
-}
diff --git a/src/urlbar/rsswidget.h b/src/urlbar/rsswidget.h
deleted file mode 100644
index eaa3de7d..00000000
--- a/src/urlbar/rsswidget.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef RSSWIDGET_H
-#define RSSWIDGET_H
-
-// Qt Includes
-#include <QMenu>
-
-// Forward Declarations
-class KComboBox;
-class KUrl;
-
-
-class RSSWidget : public QMenu
-{
- Q_OBJECT
-
-public:
- // QMap< feedUrl, feedTitle>
- RSSWidget(const QMap<KUrl, QString> &map, QWidget *parent = 0);
-
- void showAt(const QPoint &pos);
-
-private Q_SLOTS:
- void accept();
-
-private:
- void addWithAkregator(const QString &url);
- void addWithGoogleReader(const QString &url);
-
- QMap<KUrl, QString> m_map;
-
- KComboBox *m_agregators;
- KComboBox *m_feeds;
-};
-
-#endif // RSSWIDGET_H
diff --git a/src/urlbar/sslwidget.cpp b/src/urlbar/sslwidget.cpp
deleted file mode 100644
index 52724733..00000000
--- a/src/urlbar/sslwidget.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Auto Includes
-#include "sslwidget.h"
-#include "sslwidget.moc"
-
-// Local includes
-#include "application.h"
-#include "historymanager.h"
-#include "sslinfodialog.h"
-
-// Qt Includes
-#include <QPointer>
-
-#include <QDialogButtonBox>
-#include <QGridLayout>
-#include <QLabel>
-#include <QPushButton>
-#include <QTextDocument>
-
-
-SSLWidget::SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent)
- : QMenu(parent)
- , m_url(url)
- , m_info(info)
-{
- setAttribute(Qt::WA_DeleteOnClose);
- setMinimumWidth(400);
-
- QList<QSslCertificate> certList = m_info.certificateChain();
- QSslCertificate cert;
- if (!certList.isEmpty())
- cert = certList.first();
-
- QList<QStringList> certErrorList = SslInfoDialog::errorsFromString(m_info.certificateErrors());
- QStringList firstCertErrorList;
- if (!certErrorList.isEmpty())
- firstCertErrorList = certErrorList.first();
-
- QGridLayout *layout = new QGridLayout(this);
-
- QLabel *label;
- QLabel *imageLabel;
-
- int rows = 0;
- // ------------------------------------------------------------------------------------------------------
- imageLabel = new QLabel(this);
- layout->addWidget(imageLabel, rows , 0, Qt::AlignCenter);
-
- label = new QLabel(this);
- label->setWordWrap(true);
- label->setText(i18n("Identity"));
- QFont f1 = label->font();
- f1.setBold(true);
- label->setFont(f1);
- layout->addWidget(label, rows++, 1);
-
- label = new QLabel(this);
- label->setWordWrap(true);
- if (cert.isNull())
- {
- label->setText(i18n("Warning: this site is NOT carrying a certificate."));
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
- layout->addWidget(label, rows++, 1);
- }
- else
- {
- if (cert.isValid() && firstCertErrorList.isEmpty())
- {
- label->setText(i18n("The certificate for this site is valid and has been verified by:\n%1.",
- Qt::escape(cert.issuerInfo(QSslCertificate::CommonName))));
-
- imageLabel->setPixmap(KIcon("security-high").pixmap(32));
- }
- else
- {
- QString c = QL1S("<ul>");
- Q_FOREACH(const QString & s, firstCertErrorList)
- {
- c += QL1S("<li>") + s + QL1S("</li>");
- }
- c += QL1S("</ul>");
-
- label->setText(i18n("The certificate for this site is NOT valid, for the following reasons:\n%1.", c));
- label->setTextFormat(Qt::RichText);
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
- }
-
- layout->addWidget(label, rows++, 1);
-
- label = new QLabel(this);
- label->setWordWrap(true);
- label->setText(QL1S("<a href=\"moresslinfos\">") + i18n("Certificate Information") + QL1S("</a>"));
- connect(label, SIGNAL(linkActivated(QString)), this, SLOT(showMoreSslInfos(QString)));
- layout->addWidget(label, rows++, 1);
- }
-
- // -------------------------------------------------------------------------------------------------------------
- label = new QLabel(this);
- label->setWordWrap(true);
- label->setText(i18n("Encryption"));
- QFont f2 = label->font();
- f2.setBold(true);
- label->setFont(f2);
- layout->addWidget(label, rows, 1);
-
- imageLabel = new QLabel(this);
- layout->addWidget(imageLabel, rows++ , 0, Qt::AlignCenter);
-
- QString ciph = m_info.ciphers();
- if (ciph.isEmpty()) // NOTE: Can I verify encryption in another (better?) way?
- {
- label = new QLabel(this);
- label->setWordWrap(true);
- label->setText(i18n("Your connection to %1 is NOT encrypted.\n", m_url.host()));
- layout->addWidget(label, rows++ , 1);
-
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
- }
- else
- {
- label = new QLabel(this);
- label->setWordWrap(true);
- label->setText(i18n("Your connection to \"%1\" is encrypted.\n", m_url.host()));
- layout->addWidget(label, rows++, 1);
-
- QString vers = m_info.protocol();
- QString sslVersion;
- if (vers == QL1S("SSLv3"))
- {
- sslVersion = QL1S("SSL 3.0");
- imageLabel->setPixmap(KIcon("security-high").pixmap(32));
- }
- else if (vers == QL1S("SSLv2"))
- {
- sslVersion = QL1S("SSL 2.0");
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
- }
- else if (vers == QL1S("TLSv1"))
- {
- sslVersion = QL1S("TLS 1.0");
- imageLabel->setPixmap(KIcon("security-high").pixmap(32));
- }
- else
- {
- sslVersion = i18n("Unknown");
- imageLabel->setPixmap(KIcon("security-low").pixmap(32));
- }
-
- label = new QLabel(this);
- label->setWordWrap(true);
- label->setText(i18n("It uses protocol: %1.\n", sslVersion));
- layout->addWidget(label, rows++, 1);
-
- const QStringList cipherInfo = m_info.ciphers().split('\n', QString::SkipEmptyParts);
- label = new QLabel(this);
- label->setWordWrap(true);
- label->setText(
- i18n("It is encrypted using %1 at %2 bits, with %3 for message authentication and %4 with Auth %5 as key exchange mechanism.\n\n",
- cipherInfo[0],
- m_info.usedChiperBits(),
- cipherInfo[3],
- cipherInfo[2],
- cipherInfo[1])
- );
- layout->addWidget(label, rows++, 1);
-
- }
-
- // ------------------------------------------------------------------------------------------------------------------
- imageLabel = new QLabel(this);
- layout->addWidget(imageLabel, rows , 0, Qt::AlignCenter);
-
- label = new QLabel(this);
- label->setWordWrap(true);
- label->setText(i18n("Site Information"));
- QFont f3 = label->font();
- f3.setBold(true);
- label->setFont(f3);
- layout->addWidget(label, rows++, 1);
-
- label = new QLabel(this);
- label->setWordWrap(true);
-
- QList<HistoryItem> hList = rApp->historyManager()->find(url.toString());
- HistoryItem firstVisit = hList.isEmpty() ?
- HistoryItem() :
- hList.first() ;
-
- if (firstVisit.visitCount == 1)
- {
- label->setText(i18n("It is your first time visiting this site."));
- imageLabel->setPixmap(KIcon("security-medium").pixmap(32));
- }
- else
- {
- label->setText(i18n("You just visited this site.\nYour first visit was on %1.\n", firstVisit.firstDateTimeVisit.toString()));
- imageLabel->setPixmap(KIcon("security-high").pixmap(32));
- }
- layout->addWidget(label, rows++, 1);
-
-}
-
-
-void SSLWidget::showAt(const QPoint &pos)
-{
- adjustSize();
-
- QPoint p(pos.x() - width(), pos.y() + 10);
- move(p);
- show();
-}
-
-
-void SSLWidget::accept()
-{
- close();
-}
-
-
-void SSLWidget::showMoreSslInfos(const QString &)
-{
- QPointer<SslInfoDialog> dlg = new SslInfoDialog(m_url.host(), m_info, this);
- dlg->exec();
- delete dlg;
-
- return;
-}
diff --git a/src/urlbar/sslwidget.h b/src/urlbar/sslwidget.h
deleted file mode 100644
index dd6f020d..00000000
--- a/src/urlbar/sslwidget.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef SSL_WIDGET_H
-#define SSL_WIDGET_H
-
-
-// Local Includes
-#include "websslinfo.h"
-
-// Qt Includes
-#include <QMenu>
-
-#include <QUrl>
-
-
-class SSLWidget : public QMenu
-{
- Q_OBJECT
-
-public:
- SSLWidget(const QUrl &url, const WebSslInfo &info, QWidget *parent = 0);
-
- void showAt(const QPoint &pos);
-
-private Q_SLOTS:
- void showMoreSslInfos(const QString &);
- void accept();
-
-private:
- QUrl m_url;
- WebSslInfo m_info;
-};
-
-#endif // SSL_WIDGET_H
diff --git a/src/urlbar/stackedurlbar.cpp b/src/urlbar/stackedurlbar.cpp
deleted file mode 100644
index 728a9c1b..00000000
--- a/src/urlbar/stackedurlbar.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "stackedurlbar.h"
-#include "stackedurlbar.moc"
-
-// Local Includes
-#include "urlbar.h"
-
-
-StackedUrlBar::StackedUrlBar(QWidget *parent)
- : QStackedWidget(parent)
-{
- // cosmetic
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
- setMinimumWidth(200);
- setMinimumHeight(20);
-}
-
-
-UrlBar *StackedUrlBar::currentUrlBar()
-{
- return urlBar(currentIndex());
-}
-
-
-UrlBar *StackedUrlBar::urlBar(int index)
-{
- UrlBar *urlBar = qobject_cast<UrlBar*>(QStackedWidget::widget(index));
- if (!urlBar)
- {
- kWarning() << "URL bar with index" << index << "not found. Returning NULL. line:" << __LINE__;
- }
-
- return urlBar;
-}
-
-
-void StackedUrlBar::moveBar(int from, int to)
-{
- QWidget *fromBar = widget(from);
- removeWidget(fromBar);
- insertWidget(to, fromBar);
-}
diff --git a/src/urlbar/stackedurlbar.h b/src/urlbar/stackedurlbar.h
deleted file mode 100644
index 7296a2f8..00000000
--- a/src/urlbar/stackedurlbar.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef STACKED_URLBAR_H
-#define STACKED_URLBAR_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QStackedWidget>
-
-// Forward Declarations
-class UrlBar;
-
-
-class REKONQ_TESTS_EXPORT StackedUrlBar : public QStackedWidget
-{
- Q_OBJECT
-
-public:
- StackedUrlBar(QWidget *parent = 0);
-
- UrlBar *currentUrlBar();
- UrlBar *urlBar(int index);
-
-private Q_SLOTS:
- void moveBar(int, int);
-};
-
-#endif // STACKED_URLBAR_H
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
deleted file mode 100644
index 21debceb..00000000
--- a/src/urlbar/urlbar.cpp
+++ /dev/null
@@ -1,773 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "urlbar.h"
-#include "urlbar.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "mainwindow.h"
-#include "webtab.h"
-#include "webpage.h"
-#include "webview.h"
-#include "completionwidget.h"
-#include "bookmarkmanager.h"
-#include "bookmarkowner.h"
-#include "bookmarkwidget.h"
-#include "iconmanager.h"
-#include "favoritewidget.h"
-#include "searchengine.h"
-#include "websnap.h"
-
-// KDE Includes
-#include <KCompletionBox>
-#include <KStandardDirs>
-#include <KColorScheme>
-#include <KMenu>
-#include <KIconLoader>
-
-// Qt Includes
-#include <QPainter>
-#include <QPaintEvent>
-#include <QPalette>
-#include <QVBoxLayout>
-#include <QClipboard>
-#include <QTimer>
-
-// const values
-const int c_iconMargin = 4;
-
-
-IconButton::IconButton(QWidget *parent)
- : QToolButton(parent)
-{
- setToolButtonStyle(Qt::ToolButtonIconOnly);
- setStyleSheet("IconButton { background-color:transparent; border: none; padding: 0px}");
- setCursor(Qt::ArrowCursor);
-
- setContextMenuPolicy(Qt::PreventContextMenu);
-}
-
-
-void IconButton::mouseReleaseEvent(QMouseEvent* event)
-{
- emit clicked(event->globalPos());
-}
-
-
-// -----------------------------------------------------------------------------------------------------------
-
-
-QString guessUrlWithCustomFirstLevel(const QString &str1, const QString &str2)
-{
- QUrl url(QL1S("http://www.") + str1);
- QString host = url.host().toLower();
- if (!host.endsWith(str2, Qt::CaseInsensitive))
- {
- host += str2;
- url.setHost(host);
- }
- return url.toString();
-}
-
-// -----------------------------------------------------------------------------------------------------------
-
-
-UrlBar::UrlBar(QWidget *parent)
- : KLineEdit(parent)
- , _tab(0)
- , _icon(new IconButton(this))
- , _suggestionTimer(new QTimer(this))
-{
- setLayoutDirection(Qt::LeftToRight);
-
- // set initial icon
- _icon->setIcon(KIcon("arrow-right"));
-
- // initial style
- setStyleSheet(QString("UrlBar { padding: 2px 0 2px %1px; height: %1px } ").arg(_icon->sizeHint().width()));
-
- // doesn't show the clear button
- setClearButtonShown(false);
-
- // enable dragging
- setDragEnabled(true);
-
- // insert decoded URLs
- setUrlDropsEnabled(true);
-
- // tooltip
- setToolTip(i18n("Type here to search your bookmarks, history and the web..."));
-
- // accept focus, via tabbing, clicking & wheeling
- setFocusPolicy(Qt::WheelFocus);
-
- // disable completion object (we have our own :) )
- setCompletionObject(0);
-
- _tab = qobject_cast<WebTab *>(parent);
-
- connect(_tab, SIGNAL(loadProgressing()), this, SLOT(update()));
-
- connect(_tab->view(), SIGNAL(urlChanged(QUrl)), this, SLOT(setQUrl(QUrl)));
- connect(_tab->view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
- connect(_tab->view(), SIGNAL(loadStarted()), this, SLOT(clearRightIcons()));
- connect(_tab->view(), SIGNAL(iconChanged()), this, SLOT(refreshFavicon()));
-
- // search icon
- connect(rApp->opensearchManager(), SIGNAL(openSearchEngineAdded(QString)), this, SLOT(updateRightIcons()));
-
- // bookmark icon
- connect(rApp->bookmarkManager(), SIGNAL(bookmarksUpdated()), this, SLOT(updateRightIcons()));
-
- _suggestionTimer->setSingleShot(true);
- connect(_suggestionTimer, SIGNAL(timeout()), this, SLOT(suggest()));
-
- activateSuggestions(true);
-}
-
-
-UrlBar::~UrlBar()
-{
- _suggestionTimer->stop();
- activateSuggestions(false);
- _box.clear();
-
- disconnect();
-}
-
-
-void UrlBar::setQUrl(const QUrl& url)
-{
- if (url.scheme() == QL1S("about"))
- {
- clear();
- setFocus();
- }
- else
- {
- clearFocus();
- KLineEdit::setUrl(url);
- setCursorPosition(0);
- refreshFavicon();
- }
-}
-
-
-void UrlBar::loadRequestedUrl(const KUrl& url, Rekonq::OpenType type)
-{
- activateSuggestions(false);
- clearFocus();
- setUrl(url);
- rApp->loadUrl(url, type);
-}
-
-
-void UrlBar::loadDigitedUrl()
-{
- UrlResolver res(text());
- UrlSearchList list = res.orderedSearchItems();
- if (list.isEmpty())
- {
- loadRequestedUrl(KUrl(text()));
- }
- else
- {
- loadRequestedUrl(list.first().url);
- }
-}
-
-
-void UrlBar::paintEvent(QPaintEvent *event)
-{
- KColorScheme colorScheme(palette().currentColorGroup());
- QColor backgroundColor;
- QColor foregroundColor;
-
- if (QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- {
- backgroundColor = QColor(220, 220, 220); // light gray
- foregroundColor = Qt::black;
- }
- else
- {
- backgroundColor = rApp->palette().color(QPalette::Base);
- foregroundColor = rApp->palette().color(QPalette::Text);
- }
-
- // set background color of UrlBar
- QPalette p = palette();
-
- int progr = _tab->progress();
- if (progr == 0 || progr == 100)
- {
- if (_tab->url().scheme() == QL1S("https"))
- {
- backgroundColor = _tab->page()->hasSslValid()
- ? colorScheme.background(KColorScheme::PositiveBackground).color()
- : colorScheme.background(KColorScheme::NegativeBackground).color();
-
- foregroundColor = colorScheme.foreground(KColorScheme::NormalText).color();
- }
- p.setBrush(QPalette::Base, backgroundColor);
- p.setBrush(QPalette::Text, foregroundColor);
- }
- else
- {
- QColor highlight = rApp->palette().color(QPalette::Highlight);
-
- int r = (highlight.red() + 2 * backgroundColor.red()) / 3;
- int g = (highlight.green() + 2 * backgroundColor.green()) / 3;
- int b = (highlight.blue() + 2 * backgroundColor.blue()) / 3;
-
- QColor loadingColor(r, g, b);
-
- if (abs(loadingColor.lightness() - backgroundColor.lightness()) < 20) //eg. Gaia color scheme
- {
- r = (2 * highlight.red() + backgroundColor.red()) / 3;
- g = (2 * highlight.green() + backgroundColor.green()) / 3;
- b = (2 * highlight.blue() + backgroundColor.blue()) / 3;
- loadingColor = QColor(r, g, b);
- }
-
- QLinearGradient gradient(QPoint(0, 0), QPoint(width(), 0));
- gradient.setColorAt(0, loadingColor);
- gradient.setColorAt(((double)progr) / 100 - .000001, loadingColor);
- gradient.setColorAt(((double)progr) / 100, backgroundColor);
- p.setBrush(QPalette::Base, gradient);
- }
- setPalette(p);
-
- // you need this before our code to draw inside the line edit..
- KLineEdit::paintEvent(event);
-
- if (text().isEmpty() && (progr == 0 || progr == 100))
- {
- QStyleOptionFrame option;
- initStyleOption(&option);
- QRect textRect = style()->subElementRect(QStyle::SE_LineEditContents, &option, this);
- QPainter painter(this);
- painter.setPen(Qt::gray);
- painter.drawText(textRect,
- Qt::AlignVCenter | Qt::AlignCenter,
- i18n("Type here to search your bookmarks, history and the web...")
- );
- }
-}
-
-
-void UrlBar::keyPressEvent(QKeyEvent *event)
-{
- QString currentText = text().trimmed();
-
- if (currentText.isEmpty())
- return KLineEdit::keyPressEvent(event);
-
- // this handles the Modifiers + Return key combinations
- if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)
- {
- switch (event->modifiers())
- {
- case Qt::AltModifier:
- loadRequestedUrl(currentText, Rekonq::NewFocusedTab);
- break;
-
- case Qt::ControlModifier:
- loadRequestedUrl(guessUrlWithCustomFirstLevel(currentText, QL1S(".com")));
- break;
-
- case 0x06000000: // Qt::ControlModifier | Qt::ShiftModifier:
- loadRequestedUrl(guessUrlWithCustomFirstLevel(currentText, QL1S(".org")));
- break;
-
- case Qt::ShiftModifier:
- loadRequestedUrl(guessUrlWithCustomFirstLevel(currentText, QL1S(".net")));
- break;
-
- default:
- loadRequestedUrl(currentText);
- break;
- }
- }
-
- if (event->key() == Qt::Key_Escape)
- {
- clearFocus();
- if (!(_tab->url().protocol() == QL1S("about")))
- setText(_tab->url().url());
- event->accept();
- }
-
- KLineEdit::keyPressEvent(event);
-}
-
-
-void UrlBar::focusInEvent(QFocusEvent *event)
-{
- activateSuggestions(true);
- rApp->mainWindow()->updateTabActions();
-
- KLineEdit::focusInEvent(event);
-}
-
-
-void UrlBar::dropEvent(QDropEvent *event)
-{
- // handles only plain-text with url format
- if (event->mimeData()->hasFormat("text/plain") && event->source() != this)
- {
- QUrl url = QUrl::fromUserInput(event->mimeData()->data("text/plain"));
-
- if (url.isValid())
- {
- setQUrl(url);
- loadRequestedUrl(text());
- return;
- }
- }
-
- // handles everything else
- KLineEdit::dropEvent(event);
- loadRequestedUrl(text());
-}
-
-
-void UrlBar::loadFinished()
-{
- if (_tab->url().scheme() == QL1S("about"))
- {
- update();
- return;
- }
-
- // show bookmark info
- IconButton *bt = addRightIcon(UrlBar::BK);
- connect(bt, SIGNAL(clicked(QPoint)), this, SLOT(manageBookmarks()));
-
- // show favorite icon
- IconButton *fbt = addRightIcon(UrlBar::Favorite);
- connect(fbt, SIGNAL(clicked(QPoint)), this, SLOT(manageFavorites(QPoint)));
-
- // show KGet downloads??
- if (!KStandardDirs::findExe("kget").isNull() && ReKonfig::kgetList())
- {
- IconButton *bt = addRightIcon(UrlBar::KGet);
- connect(bt, SIGNAL(clicked(QPoint)), _tab->page(), SLOT(downloadAllContentsWithKGet()));
- }
-
- // show RSS
- if (_tab->hasRSSInfo())
- {
- IconButton *bt = addRightIcon(UrlBar::RSS);
- connect(bt, SIGNAL(clicked(QPoint)), _tab, SLOT(showRSSInfo(QPoint)));
- }
-
- // show SSL
- if (_tab->url().scheme() == QL1S("https"))
- {
- // NOTE: the choice for the right SSL icon is done in the addRightIcon method
- IconButton *bt = addRightIcon(UrlBar::SSL);
- connect(bt, SIGNAL(clicked(QPoint)), _tab->page(), SLOT(showSSLInfo(QPoint)));
- }
-
- // show add search engine
- if (_tab->hasNewSearchEngine())
- {
- IconButton *bt = addRightIcon(UrlBar::SearchEngine);
- connect(bt, SIGNAL(clicked(QPoint)), _tab, SLOT(showSearchEngine(QPoint)));
- }
-
- if (_tab->hasAdBlockedElements())
- {
- IconButton *bt = addRightIcon(UrlBar::AdBlock);
-
- connect(bt, SIGNAL(clicked(QPoint)), (QObject *) rApp->adblockManager(), SLOT(showBlockedItemDialog()));
- }
-
- // we need to update urlbar after the right icon settings
- // removing this code (where setStyleSheet automatically calls update) needs adding again
- // an update call
- int oneIconWidth = _icon->sizeHint().width();
- int rightIconWidth = (oneIconWidth + c_iconMargin) * (_rightIconsList.count());
- setStyleSheet(QString("UrlBar { padding: 2px %2px 2px %1px; height: %1px } ").arg(oneIconWidth).arg(rightIconWidth));
-}
-
-
-void UrlBar::updateRightIcons()
-{
- if (!_tab->isPageLoading())
- {
- clearRightIcons();
- loadFinished();
- }
-}
-
-
-void UrlBar::activateSuggestions(bool b)
-{
- if (b)
- {
- if (_box.isNull())
- {
- _box = new CompletionWidget(this);
- installEventFilter(_box.data());
- connect(_box.data(), SIGNAL(chosenUrl(KUrl, Rekonq::OpenType)), this, SLOT(loadRequestedUrl(KUrl, Rekonq::OpenType)));
-
- // activate suggestions on edit text
- connect(this, SIGNAL(textChanged(QString)), this, SLOT(detectTypedString(QString)));
- }
- }
- else
- {
- disconnect(this, SIGNAL(textChanged(QString)), this, SLOT(detectTypedString(QString)));
- removeEventFilter(_box.data());
- if (!_box.isNull())
- _box.data()->deleteLater();
- }
-}
-
-
-void UrlBar::mouseDoubleClickEvent(QMouseEvent *event)
-{
- Q_UNUSED(event);
-
- selectAll();
-}
-
-
-void UrlBar::contextMenuEvent(QContextMenuEvent* event)
-{
- KMenu menu;
- const bool clipboardFilled = !rApp->clipboard()->text().isEmpty();
-
- // Cut
- KAction *a = KStandardAction::cut(this, SLOT(cut()), this);
- a->setEnabled(hasSelectedText());
- menu.addAction(a);
-
- // Copy
- a = KStandardAction::copy(this, SLOT(copy()), this);
- a->setEnabled(hasSelectedText());
- menu.addAction(a);
-
- // Paste
- a = KStandardAction::paste(this, SLOT(paste()), this);
- a->setEnabled(clipboardFilled);
- menu.addAction(a);
-
- // Paste & Go
- const QString clipboardText = rApp->clipboard()->text();
- if (isValidURL(clipboardText) || clipboardText.isEmpty())
- {
- a = new KAction(i18n("Paste && Go"), this);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(pasteAndGo()));
- }
- else
- {
- a = new KAction(i18n("Paste && Search"), this);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(pasteAndSearch()));
- }
- a->setEnabled(clipboardFilled);
- menu.addAction(a);
-
- // Delete
- a = new KAction(KIcon("edit-delete"), i18n("Delete"), this);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(delSlot()));
- a->setEnabled(hasSelectedText());
- menu.addAction(a);
-
- menu.addSeparator();
-
- // Select All
- a = KStandardAction::selectAll(this, SLOT(selectAll()), this);
- a->setEnabled(!text().isEmpty());
- menu.addAction(a);
-
- menu.exec(event->globalPos());
-}
-
-
-bool UrlBar::isValidURL(QString url)
-{
- bool isValid = false;
- if (url.startsWith(QL1S("http://"))
- || url.startsWith(QL1S("https://"))
- || url.startsWith(QL1S("ftp://"))
- )
- url = url.remove(QRegExp("(http|https|ftp)://"));
-
- if (url.contains(QL1C('.'))
- && url.indexOf(QL1C('.')) > 0
- && url.indexOf(QL1C('.')) < url.length()
- && !url.trimmed().contains(QL1C(' '))
- && QUrl::fromUserInput(url).isValid()
- )
- isValid = true;
-
- return isValid;
-}
-
-
-IconButton *UrlBar::addRightIcon(UrlBar::icon ic)
-{
- IconButton *rightIcon = new IconButton(this);
-
- switch (ic)
- {
- case UrlBar::KGet:
- rightIcon->setIcon(KIcon("download"));
- rightIcon->setToolTip(i18n("List all links with KGet"));
- break;
- case UrlBar::RSS:
- rightIcon->setIcon(KIcon("application-rss+xml"));
- rightIcon->setToolTip(i18n("List all available RSS feeds"));
- break;
- case UrlBar::SSL:
- _tab->page()->hasSslValid()
- ? rightIcon->setIcon(KIcon("object-locked"))
- : rightIcon->setIcon(KIcon("object-unlocked"));
- rightIcon->setToolTip(i18n("Show SSL Info"));
- break;
- case UrlBar::BK:
- if (rApp->bookmarkManager()->bookmarkForUrl(_tab->url()).isNull())
- {
- rightIcon->setIcon(KIcon("bookmarks").pixmap(32, 32, QIcon::Disabled));
- rightIcon->setToolTip(i18n("Bookmark this page"));
- }
- else
- {
- rightIcon->setIcon(KIcon("bookmarks"));
- rightIcon->setToolTip(i18n("Edit this bookmark"));
- }
- break;
- case UrlBar::SearchEngine:
- {
- KIcon wsIcon("edit-web-search");
- if (wsIcon.isNull())
- {
- wsIcon = KIcon("preferences-web-browser-shortcuts");
- }
- rightIcon->setIcon(wsIcon);
- rightIcon->setToolTip(i18n("Add search engine"));
- break;
- }
- case UrlBar::Favorite:
- if (ReKonfig::previewUrls().contains(_tab->url().url()))
- {
- rightIcon->setIcon(KIcon("emblem-favorite"));
- rightIcon->setToolTip(i18n("Remove from favorite"));
- }
- else
- {
- rightIcon->setIcon(KIcon("emblem-favorite").pixmap(32, 32, QIcon::Disabled));
- rightIcon->setToolTip(i18n("Add to favorites"));
- }
- break;
- case UrlBar::AdBlock:
- rightIcon->setIcon(KIcon("preferences-web-browser-adblock"));
- rightIcon->setToolTip(i18n("There are elements blocked by AdBlock"));
- break;
- default:
- ASSERT_NOT_REACHED("ERROR.. default non extant case!!");
- break;
- }
-
- _rightIconsList << rightIcon;
-
- int iconsCount = _rightIconsList.count();
- updateRightIconPosition(rightIcon, iconsCount);
-
- rightIcon->show();
-
- return rightIcon;
-}
-
-
-void UrlBar::clearRightIcons()
-{
- qDeleteAll(_rightIconsList);
- _rightIconsList.clear();
-}
-
-
-void UrlBar::resizeEvent(QResizeEvent *event)
-{
- int ih = _icon->sizeHint().height();
- int iconsCount = _rightIconsList.count();
- int iconHeight = (height() - ih) / 2;
-
- _icon->move(c_iconMargin, iconHeight);
-
- for (int i = 0; i < iconsCount; ++i)
- {
- IconButton *bt = _rightIconsList.at(i);
- updateRightIconPosition(bt, i + 1);
- }
-
- KLineEdit::resizeEvent(event);
-}
-
-
-void UrlBar::detectTypedString(const QString &typed)
-{
- if (typed.count() == 1)
- {
- QTimer::singleShot(0, this, SLOT(suggest()));
- return;
- }
-
- if (_suggestionTimer->isActive())
- _suggestionTimer->stop();
- _suggestionTimer->start(50);
-}
-
-
-void UrlBar::suggest()
-{
- if (!_box.isNull())
- _box.data()->suggestUrls(text());
-}
-
-
-void UrlBar::refreshFavicon()
-{
- if (QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
- {
- _icon->setIcon(KIcon("view-media-artist"));
- return;
- }
-
- KUrl u = _tab->url();
- if (u.scheme() == QL1S("about"))
- {
- _icon->setIcon(KIcon("arrow-right"));
- return;
- }
- _icon->setIcon(rApp->iconManager()->iconForUrl(u));
-}
-
-
-void UrlBar::pasteAndGo()
-{
- loadRequestedUrl(rApp->clipboard()->text());
-}
-
-
-void UrlBar::pasteAndSearch()
-{
- KService::Ptr defaultEngine = SearchEngine::defaultEngine();
- if (defaultEngine)
- loadRequestedUrl(KUrl(SearchEngine::buildQuery(defaultEngine, rApp->clipboard()->text())));
-}
-
-
-void UrlBar::delSlot()
-{
- del();
-}
-
-
-void UrlBar::manageBookmarks()
-{
- if (_tab->url().scheme() == QL1S("about"))
- return;
-
- KBookmark bookmark = rApp->bookmarkManager()->bookmarkForUrl(_tab->url());
-
- if (bookmark.isNull())
- {
- bookmark = rApp->bookmarkManager()->owner()->bookmarkCurrentPage();
- }
-
- // calculate position
- int iconSize = IconSize(KIconLoader::Small) + c_iconMargin;
-
- // Add a generic 10 to move it a bit below and right.
- // No need to be precise...
- int iconWidth = 10 + width() - ((iconSize + c_iconMargin));
- int iconHeight = 10 + (height() - iconSize) / 2;
-
- QPoint p = mapToGlobal(QPoint(iconWidth, iconHeight));
-
- // show bookmark widget
- BookmarkWidget *widget = new BookmarkWidget(bookmark, window());
- widget->showAt(p);
-}
-
-
-void UrlBar::manageFavorites(QPoint pos)
-{
- IconButton *bt = qobject_cast<IconButton *>(this->sender());
- if (!bt)
- return;
-
- if (_tab->url().scheme() == QL1S("about"))
- return;
-
- if (ReKonfig::previewUrls().contains(_tab->url().url()))
- {
- // remove site from favorites
- FavoriteWidget *widget = new FavoriteWidget(_tab, window());
- connect(widget, SIGNAL(updateIcon()), this, SLOT(updateRightIcons()));
- widget->showAt(pos);
- return;
- }
-
- // else, add as favorite
- QStringList urls = ReKonfig::previewUrls();
- urls << _tab->url().url();
- ReKonfig::setPreviewUrls(urls);
-
- QStringList titles = ReKonfig::previewNames();
- titles << _tab->view()->title();
- ReKonfig::setPreviewNames(titles);
-
- // also, save a site snapshot
- WebSnap *snap = new WebSnap(_tab->url(), this);
-
- updateRightIcons();
-}
-
-
-void UrlBar::updateRightIconPosition(IconButton *icon, int iconsCount)
-{
- // NOTE: cannot show a (let's say) 16x16 icon in a 16x16 square.
- // It needs some margin. It usually is 3, but using 4 (default rekonq icon margin)
- // seems NOT a big problem and let's us using just one const ;)
- int iconSize = IconSize(KIconLoader::Small) + c_iconMargin;
-
- int iconWidth = width() - ((iconSize + c_iconMargin) * iconsCount);
- int iconHeight = (height() - iconSize) / 2;
-
- icon->move(iconWidth, iconHeight);
-}
diff --git a/src/urlbar/urlbar.h b/src/urlbar/urlbar.h
deleted file mode 100644
index b2cf44ac..00000000
--- a/src/urlbar/urlbar.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com>
-* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef URLBAR_H
-#define URLBAR_H
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KUrl>
-#include <KLineEdit>
-
-// Qt Includes
-#include <QWeakPointer>
-#include <QToolButton>
-
-// Forward Declarations
-class QWidget;
-class CompletionWidget;
-class WebTab;
-class QTimer;
-
-
-class IconButton : public QToolButton
-{
- Q_OBJECT
-
-public:
- IconButton(QWidget *parent = 0);
-
-Q_SIGNALS:
- void clicked(QPoint);
-
-protected:
- void mouseReleaseEvent(QMouseEvent *event);
-};
-
-
-// Definitions
-typedef QList<IconButton *> IconButtonPointerList;
-
-
-// ------------------------------------------------------------------------------------
-
-
-class REKONQ_TESTS_EXPORT UrlBar : public KLineEdit
-{
- Q_OBJECT
-
-public:
-
- enum icon
- {
- KGet = 0x00000001,
- RSS = 0x00000010,
- SSL = 0x00000100,
- BK = 0x00001000,
- SearchEngine = 0x00010000,
- Favorite = 0x00100000,
- AdBlock = 0x01000000
- };
-
- explicit UrlBar(QWidget *parent = 0);
- ~UrlBar();
-
- void activateSuggestions(bool);
-
-public Q_SLOTS:
- void setQUrl(const QUrl &url);
-
- /**
- * Let us add bookmarks as the major browsers do
- *
- */
- void manageBookmarks();
-
-private Q_SLOTS:
- void loadRequestedUrl(const KUrl& url, Rekonq::OpenType = Rekonq::CurrentTab);
-
- void loadFinished();
-
- void clearRightIcons();
- void updateRightIcons();
-
- void detectTypedString(const QString &);
- void suggest();
-
- void manageFavorites(QPoint);
-
- void refreshFavicon();
-
- void pasteAndGo();
- void pasteAndSearch();
- void delSlot();
- bool isValidURL(QString url);
-
- /**
- * Load digited url
- */
- void loadDigitedUrl();
-
-protected:
- void paintEvent(QPaintEvent *event);
- void keyPressEvent(QKeyEvent *event);
- void focusInEvent(QFocusEvent *event);
- void dropEvent(QDropEvent *event);
- void mouseDoubleClickEvent(QMouseEvent *);
- void contextMenuEvent(QContextMenuEvent *event);
- void resizeEvent(QResizeEvent *);
-
-private:
- /**
- * Updates right icon position, given its number in the right icons list
- * and considering rekonq window position/dimension
- */
- void updateRightIconPosition(IconButton *, int);
- IconButton *addRightIcon(UrlBar::icon);
-
- QWeakPointer<CompletionWidget> _box;
- WebTab *_tab;
-
- IconButton *_icon;
- IconButtonPointerList _rightIconsList;
-
- QTimer *_suggestionTimer;
-};
-
-
-#endif
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
deleted file mode 100644
index c6d0f7a4..00000000
--- a/src/urlbar/urlresolver.cpp
+++ /dev/null
@@ -1,403 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "urlresolver.h"
-#include "urlresolver.moc"
-
-// Local Includes
-#include "historymanager.h"
-#include "bookmarkmanager.h"
-#include "searchengine.h"
-
-// KDE Includes
-#include <KBookmark>
-#include <KService>
-#include <KProtocolInfo>
-
-// Qt Includes
-#include <QByteArray>
-
-
-// NOTE
-// default kurifilter plugin list (at least in my box):
-// 1. "kshorturifilter"
-// 2. "kurisearchfilter"
-// 3. "localdomainurifilter"
-// 4 ."kuriikwsfilter"
-// 5. "fixhosturifilter"
-
-
-// ------------------------------------------------------------------------
-
-KService::Ptr UrlResolver::_searchEngine;
-
-QRegExp UrlResolver::_browseRegexp;
-QRegExp UrlResolver::_searchEnginesRegexp;
-
-
-UrlResolver::UrlResolver(const QString &typedUrl)
- : QObject()
- , _typedString(typedUrl.trimmed())
- , _typedQuery()
- , _isKDEUrl(false)
-{
- if (!_searchEngine)
- setSearchEngine(SearchEngine::defaultEngine());
-
- if (_browseRegexp.isEmpty())
- {
- QString protocol = QString("^(%1)").arg(KProtocolInfo::protocols().join("|"));
-
- QString localhost = QL1S("^localhost");
-
- QString local = QL1S("^/");
-
- QString ipv4 = QL1S("^0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])"\
- "\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.0*([1-9]?\\d|1\\d\\d|2[0-4]\\d|25[0-5])");
-
- QString ipv6 = QL1S("^([0-9a-fA-F]{4}|0)(\\:([0-9a-fA-F]{4}|0)){7}");
-
- QString address = QL1S("[\\d\\w-.]+\\.(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|"\
- "c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrstu]|f[ijkmnor]|g[abdefghilmnpqrstuwy]|"\
- "h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|"\
- "m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eouw]|"\
- "s[abcdeghijklmnortuvyz]|t[cdfghjkmnoprtvwz]|u[augkmsyz]|v[aceginu]|w[fs]|"\
- "y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|local|mil|museum|name|net|org|"\
- "pro)");
-
- QString joiner = QL1S(")|(");
- _browseRegexp = QRegExp(QL1C('(') +
- protocol + joiner +
- localhost + joiner +
- local + joiner +
- address + joiner +
- ipv6 + joiner +
- ipv4 + QL1C(')')
- );
- }
-
- if (_searchEnginesRegexp.isEmpty())
- {
- QString reg;
- QString engineUrl;
- Q_FOREACH(KService::Ptr s, SearchEngine::favorites())
- {
- engineUrl = QRegExp::escape(s->property("Query").toString()).replace(QL1S("\\\\\\{@\\}"), QL1S("[\\d\\w-.]+"));
- if (reg.isEmpty())
- reg = QL1C('(') + engineUrl + QL1C(')');
- else
- reg = reg + QL1S("|(") + engineUrl + QL1C(')');
- }
- _searchEnginesRegexp = QRegExp(reg);
- }
-}
-
-
-UrlSearchList UrlResolver::orderedSearchItems()
-{
- if (_typedString.startsWith(QL1S("about:")))
- {
- QStringList aboutUrlList;
- aboutUrlList
- << QL1S("about:home")
- << QL1S("about:favorites")
- << QL1S("about:closedTabs")
- << QL1S("about:bookmarks")
- << QL1S("about:history")
- << QL1S("about:downloads")
- << QL1S("about:tabs")
- << QL1S("about:info");
-
- QStringList aboutUrlResults = aboutUrlList.filter(_typedString, Qt::CaseInsensitive);
-
- UrlSearchList list;
-
- if (aboutUrlResults.isEmpty())
- {
- UrlSearchItem info(UrlSearchItem::Browse, QL1S("about:info"), QL1S("info"));
- list << info;
-
- return list;
- }
-
- Q_FOREACH(const QString & urlResult, aboutUrlResults)
- {
- QString name = urlResult;
- name.remove(0, 6);
- UrlSearchItem item(UrlSearchItem::Browse, urlResult, name);
- list << item;
- }
-
- return list;
- }
-
- //compute lists
- computeHistory();
- computeQurlFromUserInput();
- computeWebSearches();
- computeBookmarks();
-
- return orderLists();
-}
-
-
-UrlSearchList UrlResolver::orderLists()
-{
- // NOTE
- // The const int here decides the number of proper suggestions, taken from history & bookmarks
- // You have to add here the "browse & search" options, always available.
- const int availableEntries = 8;
-
- bool webSearchFirst = false;
- // Browse & Search results
- UrlSearchList browseSearch;
- QString lowerTypedString = _typedString.toLower();
- if (!_isKDEUrl
- && (_browseRegexp.indexIn(lowerTypedString) != -1))
- {
- webSearchFirst = true;
- browseSearch << _webSearches;
- }
- else
- {
- browseSearch << _webSearches;
- browseSearch << _qurlFromUserInput;
- }
-
-
- // find relevant items (the one you are more probably searching...)
- UrlSearchList relevant;
-
- // history
- Q_FOREACH(const UrlSearchItem & item, _history)
- {
- QString hst = KUrl(item.url).host();
- if (item.url.startsWith(_typedString)
- || hst.startsWith(_typedString)
- || hst.remove("www.").startsWith(_typedString))
- {
- relevant << item;
- _history.removeOne(item);
- break;
- }
- }
-
- // bookmarks
- Q_FOREACH(const UrlSearchItem & item, _bookmarks)
- {
- QString hst = KUrl(item.url).host();
- if (item.url.startsWith(_typedString)
- || hst.startsWith(_typedString)
- || hst.remove("www.").startsWith(_typedString))
- {
- relevant << item;
- _bookmarks.removeOne(item);
- break;
- }
- }
-
- // decide history & bookmarks number
- int historyCount = _history.count();
- int bookmarksCount = _bookmarks.count();
- int relevantCount = relevant.count();
-
- const int historyEntries = (availableEntries - relevantCount) / 2;
- const int bookmarksEntries = availableEntries - relevantCount - historyEntries;
-
- if (historyCount >= historyEntries && bookmarksCount >= bookmarksEntries)
- {
- _history = _history.mid(0, historyEntries);
- _bookmarks = _bookmarks.mid(0, bookmarksEntries);
- }
- else if (historyCount < historyEntries && bookmarksCount >= bookmarksEntries)
- {
- if (historyCount + bookmarksCount > availableEntries)
- {
- _bookmarks = _bookmarks.mid(0, availableEntries - historyCount);
- }
- }
- else if (historyCount >= historyEntries && bookmarksCount < bookmarksEntries)
- {
- if (historyCount + bookmarksCount > availableEntries)
- {
- _history = _history.mid(0, availableEntries - bookmarksCount);
- }
- }
-
- // and finally, results
- UrlSearchList list;
-
- if (webSearchFirst)
- list << _qurlFromUserInput;
- list += relevant + browseSearch + _history + _bookmarks;
- return list;
-}
-
-
-//////////////////////////////////////////////////////////////////////////
-// PRIVATE ENGINES
-
-
-// QUrl from User Input (easily the best solution... )
-void UrlResolver::computeQurlFromUserInput()
-{
- QString url = _typedString;
- QUrl urlFromUserInput = QUrl::fromUserInput(url);
- if (urlFromUserInput.isValid())
- {
- // ensure http(s) hosts are lower cases
- if (urlFromUserInput.scheme().startsWith(QL1S("http")))
- {
- QString hst = urlFromUserInput.host();
- urlFromUserInput.setHost(hst.toLower());
- }
-
- QString urlString = urlFromUserInput.toString();
- QString gTitle = i18nc("Browse a website", "Browse");
- UrlSearchItem gItem(UrlSearchItem::Browse, urlString, gTitle);
- _qurlFromUserInput << gItem;
- }
-}
-
-
-// webSearches
-void UrlResolver::computeWebSearches()
-{
- QString query = _typedString;
- KService::Ptr engine = SearchEngine::fromString(_typedString);
- if (engine)
- {
- query = query.remove(0, _typedString.indexOf(SearchEngine::delimiter()) + 1);
- setSearchEngine(engine);
- _isKDEUrl = true;
- }
-
- if (_searchEngine)
- {
- UrlSearchItem item = UrlSearchItem(UrlSearchItem::Search, SearchEngine::buildQuery(_searchEngine, query), query);
- UrlSearchList list;
- list << item;
- _webSearches = list;
- }
-}
-
-
-// history
-void UrlResolver::computeHistory()
-{
- QList<HistoryItem> found = rApp->historyManager()->find(_typedString);
- qSort(found.begin(), found.end(), isHistoryItemRelevant);
-
- Q_FOREACH(const HistoryItem & i, found)
- {
- if (_searchEnginesRegexp.isEmpty() || _searchEnginesRegexp.indexIn(i.url) == -1) //filter all urls that are search engine results
- {
- UrlSearchItem gItem(UrlSearchItem::History, i.url, i.title);
- _history << gItem;
- }
- }
-}
-
-
-// bookmarks
-void UrlResolver::computeBookmarks()
-{
- QList<KBookmark> found = rApp->bookmarkManager()->find(_typedString);
- Q_FOREACH(const KBookmark & b, found)
- {
- UrlSearchItem gItem(UrlSearchItem::Bookmark, b.url().url(), b.fullText());
- _bookmarks << gItem;
- }
-}
-
-
-// opensearch suggestion
-void UrlResolver::computeSuggestions()
-{
- // NOTE
- // This attempt basically cuts out open search suggestions.
- UrlSearchList list;
- emit suggestionsReady(list, _typedString);
- return;
-
-// // if a string startsWith /, it is probably a local path
-// // so, no need for suggestions...
-// if (_typedString.startsWith('/') || !rApp->opensearchManager()->isSuggestionAvailable())
-// {
-// UrlSearchList list;
-// emit suggestionsReady(list, _typedString);
-// return;
-// }
-//
-// QString query = _typedString;
-// KService::Ptr engine = SearchEngine::fromString(_typedString);
-// if (engine)
-// {
-// query = query.remove(0, _typedString.indexOf(SearchEngine::delimiter()) + 1);
-// setSearchEngine(engine);
-// }
-//
-// connect(rApp->opensearchManager(),
-// SIGNAL(suggestionsReceived(QString,ResponseList)),
-// this,
-// SLOT(suggestionsReceived(QString,ResponseList)));
-//
-// _typedQuery = query;
-// rApp->opensearchManager()->requestSuggestion(query);
-}
-
-
-bool UrlResolver::isHistoryItemRelevant(const HistoryItem &a, const HistoryItem &b)
-{
- return a.relevance() > b.relevance();
-}
-
-
-void UrlResolver::suggestionsReceived(const QString &text, const ResponseList &suggestions)
-{
- if (text != _typedQuery)
- return;
-
- UrlSearchList sugList;
- QString urlString;
- Q_FOREACH(const Response & i, suggestions)
- {
- if (text == i.title)
- continue;
-
- urlString = i.url;
- if (urlString.isEmpty())
- {
- urlString = SearchEngine::buildQuery(UrlResolver::searchEngine(), i.title);
- }
-
- UrlSearchItem gItem(UrlSearchItem::Suggestion, urlString, i.title, i.description, i.image, i.image_width, i.image_height);
- sugList << gItem;
- }
- emit suggestionsReady(sugList, _typedString);
- this->deleteLater();
-}
diff --git a/src/urlbar/urlresolver.h b/src/urlbar/urlresolver.h
deleted file mode 100644
index d799231f..00000000
--- a/src/urlbar/urlresolver.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef URL_RESOLVER_H
-#define URL_RESOLVER_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Locale Includes
-#include "application.h"
-#include "opensearchmanager.h"
-#include "suggestionparser.h"
-
-// KDE Includes
-#include <KUrl>
-#include <KService>
-
-// Qt Includes
-#include <QString>
-#include <QList>
-
-
-class UrlSearchItem
-{
-public:
-
- enum types
- {
- Undefined = 0x00000000,
- Search = 0x00000001,
- Browse = 0x00000010,
- History = 0x00000100,
- Bookmark = 0x00001000,
- Suggestion = 0x00010000
- };
-
- int type;
- QString url;
- QString title;
- QString description;
- QString image;
- int image_width;
- int image_height;
- QString bookmarkPath;
-
- UrlSearchItem(const UrlSearchItem &item)
- : type(item.type)
- , url(item.url)
- , title(item.title)
- , description(item.description)
- , image(item.image)
- , image_width(item.image_width)
- , image_height(item.image_height)
- {};
-
- UrlSearchItem()
- : type(UrlSearchItem::Undefined)
- , url(QString())
- , title(QString())
- , description(QString())
- , image(QString())
- , image_width(0)
- , image_height(0)
- {};
-
- UrlSearchItem(const int &_type,
- const QString &_url,
- const QString &_title = QString(),
- const QString &_description = QString(),
- const QString &_image = QString(),
- const int &_image_width = 0,
- const int &_image_height = 0
- )
- : type(_type)
- , url(_url)
- , title(_title)
- , description(_description)
- , image(_image)
- , image_width(_image_width)
- , image_height(_image_height)
- {};
-
- inline bool operator==(const UrlSearchItem &i) const
- {
- return i.url == url;//TODO && i.title == title;
- }
-};
-
-typedef QList <UrlSearchItem> UrlSearchList;
-
-
-// ----------------------------------------------------------------------
-
-class HistoryItem;
-
-class UrlResolver : public QObject
-{
- Q_OBJECT
-
-public:
- UrlResolver(const QString &typedUrl);
-
- UrlSearchList orderedSearchItems();
-
- static KService::Ptr searchEngine()
- {
- return _searchEngine;
- };
-
- static void setSearchEngine(KService::Ptr engine)
- {
- _searchEngine = engine;
- if (engine)
- rApp->opensearchManager()->setSearchProvider(engine->desktopEntryName());
- };
-
- void computeSuggestions();
-
- static bool isHistoryItemRelevant(const HistoryItem &a, const HistoryItem &b);
-
-private Q_SLOTS:
- void suggestionsReceived(const QString &text, const ResponseList &suggestions);
-
-Q_SIGNALS:
- void suggestionsReady(const UrlSearchList &, const QString &);
-
-private:
- void computeWebSearches();
- void computeHistory();
- void computeQurlFromUserInput();
- void computeBookmarks();
-
- UrlSearchList orderLists();
-
- QString _typedString;
- QString _typedQuery;
-
- UrlSearchList _webSearches;
- UrlSearchList _qurlFromUserInput;
- UrlSearchList _history;
- UrlSearchList _bookmarks;
- UrlSearchList _suggestions;
-
- static QRegExp _browseRegexp;
- static QRegExp _searchEnginesRegexp;
-
- static KService::Ptr _searchEngine;
-
- bool _isKDEUrl;
-};
-
-// ------------------------------------------------------------------------------
-
-#endif // URL_RESOLVER_H
diff --git a/src/urlbar/webshortcutwidget.cpp b/src/urlbar/webshortcutwidget.cpp
deleted file mode 100644
index c6dc3b79..00000000
--- a/src/urlbar/webshortcutwidget.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Fredy Yanardi <fyanardi@gmail.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "webshortcutwidget.h"
-#include "webshortcutwidget.moc"
-
-// KDE Includes
-#include <KGlobalSettings>
-#include <KIcon>
-#include <KLocale>
-#include <KServiceTypeTrader>
-
-// Qt Includes
-#include <QSet>
-#include <QLabel>
-#include <QLineEdit>
-#include <QDialogButtonBox>
-#include <QFormLayout>
-
-
-WebShortcutWidget::WebShortcutWidget(QWidget *parent)
- : QMenu(parent)
- , m_wsLineEdit(new QLineEdit(this))
- , m_nameLineEdit(new QLineEdit(this))
- , m_noteLabel(new QLabel(this))
-{
- setAttribute(Qt::WA_DeleteOnClose);
- setFixedWidth(350);
-
- QFormLayout *layout = new QFormLayout(this);
- QVBoxLayout *vLay = new QVBoxLayout;
-
- // Web Search Icon
- QLabel *webSearchIcon = new QLabel(this);
- webSearchIcon->setPixmap(KIcon("edit-web-search").pixmap(32, 32));
-
- // Title
- QLabel *titleLabel = new QLabel(this);
- titleLabel->setText("<h4>" + i18n("Add Search Engine") + "</h4>");
- vLay->addWidget(titleLabel);
-
- // Name
- vLay->addWidget(m_nameLineEdit);
-
- layout->addRow(webSearchIcon, vLay);
-
- // Shortcuts
- QLabel *shortcutsLabel = new QLabel(i18n("Shortcuts:"), this);
- layout->addRow(shortcutsLabel, m_wsLineEdit);
- connect(m_wsLineEdit, SIGNAL(textChanged(QString)), SLOT(shortcutsChanged(QString)));
-
- // Note
- m_noteLabel->setWordWrap(true);
- layout->addRow(m_noteLabel);
- m_noteLabel->hide();
-
- // Ok & Cancel buttons
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
- layout->addWidget(buttonBox);
-
- m_providers = KServiceTypeTrader::self()->query("SearchProvider");
-
- m_wsLineEdit->setFocus();
-}
-
-
-void WebShortcutWidget::showAt(const QPoint &pos)
-{
- adjustSize();
-
- QPoint p(pos.x() - width(), pos.y() + 10);
- move(p);
- exec();
-}
-
-
-void WebShortcutWidget::show(const KUrl &url, const QString &openSearchName, const QPoint &pos)
-{
- m_wsLineEdit->clear();
- m_nameLineEdit->setText(openSearchName);
- m_url = url;
- showAt(pos);
-}
-
-
-void WebShortcutWidget::accept()
-{
- emit webShortcutSet(m_url, m_nameLineEdit->text(), m_wsLineEdit->text());
-
- // close widget (and destroy it)
- close();
-}
-
-
-void WebShortcutWidget::shortcutsChanged(const QString& newShorthands)
-{
- int savedCursorPosition = m_wsLineEdit->cursorPosition();
- QString normalizedShorthands = QString(newShorthands).replace(QL1C(' '), QL1C(','));
- m_wsLineEdit->setText(normalizedShorthands);
- m_wsLineEdit->setCursorPosition(savedCursorPosition);
-
- QSet<QString> shorthands = normalizedShorthands.split(QL1C(',')).toSet();
- QString contenderName = "";
- QString contenderWS = "";
-
- Q_FOREACH(const QString & shorthand, shorthands)
- {
- Q_FOREACH(KService::Ptr provider, m_providers)
- {
- if (provider->property("Keys").toStringList().contains(shorthand))
- {
- contenderName = provider->property("Name").toString();
- contenderWS = shorthand;
- break;
- }
- }
- }
-
- if (!contenderName.isEmpty())
- {
- m_noteLabel->setText(i18n("The shortcut \"%1\" is already assigned to \"%2\".", contenderWS, contenderName));
- m_noteLabel->setVisible(true);
- resize(minimumSize().width(), minimumSizeHint().height() + 15);
- }
- else
- {
- m_noteLabel->clear();
- bool noteIsVisible = m_noteLabel->isVisible();
- m_noteLabel->setVisible(false);
- if (noteIsVisible)
- {
- resize(minimumSize());
- }
- }
-}
diff --git a/src/urlbar/webshortcutwidget.h b/src/urlbar/webshortcutwidget.h
deleted file mode 100644
index d1291714..00000000
--- a/src/urlbar/webshortcutwidget.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Fredy Yanardi <fyanardi@gmail.com>
-* Copyright (C) 2010-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-* Copyright (C) 2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEBSHORTCUTWIDGET_H
-#define WEBSHORTCUTWIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KUrl>
-#include <KService>
-
-// Qt Includes
-#include <QMenu>
-
-// Forward Declarations
-class QLabel;
-class QLineEdit;
-class QPushButton;
-
-
-class REKONQ_TESTS_EXPORT WebShortcutWidget : public QMenu
-{
- Q_OBJECT
-public:
- WebShortcutWidget(QWidget *parent = 0);
-
- void show(const KUrl &url, const QString &openSearchName, const QPoint &pos);
-
-private Q_SLOTS:
- void accept();
- void shortcutsChanged(const QString& newShorthands);
-
-Q_SIGNALS:
- void webShortcutSet(const KUrl &url, const QString &openSearchName, const QString &webShortcut);
-
-private:
- QLineEdit *m_wsLineEdit;
- QLineEdit *m_nameLineEdit;
- QLabel *m_noteLabel;
-
- KService::List m_providers;
- KUrl m_url;
-
- void showAt(const QPoint &pos);
-};
-
-#endif // WEBSHORTCUTWIDGET_H
-
diff --git a/src/urlfilterproxymodel.cpp b/src/urlfilterproxymodel.cpp
deleted file mode 100644
index aa9ac7a6..00000000
--- a/src/urlfilterproxymodel.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Nils Weigel <nehlsen at gmail dot com>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "urlfilterproxymodel.h"
-#include "urlfilterproxymodel.moc"
-
-
-UrlFilterProxyModel::UrlFilterProxyModel(QObject *parent)
- : QSortFilterProxyModel(parent)
-{
- setFilterCaseSensitivity(Qt::CaseInsensitive);
-}
-
-
-bool UrlFilterProxyModel::filterAcceptsRow(const int source_row, const QModelIndex &source_parent) const
-{
- return recursiveMatch(sourceModel()->index(source_row, 0, source_parent));
-}
-
-
-bool UrlFilterProxyModel::recursiveMatch(const QModelIndex &index) const
-{
- if (index.data().toString().contains(filterRegExp()))
- return true;
-
- int numChildren = sourceModel()->rowCount(index);
- for (int childRow = 0; childRow < numChildren; ++childRow)
- {
- if (recursiveMatch(sourceModel()->index(childRow, 0, index)))
- return true;
- }
-
- return false;
-}
diff --git a/src/urlfilterproxymodel.h b/src/urlfilterproxymodel.h
deleted file mode 100644
index 6cb8574e..00000000
--- a/src/urlfilterproxymodel.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Nils Weigel <nehlsen at gmail dot com>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef URLFILTERPROXYMODEL_H
-#define URLFILTERPROXYMODEL_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QSortFilterProxyModel>
-
-
-/**
- * QSortFilterProxyModel hides all children which parent doesn't
- * match the filter. This class is used to change this behavior.
- * If a url matches the filter it'll be shown,
- * even if it's parent doesn't match it.
- */
-class REKONQ_TESTS_EXPORT UrlFilterProxyModel : public QSortFilterProxyModel
-{
- Q_OBJECT
-
-public:
- explicit UrlFilterProxyModel(QObject *parent = 0);
-
-protected:
- virtual bool filterAcceptsRow(const int source_row, const QModelIndex &source_parent) const;
-
- // returns true if index or any of his children match the filter
- bool recursiveMatch(const QModelIndex &index) const;
-};
-
-#endif // URLFILTERPROXYMODEL_H
diff --git a/src/urlpanel.cpp b/src/urlpanel.cpp
deleted file mode 100644
index 8e0d425f..00000000
--- a/src/urlpanel.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com>
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "urlpanel.h"
-#include "urlpanel.moc"
-
-// Local Includes
-#include "paneltreeview.h"
-#include "urlfilterproxymodel.h"
-
-// KDE Includes
-#include <KLineEdit>
-#include <KLocalizedString>
-
-// Qt Includes
-#include <QLabel>
-#include <QHBoxLayout>
-#include <QHeaderView>
-
-
-UrlPanel::UrlPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags)
- : QDockWidget(title, parent, flags)
- , _treeView(new PanelTreeView(this))
- , _loaded(false)
-{
- setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-
- connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(showing(bool)));
-}
-
-
-void UrlPanel::showing(bool b)
-{
- if (!_loaded && b)
- {
- setup();
- _loaded = true;
- }
-}
-
-
-void UrlPanel::setup()
-{
- QWidget *ui = new QWidget(this);
-
- // setup search bar
- QHBoxLayout *searchLayout = new QHBoxLayout;
- searchLayout->setContentsMargins(5, 0, 0, 0);
- QLabel *searchLabel = new QLabel(i18n("&Search:"));
- searchLayout->addWidget(searchLabel);
- KLineEdit *search = new KLineEdit;
- search->setClearButtonShown(true);
- searchLayout->addWidget(search);
- searchLabel->setBuddy(search);
-
- // setup tree view
- _treeView->setUniformRowHeights(true);
- _treeView->header()->hide();
-
- // put everything together
- QVBoxLayout *vBoxLayout = new QVBoxLayout;
- vBoxLayout->setContentsMargins(0, 0, 0, 0);
- vBoxLayout->addLayout(searchLayout);
- vBoxLayout->addWidget(_treeView);
-
- // add it to the UI
- ui->setLayout(vBoxLayout);
- setWidget(ui);
-
- UrlFilterProxyModel *proxy = new UrlFilterProxyModel(this);
- proxy->setSourceModel(model());
- _treeView->setModel(proxy);
-
- connect(search, SIGNAL(textChanged(QString)), proxy, SLOT(setFilterFixedString(QString)));
- connect(search, SIGNAL(textChanged(QString)), this, SLOT(expandTreeView()));
-
- connect(_treeView, SIGNAL(contextMenuItemRequested(QPoint)), this, SLOT(contextMenuItem(QPoint)));
- connect(_treeView, SIGNAL(contextMenuGroupRequested(QPoint)), this, SLOT(contextMenuGroup(QPoint)));
- connect(_treeView, SIGNAL(contextMenuEmptyRequested(QPoint)), this, SLOT(contextMenuEmpty(QPoint)));
-}
-
-void UrlPanel::expandTreeView()
-{
- _treeView->expandAll();
-}
diff --git a/src/urlpanel.h b/src/urlpanel.h
deleted file mode 100644
index c8d15a8e..00000000
--- a/src/urlpanel.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 by Domrachev Alexandr <alexandr.domrachev@gmail.com>
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef URLPANEL_H
-#define URLPANEL_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QDockWidget>
-
-// Forward Declarations
-class PanelTreeView;
-
-class QAbstractItemModel;
-
-
-class REKONQ_TESTS_EXPORT UrlPanel : public QDockWidget
-{
- Q_OBJECT
-
-public:
- explicit UrlPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0);
-
-Q_SIGNALS:
- void openUrl(const KUrl &, const Rekonq::OpenType &);
- void itemHovered(const QString &);
-
-public Q_SLOTS:
- void showing(bool);
-
-protected:
- virtual void setup();
- virtual QAbstractItemModel* model() = 0;
-
- PanelTreeView* panelTreeView() const
- {
- return _treeView;
- }
-
-protected Q_SLOTS:
- virtual void contextMenuItem(const QPoint &pos) = 0;
- virtual void contextMenuGroup(const QPoint &pos) = 0;
- virtual void contextMenuEmpty(const QPoint &pos) = 0;
-
-private Q_SLOTS:
- void expandTreeView();
-
-private:
- PanelTreeView *_treeView;
- bool _loaded;
-};
-
-
-#endif // URLPANEL_H
diff --git a/src/useragent/useragentinfo.cpp b/src/useragent/useragentinfo.cpp
deleted file mode 100644
index 00f0a9db..00000000
--- a/src/useragent/useragentinfo.cpp
+++ /dev/null
@@ -1,202 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (c) 2001 by Dawit Alemayehu <adawit@kde.org>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "useragentinfo.h"
-
-// Standard Includes
-#include <time.h>
-#include <sys/utsname.h>
-
-// KDE Includes
-#include <KService>
-#include <KServiceTypeTrader>
-
-#include <KConfig>
-#include <KConfigGroup>
-
-#include <KProtocolManager>
-
-// Qt includes
-#include <QStringBuilder>
-
-UserAgentInfo::UserAgentInfo()
-{
- m_providers = KServiceTypeTrader::self()->query("UserAgentStrings");
-}
-
-
-KService::List UserAgentInfo::availableProviders() const
-{
- return m_providers;
-}
-
-
-QString UserAgentInfo::userAgentString(int i)
-{
- if (i < 0 || !providerExists(i))
- {
- kDebug() << "oh oh... wrong index on the user agent choice! INDEX = " << i;
- return QL1S("Default");
- }
-
- QString tmp = m_providers.at(i)->property("X-KDE-UA-FULL").toString();
-
- struct utsname utsn;
- uname(&utsn);
-
- tmp.replace(QL1S("appSysName"), QString(utsn.sysname));
- tmp.replace(QL1S("appSysRelease"), QString(utsn.release));
- tmp.replace(QL1S("appMachineType"), QString(utsn.machine));
-
- QStringList languageList = KGlobal::locale()->languageList();
- if (languageList.count())
- {
- int ind = languageList.indexOf(QL1S("C"));
- if (ind >= 0)
- {
- if (languageList.contains(QL1S("en")))
- languageList.removeAt(ind);
- else
- languageList.value(ind) = QL1S("en");
- }
- }
-
- tmp.replace(QL1S("appLanguage"), QString("%1").arg(languageList.join(", ")));
- tmp.replace(QL1S("appPlatform"), QL1S("X11"));
-
- return tmp;
-}
-
-
-QString UserAgentInfo::userAgentName(int i)
-{
- if (i < 0 || !providerExists(i))
- {
- kDebug() << "oh oh... wrong index on the user agent choice! INDEX = " << i;
- return QL1S("Default");
- }
-
- return m_providers.at(i)->property("X-KDE-UA-NAME").toString();
-}
-
-
-QString UserAgentInfo::userAgentVersion(int i)
-{
- if (i < 0 || !providerExists(i))
- {
- kDebug() << "oh oh... wrong index on the user agent choice! INDEX = " << i;
- return QL1S("Default");
- }
-
- return m_providers.at(i)->property("X-KDE-UA-VERSION").toString();
-}
-
-
-QString UserAgentInfo::userAgentDescription(int i)
-{
- if (i < 0 || !providerExists(i))
- {
- kDebug() << "oh oh... wrong index on the user agent choice! INDEX = " << i;
- return QL1S("Default");
- }
-
- QString systemName = m_providers.at(i)->property("X-KDE-UA-SYSNAME").toString();
- QString systemRelease = m_providers.at(i)->property("X-KDE-UA-SYSRELEASE").toString();
- QString systemSummary;
-
- if (!systemName.isEmpty() && !systemRelease.isEmpty())
- {
- systemSummary = i18nc("describe UA platform, eg: firefox 3.1 \"on Windows XP\"", " on %1 %2", systemName, systemRelease);
- }
-
- return userAgentName(i) % QL1C(' ') % userAgentVersion(i) % systemSummary;
-}
-
-
-QStringList UserAgentInfo::availableUserAgents()
-{
- QStringList UAs;
- int n = m_providers.count();
- for (int i = 0; i < n; ++i)
- {
- UAs << userAgentDescription(i);
- }
- return UAs;
-}
-
-
-bool UserAgentInfo::setUserAgentForHost(int uaIndex, const QString &host)
-{
- KConfig config("kio_httprc", KConfig::NoGlobals);
-
- QStringList modifiedHosts = config.groupList();
- KConfigGroup hostGroup(&config, host);
-
- if (uaIndex == -1)
- {
- if (!hostGroup.exists())
- {
- kDebug() << "Host does NOT exists!";
- return false;
- }
- hostGroup.deleteGroup();
- KProtocolManager::reparseConfiguration();
- return true;
- }
-
- hostGroup.writeEntry(QL1S("UserAgent"), userAgentString(uaIndex));
-
- KProtocolManager::reparseConfiguration();
- return true;
-}
-
-
-int UserAgentInfo::uaIndexForHost(const QString &host)
-{
- QString KDEUserAgent = KProtocolManager::userAgentForHost(host);
-
- int n = m_providers.count();
- for (int i = 0; i < n; ++i)
- {
- QString rekonqUserAgent = userAgentString(i);
- if (KDEUserAgent == rekonqUserAgent)
- return i;
- }
- return -1;
-}
-
-
-bool UserAgentInfo::providerExists(int i)
-{
- KService::Ptr s = m_providers.at(i);
- if (s.isNull())
- {
- return false;
- }
- return true;
-}
diff --git a/src/useragent/useragentinfo.h b/src/useragent/useragentinfo.h
deleted file mode 100644
index 3162fa82..00000000
--- a/src/useragent/useragentinfo.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (c) 2001 by Dawit Alemayehu <adawit@kde.org>
-* Copyright (C) 2010-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-
-#ifndef USER_AGENT_INFO_H
-#define USER_AGENT_INFO_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KService>
-
-// Qt Includes
-#include <QString>
-
-
-class UserAgentInfo
-{
-public:
- UserAgentInfo();
-
- /**
- * Lists all available providers
- *
- */
- KService::List availableProviders() const;
-
- /**
- * Lists all available User Agents
- *
- * @returns the list of the UA descriptions
- */
- QStringList availableUserAgents();
-
- /**
- * Set User Agent for host
- *
- * @param uaIndex the index of the UA description. @see availableUserAgents()
- * @param host the host to se the UA
- */
- bool setUserAgentForHost(int uaIndex, const QString &host);
-
- /**
- * @returns the index of the UA set for the @p host
- */
- int uaIndexForHost(const QString &);
-
-private:
- QString userAgentString(int);
- QString userAgentName(int);
- QString userAgentVersion(int);
- QString userAgentDescription(int);
-
- bool providerExists(int);
-
-private:
- KService::List m_providers;
-};
-
-#endif // USER_AGENT_INFO_H
diff --git a/src/useragent/useragentmanager.cpp b/src/useragent/useragentmanager.cpp
deleted file mode 100644
index 9a2db3c9..00000000
--- a/src/useragent/useragentmanager.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "useragentmanager.h"
-#include "useragentmanager.moc"
-
-// Local Includes
-#include "useragentinfo.h"
-#include "useragentwidget.h"
-#include "webtab.h"
-#include "webview.h"
-
-// KDE Includes
-#include <KAction>
-#include <KDialog>
-#include <KMenu>
-
-
-UserAgentManager::UserAgentManager(QObject *parent)
- : QObject(parent)
- , m_uaSettingsAction(0)
-{
- m_uaSettingsAction = new KAction(KIcon("preferences-web-browser-identification"), i18n("Browser Identification"), this);
- connect(m_uaSettingsAction, SIGNAL(triggered(bool)), this, SLOT(showSettings()));
-}
-
-
-void UserAgentManager::showSettings()
-{
- QPointer<KDialog> dialog = new KDialog(m_uaTab.data());
- dialog->setCaption(i18nc("@title:window", "User Agent Settings"));
- dialog->setButtons(KDialog::Ok);
-
- UserAgentWidget widget;
- dialog->setMainWidget(&widget);
- dialog->exec();
-
- dialog->deleteLater();
-}
-
-
-void UserAgentManager::populateUAMenuForTabUrl(KMenu *uaMenu, WebTab *uaTab)
-{
- if (!m_uaTab.isNull())
- {
- disconnect(this, SIGNAL(reloadTab()), m_uaTab.data()->view(), SLOT(reload()));
- m_uaTab.clear();
- }
-
- m_uaTab = uaTab;
- connect(this, SIGNAL(reloadTab()), m_uaTab.data()->view(), SLOT(reload()));
-
- bool defaultUA = true;
-
- QAction *a, *defaultAction;
-
- // just to be sure...
- uaMenu->clear();
-
- defaultAction = new QAction(i18nc("Default rekonq user agent", "Default"), uaMenu);
- defaultAction->setData(-1);
- defaultAction->setCheckable(true);
- connect(defaultAction, SIGNAL(triggered(bool)), this, SLOT(setUserAgent()));
-
- uaMenu->addAction(defaultAction);
- uaMenu->addSeparator();
-
- // Main Browsers Menus
- KMenu *ffMenu = new KMenu(i18n("Firefox"), uaMenu);
- uaMenu->addMenu(ffMenu);
-
- KMenu *ieMenu = new KMenu(i18n("Internet Explorer"), uaMenu);
- uaMenu->addMenu(ieMenu);
-
- KMenu *nsMenu = new KMenu(i18n("Netscape"), uaMenu);
- uaMenu->addMenu(nsMenu);
-
- KMenu *opMenu = new KMenu(i18n("Opera"), uaMenu);
- uaMenu->addMenu(opMenu);
-
- KMenu *sfMenu = new KMenu(i18n("Safari"), uaMenu);
- uaMenu->addMenu(sfMenu);
-
- KMenu *otMenu = new KMenu(i18n("Other"), uaMenu);
- uaMenu->addMenu(otMenu);
-
- UserAgentInfo uaInfo;
- QStringList UAlist = uaInfo.availableUserAgents();
- const KService::List providers = uaInfo.availableProviders();
- int uaIndex = uaInfo.uaIndexForHost(m_uaTab.data()->url().host());
-
- for (int i = 0; i < UAlist.count(); ++i)
- {
- QString uaDesc = UAlist.at(i);
-
- a = new QAction(uaDesc, uaMenu);
- a->setData(i);
- a->setCheckable(true);
- connect(a, SIGNAL(triggered(bool)), this, SLOT(setUserAgent()));
-
- if (i == uaIndex)
- {
- a->setChecked(true);
- defaultUA = false;
- }
-
- QString tag = providers.at(i)->property("X-KDE-UA-TAG").toString();
- if (tag == QL1S("FF"))
- {
- ffMenu->addAction(a);
- }
- else if (tag == QL1S("IE"))
- {
- ieMenu->addAction(a);
- }
- else if (tag == QL1S("NN"))
- {
- nsMenu->addAction(a);
- }
- else if (tag == QL1S("OPR"))
- {
- opMenu->addAction(a);
- }
- else if (tag == QL1S("SAF"))
- {
- sfMenu->addAction(a);
- }
- else // OTHERs
- {
- otMenu->addAction(a);
- }
- }
- defaultAction->setChecked(defaultUA);
-
- uaMenu->addSeparator();
- uaMenu->addAction(m_uaSettingsAction);
-}
-
-
-void UserAgentManager::setUserAgent()
-{
- QAction *sender = static_cast<QAction *>(QObject::sender());
-
- int uaIndex = sender->data().toInt();
-
- UserAgentInfo uaInfo;
- uaInfo.setUserAgentForHost(uaIndex, m_uaTab.data()->url().host());
- emit reloadTab();
-}
diff --git a/src/useragent/useragentmanager.h b/src/useragent/useragentmanager.h
deleted file mode 100644
index 57a65c31..00000000
--- a/src/useragent/useragentmanager.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2011-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef USER_AGENT_MANAGER_H
-#define USER_AGENT_MANAGER_H
-
-
-// Qt Includes
-#include <QObject>
-#include <QWeakPointer>
-
-// Forward Declarations
-class WebTab;
-
-class KAction;
-class KMenu;
-
-
-class UserAgentManager : public QObject
-{
- Q_OBJECT
-
-public:
- UserAgentManager(QObject *parent = 0);
-
- void populateUAMenuForTabUrl(KMenu *, WebTab *);
-
-private Q_SLOTS:
- void showSettings();
- void setUserAgent();
-
-Q_SIGNALS:
- void reloadTab();
-
-private:
- KAction *m_uaSettingsAction;
- QWeakPointer<WebTab> m_uaTab;
-};
-
-#endif // USER_AGENT_MANAGER_H
diff --git a/src/useragent/useragentsettings.ui b/src/useragent/useragentsettings.ui
deleted file mode 100644
index e2cd5454..00000000
--- a/src/useragent/useragentsettings.ui
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>UserAgent</class>
- <widget class="QWidget" name="UserAgent">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>609</width>
- <height>496</height>
- </rect>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QTreeWidget" name="sitePolicyTreeWidget">
- <property name="rootIsDecorated">
- <bool>false</bool>
- </property>
- <property name="sortingEnabled">
- <bool>true</bool>
- </property>
- <column>
- <property name="text">
- <string>Host</string>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Identification</string>
- </property>
- </column>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QPushButton" name="deleteButton">
- <property name="text">
- <string>Delete</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="deleteAllButton">
- <property name="text">
- <string>Delete All</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/useragent/useragentwidget.cpp b/src/useragent/useragentwidget.cpp
deleted file mode 100644
index 92ba3ce4..00000000
--- a/src/useragent/useragentwidget.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "useragentwidget.h"
-#include "useragentwidget.moc"
-
-// KDE Includes
-#include <KProtocolManager>
-
-
-UserAgentWidget::UserAgentWidget(QWidget *parent)
- : QWidget(parent)
-{
- setupUi(this);
-
- connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteUserAgent()));
- connect(deleteAllButton, SIGNAL(clicked()), this, SLOT(deleteAll()));
-
- KConfig config("kio_httprc", KConfig::NoGlobals);
-
- QStringList hosts = config.groupList();
- Q_FOREACH(const QString & host, hosts)
- {
- QStringList tmp;
- tmp << host;
-
- KConfigGroup hostGroup(&config, host);
- tmp << hostGroup.readEntry(QL1S("UserAgent"), QString());
-
- QTreeWidgetItem *item = new QTreeWidgetItem(sitePolicyTreeWidget, tmp);
- sitePolicyTreeWidget->addTopLevelItem(item);
- }
-}
-
-
-void UserAgentWidget::deleteUserAgent()
-{
- QTreeWidgetItem *item = sitePolicyTreeWidget->currentItem();
- if (!item)
- return;
-
- sitePolicyTreeWidget->takeTopLevelItem(sitePolicyTreeWidget->indexOfTopLevelItem(item));
-
- QString host = item->text(0);
-
- KConfig config("kio_httprc", KConfig::NoGlobals);
- KConfigGroup group(&config, host);
- if (group.exists())
- {
- group.deleteGroup();
- KProtocolManager::reparseConfiguration();
- }
-}
-
-
-void UserAgentWidget::deleteAll()
-{
- sitePolicyTreeWidget->clear();
-
- KConfig config("kio_httprc", KConfig::NoGlobals);
-
- QStringList list = config.groupList();
- Q_FOREACH(const QString & groupName, list)
- {
- KConfigGroup group(&config, groupName);
- group.deleteGroup();
- }
- KConfigGroup group(&config, QString());
- group.deleteGroup();
-
- KProtocolManager::reparseConfiguration();
-}
diff --git a/src/useragent/useragentwidget.h b/src/useragent/useragentwidget.h
deleted file mode 100644
index 1c850d9e..00000000
--- a/src/useragent/useragentwidget.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef USER_AGENT_WIDGET_H
-#define USER_AGENT_WIDGET_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QWidget>
-
-// Ui Includes
-#include "ui_useragentsettings.h"
-
-
-class UserAgentWidget : public QWidget, private Ui::UserAgent
-{
- Q_OBJECT
-
-public:
- UserAgentWidget(QWidget *parent = 0);
-
-private Q_SLOTS:
- void deleteUserAgent();
- void deleteAll();
-};
-
-#endif
diff --git a/src/walletbar.cpp b/src/walletbar.cpp
deleted file mode 100644
index 01a6d658..00000000
--- a/src/walletbar.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "walletbar.h"
-#include "walletbar.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// KDE Includes
-#include <KIcon>
-#include <KLocalizedString>
-
-// Qt Includes
-#include <QAction>
-
-
-WalletBar::WalletBar(QWidget *parent)
- : KMessageWidget(parent)
-{
- setMessageType(KMessageWidget::Warning);
-
- QSize sz = size();
- sz.setWidth(qobject_cast<QWidget *>(parent)->size().width());
- resize(sz);
-
- setCloseButtonVisible(false);
-
- QAction *rememberAction = new QAction(KIcon("document-save"), i18n("Remember"), this);
- connect(rememberAction, SIGNAL(triggered(bool)), this, SLOT(rememberData()));
- addAction(rememberAction);
-
- QAction *neverHereAction = new QAction(KIcon("process-stop"), i18n("Never for This Site"), this);
- connect(neverHereAction, SIGNAL(triggered(bool)), this, SLOT(neverRememberData()));
- addAction(neverHereAction);
-
- QAction *notNowAction = new QAction(KIcon("dialog-cancel"), i18n("Not Now"), this);
- connect(notNowAction, SIGNAL(triggered(bool)), this, SLOT(notNowRememberData()));
- addAction(notNowAction);
-}
-
-
-void WalletBar::rememberData()
-{
- emit saveFormDataAccepted(m_key);
-
- animatedHide();
- deleteLater();
-}
-
-
-void WalletBar::neverRememberData()
-{
- // add url to the blacklist
- QStringList list = ReKonfig::walletBlackList();
- list << m_url.toString();
- ReKonfig::setWalletBlackList(list);
-
- notNowRememberData();
-}
-
-
-void WalletBar::notNowRememberData()
-{
- emit saveFormDataRejected(m_key);
-
- animatedHide();
- deleteLater();
-}
-
-
-
-void WalletBar::onSaveFormData(const QString &key, const QUrl &url)
-{
- setText(i18n("Do you want rekonq to remember the password on %1?", url.host()));
-
- m_key = key;
- m_url = url;
-}
diff --git a/src/walletbar.h b/src/walletbar.h
deleted file mode 100644
index f1bbd2cb..00000000
--- a/src/walletbar.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WALLET_BAR_H
-#define WALLET_BAR_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KMessageWidget>
-
-// Qt Includes
-#include <QUrl>
-#include <QString>
-
-
-class REKONQ_TESTS_EXPORT WalletBar : public KMessageWidget
-{
- Q_OBJECT
-
-public:
- WalletBar(QWidget *parent);
-
-private Q_SLOTS:
- void rememberData();
- void neverRememberData();
- void notNowRememberData();
-
-public Q_SLOTS:
- void onSaveFormData(const QString &, const QUrl &);
-
-Q_SIGNALS:
- void saveFormDataAccepted(const QString &);
- void saveFormDataRejected(const QString &);
-
-private:
- QString m_key;
- QUrl m_url;
-};
-
-#endif // WALLET_BAR_H
diff --git a/src/webappcreation.ui b/src/webappcreation.ui
deleted file mode 100644
index 1e688290..00000000
--- a/src/webappcreation.ui
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>webAppCreation</class>
- <widget class="QWidget" name="webAppCreation">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>461</width>
- <height>143</height>
- </rect>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Name:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLineEdit" name="nameLineEdit"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>Description:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLineEdit" name="descriptionLineEdit">
- <property name="text">
- <string/>
- </property>
- <property name="placeholderText">
- <string>(optional)</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Create Application shortcuts in:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_createDesktopAppShortcut">
- <property name="text">
- <string>Desktop</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_createMenuAppShortcut">
- <property name="text">
- <string>Application Menu</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/webicon.cpp b/src/webicon.cpp
deleted file mode 100644
index 7943cfb6..00000000
--- a/src/webicon.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "webicon.h"
-#include "webicon.moc"
-
-// Local Includes
-#include "application.h"
-#include "iconmanager.h"
-
-// Qt Includes
-#include <QTimer>
-#include <QWebFrame>
-
-
-WebIcon::WebIcon(const KUrl& url, QObject *parent)
- : QObject(parent)
- , m_url(url)
-{
- m_page.settings()->setAttribute(QWebSettings::PluginsEnabled, false);
- m_page.settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
- m_page.settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
-
- connect(&m_page, SIGNAL(loadFinished(bool)), this, SLOT(saveIcon(bool)));
- QTimer::singleShot(0, this, SLOT(load()));
-}
-
-
-void WebIcon::load()
-{
- m_page.mainFrame()->load(m_url);
-}
-
-
-void WebIcon::saveIcon(bool b)
-{
- if (b)
- rApp->iconManager()->provideIcon(m_page.mainFrame(), m_url, false);
-
- this->deleteLater();
-}
diff --git a/src/webicon.h b/src/webicon.h
deleted file mode 100644
index 39f98e7e..00000000
--- a/src/webicon.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEB_ICON_H
-#define WEB_ICON_H
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KUrl>
-
-// Qt Includes
-#include <QWebPage>
-
-
-class REKONQ_TESTS_EXPORT WebIcon : public QObject
-{
- Q_OBJECT
-
-public:
- explicit WebIcon(const KUrl &url, QObject *parent = 0);
-
-private Q_SLOTS:
- void load();
- void saveIcon(bool);
-
-private:
- QWebPage m_page;
- KUrl m_url;
-};
-
-#endif //WEB_ICON_H
diff --git a/src/webinspectorpanel.cpp b/src/webinspectorpanel.cpp
deleted file mode 100644
index 06e98643..00000000
--- a/src/webinspectorpanel.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "webinspectorpanel.h"
-#include "webinspectorpanel.moc"
-
-// Local Includes
-#include "mainwindow.h"
-#include "webpage.h"
-#include "webtab.h"
-
-// Qt Includes
-#include <QAction>
-#include <QWebInspector>
-
-
-WebInspectorPanel::WebInspectorPanel(QString title, QWidget *parent)
- : QDockWidget(title, parent)
- , _inspector(0)
-{
- setObjectName("webInspectorDock");
-}
-
-
-void WebInspectorPanel::closeEvent(QCloseEvent *event)
-{
- Q_UNUSED(event);
- toggle(false);
-}
-
-
-void WebInspectorPanel::toggle(bool enable)
-{
- MainWindow *w = qobject_cast<MainWindow *>(parent());
- w->actionByName(QL1S("web_inspector"))->setChecked(enable);
-
- if (enable)
- {
- w->currentTab()->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
- if (!_inspector)
- {
- _inspector = new QWebInspector(this);
- _inspector->setPage(w->currentTab()->page());
- setWidget(_inspector);
- }
- }
- else
- {
- w->currentTab()->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, false);
- }
-
- setVisible(enable);
-}
-
-
-void WebInspectorPanel::changeCurrentPage()
-{
- MainWindow *w = qobject_cast<MainWindow *>(parent());
- bool enable = w->currentTab()->page()->settings()->testAttribute(QWebSettings::DeveloperExtrasEnabled);
- toggle(enable);
-}
diff --git a/src/webinspectorpanel.h b/src/webinspectorpanel.h
deleted file mode 100644
index ebe82267..00000000
--- a/src/webinspectorpanel.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2010-2011 by Matthieu Gicquel <matgic78 at gmail dot com>
-* Copyright (C) 2010-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEBINSPECTOR_PANEL_H
-#define WEBINSPECTOR_PANEL_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QDockWidget>
-
-// Forward
-class QWebInspector;
-
-
-/**
- * Docked web inspector
- * behaviour : hide/show by tab, not globally
-**/
-class REKONQ_TESTS_EXPORT WebInspectorPanel : public QDockWidget
-{
- Q_OBJECT
-public:
- WebInspectorPanel(QString title, QWidget *parent);
-
-public Q_SLOTS:
- void toggle(bool enable);
- void changeCurrentPage();
-
-protected:
- virtual void closeEvent(QCloseEvent *event);
-
- QWebInspector *_inspector;
-};
-
-#endif
diff --git a/src/webpage.cpp b/src/webpage.cpp
deleted file mode 100644
index 59262862..00000000
--- a/src/webpage.cpp
+++ /dev/null
@@ -1,777 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008 Dirk Mueller <mueller@kde.org>
-* Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
-* Copyright (C) 2008 Michael Howell <mhowell123@gmail.com>
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-* Copyright (C) 2009-2010 Dawit Alemayehu <adawit at kde dot org>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "webpage.h"
-#include "webpage.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "adblockmanager.h"
-#include "application.h"
-#include "downloadmanager.h"
-#include "historymanager.h"
-#include "iconmanager.h"
-#include "mainview.h"
-#include "mainwindow.h"
-#include "networkaccessmanager.h"
-#include "urlbar.h"
-#include "webpluginfactory.h"
-#include "websnap.h"
-#include "webtab.h"
-#include "searchengine.h"
-#include "sslwidget.h"
-#include "sslinfodialog.h"
-
-// KDE Includes
-#include <KTemporaryFile>
-#include <KStandardDirs>
-#include <KJobUiDelegate>
-#include <KLocalizedString>
-#include <KMessageBox>
-#include <KMimeTypeTrader>
-#include <KService>
-#include <KWebWallet>
-#include <KProtocolInfo>
-#include <KRun>
-
-#include <KIO/JobUiDelegate>
-
-#include <kparts/browseropenorsavequestion.h>
-
-// Qt Includes
-#include <QTextDocument>
-#include <QFileInfo>
-#include <QNetworkReply>
-
-
-// Returns true if the scheme and domain of the two urls match...
-static bool domainSchemeMatch(const QUrl& u1, const QUrl& u2)
-{
- if (u1.scheme() != u2.scheme())
- return false;
-
- QStringList u1List = u1.host().split(QL1C('.'), QString::SkipEmptyParts);
- QStringList u2List = u2.host().split(QL1C('.'), QString::SkipEmptyParts);
-
- if (qMin(u1List.count(), u2List.count()) < 2)
- return false; // better safe than sorry...
-
- while (u1List.count() > 2)
- u1List.removeFirst();
-
- while (u2List.count() > 2)
- u2List.removeFirst();
-
- return (u1List == u2List);
-}
-
-
-static void extractMimeType(const QNetworkReply* reply, QString& mimeType)
-{
- mimeType.clear();
- const KIO::MetaData& metaData = reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap();
- if (metaData.contains(QL1S("content-type")))
- mimeType = metaData.value(QL1S("content-type"));
-
- if (!mimeType.isEmpty())
- return;
-
- if (!reply->hasRawHeader("Content-Type"))
- return;
-
- const QString value(QL1S(reply->rawHeader("Content-Type").simplified().constData()));
- const int index = value.indexOf(QL1C(';'));
- if (index == -1)
- mimeType = value;
- else
- mimeType = value.left(index);
-}
-
-
-// ---------------------------------------------------------------------------------
-
-
-WebPage::WebPage(QWidget *parent)
- : KWebPage(parent, KWalletIntegration)
- , _networkAnalyzer(false)
- , _isOnRekonqPage(false)
-{
- // handling unsupported content...
- setForwardUnsupportedContent(true);
- connect(this, SIGNAL(unsupportedContent(QNetworkReply*)), this, SLOT(handleUnsupportedContent(QNetworkReply*)));
-
- // rekonq Network Manager
- NetworkAccessManager *manager = new NetworkAccessManager(this);
-
- // set network reply object to emit readyRead when it receives meta data
- manager->setEmitReadyReadOnMetaDataChange(true);
-
- // disable QtWebKit cache to just use KIO one..
- manager->setCache(0);
-
- // set cookieJar window..
- if (parent && parent->window())
- manager->setWindow(parent->window());
-
- setNetworkAccessManager(manager);
-
- // activate ssl warnings
- setSessionMetaData(QL1S("ssl_activate_warnings"), QL1S("TRUE"));
-
- // ----- Web Plugin Factory
- setPluginFactory(new WebPluginFactory(this));
-
- // ----- last stuffs
- connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(manageNetworkErrors(QNetworkReply*)));
-
- connect(this, SIGNAL(downloadRequested(QNetworkRequest)), this, SLOT(downloadRequest(QNetworkRequest)));
- connect(this, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
- connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
-
- // protocol handler signals
- connect(&_protHandler, SIGNAL(downloadUrl(KUrl)), this, SLOT(downloadUrl(KUrl)));
-
- connect(rApp->iconManager(), SIGNAL(iconChanged()), mainFrame(), SIGNAL(iconChanged()));
-}
-
-
-WebPage::~WebPage()
-{
- disconnect();
-
- QPixmap preview = WebSnap::renderPagePreview(*this);
- QString path = WebSnap::imagePathFromUrl(mainFrame()->url().toString());
- QFile::remove(path);
- preview.save(path);
-}
-
-
-bool WebPage::hasNetworkAnalyzerEnabled() const
-{
- return _networkAnalyzer;
-};
-
-
-void WebPage::enableNetworkAnalyzer(bool b)
-{
- _networkAnalyzer = b;
-};
-
-
-bool WebPage::isOnRekonqPage() const
-{
- return _isOnRekonqPage;
-};
-
-
-void WebPage::setIsOnRekonqPage(bool b)
-{
- _isOnRekonqPage = b;
-};
-
-
-KUrl WebPage::loadingUrl()
-{
- return _loadingUrl;
-};
-
-
-QString WebPage::suggestedFileName()
-{
- return _suggestedFileName;
-};
-
-
-bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type)
-{
- if (_isOnRekonqPage)
- {
- WebView *view = qobject_cast<WebView *>(parent());
- WebTab *tab = qobject_cast<WebTab *>(view->parent());
- _isOnRekonqPage = false;
- tab->setPart(0, KUrl()); // re-enable the view page
- }
-
- // reset webpage values
- _suggestedFileName.clear();
- _loadingUrl = request.url();
-
- const bool isMainFrameRequest = (frame == mainFrame());
-
- if (frame)
- {
- if (_protHandler.preHandling(request, frame))
- {
- return false;
- }
-
- switch (type)
- {
- case QWebPage::NavigationTypeLinkClicked:
- if (_sslInfo.isValid())
- {
- setRequestMetaData("ssl_was_in_use", "TRUE");
- }
- break;
-
- case QWebPage::NavigationTypeFormSubmitted:
- break;
-
- case QWebPage::NavigationTypeFormResubmitted:
- if (KMessageBox::warningContinueCancel(view(),
- i18n("Are you sure you want to send your data again?"),
- i18n("Resend form data")
- )
- == KMessageBox::Cancel)
- {
- return false;
- }
- break;
-
- case QWebPage::NavigationTypeReload:
- setRequestMetaData(QL1S("cache"), QL1S("reload"));
- break;
-
- case QWebPage::NavigationTypeBackOrForward:
- case QWebPage::NavigationTypeOther:
- break;
-
- default:
- ASSERT_NOT_REACHED(unknown NavigationType);
- break;
- }
- }
-
- // Get the SSL information sent, if any...
- KIO::AccessManager *manager = qobject_cast<KIO::AccessManager*>(networkAccessManager());
- KIO::MetaData metaData = manager->requestMetaData();
- if (metaData.contains(QL1S("ssl_in_use")))
- {
- WebSslInfo info;
- info.restoreFrom(metaData.toVariant(), request.url());
- info.setUrl(request.url());
- _sslInfo = info;
- }
-
- if (isMainFrameRequest)
- {
- setRequestMetaData(QL1S("main_frame_request"), QL1S("TRUE"));
- if (_sslInfo.isValid() && !domainSchemeMatch(request.url(), _sslInfo.url()))
- {
- _sslInfo = WebSslInfo();
- }
- }
- else
- {
- setRequestMetaData(QL1S("main_frame_request"), QL1S("FALSE"));
- }
-
- return KWebPage::acceptNavigationRequest(frame, request, type);
-}
-
-
-WebPage *WebPage::createWindow(QWebPage::WebWindowType type)
-{
- // added to manage web modal dialogs
- if (type == QWebPage::WebModalDialog)
- kDebug() << "Modal Dialog";
-
- WebTab *w = 0;
- if (ReKonfig::openLinksInNewWindow())
- {
- w = rApp->newMainWindow()->mainView()->currentWebTab();
- }
- else
- {
- w = rApp->mainWindow()->mainView()->newWebTab(!ReKonfig::openNewTabsInBackground());
- }
- return w->page();
-}
-
-
-void WebPage::handleUnsupportedContent(QNetworkReply *reply)
-{
- Q_ASSERT(reply);
-
- if (!reply)
- return;
-
- // handle protocols WebKit cannot handle...
- if (_protHandler.postHandling(reply->request(), mainFrame()))
- {
- return;
- }
-
- if (reply->error() != QNetworkReply::NoError)
- return;
-
- KIO::Integration::AccessManager::putReplyOnHold(reply);
-
- // Get mimeType...
- extractMimeType(reply, _mimeType);
-
- // Convert executable text files to plain text...
- if (KParts::BrowserRun::isTextExecutable(_mimeType))
- _mimeType = QL1S("text/plain");
-
- // Get suggested file name...
- const KIO::MetaData& data = reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap();
- _suggestedFileName = data.value(QL1S("content-disposition-filename"));
-
- kDebug() << "Detected MimeType = " << _mimeType;
- kDebug() << "Suggested File Name = " << _suggestedFileName;
- // ------------------------------------------------
-
- KService::Ptr appService = KMimeTypeTrader::self()->preferredService(_mimeType);
-
- KUrl replyUrl = reply->url();
- bool isLocal = replyUrl.isLocalFile();
-
- if (appService.isNull()) // no service can handle this. We can just download it..
- {
- isLocal
- ? KMessageBox::sorry(view(), i18n("No service can handle this file."))
- : downloadUrl(reply->url());
-
- return;
- }
-
- // NOTE
- // This is needed in case rekonq has been associated with something it cannot
- // properly handle (eg: xbel files, see BUG:299056). This way we break an eventual
- // "recall" loop.
- if (appService->exec().trimmed().startsWith(QL1S("rekonq")))
- {
- isLocal
- ? KMessageBox::sorry(view(), i18n("rekonq cannot properly handle this, sorry"))
- : downloadUrl(reply->url());
-
- return;
- }
-
- if (isLocal)
- {
- // Load outside local files
- KRun::run(*appService, replyUrl, 0, false, _suggestedFileName);
- }
- else
- {
- KParts::BrowserOpenOrSaveQuestion dlg(rApp->mainWindow(), replyUrl, _mimeType);
-
- if (!_suggestedFileName.isEmpty())
- dlg.setSuggestedFileName(_suggestedFileName);
-
- // read askEmbedOrSave preferences. If we don't have to show dialog and rekonq settings are
- // to automatically choose download dir, we won't show local dir choose dialog
- KConfigGroup cg = KConfigGroup(KSharedConfig::openConfig("filetypesrc", KConfig::NoGlobals), QL1S("Notification Messages"));
- bool hideDialog = cg.readEntry(QL1S("askEmbedOrSave") + _mimeType, false);
-
- kDebug() << "Hide dialog for " << _mimeType << "? " << hideDialog;
-
- switch (dlg.askEmbedOrSave())
- {
- case KParts::BrowserOpenOrSaveQuestion::Save:
- rApp->downloadManager()->downloadResource(reply->url(), KIO::MetaData(), view(), !hideDialog, _suggestedFileName);
- return;
-
- case KParts::BrowserOpenOrSaveQuestion::Cancel:
- return;
-
- default: // Can happen when "Open with.." is set and "don't ask again" is checked
- break;
- }
- }
-
- // Handle Post operations that return content...
- if (reply->operation() == QNetworkAccessManager::PostOperation)
- {
- kDebug() << "POST OPERATION: downloading file...";
- QFileInfo finfo(_suggestedFileName.isEmpty() ? _loadingUrl.fileName() : _suggestedFileName);
- KTemporaryFile tempFile;
- tempFile.setSuffix(QL1C('.') + finfo.suffix());
- tempFile.setAutoRemove(false);
- tempFile.open();
- KUrl destUrl;
- destUrl.setPath(tempFile.fileName());
- KIO::Job *job = KIO::file_copy(_loadingUrl, destUrl, 0600, KIO::Overwrite);
- job->ui()->setWindow(rApp->mainWindow());
- connect(job, SIGNAL(result(KJob*)), this, SLOT(copyToTempFileResult(KJob*)));
- return;
- }
-
- // case KParts::BrowserRun::Embed
- KParts::ReadOnlyPart *pa = KMimeTypeTrader::createPartInstanceFromQuery<KParts::ReadOnlyPart>(_mimeType, view(), this, QString());
- if (pa)
- {
- _isOnRekonqPage = true;
-
- WebView *view = qobject_cast<WebView *>(parent());
- WebTab *tab = qobject_cast<WebTab *>(view->parent());
- tab->setPart(pa, replyUrl);
-
- UrlBar *bar = tab->urlBar();
- bar->setQUrl(replyUrl);
-
- rApp->mainWindow()->updateHistoryActions();
- }
- else
- {
- // No parts, just app services. Load it!
- // If the app is a KDE one, publish the slave on hold to let it use it.
- // Otherwise, run the app and remove it (the io slave...)
- KRun::run(*appService, replyUrl, 0, false, _suggestedFileName);
- }
-
- return;
-}
-
-
-void WebPage::loadStarted()
-{
- _hasAdBlockedElements = false;
- rApp->adblockManager()->clearElementsLists();
-
- // set zoom factor
- QString val;
- KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup group(config, "Zoom");
- val = group.readEntry(_loadingUrl.host(), QString("10"));
-
- int value = val.toInt();
- if (value != 10)
- mainFrame()->setZoomFactor(QVariant(value).toReal() / 10); // Don't allox max +1 values
-}
-
-
-void WebPage::loadFinished(bool ok)
-{
- Q_UNUSED(ok);
-
- // Provide site icon. Can this be moved to loadStarted??
- rApp->iconManager()->provideIcon(mainFrame(), _loadingUrl);
-
- // Apply adblock manager hiding rules
- rApp->adblockManager()->applyHidingRules(this);
-
- // KWallet Integration
- QStringList list = ReKonfig::walletBlackList();
- if (wallet()
- && !list.contains(mainFrame()->url().toString())
- )
- {
- wallet()->fillFormData(mainFrame());
- }
-}
-
-
-void WebPage::manageNetworkErrors(QNetworkReply *reply)
-{
- Q_ASSERT(reply);
-
- QWebFrame* frame = qobject_cast<QWebFrame *>(reply->request().originatingObject());
- if (!frame)
- return;
-
- const bool isMainFrameRequest = (frame == mainFrame());
-
- // Only deal with non-redirect responses...
- const QVariant redirectVar = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
- if (redirectVar.isValid())
- {
- _sslInfo.restoreFrom(reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)), reply->url());
- return;
- }
-
- // We are just managing loading URLs errors
- if (reply->request().url() != _loadingUrl)
- return;
-
- // NOTE: These are not all networkreply errors,
- // but just that supported directly by KIO
- switch (reply->error())
- {
-
- case QNetworkReply::NoError: // no error. Simple :)
- if (isMainFrameRequest)
- {
- // Obtain and set the SSL information if any...
- _sslInfo.restoreFrom(reply->attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)), reply->url());
- _sslInfo.setUrl(reply->url());
- }
- break;
-
- case QNetworkReply::OperationCanceledError: // operation canceled via abort() or close() calls
- // ignore this..
- return;
-
- // WARNING: This is also typical adblocked element error: IGNORE THIS!
- case QNetworkReply::ContentAccessDenied: // access to remote content denied
- break;
-
- case QNetworkReply::UnknownNetworkError: // unknown network-related error detected
- // last chance for the strange things (eg: FTP, custom schemes, etc...)
- if (_protHandler.postHandling(reply->request(), mainFrame()))
- return;
-
- case QNetworkReply::ConnectionRefusedError: // remote server refused connection
- case QNetworkReply::HostNotFoundError: // invalid hostname
- case QNetworkReply::TimeoutError: // connection time out
- case QNetworkReply::ProxyNotFoundError: // invalid proxy hostname
- case QNetworkReply::ContentOperationNotPermittedError: // operation requested on remote content not permitted
- case QNetworkReply::ContentNotFoundError: // remote content not found on server (similar to HTTP error 404)
- case QNetworkReply::ProtocolUnknownError: // Unknown protocol
- case QNetworkReply::ProtocolInvalidOperationError: // requested operation is invalid for this protocol
- default:
- kDebug() << "ERROR " << reply->error() << ": " << reply->errorString();
- if (reply->url() == _loadingUrl)
- {
- frame->setHtml(errorPage(reply));
- if (isMainFrameRequest)
- {
- _isOnRekonqPage = true;
-
- WebView *view = qobject_cast<WebView *>(parent());
- WebTab *tab = qobject_cast<WebTab *>(view->parent());
- UrlBar *bar = tab->urlBar();
- bar->setQUrl(_loadingUrl);
-
- rApp->mainWindow()->updateHistoryActions();
- }
- }
- break;
-
- }
-}
-
-
-QString WebPage::errorPage(QNetworkReply *reply)
-{
- // display "not found" page
- QString notfoundFilePath = KStandardDirs::locate("data", "rekonq/htmls/rekonqinfo.html");
- QFile file(notfoundFilePath);
-
- bool isOpened = file.open(QIODevice::ReadOnly);
- if (!isOpened)
- {
- return QString("Couldn't open the rekonqinfo.html file");
- }
-
- // NOTE:
- // this, to take care about XSS (see BUG 217464)...
- QString urlString = Qt::escape(reply->url().toString());
-
- // 1. data path
- QString dataPath = QL1S("file://") + notfoundFilePath;
- dataPath.remove(QL1S("/htmls/rekonqinfo.html"));
-
- // 2. title
- QString title = i18n("There was a problem while loading the page");
-
- // 3. main content
- QString msg;
-
- msg += i18n("<h1>Oops! Rekonq cannot load <em>%1</em></h1>", urlString);
-
-
- msg += i18n("<h2>Wrongly typed?</h2>");
-
- msg += QL1S("<table>");
- msg += QL1S("<tr><td>");
-
- msg += QL1S("<p>");
-
- msg += i18n("We tried to load url: %1.<br />", urlString);
- msg += i18n("Check your address for errors like <em>ww.kde.org</em> instead of <em>www.kde.org</em>.<br />");
- msg += i18n("If you spelled right, just try to <a href=\"%1\">reload it</a>.<br />", urlString);
- msg += i18n("Otherwise, just be careful the next time around.");
-
- msg += QL1S("</p>");
-
- QString laughIconPath = QString("file://") + KIconLoader::global()->iconPath("face-laugh" , -KIconLoader::SizeHuge, false);
- msg += QL1S("</td><td>");
- msg += QL1S("<img src=\"") + laughIconPath + QL1S("\" />");
- msg += QL1S("</td></tr></table>");
-
-
- msg += i18n("<h2>Network problems?</h2>");
-
- QString faceIconPath = QString("file://") + KIconLoader::global()->iconPath("face-surprise" , -KIconLoader::SizeHuge, false);
- msg += QL1S("<table>");
- msg += QL1S("<tr><td width=\"100px\">");
- msg += QL1S("<img src=\"") + faceIconPath + QL1S("\" />");
- msg += QL1S("</td><td>");
-
- msg += QL1S("<p>");
-
- msg += i18n("Maybe you are having problems with your network.<br />");
- msg += i18n("Try checking your <a href=\"%1\">network connections</a>", QL1S("about:settings/network"));
- msg += i18n(", your <a href=\"%1\">proxy settings</a> ", QL1S("about:settings/proxy"));
- msg += i18n("and your <a href=\"%1\">firewall</a>.<br />", QL1S("about:settings/firewall"));
- msg += i18n("Then try again.<br />");
-
- msg += QL1S("</p>");
-
- msg += QL1S("</td></tr></table>");
-
-
- msg += i18n("<h2>Suggestions</h2>");
-
- msg += QL1S("<table>");
- msg += QL1S("<tr><td>");
-
- msg += QL1S("<p>");
-
- // Default SearchEngine
- KService::Ptr defaultEngine = SearchEngine::defaultEngine();
-
- if (defaultEngine)
- {
- msg += i18n("Consult your default search engine about:");
- msg += QL1S(" <a href=\"") + SearchEngine::buildQuery(defaultEngine, urlString) + QL1S("\">");
- msg += i18n("search with %1", defaultEngine->name());
- msg += QL1S("</a>!<br />");
- }
- else
- {
- msg += i18n("You don't have a default search engine set. We won't suggest you one.");
- }
-
- msg += i18n("At least, you can consult a cached snapshot of the site: <br />");
- msg += i18n("Try checking the <a href=\"%1\">Wayback Machine</a>", QL1S("http://wayback.archive.org/web/*/") + urlString);
- msg += i18n(" or the <a href=\"%1\">Google Cache</a>.", QL1S("http://google.com/search?q=cache:") + urlString);
-
- msg += QL1S("</p>");
-
- QString winkIconPath = QString("file://") + KIconLoader::global()->iconPath("face-wink" , -KIconLoader::SizeHuge, false);
- msg += QL1S("</td><td>");
- msg += QL1S("<img src=\"") + winkIconPath + QL1S("\" />");
- msg += QL1S("</td></tr></table>");
-
- // done. Replace variables and show it
- QString html = QL1S(file.readAll());
-
- html.replace(QL1S("$DEFAULT_PATH"), dataPath);
- html.replace(QL1S("$PAGE_TITLE"), title);
- html.replace(QL1S("$MAIN_CONTENT"), msg);
-
- return html;
-}
-
-
-void WebPage::downloadRequest(const QNetworkRequest &request)
-{
- rApp->downloadManager()->downloadResource(request.url(),
- request.attribute(static_cast<QNetworkRequest::Attribute>(KIO::AccessManager::MetaData)).toMap(),
- view());
-}
-
-
-void WebPage::downloadUrl(const KUrl &url)
-{
- rApp->downloadManager()->downloadResource(url, KIO::MetaData(), view());
-}
-
-
-void WebPage::downloadAllContentsWithKGet()
-{
- QSet<QString> contents;
- KUrl baseUrl(currentFrame()->url());
- KUrl relativeUrl;
-
- QWebElementCollection images = mainFrame()->documentElement().findAll("img");
- Q_FOREACH(const QWebElement & img, images)
- {
- relativeUrl.setEncodedUrl(img.attribute("src").toUtf8(), KUrl::TolerantMode);
- contents << baseUrl.resolved(relativeUrl).toString();
- }
-
- QWebElementCollection links = mainFrame()->documentElement().findAll("a");
- Q_FOREACH(const QWebElement & link, links)
- {
- relativeUrl.setEncodedUrl(link.attribute("href").toUtf8(), KUrl::TolerantMode);
- contents << baseUrl.resolved(relativeUrl).toString();
- }
-
- rApp->downloadManager()->downloadLinksWithKGet(QVariant(contents.toList()));
-}
-
-
-void WebPage::showSSLInfo(QPoint pos)
-{
- if (mainFrame()->url().scheme() == QL1S("https"))
- {
- SSLWidget *widget = new SSLWidget(mainFrame()->url(), _sslInfo, view());
- widget->showAt(pos);
- }
- else
- {
- KMessageBox::information(view(),
- i18n("This site does not contain SSL information."),
- i18nc("Secure Sockets Layer", "SSL")
- );
- }
-}
-
-
-void WebPage::copyToTempFileResult(KJob* job)
-{
- if (job->error())
- job->uiDelegate()->showErrorMessage();
- else
- (void)KRun::runUrl(static_cast<KIO::FileCopyJob *>(job)->destUrl(), _mimeType, rApp->mainWindow());
-}
-
-
-bool WebPage::hasSslValid() const
-{
- QList<QSslCertificate> certList = _sslInfo.certificateChain();
-
- if (certList.isEmpty())
- return false;
-
- const QSslCertificate cert = certList.at(0);
- if (!cert.isValid())
- return false;
-
- QList<QStringList> errorList = SslInfoDialog::errorsFromString(_sslInfo.certificateErrors());
- if (!errorList.isEmpty())
- {
- QStringList list = errorList.at(0);
- if (!list.isEmpty())
- return false;
- }
-
- return true;
-}
diff --git a/src/webpage.h b/src/webpage.h
deleted file mode 100644
index abc9f64c..00000000
--- a/src/webpage.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008 Benjamin C. Meyer <ben@meyerhome.net>
-* Copyright (C) 2008 Dirk Mueller <mueller@kde.org>
-* Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
-* Copyright (C) 2008 Michael Howell <mhowell123@gmail.com>
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEBPAGE_H
-#define WEBPAGE_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "protocolhandler.h"
-#include "websslinfo.h"
-
-// KDE Includes
-#include <KWebPage>
-
-
-class REKONQ_TESTS_EXPORT WebPage : public KWebPage
-{
- Q_OBJECT
-
-public:
- explicit WebPage(QWidget *parent = 0);
- ~WebPage();
-
- bool hasNetworkAnalyzerEnabled() const;
- void enableNetworkAnalyzer(bool b);
-
- bool isOnRekonqPage() const;
- void setIsOnRekonqPage(bool b);
-
- KUrl loadingUrl();
-
- QString suggestedFileName();
-
- inline bool hasAdBlockedElements() const
- {
- return _hasAdBlockedElements;
- };
-
- inline void setHasAdBlockedElements(bool b)
- {
- _hasAdBlockedElements = b;
- };
-
- bool hasSslValid() const;
-
-public Q_SLOTS:
- void downloadAllContentsWithKGet();
-
- virtual void downloadRequest(const QNetworkRequest &request);
- virtual void downloadUrl(const KUrl &url);
-
-protected:
- WebPage *createWindow(WebWindowType type);
-
- virtual bool acceptNavigationRequest(QWebFrame *frame,
- const QNetworkRequest &request,
- NavigationType type);
-
-private Q_SLOTS:
- void handleUnsupportedContent(QNetworkReply *reply);
- void manageNetworkErrors(QNetworkReply *reply);
- void loadStarted();
- void loadFinished(bool);
- void showSSLInfo(QPoint);
-
- void copyToTempFileResult(KJob*);
-
-private:
- QString errorPage(QNetworkReply *reply);
- KUrl _loadingUrl;
-
- ProtocolHandler _protHandler;
- WebSslInfo _sslInfo;
-
- QString _mimeType;
- QString _suggestedFileName;
-
- bool _networkAnalyzer;
- bool _isOnRekonqPage;
- bool _hasAdBlockedElements;
-};
-
-#endif
diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp
deleted file mode 100644
index 083ea747..00000000
--- a/src/webpluginfactory.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "webpluginfactory.h"
-#include "webpluginfactory.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "clicktoflash.h"
-
-
-WebPluginFactory::WebPluginFactory(QObject *parent)
- : KWebPluginFactory(parent)
- , _loadClickToFlash(false)
-{
- connect(this, SIGNAL(signalLoadClickToFlash(bool)), SLOT(setLoadClickToFlash(bool)));
-}
-
-
-void WebPluginFactory::setLoadClickToFlash(bool load)
-{
- _loadClickToFlash = load;
-}
-
-
-QObject *WebPluginFactory::create(const QString &_mimeType,
- const QUrl &url,
- const QStringList &argumentNames,
- const QStringList &argumentValues) const
-{
- QString mimeType(_mimeType.trimmed());
- // If no mimetype is provided, follow kwebpluginfactory road to determine/guess it
- if (mimeType.isEmpty())
- {
- extractGuessedMimeType(url, &mimeType);
- }
-
- kDebug() << "loading mimeType: " << mimeType;
-
- // we'd like to use djvu plugin if possible. If not available, rekonq protocol handler
- // will provide a part to load it. See BUG:304562 about
- if (mimeType == QL1S("image/vnd.djvu") || mimeType == QL1S("image/x.djvu"))
- return 0;
-
- switch (ReKonfig::pluginsEnabled())
- {
- case 0:
- kDebug() << "No plugins found for" << mimeType << ". Falling back to KDEWebKit ones...";
- return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues);
-
- case 1:
- if (mimeType != QString("application/x-shockwave-flash")
- && mimeType != QString("application/futuresplash"))
- break;
-
- if (_loadClickToFlash)
- {
- emit signalLoadClickToFlash(false);
- return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues);
- }
- else
- {
- ClickToFlash* ctf = new ClickToFlash(url);
- connect(ctf, SIGNAL(signalLoadClickToFlash(bool)), this, SLOT(setLoadClickToFlash(bool)));
- return ctf;
- }
- break;
-
- case 2:
- return 0;
-
- default:
- ASSERT_NOT_REACHED("oh oh.. this should NEVER happen..");
- break;
- }
-
- return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues);
-}
diff --git a/src/webpluginfactory.h b/src/webpluginfactory.h
deleted file mode 100644
index 82bf02ce..00000000
--- a/src/webpluginfactory.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEB_PLUGIN_FACTORY_H
-#define WEB_PLUGIN_FACTORY_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KWebPluginFactory>
-
-
-class REKONQ_TESTS_EXPORT WebPluginFactory : public KWebPluginFactory
-{
- Q_OBJECT
-
-public:
- WebPluginFactory(QObject *parent);
-
- virtual QObject *create(const QString &_mimeType,
- const QUrl &url,
- const QStringList &argumentNames,
- const QStringList &argumentValues) const;
-
-Q_SIGNALS:
- void signalLoadClickToFlash(bool) const;
-
-public Q_SLOTS:
- void setLoadClickToFlash(bool load);
-
-private:
- /**
- When true, force loading of next flash animation (don't show clicktoflash)
- We use signals/slots to set this property because QWebPluginFactory::create is const
- */
- bool _loadClickToFlash;
-};
-
-#endif // WEB_PLUGIN_FACTORY_H
diff --git a/src/websnap.cpp b/src/websnap.cpp
deleted file mode 100644
index 830d37e1..00000000
--- a/src/websnap.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 Nokia Corporation <qt-info@nokia.com>
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "websnap.h"
-#include "websnap.moc"
-
-// KDE Includes
-#include <KStandardDirs>
-
-// Qt Includes
-#include <QSize>
-#include <QFile>
-
-#include <QCryptographicHash>
-
-#include <QPainter>
-#include <QAction>
-
-#include <QWebFrame>
-#include <QWebSettings>
-
-
-WebSnap::WebSnap(const KUrl& url, QObject *parent)
- : QObject(parent)
- , m_url(url)
-{
- // this to not register websnap history
- m_page.settings()->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
-
- // this to not let this page open other windows
- m_page.settings()->setAttribute(QWebSettings::PluginsEnabled, false);
- m_page.settings()->setAttribute(QWebSettings::JavascriptEnabled, false);
-
- connect(&m_page, SIGNAL(loadFinished(bool)), this, SLOT(saveResult(bool)));
-
- QMetaObject::invokeMethod(this, "load", Qt::QueuedConnection);
-}
-
-
-WebSnap::~WebSnap()
-{
- m_page.action(QWebPage::Stop)->trigger();
- m_page.deleteLater();
-}
-
-
-void WebSnap::load()
-{
- m_page.mainFrame()->load(m_url);
-}
-
-
-
-QPixmap WebSnap::render(const QWebPage &page, int w, int h)
-{
- // create the page image
- QPixmap pageImage = QPixmap(w, h);
- pageImage.fill(Qt::transparent);
-
- // render it
- QPainter p(&pageImage);
- page.mainFrame()->render(&p, QWebFrame::ContentsLayer);
- p.end();
-
- return pageImage;
-}
-
-
-// NOTE
-// to render page preview in a safe way, you CANNOT work with scrollbars!
-// In fact, disabling temporarily them DOES NOT work without reloading a page
-// that is something we CANNOT do.
-QPixmap WebSnap::renderPagePreview(const QWebPage &page, int w, int h)
-{
- // store actual viewportsize
- QSize oldSize = page.viewportSize();
-
- // prepare page
- // NOTE: I saw some sites with strange CMS and with absurd content size width (eg: 8584553)
- // This usually leads setViewportSize to crash :(
- // So, ensure renderWidth is no more than 2000.
- int renderWidth = page.mainFrame()->contentsSize().width();
- if (renderWidth > 2000)
- renderWidth = 2000;
- int renderHeight = renderWidth * ((0.0 + h) / w);
-
- page.setViewportSize(QSize(renderWidth, renderHeight));
-
- // consider scrollbars and render the page
- bool verticalScrollBarActive = !page.mainFrame()->scrollBarGeometry(Qt::Vertical).isEmpty();
- if (verticalScrollBarActive)
- renderWidth -= 15;
-
- bool horizontalScrollBarActive = !page.mainFrame()->scrollBarGeometry(Qt::Horizontal).isEmpty();
- if (horizontalScrollBarActive)
- renderHeight -= 15;
-
- QPixmap pageImage = WebSnap::render(page, renderWidth, renderHeight);
-
- // resize image
- pageImage = pageImage.scaled(w, h, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
-
- // restore page state
- page.setViewportSize(oldSize);
-
- return pageImage;
-}
-
-
-QString WebSnap::imagePathFromUrl(const KUrl &url)
-{
- QUrl temp = QUrl(url.url());
- QByteArray name = temp.toEncoded(QUrl::RemoveScheme | QUrl::RemoveUserInfo | QUrl::StripTrailingSlash);
-
- QByteArray hashedName = QCryptographicHash::hash(name, QCryptographicHash::Md5).toHex();
-
- return KStandardDirs::locateLocal("cache", QString("thumbs/") + hashedName + ".png", true);
-}
-
-
-void WebSnap::saveResult(bool ok)
-{
- if (ok)
- {
- QPixmap image = renderPagePreview(m_page, defaultWidth, defaultHeight);
- QString path = imagePathFromUrl(m_url);
- QFile::remove(path);
- image.save(path);
- }
-
- emit snapDone(ok);
-
- this->deleteLater();
-}
-
-
-bool WebSnap::existsImage(const KUrl &u)
-{
- return QFile::exists(imagePathFromUrl(u));
-}
diff --git a/src/websnap.h b/src/websnap.h
deleted file mode 100644
index 3e9111f8..00000000
--- a/src/websnap.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2009 Nokia Corporation <qt-info@nokia.com>
-* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEB_SNAP_H
-#define WEB_SNAP_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KUrl>
-
-// Qt Includes
-#include <QObject>
-#include <QWebPage>
-
-// Forward Declarations
-class QPixmap;
-
-/**
- * This class is used in many classes of rekonq to produce an image
- * based on the site corresponding to the url passed as argument.
- * It also cached the images to not retrieve them every time :)
- *
- * Heavily based on Graphics-Dojo WebSnap example (thanks!)
- *
- * We use this in the following rekonq classes:
- *
- * - TabBar class: to show a tab preview (given a page, you show AND save an image)
- * - PreviewSelector class: to save new favorite selection (given a page, you show AND save an image)
- *
- * - NewTabPage class: to show the favorites page "preview" (given an url, you show AND save an image)
- *
- */
-
-class REKONQ_TESTS_EXPORT WebSnap : public QObject
-{
- Q_OBJECT
-
-public:
- /**
- * Creates a WebSnap object. It will load the url in one WebPage
- * and snap an image from it.
- *
- * @param url the url to load
- * @param parent the object parent
- */
- explicit WebSnap(const KUrl &url, QObject *parent = 0);
-
- ~WebSnap();
-
- /**
- * Snaps a pixmap of size w * h from a page
- *
- * @param page the page to snap
- * @param w the image width
- * @param h the image height
- *
- * @return the pixmap snapped from the page
- */
- static QPixmap renderPagePreview(const QWebPage &page, int w = defaultWidth, int h = defaultHeight);
-
- /**
- * Guess the local path where the image for the url provided
- * should be
- *
- * @param url the url to guess snap path
- *
- * @return the local path of the url snap
- */
- static QString imagePathFromUrl(const KUrl &url);
-
- /**
- * Determines if a snap exists for that url
- *
- */
- static bool existsImage(const KUrl &url);
-
-
-private Q_SLOTS:
- void saveResult(bool ok = true);
- void load();
-
-Q_SIGNALS:
- void snapDone(bool ok);
-
-private:
- // Constants
- static const int defaultWidth = 200;
- static const int defaultHeight = 150;
- QWebPage m_page;
- KUrl m_url;
-
- //render a preview: common part of renderPagePreview() and renderTabPreview()
- static QPixmap render(const QWebPage &page, int w, int h);
-};
-
-#endif // WEB_SNAP_H
diff --git a/src/websslinfo.cpp b/src/websslinfo.cpp
deleted file mode 100644
index adbf64f5..00000000
--- a/src/websslinfo.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the KDE project
-*
-* Copyright (C) 2009-2011 by Dawit Alemayehu <adawit@kde.org>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "websslinfo.h"
-
-// Qt Includes
-#include <QtCore/QVariant>
-
-
-class WebSslInfo::WebSslInfoPrivate
-{
-public:
- WebSslInfoPrivate()
- : usedCipherBits(0), supportedCipherBits(0) {}
-
- QUrl url;
- QString ciphers;
- QString protocol;
- QString certErrors;
- QHostAddress peerAddress;
- QHostAddress parentAddress;
- QList<QSslCertificate> certificateChain;
-
- int usedCipherBits;
- int supportedCipherBits;
-};
-
-WebSslInfo::WebSslInfo()
- : d(new WebSslInfo::WebSslInfoPrivate)
-{
-}
-
-WebSslInfo::WebSslInfo(const WebSslInfo& other)
- : d(new WebSslInfo::WebSslInfoPrivate)
-{
- *this = other;
-}
-
-WebSslInfo::~WebSslInfo()
-{
- delete d;
- d = 0;
-}
-
-bool WebSslInfo::isValid() const
-{
- return (d ? !d->peerAddress.isNull() : false);
-}
-
-QUrl WebSslInfo::url() const
-{
- return (d ? d->url : QUrl());
-}
-
-QHostAddress WebSslInfo::parentAddress() const
-{
- return (d ? d->parentAddress : QHostAddress());
-}
-
-QHostAddress WebSslInfo::peerAddress() const
-{
- return (d ? d->peerAddress : QHostAddress());
-}
-
-QString WebSslInfo::protocol() const
-{
- return (d ? d->protocol : QString());
-}
-
-QString WebSslInfo::ciphers() const
-{
- return (d ? d->ciphers : QString());
-}
-
-QString WebSslInfo::certificateErrors() const
-{
- return (d ? d->certErrors : QString());
-}
-
-int WebSslInfo::supportedChiperBits() const
-{
- return (d ? d->supportedCipherBits : 0);
-}
-
-int WebSslInfo::usedChiperBits() const
-{
- return (d ? d->usedCipherBits : 0);
-}
-
-QList<QSslCertificate> WebSslInfo::certificateChain() const
-{
- return (d ? d->certificateChain : QList<QSslCertificate>());
-}
-
-WebSslInfo& WebSslInfo::operator=(const WebSslInfo & other)
-{
- if (d)
- {
- d->ciphers = other.d->ciphers;
- d->protocol = other.d->protocol;
- d->certErrors = other.d->certErrors;
- d->peerAddress = other.d->peerAddress;
- d->parentAddress = other.d->parentAddress;
- d->certificateChain = other.d->certificateChain;
-
- d->usedCipherBits = other.d->usedCipherBits;
- d->supportedCipherBits = other.d->supportedCipherBits;
- d->url = other.d->url;
- }
-
- return *this;
-}
-
-bool WebSslInfo::saveTo(QMap<QString, QVariant>& data) const
-{
- const bool ok = isValid();
- if (ok)
- {
- data.insert("ssl_in_use", true);
- data.insert("ssl_peer_ip", d->peerAddress.toString());
- data.insert("ssl_parent_ip", d->parentAddress.toString());
- data.insert("ssl_protocol_version", d->protocol);
- data.insert("ssl_cipher", d->ciphers);
- data.insert("ssl_cert_errors", d->certErrors);
- data.insert("ssl_cipher_used_bits", d->usedCipherBits);
- data.insert("ssl_cipher_bits", d->supportedCipherBits);
- QByteArray certChain;
- Q_FOREACH(const QSslCertificate & cert, d->certificateChain)
- certChain += cert.toPem();
- data.insert("ssl_peer_chain", certChain);
- }
-
- return ok;
-}
-
-void WebSslInfo::restoreFrom(const QVariant& value, const QUrl& url)
-{
- if (value.isValid() && value.type() == QVariant::Map)
- {
- QMap<QString, QVariant> metaData = value.toMap();
- if (metaData.value("ssl_in_use", false).toBool())
- {
- setCertificateChain(metaData.value("ssl_peer_chain").toByteArray());
- setPeerAddress(metaData.value("ssl_peer_ip").toString());
- setParentAddress(metaData.value("ssl_parent_ip").toString());
- setProtocol(metaData.value("ssl_protocol_version").toString());
- setCiphers(metaData.value("ssl_cipher").toString());
- setCertificateErrors(metaData.value("ssl_cert_errors").toString());
- setUsedCipherBits(metaData.value("ssl_cipher_used_bits").toString());
- setSupportedCipherBits(metaData.value("ssl_cipher_bits").toString());
- setUrl(url);
- }
- }
-}
-
-void WebSslInfo::setUrl(const QUrl &url)
-{
- if (d)
- d->url = url;
-}
-
-void WebSslInfo::setPeerAddress(const QString& address)
-{
- if (d)
- d->peerAddress = address;
-}
-
-void WebSslInfo::setParentAddress(const QString& address)
-{
- if (d)
- d->parentAddress = address;
-}
-
-void WebSslInfo::setProtocol(const QString& protocol)
-{
- if (d)
- d->protocol = protocol;
-}
-
-void WebSslInfo::setCertificateChain(const QByteArray& chain)
-{
- if (d)
- d->certificateChain = QSslCertificate::fromData(chain);
-}
-
-void WebSslInfo::setCiphers(const QString& ciphers)
-{
- if (d)
- d->ciphers = ciphers;
-}
-
-void WebSslInfo::setUsedCipherBits(const QString& bits)
-{
- if (d)
- d->usedCipherBits = bits.toInt();
-}
-
-void WebSslInfo::setSupportedCipherBits(const QString& bits)
-{
- if (d)
- d->supportedCipherBits = bits.toInt();
-}
-
-void WebSslInfo::setCertificateErrors(const QString& certErrors)
-{
- if (d)
- d->certErrors = certErrors;
-}
diff --git a/src/websslinfo.h b/src/websslinfo.h
deleted file mode 100644
index 6d47b4c8..00000000
--- a/src/websslinfo.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the KDE project
-*
-* Copyright (C) 2009-2011 by Dawit Alemayehu <adawit@kde.org>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEBSSLINFO_H
-#define WEBSSLINFO_H
-
-#include <kdemacros.h>
-
-#include <QtCore/QUrl>
-#include <QtCore/QList>
-#include <QtCore/QString>
-#include <QtNetwork/QHostAddress>
-#include <QtNetwork/QSslCertificate>
-
-
-class WebSslInfo
-{
-public:
- WebSslInfo();
- WebSslInfo(const WebSslInfo&);
- virtual ~WebSslInfo();
-
- bool isValid() const;
- QUrl url() const;
- QHostAddress peerAddress() const;
- QHostAddress parentAddress() const;
- QString ciphers() const;
- QString protocol() const;
- QString certificateErrors() const;
- int supportedChiperBits() const;
- int usedChiperBits() const;
- QList<QSslCertificate> certificateChain() const;
-
- bool saveTo(QMap<QString, QVariant>&) const;
- void restoreFrom(const QVariant &, const QUrl& = QUrl());
-
- void setUrl(const QUrl &url);
- WebSslInfo& operator = (const WebSslInfo&);
-
-protected:
- void setCiphers(const QString& ciphers);
- void setProtocol(const QString& protocol);
- void setPeerAddress(const QString& address);
- void setParentAddress(const QString& address);
- void setCertificateChain(const QByteArray& chain);
- void setCertificateErrors(const QString& certErrors);
- void setUsedCipherBits(const QString& bits);
- void setSupportedCipherBits(const QString& bits);
-
-private:
- class WebSslInfoPrivate;
- WebSslInfoPrivate* d;
-};
-
-#endif // WEBSSLINFO_H
diff --git a/src/webtab.cpp b/src/webtab.cpp
deleted file mode 100644
index 457e9006..00000000
--- a/src/webtab.cpp
+++ /dev/null
@@ -1,419 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "webtab.h"
-#include "webtab.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "historymanager.h"
-#include "messagebar.h"
-#include "opensearchmanager.h"
-#include "previewselectorbar.h"
-#include "rsswidget.h"
-#include "searchenginebar.h"
-#include "sessionmanager.h"
-#include "syncmanager.h"
-#include "urlbar.h"
-#include "walletbar.h"
-#include "webpage.h"
-#include "websnap.h"
-#include "webshortcutwidget.h"
-
-// KDE Includes
-#include <KWebWallet>
-#include <KStandardShortcut>
-#include <KMenu>
-#include <KActionMenu>
-#include <KWebView>
-#include <KDebug>
-#include <KBuildSycocaProgressDialog>
-
-// Qt Includes
-#include <QVBoxLayout>
-
-
-WebTab::WebTab(QWidget *parent)
- : QWidget(parent)
- , m_webView(0)
- , m_urlBar(new UrlBar(this))
- , m_progress(0)
- , m_part(0)
-{
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-
- QVBoxLayout *l = new QVBoxLayout(this);
- l->setMargin(0);
- l->setSpacing(0);
-
- l->addWidget(view());
- view()->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-
- // fix focus handling
- setFocusProxy(view());
-
- KWebWallet *wallet = page()->wallet();
-
- if (wallet)
- {
- connect(wallet, SIGNAL(saveFormDataRequested(QString, QUrl)),
- this, SLOT(createWalletBar(QString, QUrl)));
- }
-
- connect(view(), SIGNAL(loadProgress(int)), this, SLOT(updateProgress(int)));
- connect(view(), SIGNAL(loadStarted()), this, SLOT(resetProgress()));
- connect(view(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
- connect(view(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished()));
-
- // Session Manager
- connect(view(), SIGNAL(loadFinished(bool)), rApp->sessionManager(), SLOT(saveSession()));
-}
-
-
-WebTab::~WebTab()
-{
- m_walletBar.clear();
- m_previewSelectorBar.clear();
-
- // NOTE:
- // Urlbar is reparented when inserted in StackedUrlBar, so we need
- // to get sure it will be deleted. Deleting it later to ensure everything
- // will be finished before ;)
- m_urlBar->deleteLater();
-
- // Get sure m_part will be deleted
- delete m_part;
-}
-
-
-WebView *WebTab::view()
-{
- if (!m_webView)
- {
- m_webView = new WebView(this);
- }
- return m_webView;
-}
-
-
-WebPage *WebTab::page()
-{
- if (view())
- return view()->page();
-
- return 0;
-}
-
-
-KUrl WebTab::url()
-{
- if (page() && page()->isOnRekonqPage())
- {
- return page()->loadingUrl();
- }
-
- if (view())
- return view()->url();
-
- kDebug() << "OOPS... NO web classes survived! Returning an empty url...";
- return KUrl();
-}
-
-
-void WebTab::updateProgress(int p)
-{
- m_progress = p;
- emit loadProgressing();
-}
-
-
-void WebTab::resetProgress()
-{
- m_progress = 1;
-}
-
-
-bool WebTab::isPageLoading()
-{
- return m_progress != 0 && m_progress != 100;
-}
-
-
-void WebTab::createWalletBar(const QString &key, const QUrl &url)
-{
- // check if the url is in the wallet blacklist
- QString urlString = url.toString();
- QStringList blackList = ReKonfig::walletBlackList();
- if (blackList.contains(urlString))
- return;
-
- KWebWallet *wallet = page()->wallet();
-
- if (!ReKonfig::passwordSavingEnabled())
- {
- wallet->rejectSaveFormDataRequest(key);
- return;
- }
-
- if (m_walletBar.isNull())
- {
- m_walletBar = new WalletBar(this);
- m_walletBar.data()->onSaveFormData(key, url);
- qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, m_walletBar.data());
- m_walletBar.data()->animatedShow();
- }
- else
- {
- disconnect(wallet);
- qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, m_walletBar.data());
- m_walletBar.data()->animatedShow();
- }
-
- connect(m_walletBar.data(), SIGNAL(saveFormDataAccepted(QString)),
- wallet, SLOT(acceptSaveFormDataRequest(QString)), Qt::UniqueConnection);
- connect(m_walletBar.data(), SIGNAL(saveFormDataRejected(QString)),
- wallet, SLOT(rejectSaveFormDataRequest(QString)), Qt::UniqueConnection);
-
- // sync passwords
- connect(m_walletBar.data(), SIGNAL(saveFormDataAccepted(QString)),
- rApp->syncManager(), SLOT(syncPasswords()), Qt::UniqueConnection);
-}
-
-
-void WebTab::createPreviewSelectorBar(int index)
-{
- if (m_previewSelectorBar.isNull())
- {
- m_previewSelectorBar = new PreviewSelectorBar(index, this);
- qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, m_previewSelectorBar.data());
- m_previewSelectorBar.data()->animatedShow();
- }
- else
- {
- disconnect(m_previewSelectorBar.data());
- m_previewSelectorBar.data()->setIndex(index);
- m_previewSelectorBar.data()->animatedHide();
- }
-
- connect(page(), SIGNAL(loadStarted()), m_previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection);
- connect(page(), SIGNAL(loadProgress(int)), m_previewSelectorBar.data(), SLOT(loadProgress()), Qt::UniqueConnection);
- connect(page(), SIGNAL(loadFinished(bool)), m_previewSelectorBar.data(), SLOT(loadFinished()), Qt::UniqueConnection);
- connect(page()->mainFrame(), SIGNAL(urlChanged(QUrl)), m_previewSelectorBar.data(), SLOT(verifyUrl()), Qt::UniqueConnection);
-}
-
-
-bool WebTab::hasRSSInfo()
-{
- QWebElementCollection col = page()->mainFrame()->findAllElements("link[type=\"application/rss+xml\"]");
- col.append(page()->mainFrame()->findAllElements("link[type=\"application/atom+xml\"]"));
- if (col.count() != 0)
- return true;
-
- return false;
-}
-
-
-void WebTab::showRSSInfo(const QPoint &pos)
-{
- QWebElementCollection col = page()->mainFrame()->findAllElements("link[type=\"application/rss+xml\"]");
- col.append(page()->mainFrame()->findAllElements("link[type=\"application/atom+xml\"]"));
-
- QMap<KUrl, QString> map;
-
- Q_FOREACH(const QWebElement & el, col)
- {
- QString urlString;
- if (el.attribute("href").startsWith(QL1S("http")))
- urlString = el.attribute("href");
- else
- {
- KUrl u = url();
- // NOTE
- // cd() is probably better than setPath() here,
- // for all those url sites just having a path
- if (u.cd(el.attribute("href")))
- urlString = u.toMimeDataString();
- }
-
- QString title = el.attribute("title");
- if (title.isEmpty())
- title = el.attribute("href");
-
- map.insert(KUrl(urlString), title);
- }
-
- RSSWidget *widget = new RSSWidget(map, window());
- widget->showAt(pos);
-}
-
-
-void WebTab::hideSelectorBar()
-{
- m_previewSelectorBar.data()->animatedHide();
-}
-
-
-void WebTab::setPart(KParts::ReadOnlyPart *p, const KUrl &u)
-{
- if (p)
- {
- // Ok, part exists. Insert & show it..
- m_part = p;
- qobject_cast<QVBoxLayout *>(layout())->insertWidget(1, p->widget());
- p->openUrl(u);
- m_webView->hide();
-
- emit titleChanged(u.url());
- return;
- }
-
- if (!m_part)
- return;
-
- // Part NO more exists. Let's clean up from webtab
- m_webView->show();
- qobject_cast<QVBoxLayout *>(layout())->removeWidget(m_part->widget());
- delete m_part;
- m_part = 0;
-}
-
-
-KUrl WebTab::extractOpensearchUrl(QWebElement e)
-{
- QString href = e.attribute(QL1S("href"));
- KUrl url = KUrl(href);
- if (!href.contains(":"))
- {
- KUrl docUrl = m_webView->url();
- QString host = docUrl.scheme() + "://" + docUrl.host();
- if (docUrl.port() != -1)
- {
- host += QL1C(':') + QString::number(docUrl.port());
- }
- url = KUrl(docUrl, href);
- }
- return url;
-}
-
-
-bool WebTab::hasNewSearchEngine()
-{
- QWebElement e = page()->mainFrame()->findFirstElement(QL1S("head >link[rel=\"search\"][ type=\"application/opensearchdescription+xml\"]"));
- return !e.isNull() && !rApp->opensearchManager()->engineExists(extractOpensearchUrl(e));
-}
-
-
-void WebTab::showSearchEngine(const QPoint &pos)
-{
- QWebElement e = page()->mainFrame()->findFirstElement(QL1S("head >link[rel=\"search\"][ type=\"application/opensearchdescription+xml\"]"));
- QString title = e.attribute(QL1S("title"));
- if (!title.isEmpty())
- {
- WebShortcutWidget *widget = new WebShortcutWidget(window());
- widget->setWindowFlags(Qt::Popup);
-
- connect(widget, SIGNAL(webShortcutSet(KUrl, QString, QString)),
- rApp->opensearchManager(), SLOT(addOpenSearchEngine(KUrl, QString, QString)));
- connect(rApp->opensearchManager(), SIGNAL(openSearchEngineAdded(QString)),
- this, SLOT(openSearchEngineAdded()));
-
- widget->show(extractOpensearchUrl(e), title, pos);
- }
-}
-
-
-void WebTab::openSearchEngineAdded()
-{
- // If the providers changed, tell sycoca to rebuild its database...
- KBuildSycocaProgressDialog::rebuildKSycoca(this);
-
- disconnect(rApp->opensearchManager(), SIGNAL(openSearchEngineAdded(QString, QString, QString)),
- this, SLOT(openSearchEngineAdded()));
-}
-
-
-void WebTab::showMessageBar()
-{
- MessageBar *msgBar = new MessageBar(i18n("It seems rekonq was not closed properly. Do you want "
- "to restore the last saved session?"), this);
-
- qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, msgBar);
- msgBar->animatedShow();
-
- connect(msgBar, SIGNAL(accepted()), rApp->sessionManager(), SLOT(restoreCrashedSession()));
-}
-
-
-bool WebTab::hasAdBlockedElements()
-{
- return page()->hasAdBlockedElements();
-}
-
-
-QPixmap WebTab::tabPreview(int width, int height)
-{
- if (isPageLoading())
- {
- // no previews during load
- return QPixmap();
- }
-
- if (!part())
- {
- return WebSnap::renderPagePreview(*page(), width, height);
- }
- else
- {
- QWidget *partWidget = part()->widget();
- QPixmap partThumb(partWidget->size());
-
- partWidget->render(&partThumb);
-
- return partThumb.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
- }
-}
-
-
-void WebTab::loadFinished()
-{
- // add page to history
- QString pageTitle = (page() && page()->isOnRekonqPage()) ? url().url() : m_webView->title();
- rApp->historyManager()->addHistoryEntry(url(), pageTitle);
-}
-
-
-void WebTab::showSearchEngineBar()
-{
- SearchEngineBar *seBar = new SearchEngineBar(this);
-
- qobject_cast<QVBoxLayout *>(layout())->insertWidget(0, seBar);
- seBar->animatedShow();
-}
diff --git a/src/webtab.h b/src/webtab.h
deleted file mode 100644
index 39c23fb9..00000000
--- a/src/webtab.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEBTAB_H
-#define WEBTAB_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Local Includes
-#include "webview.h"
-
-// KDE Includes
-#include <KParts/Part>
-
-// Qt Includes
-#include <QWidget>
-
-// Forward Declarations
-class NotificationBar;
-class PreviewSelectorBar;
-class QPoint;
-class UrlBar;
-class WalletBar;
-class WebPage;
-
-
-class REKONQ_TESTS_EXPORT WebTab : public QWidget
-{
- Q_OBJECT
-
-public:
- explicit WebTab(QWidget *parent = 0);
- ~WebTab();
-
- WebView *view();
- WebPage *page();
-
- inline UrlBar *urlBar() const
- {
- return m_urlBar;
- }
-
- inline int progress() const
- {
- return m_progress;
- }
-
- KUrl url();
-
- void createPreviewSelectorBar(int index);
-
- void hideSelectorBar();
-
- bool hasRSSInfo();
-
- bool isPageLoading();
-
- bool hasNewSearchEngine();
-
- KParts::ReadOnlyPart *part()
- {
- return m_part;
- }
-
- void setPart(KParts::ReadOnlyPart *p, const KUrl &u);
-
- bool hasAdBlockedElements();
-
- QPixmap tabPreview(int width, int height);
-
-private Q_SLOTS:
- void updateProgress(int progress);
- void resetProgress();
-
- void createWalletBar(const QString &, const QUrl &);
- void showRSSInfo(const QPoint &pos);
- void showSearchEngine(const QPoint &pos);
- void openSearchEngineAdded();
-
- void showMessageBar();
- void loadFinished();
-
- void showSearchEngineBar();
-
-private:
- KUrl extractOpensearchUrl(QWebElement e);
-
-Q_SIGNALS:
- void loadProgressing();
- void titleChanged(const QString &);
-
-private:
- WebView *m_webView;
-
- UrlBar *m_urlBar;
-
- int m_progress;
-
- QWeakPointer<WalletBar> m_walletBar;
- QWeakPointer<PreviewSelectorBar> m_previewSelectorBar;
-
- KParts::ReadOnlyPart *m_part;
-};
-
-#endif
diff --git a/src/webview.cpp b/src/webview.cpp
deleted file mode 100644
index 50dad074..00000000
--- a/src/webview.cpp
+++ /dev/null
@@ -1,1463 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "webview.h"
-#include "webview.moc"
-
-// Auto Includes
-#include "rekonq.h"
-
-// Local Includes
-#include "application.h"
-#include "adblockmanager.h"
-#include "bookmarkmanager.h"
-#include "iconmanager.h"
-#include "mainview.h"
-#include "mainwindow.h"
-#include "searchengine.h"
-#include "urlbar.h"
-#include "webpage.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KAction>
-#include <KActionMenu>
-#include <KLocalizedString>
-#include <KMenu>
-#include <KStandardAction>
-#include <KStandardDirs>
-#include <KToolInvocation>
-
-// Qt Includes
-#include <QFile>
-#include <QTimer>
-
-#include <QClipboard>
-#include <QContextMenuEvent>
-#include <QLabel>
-
-#include <QWebFrame>
-#include <QWebHistory>
-#include <QNetworkRequest>
-#include <sonnet/speller.h>
-#include <Sonnet/Dialog>
-#include <sonnet/backgroundchecker.h>
-
-WebView::WebView(QWidget* parent)
- : KWebView(parent, false)
- , m_page(0)
- , m_autoScrollTimer(new QTimer(this))
- , m_verticalAutoScrollSpeed(0)
- , m_horizontalAutoScrollSpeed(0)
- , m_isViewAutoScrolling(false)
- , m_autoScrollIndicator(QPixmap(KStandardDirs::locate("appdata" , "pics/autoscroll.png")))
- , m_smoothScrollTimer(new QTimer(this))
- , m_dy(0)
- , m_smoothScrollSteps(0)
- , m_isViewSmoothScrolling(false)
- , m_accessKeysPressed(false)
- , m_accessKeysActive(false)
-{
- // loadUrl signal
- connect(this, SIGNAL(loadUrl(KUrl, Rekonq::OpenType)), rApp, SLOT(loadUrl(KUrl, Rekonq::OpenType)));
-
- // Auto scroll timer
- connect(m_autoScrollTimer, SIGNAL(timeout()), this, SLOT(scrollFrameChanged()));
- m_autoScrollTimer->setInterval(100);
-
- // Smooth scroll timer
- connect(m_smoothScrollTimer, SIGNAL(timeout()), this, SLOT(scrollTick()));
- m_smoothScrollTimer->setInterval(16);
-
- connect(this, SIGNAL(iconChanged()), this, SLOT(changeWindowIcon()));
- connect(this, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
-}
-
-
-WebView::~WebView()
-{
- if (m_isViewSmoothScrolling)
- stopSmoothScrolling();
-}
-
-
-void WebView::load(const QUrl &url)
-{
- load(QNetworkRequest(url));
-}
-
-
-void WebView::load(const QNetworkRequest &req, QNetworkAccessManager::Operation op, const QByteArray &body)
-{
- QNetworkRequest request = req;
- const QUrl &reqUrl = request.url();
- if (reqUrl.host() == url().host())
- {
- request.setRawHeader(QByteArray("Referer"), url().toEncoded());
- }
-
- KWebView::load(request, op, body);
-}
-
-
-void WebView::loadStarted()
-{
- hideAccessKeys();
-}
-
-
-void WebView::changeWindowIcon()
-{
- if (ReKonfig::useFavicon())
- {
- MainWindow *const mainWindow = rApp->mainWindow();
- if (url() == mainWindow->currentTab()->url())
- {
- const int index = mainWindow->mainView()->currentIndex();
- mainWindow->changeWindowIcon(index);
- }
- }
-}
-
-
-WebPage *WebView::page()
-{
- if (!m_page)
- {
- m_page = new WebPage(this);
- setPage(m_page);
- }
- return m_page;
-}
-
-bool WebView::popupSpellMenu(QContextMenuEvent *event)
-{
- // return false if not handled
- if (! ReKonfig::automaticSpellChecking())
- return false;
-
- QWebElement element(m_ContextMenuResult.element());
- if (element.isNull())
- return false;
-
- int selStart = element.evaluateJavaScript("this.selectionStart").toInt();
- int selEnd = element.evaluateJavaScript("this.selectionEnd").toInt();
- if (selEnd != selStart)
- return false; // selection, handle normally
-
- // No selection - Spell Checking only
- // Get word
- QString text = element.evaluateJavaScript("this.value").toString();
- QRegExp ws("\\b");
- int s1 = text.lastIndexOf(ws, selStart);
- int s2 = text.indexOf(ws, selStart);
- QString word = text.mid(s1, s2 - s1).trimmed();
-
- // sanity check
- if (word.isEmpty())
- return false;
-
- kDebug() << s1 << ":" << s2 << ":" << word << ":";
- Sonnet::Speller spellor;
- if (spellor.isCorrect(word))
- return false; // no need to popup spell menu
-
-
- // find alternates
- QStringList words = spellor.suggest(word);
-
- // Construct popup menu
- QMenu mnu(this);
-
- // Add alternates
- if (words.isEmpty())
- {
- QAction *a = mnu.addAction(i18n("No suggestions for %1", word));
- a->setEnabled(false);
- }
- else
- {
- QStringListIterator it(words);
- while (it.hasNext())
- {
- QString w = it.next();
- QAction *aWord = mnu.addAction(w);
- aWord->setData(w);
- }
- }
- // Add dictionary options
- mnu.addSeparator();
- QAction *aIgnore = mnu.addAction(i18n("Ignore"));
- QAction *aAddToDict = mnu.addAction(i18n("Add to Dictionary"));
-
- QAction *aSpellChoice = mnu.exec(event->globalPos());
- if (aSpellChoice)
- {
- if (aSpellChoice == aAddToDict)
- spellor.addToPersonal(word);
- else if (aSpellChoice == aIgnore)
- {
- // Ignore :)
- }
- else
- {
- // Choose a replacement word
- QString w = aSpellChoice->data().toString();
- if (! w.isEmpty())
- {
- // replace word
- QString script(QL1S("this.value=this.value.substring(0,"));
- script += QString::number(s1);
- script += QL1S(") + \"");
- script += w;
- script += QL1S("\" + this.value.substring(");
- script += QString::number(s2);
- script += QL1S(")");
- element.evaluateJavaScript(script);
- // reposition cursor
- element.evaluateJavaScript("this.selectionEnd=this.selectionStart=" + QString::number(selStart) + ";");
- }
- }
- }
-
- return true;
-}
-
-void WebView::contextMenuEvent(QContextMenuEvent *event)
-{
- m_ContextMenuResult = page()->mainFrame()->hitTestContent(event->pos());
- MainWindow *mainwindow = rApp->mainWindow();
-
- if (m_ContextMenuResult.isContentEditable())
- {
- // Check to see if handled by speller
- if (popupSpellMenu(event))
- return;
- }
-
- KMenu menu(this);
-
- KAction *inspectAction = new KAction(KIcon("layer-visible-on"), i18n("Inspect Element"), &menu);
- connect(inspectAction, SIGNAL(triggered(bool)), this, SLOT(inspect()));
-
- KAction *sendByMailAction = new KAction(&menu);
- sendByMailAction->setIcon(KIcon("mail-send"));
- connect(sendByMailAction, SIGNAL(triggered(bool)), this, SLOT(sendByMail()));
-
- // Choose right context
- int resultHit = 0;
- if (m_ContextMenuResult.linkUrl().isEmpty())
- resultHit = WebView::EmptySelection;
- else
- resultHit = WebView::LinkSelection;
-
- if (!m_ContextMenuResult.pixmap().isNull())
- resultHit |= WebView::ImageSelection;
-
- if (m_ContextMenuResult.isContentSelected())
- resultHit = WebView::TextSelection;
-
- // --------------------------------------------------------------------------------
- // Ok, let's start filling up the menu...
-
- // is content editable? Add PASTE
- if (m_ContextMenuResult.isContentEditable())
- {
- menu.addAction(pageAction(KWebPage::Paste));
- menu.addSeparator();
- }
-
- QAction *a;
- // EMPTY PAGE ACTIONS -------------------------------------------------------------
- if (resultHit == WebView::EmptySelection)
- {
- // send by mail: page url
- sendByMailAction->setData(page()->currentFrame()->url());
- sendByMailAction->setText(i18n("Share page url"));
-
- // navigation
- QWebHistory *history = page()->history();
- if (history->canGoBack())
- {
- menu.addAction(pageAction(KWebPage::Back));
- }
-
- if (history->canGoForward())
- {
- menu.addAction(pageAction(KWebPage::Forward));
- }
-
- menu.addAction(mainwindow->actionByName("view_redisplay"));
-
- menu.addSeparator();
-
- //Frame
- KActionMenu *frameMenu = new KActionMenu(i18n("Current Frame"), &menu);
- frameMenu->addAction(pageAction(KWebPage::OpenFrameInNewWindow));
-
- a = new KAction(KIcon("document-print-frame"), i18n("Print Frame"), &menu);
- connect(a, SIGNAL(triggered()), this, SLOT(printFrame()));
- frameMenu->addAction(a);
-
- menu.addAction(frameMenu);
-
- menu.addSeparator();
-
- // Page Actions
- menu.addAction(pageAction(KWebPage::SelectAll));
-
- menu.addAction(mainwindow->actionByName(KStandardAction::name(KStandardAction::SaveAs)));
-
- if (!KStandardDirs::findExe("kget").isNull() && ReKonfig::kgetList())
- {
- a = new KAction(KIcon("kget"), i18n("List All Links"), &menu);
- connect(a, SIGNAL(triggered(bool)), page(), SLOT(downloadAllContentsWithKGet()));
- menu.addAction(a);
- }
-
- menu.addAction(mainwindow->actionByName("page_source"));
- menu.addAction(inspectAction);
-
- if (mainwindow->isFullScreen())
- {
- menu.addSeparator();
- menu.addAction(mainwindow->actionByName("fullscreen"));
- }
- }
-
- // LINK ACTIONS -------------------------------------------------------------------
- if (resultHit & WebView::LinkSelection)
- {
- // send by mail: link url
- sendByMailAction->setData(m_ContextMenuResult.linkUrl());
- sendByMailAction->setText(i18n("Share link"));
-
- a = new KAction(KIcon("tab-new"), i18n("Open in New &Tab"), &menu);
- a->setData(m_ContextMenuResult.linkUrl());
- connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab()));
- menu.addAction(a);
-
- a = new KAction(KIcon("window-new"), i18n("Open in New &Window"), &menu);
- a->setData(m_ContextMenuResult.linkUrl());
- connect(a, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow()));
- menu.addAction(a);
-
- menu.addSeparator();
-
- // Don't show dots if we are NOT going to ask for download path
- a = pageAction(KWebPage::DownloadLinkToDisk);
- if (ReKonfig::askDownloadPath())
- a->setText(i18n("Save Link..."));
- else
- a->setText(i18n("Save Link"));
-
- menu.addAction(a);
- menu.addAction(pageAction(KWebPage::CopyLinkToClipboard));
- }
-
- // IMAGE ACTIONS ------------------------------------------------------------------
- if (resultHit & WebView::ImageSelection)
- {
- // send by mail: image url
- sendByMailAction->setData(m_ContextMenuResult.imageUrl());
- sendByMailAction->setText(i18n("Share image link"));
-
- menu.addSeparator();
-
- a = new KAction(KIcon("view-preview"), i18n("&View Image"), &menu);
- a->setData(m_ContextMenuResult.imageUrl());
- connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)),
- this, SLOT(viewImage(Qt::MouseButtons, Qt::KeyboardModifiers)));
- menu.addAction(a);
-
- menu.addAction(pageAction(KWebPage::DownloadImageToDisk));
-
- a = new KAction(KIcon("view-media-visualization"), i18n("&Copy Image Location"), &menu);
- a->setData(m_ContextMenuResult.imageUrl());
- connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(slotCopyImageLocation()));
- menu.addAction(a);
-
- if (rApp->adblockManager()->isEnabled())
- {
- a = new KAction(KIcon("preferences-web-browser-adblock"), i18n("Block image"), &menu);
- a->setData(m_ContextMenuResult.imageUrl());
- connect(a, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)), this, SLOT(blockImage()));
- menu.addAction(a);
- }
- }
-
- // ACTIONS FOR TEXT SELECTION -----------------------------------------------------
- if (resultHit & WebView::TextSelection)
- {
- // send by mail: text
- sendByMailAction->setData(selectedText());
- sendByMailAction->setText(i18n("Share selected text"));
-
- if (m_ContextMenuResult.isContentEditable())
- {
- // actions for text selected in field
- menu.addAction(pageAction(KWebPage::Cut));
- }
-
- a = pageAction(KWebPage::Copy);
- if (!m_ContextMenuResult.linkUrl().isEmpty())
- a->setText(i18n("Copy Text")); //for link
- else
- a->setText(i18n("Copy"));
- menu.addAction(a);
-
- if (selectedText().contains('.') && selectedText().indexOf('.') < selectedText().length()
- && !selectedText().trimmed().contains(" ")
- )
- {
- QString text = selectedText();
- text = text.trimmed();
- KUrl urlLikeText(text);
- if (urlLikeText.isValid())
- {
- QString truncatedUrl = text;
- const int maxTextSize = 18;
- if (truncatedUrl.length() > maxTextSize)
- {
- const int truncateSize = 15;
- truncatedUrl.truncate(truncateSize);
- truncatedUrl += QL1S("...");
- }
- //open selected text url in a new tab
- QAction * const openInNewTabAction = new KAction(KIcon("tab-new"), i18n("Open '%1' in New Tab", truncatedUrl), &menu);
- openInNewTabAction->setData(QUrl(urlLikeText));
- connect(openInNewTabAction, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewTab()));
- menu.addAction(openInNewTabAction);
- //open selected text url in a new window
- QAction * const openInNewWindowAction = new KAction(KIcon("window-new"), i18n("Open '%1' in New Window", truncatedUrl), &menu);
- openInNewWindowAction->setData(QUrl(urlLikeText));
- connect(openInNewWindowAction, SIGNAL(triggered(bool)), this, SLOT(openLinkInNewWindow()));
- menu.addAction(openInNewWindowAction);
- menu.addSeparator();
- }
- }
-
- //Default SearchEngine
- KService::Ptr defaultEngine = SearchEngine::defaultEngine();
- if (defaultEngine) // check if a default engine is set
- {
- a = new KAction(i18nc("Search selected text with the default search engine", "Search with %1", defaultEngine->name()), &menu);
- a->setIcon(rApp->iconManager()->iconForUrl(SearchEngine::buildQuery(defaultEngine, "")));
- a->setData(defaultEngine->entryPath());
- connect(a, SIGNAL(triggered(bool)), this, SLOT(search()));
- menu.addAction(a);
- }
-
- //All favourite ones
- KActionMenu *searchMenu = new KActionMenu(KIcon("edit-find"), i18nc("@title:menu", "Search"), &menu);
-
- Q_FOREACH(const KService::Ptr & engine, SearchEngine::favorites())
- {
- a = new KAction(i18nc("@item:inmenu Search, %1 = search engine", "With %1", engine->name()), &menu);
- a->setIcon(rApp->iconManager()->iconForUrl(SearchEngine::buildQuery(engine, "")));
- a->setData(engine->entryPath());
- connect(a, SIGNAL(triggered(bool)), this, SLOT(search()));
- searchMenu->addAction(a);
- }
-
- a = new KAction(KIcon("edit-find"), i18n("On Current Page"), &menu);
- connect(a, SIGNAL(triggered()), rApp->mainWindow(), SLOT(findSelectedText()));
- searchMenu->addAction(a);
-
- if (!searchMenu->menu()->isEmpty())
- {
- menu.addAction(searchMenu);
- }
- }
-
- // DEFAULT ACTIONs (on the bottom) ------------------------------------------------
- menu.addSeparator();
- if (resultHit & WebView::LinkSelection)
- {
- a = new KAction(KIcon("bookmark-new"), i18n("&Bookmark link"), &menu);
- a->setData(m_ContextMenuResult.linkUrl());
- connect(a, SIGNAL(triggered(bool)), this, SLOT(bookmarkLink()));
- menu.addAction(a);
- }
- else
- {
- a = mainwindow->actionByName(KStandardAction::name(KStandardAction::AddBookmark));
- menu.addAction(a);
- }
- menu.addAction(sendByMailAction);
- menu.addAction(inspectAction);
-
- // SPELL CHECK Actions
- if (m_ContextMenuResult.isContentEditable())
- {
- menu.addSeparator();
- a = KStandardAction::spelling(this, SLOT(spellCheck()), &menu);
- menu.addAction(a);
- }
-
- // finally launch the menu...
- menu.exec(mapToGlobal(event->pos()));
-}
-
-
-void WebView::mousePressEvent(QMouseEvent *event)
-{
- if (m_isViewAutoScrolling)
- {
- m_verticalAutoScrollSpeed = 0;
- m_horizontalAutoScrollSpeed = 0;
- m_autoScrollTimer->stop();
- m_isViewAutoScrolling = false;
- update();
- return;
- }
-
- QWebHitTestResult result = page()->mainFrame()->hitTestContent(event->pos());
- bool weCanDoMiddleClickActions = !result.isContentEditable() && result.linkUrl().isEmpty();
-
- switch (event->button())
- {
- case Qt::XButton1:
- triggerPageAction(KWebPage::Back);
- break;
-
- case Qt::XButton2:
- triggerPageAction(KWebPage::Forward);
- break;
-
- case Qt::MidButton:
- switch (ReKonfig::middleClickAction())
- {
- case 0: // AutoScroll
- if (weCanDoMiddleClickActions
- && !m_isViewAutoScrolling
- && !page()->currentFrame()->scrollBarGeometry(Qt::Horizontal).contains(event->pos())
- && !page()->currentFrame()->scrollBarGeometry(Qt::Vertical).contains(event->pos()))
- {
- if (!page()->currentFrame()->scrollBarGeometry(Qt::Horizontal).isNull()
- || !page()->currentFrame()->scrollBarGeometry(Qt::Vertical).isNull())
- {
- m_clickPos = event->pos();
- m_isViewAutoScrolling = true;
- update();
- }
- }
- break;
-
- case 1: // Load Clipboard URL
- if (weCanDoMiddleClickActions)
- {
- const QString clipboardContent = rApp->clipboard()->text();
-
- if (clipboardContent.isEmpty())
- break;
-
- if (QUrl::fromUserInput(clipboardContent).isValid())
- loadUrl(clipboardContent, Rekonq::CurrentTab);
- else // Search with default Engine
- {
- KService::Ptr defaultEngine = SearchEngine::defaultEngine();
- if (defaultEngine) // check if a default engine is set
- loadUrl(KUrl(SearchEngine::buildQuery(defaultEngine, clipboardContent)), Rekonq::CurrentTab);
- }
- }
- break;
-
- default: // Do Nothing
- break;
- }
- break;
-
- default:
- break;
- };
-
- KWebView::mousePressEvent(event);
-}
-
-
-void WebView::mouseMoveEvent(QMouseEvent *event)
-{
- QPoint mousePos = event->pos();
-
- if (m_isViewAutoScrolling)
- {
- QPoint r = mousePos - m_clickPos;
- m_horizontalAutoScrollSpeed = r.x() / 2; // you are too fast..
- m_verticalAutoScrollSpeed = r.y() / 2;
- if (!m_autoScrollTimer->isActive())
- m_autoScrollTimer->start();
-
- return;
- }
-
- MainWindow *w = rApp->mainWindow();
- if (w->isFullScreen())
- {
- if (event->pos().y() >= 0 && event->pos().y() <= 4)
- {
- w->setWidgetsVisible(true);
- }
- else
- {
- if (!w->mainView()->currentUrlBar()->hasFocus())
- w->setWidgetsVisible(false);
- }
- }
- KWebView::mouseMoveEvent(event);
-}
-
-
-void WebView::dropEvent(QDropEvent *event)
-{
- bool isEditable = page()->frameAt(event->pos())->hitTestContent(event->pos()).isContentEditable();
- if (event->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type()))
- {
- QByteArray addresses = event->mimeData()->data(BookmarkManager::bookmark_mime_type());
- KBookmark bookmark = rApp->bookmarkManager()->findByAddress(QString::fromLatin1(addresses.data()));
- if (bookmark.isGroup())
- {
- rApp->bookmarkManager()->openFolderinTabs(bookmark.toGroup());
- }
- else
- {
- emit loadUrl(bookmark.url(), Rekonq::CurrentTab);
- }
- }
- else if (event->mimeData()->hasUrls() && event->source() != this && !isEditable) //dropped links
- {
- Q_FOREACH(const QUrl & url, event->mimeData()->urls())
- {
- emit loadUrl(url, Rekonq::NewFocusedTab);
- }
- }
- else if (event->mimeData()->hasFormat("text/plain") && event->source() != this && !isEditable) //dropped plain text with url format
- {
- QUrl url = QUrl::fromUserInput(event->mimeData()->data("text/plain"));
-
- if (url.isValid())
- emit loadUrl(url, Rekonq::NewFocusedTab);
- }
- else
- {
- KWebView::dropEvent(event);
- }
-}
-
-
-void WebView::paintEvent(QPaintEvent* event)
-{
- KWebView::paintEvent(event);
-
- if (m_isViewAutoScrolling)
- {
- QPoint centeredPoint = m_clickPos;
- centeredPoint.setX(centeredPoint.x() - m_autoScrollIndicator.width() / 2);
- centeredPoint.setY(centeredPoint.y() - m_autoScrollIndicator.height() / 2);
-
- QPainter painter(this);
- painter.setOpacity(0.8);
- painter.drawPixmap(centeredPoint, m_autoScrollIndicator);
- }
-}
-
-
-void WebView::search()
-{
- KAction *a = qobject_cast<KAction*>(sender());
- KService::Ptr engine = KService::serviceByDesktopPath(a->data().toString());
- KUrl urlSearch = KUrl(SearchEngine::buildQuery(engine, selectedText()));
-
- emit loadUrl(urlSearch, Rekonq::NewTab);
-}
-
-
-void WebView::printFrame()
-{
- rApp->mainWindow()->printRequested(page()->currentFrame());
-}
-
-
-void WebView::viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers)
-{
- KAction *a = qobject_cast<KAction*>(sender());
- KUrl url(a->data().toUrl());
-
- if (modifiers & Qt::ControlModifier || buttons == Qt::MidButton)
- {
- emit loadUrl(url, Rekonq::NewTab);
- }
- else
- {
- emit loadUrl(url, Rekonq::CurrentTab);
- }
-}
-
-
-void WebView::slotCopyImageLocation()
-{
- KAction *a = qobject_cast<KAction*>(sender());
- KUrl imageUrl(a->data().toUrl());
-#ifndef QT_NO_MIMECLIPBOARD
- // Set it in both the mouse selection and in the clipboard
- QMimeData* mimeData = new QMimeData;
- imageUrl.populateMimeData(mimeData);
- QApplication::clipboard()->setMimeData(mimeData, QClipboard::Clipboard);
- mimeData = new QMimeData;
- imageUrl.populateMimeData(mimeData);
- QApplication::clipboard()->setMimeData(mimeData, QClipboard::Selection);
-#else
- QApplication::clipboard()->setText(imageUrl.url());
-#endif
-}
-
-
-void WebView::openLinkInNewWindow()
-{
- KAction *a = qobject_cast<KAction*>(sender());
- KUrl url(a->data().toUrl());
-
- emit loadUrl(url, Rekonq::NewWindow);
-}
-
-
-void WebView::openLinkInNewTab()
-{
- KAction *a = qobject_cast<KAction*>(sender());
- KUrl url(a->data().toUrl());
-
- emit loadUrl(url, Rekonq::NewTab);
-}
-
-
-void WebView::bookmarkLink()
-{
- KAction *a = qobject_cast<KAction*>(sender());
- KUrl url(a->data().toUrl());
-
- rApp->bookmarkManager()->rootGroup().addBookmark(url.prettyUrl(), url);
- rApp->bookmarkManager()->emitChanged();
-}
-
-static QVariant execJScript(QWebHitTestResult result, const QString& script)
-{
- QWebElement element(result.element());
- if (element.isNull())
- return QVariant();
- return element.evaluateJavaScript(script);
-}
-
-void WebView::spellCheck()
-{
- QString text(execJScript(m_ContextMenuResult, QL1S("this.value")).toString());
-
- if (m_ContextMenuResult.isContentSelected())
- {
- m_spellTextSelectionStart = qMax(0, execJScript(m_ContextMenuResult, QL1S("this.selectionStart")).toInt());
- m_spellTextSelectionEnd = qMax(0, execJScript(m_ContextMenuResult, QL1S("this.selectionEnd")).toInt());
- text = text.mid(m_spellTextSelectionStart, (m_spellTextSelectionEnd - m_spellTextSelectionStart));
- }
- else
- {
- m_spellTextSelectionStart = 0;
- m_spellTextSelectionEnd = 0;
- }
-
- if (text.isEmpty())
- {
- return;
- }
-
- Sonnet::BackgroundChecker *backgroundSpellCheck = new Sonnet::BackgroundChecker;
- Sonnet::Dialog* spellDialog = new Sonnet::Dialog(backgroundSpellCheck, this);
- backgroundSpellCheck->setParent(spellDialog);
- spellDialog->setAttribute(Qt::WA_DeleteOnClose, true);
-
- spellDialog->showSpellCheckCompletionMessage(true);
- connect(spellDialog, SIGNAL(replace(QString, int, QString)), this, SLOT(spellCheckerCorrected(QString, int, QString)));
- connect(spellDialog, SIGNAL(misspelling(QString, int)), this, SLOT(spellCheckerMisspelling(QString, int)));
- if (m_ContextMenuResult.isContentSelected())
- connect(spellDialog, SIGNAL(done(QString)), this, SLOT(slotSpellCheckDone(QString)));
- spellDialog->setBuffer(text);
- spellDialog->show();
-}
-
-void WebView::spellCheckerCorrected(const QString& original, int pos, const QString& replacement)
-{
- // Adjust the selection end...
- if (m_spellTextSelectionEnd > 0)
- {
- m_spellTextSelectionEnd += qMax(0, (replacement.length() - original.length()));
- }
-
- const int index = pos + m_spellTextSelectionStart;
- QString script(QL1S("this.value=this.value.substring(0,"));
- script += QString::number(index);
- script += QL1S(") + \"");
- script += replacement;
- script += QL1S("\" + this.value.substring(");
- script += QString::number(index + original.length());
- script += QL1S(")");
-
- //kDebug() << "**** script:" << script;
- execJScript(m_ContextMenuResult, script);
-}
-
-void WebView::spellCheckerMisspelling(const QString& text, int pos)
-{
- // kDebug() << text << pos;
- QString selectionScript(QL1S("this.setSelectionRange("));
- selectionScript += QString::number(pos + m_spellTextSelectionStart);
- selectionScript += QL1C(',');
- selectionScript += QString::number(pos + text.length() + m_spellTextSelectionStart);
- selectionScript += QL1C(')');
- execJScript(m_ContextMenuResult, selectionScript);
-}
-
-void WebView::slotSpellCheckDone(const QString&)
-{
- // Restore the text selection if one was present before we started the
- // spell check.
- if (m_spellTextSelectionStart > 0 || m_spellTextSelectionEnd > 0)
- {
- QString script(QL1S("; this.setSelectionRange("));
- script += QString::number(m_spellTextSelectionStart);
- script += QL1C(',');
- script += QString::number(m_spellTextSelectionEnd);
- script += QL1C(')');
- execJScript(m_ContextMenuResult, script);
- }
-}
-
-
-void WebView::keyPressEvent(QKeyEvent *event)
-{
- // If CTRL was hit, be prepared for access keys
- if (ReKonfig::accessKeysEnabled()
- && !m_accessKeysActive
- && event->key() == Qt::Key_Control
- && !(event->modifiers() & ~Qt::ControlModifier)
- )
- {
- m_accessKeysPressed = true;
- event->accept();
- return;
- }
-
- const QString tagName = page()->mainFrame()->evaluateJavaScript("document.activeElement.tagName").toString();
-
- if (event->modifiers() == Qt::ControlModifier)
- {
- if (event->key() == Qt::Key_C)
- {
- triggerPageAction(KWebPage::Copy);
- event->accept();
- return;
- }
-
- if (event->key() == Qt::Key_A)
- {
- triggerPageAction(KWebPage::SelectAll);
- event->accept();
- return;
- }
-
- // CTRL + RETURN: open link into another tab
- if (event->key() == Qt::Key_Return && tagName == QL1S("A"))
- {
- KUrl u = KUrl(page()->mainFrame()->evaluateJavaScript("document.activeElement.attributes[\"href\"].value").toString());
- emit loadUrl(u, Rekonq::NewTab);
- event->accept();
- return;
- }
- }
-
- // Auto Scrolling
- if (event->modifiers() == Qt::ShiftModifier
- && tagName != QL1S("INPUT")
- && tagName != QL1S("TEXTAREA")
- )
- {
- // NOTE and FIXME
- // This check is doabled because it presents strange behavior: QtWebKit check works well in pages like gmail
- // and fails on sites like g+. The opposite is true for javascript check.
- // Please, help me finding the right way to check this EVERY TIME.
- bool isContentEditableQW = page()->mainFrame()->hitTestContent(QCursor::pos()).isContentEditable();
- bool isContentEditableJS = page()->mainFrame()->evaluateJavaScript("document.activeElement.isContentEditable").toBool();
-
- if (!isContentEditableQW && !isContentEditableJS)
- {
- if (event->key() == Qt::Key_Up)
- {
- m_verticalAutoScrollSpeed--;
- if (!m_autoScrollTimer->isActive())
- m_autoScrollTimer->start();
-
- event->accept();
- return;
- }
-
- if (event->key() == Qt::Key_Down)
- {
- m_verticalAutoScrollSpeed++;
- if (!m_autoScrollTimer->isActive())
- m_autoScrollTimer->start();
-
- event->accept();
- return;
- }
-
- if (event->key() == Qt::Key_Right)
- {
- m_horizontalAutoScrollSpeed++;
- if (!m_autoScrollTimer->isActive())
- m_autoScrollTimer->start();
-
- event->accept();
- return;
- }
-
- if (event->key() == Qt::Key_Left)
- {
- m_horizontalAutoScrollSpeed--;
- if (!m_autoScrollTimer->isActive())
- m_autoScrollTimer->start();
-
- event->accept();
- return;
- }
-
- if (m_autoScrollTimer->isActive())
- {
- m_autoScrollTimer->stop();
- event->accept();
- return;
- }
- else
- {
- if (m_verticalAutoScrollSpeed || m_horizontalAutoScrollSpeed)
- {
- m_autoScrollTimer->start();
- event->accept();
- return;
- }
- }
- }
-
- // if you arrived here, I hope it means SHIFT has been pressed NOT for autoscroll management...
- }
-
- if (ReKonfig::accessKeysEnabled() && m_accessKeysActive)
- {
- hideAccessKeys();
- event->accept();
- return;
- }
-
- // vi-like navigation
- if (ReKonfig::enableViShortcuts())
- {
- if (event->modifiers() == Qt::NoModifier
- && tagName != QL1S("INPUT")
- && tagName != QL1S("TEXTAREA")
- )
- {
- // See note up!
- bool isContentEditableQW = page()->mainFrame()->hitTestContent(QCursor::pos()).isContentEditable();
- bool isContentEditableJS = page()->mainFrame()->evaluateJavaScript("document.activeElement.isContentEditable").toBool();
-
- if (!isContentEditableQW && !isContentEditableJS)
- {
- switch (event->key())
- {
- case Qt::Key_J:
- event->accept();
- event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier);
- break;
- case Qt::Key_K:
- event->accept();
- event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier);
- break;
- case Qt::Key_L:
- event->accept();
- event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier);
- break;
- case Qt::Key_H:
- event->accept();
- event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier);
- break;
- default:
- break;
- }
- }
- }
- }
-
- KWebView::keyPressEvent(event);
-}
-
-
-void WebView::keyReleaseEvent(QKeyEvent *event)
-{
- // access keys management
- if (ReKonfig::accessKeysEnabled())
- {
- if (m_accessKeysPressed && event->key() != Qt::Key_Control)
- m_accessKeysPressed = false;
-
- if (m_accessKeysPressed && !(event->modifiers() & Qt::ControlModifier))
- {
- kDebug() << "Shotting access keys";
- QTimer::singleShot(200, this, SLOT(accessKeyShortcut()));
- event->accept();
- return;
- }
- else
- {
- checkForAccessKey(event);
- kDebug() << "Hiding access keys";
- hideAccessKeys();
- event->accept();
- return;
- }
- }
-
- KWebView::keyReleaseEvent(event);
-}
-
-
-void WebView::wheelEvent(QWheelEvent *event)
-{
- if (event->orientation() == Qt::Vertical || !ReKonfig::hScrollWheelHistory())
- {
- // To let some websites (eg: google maps) to handle wheel events
- int prevPos = page()->currentFrame()->scrollPosition().y();
- KWebView::wheelEvent(event);
- int newPos = page()->currentFrame()->scrollPosition().y();
-
- // Sync with the zoom slider
- if (event->modifiers() == Qt::ControlModifier)
- {
- // Round the factor (Fix slider's end value)
- int newFactor = round(zoomFactor() * 10);
- emit zoomChanged(newFactor);
- }
- else if (ReKonfig::smoothScrolling() && prevPos != newPos)
- {
- page()->currentFrame()->setScrollPosition(QPoint(page()->currentFrame()->scrollPosition().x(), prevPos));
-
- if ((event->delta() > 0) != !m_smoothScrollBottomReached)
- stopSmoothScrolling();
-
- if (event->delta() > 0)
- m_smoothScrollBottomReached = false;
- else
- m_smoothScrollBottomReached = true;
-
-
- setupSmoothScrolling(abs(newPos - prevPos));
- }
- }
- // use horizontal wheel events to go back and forward in tab history
- else
- {
- // left -> go to previous page
- if (event->delta() > 0)
- {
- emit openPreviousInHistory();
- }
- // right -> go to next page
- if (event->delta() < 0)
- {
- emit openNextInHistory();
- }
- }
-}
-
-
-void WebView::inspect()
-{
- QAction *a = rApp->mainWindow()->actionByName("web_inspector");
- if (a && !a->isChecked())
- a->trigger();
- pageAction(QWebPage::InspectElement)->trigger();
-}
-
-
-void WebView::scrollFrameChanged()
-{
- // do the scrolling
- page()->currentFrame()->scroll(m_horizontalAutoScrollSpeed, m_verticalAutoScrollSpeed);
-
- // check if we reached the end
- int y = page()->currentFrame()->scrollPosition().y();
- if (y == 0 || y == page()->currentFrame()->scrollBarMaximum(Qt::Vertical))
- m_verticalAutoScrollSpeed = 0;
-
- int x = page()->currentFrame()->scrollPosition().x();
- if (x == 0 || x == page()->currentFrame()->scrollBarMaximum(Qt::Horizontal))
- m_horizontalAutoScrollSpeed = 0;
-}
-
-
-void WebView::setupSmoothScrolling(int posY)
-{
- int ddy = qMax(m_smoothScrollSteps ? abs(m_dy) / m_smoothScrollSteps : 0, 3);
-
- m_dy += posY;
-
- if (m_dy <= 0)
- {
- stopSmoothScrolling();
- return;
- }
-
- m_smoothScrollSteps = 8;
-
- if (m_dy / m_smoothScrollSteps < ddy)
- {
- m_smoothScrollSteps = (abs(m_dy) + ddy - 1) / ddy;
- if (m_smoothScrollSteps < 1)
- m_smoothScrollSteps = 1;
- }
-
- m_smoothScrollTime.start();
-
- if (!m_isViewSmoothScrolling)
- {
- m_isViewSmoothScrolling = true;
- m_smoothScrollTimer->start();
- scrollTick();
- }
-}
-
-
-void WebView::scrollTick()
-{
- if (m_dy == 0)
- {
- stopSmoothScrolling();
- return;
- }
-
- if (m_smoothScrollSteps < 1)
- m_smoothScrollSteps = 1;
-
- int takesteps = m_smoothScrollTime.restart() / 16;
- int scroll_y = 0;
-
- if (takesteps < 1)
- takesteps = 1;
-
- if (takesteps > m_smoothScrollSteps)
- takesteps = m_smoothScrollSteps;
-
- for (int i = 0; i < takesteps; i++)
- {
- int ddy = (m_dy / (m_smoothScrollSteps + 1)) * 2;
-
- // limit step to requested scrolling distance
- if (abs(ddy) > abs(m_dy))
- ddy = m_dy;
-
- // update remaining scroll
- m_dy -= ddy;
- scroll_y += ddy;
- m_smoothScrollSteps--;
- }
-
- if (m_smoothScrollBottomReached)
- page()->currentFrame()->scroll(0, scroll_y);
- else
- page()->currentFrame()->scroll(0, -scroll_y);
-}
-
-
-void WebView::stopSmoothScrolling()
-{
- m_smoothScrollTimer->stop();
- m_dy = 0;
- m_isViewSmoothScrolling = false;
-}
-
-
-void WebView::dragEnterEvent(QDragEnterEvent *event)
-{
- if (event->mimeData()->hasUrls() || event->mimeData()->hasText())
- event->acceptProposedAction();
- else
- KWebView::dragEnterEvent(event);
-}
-
-
-void WebView::dragMoveEvent(QDragMoveEvent *event)
-{
- if (event->mimeData()->hasUrls() || event->mimeData()->hasText())
- event->acceptProposedAction();
- else
- KWebView::dragMoveEvent(event);
-}
-
-
-void WebView::hideAccessKeys()
-{
- if (!m_accessKeyLabels.isEmpty())
- {
- for (int i = 0; i < m_accessKeyLabels.count(); ++i)
- {
- QLabel *label = m_accessKeyLabels[i];
- label->hide();
- label->deleteLater();
- }
- m_accessKeyLabels.clear();
- m_accessKeyNodes.clear();
- update();
- }
-}
-
-
-void WebView::showAccessKeys()
-{
- QStringList supportedElement;
- supportedElement << QLatin1String("a")
- << QLatin1String("input")
- << QLatin1String("area")
- << QLatin1String("button")
- << QLatin1String("label")
- << QLatin1String("legend")
- << QLatin1String("textarea");
-
- QList<QChar> unusedKeys;
- for (char c = 'A'; c <= 'Z'; ++c)
- unusedKeys << QLatin1Char(c);
- for (char c = '0'; c <= '9'; ++c)
- unusedKeys << QLatin1Char(c);
-
- QRect viewport = QRect(page()->mainFrame()->scrollPosition(), page()->viewportSize());
- // Priority first goes to elements with accesskey attributes
- QList<QWebElement> alreadyLabeled;
- Q_FOREACH(const QString & elementType, supportedElement)
- {
- QList<QWebElement> result = page()->mainFrame()->findAllElements(elementType).toList();
- Q_FOREACH(const QWebElement & element, result)
- {
- const QRect geometry = element.geometry();
- if (geometry.size().isEmpty()
- || !viewport.contains(geometry.topLeft()))
- {
- continue;
- }
- QString accessKeyAttribute = element.attribute(QLatin1String("accesskey")).toUpper();
- if (accessKeyAttribute.isEmpty())
- continue;
- QChar accessKey;
- for (int i = 0; i < accessKeyAttribute.count(); i += 2)
- {
- const QChar &possibleAccessKey = accessKeyAttribute[i];
- if (unusedKeys.contains(possibleAccessKey))
- {
- accessKey = possibleAccessKey;
- break;
- }
- }
- if (accessKey.isNull())
- {
- continue;
- }
- unusedKeys.removeOne(accessKey);
- makeAccessKeyLabel(accessKey, element);
- alreadyLabeled.append(element);
- }
- }
-
- // Pick an access key first from the letters in the text and then from the
- // list of unused access keys
- Q_FOREACH(const QString & elementType, supportedElement)
- {
- QWebElementCollection result = page()->mainFrame()->findAllElements(elementType);
- Q_FOREACH(const QWebElement & element, result)
- {
- const QRect geometry = element.geometry();
- if (unusedKeys.isEmpty()
- || alreadyLabeled.contains(element)
- || geometry.size().isEmpty()
- || !viewport.contains(geometry.topLeft()))
- {
- continue;
- }
- QChar accessKey;
- QString text = element.toPlainText().toUpper();
- for (int i = 0; i < text.count(); ++i)
- {
- const QChar &c = text.at(i);
- if (unusedKeys.contains(c))
- {
- accessKey = c;
- break;
- }
- }
- if (accessKey.isNull())
- accessKey = unusedKeys.takeFirst();
- unusedKeys.removeOne(accessKey);
- makeAccessKeyLabel(accessKey, element);
- }
- }
-}
-
-
-void WebView::makeAccessKeyLabel(const QChar &accessKey, const QWebElement &element)
-{
- QLabel *label = new QLabel(this);
- label->setText(QString(QLatin1String("<qt><b>%1</b>")).arg(accessKey));
-
- label->setAutoFillBackground(true);
- label->setFrameStyle(QFrame::Box | QFrame::Plain);
- QPoint point = element.geometry().center();
- point -= page()->mainFrame()->scrollPosition();
- label->move(point);
- label->show();
- point.setX(point.x() - label->width() / 2);
- label->move(point);
- m_accessKeyLabels.append(label);
- m_accessKeyNodes[accessKey] = element;
-}
-
-
-bool WebView::checkForAccessKey(QKeyEvent *event)
-{
- if (m_accessKeyLabels.isEmpty())
- return false;
-
- QString text = event->text();
- if (text.isEmpty())
- return false;
- QChar key = text.at(0).toUpper();
- bool handled = false;
- if (m_accessKeyNodes.contains(key))
- {
- QWebElement element = m_accessKeyNodes[key];
- QPoint p = element.geometry().center();
- QWebFrame *frame = element.webFrame();
- Q_ASSERT(frame);
- do
- {
- p -= frame->scrollPosition();
- frame = frame->parentFrame();
- }
- while (frame && frame != page()->mainFrame());
- QMouseEvent pevent(QEvent::MouseButtonPress, p, Qt::LeftButton, 0, 0);
- rApp->sendEvent(this, &pevent);
- QMouseEvent revent(QEvent::MouseButtonRelease, p, Qt::LeftButton, 0, 0);
- rApp->sendEvent(this, &revent);
- handled = true;
- }
-
- kDebug() << "checking for access keys: " << handled;
- return handled;
-}
-
-
-void WebView::accessKeyShortcut()
-{
- if (!hasFocus()
- || !m_accessKeysPressed
- || !ReKonfig::accessKeysEnabled())
- return;
- if (m_accessKeyLabels.isEmpty())
- {
- showAccessKeys();
- }
- else
- {
- hideAccessKeys();
- }
- m_accessKeysPressed = false;
-}
-
-
-void WebView::sendByMail()
-{
- KAction *a = qobject_cast<KAction*>(sender());
- QString url = a->data().toString();
-
- KToolInvocation::invokeMailer("", "", "", "", url);
-}
-
-
-void WebView::blockImage()
-{
- QAction *action = qobject_cast<QAction*>(sender());
- if (!action)
- return;
-
- QString imageUrl = action->data().toString();
- rApp->adblockManager()->addCustomRule(imageUrl);
-}
-
-
-void WebView::mouseReleaseEvent(QMouseEvent *event)
-{
- QWebHitTestResult hitTest = page()->mainFrame()->hitTestContent(event->pos());
- const QUrl url = hitTest.linkUrl();
-
- if (!url.isEmpty())
- {
- if (event->button() & Qt::MidButton)
- {
- if (event->modifiers() & Qt::ShiftModifier)
- {
- if (ReKonfig::openNewTabsInBackground())
- emit loadUrl(url, Rekonq::NewFocusedTab);
- else
- emit loadUrl(url, Rekonq::NewBackGroundTab);
- event->accept();
- return;
- }
-
- emit loadUrl(url, Rekonq::NewTab);
- event->accept();
- return;
- }
-
- if ((event->button() & Qt::LeftButton) && (event->modifiers() & Qt::ControlModifier))
- {
- emit loadUrl(url, Rekonq::NewTab);
- event->accept();
- return;
- }
-
- if ((event->button() & Qt::LeftButton) && (event->modifiers() & Qt::ShiftModifier))
- {
- page()->downloadUrl(url);
- event->accept();
- return;
- }
- }
-
- QWebView::mouseReleaseEvent(event);
-}
diff --git a/src/webview.h b/src/webview.h
deleted file mode 100644
index 8cf16817..00000000
--- a/src/webview.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef WEBVIEW_H
-#define WEBVIEW_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// KDE Includes
-#include <KWebView>
-
-// Qt Includes
-#include <QTime>
-#include <QPoint>
-#include <QPixmap>
-#include <QWebHitTestResult>
-
-// Forward Declarations
-class WebPage;
-
-class QLabel;
-class QTimer;
-
-
-class REKONQ_TESTS_EXPORT WebView : public KWebView
-{
- Q_OBJECT
-
-public:
-
- enum ContextType
- {
- EmptySelection = 0x00000000,
- LinkSelection = 0x00000001,
- ImageSelection = 0x00000010,
- TextSelection = 0x00000100
- };
-
- explicit WebView(QWidget *parent);
- ~WebView();
-
- WebPage *page();
-
- void load(const QUrl &url);
- void load(const QNetworkRequest &req,
- QNetworkAccessManager::Operation op = QNetworkAccessManager::GetOperation,
- const QByteArray & body = QByteArray());
-
-protected:
- bool popupSpellMenu(QContextMenuEvent *event);
- void contextMenuEvent(QContextMenuEvent *event);
-
- void mouseMoveEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
-
- void keyPressEvent(QKeyEvent *event);
- void keyReleaseEvent(QKeyEvent *event);
-
- void wheelEvent(QWheelEvent *event);
-
- void dropEvent(QDropEvent *event);
- void dragEnterEvent(QDragEnterEvent *event);
- void dragMoveEvent(QDragMoveEvent * event);
-
- void paintEvent(QPaintEvent *event);
-
-private Q_SLOTS:
- void search();
-
- void printFrame();
-
- void openLinkInNewWindow();
- void openLinkInNewTab();
- void bookmarkLink();
- void spellCheck();
- void spellCheckerCorrected(const QString& original, int pos, const QString& replacement);
- void spellCheckerMisspelling(const QString& text, int pos);
- void slotSpellCheckDone(const QString&);
- void sendByMail();
-
- void viewImage(Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers);
- void slotCopyImageLocation();
- void inspect();
-
- void scrollFrameChanged();
- void scrollTick();
-
- void setupSmoothScrolling(int posY);
-
- void stopSmoothScrolling();
- void changeWindowIcon();
-
- void accessKeyShortcut();
- void hideAccessKeys();
-
- void loadStarted();
-
- void blockImage();
-
-
-Q_SIGNALS:
- void loadUrl(const KUrl &, const Rekonq::OpenType &);
- void zoomChanged(int);
- void openPreviousInHistory();
- void openNextInHistory();
-
-private:
- bool checkForAccessKey(QKeyEvent *event);
- void showAccessKeys();
- void makeAccessKeyLabel(const QChar &accessKey, const QWebElement &element);
-
-private:
- WebPage *m_page;
- QPoint m_clickPos;
- QWebHitTestResult m_ContextMenuResult;
-
- // Spell Checking
- int m_spellTextSelectionStart;
- int m_spellTextSelectionEnd;
-
-
- // Auto Scroll
- QTimer *const m_autoScrollTimer;
- int m_verticalAutoScrollSpeed;
- int m_horizontalAutoScrollSpeed;
- bool m_isViewAutoScrolling;
- QPixmap m_autoScrollIndicator;
-
- // Smooth Scroll
- QTimer *const m_smoothScrollTimer;
- QTime m_smoothScrollTime;
- bool m_smoothScrollBottomReached;
- int m_dy;
- int m_smoothScrollSteps;
- bool m_isViewSmoothScrolling;
-
- // Access Keys
- QList<QLabel*> m_accessKeyLabels;
- QHash<QChar, QWebElement> m_accessKeyNodes;
- bool m_accessKeysPressed;
- bool m_accessKeysActive;
-};
-
-#endif
diff --git a/src/zoombar.cpp b/src/zoombar.cpp
deleted file mode 100644
index 2cf30617..00000000
--- a/src/zoombar.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-// Self Includes
-#include "zoombar.h"
-#include "zoombar.moc"
-
-// local includes
-#include "application.h"
-#include "mainview.h"
-#include "mainwindow.h"
-#include "webtab.h"
-
-// KDE Includes
-#include <KAction>
-#include <KIcon>
-#include <KLocalizedString>
-#include <KStandardAction>
-#include <KConfig>
-#include <KConfigGroup>
-
-// Qt Includes
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QSlider>
-#include <QToolButton>
-
-
-ZoomBar::ZoomBar(QWidget *parent)
- : QWidget(parent)
- , m_zoomIn(new QToolButton(this))
- , m_zoomOut(new QToolButton(this))
- , m_zoomNormal(new QToolButton(this))
- , m_zoomSlider(new QSlider(Qt::Horizontal, this))
-{
- QHBoxLayout *layout = new QHBoxLayout;
-
- // cosmetic
- layout->setContentsMargins(2, 0, 2, 0);
-
- QToolButton *hideButton = new QToolButton(this);
- hideButton->setAutoRaise(true);
- hideButton->setIcon(KIcon("dialog-close"));
- connect(hideButton, SIGNAL(clicked()), this, SLOT(hide()));
-
- layout->addWidget(hideButton);
- layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);
-
- // label
- QLabel *label = new QLabel(i18n("Zoom:"));
- layout->addWidget(label);
-
- //Show the current zoom percentage of the page
- m_percentage = new QLabel(i18nc("percentage of the website zoom", "100%"), this);
-
- m_zoomSlider->setTracking(true);
- m_zoomSlider->setRange(1, 19); // divide by 10 to obtain a qreal for zoomFactor()
- m_zoomSlider->setValue(10);
- m_zoomSlider->setPageStep(3);
- connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
-
- m_zoomIn->setAutoRaise(true);
- m_zoomOut->setAutoRaise(true);
- m_zoomNormal->setAutoRaise(true);
-
- layout->addWidget(m_zoomOut);
- layout->addWidget(m_zoomSlider, 8);
- layout->addWidget(m_zoomIn);
- layout->addWidget(m_zoomNormal);
- layout->addWidget(m_percentage, 5);
-
- layout->addStretch();
-
- setLayout(layout);
-
- // we start off hidden
- hide();
-}
-
-
-void ZoomBar::setupActions(MainWindow *window)
-{
- KAction *a;
- a = window->actionCollection()->addAction(KStandardAction::ZoomIn, this, SLOT(zoomIn()));
- a = window->actionCollection()->addAction(KStandardAction::ZoomOut, this, SLOT(zoomOut()));
- a = window->actionCollection()->addAction(KStandardAction::ActualSize, this, SLOT(zoomNormal()));
- a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_0));
- a = window->actionCollection()->addAction(KStandardAction::Zoom, this, SLOT(toggleVisibility()));
- a->setIcon(KIcon("page-zoom"));
- a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Y));
-
- m_zoomIn->setDefaultAction(window->actionByName(KStandardAction::name(KStandardAction::ZoomIn)));
- m_zoomOut->setDefaultAction(window->actionByName(KStandardAction::name(KStandardAction::ZoomOut)));
- m_zoomNormal->setDefaultAction(window->actionByName(KStandardAction::name(KStandardAction::ActualSize)));
-}
-
-
-void ZoomBar::show()
-{
- // show findbar if not visible
- if (isHidden())
- {
- emit visibilityChanged(true);
- QWidget::show();
- m_zoomSlider->setValue(rApp->mainWindow()->currentTab()->view()->zoomFactor() * 10);
- }
-}
-
-
-void ZoomBar::hide()
-{
- emit visibilityChanged(false);
- QWidget::hide();
-}
-
-
-void ZoomBar::zoomIn()
-{
- setValue(m_zoomSlider->value() + 1);
-}
-
-
-void ZoomBar::zoomOut()
-{
- setValue(m_zoomSlider->value() - 1);
-}
-
-
-void ZoomBar::zoomNormal()
-{
- setValue(10);
-}
-
-
-void ZoomBar::updateSlider(int webview)
-{
- WebTab *tab = 0;
- MainView *mainView = static_cast<MainView *>(sender());
-
- if (mainView)
- tab = mainView->webTab(webview);
-
- if (!tab)
- return;
-
- m_zoomSlider->setValue(tab->view()->zoomFactor() * 10);
- connect(tab->view(), SIGNAL(zoomChanged(int)), this, SLOT(setValue(int)));
-}
-
-
-void ZoomBar::setValue(int value)
-{
- int boundedValue = value;
-
- // Don't exceed the slider min/max value
- if (value < 1)
- {
- boundedValue = 1;
- }
- else if (value > 19)
- {
- boundedValue = 19;
- }
-
- m_zoomSlider->setValue(boundedValue);
- m_percentage->setText(i18nc("percentage of the website zoom", "%1%", QString::number(boundedValue * 10)));
-
- WebTab *tab = rApp->mainWindow()->currentTab();
- saveZoomValue(tab->url().host(), boundedValue);
- tab->view()->setZoomFactor(QVariant(boundedValue).toReal() / 10); // Don't allox max +1 values
-}
-
-
-void ZoomBar::toggleVisibility()
-{
- isVisible() ? hide() : show();
-}
-
-
-void ZoomBar::saveZoomValue(const QString &host, int value)
-{
- KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup group(config, "Zoom");
- group.writeEntry(host, QString::number(value));
- config->sync();
-}
diff --git a/src/zoombar.h b/src/zoombar.h
deleted file mode 100644
index e1ec1ced..00000000
--- a/src/zoombar.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* ============================================================
-*
-* This file is a part of the rekonq project
-*
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
-* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
-*
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License as
-* published by the Free Software Foundation; either version 2 of
-* the License or (at your option) version 3 or any later version
-* accepted by the membership of KDE e.V. (or its successor approved
-* by the membership of KDE e.V.), which shall act as a proxy
-* defined in Section 14 of version 3 of the license.
-*
-* This program 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-* ============================================================ */
-
-
-#ifndef ZOOMBAR_H
-#define ZOOMBAR_H
-
-
-// Rekonq Includes
-#include "rekonq_defines.h"
-
-// Qt Includes
-#include <QWidget>
-
-// Forward Declarations
-class MainWindow;
-
-class QLabel;
-class QSlider;
-class QToolButton;
-
-
-class REKONQ_TESTS_EXPORT ZoomBar : public QWidget
-{
- Q_OBJECT
-
-public:
- ZoomBar(QWidget *parent);
-
-public Q_SLOTS:
- void show();
- void hide();
-
- void zoomIn();
- void zoomOut();
- void zoomNormal();
- void setupActions(MainWindow *window);
- void updateSlider(int webview);
- void setValue(int value);
- void toggleVisibility();
-
-private:
- void saveZoomValue(const QString &, int);
-
-Q_SIGNALS:
- void visibilityChanged(bool);
-
-private:
- QToolButton *m_zoomIn;
- QToolButton *m_zoomOut;
- QToolButton *m_zoomNormal;
- QSlider *m_zoomSlider;
- QLabel *m_percentage;
-};
-
-#endif