mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
[Coding Style] Edited coding style (use linux style brackets)
Linux style brackets are now used also for source files. One line blocks can now be without brackets. Example: if (test) foo(); Multi-line if statements are now written with conditionals (||, &&, ...) at the end of line. The last line of if body does not ends with closing bracket, instead the closing bracket is written on separate line. One line blocks in multi-line if statements should not be without brackets. Example: if (test || test2 && test3 ) { foo(); } [ci skip]
This commit is contained in:
parent
41ff89c3dd
commit
6874df57d7
@ -5,28 +5,24 @@
|
||||
# normalize (Qt tool to normalize all signal/slots format)
|
||||
#
|
||||
|
||||
function format_sources {
|
||||
astyle --indent=spaces=4 --style=1tbs \
|
||||
--indent-labels --pad-oper --unpad-paren --pad-header \
|
||||
--convert-tabs --indent-preprocessor --break-closing-brackets \
|
||||
--align-pointer=type --align-reference=name \
|
||||
`find -type f -name '*.cpp'` | grep 'Formatted'
|
||||
OPTIONS="--indent=spaces=4 --style=linux
|
||||
--pad-oper --unpad-paren --pad-header --convert-tabs
|
||||
--indent-preprocessor --break-closing-brackets
|
||||
--align-pointer=type --align-reference=name
|
||||
--suffix=none --formatted"
|
||||
|
||||
find . -name "*.orig" -print0 | xargs -0 rm -rf
|
||||
function format_sources {
|
||||
astyle $OPTIONS \
|
||||
`find -type f \( -name '*.cpp' -not -name 'moc_*.cpp' \)`
|
||||
}
|
||||
|
||||
function format_headers {
|
||||
astyle --indent=spaces=4 --style=linux \
|
||||
--indent-labels --pad-oper --unpad-paren --pad-header \
|
||||
--keep-one-line-statements --keep-one-line-blocks \
|
||||
--indent-preprocessor --convert-tabs \
|
||||
--align-pointer=type --align-reference=name \
|
||||
`find -type f -name '*.h'` | grep 'Formatted'
|
||||
|
||||
find . -name "*.orig" -print0 | xargs -0 rm -rf
|
||||
astyle $OPTIONS --keep-one-line-statements --keep-one-line-blocks \
|
||||
`find -type f -name '*.h'`
|
||||
}
|
||||
|
||||
cd ../src
|
||||
|
||||
echo "Running astyle for *.cpp ..."
|
||||
format_sources
|
||||
|
||||
|
3
src/lib/3rdparty/qftp/qftp.cpp
vendored
3
src/lib/3rdparty/qftp/qftp.cpp
vendored
@ -1149,7 +1149,8 @@ bool QFtpPI::processReply()
|
||||
}
|
||||
else if (replyCodeInt == 230) {
|
||||
if (currentCmd.startsWith(QLatin1String("USER ")) && pendingCommands.count() > 0 &&
|
||||
pendingCommands.first().startsWith(QLatin1String("PASS "))) {
|
||||
pendingCommands.first().startsWith(QLatin1String("PASS "))
|
||||
) {
|
||||
// no need to send the PASS -- we are already logged in
|
||||
pendingCommands.pop_front();
|
||||
}
|
||||
|
@ -477,8 +477,10 @@ void AdBlockRule::parseFilter()
|
||||
}
|
||||
|
||||
// We can use fast string matching for domain here
|
||||
if (parsedLine.startsWith(QLatin1String("||")) && parsedLine.endsWith(QLatin1Char('^'))
|
||||
&& !parsedLine.contains(QzRegExp("[/:?=&\\*]"))) {
|
||||
if (parsedLine.startsWith(QLatin1String("||")) &&
|
||||
parsedLine.endsWith(QLatin1Char('^')) &&
|
||||
!parsedLine.contains(QzRegExp("[/:?=&\\*]"))
|
||||
) {
|
||||
parsedLine = parsedLine.mid(2);
|
||||
parsedLine = parsedLine.left(parsedLine.size() - 1);
|
||||
|
||||
@ -488,8 +490,10 @@ void AdBlockRule::parseFilter()
|
||||
}
|
||||
|
||||
// If rule contains only | at end, we can also use string matching
|
||||
if (parsedLine.endsWith(QLatin1Char('|')) && !parsedLine.contains(QzRegExp("[\\^\\*]"))
|
||||
&& parsedLine.count(QLatin1Char('|')) == 1) {
|
||||
if (parsedLine.endsWith(QLatin1Char('|')) &&
|
||||
parsedLine.count(QLatin1Char('|')) == 1 &&
|
||||
!parsedLine.contains(QzRegExp("[\\^\\*]"))
|
||||
) {
|
||||
parsedLine = parsedLine.left(parsedLine.size() - 1);
|
||||
|
||||
m_type = StringEndsMatchRule;
|
||||
@ -499,8 +503,10 @@ void AdBlockRule::parseFilter()
|
||||
|
||||
// If we still find a wildcard (*) or separator (^) or (|)
|
||||
// we must modify parsedLine to comply with QzRegExp
|
||||
if (parsedLine.contains(QLatin1Char('*')) || parsedLine.contains(QLatin1Char('^'))
|
||||
|| parsedLine.contains(QLatin1Char('|'))) {
|
||||
if (parsedLine.contains(QLatin1Char('*')) ||
|
||||
parsedLine.contains(QLatin1Char('^')) ||
|
||||
parsedLine.contains(QLatin1Char('|'))
|
||||
) {
|
||||
QString parsedRegExp = parsedLine;
|
||||
|
||||
parsedRegExp.replace(QzRegExp(QLatin1String("\\*+")), QLatin1String("*")) // remove multiple wildcards
|
||||
|
@ -198,9 +198,14 @@ void CommandLineOptions::parseActions()
|
||||
url = fileInfo.absoluteFilePath();
|
||||
}
|
||||
|
||||
if (m_argc > 1 && !url.isEmpty() && !url.startsWith(QLatin1Char('-')) &&
|
||||
(url.contains(QLatin1Char('.')) || url.contains(QLatin1Char('/'))
|
||||
|| url.contains(QLatin1Char('\\')))) {
|
||||
if (m_argc > 1 &&
|
||||
!url.isEmpty() &&
|
||||
!url.startsWith(QLatin1Char('-')) &&
|
||||
(url.contains(QLatin1Char('.')) ||
|
||||
url.contains(QLatin1Char('/')) ||
|
||||
url.contains(QLatin1Char('\\'))
|
||||
)
|
||||
) {
|
||||
ActionPair pair;
|
||||
pair.action = Qz::CL_OpenUrl;
|
||||
pair.text = url;
|
||||
|
@ -609,7 +609,7 @@ void MasterPasswordDialog::showSetMasterPasswordPage()
|
||||
void MasterPasswordDialog::clearMasterPasswordAndConvert(bool forcedAskPass)
|
||||
{
|
||||
if (QMessageBox::information(this, tr("Warning!"), tr("Are you sure to clear master password and decrypt data?"), QMessageBox::Yes | QMessageBox::No)
|
||||
== QMessageBox::No) {
|
||||
== QMessageBox::No) {
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
@ -420,9 +420,10 @@ void Bookmarks::search(QList<BookmarkItem*>* items, BookmarkItem* parent, const
|
||||
|
||||
case BookmarkItem::Url:
|
||||
if (parent->title().contains(string, sensitive) ||
|
||||
parent->urlString().contains(string, sensitive) ||
|
||||
parent->description().contains(string, sensitive) ||
|
||||
parent->keyword().compare(string, sensitive) == 0) {
|
||||
parent->urlString().contains(string, sensitive) ||
|
||||
parent->description().contains(string, sensitive) ||
|
||||
parent->keyword().compare(string, sensitive) == 0
|
||||
) {
|
||||
items->append(parent);
|
||||
}
|
||||
break;
|
||||
|
@ -152,10 +152,8 @@ BookmarkItem* HtmlImporter::importBookmarks()
|
||||
|
||||
start += posOfLink + rx.cap(0).size();
|
||||
|
||||
if (linkName.isEmpty() || url.isEmpty() || url.scheme() == QLatin1String("place")
|
||||
|| url.scheme() == QLatin1String("about")) {
|
||||
if (linkName.isEmpty() || url.isEmpty() || url.scheme() == QL1S("place") || url.scheme() == QL1S("about"))
|
||||
continue;
|
||||
}
|
||||
|
||||
BookmarkItem* b = new BookmarkItem(BookmarkItem::Url, folders.isEmpty() ? root : folders.last());
|
||||
b->setTitle(linkName);
|
||||
|
@ -469,7 +469,10 @@ void DownloadItem::updateDownload()
|
||||
// after caling stop() (from readyRead()) m_reply will be a dangling pointer,
|
||||
// thus it should be checked after m_outputFile.isOpen()
|
||||
if (ui->progressBar->maximum() == 0 && m_outputFile.isOpen() &&
|
||||
((m_reply && m_reply->isFinished()) || (m_ftpDownloader && m_ftpDownloader->isFinished()))) {
|
||||
((m_reply && m_reply->isFinished()) ||
|
||||
(m_ftpDownloader && m_ftpDownloader->isFinished())
|
||||
)
|
||||
) {
|
||||
downloadProgress(0, 0);
|
||||
finished();
|
||||
}
|
||||
|
@ -68,10 +68,11 @@ void History::addHistoryEntry(const QUrl &url, QString title)
|
||||
if (!m_isSaving) {
|
||||
return;
|
||||
}
|
||||
if (url.scheme() == QLatin1String("qupzilla") ||
|
||||
url.scheme() == QLatin1String("about") ||
|
||||
url.scheme() == QLatin1String("data") ||
|
||||
url.isEmpty()) {
|
||||
if (url.isEmpty() ||
|
||||
url.scheme() == QLatin1String("qupzilla") ||
|
||||
url.scheme() == QLatin1String("about") ||
|
||||
url.scheme() == QLatin1String("data")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -110,8 +110,9 @@ void HistoryView::itemPressed(const QModelIndex &index)
|
||||
return;
|
||||
}
|
||||
|
||||
if ((selectionMode() == QAbstractItemView::SingleSelection && QApplication::keyboardModifiers() & Qt::ControlModifier)
|
||||
|| (QApplication::mouseButtons() & Qt::MiddleButton)) {
|
||||
if ((selectionMode() == QAbstractItemView::SingleSelection && QApplication::keyboardModifiers() & Qt::ControlModifier) ||
|
||||
QApplication::mouseButtons() & Qt::MiddleButton
|
||||
) {
|
||||
emit openLink(index.data(HistoryModel::UrlRole).toUrl(), OpenInNewTab);
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +515,8 @@ void LocationBar::keyReleaseEvent(QKeyEvent* event)
|
||||
QString localDomain = tr(".co.uk", "Append domain name on ALT + Enter = Should be different for every country");
|
||||
|
||||
if (event->key() == Qt::Key_Alt && m_holdingAlt && qzSettings->addCountryWithAlt &&
|
||||
!text().endsWith(localDomain) && !text().endsWith(QLatin1Char('/'))) {
|
||||
!text().endsWith(localDomain) && !text().endsWith(QLatin1Char('/'))
|
||||
) {
|
||||
LineEdit::setText(text().append(localDomain));
|
||||
}
|
||||
|
||||
|
@ -228,10 +228,8 @@ QScriptValue ProxyAutoConfig::myIpAddress(QScriptContext* context, QScriptEngine
|
||||
}
|
||||
|
||||
foreach (QHostAddress address, QNetworkInterface::allAddresses()) {
|
||||
if (address != QHostAddress::LocalHost
|
||||
&& address != QHostAddress::LocalHostIPv6) {
|
||||
if (address != QHostAddress::LocalHost && address != QHostAddress::LocalHostIPv6)
|
||||
return QScriptValue(engine, address.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return engine->undefinedValue();
|
||||
|
@ -482,8 +482,9 @@ QFtp::Error FtpDownloader::error()
|
||||
QString FtpDownloader::errorString() const
|
||||
{
|
||||
if (!m_lastErrorString.isEmpty()
|
||||
&& m_lastError != QFtp::NoError
|
||||
&& QFtp::error() == QFtp::NoError) {
|
||||
&& m_lastError != QFtp::NoError
|
||||
&& QFtp::error() == QFtp::NoError
|
||||
) {
|
||||
return m_lastErrorString;
|
||||
}
|
||||
else {
|
||||
|
@ -100,7 +100,8 @@ OpenSearchEngine* OpenSearchReader::read()
|
||||
m_searchXml = device()->peek(1024 * 5);
|
||||
|
||||
if (!m_searchXml.contains(QLatin1String("http://a9.com/-/spec/opensearch/1.1/")) &&
|
||||
!m_searchXml.contains(QLatin1String("http://www.mozilla.org/2006/browser/search/"))) {
|
||||
!m_searchXml.contains(QLatin1String("http://www.mozilla.org/2006/browser/search/"))
|
||||
) {
|
||||
raiseError(QObject::tr("The file is not an OpenSearch 1.1 file."));
|
||||
return engine;
|
||||
}
|
||||
@ -140,15 +141,17 @@ OpenSearchEngine* OpenSearchReader::read()
|
||||
QString url = attributes().value(QLatin1String("template")).toString();
|
||||
QString method = attributes().value(QLatin1String("method")).toString();
|
||||
|
||||
if (type == QLatin1String("application/x-suggestions+json")
|
||||
&& !engine->suggestionsUrlTemplate().isEmpty()) {
|
||||
if (type == QLatin1String("application/x-suggestions+json") &&
|
||||
!engine->suggestionsUrlTemplate().isEmpty()
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((type.isEmpty()
|
||||
|| type == QLatin1String("text/html")
|
||||
|| type == QLatin1String("application/xhtml+xml"))
|
||||
&& !engine->searchUrlTemplate().isEmpty()) {
|
||||
if ((type.isEmpty() ||
|
||||
type == QLatin1String("text/html") ||
|
||||
type == QLatin1String("application/xhtml+xml")) &&
|
||||
!engine->searchUrlTemplate().isEmpty()
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -161,8 +164,9 @@ OpenSearchEngine* OpenSearchReader::read()
|
||||
readNext();
|
||||
|
||||
while (!isEndElement() || (name() != QLatin1String("Url") && name() != QLatin1String("os:Url"))) {
|
||||
if (!isStartElement() || (name() != QLatin1String("Param") && name() != QLatin1String("Parameter")
|
||||
&& name() != QLatin1String("os:Param") && name() != QLatin1String("os:Parameter"))) {
|
||||
if (!isStartElement() || (name() != QLatin1String("Param") && name() != QLatin1String("Parameter") &&
|
||||
name() != QLatin1String("os:Param") && name() != QLatin1String("os:Parameter"))
|
||||
) {
|
||||
readNext();
|
||||
continue;
|
||||
}
|
||||
@ -195,11 +199,12 @@ OpenSearchEngine* OpenSearchReader::read()
|
||||
engine->setImageUrl(readElementText());
|
||||
}
|
||||
|
||||
if (!engine->name().isEmpty()
|
||||
&& !engine->description().isEmpty()
|
||||
&& !engine->suggestionsUrlTemplate().isEmpty()
|
||||
&& !engine->searchUrlTemplate().isEmpty()
|
||||
&& !engine->imageUrl().isEmpty()) {
|
||||
if (!engine->name().isEmpty() &&
|
||||
!engine->description().isEmpty() &&
|
||||
!engine->suggestionsUrlTemplate().isEmpty() &&
|
||||
!engine->searchUrlTemplate().isEmpty() &&
|
||||
!engine->imageUrl().isEmpty()
|
||||
) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -223,9 +223,10 @@ void SearchEnginesManager::engineChangedImage()
|
||||
}
|
||||
|
||||
foreach (Engine e, m_allEngines) {
|
||||
if (e.name == engine->name() && e.url.contains(engine->searchUrl("%s").toString())
|
||||
&& !engine->image().isNull()) {
|
||||
|
||||
if (e.name == engine->name() &&
|
||||
e.url.contains(engine->searchUrl("%s").toString()) &&
|
||||
!engine->image().isNull()
|
||||
) {
|
||||
int index = m_allEngines.indexOf(e);
|
||||
if (index != -1) {
|
||||
m_allEngines[index].icon = QIcon(QPixmap::fromImage(engine->image()));
|
||||
|
@ -172,9 +172,10 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
||||
hr = pAAR->SetAppAsDefault(_appRegisteredName.toStdWString().c_str(),
|
||||
assocName.toStdWString().c_str(),
|
||||
AT_URLPROTOCOL);
|
||||
if (SUCCEEDED(hr)
|
||||
&& !currentUrlDefault.isEmpty()
|
||||
&& currentUrlDefault != _urlAssocHash.value(assocName)) {
|
||||
if (SUCCEEDED(hr) &&
|
||||
!currentUrlDefault.isEmpty() &&
|
||||
currentUrlDefault != _urlAssocHash.value(assocName)
|
||||
) {
|
||||
regCurrentUserRoot.setValue("Software/Classes"
|
||||
+ assocName
|
||||
+ "/shell/open/command/backup_progid", currentUrlDefault);
|
||||
@ -199,9 +200,10 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
||||
QString progId = _fileAssocHash.value(assocName);
|
||||
createProgId(progId);
|
||||
QString currentDefault = regClassesRoot.value(assocName + "/Default").toString();
|
||||
if (!currentDefault.isEmpty()
|
||||
&& currentDefault != progId
|
||||
&& regUserRoot.value(assocName + "/backup_val").toString() != progId) {
|
||||
if (!currentDefault.isEmpty() &&
|
||||
currentDefault != progId &&
|
||||
regUserRoot.value(assocName + "/backup_val").toString() != progId
|
||||
) {
|
||||
regUserRoot.setValue(assocName + "/backup_val", currentDefault);
|
||||
}
|
||||
regUserRoot.setValue(assocName + "/.", progId);
|
||||
@ -212,9 +214,10 @@ void RegisterQAppAssociation::registerAssociation(const QString &assocName, Asso
|
||||
createProgId(progId);
|
||||
QString currentDefault = regClassesRoot.value(assocName + "/shell/open/command/Default").toString();
|
||||
QString command = "\"" + _appPath + "\" \"%1\"";
|
||||
if (!currentDefault.isEmpty()
|
||||
&& currentDefault != command
|
||||
&& regUserRoot.value(assocName + "/shell/open/command/backup_val").toString() != command) {
|
||||
if (!currentDefault.isEmpty() &&
|
||||
currentDefault != command &&
|
||||
regUserRoot.value(assocName + "/shell/open/command/backup_val").toString() != command
|
||||
) {
|
||||
regUserRoot.setValue(assocName + "/shell/open/command/backup_val", currentDefault);
|
||||
}
|
||||
|
||||
|
@ -173,8 +173,10 @@ void Speller::populateContextMenu(QMenu* menu, const QWebHitTestResult &hitTest)
|
||||
{
|
||||
m_element = hitTest.element();
|
||||
|
||||
if (!m_enabled || m_element.isNull() ||
|
||||
m_element.attribute(QLatin1String("type")) == QLatin1String("password")) {
|
||||
if (!m_enabled ||
|
||||
m_element.isNull() ||
|
||||
m_element.attribute(QLatin1String("type")) == QLatin1String("password")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,9 @@ void PopupWebPage::checkBehaviour()
|
||||
// If so, we should open new window.
|
||||
// But not when all visibilities are false, it occurs with target=_blank links
|
||||
|
||||
if (!m_createNewWindow && (!m_menuBarVisible || !m_statusBarVisible || !m_toolBarVisible)
|
||||
&& !(!m_menuBarVisible && !m_statusBarVisible && !m_toolBarVisible)) {
|
||||
if (!m_createNewWindow && (!m_menuBarVisible || !m_statusBarVisible || !m_toolBarVisible) &&
|
||||
!(!m_menuBarVisible && !m_statusBarVisible && !m_toolBarVisible)
|
||||
) {
|
||||
m_createNewWindow = true;
|
||||
}
|
||||
|
||||
|
@ -979,7 +979,8 @@ bool TabBarHelper::isDisplayedOnViewPort(int globalLeft, int globalRight)
|
||||
|
||||
if (m_scrollArea) {
|
||||
if (globalRight < m_scrollArea->viewport()->mapToGlobal(QPoint(0, 0)).x() ||
|
||||
globalLeft > m_scrollArea->viewport()->mapToGlobal(m_scrollArea->viewport()->rect().topRight()).x()) {
|
||||
globalLeft > m_scrollArea->viewport()->mapToGlobal(m_scrollArea->viewport()->rect().topRight()).x()
|
||||
) {
|
||||
isVisible = false;
|
||||
}
|
||||
}
|
||||
|
@ -118,9 +118,9 @@ bool TabStackedWidget::eventFilter(QObject* obj, QEvent* event)
|
||||
void TabStackedWidget::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (((event->key() == Qt::Key_Tab || event->key() == Qt::Key_Backtab) &&
|
||||
count() > 1 && event->modifiers() & Qt::ControlModifier)
|
||||
count() > 1 && event->modifiers() & Qt::ControlModifier)
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
|| QApplication::keypadNavigationEnabled() && (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right) && count() > 1
|
||||
|| QApplication::keypadNavigationEnabled() && (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right) && count() > 1
|
||||
#endif
|
||||
) {
|
||||
int pageCount = count();
|
||||
@ -135,7 +135,7 @@ void TabStackedWidget::keyPressEvent(QKeyEvent* event)
|
||||
page += dx;
|
||||
if (page < 0
|
||||
#ifdef QT_KEYPAD_NAVIGATION
|
||||
&& !event->isAutoRepeat()
|
||||
&& !event->isAutoRepeat()
|
||||
#endif
|
||||
) {
|
||||
page = count() - 1;
|
||||
|
@ -470,65 +470,65 @@ bool QzTools::isUtf8(const char* string)
|
||||
const unsigned char* bytes = (const unsigned char*)string;
|
||||
while (*bytes) {
|
||||
if ((// ASCII
|
||||
bytes[0] == 0x09 ||
|
||||
bytes[0] == 0x0A ||
|
||||
bytes[0] == 0x0D ||
|
||||
(0x20 <= bytes[0] && bytes[0] <= 0x7F)
|
||||
)
|
||||
bytes[0] == 0x09 ||
|
||||
bytes[0] == 0x0A ||
|
||||
bytes[0] == 0x0D ||
|
||||
(0x20 <= bytes[0] && bytes[0] <= 0x7F)
|
||||
)
|
||||
) {
|
||||
bytes += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((// non-overlong 2-byte
|
||||
(0xC2 <= bytes[0] && bytes[0] <= 0xDF) &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0xBF)
|
||||
)
|
||||
(0xC2 <= bytes[0] && bytes[0] <= 0xDF) &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0xBF)
|
||||
)
|
||||
) {
|
||||
bytes += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((// excluding overlongs
|
||||
bytes[0] == 0xE0 &&
|
||||
(0xA0 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF)
|
||||
) ||
|
||||
(// straight 3-byte
|
||||
((0xE1 <= bytes[0] && bytes[0] <= 0xEC) ||
|
||||
bytes[0] == 0xEE ||
|
||||
bytes[0] == 0xEF) &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF)
|
||||
) ||
|
||||
(// excluding surrogates
|
||||
bytes[0] == 0xED &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0x9F) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF)
|
||||
)
|
||||
bytes[0] == 0xE0 &&
|
||||
(0xA0 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF)
|
||||
) ||
|
||||
(// straight 3-byte
|
||||
((0xE1 <= bytes[0] && bytes[0] <= 0xEC) ||
|
||||
bytes[0] == 0xEE ||
|
||||
bytes[0] == 0xEF) &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF)
|
||||
) ||
|
||||
(// excluding surrogates
|
||||
bytes[0] == 0xED &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0x9F) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF)
|
||||
)
|
||||
) {
|
||||
bytes += 3;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((// planes 1-3
|
||||
bytes[0] == 0xF0 &&
|
||||
(0x90 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF) &&
|
||||
(0x80 <= bytes[3] && bytes[3] <= 0xBF)
|
||||
) ||
|
||||
(// planes 4-15
|
||||
(0xF1 <= bytes[0] && bytes[0] <= 0xF3) &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF) &&
|
||||
(0x80 <= bytes[3] && bytes[3] <= 0xBF)
|
||||
) ||
|
||||
(// plane 16
|
||||
bytes[0] == 0xF4 &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0x8F) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF) &&
|
||||
(0x80 <= bytes[3] && bytes[3] <= 0xBF)
|
||||
)
|
||||
bytes[0] == 0xF0 &&
|
||||
(0x90 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF) &&
|
||||
(0x80 <= bytes[3] && bytes[3] <= 0xBF)
|
||||
) ||
|
||||
(// planes 4-15
|
||||
(0xF1 <= bytes[0] && bytes[0] <= 0xF3) &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF) &&
|
||||
(0x80 <= bytes[3] && bytes[3] <= 0xBF)
|
||||
) ||
|
||||
(// plane 16
|
||||
bytes[0] == 0xF4 &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0x8F) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF) &&
|
||||
(0x80 <= bytes[3] && bytes[3] <= 0xBF)
|
||||
)
|
||||
) {
|
||||
bytes += 4;
|
||||
continue;
|
||||
|
@ -948,7 +948,8 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
|
||||
// Hiding double Direction + Fonts menu (bug in QtWebKit 2.2)
|
||||
if (i <= 1 && act->menu()) {
|
||||
if (act->menu()->actions().contains(pageAction(QWebPage::SetTextDirectionDefault)) ||
|
||||
act->menu()->actions().contains(pageAction(QWebPage::ToggleBold))) {
|
||||
act->menu()->actions().contains(pageAction(QWebPage::ToggleBold))
|
||||
) {
|
||||
act->setVisible(false);
|
||||
}
|
||||
}
|
||||
@ -1526,9 +1527,10 @@ bool WebView::eventFilter(QObject* obj, QEvent* event)
|
||||
}
|
||||
|
||||
if (event->type() == QEvent::MouseButtonPress ||
|
||||
event->type() == QEvent::MouseButtonRelease ||
|
||||
event->type() == QEvent::MouseButtonDblClick ||
|
||||
event->type() == QEvent::MouseMove) {
|
||||
event->type() == QEvent::MouseButtonRelease ||
|
||||
event->type() == QEvent::MouseButtonDblClick ||
|
||||
event->type() == QEvent::MouseMove
|
||||
) {
|
||||
|
||||
QMouseEvent* ev = static_cast<QMouseEvent*>(event);
|
||||
|
||||
|
@ -187,9 +187,10 @@ void AKN_Handler::handleAccessKey(QKeyEvent* event)
|
||||
other = key.toLower();
|
||||
}
|
||||
|
||||
if (!other.isNull()
|
||||
&& m_accessKeyNodes.contains(other)
|
||||
&& !m_accessKeyNodes.contains(key)) {
|
||||
if (!other.isNull() &&
|
||||
m_accessKeyNodes.contains(other) &&
|
||||
!m_accessKeyNodes.contains(key)
|
||||
) {
|
||||
key = other;
|
||||
}
|
||||
|
||||
@ -253,8 +254,9 @@ void AKN_Handler::showAccessKeys()
|
||||
QList<QWebElement> result = page->currentFrame()->findAllElements(elementType).toList();
|
||||
foreach (const QWebElement &element, result) {
|
||||
const QRect geometry = element.geometry();
|
||||
if (geometry.size().isEmpty()
|
||||
|| !viewport.contains(geometry.topLeft())) {
|
||||
if (geometry.size().isEmpty() ||
|
||||
!viewport.contains(geometry.topLeft())
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
QString accessKeyAttribute = element.attribute(QLatin1String("accesskey")).toUpper();
|
||||
@ -284,10 +286,11 @@ void AKN_Handler::showAccessKeys()
|
||||
QWebElementCollection result = page->currentFrame()->findAllElements(elementType);
|
||||
foreach (const QWebElement &element, result) {
|
||||
const QRect geometry = element.geometry();
|
||||
if (unusedKeys.isEmpty()
|
||||
|| alreadyLabeled.contains(element)
|
||||
|| geometry.size().isEmpty()
|
||||
|| !viewport.contains(geometry.topLeft())) {
|
||||
if (unusedKeys.isEmpty() ||
|
||||
alreadyLabeled.contains(element) ||
|
||||
geometry.size().isEmpty() ||
|
||||
!viewport.contains(geometry.topLeft())
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
QChar accessKey;
|
||||
|
@ -80,7 +80,8 @@ bool MouseGestures::mousePress(QObject* obj, QMouseEvent* event)
|
||||
QWebFrame* frame = m_view.data()->page()->mainFrame();
|
||||
|
||||
if (frame->scrollBarGeometry(Qt::Vertical).contains(event->pos()) ||
|
||||
frame->scrollBarGeometry(Qt::Horizontal).contains(event->pos())) {
|
||||
frame->scrollBarGeometry(Qt::Horizontal).contains(event->pos())
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user