Commit 49c680fd authored by Rafael Sadowski's avatar Rafael Sadowski
Browse files

Fix RTTI with clang

Clang's RTTI support don't work here, use qobject_cast<> to avoid
runtime crashes.
parent aabff9db
Pipeline #35402 passed with stage
in 19 minutes and 40 seconds
......@@ -45,6 +45,7 @@
#include <QMenuBar>
#include <QMimeDatabase>
#include <QMimeType>
#include <QObject>
#include <QScreen>
#include <QTabBar>
#include <QTabWidget>
......@@ -217,7 +218,7 @@ bool Shell::openDocument(const QUrl &url, const QString &serializedOptions)
KParts::ReadWritePart *const part = m_tabs[0].part;
// Return false if we can't open new tabs and the only part is occupied
if (!dynamic_cast<Okular::ViewerInterface *>(part)->openNewFilesInTabs() && !part->url().isEmpty() && !ShellUtils::unique(serializedOptions)) {
if (!qobject_cast<Okular::ViewerInterface *>(part)->openNewFilesInTabs() && !part->url().isEmpty() && !ShellUtils::unique(serializedOptions)) {
return false;
}
......@@ -237,7 +238,7 @@ bool Shell::canOpenDocs(int numDocs, int desktop)
return false;
KParts::ReadWritePart *const part = m_tabs[0].part;
const bool allowTabs = dynamic_cast<Okular::ViewerInterface *>(part)->openNewFilesInTabs();
const bool allowTabs = qobject_cast<Okular::ViewerInterface *>(part)->openNewFilesInTabs();
if (!allowTabs && (numDocs > 1 || !part->url().isEmpty()))
return false;
......@@ -259,7 +260,7 @@ void Shell::openUrl(const QUrl &url, const QString &serializedOptions)
applyOptionsToPart(activePart, serializedOptions);
activePart->openUrl(url);
} else {
if (dynamic_cast<Okular::ViewerInterface *>(activePart)->openNewFilesInTabs()) {
if (qobject_cast<Okular::ViewerInterface *>(activePart)->openNewFilesInTabs()) {
openNewTab(url, serializedOptions);
} else {
Shell *newShell = new Shell(serializedOptions);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment