Commit 273a5cba authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Port away from KNS::DownloadDialog

The newly introduced class wraps the QML components.
This way we do not need to use the about to be deprecated
QWidgets components and have a visually more pleasing dialog.
parent 08d1e4d3
......@@ -33,7 +33,12 @@
#include <QMimeDatabase>
#include <KRecentFilesAction>
#include <QStandardPaths>
#include <kns3/downloaddialog.h>
#include <knewstuff_version.h>
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 78, 0)
#include <KNS3/DownloadDialog>
#else
#include <KNS3/QtQuickDialogWrapper>
#endif
#include <kns3/uploaddialog.h>
#include <KEMailSettings>
#include <KMessageBox>
......@@ -540,13 +545,22 @@ void ParleyDocument::slotGHNS()
{
QMimeDatabase db;
QString fileName;
KNS3::DownloadDialog newStuffDialog(ParleyMainWindow::instance());
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 78, 0)
KNS3::DownloadDialog dialog(QStringLiteral("parley.knsrc"), q_ptr);
newStuffDialog.exec();
KNS3::Entry::List entries = newStuffDialog.installedEntries();
int numberInstalled = entries.size();
foreach (const KNS3::Entry & entry, entries) {
#else
const auto entries = KNS3::QtQuickDialogWrapper(QStringLiteral("parley.knsrc")).exec();
#endif
int numberInstalled = 0;
for (const auto &entry : entries) {
if (entry.status() != KNS3::Entry::Installed) {
continue;
}
++numberInstalled;
// check mime type and if kvtml, open it
foreach (const QString & file, entry.installedFiles()) {
const QStringList installedFiles = entry.installedFiles();
for (const QString &file : installedFiles) {
QMimeType mimeType = db.mimeTypeForFile(file);
qDebug() << "KNS2 file of mime type:" << db.mimeTypeForFile(file).name();
if (mimeType.inherits(QStringLiteral("application/x-kvtml"))) {
......
......@@ -21,7 +21,12 @@
#include <KLocalizedString>
#include <KConfigSkeleton>
#include <knewstuff_version.h>
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 78, 0)
#include <KNS3/DownloadDialog>
#else
#include <KNS3/QtQuickDialogWrapper>
#endif
#include <QDirIterator>
#include "ui_kgamethemeselector.h"
......@@ -212,10 +217,17 @@ void KGameThemeSelectorPrivate::_k_updateThemeList(const QString &strTheme)
void KGameThemeSelectorPrivate::_k_openKNewStuffDialog()
{
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 78, 0)
KNS3::DownloadDialog dialog(QStringLiteral("parley-themes.knsrc"), q_ptr);
dialog.exec();
if (!dialog.changedEntries().isEmpty())
findThemes(ui.kcfg_Theme->text());
#else
if (!KNS3::QtQuickDialogWrapper(QStringLiteral("parley-themes.knsrc")).exec().isEmpty()) {
// Only load the list if entries are changed
findThemes(ui.kcfg_Theme->text());
}
#endif
}
#include "moc_kgamethemeselector.cpp"
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