mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 10:22:48 +00:00
generic: misc cleanups
This commit is contained in:
parent
a45755d5a1
commit
f4f2c7bc75
49 changed files with 263 additions and 340 deletions
|
@ -23,8 +23,6 @@
|
|||
#include <kdecore_export.h>
|
||||
#include <kjob.h>
|
||||
|
||||
#include <QtCore/qlist.h>
|
||||
|
||||
class KCompositeJobPrivate;
|
||||
/**
|
||||
* The base class for all jobs able to be composed of one
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <kdecore_export.h>
|
||||
|
||||
#include <QtCore/qshareddata.h>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/qdatetime.h>
|
||||
|
||||
class QDate;
|
||||
class QStringList;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#define KENCODINGDETECTOR_H
|
||||
|
||||
#include <kdecore_export.h>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/qstring.h>
|
||||
|
||||
class QTextCodec;
|
||||
class QTextDecoder;
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
#include <klocalizedstring.h>
|
||||
#include <ksharedconfig.h>
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QList>
|
||||
|
||||
class QStringList;
|
||||
class QTextCodec;
|
||||
class QDate;
|
||||
|
|
|
@ -21,10 +21,8 @@
|
|||
|
||||
#include <kdecore_export.h>
|
||||
|
||||
|
||||
#include <QtCore/QChar>
|
||||
#include <QtCore/qchar.h>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/qstringlist.h>
|
||||
|
||||
class KLocale;
|
||||
struct KCatalogName;
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
#ifndef KUITFORMATS_P_H
|
||||
#define KUITFORMATS_P_H
|
||||
|
||||
#include <QString>
|
||||
#include <QHash>
|
||||
#include <QtCore/qhash.h>
|
||||
|
||||
namespace KuitFormats {
|
||||
/**
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include <QRegExp>
|
||||
#include <QStack>
|
||||
#include <QtCore/qxmlstream.h>
|
||||
#include <QStringList>
|
||||
#include <QPair>
|
||||
#include <QDir>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
@ -36,8 +34,6 @@
|
|||
#include <kuitformats_p.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#define QL1S(x) QLatin1String(x)
|
||||
|
||||
// Truncates string, for output of long messages.
|
||||
// (But don't truncate too much otherwise it's impossible to determine
|
||||
// which message is faulty if many messages start with the same beginning).
|
||||
|
@ -308,16 +304,34 @@ KuitSemanticsStaticData::KuitSemanticsStaticData ()
|
|||
SETUP_CUE(Shell, "shell");
|
||||
|
||||
// Collect all Qt's rich text engine HTML tags, for some checks later.
|
||||
qtHtmlTagNames << QL1S("a") << QL1S("address") << QL1S("b") << QL1S("big") << QL1S("blockquote")
|
||||
<< QL1S("body") << QL1S("br") << QL1S("center") << QL1S("cita") << QL1S("code")
|
||||
<< QL1S("dd") << QL1S("dfn") << QL1S("div") << QL1S("dl") << QL1S("dt") << QL1S("em")
|
||||
<< QL1S("font") << QL1S("h1") << QL1S("h2") << QL1S("h3") << QL1S("h4") << QL1S("h5")
|
||||
<< QL1S("h6") << QL1S("head") << QL1S("hr") << QL1S("html") << QL1S("i") << QL1S("img")
|
||||
<< QL1S("kbd") << QL1S("meta") << QL1S("li") << QL1S("nobr") << QL1S("ol") << QL1S("p")
|
||||
<< QL1S("pre") << QL1S("qt") << QL1S("s") << QL1S("samp") << QL1S("small") << QL1S("span")
|
||||
<< QL1S("strong") << QL1S("sup") << QL1S("sub") << QL1S("table") << QL1S("tbody")
|
||||
<< QL1S("td") << QL1S("tfoot") << QL1S("th") << QL1S("thead") << QL1S("title")
|
||||
<< QL1S("tr") << QL1S("tt") << QL1S("u") << QL1S("ul") << QL1S("var");
|
||||
qtHtmlTagNames << QLatin1String("a") << QLatin1String("address")
|
||||
<< QLatin1String("b") << QLatin1String("big")
|
||||
<< QLatin1String("blockquote") << QLatin1String("body")
|
||||
<< QLatin1String("br") << QLatin1String("center")
|
||||
<< QLatin1String("cita") << QLatin1String("code")
|
||||
<< QLatin1String("dd") << QLatin1String("dfn")
|
||||
<< QLatin1String("div") << QLatin1String("dl")
|
||||
<< QLatin1String("dt") << QLatin1String("em")
|
||||
<< QLatin1String("font") << QLatin1String("h1")
|
||||
<< QLatin1String("h2") << QLatin1String("h3")
|
||||
<< QLatin1String("h4") << QLatin1String("h5")
|
||||
<< QLatin1String("h6") << QLatin1String("head")
|
||||
<< QLatin1String("hr") << QLatin1String("html")
|
||||
<< QLatin1String("i") << QLatin1String("img")
|
||||
<< QLatin1String("kbd") << QLatin1String("meta")
|
||||
<< QLatin1String("li") << QLatin1String("nobr")
|
||||
<< QLatin1String("ol") << QLatin1String("p")
|
||||
<< QLatin1String("pre") << QLatin1String("qt")
|
||||
<< QLatin1String("s") << QLatin1String("samp")
|
||||
<< QLatin1String("small") << QLatin1String("span")
|
||||
<< QLatin1String("strong") << QLatin1String("sup")
|
||||
<< QLatin1String("sub") << QLatin1String("table")
|
||||
<< QLatin1String("tbody") << QLatin1String("td")
|
||||
<< QLatin1String("tfoot") << QLatin1String("th")
|
||||
<< QLatin1String("thead") << QLatin1String("title")
|
||||
<< QLatin1String("tr") << QLatin1String("tt")
|
||||
<< QLatin1String("u") << QLatin1String("ul")
|
||||
<< QLatin1String("var");
|
||||
|
||||
// Tags that format with number of leading newlines.
|
||||
#undef SETUP_TAG_NL
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define KLOCALSOCKET_H
|
||||
|
||||
#include <kdecore_export.h>
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include <QtNetwork/QTcpSocket>
|
||||
#include <QtNetwork/QTcpServer>
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#ifndef KLOCALSOCKET_P_H
|
||||
#define KLOCALSOCKET_P_H
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QQueue>
|
||||
#include "klocalsocket.h"
|
||||
#define MIN_SOCKADDR_UN_LEN (sizeof(quint16) + sizeof(char))
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define KSOCKETFACTORY_H
|
||||
|
||||
#include <kdecore_export.h>
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include <QtNetwork/QNetworkProxy>
|
||||
#include <QtNetwork/QHostAddress>
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
#include <QtNetwork/QSslCertificate>
|
||||
#include <QtNetwork/QSslError>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/qdatetime.h>
|
||||
|
||||
class QSslCertificate;
|
||||
|
|
|
@ -22,10 +22,7 @@
|
|||
#ifndef KSSLD_ADAPTOR_H
|
||||
#define KSSLD_ADAPTOR_H
|
||||
|
||||
#include <QtDBus/QDBusInterface>
|
||||
#include <QtDBus/QDBusMetaType>
|
||||
#include <QtDBus/QDBusAbstractAdaptor>
|
||||
#include <QtDBus/QDBusArgument>
|
||||
|
||||
#include "kssld_dbusmetatypes.h"
|
||||
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#ifndef KSSLD_DBUSMETATYPES_H
|
||||
#define KSSLD_DBUSMETATYPES_H
|
||||
|
||||
#include <QtDBus/qdbusargument.h>
|
||||
#include <QtDBus/qdbusmetatype.h>
|
||||
|
||||
Q_DECLARE_METATYPE(QSslCertificate)
|
||||
Q_DECLARE_METATYPE(KSslCertificateRule)
|
||||
Q_DECLARE_METATYPE(QList<QSslCertificate>)
|
||||
|
|
|
@ -22,9 +22,8 @@
|
|||
#ifndef KSSLDINTERFACE_H
|
||||
#define KSSLDINTERFACE_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtDBus/QtDBus>
|
||||
#include <QtDBus/QDBusAbstractInterface>
|
||||
|
||||
#include "kssld_dbusmetatypes.h"
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#define KMIMEGLOBSFILEPARSER_P_H
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QHash>
|
||||
|
||||
class QIODevice;
|
||||
class QString;
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
class QIODevice;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#ifndef __kmimetype_h__
|
||||
#define __kmimetype_h__
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QList>
|
||||
|
||||
#include <kurl.h>
|
||||
#include <ksycocatype.h>
|
||||
#include <kservicetype.h>
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define KMIMETYPETRADER_H
|
||||
|
||||
#include <kservice.h>
|
||||
|
||||
class KServiceOffer;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,15 +20,9 @@
|
|||
#ifndef KDECORE_KPLUGININFO_H
|
||||
#define KDECORE_KPLUGININFO_H
|
||||
|
||||
#include <QtCore/qsharedpointer.h>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
#include <kconfiggroup.h>
|
||||
#include <kservice.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <QtCore/QList>
|
||||
|
||||
class KPluginInfoPrivate;
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#define KSERVICE_H
|
||||
|
||||
#include "kserviceaction.h"
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QVariant>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
#include <ksycocaentry.h>
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <kdecore_export.h>
|
||||
#include <QtCore/qshareddata.h>
|
||||
|
||||
class QVariant;
|
||||
class KServiceActionPrivate;
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#ifndef __kservicefactory_h__
|
||||
#define __kservicefactory_h__
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
#include "kserviceoffer.h"
|
||||
#include "ksycocafactory.h"
|
||||
#include <assert.h>
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#ifndef KSERVICEGROUPFACTORY_H
|
||||
#define KSERVICEGROUPFACTORY_H
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
#include "kservicegroup.h"
|
||||
#include "ksycocafactory.h"
|
||||
#include <assert.h>
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#ifndef KSERVICEOFFER_H
|
||||
#define KSERVICEOFFER_H
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <kservice.h>
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
#include <ksycocaentry.h>
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
#include "ksycocafactory.h"
|
||||
#include "kservicetype.h"
|
||||
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
#ifndef __kservicetypeprofile_h__
|
||||
#define __kservicetypeprofile_h__
|
||||
|
||||
#include <QtCore/QMap> // KDE5: remove
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QList>
|
||||
|
||||
#include <kservicetypetrader.h>
|
||||
|
||||
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
#ifndef __ktrader_parse_tree_h__
|
||||
#define __ktrader_parse_tree_h__
|
||||
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QMap>
|
||||
|
||||
#include <kservice.h>
|
||||
|
||||
namespace KTraderParse {
|
||||
|
|
0
kdecore/services/regen.sh
Normal file → Executable file
0
kdecore/services/regen.sh
Normal file → Executable file
|
@ -1,5 +1,3 @@
|
|||
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
|
||||
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
|
||||
|
||||
########### next target ###############
|
||||
|
@ -7,21 +5,21 @@ remove_definitions(-DQT_NO_CAST_FROM_ASCII)
|
|||
# TODO automate and merge with test_filter?
|
||||
set(test_suggest_SRCS test.cpp)
|
||||
|
||||
kde4_add_executable(test_suggest TEST ${test_suggest_SRCS})
|
||||
add_executable(test_suggest ${test_suggest_SRCS})
|
||||
|
||||
target_link_libraries(test_suggest ${KDE4_KDECORE_LIBS} )
|
||||
|
||||
########### unittests ###############
|
||||
|
||||
MACRO(SONNET_UNIT_TESTS)
|
||||
FOREACH(_testname ${ARGN})
|
||||
kde4_add_unit_test(${_testname} TESTNAME sonnet-${_testname} ${_testname}.cpp)
|
||||
target_link_libraries(${_testname} ${KDE4_KDECORE_LIBS} ${QT_QTTEST_LIBRARY} ${QT_QTXML_LIBRARY} ${KDEWIN_LIBRARIES})
|
||||
ENDFOREACH(_testname)
|
||||
FOREACH(_testname ${ARGN})
|
||||
kde4_add_test(sonnet-${_testname} ${_testname}.cpp)
|
||||
target_link_libraries(sonnet-${_testname} ${KDE4_KDECORE_LIBS} ${QT_QTTEST_LIBRARY} ${QT_QTXML_LIBRARY} ${KDEWIN_LIBRARIES})
|
||||
ENDFOREACH(_testname)
|
||||
ENDMACRO(SONNET_UNIT_TESTS)
|
||||
|
||||
SONNET_UNIT_TESTS(
|
||||
test_filter
|
||||
test_core
|
||||
test_filter
|
||||
test_core
|
||||
)
|
||||
|
||||
|
|
|
@ -55,19 +55,11 @@
|
|||
#include <kprotocolinfo.h>
|
||||
#include <kparts/statusbarextension.h>
|
||||
|
||||
#include <QUrl>
|
||||
#include <QFile>
|
||||
#include <QTextCodec>
|
||||
#include <QCoreApplication>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDBusInterface>
|
||||
#include <QWebFrame>
|
||||
#include <QWebElement>
|
||||
#include <QWebHistory>
|
||||
|
||||
#define QL1S(x) QLatin1String(x)
|
||||
#define QL1C(x) QLatin1Char(x)
|
||||
|
||||
K_GLOBAL_STATIC_WITH_ARGS(QUrl, globalBlankUrl, ("about:blank"))
|
||||
|
||||
static inline int convertStr2Int(const QString& value)
|
||||
|
@ -118,7 +110,7 @@ KWebKitPart::KWebKitPart(QWidget *parentWidget, QObject *parent,
|
|||
.arg(KDE::versionMinor())
|
||||
.arg(KDE::versionRelease()));
|
||||
|
||||
setXMLFile(QL1S("kwebkitpart.rc"));
|
||||
setXMLFile(QLatin1String("kwebkitpart.rc"));
|
||||
|
||||
// Create this KPart's widget
|
||||
QWidget *mainWidget = new QWidget (parentWidget);
|
||||
|
@ -252,18 +244,18 @@ void KWebKitPart::updateActions()
|
|||
{
|
||||
m_browserExtension->updateActions();
|
||||
|
||||
QAction* action = actionCollection()->action(QL1S("saveDocument"));
|
||||
QAction* action = actionCollection()->action(QLatin1String("saveDocument"));
|
||||
if (action) {
|
||||
const QString protocol (url().protocol());
|
||||
action->setEnabled(protocol != QL1S("about") && protocol != QL1S("error"));
|
||||
action->setEnabled(protocol != QLatin1String("about") && protocol != QLatin1String("error"));
|
||||
}
|
||||
|
||||
action = actionCollection()->action(QL1S("printPreview"));
|
||||
action = actionCollection()->action(QLatin1String("printPreview"));
|
||||
if (action) {
|
||||
action->setEnabled(m_browserExtension->isActionEnabled("print"));
|
||||
}
|
||||
|
||||
action = actionCollection()->action(QL1S("saveFrame"));
|
||||
action = actionCollection()->action(QLatin1String("saveFrame"));
|
||||
if (action) {
|
||||
action->setEnabled((view()->page()->currentFrame() != view()->page()->mainFrame()));
|
||||
}
|
||||
|
@ -331,8 +323,8 @@ bool KWebKitPart::openUrl(const KUrl &_u)
|
|||
// a path component, we set the path to "/" here so that the security context
|
||||
// will properly allow access to local resources.
|
||||
if (u.host().isEmpty() && u.path().isEmpty()
|
||||
&& KProtocolInfo::protocolClass(u.protocol()) == QL1S(":local")) {
|
||||
u.setPath(QL1S("/"));
|
||||
&& KProtocolInfo::protocolClass(u.protocol()) == QLatin1String(":local")) {
|
||||
u.setPath(QLatin1String("/"));
|
||||
}
|
||||
|
||||
// Do not emit update history when url is typed in since the embedding part
|
||||
|
@ -344,7 +336,7 @@ bool KWebKitPart::openUrl(const KUrl &_u)
|
|||
Q_ASSERT(p);
|
||||
|
||||
// Handle error conditions...
|
||||
if (u.protocol().compare(QL1S("error"), Qt::CaseInsensitive) == 0 && u.hasSubUrl()) {
|
||||
if (u.protocol().compare(QLatin1String("error"), Qt::CaseInsensitive) == 0 && u.hasSubUrl()) {
|
||||
/**
|
||||
* The format of the error url is that two variables are passed in the query:
|
||||
* error = int kio error code, errText = QString error text from kio
|
||||
|
@ -378,7 +370,7 @@ bool KWebKitPart::openUrl(const KUrl &_u)
|
|||
|
||||
if (u != *globalBlankUrl) {
|
||||
// Get the SSL information sent, if any...
|
||||
if (args.metaData().contains(QL1S("ssl_in_use"))) {
|
||||
if (args.metaData().contains(QLatin1String("ssl_in_use"))) {
|
||||
WebSslInfo sslInfo;
|
||||
sslInfo.restoreFrom(KIO::MetaData(args.metaData()).toVariant());
|
||||
sslInfo.setUrl(u);
|
||||
|
@ -489,16 +481,16 @@ void KWebKitPart::slotMainFrameLoadFinished (bool ok)
|
|||
// Set the favicon specified through the <link> tag...
|
||||
if (WebKitSettings::self()->favIconsEnabled()
|
||||
&& !frame->page()->settings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
|
||||
const QWebElement element = frame->findFirstElement(QL1S("head>link[rel=icon], "
|
||||
const QWebElement element = frame->findFirstElement(QLatin1String("head>link[rel=icon], "
|
||||
"head>link[rel=\"shortcut icon\"]"));
|
||||
KUrl shortcutIconUrl;
|
||||
if (element.isNull()) {
|
||||
shortcutIconUrl = frame->baseUrl();
|
||||
QString urlPath = shortcutIconUrl.path();
|
||||
const int index = urlPath.indexOf(QL1C('/'));
|
||||
const int index = urlPath.indexOf(QLatin1Char('/'));
|
||||
if (index > -1)
|
||||
urlPath.truncate(index);
|
||||
urlPath += QL1S("/favicon.ico");
|
||||
urlPath += QLatin1String("/favicon.ico");
|
||||
shortcutIconUrl.setPath(urlPath);
|
||||
} else {
|
||||
shortcutIconUrl = KUrl (frame->baseUrl(), element.attribute("href"));
|
||||
|
@ -520,7 +512,7 @@ void KWebKitPart::slotLoadFinished(bool ok)
|
|||
QWebFrame* frame = (page() ? page()->currentFrame() : 0);
|
||||
if (ok &&
|
||||
frame == page()->mainFrame() &&
|
||||
!frame->findFirstElement(QL1S("head>meta[http-equiv=refresh]")).isNull()) {
|
||||
!frame->findFirstElement(QLatin1String("head>meta[http-equiv=refresh]")).isNull()) {
|
||||
if (WebKitSettings::self()->autoPageRefresh()) {
|
||||
pending = true;
|
||||
} else {
|
||||
|
@ -549,7 +541,7 @@ void KWebKitPart::slotUrlChanged(const QUrl& url)
|
|||
return;
|
||||
|
||||
// Ignore if error url
|
||||
if (url.scheme().compare(QL1S("error"), Qt::CaseInsensitive) == 0)
|
||||
if (url.scheme().compare(QLatin1String("error"), Qt::CaseInsensitive) == 0)
|
||||
return;
|
||||
|
||||
const KUrl u (url);
|
||||
|
@ -660,7 +652,7 @@ void KWebKitPart::slotLinkHovered(const QString& _link, const QString& /*title*/
|
|||
QString message;
|
||||
|
||||
if (_link.isEmpty()) {
|
||||
message = QL1S("");
|
||||
message = QLatin1String("");
|
||||
emit m_browserExtension->mouseOverInfo(KFileItem());
|
||||
} else {
|
||||
QUrl linkUrl (_link);
|
||||
|
@ -670,7 +662,7 @@ void KWebKitPart::slotLinkHovered(const QString& _link, const QString& /*title*/
|
|||
linkUrl.setUserName(QString());
|
||||
const QString link (linkUrl.toString());
|
||||
|
||||
if (QString::compare(scheme, QL1S("mailto"), Qt::CaseInsensitive) == 0) {
|
||||
if (QString::compare(scheme, QLatin1String("mailto"), Qt::CaseInsensitive) == 0) {
|
||||
message += i18nc("status bar text when hovering email links; looks like \"Email: xy@kde.org - CC: z@kde.org -BCC: x@kde.org - Subject: Hi translator\"", "Email: ");
|
||||
|
||||
// Workaround: for QUrl's parsing deficiencies of "mailto:foo@bar.com".
|
||||
|
@ -684,29 +676,29 @@ void KWebKitPart::slotLinkHovered(const QString& _link, const QString& /*title*/
|
|||
for(int i = 0; i < count; ++i) {
|
||||
const QPair<QString, QString> queryItem (queryItems.at(i));
|
||||
//kDebug() << "query: " << queryItem.first << queryItem.second;
|
||||
if (queryItem.first.contains(QL1C('@')) && queryItem.second.isEmpty())
|
||||
if (queryItem.first.contains(QLatin1Char('@')) && queryItem.second.isEmpty())
|
||||
fields["to"] << queryItem.first;
|
||||
if (QString::compare(queryItem.first, QL1S("to"), Qt::CaseInsensitive) == 0)
|
||||
if (QString::compare(queryItem.first, QLatin1String("to"), Qt::CaseInsensitive) == 0)
|
||||
fields["to"] << queryItem.second;
|
||||
if (QString::compare(queryItem.first, QL1S("cc"), Qt::CaseInsensitive) == 0)
|
||||
if (QString::compare(queryItem.first, QLatin1String("cc"), Qt::CaseInsensitive) == 0)
|
||||
fields["cc"] << queryItem.second;
|
||||
if (QString::compare(queryItem.first, QL1S("bcc"), Qt::CaseInsensitive) == 0)
|
||||
if (QString::compare(queryItem.first, QLatin1String("bcc"), Qt::CaseInsensitive) == 0)
|
||||
fields["bcc"] << queryItem.second;
|
||||
if (QString::compare(queryItem.first, QL1S("subject"), Qt::CaseInsensitive) == 0)
|
||||
if (QString::compare(queryItem.first, QLatin1String("subject"), Qt::CaseInsensitive) == 0)
|
||||
fields["subject"] << queryItem.second;
|
||||
}
|
||||
|
||||
if (fields.contains(QL1S("to")))
|
||||
message += fields.value(QL1S("to")).join(QL1S(", "));
|
||||
if (fields.contains(QL1S("cc")))
|
||||
message += i18nc("status bar text when hovering email links; looks like \"Email: xy@kde.org - CC: z@kde.org -BCC: x@kde.org - Subject: Hi translator\"", " - CC: ") + fields.value(QL1S("cc")).join(QL1S(", "));
|
||||
if (fields.contains(QL1S("bcc")))
|
||||
message += i18nc("status bar text when hovering email links; looks like \"Email: xy@kde.org - CC: z@kde.org -BCC: x@kde.org - Subject: Hi translator\"", " - BCC: ") + fields.value(QL1S("bcc")).join(QL1S(", "));
|
||||
if (fields.contains(QL1S("subject")))
|
||||
message += i18nc("status bar text when hovering email links; looks like \"Email: xy@kde.org - CC: z@kde.org -BCC: x@kde.org - Subject: Hi translator\"", " - Subject: ") + fields.value(QL1S("subject")).join(QL1S(" "));
|
||||
} else if (scheme == QL1S("javascript")) {
|
||||
if (fields.contains(QLatin1String("to")))
|
||||
message += fields.value(QLatin1String("to")).join(QLatin1String(", "));
|
||||
if (fields.contains(QLatin1String("cc")))
|
||||
message += i18nc("status bar text when hovering email links; looks like \"Email: xy@kde.org - CC: z@kde.org -BCC: x@kde.org - Subject: Hi translator\"", " - CC: ") + fields.value(QLatin1String("cc")).join(QLatin1String(", "));
|
||||
if (fields.contains(QLatin1String("bcc")))
|
||||
message += i18nc("status bar text when hovering email links; looks like \"Email: xy@kde.org - CC: z@kde.org -BCC: x@kde.org - Subject: Hi translator\"", " - BCC: ") + fields.value(QLatin1String("bcc")).join(QLatin1String(", "));
|
||||
if (fields.contains(QLatin1String("subject")))
|
||||
message += i18nc("status bar text when hovering email links; looks like \"Email: xy@kde.org - CC: z@kde.org -BCC: x@kde.org - Subject: Hi translator\"", " - Subject: ") + fields.value(QLatin1String("subject")).join(QLatin1String(" "));
|
||||
} else if (scheme == QLatin1String("javascript")) {
|
||||
message = KStringHandler::rsqueeze(link, 150);
|
||||
if (link.startsWith(QL1S("javascript:window.open")))
|
||||
if (link.startsWith(QLatin1String("javascript:window.open")))
|
||||
message += i18n(" (In new window)");
|
||||
} else {
|
||||
message = link;
|
||||
|
|
|
@ -46,19 +46,14 @@
|
|||
#include <kdeversion.h>
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QVariant>
|
||||
#include <QClipboard>
|
||||
#include <QApplication>
|
||||
#include <QPrinter>
|
||||
#include <QPrintDialog>
|
||||
#include <QPrintPreviewDialog>
|
||||
#include <QWebFrame>
|
||||
#include <QWebHistory>
|
||||
#include <QWebElement>
|
||||
|
||||
#define QL1S(x) QLatin1String(x)
|
||||
#define QL1C(x) QLatin1Char(x)
|
||||
|
||||
|
||||
WebKitBrowserExtension::WebKitBrowserExtension(KWebKitPart *parent, const QByteArray& cachedHistoryData)
|
||||
:KParts::BrowserExtension(parent),
|
||||
|
@ -249,7 +244,7 @@ void WebKitBrowserExtension::updateEditActions()
|
|||
void WebKitBrowserExtension::updateActions()
|
||||
{
|
||||
const QString protocol (m_part->url().protocol());
|
||||
const bool isValidDocument = (protocol != QL1S("about") && protocol != QL1S("error"));
|
||||
const bool isValidDocument = (protocol != QLatin1String("about") && protocol != QLatin1String("error"));
|
||||
enableAction("print", isValidDocument);
|
||||
}
|
||||
|
||||
|
@ -275,7 +270,7 @@ void WebKitBrowserExtension::searchProvider()
|
|||
return;
|
||||
|
||||
KParts::BrowserArguments bargs;
|
||||
bargs.frameName = QL1S("_blank");
|
||||
bargs.frameName = QLatin1String("_blank");
|
||||
emit openUrlRequest(url, KParts::OpenUrlArguments(), bargs);
|
||||
}
|
||||
|
||||
|
@ -378,7 +373,7 @@ void WebKitBrowserExtension::slotFrameInTop()
|
|||
uargs.setActionRequestedByUser(true);
|
||||
|
||||
KParts::BrowserArguments bargs;
|
||||
bargs.frameName = QL1S("_top");
|
||||
bargs.frameName = QLatin1String("_top");
|
||||
|
||||
QUrl url (view()->page()->currentFrame()->baseUrl());
|
||||
url.resolved(view()->page()->currentFrame()->url());
|
||||
|
@ -499,7 +494,7 @@ void WebKitBrowserExtension::slotBlockHost()
|
|||
return;
|
||||
|
||||
QUrl url (view()->contextMenuResult().imageUrl());
|
||||
url.setPath(QL1S("/*"));
|
||||
url.setPath(QLatin1String("/*"));
|
||||
WebKitSettings::self()->addAdFilter(url.toString(QUrl::RemoveUserInfo | QUrl::RemovePort));
|
||||
reparseConfiguration();
|
||||
}
|
||||
|
@ -542,14 +537,14 @@ void WebKitBrowserExtension::slotViewDocumentSource()
|
|||
|
||||
const KUrl pageUrl (view()->url());
|
||||
if (pageUrl.isLocalFile()) {
|
||||
KRun::runUrl(pageUrl, QL1S("text/plain"), view(), false);
|
||||
KRun::runUrl(pageUrl, QLatin1String("text/plain"), view(), false);
|
||||
} else {
|
||||
KTemporaryFile tempFile;
|
||||
tempFile.setSuffix(QL1S(".html"));
|
||||
tempFile.setSuffix(QLatin1String(".html"));
|
||||
tempFile.setAutoRemove(false);
|
||||
if (tempFile.open()) {
|
||||
tempFile.write(view()->page()->mainFrame()->toHtml().toUtf8());
|
||||
KRun::runUrl(tempFile.fileName(), QL1S("text/plain"), view(), true, false);
|
||||
KRun::runUrl(tempFile.fileName(), QLatin1String("text/plain"), view(), true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -561,24 +556,24 @@ void WebKitBrowserExtension::slotViewFrameSource()
|
|||
|
||||
const KUrl frameUrl(view()->page()->currentFrame()->url());
|
||||
if (frameUrl.isLocalFile()) {
|
||||
KRun::runUrl(frameUrl, QL1S("text/plain"), view(), false);
|
||||
KRun::runUrl(frameUrl, QLatin1String("text/plain"), view(), false);
|
||||
} else {
|
||||
KTemporaryFile tempFile;
|
||||
tempFile.setSuffix(QL1S(".html"));
|
||||
tempFile.setSuffix(QLatin1String(".html"));
|
||||
tempFile.setAutoRemove(false);
|
||||
if (tempFile.open()) {
|
||||
tempFile.write(view()->page()->currentFrame()->toHtml().toUtf8());
|
||||
KRun::runUrl(tempFile.fileName(), QL1S("text/plain"), view(), true, false);
|
||||
KRun::runUrl(tempFile.fileName(), QLatin1String("text/plain"), view(), true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool isMultimediaElement(const QWebElement& element)
|
||||
{
|
||||
if (element.tagName().compare(QL1S("video"), Qt::CaseInsensitive) == 0)
|
||||
if (element.tagName().compare(QLatin1String("video"), Qt::CaseInsensitive) == 0)
|
||||
return true;
|
||||
|
||||
if (element.tagName().compare(QL1S("audio"), Qt::CaseInsensitive) == 0)
|
||||
if (element.tagName().compare(QLatin1String("audio"), Qt::CaseInsensitive) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -593,7 +588,7 @@ void WebKitBrowserExtension::slotLoopMedia()
|
|||
if (!isMultimediaElement(element))
|
||||
return;
|
||||
|
||||
element.evaluateJavaScript(QL1S("this.loop = !this.loop;"));
|
||||
element.evaluateJavaScript(QLatin1String("this.loop = !this.loop;"));
|
||||
}
|
||||
|
||||
void WebKitBrowserExtension::slotMuteMedia()
|
||||
|
@ -605,7 +600,7 @@ void WebKitBrowserExtension::slotMuteMedia()
|
|||
if (!isMultimediaElement(element))
|
||||
return;
|
||||
|
||||
element.evaluateJavaScript(QL1S("this.muted = !this.muted;"));
|
||||
element.evaluateJavaScript(QLatin1String("this.muted = !this.muted;"));
|
||||
}
|
||||
|
||||
void WebKitBrowserExtension::slotPlayMedia()
|
||||
|
@ -617,7 +612,7 @@ void WebKitBrowserExtension::slotPlayMedia()
|
|||
if (!isMultimediaElement(element))
|
||||
return;
|
||||
|
||||
element.evaluateJavaScript(QL1S("this.paused ? this.play() : this.pause();"));
|
||||
element.evaluateJavaScript(QLatin1String("this.paused ? this.play() : this.pause();"));
|
||||
}
|
||||
|
||||
void WebKitBrowserExtension::slotShowMediaControls()
|
||||
|
@ -629,15 +624,15 @@ void WebKitBrowserExtension::slotShowMediaControls()
|
|||
if (!isMultimediaElement(element))
|
||||
return;
|
||||
|
||||
element.evaluateJavaScript(QL1S("this.controls = !this.controls;"));
|
||||
element.evaluateJavaScript(QLatin1String("this.controls = !this.controls;"));
|
||||
}
|
||||
|
||||
static KUrl mediaUrlFrom(QWebElement& element)
|
||||
{
|
||||
QWebFrame* frame = element.webFrame();
|
||||
QString src = frame ? element.attribute(QL1S("src")) : QString();
|
||||
QString src = frame ? element.attribute(QLatin1String("src")) : QString();
|
||||
if (src.isEmpty())
|
||||
src = frame ? element.evaluateJavaScript(QL1S("this.src")).toString() : QString();
|
||||
src = frame ? element.evaluateJavaScript(QLatin1String("this.src")).toString() : QString();
|
||||
|
||||
if (src.isEmpty())
|
||||
return KUrl();
|
||||
|
@ -703,7 +698,7 @@ static QVariant execJScript(WebView* view, const QString& script)
|
|||
|
||||
void WebKitBrowserExtension::slotCheckSpelling()
|
||||
{
|
||||
const QString text (execJScript(view(), QL1S("this.value")).toString());
|
||||
const QString text (execJScript(view(), QLatin1String("this.value")).toString());
|
||||
|
||||
if ( text.isEmpty() ) {
|
||||
return;
|
||||
|
@ -722,14 +717,14 @@ void WebKitBrowserExtension::slotCheckSpelling()
|
|||
|
||||
void WebKitBrowserExtension::slotSpellCheckSelection()
|
||||
{
|
||||
QString text (execJScript(view(), QL1S("this.value")).toString());
|
||||
QString text (execJScript(view(), QLatin1String("this.value")).toString());
|
||||
|
||||
if ( text.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_spellTextSelectionStart = qMax(0, execJScript(view(), QL1S("this.selectionStart")).toInt());
|
||||
m_spellTextSelectionEnd = qMax(0, execJScript(view(), QL1S("this.selectionEnd")).toInt());
|
||||
m_spellTextSelectionStart = qMax(0, execJScript(view(), QLatin1String("this.selectionStart")).toInt());
|
||||
m_spellTextSelectionEnd = qMax(0, execJScript(view(), QLatin1String("this.selectionEnd")).toInt());
|
||||
// kDebug() << "selection start:" << m_spellTextSelectionStart << "end:" << m_spellTextSelectionEnd;
|
||||
|
||||
Sonnet::Dialog* spellDialog = new Sonnet::Dialog(new Sonnet::BackgroundChecker(this), view());
|
||||
|
@ -749,13 +744,13 @@ void WebKitBrowserExtension::spellCheckerCorrected(const QString& original, int
|
|||
}
|
||||
|
||||
const int index = pos + m_spellTextSelectionStart;
|
||||
QString script(QL1S("this.value=this.value.substring(0,"));
|
||||
QString script(QLatin1String("this.value=this.value.substring(0,"));
|
||||
script += QString::number(index);
|
||||
script += QL1S(") + \"");
|
||||
script += QLatin1String(") + \"");
|
||||
script += replacement;
|
||||
script += QL1S("\" + this.value.substring(");
|
||||
script += QLatin1String("\" + this.value.substring(");
|
||||
script += QString::number(index + original.length());
|
||||
script += QL1S(")");
|
||||
script += QLatin1String(")");
|
||||
|
||||
//kDebug() << "**** script:" << script;
|
||||
execJScript(view(), script);
|
||||
|
@ -764,11 +759,11 @@ void WebKitBrowserExtension::spellCheckerCorrected(const QString& original, int
|
|||
void WebKitBrowserExtension::spellCheckerMisspelling(const QString& text, int pos)
|
||||
{
|
||||
// kDebug() << text << pos;
|
||||
QString selectionScript (QL1S("this.setSelectionRange("));
|
||||
QString selectionScript (QLatin1String("this.setSelectionRange("));
|
||||
selectionScript += QString::number(pos + m_spellTextSelectionStart);
|
||||
selectionScript += QL1C(',');
|
||||
selectionScript += QLatin1Char(',');
|
||||
selectionScript += QString::number(pos + text.length() + m_spellTextSelectionStart);
|
||||
selectionScript += QL1C(')');
|
||||
selectionScript += QLatin1Char(')');
|
||||
execJScript(view(), selectionScript);
|
||||
}
|
||||
|
||||
|
@ -777,11 +772,11 @@ void WebKitBrowserExtension::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("));
|
||||
QString script (QLatin1String("; this.setSelectionRange("));
|
||||
script += QString::number(m_spellTextSelectionStart);
|
||||
script += QL1C(',');
|
||||
script += QLatin1Char(',');
|
||||
script += QString::number(m_spellTextSelectionEnd);
|
||||
script += QL1C(')');
|
||||
script += QLatin1Char(')');
|
||||
execJScript(view(), script);
|
||||
}
|
||||
}
|
||||
|
@ -854,7 +849,7 @@ void WebKitBrowserExtension::slotLinkInTop()
|
|||
uargs.setActionRequestedByUser(true);
|
||||
|
||||
KParts::BrowserArguments bargs;
|
||||
bargs.frameName = QL1S("_top");
|
||||
bargs.frameName = QLatin1String("_top");
|
||||
|
||||
const KUrl url (view()->contextMenuResult().linkUrl());
|
||||
|
||||
|
@ -950,9 +945,9 @@ static KParts::SelectorInterface::Element convertWebElement(const QWebElement& w
|
|||
|
||||
static QString queryOne(const QString& query)
|
||||
{
|
||||
QString jsQuery = QL1S("(function(query) { var element; var selectedElement = window.getSelection().getRangeAt(0).cloneContents().querySelector(\"");
|
||||
QString jsQuery = QLatin1String("(function(query) { var element; var selectedElement = window.getSelection().getRangeAt(0).cloneContents().querySelector(\"");
|
||||
jsQuery += query;
|
||||
jsQuery += QL1S("\"); if (selectedElement && selectedElement.length > 0) { element = new Object; "
|
||||
jsQuery += QLatin1String("\"); if (selectedElement && selectedElement.length > 0) { element = new Object; "
|
||||
"element.tagName = selectedElements[0].tagName; element.href = selectedElements[0].href; } "
|
||||
"return element; }())");
|
||||
return jsQuery;
|
||||
|
@ -960,9 +955,9 @@ static QString queryOne(const QString& query)
|
|||
|
||||
static QString queryAll(const QString& query)
|
||||
{
|
||||
QString jsQuery = QL1S("(function(query) { var elements = []; var selectedElements = window.getSelection().getRangeAt(0).cloneContents().querySelectorAll(\"");
|
||||
QString jsQuery = QLatin1String("(function(query) { var elements = []; var selectedElements = window.getSelection().getRangeAt(0).cloneContents().querySelectorAll(\"");
|
||||
jsQuery += query;
|
||||
jsQuery += QL1S("\"); var numSelectedElements = (selectedElements ? selectedElements.length : 0);"
|
||||
jsQuery += QLatin1String("\"); var numSelectedElements = (selectedElements ? selectedElements.length : 0);"
|
||||
"for (var i = 0; i < numSelectedElements; ++i) { var element = new Object; "
|
||||
"element.tagName = selectedElements[i].tagName; element.href = selectedElements[i].href;"
|
||||
"elements.push(element); } return elements; } ())");
|
||||
|
@ -974,8 +969,8 @@ static KParts::SelectorInterface::Element convertSelectionElement(const QVariant
|
|||
KParts::SelectorInterface::Element element;
|
||||
if (!variant.isNull() && variant.type() == QVariant::Map) {
|
||||
const QVariantMap elementMap (variant.toMap());
|
||||
element.setTagName(elementMap.value(QL1S("tagName")).toString());
|
||||
element.setAttribute(QL1S("href"), elementMap.value(QL1S("href")).toString());
|
||||
element.setTagName(elementMap.value(QLatin1String("tagName")).toString());
|
||||
element.setAttribute(QLatin1String("href"), elementMap.value(QLatin1String("href")).toString());
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
@ -987,8 +982,8 @@ static QList<KParts::SelectorInterface::Element> convertSelectionElements(const
|
|||
Q_FOREACH(const QVariant& result, resultList) {
|
||||
const QVariantMap elementMap = result.toMap();
|
||||
KParts::SelectorInterface::Element element;
|
||||
element.setTagName(elementMap.value(QL1S("tagName")).toString());
|
||||
element.setAttribute(QL1S("href"), elementMap.value(QL1S("href")).toString());
|
||||
element.setTagName(elementMap.value(QLatin1String("tagName")).toString());
|
||||
element.setAttribute(QLatin1String("href"), elementMap.value(QLatin1String("href")).toString());
|
||||
elements.append(element);
|
||||
}
|
||||
return elements;
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
#include <kpluginfactory.h>
|
||||
|
||||
#include <QHash>
|
||||
|
||||
class QWidget;
|
||||
|
||||
class KWebKitFactory : public KPluginFactory
|
||||
|
|
|
@ -26,15 +26,12 @@
|
|||
#include <kprotocolinfo.h>
|
||||
#include <krun.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <QNetworkReply>
|
||||
#include <QWebFrame>
|
||||
#include <QWebElement>
|
||||
|
||||
|
||||
#define QL1S(x) QLatin1String(x)
|
||||
#define HIDABLE_ELEMENTS QL1S("audio,img,embed,object,iframe,frame,video")
|
||||
#define HIDABLE_ELEMENTS QLatin1String("audio,img,embed,object,iframe,frame,video")
|
||||
|
||||
/* Null network reply */
|
||||
class NullNetworkReply : public QNetworkReply
|
||||
|
@ -105,9 +102,9 @@ static void hideBlockedElements(const QUrl& url, QWebElementCollection& collecti
|
|||
{
|
||||
for (QWebElementCollection::iterator it = collection.begin(); it != collection.end(); ++it) {
|
||||
const QUrl baseUrl ((*it).webFrame()->baseUrl());
|
||||
QString src = (*it).attribute(QL1S("src"));
|
||||
QString src = (*it).attribute(QLatin1String("src"));
|
||||
if (src.isEmpty())
|
||||
src = (*it).evaluateJavaScript(QL1S("this.src")).toString();
|
||||
src = (*it).evaluateJavaScript(QLatin1String("this.src")).toString();
|
||||
if (src.isEmpty())
|
||||
continue;
|
||||
const QUrl resolvedUrl (baseUrl.resolved(src));
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#ifndef WEBKIT_FILTER_P_H
|
||||
#define WEBKIT_FILTER_P_H
|
||||
|
||||
#include <QString>
|
||||
#include <QRegExp>
|
||||
#include <QVector>
|
||||
#include <kwebkitpart.h>
|
||||
|
|
|
@ -24,7 +24,6 @@ class KConfig;
|
|||
class KConfigGroup;
|
||||
|
||||
#include <QColor>
|
||||
#include <QStringList>
|
||||
#include <QPair>
|
||||
|
||||
#include <kparts/htmlextension.h>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define SSLINFODIALOG_P_H
|
||||
|
||||
#include <kdemacros.h>
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <ktcpsocket.h>
|
||||
|
||||
|
|
|
@ -20,10 +20,8 @@
|
|||
#ifndef WEBHISTORYINTERFACE_H
|
||||
#define WEBHISTORYINTERFACE_H
|
||||
|
||||
|
||||
#include <QWebHistoryInterface>
|
||||
|
||||
|
||||
class WebHistoryInterface : public QWebHistoryInterface
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include <kio/scheduler.h>
|
||||
#include <kparts/htmlextension.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QApplication>
|
||||
#include <QTextDocument> // Qt::escape
|
||||
#include <QNetworkReply>
|
||||
|
@ -57,12 +56,9 @@
|
|||
#include <QWebHistory>
|
||||
#include <QWebSecurityOrigin>
|
||||
|
||||
#define QL1S(x) QLatin1String(x)
|
||||
#define QL1C(x) QLatin1Char(x)
|
||||
|
||||
static bool isBlankUrl(const KUrl& url)
|
||||
{
|
||||
return (url.isEmpty() || url.url() == QL1S("about:blank"));
|
||||
return (url.isEmpty() || url.url() == QLatin1String("about:blank"));
|
||||
}
|
||||
|
||||
WebPage::WebPage(KWebKitPart *part, QWidget *parent)
|
||||
|
@ -85,7 +81,7 @@ WebPage::WebPage(KWebKitPart *part, QWidget *parent)
|
|||
|
||||
setPluginFactory(new WebPluginFactory(part, this));
|
||||
|
||||
setSessionMetaData(QL1S("ssl_activate_warnings"), QL1S("TRUE"));
|
||||
setSessionMetaData(QLatin1String("ssl_activate_warnings"), QLatin1String("TRUE"));
|
||||
|
||||
// Set font sizes accordingly...
|
||||
if (view())
|
||||
|
@ -97,10 +93,10 @@ WebPage::WebPage(KWebKitPart *part, QWidget *parent)
|
|||
Q_FOREACH (const QString& protocol, KProtocolInfo::protocols()) {
|
||||
// file is already a known local scheme and about must not be added
|
||||
// to this list since there is about:blank.
|
||||
if (protocol == QL1S("about") || protocol == QL1S("file"))
|
||||
if (protocol == QLatin1String("about") || protocol == QLatin1String("file"))
|
||||
continue;
|
||||
|
||||
if (KProtocolInfo::protocolClass(protocol) != QL1S(":local"))
|
||||
if (KProtocolInfo::protocolClass(protocol) != QLatin1String(":local"))
|
||||
continue;
|
||||
|
||||
QWebSecurityOrigin::addLocalScheme(protocol);
|
||||
|
@ -178,9 +174,9 @@ static QString warningIconData()
|
|||
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
KMimeType::Ptr mime = KMimeType::mimeType(f.fileName(), KMimeType::ResolveAliases);
|
||||
data += QL1S("data:");
|
||||
data += QLatin1String("data:");
|
||||
data += mime ? mime->name() : KMimeType::defaultMimeType();
|
||||
data += QL1S(";base64,");
|
||||
data += QLatin1String(";base64,");
|
||||
data += f.readAll().toBase64();
|
||||
f.close();
|
||||
}
|
||||
|
@ -198,72 +194,72 @@ QString WebPage::errorPage(int code, const QString& text, const KUrl& reqUrl) co
|
|||
|
||||
stream >> errorName >> techName >> description >> causes >> solutions;
|
||||
|
||||
QFile file (KStandardDirs::locate ("data", QL1S("kwebkitpart/error.html")));
|
||||
QFile file (KStandardDirs::locate ("data", QLatin1String("kwebkitpart/error.html")));
|
||||
if ( !file.open( QIODevice::ReadOnly ) )
|
||||
return i18n("<html><body><h3>Unable to display error message</h3>"
|
||||
"<p>The error template file <em>error.html</em> could not be "
|
||||
"found.</p></body></html>");
|
||||
|
||||
QString html( QL1S(file.readAll()) );
|
||||
QString html( QLatin1String(file.readAll()) );
|
||||
|
||||
html.replace( QL1S( "TITLE" ), i18n( "Error: %1", errorName ) );
|
||||
html.replace( QL1S( "DIRECTION" ), QApplication::isRightToLeft() ? "rtl" : "ltr" );
|
||||
html.replace( QL1S( "ICON_PATH" ), warningIconData());
|
||||
html.replace( QLatin1String( "TITLE" ), i18n( "Error: %1", errorName ) );
|
||||
html.replace( QLatin1String( "DIRECTION" ), QApplication::isRightToLeft() ? "rtl" : "ltr" );
|
||||
html.replace( QLatin1String( "ICON_PATH" ), warningIconData());
|
||||
|
||||
QString doc (QL1S( "<h1>" ));
|
||||
QString doc (QLatin1String( "<h1>" ));
|
||||
doc += i18n( "The requested operation could not be completed" );
|
||||
doc += QL1S( "</h1><h2>" );
|
||||
doc += QLatin1String( "</h1><h2>" );
|
||||
doc += errorName;
|
||||
doc += QL1S( "</h2>" );
|
||||
doc += QLatin1String( "</h2>" );
|
||||
|
||||
if ( !techName.isNull() ) {
|
||||
doc += QL1S( "<h2>" );
|
||||
doc += QLatin1String( "<h2>" );
|
||||
doc += i18n( "Technical Reason: %1", techName );
|
||||
doc += QL1S( "</h2>" );
|
||||
doc += QLatin1String( "</h2>" );
|
||||
}
|
||||
|
||||
doc += QL1S( "<h3>" );
|
||||
doc += QLatin1String( "<h3>" );
|
||||
doc += i18n( "Details of the Request:" );
|
||||
doc += QL1S( "</h3><ul><li>" );
|
||||
doc += QLatin1String( "</h3><ul><li>" );
|
||||
// escape URL twice: once for i18n, and once for HTML.
|
||||
doc += i18n( "URL: %1", Qt::escape( Qt::escape( reqUrl.prettyUrl() ) ) );
|
||||
doc += QL1S( "</li><li>" );
|
||||
doc += QLatin1String( "</li><li>" );
|
||||
|
||||
const QString protocol (reqUrl.protocol());
|
||||
if ( !protocol.isNull() ) {
|
||||
// escape protocol twice: once for i18n, and once for HTML.
|
||||
doc += i18n( "Protocol: %1", Qt::escape( Qt::escape( protocol ) ) );
|
||||
doc += QL1S( "</li><li>" );
|
||||
doc += QLatin1String( "</li><li>" );
|
||||
}
|
||||
|
||||
doc += i18n( "Date and Time: %1",
|
||||
KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), KLocale::LongDate) );
|
||||
doc += QL1S( "</li><li>" );
|
||||
doc += QLatin1String( "</li><li>" );
|
||||
// escape text twice: once for i18n, and once for HTML.
|
||||
doc += i18n( "Additional Information: %1", Qt::escape( Qt::escape( text ) ) );
|
||||
doc += QL1S( "</li></ul><h3>" );
|
||||
doc += QLatin1String( "</li></ul><h3>" );
|
||||
doc += i18n( "Description:" );
|
||||
doc += QL1S( "</h3><p>" );
|
||||
doc += QLatin1String( "</h3><p>" );
|
||||
doc += Qt::escape( description );
|
||||
doc += QL1S( "</p>" );
|
||||
doc += QLatin1String( "</p>" );
|
||||
|
||||
if ( causes.count() ) {
|
||||
doc += QL1S( "<h3>" );
|
||||
doc += QLatin1String( "<h3>" );
|
||||
doc += i18n( "Possible Causes:" );
|
||||
doc += QL1S( "</h3><ul><li>" );
|
||||
doc += QLatin1String( "</h3><ul><li>" );
|
||||
doc += causes.join( "</li><li>" );
|
||||
doc += QL1S( "</li></ul>" );
|
||||
doc += QLatin1String( "</li></ul>" );
|
||||
}
|
||||
|
||||
if ( solutions.count() ) {
|
||||
doc += QL1S( "<h3>" );
|
||||
doc += QLatin1String( "<h3>" );
|
||||
doc += i18n( "Possible Solutions:" );
|
||||
doc += QL1S( "</h3><ul><li>" );
|
||||
doc += QLatin1String( "</h3><ul><li>" );
|
||||
doc += solutions.join( "</li><li>" );
|
||||
doc += QL1S( "</li></ul>" );
|
||||
doc += QLatin1String( "</li></ul>" );
|
||||
}
|
||||
|
||||
html.replace( QL1S("TEXT"), doc );
|
||||
html.replace( QLatin1String("TEXT"), doc );
|
||||
|
||||
return html;
|
||||
}
|
||||
|
@ -336,8 +332,8 @@ 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);
|
||||
QStringList u1List = u1.host().split(QLatin1Char('.'), QString::SkipEmptyParts);
|
||||
QStringList u2List = u2.host().split(QLatin1Char('.'), QString::SkipEmptyParts);
|
||||
|
||||
if (qMin(u1List.count(), u2List.count()) < 2)
|
||||
return false; // better safe than sorry...
|
||||
|
@ -417,7 +413,7 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
|
|||
}
|
||||
break;
|
||||
case QWebPage::NavigationTypeReload:
|
||||
setRequestMetaData(QL1S("cache"), QL1S("reload"));
|
||||
setRequestMetaData(QLatin1String("cache"), QLatin1String("reload"));
|
||||
inPageRequest = false;
|
||||
if (!isBlankUrl(reqUrl)) {
|
||||
resetPluginsLoadedOnDemandFor(pluginFactory());
|
||||
|
@ -438,11 +434,11 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r
|
|||
return false;
|
||||
|
||||
if (m_sslInfo.isValid())
|
||||
setRequestMetaData(QL1S("ssl_was_in_use"), QL1S("TRUE"));
|
||||
setRequestMetaData(QLatin1String("ssl_was_in_use"), QLatin1String("TRUE"));
|
||||
}
|
||||
|
||||
// Set the "main_frame_request" meta-data to aid SSL verification in KIO.
|
||||
setRequestMetaData(QL1S("main_frame_request"), (isMainFrameRequest ? QL1S("TRUE") : QL1S("FALSE")));
|
||||
setRequestMetaData(QLatin1String("main_frame_request"), (isMainFrameRequest ? QLatin1String("TRUE") : QLatin1String("FALSE")));
|
||||
|
||||
// Insert the request into the queue...
|
||||
reqUrl.setUserInfo(QString());
|
||||
|
@ -462,7 +458,7 @@ QString WebPage::userAgentForUrl(const QUrl& url) const
|
|||
QString userAgent = KWebPage::userAgentForUrl(url);
|
||||
|
||||
// Remove the useless "U" if it is present.
|
||||
const int index = userAgent.indexOf(QL1S(" U;"), -1, Qt::CaseInsensitive);
|
||||
const int index = userAgent.indexOf(QLatin1String(" U;"), -1, Qt::CaseInsensitive);
|
||||
if (index > -1)
|
||||
userAgent.remove(index, 3);
|
||||
|
||||
|
@ -604,7 +600,7 @@ void WebPage::slotUnsupportedContent(QNetworkReply* reply)
|
|||
reply->deleteLater();
|
||||
if (qobject_cast<NewWindowPage*>(this) && isBlankUrl(m_part->url())) {
|
||||
m_part->closeUrl();
|
||||
if (m_part->arguments().metaData().contains(QL1S("new-window"))) {
|
||||
if (m_part->arguments().metaData().contains(QLatin1String("new-window"))) {
|
||||
m_part->widget()->topLevelWidget()->close();
|
||||
} else {
|
||||
delete m_part;
|
||||
|
@ -684,7 +680,7 @@ bool WebPage::checkFormData(const QNetworkRequest &req) const
|
|||
const QString scheme (req.url().scheme());
|
||||
|
||||
if (m_sslInfo.isValid() &&
|
||||
!scheme.compare(QL1S("https")) && !scheme.compare(QL1S("mailto")) &&
|
||||
!scheme.compare(QLatin1String("https")) && !scheme.compare(QLatin1String("mailto")) &&
|
||||
(KMessageBox::warningContinueCancel(0,
|
||||
i18n("Warning: This is a secure form "
|
||||
"but it is attempting to send "
|
||||
|
@ -700,7 +696,7 @@ bool WebPage::checkFormData(const QNetworkRequest &req) const
|
|||
}
|
||||
|
||||
|
||||
if (scheme.compare(QL1S("mailto")) == 0 &&
|
||||
if (scheme.compare(QLatin1String("mailto")) == 0 &&
|
||||
(KMessageBox::warningContinueCancel(0, i18n("This site is attempting to "
|
||||
"submit form data via email.\n"
|
||||
"Do you want to continue?"),
|
||||
|
@ -723,18 +719,18 @@ static QUrl sanitizeMailToUrl(const QUrl &url, QStringList& files) {
|
|||
if (url.hasQuery())
|
||||
sanitizedUrl = url;
|
||||
else
|
||||
sanitizedUrl = QUrl(url.scheme() + QL1S(":?") + url.path());
|
||||
sanitizedUrl = QUrl(url.scheme() + QLatin1String(":?") + url.path());
|
||||
|
||||
QListIterator<QPair<QString, QString> > it (sanitizedUrl.queryItems());
|
||||
sanitizedUrl.setEncodedQuery(QByteArray()); // clear out the query componenet
|
||||
|
||||
while (it.hasNext()) {
|
||||
QPair<QString, QString> queryItem = it.next();
|
||||
if (queryItem.first.contains(QL1C('@')) && queryItem.second.isEmpty()) {
|
||||
if (queryItem.first.contains(QLatin1Char('@')) && queryItem.second.isEmpty()) {
|
||||
// ### DF: this hack breaks mailto:faure@kde.org, kmail doesn't expect mailto:?to=faure@kde.org
|
||||
queryItem.second = queryItem.first;
|
||||
queryItem.first = "to";
|
||||
} else if (QString::compare(queryItem.first, QL1S("attach"), Qt::CaseInsensitive) == 0) {
|
||||
} else if (QString::compare(queryItem.first, QLatin1String("attach"), Qt::CaseInsensitive) == 0) {
|
||||
files << queryItem.second;
|
||||
continue;
|
||||
}
|
||||
|
@ -746,7 +742,7 @@ static QUrl sanitizeMailToUrl(const QUrl &url, QStringList& files) {
|
|||
|
||||
bool WebPage::handleMailToUrl (const QUrl &url, NavigationType type) const
|
||||
{
|
||||
if (QString::compare(url.scheme(), QL1S("mailto"), Qt::CaseInsensitive) == 0) {
|
||||
if (QString::compare(url.scheme(), QLatin1String("mailto"), Qt::CaseInsensitive) == 0) {
|
||||
QStringList files;
|
||||
QUrl mailtoUrl (sanitizeMailToUrl(url, files));
|
||||
|
||||
|
@ -757,12 +753,12 @@ bool WebPage::handleMailToUrl (const QUrl &url, NavigationType type) const
|
|||
"the following files to the email message?</qt>"),
|
||||
files, i18n("Email Attachment Confirmation"),
|
||||
KGuiItem(i18n("&Allow attachments")),
|
||||
KGuiItem(i18n("&Ignore attachments")), QL1S("WarnEmailAttachment")) == KMessageBox::Continue) {
|
||||
KGuiItem(i18n("&Ignore attachments")), QLatin1String("WarnEmailAttachment")) == KMessageBox::Continue) {
|
||||
|
||||
// Re-add the attachments...
|
||||
QStringListIterator filesIt (files);
|
||||
while (filesIt.hasNext()) {
|
||||
mailtoUrl.addQueryItem(QL1S("attach"), filesIt.next());
|
||||
mailtoUrl.addQueryItem(QLatin1String("attach"), filesIt.next());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -871,7 +867,7 @@ bool NewWindowPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequ
|
|||
|
||||
// OpenUrl args...
|
||||
KParts::OpenUrlArguments uargs;
|
||||
uargs.setMimeType(QL1S("text/html"));
|
||||
uargs.setMimeType(QLatin1String("text/html"));
|
||||
uargs.setActionRequestedByUser(false);
|
||||
|
||||
// Window args...
|
||||
|
@ -885,7 +881,7 @@ bool NewWindowPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequ
|
|||
return false;
|
||||
} else if (newWindowPart->widget()->topLevelWidget() != part()->widget()->topLevelWidget()) {
|
||||
KParts::OpenUrlArguments args;
|
||||
args.metaData().insert(QL1S("new-window"), QL1S("true"));
|
||||
args.metaData().insert(QLatin1String("new-window"), QLatin1String("true"));
|
||||
newWindowPart->setArguments(args);
|
||||
}
|
||||
|
||||
|
@ -963,7 +959,7 @@ void NewWindowPage::slotLoadFinished(bool ok)
|
|||
|
||||
// OpenUrl args...
|
||||
KParts::OpenUrlArguments uargs;
|
||||
uargs.setMimeType(QL1S("text/html"));
|
||||
uargs.setMimeType(QLatin1String("text/html"));
|
||||
uargs.setActionRequestedByUser(false);
|
||||
|
||||
// Window args...
|
||||
|
@ -982,7 +978,7 @@ void NewWindowPage::slotLoadFinished(bool ok)
|
|||
// if a new window is created, set a new window meta-data flag.
|
||||
if (newWindowPart->widget()->topLevelWidget() != part()->widget()->topLevelWidget()) {
|
||||
KParts::OpenUrlArguments args;
|
||||
args.metaData().insert(QL1S("new-window"), QL1S("true"));
|
||||
args.metaData().insert(QLatin1String("new-window"), QLatin1String("true"));
|
||||
newWindowPart->setArguments(args);
|
||||
}
|
||||
// Reparent this page to the new webview to prevent memory leaks.
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#include <kwebpage.h>
|
||||
#include <kparts/browserextension.h>
|
||||
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
#include <QMultiHash>
|
||||
|
||||
class KUrl;
|
||||
|
|
|
@ -35,14 +35,10 @@
|
|||
#include <QHBoxLayout>
|
||||
#include <QSpacerItem>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <QWebFrame>
|
||||
#include <QWebView>
|
||||
#include <QWebElement>
|
||||
|
||||
#define QL1S(x) QLatin1String(x)
|
||||
#define QL1C(x) QLatin1Char(x)
|
||||
|
||||
static QWebView* webViewFrom(QWidget* widget)
|
||||
{
|
||||
QWidget* parent = widget;
|
||||
|
@ -176,7 +172,7 @@ static uint pluginId(const QUrl& url, const QStringList& argumentNames, const QS
|
|||
const int index = argumentNames.indexOf(properties[i]);
|
||||
if (index > -1) {
|
||||
signature += argumentNames.at(index);
|
||||
signature += QL1C('=');
|
||||
signature += QLatin1Char('=');
|
||||
signature += argumentValues.at(index);
|
||||
}
|
||||
}
|
||||
|
@ -249,8 +245,8 @@ QObject* WebPluginFactory::create (const QString& _mimeType, const QUrl& url, co
|
|||
|
||||
if (page) {
|
||||
const QString scheme = page->currentFrame()->url().scheme();
|
||||
if (page && (QString::compare (scheme, QL1S ("https"), Qt::CaseInsensitive) == 0 ||
|
||||
QString::compare (scheme, QL1S ("webdavs"), Qt::CaseInsensitive) == 0))
|
||||
if (page && (QString::compare (scheme, QLatin1String ("https"), Qt::CaseInsensitive) == 0 ||
|
||||
QString::compare (scheme, QLatin1String ("webdavs"), Qt::CaseInsensitive) == 0))
|
||||
metaData.insert ("ssl_was_in_use", "TRUE");
|
||||
else
|
||||
metaData.insert ("ssl_was_in_use", "FALSE");
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
#include <kwebpluginfactory.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QUrl>
|
||||
#include <QWidget>
|
||||
#include <QPointer>
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#include <kdemacros.h>
|
||||
|
||||
#include <QUrl>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QHostAddress>
|
||||
#include <QSslCertificate>
|
||||
|
||||
|
|
|
@ -40,9 +40,6 @@
|
|||
#include <kstringhandler.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QMimeData>
|
||||
#include <QtGui/qevent.h>
|
||||
#include <QLabel>
|
||||
#include <QNetworkRequest>
|
||||
#include <QWebFrame>
|
||||
|
@ -52,13 +49,11 @@
|
|||
#endif
|
||||
#include <QToolTip>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#define QL1S(x) QLatin1String(x)
|
||||
#define QL1C(x) QLatin1Char(x)
|
||||
|
||||
#define ALTERNATE_DEFAULT_WEB_SHORTCUT QL1S("google")
|
||||
#define ALTERNATE_WEB_SHORTCUTS QStringList() << QL1S("google") << QL1S("wikipedia") << QL1S("webster") << QL1S("dmoz")
|
||||
#define ALTERNATE_DEFAULT_WEB_SHORTCUT QLatin1String("google")
|
||||
#define ALTERNATE_WEB_SHORTCUTS QStringList() << QLatin1String("google") << QLatin1String("wikipedia") << QLatin1String("webster") << QLatin1String("dmoz")
|
||||
|
||||
WebView::WebView(KWebKitPart* part, QWidget* parent)
|
||||
:KWebView(parent, false),
|
||||
|
@ -115,10 +110,10 @@ QWebHitTestResult WebView::contextMenuResult() const
|
|||
|
||||
static bool isMultimediaElement(const QWebElement& element)
|
||||
{
|
||||
if (element.tagName().compare(QL1S("video"), Qt::CaseInsensitive) == 0)
|
||||
if (element.tagName().compare(QLatin1String("video"), Qt::CaseInsensitive) == 0)
|
||||
return true;
|
||||
|
||||
if (element.tagName().compare(QL1S("audio"), Qt::CaseInsensitive) == 0)
|
||||
if (element.tagName().compare(QLatin1String("audio"), Qt::CaseInsensitive) == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -138,12 +133,12 @@ static void extractMimeTypeFor(const KUrl& url, QString& mimeType)
|
|||
// of undecidable type. If the mime type from the extension is one
|
||||
// of these, don't use it. Retain the original type 'text/html'.
|
||||
if (pmt->name() == KMimeType::defaultMimeType() ||
|
||||
pmt->is(QL1S("application/x-perl")) ||
|
||||
pmt->is(QL1S("application/x-perl-module")) ||
|
||||
pmt->is(QL1S("application/x-php")) ||
|
||||
pmt->is(QL1S("application/x-python-bytecode")) ||
|
||||
pmt->is(QL1S("application/x-python")) ||
|
||||
pmt->is(QL1S("application/x-shellscript")))
|
||||
pmt->is(QLatin1String("application/x-perl")) ||
|
||||
pmt->is(QLatin1String("application/x-perl-module")) ||
|
||||
pmt->is(QLatin1String("application/x-php")) ||
|
||||
pmt->is(QLatin1String("application/x-python-bytecode")) ||
|
||||
pmt->is(QLatin1String("application/x-python")) ||
|
||||
pmt->is(QLatin1String("application/x-shellscript")))
|
||||
return;
|
||||
|
||||
mimeType = pmt->name();
|
||||
|
@ -156,7 +151,7 @@ void WebView::dropEvent(QDropEvent* ev)
|
|||
// See https://bugs.webkit.org/show_bug.cgi?id=53320.
|
||||
if (ev) {
|
||||
QWebHitTestResult hitResult = page()->currentFrame()->hitTestContent(ev->pos());
|
||||
if (hitResult.isNull() || hitResult.element().tagName() != QL1S("input")) {
|
||||
if (hitResult.isNull() || hitResult.element().tagName() != QLatin1String("input")) {
|
||||
const QMimeData* mimeData = ev ? ev->mimeData() : 0;
|
||||
if (mimeData && mimeData->hasUrls()) {
|
||||
KUrl url (mimeData->urls().first());
|
||||
|
@ -180,12 +175,12 @@ void WebView::contextMenuEvent(QContextMenuEvent* e)
|
|||
|
||||
KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems;
|
||||
KParts::BrowserExtension::ActionGroupMap mapAction;
|
||||
QString mimeType (QL1S("text/html"));
|
||||
QString mimeType (QLatin1String("text/html"));
|
||||
bool forcesNewWindow = false;
|
||||
|
||||
KUrl emitUrl;
|
||||
if (m_result.isContentEditable()) {
|
||||
if (m_result.element().hasAttribute(QL1S("disabled"))) {
|
||||
if (m_result.element().hasAttribute(QLatin1String("disabled"))) {
|
||||
e->accept();
|
||||
return;
|
||||
}
|
||||
|
@ -242,15 +237,15 @@ void WebView::contextMenuEvent(QContextMenuEvent* e)
|
|||
static bool isEditableElement(QWebPage* page)
|
||||
{
|
||||
const QWebFrame* frame = (page ? page->currentFrame() : 0);
|
||||
QWebElement element = (frame ? frame->findFirstElement(QL1S(":focus")) : QWebElement());
|
||||
QWebElement element = (frame ? frame->findFirstElement(QLatin1String(":focus")) : QWebElement());
|
||||
if (!element.isNull()) {
|
||||
const QString tagName(element.tagName());
|
||||
if (tagName.compare(QL1S("textarea"), Qt::CaseInsensitive) == 0) {
|
||||
if (tagName.compare(QLatin1String("textarea"), Qt::CaseInsensitive) == 0) {
|
||||
return true;
|
||||
}
|
||||
const QString type(element.attribute(QL1S("type")).toLower());
|
||||
if (tagName.compare(QL1S("input"), Qt::CaseInsensitive) == 0
|
||||
&& (type.isEmpty() || type == QL1S("text") || type == QL1S("password"))) {
|
||||
const QString type(element.attribute(QLatin1String("type")).toLower());
|
||||
if (tagName.compare(QLatin1String("input"), Qt::CaseInsensitive) == 0
|
||||
&& (type.isEmpty() || type == QLatin1String("text") || type == QLatin1String("password"))) {
|
||||
return true;
|
||||
}
|
||||
if (element.evaluateJavaScript("this.isContentEditable").toBool()) {
|
||||
|
@ -396,14 +391,14 @@ void WebView::timerEvent(QTimerEvent* e)
|
|||
|
||||
static bool showSpellCheckAction(const QWebElement& element)
|
||||
{
|
||||
if (element.hasAttribute(QL1S("readonly")))
|
||||
if (element.hasAttribute(QLatin1String("readonly")))
|
||||
return false;
|
||||
|
||||
if (element.attribute(QL1S("spellcheck"), QL1S("true")).compare(QL1S("false"), Qt::CaseInsensitive) == 0)
|
||||
if (element.attribute(QLatin1String("spellcheck"), QLatin1String("true")).compare(QLatin1String("false"), Qt::CaseInsensitive) == 0)
|
||||
return false;
|
||||
|
||||
if (element.hasAttribute(QL1S("type"))
|
||||
&& element.attribute(QL1S("type")).compare(QL1S("text"), Qt::CaseInsensitive) != 0)
|
||||
if (element.hasAttribute(QLatin1String("type"))
|
||||
&& element.attribute(QLatin1String("type")).compare(QLatin1String("text"), Qt::CaseInsensitive) != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -417,7 +412,7 @@ void WebView::editableContentActionPopupMenu(KParts::BrowserExtension::ActionGro
|
|||
QActionGroup* group = new QActionGroup(this);
|
||||
group->setExclusive(true);
|
||||
|
||||
KAction *action = m_actionCollection->addAction(QL1S("text-direction-default"), m_part->browserExtension(), SLOT(slotTextDirectionChanged()));
|
||||
KAction *action = m_actionCollection->addAction(QLatin1String("text-direction-default"), m_part->browserExtension(), SLOT(slotTextDirectionChanged()));
|
||||
action->setText(i18n("Default"));
|
||||
action->setCheckable(true);
|
||||
action->setData(QWebPage::SetTextDirectionDefault);
|
||||
|
@ -426,7 +421,7 @@ void WebView::editableContentActionPopupMenu(KParts::BrowserExtension::ActionGro
|
|||
action->setActionGroup(group);
|
||||
menu->addAction(action);
|
||||
|
||||
action = m_actionCollection->addAction(QL1S("text-direction-left-to-right"), m_part->browserExtension(), SLOT(slotTextDirectionChanged()));
|
||||
action = m_actionCollection->addAction(QLatin1String("text-direction-left-to-right"), m_part->browserExtension(), SLOT(slotTextDirectionChanged()));
|
||||
action->setText(i18n("Left to right"));
|
||||
action->setCheckable(true);
|
||||
action->setData(QWebPage::SetTextDirectionLeftToRight);
|
||||
|
@ -435,7 +430,7 @@ void WebView::editableContentActionPopupMenu(KParts::BrowserExtension::ActionGro
|
|||
action->setActionGroup(group);
|
||||
menu->addAction(action);
|
||||
|
||||
action = m_actionCollection->addAction(QL1S("text-direction-right-to-left"), m_part->browserExtension(), SLOT(slotTextDirectionChanged()));
|
||||
action = m_actionCollection->addAction(QLatin1String("text-direction-right-to-left"), m_part->browserExtension(), SLOT(slotTextDirectionChanged()));
|
||||
action->setText(i18n("Right to left"));
|
||||
action->setCheckable(true);
|
||||
action->setData(QWebPage::SetTextDirectionRightToLeft);
|
||||
|
@ -450,15 +445,15 @@ void WebView::editableContentActionPopupMenu(KParts::BrowserExtension::ActionGro
|
|||
action->setSeparator(true);
|
||||
editableContentActions.append(action);
|
||||
|
||||
action = m_actionCollection->addAction(KStandardAction::Copy, QL1S("copy"), m_part->browserExtension(), SLOT(copy()));
|
||||
action = m_actionCollection->addAction(KStandardAction::Copy, QLatin1String("copy"), m_part->browserExtension(), SLOT(copy()));
|
||||
action->setEnabled(pageAction(QWebPage::Copy)->isEnabled());
|
||||
editableContentActions.append(action);
|
||||
|
||||
action = m_actionCollection->addAction(KStandardAction::Cut, QL1S("cut"), m_part->browserExtension(), SLOT(cut()));
|
||||
action = m_actionCollection->addAction(KStandardAction::Cut, QLatin1String("cut"), m_part->browserExtension(), SLOT(cut()));
|
||||
action->setEnabled(pageAction(QWebPage::Cut)->isEnabled());
|
||||
editableContentActions.append(action);
|
||||
|
||||
action = m_actionCollection->addAction(KStandardAction::Paste, QL1S("paste"), m_part->browserExtension(), SLOT(paste()));
|
||||
action = m_actionCollection->addAction(KStandardAction::Paste, QLatin1String("paste"), m_part->browserExtension(), SLOT(paste()));
|
||||
action->setEnabled(pageAction(QWebPage::Paste)->isEnabled());
|
||||
editableContentActions.append(action);
|
||||
|
||||
|
@ -466,8 +461,8 @@ void WebView::editableContentActionPopupMenu(KParts::BrowserExtension::ActionGro
|
|||
action->setSeparator(true);
|
||||
editableContentActions.append(action);
|
||||
|
||||
const bool hasContent = (!m_result.element().evaluateJavaScript(QL1S("this.value")).toString().isEmpty());
|
||||
action = m_actionCollection->addAction(KStandardAction::SelectAll, QL1S("selectall"), m_part->browserExtension(), SLOT(slotSelectAll()));
|
||||
const bool hasContent = (!m_result.element().evaluateJavaScript(QLatin1String("this.value")).toString().isEmpty());
|
||||
action = m_actionCollection->addAction(KStandardAction::SelectAll, QLatin1String("selectall"), m_part->browserExtension(), SLOT(slotSelectAll()));
|
||||
action->setEnabled((pageAction(QWebPage::SelectAll)->isEnabled() && hasContent));
|
||||
editableContentActions.append(action);
|
||||
|
||||
|
@ -475,13 +470,13 @@ void WebView::editableContentActionPopupMenu(KParts::BrowserExtension::ActionGro
|
|||
action = new KAction(m_actionCollection);
|
||||
action->setSeparator(true);
|
||||
editableContentActions.append(action);
|
||||
action = m_actionCollection->addAction(KStandardAction::Spelling, QL1S("spelling"), m_part->browserExtension(), SLOT(slotCheckSpelling()));
|
||||
action = m_actionCollection->addAction(KStandardAction::Spelling, QLatin1String("spelling"), m_part->browserExtension(), SLOT(slotCheckSpelling()));
|
||||
action->setText(i18n("Check Spelling..."));
|
||||
action->setEnabled(hasContent);
|
||||
editableContentActions.append(action);
|
||||
|
||||
const bool hasSelection = (hasContent && m_result.isContentSelected());
|
||||
action = m_actionCollection->addAction(KStandardAction::Spelling, QL1S("spellcheckSelection"), m_part->browserExtension(), SLOT(slotSpellCheckSelection()));
|
||||
action = m_actionCollection->addAction(KStandardAction::Spelling, QLatin1String("spellcheckSelection"), m_part->browserExtension(), SLOT(slotSpellCheckSelection()));
|
||||
action->setText(i18n("Spellcheck selection..."));
|
||||
action->setEnabled(hasSelection);
|
||||
editableContentActions.append(action);
|
||||
|
@ -512,34 +507,34 @@ void WebView::partActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& part
|
|||
if (m_result.imageUrl().isValid()) {
|
||||
KAction *action;
|
||||
action = new KAction(i18n("Save Image As..."), this);
|
||||
m_actionCollection->addAction(QL1S("saveimageas"), action);
|
||||
m_actionCollection->addAction(QLatin1String("saveimageas"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotSaveImageAs()));
|
||||
partActions.append(action);
|
||||
|
||||
action = new KAction(i18n("Send Image..."), this);
|
||||
m_actionCollection->addAction(QL1S("sendimage"), action);
|
||||
m_actionCollection->addAction(QLatin1String("sendimage"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotSendImage()));
|
||||
partActions.append(action);
|
||||
|
||||
action = new KAction(i18n("Copy Image URL"), this);
|
||||
m_actionCollection->addAction(QL1S("copyimageurl"), action);
|
||||
m_actionCollection->addAction(QLatin1String("copyimageurl"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotCopyImageURL()));
|
||||
partActions.append(action);
|
||||
|
||||
action = new KAction(i18n("Copy Image"), this);
|
||||
m_actionCollection->addAction(QL1S("copyimage"), action);
|
||||
m_actionCollection->addAction(QLatin1String("copyimage"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotCopyImage()));
|
||||
action->setEnabled(!m_result.pixmap().isNull());
|
||||
partActions.append(action);
|
||||
|
||||
action = new KAction(i18n("View Image (%1)", KUrl(m_result.imageUrl()).fileName()), this);
|
||||
m_actionCollection->addAction(QL1S("viewimage"), action);
|
||||
m_actionCollection->addAction(QLatin1String("viewimage"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotViewImage()));
|
||||
partActions.append(action);
|
||||
|
||||
if (WebKitSettings::self()->isAdFilterEnabled()) {
|
||||
action = new KAction(i18n("Block Image..."), this);
|
||||
m_actionCollection->addAction(QL1S("blockimage"), action);
|
||||
m_actionCollection->addAction(QLatin1String("blockimage"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotBlockImage()));
|
||||
partActions.append(action);
|
||||
|
||||
|
@ -547,7 +542,7 @@ void WebView::partActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& part
|
|||
!m_result.imageUrl().scheme().isEmpty())
|
||||
{
|
||||
action = new KAction(i18n("Block Images From %1" , m_result.imageUrl().host()), this);
|
||||
m_actionCollection->addAction(QL1S("blockhost"), action);
|
||||
m_actionCollection->addAction(QLatin1String("blockhost"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotBlockHost()));
|
||||
partActions.append(action);
|
||||
}
|
||||
|
@ -556,17 +551,17 @@ void WebView::partActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& part
|
|||
KActionMenu * menu = new KActionMenu(i18nc("@title:menu HTML frame/iframe", "Frame"), this);
|
||||
|
||||
KAction* action = new KAction(KIcon("window-new"), i18n("Open in New &Window"), this);
|
||||
m_actionCollection->addAction(QL1S("frameinwindow"), action);
|
||||
m_actionCollection->addAction(QLatin1String("frameinwindow"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotFrameInWindow()));
|
||||
menu->addAction(action);
|
||||
|
||||
action = new KAction(i18n("Open in &This Window"), this);
|
||||
m_actionCollection->addAction(QL1S("frameintop"), action);
|
||||
m_actionCollection->addAction(QLatin1String("frameintop"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotFrameInTop()));
|
||||
menu->addAction(action);
|
||||
|
||||
action = new KAction(KIcon("tab-new"), i18n("Open in &New Tab"), this);
|
||||
m_actionCollection->addAction(QL1S("frameintab"), action);
|
||||
m_actionCollection->addAction(QLatin1String("frameintab"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotFrameInTab()));
|
||||
menu->addAction(action);
|
||||
|
||||
|
@ -575,27 +570,27 @@ void WebView::partActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& part
|
|||
menu->addAction(action);
|
||||
|
||||
action = new KAction(i18n("Reload Frame"), this);
|
||||
m_actionCollection->addAction(QL1S("reloadframe"), action);
|
||||
m_actionCollection->addAction(QLatin1String("reloadframe"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotReloadFrame()));
|
||||
menu->addAction(action);
|
||||
|
||||
action = new KAction(KIcon("document-print-frame"), i18n("Print Frame..."), this);
|
||||
m_actionCollection->addAction(QL1S("printFrame"), action);
|
||||
m_actionCollection->addAction(QLatin1String("printFrame"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(print()));
|
||||
menu->addAction(action);
|
||||
|
||||
action = new KAction(i18n("Save &Frame As..."), this);
|
||||
m_actionCollection->addAction(QL1S("saveFrame"), action);
|
||||
m_actionCollection->addAction(QLatin1String("saveFrame"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotSaveFrame()));
|
||||
menu->addAction(action);
|
||||
|
||||
action = new KAction(i18n("View Frame Source"), this);
|
||||
m_actionCollection->addAction(QL1S("viewFrameSource"), action);
|
||||
m_actionCollection->addAction(QLatin1String("viewFrameSource"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotViewFrameSource()));
|
||||
menu->addAction(action);
|
||||
///TODO Slot not implemented yet
|
||||
// action = new KAction(i18n("View Frame Information"), this);
|
||||
// m_actionCollection->addAction(QL1S("viewFrameInfo"), action);
|
||||
// m_actionCollection->addAction(QLatin1String("viewFrameInfo"), action);
|
||||
// connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotViewPageInfo()));
|
||||
|
||||
action = new KAction(m_actionCollection);
|
||||
|
@ -604,7 +599,7 @@ void WebView::partActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& part
|
|||
|
||||
if (WebKitSettings::self()->isAdFilterEnabled()) {
|
||||
action = new KAction(i18n("Block IFrame..."), this);
|
||||
m_actionCollection->addAction(QL1S("blockiframe"), action);
|
||||
m_actionCollection->addAction(QLatin1String("blockiframe"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotBlockIFrame()));
|
||||
menu->addAction(action);
|
||||
}
|
||||
|
@ -653,7 +648,7 @@ void WebView::selectActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& se
|
|||
{
|
||||
QList<QAction*> selectActions;
|
||||
|
||||
KAction* copyAction = m_actionCollection->addAction(KStandardAction::Copy, QL1S("copy"), m_part->browserExtension(), SLOT(copy()));
|
||||
KAction* copyAction = m_actionCollection->addAction(KStandardAction::Copy, QLatin1String("copy"), m_part->browserExtension(), SLOT(copy()));
|
||||
copyAction->setText(i18n("&Copy Text"));
|
||||
copyAction->setEnabled(m_part->browserExtension()->isActionEnabled("copy"));
|
||||
selectActions.append(copyAction);
|
||||
|
@ -666,7 +661,7 @@ void WebView::selectActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& se
|
|||
data.uri().isValid() && data.uriType() == KUriFilterData::NetProtocol) {
|
||||
KAction *action = new KAction(KIcon("window-new"), i18nc("open selected url", "Open '%1'",
|
||||
KStringHandler::rsqueeze(data.uri().url(), 18)), this);
|
||||
m_actionCollection->addAction(QL1S("openSelection"), action);
|
||||
m_actionCollection->addAction(QLatin1String("openSelection"), action);
|
||||
action->setData(QUrl(data.uri()));
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotOpenSelection()));
|
||||
selectActions.append(action);
|
||||
|
@ -686,7 +681,7 @@ void WebView::linkActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& link
|
|||
KAction* action;
|
||||
|
||||
if (m_result.isContentSelected()) {
|
||||
action = m_actionCollection->addAction(KStandardAction::Copy, QL1S("copy"), m_part->browserExtension(), SLOT(copy()));
|
||||
action = m_actionCollection->addAction(KStandardAction::Copy, QLatin1String("copy"), m_part->browserExtension(), SLOT(copy()));
|
||||
action->setText(i18n("&Copy Text"));
|
||||
action->setEnabled(m_part->browserExtension()->isActionEnabled("copy"));
|
||||
linkActions.append(action);
|
||||
|
@ -694,24 +689,24 @@ void WebView::linkActionPopupMenu(KParts::BrowserExtension::ActionGroupMap& link
|
|||
|
||||
if (url.protocol() == "mailto") {
|
||||
action = new KAction(i18n("&Copy Email Address"), this);
|
||||
m_actionCollection->addAction(QL1S("copylinklocation"), action);
|
||||
m_actionCollection->addAction(QLatin1String("copylinklocation"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotCopyEmailAddress()));
|
||||
linkActions.append(action);
|
||||
} else {
|
||||
if (!m_result.isContentSelected()) {
|
||||
action = new KAction(KIcon("edit-copy"), i18n("Copy Link &Text"), this);
|
||||
m_actionCollection->addAction(QL1S("copylinktext"), action);
|
||||
m_actionCollection->addAction(QLatin1String("copylinktext"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotCopyLinkText()));
|
||||
linkActions.append(action);
|
||||
}
|
||||
|
||||
action = new KAction(i18n("Copy Link &URL"), this);
|
||||
m_actionCollection->addAction(QL1S("copylinkurl"), action);
|
||||
m_actionCollection->addAction(QLatin1String("copylinkurl"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotCopyLinkURL()));
|
||||
linkActions.append(action);
|
||||
|
||||
action = new KAction(i18n("&Save Link As..."), this);
|
||||
m_actionCollection->addAction(QL1S("savelinkas"), action);
|
||||
m_actionCollection->addAction(QLatin1String("savelinkas"), action);
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(slotSaveLinkAs()));
|
||||
linkActions.append(action);
|
||||
}
|
||||
|
@ -724,34 +719,34 @@ void WebView::multimediaActionPopupMenu(KParts::BrowserExtension::ActionGroupMap
|
|||
QList<QAction*> multimediaActions;
|
||||
|
||||
QWebElement element (m_result.element());
|
||||
const bool isPaused = element.evaluateJavaScript(QL1S("this.paused")).toBool();
|
||||
const bool isMuted = element.evaluateJavaScript(QL1S("this.muted")).toBool();
|
||||
const bool isLoopOn = element.evaluateJavaScript(QL1S("this.loop")).toBool();
|
||||
const bool areControlsOn = element.evaluateJavaScript(QL1S("this.controls")).toBool();
|
||||
const bool isVideoElement = (element.tagName().compare(QL1S("video"), Qt::CaseInsensitive) == 0);
|
||||
const bool isAudioElement = (element.tagName().compare(QL1S("audio"), Qt::CaseInsensitive) == 0);
|
||||
const bool isPaused = element.evaluateJavaScript(QLatin1String("this.paused")).toBool();
|
||||
const bool isMuted = element.evaluateJavaScript(QLatin1String("this.muted")).toBool();
|
||||
const bool isLoopOn = element.evaluateJavaScript(QLatin1String("this.loop")).toBool();
|
||||
const bool areControlsOn = element.evaluateJavaScript(QLatin1String("this.controls")).toBool();
|
||||
const bool isVideoElement = (element.tagName().compare(QLatin1String("video"), Qt::CaseInsensitive) == 0);
|
||||
const bool isAudioElement = (element.tagName().compare(QLatin1String("audio"), Qt::CaseInsensitive) == 0);
|
||||
|
||||
KAction* action = new KAction((isPaused ? i18n("&Play") : i18n("&Pause")), this);
|
||||
m_actionCollection->addAction(QL1S("playmultimedia"), action);
|
||||
m_actionCollection->addAction(QLatin1String("playmultimedia"), action);
|
||||
connect(action, SIGNAL(triggered()), m_part->browserExtension(), SLOT(slotPlayMedia()));
|
||||
multimediaActions.append(action);
|
||||
|
||||
action = new KAction((isMuted ? i18n("Un&mute") : i18n("&Mute")), this);
|
||||
m_actionCollection->addAction(QL1S("mutemultimedia"), action);
|
||||
m_actionCollection->addAction(QLatin1String("mutemultimedia"), action);
|
||||
connect(action, SIGNAL(triggered()), m_part->browserExtension(), SLOT(slotMuteMedia()));
|
||||
multimediaActions.append(action);
|
||||
|
||||
action = new KAction(i18n("&Loop"), this);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(isLoopOn);
|
||||
m_actionCollection->addAction(QL1S("loopmultimedia"), action);
|
||||
m_actionCollection->addAction(QLatin1String("loopmultimedia"), action);
|
||||
connect(action, SIGNAL(triggered()), m_part->browserExtension(), SLOT(slotLoopMedia()));
|
||||
multimediaActions.append(action);
|
||||
|
||||
action = new KAction(i18n("Show &Controls"), this);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(areControlsOn);
|
||||
m_actionCollection->addAction(QL1S("showmultimediacontrols"), action);
|
||||
m_actionCollection->addAction(QLatin1String("showmultimediacontrols"), action);
|
||||
connect(action, SIGNAL(triggered()), m_part->browserExtension(), SLOT(slotShowMediaControls()));
|
||||
multimediaActions.append(action);
|
||||
|
||||
|
@ -772,12 +767,12 @@ void WebView::multimediaActionPopupMenu(KParts::BrowserExtension::ActionGroupMap
|
|||
}
|
||||
|
||||
action = new KAction(saveMediaText, this);
|
||||
m_actionCollection->addAction(QL1S("savemultimedia"), action);
|
||||
m_actionCollection->addAction(QLatin1String("savemultimedia"), action);
|
||||
connect(action, SIGNAL(triggered()), m_part->browserExtension(), SLOT(slotSaveMedia()));
|
||||
multimediaActions.append(action);
|
||||
|
||||
action = new KAction(copyMediaText, this);
|
||||
m_actionCollection->addAction(QL1S("copymultimediaurl"), action);
|
||||
m_actionCollection->addAction(QLatin1String("copymultimediaurl"), action);
|
||||
connect(action, SIGNAL(triggered()), m_part->browserExtension(), SLOT(slotCopyMedia()));
|
||||
multimediaActions.append(action);
|
||||
|
||||
|
@ -816,7 +811,7 @@ void WebView::addSearchActions(QList<QAction*>& selectActions, QWebView* view)
|
|||
data.searchProvider(), squeezedText), view);
|
||||
action->setData(QUrl(data.uri()));
|
||||
connect(action, SIGNAL(triggered(bool)), m_part->browserExtension(), SLOT(searchProvider()));
|
||||
m_actionCollection->addAction(QL1S("defaultSearchProvider"), action);
|
||||
m_actionCollection->addAction(QLatin1String("defaultSearchProvider"), action);
|
||||
selectActions.append(action);
|
||||
|
||||
|
||||
|
@ -835,7 +830,7 @@ void WebView::addSearchActions(QList<QAction*>& selectActions, QWebView* view)
|
|||
|
||||
providerList->addAction(action);
|
||||
}
|
||||
m_actionCollection->addAction(QL1S("searchProviderList"), providerList);
|
||||
m_actionCollection->addAction(QLatin1String("searchProviderList"), providerList);
|
||||
selectActions.append(providerList);
|
||||
}
|
||||
}
|
||||
|
@ -888,12 +883,12 @@ void WebView::hideAccessKeys()
|
|||
|
||||
static QString linkElementKey(const QWebElement& element)
|
||||
{
|
||||
if (element.hasAttribute(QL1S("href"))) {
|
||||
const QUrl url = element.webFrame()->baseUrl().resolved(element.attribute(QL1S("href")));
|
||||
if (element.hasAttribute(QLatin1String("href"))) {
|
||||
const QUrl url = element.webFrame()->baseUrl().resolved(element.attribute(QLatin1String("href")));
|
||||
QString linkKey (url.toString());
|
||||
if (element.hasAttribute(QL1S("target"))) {
|
||||
linkKey += QL1C('+');
|
||||
linkKey += element.attribute(QL1S("target"));
|
||||
if (element.hasAttribute(QLatin1String("target"))) {
|
||||
linkKey += QLatin1Char('+');
|
||||
linkKey += element.attribute(QLatin1String("target"));
|
||||
}
|
||||
return linkKey;
|
||||
}
|
||||
|
@ -902,7 +897,7 @@ static QString linkElementKey(const QWebElement& element)
|
|||
|
||||
static void handleDuplicateLinkElements(const QWebElement& element, QHash<QString, QChar>* dupLinkList, QChar* accessKey)
|
||||
{
|
||||
if (element.tagName().compare(QL1S("A"), Qt::CaseInsensitive) == 0) {
|
||||
if (element.tagName().compare(QLatin1String("A"), Qt::CaseInsensitive) == 0) {
|
||||
const QString linkKey (linkElementKey(element));
|
||||
// kDebug() << "LINK KEY:" << linkKey;
|
||||
if (dupLinkList->contains(linkKey)) {
|
||||
|
@ -919,22 +914,22 @@ static void handleDuplicateLinkElements(const QWebElement& element, QHash<QStrin
|
|||
static bool isHiddenElement(const QWebElement& element)
|
||||
{
|
||||
// width property set to less than zero
|
||||
if (element.hasAttribute(QL1S("width")) && element.attribute(QL1S("width")).toInt() < 1) {
|
||||
if (element.hasAttribute(QLatin1String("width")) && element.attribute(QLatin1String("width")).toInt() < 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// height property set to less than zero
|
||||
if (element.hasAttribute(QL1S("height")) && element.attribute(QL1S("height")).toInt() < 1) {
|
||||
if (element.hasAttribute(QLatin1String("height")) && element.attribute(QLatin1String("height")).toInt() < 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// visiblity set to 'hidden' in the element itself or its parent elements.
|
||||
if (element.styleProperty(QL1S("visibility"),QWebElement::ComputedStyle).compare(QL1S("hidden"), Qt::CaseInsensitive) == 0) {
|
||||
if (element.styleProperty(QLatin1String("visibility"),QWebElement::ComputedStyle).compare(QLatin1String("hidden"), Qt::CaseInsensitive) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// display set to 'none' in the element itself or its parent elements.
|
||||
if (element.styleProperty(QL1S("display"),QWebElement::ComputedStyle).compare(QL1S("none"), Qt::CaseInsensitive) == 0) {
|
||||
if (element.styleProperty(QLatin1String("display"),QWebElement::ComputedStyle).compare(QLatin1String("none"), Qt::CaseInsensitive) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
|
||||
#include "kwebpage.h"
|
||||
|
||||
#define QL1S(x) QLatin1String(x)
|
||||
|
||||
template <class T>
|
||||
class KWebViewPrivate
|
||||
{
|
||||
|
@ -115,12 +113,12 @@ public:
|
|||
return true;
|
||||
|
||||
if (!hitTest.linkUrl().isValid() && !hitTest.isContentEditable() && !page->isModified()) {
|
||||
QString subType (QL1S("plain"));
|
||||
QString subType (QLatin1String("plain"));
|
||||
const QString clipboardText = QApplication::clipboard()->text(subType, QClipboard::Selection);
|
||||
if (!clipboardText.isEmpty()) {
|
||||
KUriFilterData data (clipboardText.left(250).trimmed());
|
||||
data.setCheckForExecutables(false); // don't allow executables...
|
||||
if (KUriFilter::self()->filterUri(data, QStringList(QL1S("kshorturifilter")))) {
|
||||
if (KUriFilter::self()->filterUri(data, QStringList(QLatin1String("kshorturifilter")))) {
|
||||
switch (data.uriType()) {
|
||||
case KUriFilterData::LocalFile:
|
||||
case KUriFilterData::LocalDir:
|
||||
|
|
|
@ -27,11 +27,8 @@
|
|||
#include <kurl.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QPair>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
class QWebFrame;
|
||||
class QWebPage;
|
||||
|
|
|
@ -30,9 +30,7 @@
|
|||
|
||||
#define PIC_MAGIC_NUMBER 0x5380f634
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtGui/qimageiohandler.h>
|
||||
#include <QtGui/QColor>
|
||||
|
||||
/**
|
||||
* How fields are distributed over the image
|
||||
|
|
|
@ -10,11 +10,9 @@
|
|||
#ifndef KIMG_RGB_H
|
||||
#define KIMG_RGB_H
|
||||
|
||||
|
||||
#include <QtGui/qimageiohandler.h>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QVector>
|
||||
|
||||
#include <QtCore/qmap.h>
|
||||
#include <QtCore/qvector.h>
|
||||
|
||||
class RGBHandler : public QImageIOHandler
|
||||
{
|
||||
|
|
|
@ -23,9 +23,8 @@
|
|||
|
||||
|
||||
#include <QtGui/qimageiohandler.h>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtCore/QIODevice>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtGui/qimage.h>
|
||||
#include <QtCore/qvector.h>
|
||||
|
||||
#include "gimp.h"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue