mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
[coverity] Fixes for issues found by scan.coverity.com
This commit is contained in:
parent
222137e93b
commit
260447e414
1
src/lib/3rdparty/fancytabwidget.cpp
vendored
1
src/lib/3rdparty/fancytabwidget.cpp
vendored
@ -248,6 +248,7 @@ void FancyTab::setFader(float value)
|
||||
|
||||
FancyTabBar::FancyTabBar(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_currentIndex(-1)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
|
||||
//setStyle(new QWindowsStyle);
|
||||
|
2
src/lib/3rdparty/processinfo.cpp
vendored
2
src/lib/3rdparty/processinfo.cpp
vendored
@ -61,7 +61,7 @@ bool ProcessInfo::IsNumeric(const char* ccharptr_CharacterList) const
|
||||
|
||||
pid_t ProcessInfo::GetPIDbyName(const char* cchrptr_ProcessName) const
|
||||
{
|
||||
char chrarry_CommandLinePath[100] ;
|
||||
char chrarry_CommandLinePath[260] ;
|
||||
char chrarry_NameOfProcess[300] ;
|
||||
char* chrptr_StringToCompare = NULL ;
|
||||
pid_t pid_ProcessIdentifier = (pid_t) - 1 ;
|
||||
|
@ -86,6 +86,7 @@ MainApplication::MainApplication(int &argc, char** argv)
|
||||
, m_networkmanager(0)
|
||||
, m_cookiejar(0)
|
||||
, m_rssmanager(0)
|
||||
, m_plugins(0)
|
||||
, m_bookmarksModel(0)
|
||||
, m_downloadManager(0)
|
||||
, m_autofill(0)
|
||||
|
@ -81,7 +81,10 @@ bool AutoFill::isStoringEnabled(const QUrl &url)
|
||||
query.prepare("SELECT count(id) FROM autofill_exceptions WHERE server=?");
|
||||
query.addBindValue(server);
|
||||
query.exec();
|
||||
query.next();
|
||||
|
||||
if (!query.next()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return query.value(0).toInt() <= 0;
|
||||
}
|
||||
|
@ -88,8 +88,6 @@ private:
|
||||
bool m_askPasswordDialogVisible;
|
||||
bool m_askMasterPassword;
|
||||
QByteArray m_masterPassword;
|
||||
|
||||
MasterPasswordDialog* m_masterPasswordDialog;
|
||||
};
|
||||
|
||||
namespace Ui
|
||||
|
@ -96,8 +96,13 @@ bool BookmarksModel::isBookmarked(const QUrl &url)
|
||||
QSqlQuery query;
|
||||
query.prepare("SELECT count(id) FROM bookmarks WHERE url=?");
|
||||
query.bindValue(0, url.toString());
|
||||
query.exec();
|
||||
|
||||
if (!query.exec()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
query.next();
|
||||
|
||||
return query.value(0).toInt() > 0;
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ BookmarksImportDialog::BookmarksImportDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::BookmarksImportDialog)
|
||||
, m_currentPage(0)
|
||||
, m_browser(Firefox)
|
||||
, m_fetcher(0)
|
||||
, m_fetcherThread(0)
|
||||
{
|
||||
|
@ -48,6 +48,7 @@ DownloadFileHelper::DownloadFileHelper(const QString &lastDownloadPath, const QS
|
||||
, m_useNativeDialog(useNativeDialog)
|
||||
, m_timer(0)
|
||||
, m_reply(0)
|
||||
, m_fileSize(0)
|
||||
, m_openFileChoosed(false)
|
||||
, m_listWidget(0)
|
||||
, m_iconProvider(new QFileIconProvider)
|
||||
|
@ -38,6 +38,7 @@ DownloadManager::DownloadManager(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::DownloadManager)
|
||||
, m_isClosing(false)
|
||||
, m_lastDownloadOption(NoOption)
|
||||
{
|
||||
setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
|
||||
ui->setupUi(this);
|
||||
|
@ -42,7 +42,7 @@ class QT_QUPZILLA_EXPORT DownloadManager : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum DownloadOption { OpenFile, SaveFile, ExternalManager };
|
||||
enum DownloadOption { OpenFile, SaveFile, ExternalManager, NoOption };
|
||||
|
||||
struct DownloadInfo {
|
||||
WebPage* page;
|
||||
|
@ -146,8 +146,10 @@ void History::deleteHistoryEntry(const QList<int> &list)
|
||||
QSqlQuery query;
|
||||
query.prepare("SELECT count, date, url, title FROM history WHERE id=?");
|
||||
query.addBindValue(index);
|
||||
query.exec();
|
||||
query.next();
|
||||
|
||||
if (!query.exec() || !query.next()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
HistoryEntry entry;
|
||||
entry.id = index;
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
class QIcon;
|
||||
|
||||
class QupZilla;
|
||||
class WebView;
|
||||
class HistoryModel;
|
||||
|
||||
@ -79,8 +78,6 @@ signals:
|
||||
|
||||
private:
|
||||
bool m_isSaving;
|
||||
|
||||
QupZilla* p_QupZilla;
|
||||
HistoryModel* m_model;
|
||||
};
|
||||
|
||||
|
@ -174,6 +174,7 @@ bool LocationCompleterView::eventFilter(QObject* object, QEvent* event)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,6 +31,7 @@ CaBundleUpdater::CaBundleUpdater(NetworkManager* manager, QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_manager(manager)
|
||||
, m_progress(Start)
|
||||
, m_reply(0)
|
||||
, m_latestBundleVersion(0)
|
||||
{
|
||||
m_bundleVersionFileName = mApp->PROFILEDIR + "certificates/bundle_version";
|
||||
|
@ -67,6 +67,7 @@ NetworkProxyFactory::NetworkProxyFactory()
|
||||
, m_proxyType(QNetworkProxy::HttpProxy)
|
||||
, m_port(0)
|
||||
, m_httpsPort(0)
|
||||
, m_useDifferentProxyForHttps(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,10 @@
|
||||
#include <QNetworkReply>
|
||||
|
||||
Updater::Version::Version(const QString &s)
|
||||
: isValid(false)
|
||||
, majorVersion(-1)
|
||||
, minorVersion(-1)
|
||||
, revisionNumber(-1)
|
||||
{
|
||||
isValid = false;
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QWebPage> // QTWEBKIT_VERSION_CHECK macro
|
||||
|
||||
UserAgentManager::UserAgentManager()
|
||||
: m_usePerDomainUserAgent(false)
|
||||
{
|
||||
m_fakeUserAgent = QString("Mozilla/5.0 (%1) AppleWebKit/%2 (KHTML, like Gecko) Chrome/10.0 Safari/%2").arg(QzTools::operatingSystem(), QupZilla::WEBKITVERSION);
|
||||
}
|
||||
|
@ -185,8 +185,7 @@ void ClickToFlash::findElement()
|
||||
|
||||
QList<QWebFrame*> frames;
|
||||
frames.append(objectFrame);
|
||||
m_mainFrame = view->page()->mainFrame();
|
||||
frames.append(m_mainFrame);
|
||||
frames.append(view->page()->mainFrame());
|
||||
|
||||
while (!frames.isEmpty()) {
|
||||
QWebFrame* frame = frames.takeFirst();
|
||||
|
@ -81,7 +81,6 @@ private:
|
||||
QStringList m_argumentNames;
|
||||
QStringList m_argumentValues;
|
||||
QWebElement m_element;
|
||||
QWebFrame* m_mainFrame;
|
||||
|
||||
QToolButton* m_toolButton;
|
||||
QHBoxLayout* m_layout1;
|
||||
|
@ -40,6 +40,8 @@ Speller::Speller(QObject* parent)
|
||||
, m_textCodec(0)
|
||||
, m_hunspell(0)
|
||||
, m_enabled(false)
|
||||
, m_startPos(0)
|
||||
, m_endPos(0)
|
||||
{
|
||||
loadSettings();
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ SpeedDial::SpeedDial(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_maxPagesInRow(4)
|
||||
, m_sizeOfSpeedDials(231)
|
||||
, m_sdcentered(false)
|
||||
, m_loaded(false)
|
||||
, m_regenerateScript(true)
|
||||
{
|
||||
|
@ -106,6 +106,7 @@ void ThemeManager::currentChanged()
|
||||
ThemeManager::Theme ThemeManager::parseTheme(const QString &path, const QString &name)
|
||||
{
|
||||
Theme info;
|
||||
info.isValid = false;
|
||||
|
||||
if (!QFile(path + "main.css").exists() || !QFile(path + "theme.info").exists()) {
|
||||
info.isValid = false;
|
||||
|
@ -180,6 +180,10 @@ void UserAgentDialog::enablePerSiteFrame(bool enable)
|
||||
|
||||
bool UserAgentDialog::showEditDialog(const QString &title, QString* rSite, QString* rUserAgent)
|
||||
{
|
||||
if (!rSite || !rUserAgent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QDialog* dialog = new QDialog(this);
|
||||
QFormLayout* layout = new QFormLayout(dialog);
|
||||
QLineEdit* editSite = new QLineEdit(dialog);
|
||||
@ -199,13 +203,11 @@ bool UserAgentDialog::showEditDialog(const QString &title, QString* rSite, QStri
|
||||
layout->addRow(new QLabel(tr("User Agent: ")), editAgent);
|
||||
layout->addRow(box);
|
||||
|
||||
if (rSite && rUserAgent) {
|
||||
editSite->setText(*rSite);
|
||||
editAgent->lineEdit()->setText(*rUserAgent);
|
||||
editSite->setText(*rSite);
|
||||
editAgent->lineEdit()->setText(*rUserAgent);
|
||||
|
||||
editSite->setFocus();
|
||||
editAgent->lineEdit()->setCursorPosition(0);
|
||||
}
|
||||
editSite->setFocus();
|
||||
editAgent->lineEdit()->setCursorPosition(0);
|
||||
|
||||
dialog->setWindowTitle(title);
|
||||
dialog->setMinimumSize(550, 100);
|
||||
|
@ -24,6 +24,7 @@ AnimatedWidget::AnimatedWidget(const Direction &direction, int duration, QWidget
|
||||
, m_direction(direction)
|
||||
, m_stepHeight(0)
|
||||
, m_stepY(0)
|
||||
, m_startY(0)
|
||||
, m_widget(new QWidget(this))
|
||||
{
|
||||
m_timeLine.setDuration(duration);
|
||||
|
@ -45,6 +45,8 @@ void ClosedTabsManager::saveView(WebTab* tab, int position)
|
||||
ClosedTabsManager::Tab ClosedTabsManager::getFirstClosedTab()
|
||||
{
|
||||
Tab tab;
|
||||
tab.position = -1;
|
||||
|
||||
if (m_closedTabs.count() > 0) {
|
||||
tab = m_closedTabs.first();
|
||||
m_closedTabs.remove(0);
|
||||
@ -56,6 +58,8 @@ ClosedTabsManager::Tab ClosedTabsManager::getFirstClosedTab()
|
||||
ClosedTabsManager::Tab ClosedTabsManager::getTabAt(int index)
|
||||
{
|
||||
Tab tab;
|
||||
tab.position = -1;
|
||||
|
||||
if (QzTools::vectorContainsIndex(m_closedTabs, index)) {
|
||||
tab = m_closedTabs.at(index);
|
||||
m_closedTabs.remove(index);
|
||||
|
@ -24,6 +24,7 @@ HeaderView::HeaderView(QAbstractItemView* parent)
|
||||
: QHeaderView(Qt::Horizontal, parent)
|
||||
, m_parent(parent)
|
||||
, m_menu(0)
|
||||
, m_resizeOnShow(false)
|
||||
{
|
||||
#if QT_VERSION >= 0x050000
|
||||
setSectionsMovable(true);
|
||||
|
@ -103,7 +103,7 @@ void TreeWidget::setMimeType(const QString &mimeType)
|
||||
m_mimeType = mimeType;
|
||||
}
|
||||
|
||||
Qt::DropActions TreeWidget::supportedDropActions()
|
||||
Qt::DropActions TreeWidget::supportedDropActions() const
|
||||
{
|
||||
return Qt::CopyAction;
|
||||
}
|
||||
@ -193,7 +193,7 @@ bool TreeWidget::dropMimeData(QTreeWidgetItem* parent, int,
|
||||
bool parentIsRoot = item->data(0, ITEM_IS_TOPLEVEL).toBool();
|
||||
QString oldParentTitle = item->data(0, ITEM_PARENT_TITLE).toString();
|
||||
|
||||
bool isFolder = (item && item->text(1).isEmpty());
|
||||
bool isFolder = item->text(1).isEmpty();
|
||||
if (isFolder && (item->text(0) == _bookmarksMenu ||
|
||||
item->text(0) == _bookmarksToolbar)) {
|
||||
continue;
|
||||
|
@ -67,7 +67,7 @@ private:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void iterateAllItems(QTreeWidgetItem* parent);
|
||||
|
||||
Qt::DropActions supportedDropActions();
|
||||
Qt::DropActions supportedDropActions() const;
|
||||
QStringList mimeTypes() const;
|
||||
QMimeData* mimeData(const QList<QTreeWidgetItem*> items) const;
|
||||
bool dropMimeData(QTreeWidgetItem* parent, int, const QMimeData* data, Qt::DropAction action);
|
||||
|
@ -33,7 +33,6 @@ class QTreeWidgetItem;
|
||||
|
||||
class WebView;
|
||||
class CertificateInfoWidget;
|
||||
class ListItemDelegate;
|
||||
|
||||
class QT_QUPZILLA_EXPORT SiteInfo : public QDialog
|
||||
{
|
||||
@ -58,7 +57,6 @@ private:
|
||||
Ui::SiteInfo* ui;
|
||||
CertificateInfoWidget* m_certWidget;
|
||||
WebView* m_view;
|
||||
ListItemDelegate* m_delegate;
|
||||
|
||||
QPixmap m_activePixmap;
|
||||
QUrl m_baseUrl;
|
||||
|
@ -46,6 +46,7 @@ TabBar::TabBar(QupZilla* mainClass, TabWidget* tabWidget)
|
||||
, m_tabWidget(tabWidget)
|
||||
, m_tabPreview(new TabPreview(mainClass, mainClass))
|
||||
, m_showTabPreviews(false)
|
||||
, m_hideTabBarWithOneTab(false)
|
||||
, m_clickedTab(0)
|
||||
, m_normalTabWidth(0)
|
||||
, m_activeTabWidth(0)
|
||||
|
@ -752,6 +752,10 @@ void TabWidget::restoreClosedTab(QObject* obj)
|
||||
tab = m_closedTabsManager->getFirstClosedTab();
|
||||
}
|
||||
|
||||
if (tab.position < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int index = addView(QUrl(), tab.title, Qz::NT_CleanSelectedTab, false, tab.position);
|
||||
WebTab* webTab = weTab(index);
|
||||
webTab->p_restoreTab(tab.url, tab.history);
|
||||
|
@ -326,6 +326,7 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
|
||||
dManager->handleUnsupportedContent(reply, this);
|
||||
return;
|
||||
}
|
||||
// Falling unsupported content with invalid ContentTypeHeader to be handled as UnknownProtocol
|
||||
|
||||
case QNetworkReply::ProtocolUnknownError: {
|
||||
if (url.scheme() == QLatin1String("file")) {
|
||||
|
@ -1295,6 +1295,7 @@ void WebView::keyPressEvent(QKeyEvent* event)
|
||||
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;
|
||||
}
|
||||
|
@ -34,12 +34,14 @@
|
||||
GM_Downloader::GM_Downloader(const QNetworkRequest &request, GM_Manager* manager)
|
||||
: QObject()
|
||||
, m_manager(manager)
|
||||
, m_widget(0)
|
||||
{
|
||||
m_reply = new FollowRedirectReply(request.url(), mApp->networkManager());
|
||||
connect(m_reply, SIGNAL(finished()), this, SLOT(scriptDownloaded()));
|
||||
|
||||
QVariant v = request.attribute((QNetworkRequest::Attribute)(QNetworkRequest::User + 100));
|
||||
WebPage* webPage = static_cast<WebPage*>(v.value<void*>());
|
||||
|
||||
if (WebPage::isPointerSafeToUse(webPage)) {
|
||||
m_widget = webPage->view();
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ PluginSpec GM_Plugin::pluginSpec()
|
||||
spec.name = "GreaseMonkey";
|
||||
spec.info = "Userscripts for QupZilla";
|
||||
spec.description = "Provides support for userscripts (www.userscripts.org)";
|
||||
spec.version = "0.4.2";
|
||||
spec.version = "0.4.3";
|
||||
spec.author = "David Rosca <nowrep@gmail.com>";
|
||||
spec.icon = QPixmap(":gm/data/icon.png");
|
||||
spec.hasSettings = true;
|
||||
|
@ -133,28 +133,28 @@ bool QjtMouseGestureFilter::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
case QEvent::MouseButtonPress:
|
||||
if (mouseButtonPressEvent(dynamic_cast<QMouseEvent*>(event), obj)) {
|
||||
if (mouseButtonPressEvent(static_cast<QMouseEvent*>(event), obj)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case QEvent::MouseButtonRelease:
|
||||
if (mouseButtonReleaseEvent(dynamic_cast<QMouseEvent*>(event), obj)) {
|
||||
if (mouseButtonReleaseEvent(static_cast<QMouseEvent*>(event), obj)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case QEvent::MouseMove:
|
||||
if (mouseMoveEvent(dynamic_cast<QMouseEvent*>(event), obj)) {
|
||||
if (mouseMoveEvent(static_cast<QMouseEvent*>(event), obj)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case QEvent::Paint:
|
||||
if (paintEvent(obj, dynamic_cast<QPaintEvent*>(event))) {
|
||||
if (paintEvent(obj, static_cast<QPaintEvent*>(event))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user