mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
[coverity] Followup fixes
webview.cpp: Fixed pointer to local outside scope bookmarksmodel.cpp: Unchecked return value
This commit is contained in:
parent
5b55d5b483
commit
aa6aea1399
|
@ -97,12 +97,10 @@ bool BookmarksModel::isBookmarked(const QUrl &url)
|
|||
query.prepare("SELECT count(id) FROM bookmarks WHERE url=?");
|
||||
query.bindValue(0, url.toString());
|
||||
|
||||
if (!query.exec()) {
|
||||
if (!query.exec() || !query.next()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
query.next();
|
||||
|
||||
return query.value(0).toInt() > 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1289,15 +1289,17 @@ void WebView::keyPressEvent(QKeyEvent* event)
|
|||
// Example: Key_Right within LTR layout triggers QWebPage::MoveToNextChar but,
|
||||
// Key_Right within RTL layout should trigger QWebPage::MoveToPreviousChar
|
||||
|
||||
if (eventKey == Qt::Key_Left || eventKey == Qt::Key_Right) {
|
||||
// event->spontaneous() check guards recursive calling of keyPressEvent
|
||||
// Events created from app have spontaneous() == false
|
||||
if (event->spontaneous() && (eventKey == Qt::Key_Left || eventKey == Qt::Key_Right)) {
|
||||
const QWebElement elementHasCursor = activeElement();
|
||||
if (!elementHasCursor.isNull()) {
|
||||
const QString direction = elementHasCursor.styleProperty("direction", QWebElement::ComputedStyle);
|
||||
if (direction == QLatin1String("rtl")) {
|
||||
eventKey = eventKey == Qt::Key_Left ? Qt::Key_Right : Qt::Key_Left;
|
||||
// FIXME: !!!!!!!!!!!!
|
||||
QKeyEvent ev(event->type(), eventKey, event->modifiers(), event->text(), event->isAutoRepeat());
|
||||
event = &ev;
|
||||
keyPressEvent(&ev);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user