X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=src%2Fwidgets%2FTabWidget.cpp;h=05f10d23b970520b50a919e59cd3146c1b5cd3e2;hb=75a38db8a253d1458aaa5a2811afb58bc4eb7855;hp=cbb84b3dfe3c9d9f081da5870c48d662b1dbe039;hpb=efed1601e5f6e79d746866d55d625d777b64a248;p=PrivacyBrowserPC.git diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index cbb84b3..05f10d2 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -47,7 +47,7 @@ QString TabWidget::webEngineDefaultUserAgent = QLatin1String(""); // Construct the class. -TabWidget::TabWidget(QWidget *parent) : QWidget(parent) +TabWidget::TabWidget(QWidget *windowPointer) : QWidget(windowPointer) { // Create a QProcess to check if KDE is running. QProcess *checkIfRunningKdeQProcessPointer = new QProcess(); @@ -94,6 +94,9 @@ TabWidget::TabWidget(QWidget *parent) : QWidget(parent) // Set the loading favorite icon movie file name. loadingFavoriteIconMoviePointer->setFileName(QStringLiteral(":/icons/loading.gif")); + // Stop the loading favorite icon movie if the window is destroyed. Otherwise, the app will crash if there is more than one window open and a window is closed while at tab is loading. + connect(windowPointer, SIGNAL(destroyed()), this, SLOT(stopLoadingFavoriteIconMovie())); + // Add the first tab. addFirstTab(); @@ -741,6 +744,12 @@ void TabWidget::pageLinkHovered(const QString &linkUrl) const emit linkHovered(linkUrl); } +void TabWidget::stopLoadingFavoriteIconMovie() const +{ + // Stop the loading favorite icon movie. Otherwise, the browser will crash if a second window is closed while a tab in it is loading. + loadingFavoriteIconMoviePointer->stop(); +} + void TabWidget::print() const { // Create a printer. @@ -1103,7 +1112,8 @@ void TabWidget::useNativeKdeDownloader(QUrl &downloadUrl, QString &suggestedFile // Create a file copy job. `-1` creates the file with default permissions. KIO::FileCopyJob *fileCopyJobPointer = KIO::file_copy(downloadUrl, saveLocation, -1, KIO::Overwrite); - // Set the download job to display any error messages. + // Set the download job to display any warning and error messages. + fileCopyJobPointer->uiDelegate()->setAutoWarningHandlingEnabled(true); fileCopyJobPointer->uiDelegate()->setAutoErrorHandlingEnabled(true); // Start the download.