[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kbibtex] src: Avoid calling KRun::runUrl with signature deprecated since KF 5.31
From: Thomas Fischer <null () kde ! org>
Date: 2017-03-31 21:56:22
Message-ID: E1cu4Ws-0004Se-93 () code ! kde ! org
[Download RAW message or body]
Git commit a8e5ce03d432eb5fa9176001b2c191da8a36f4ff by Thomas Fischer.
Committed on 31/03/2017 at 19:29.
Pushed by thomasfischer into branch 'master'.
Avoid calling KRun::runUrl with signature deprecated since KF 5.31
A preprocessor directive checks if the code is compiled against
KDE Frameworks 5.31 and later -or- an earlier version. KF 5.31
introduced a new variant of KRun::runUrl with different arguments
and deprecated the old variant at the same time.
Using one or the other version, depending on used KF5 version
avoids warnings during compilation time.
M +5 -0 src/gui/element/elementwidgets.cpp
M +11 -2 src/gui/element/findpdfui.cpp
M +5 -0 src/gui/field/fieldlineedit.cpp
M +6 -1 src/networking/zotero/oauthwizard.cpp
M +9 -0 src/parts/part.cpp
M +9 -0 src/program/docklets/documentpreview.cpp
M +5 -0 src/program/docklets/referencepreview.cpp
M +5 -0 src/program/docklets/searchform.cpp
https://commits.kde.org/kbibtex/a8e5ce03d432eb5fa9176001b2c191da8a36f4ff
diff --git a/src/gui/element/elementwidgets.cpp b/src/gui/element/elementwidgets.cpp
index a27676f9..9e6003f4 100644
--- a/src/gui/element/elementwidgets.cpp
+++ b/src/gui/element/elementwidgets.cpp
@@ -37,6 +37,7 @@
#include <KComboBox>
#include <KRun>
#include <KTextEdit>
+#include <kio_version.h>
#include "idsuggestions.h"
#include "fileinfo.h"
@@ -856,7 +857,11 @@ void OtherFieldsWidget::actionOpen()
QMimeType mimeType = FileInfo::mimeTypeForUrl(currentUrl);
const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
+#if KIO_VERSION < 0x051f00 // < 5.31.0
KRun::runUrl(currentUrl, mimeTypeName, this, false, false);
+#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(currentUrl, mimeTypeName, this, KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
}
diff --git a/src/gui/element/findpdfui.cpp b/src/gui/element/findpdfui.cpp
index 55ec9014..9251134a 100644
--- a/src/gui/element/findpdfui.cpp
+++ b/src/gui/element/findpdfui.cpp
@@ -42,6 +42,7 @@
#include <KIconLoader>
#include <KSqueezedTextLabel>
#include <KRun>
+#include <kio_version.h>
#include "fileinfo.h"
#include "fieldlistedit.h"
@@ -232,13 +233,21 @@ void PDFItemDelegate::slotViewPDF()
QMimeType mimeType = FileInfo::mimeTypeForUrl(tempUrl);
const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
- KRun::runUrl(tempUrl, mimeTypeName, nullptr, false, false, \
url.toDisplayString()); +#if KIO_VERSION < 0x051f00 // < 5.31.0
+ KRun::runUrl(tempUrl, mimeTypeName, itemView(), false, false, \
url.toDisplayString()); +#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(tempUrl, mimeTypeName, itemView(), KRun::RunFlags(), \
url.toDisplayString()); +#endif // KIO_VERSION < 0x051f00
} else if (url.isValid()) {
/// Guess mime type for url to open
QMimeType mimeType = FileInfo::mimeTypeForUrl(url);
const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
- KRun::runUrl(url, mimeTypeName, nullptr, false, false);
+#if KIO_VERSION < 0x051f00 // < 5.31.0
+ KRun::runUrl(url, mimeTypeName, itemView(), false, false);
+#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(url, mimeTypeName, itemView(), KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
}
}
diff --git a/src/gui/field/fieldlineedit.cpp b/src/gui/field/fieldlineedit.cpp
index 6d10149f..98228bf2 100644
--- a/src/gui/field/fieldlineedit.cpp
+++ b/src/gui/field/fieldlineedit.cpp
@@ -38,6 +38,7 @@
#include <KLocalizedString>
#include <KSharedConfig>
#include <KConfigGroup>
+#include <kio_version.h>
#include "fileinfo.h"
#include "file.h"
@@ -308,7 +309,11 @@ public:
QMimeType mimeType = FileInfo::mimeTypeForUrl(urlToOpen);
const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
+#if KIO_VERSION < 0x051f00 // < 5.31.0
KRun::runUrl(urlToOpen, mimeTypeName, parent, false, false);
+#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(urlToOpen, mimeTypeName, parent, KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
}
diff --git a/src/networking/zotero/oauthwizard.cpp \
b/src/networking/zotero/oauthwizard.cpp index 2583d8e9..aca03049 100644
--- a/src/networking/zotero/oauthwizard.cpp
+++ b/src/networking/zotero/oauthwizard.cpp
@@ -30,6 +30,7 @@
#include <KLocalizedString>
#include <KLineEdit>
#include <KRun>
+#include <kio_version.h>
#include "internalnetworkaccessmanager.h"
#include "logging_networking.h"
@@ -296,7 +297,11 @@ void OAuthWizard::copyAuthorizationUrl()
void OAuthWizard::openAuthorizationUrl()
{
- KRun::runUrl(QUrl(d->lineEditAuthorizationUrl->text()), \
QStringLiteral("text/html"), this); +#if KIO_VERSION < 0x051f00 // < 5.31.0
+ KRun::runUrl(QUrl(d->lineEditAuthorizationUrl->text()), \
QStringLiteral("text/html"), this, false, false); +#else // KIO_VERSION < 0x051f00 // \
>= 5.31.0 + KRun::runUrl(QUrl(d->lineEditAuthorizationUrl->text()), \
> QStringLiteral("text/html"), this, KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
#include "oauthwizard.moc"
diff --git a/src/parts/part.cpp b/src/parts/part.cpp
index dc9bc24e..acb0f28d 100644
--- a/src/parts/part.cpp
+++ b/src/parts/part.cpp
@@ -51,6 +51,7 @@
#include <KIO/CopyJob>
#include <KIO/Job>
#include <KJobWidgets>
+#include <kio_version.h>
#include "file.h"
#include "macro.h"
@@ -893,7 +894,11 @@ void KBibTeXPart::elementViewDocument()
QMimeType mimeType = FileInfo::mimeTypeForUrl(url);
const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
+#if KIO_VERSION < 0x051f00 // < 5.31.0
KRun::runUrl(url, mimeTypeName, widget(), false, false);
+#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(url, mimeTypeName, widget(), KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
}
@@ -906,7 +911,11 @@ void KBibTeXPart::elementViewDocumentMenu(QObject *obj)
QMimeType mimeType = FileInfo::mimeTypeForUrl(url);
const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
+#if KIO_VERSION < 0x051f00 // < 5.31.0
KRun::runUrl(url, mimeTypeName, widget(), false, false);
+#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(url, mimeTypeName, widget(), KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
void KBibTeXPart::elementFindPDF()
diff --git a/src/program/docklets/documentpreview.cpp \
b/src/program/docklets/documentpreview.cpp index 8317d860..39c4d02a 100644
--- a/src/program/docklets/documentpreview.cpp
+++ b/src/program/docklets/documentpreview.cpp
@@ -59,6 +59,7 @@
#include <KActionCollection>
#include <KSharedConfig>
#include <KConfigGroup>
+#include <kio_version.h>
#include "kbibtex.h"
#include "element.h"
@@ -533,7 +534,11 @@ public:
QMimeType mimeType = FileInfo::mimeTypeForUrl(url);
const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
+#if KIO_VERSION < 0x051f00 // < 5.31.0
KRun::runUrl(url, mimeTypeName, p, false, false);
+#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(url, mimeTypeName, p, KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
UrlInfo urlMetaInfo(const QUrl &url) {
@@ -694,7 +699,11 @@ void DocumentPreview::linkActivated(const QString &link)
QMimeType mimeType = FileInfo::mimeTypeForUrl(urlToOpen);
const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
+#if KIO_VERSION < 0x051f00 // < 5.31.0
KRun::runUrl(urlToOpen, mimeTypeName, this, false, false);
+#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(urlToOpen, mimeTypeName, this, KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
}
}
diff --git a/src/program/docklets/referencepreview.cpp \
b/src/program/docklets/referencepreview.cpp index 753912e4..f306798d 100644
--- a/src/program/docklets/referencepreview.cpp
+++ b/src/program/docklets/referencepreview.cpp
@@ -44,6 +44,7 @@
#include <KSharedConfig>
#include <KConfigGroup>
#include <KTextEdit>
+#include <kio_version.h>
#include "fileexporterbibtex.h"
#include "fileexporterbibtex2html.h"
@@ -382,7 +383,11 @@ void ReferencePreview::openAsHTML()
/// Ask KDE subsystem to open url in viewer matching mime type
QUrl url(file.fileName());
+#if KIO_VERSION < 0x051f00 // < 5.31.0
KRun::runUrl(url, QStringLiteral("text/html"), this, false, false);
+#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(url, QStringLiteral("text/html"), this, KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
void ReferencePreview::saveAsHTML()
diff --git a/src/program/docklets/searchform.cpp \
b/src/program/docklets/searchform.cpp index a3b605dd..d272f548 100644
--- a/src/program/docklets/searchform.cpp
+++ b/src/program/docklets/searchform.cpp
@@ -43,6 +43,7 @@
#include <KParts/ReadOnlyPart>
#include <KConfigGroup>
#include <KSharedConfig>
+#include <kio_version.h>
#include "element.h"
#include "file.h"
@@ -332,7 +333,11 @@ public:
QMimeType mimeType = FileInfo::mimeTypeForUrl(url);
const QString mimeTypeName = mimeType.name();
/// Ask KDE subsystem to open url in viewer matching mime type
+#if KIO_VERSION < 0x051f00 // < 5.31.0
KRun::runUrl(url, mimeTypeName, p, false, false);
+#else // KIO_VERSION < 0x051f00 // >= 5.31.0
+ KRun::runUrl(url, mimeTypeName, p, KRun::RunFlags());
+#endif // KIO_VERSION < 0x051f00
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic