Commit 473eff07 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Fix compile error against qt6

parent 3fbe4e9d
......@@ -21,21 +21,22 @@
int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/**
* enable high dpi support
*/
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
#endif
QApplication app(argc, argv);
KLocalizedString::setApplicationDomain("filelight");
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Kdelibs4ConfigMigrator migrate(QStringLiteral("filelight"));
migrate.setConfigFiles(QStringList() << QStringLiteral("filelightrc"));
migrate.setUiFiles(QStringList() << QStringLiteral("filelightui.rc"));
migrate.migrate();
#endif
auto config = KSharedConfig::openConfig();
auto stateConfig = KSharedConfig::openStateConfig();
if (config->hasGroup("general")) {
......
......@@ -84,7 +84,11 @@ protected:
void mousePressEvent(QMouseEvent*) override;
void paintEvent(QPaintEvent*) override;
void resizeEvent(QResizeEvent*) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void enterEvent(QEnterEvent *event) override;
#else
void enterEvent(QEvent*) override;
#endif
void leaveEvent(QEvent*) override;
protected:
......
......@@ -16,12 +16,11 @@
#include <KIO//DeleteJob>
#include <KMessageBox> //::mousePressEvent()
#include <QMenu> //::mousePressEvent()
#include <KToolInvocation>
#include <KTerminalLauncherJob>
#include <QUrl>
#include <KIO/JobUiDelegate>
#include <KIO/OpenUrlJob>
#include <KLocalizedString>
#include <kio_version.h>
#include <QApplication> //QApplication::setOverrideCursor()
#include <QClipboard>
......@@ -235,8 +234,11 @@ void RadialMap::Widget::mouseMoveEvent(QMouseEvent *e)
Q_EMIT mouseHover(m_focus->file()->displayPath());
update();
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void RadialMap::Widget::enterEvent(QEnterEvent *event)
#else
void RadialMap::Widget::enterEvent(QEvent *)
#endif
{
if (!m_focus) return;
......@@ -337,7 +339,10 @@ void RadialMap::Widget::mousePressEvent(QMouseEvent *e)
} else if (rescanAction && clicked == rescanAction) {
Q_EMIT rescanRequested(url);
} else if (openTerminal && clicked == openTerminal) {
KToolInvocation::invokeTerminal(QString(), QStringList(), url.path());
KTerminalLauncherJob *job = new KTerminalLauncherJob(QString(), this);
job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->setWorkingDirectory(url.path());
job->start();
} else if (centerMap && clicked == centerMap) {
Q_EMIT activated(url); //activate first, this will cause UI to prepare itself
createFromCache((Folder *)m_focus->file());
......
......@@ -99,8 +99,11 @@ bool ScanManager::start(const QUrl &url)
//find a pointer to the requested branch
qCDebug(FILELIGHT_LOG) << "Cache-(a)hit: " << cachePath;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QVector<QStringRef> split = path.midRef(cachePath.length()).split(QLatin1Char('/'));
#else
QVector<QStringView> split = QStringView(path).mid(cachePath.length()).split(QLatin1Char('/'));
#endif
Folder *d = folder;
while (!split.isEmpty() && d != nullptr) { //if NULL we have got lost so abort!!
......@@ -194,8 +197,11 @@ void ScanManager::invalidateCacheFor(const QUrl &url)
if (!path.startsWith(cachePath)) {
continue;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QVector<QStringRef> splitPath = path.midRef(cachePath.length()).split(QLatin1Char('/'));
#else
QVector<QStringView> splitPath = QStringView(path).mid(cachePath.length()).split(QLatin1Char('/'));
#endif
Folder *d = folder;
while (!splitPath.isEmpty() && d != nullptr) { //if NULL we have got lost so abort!!
......
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