Provide other functions to localized ~/Videos, ~/Music, etc with QStandardPaths
AbandonedPublic

Authored by Zren on Mar 24 2017, 10:18 PM.

Details

Reviewers
hein
Summary

In TiledMenu, I need access to the localized home directories so I can link to the right folders in the bottom left area above the power icon.

I've yet to try compiling plasma-desktop yet, but I compiled the exact same systemsettings.cpp/.h in a smaller cmake project/qml plugin, and tested the functions in a QML file.

Diff Detail

Repository
R119 Plasma Desktop
Lint
Lint Skipped
Unit
Unit Tests Skipped
Zren created this revision.Mar 24 2017, 10:18 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 24 2017, 10:18 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
hein edited edge metadata.Mar 24 2017, 10:23 PM

Instead of having lots of invokables, it would probably be nicer to just register the enum and make one invokable (standardLocation), then port the callsite in Kicker.

Zren added a comment.Mar 24 2017, 10:57 PM

Thought you might want that, but wasn't sure how to expose QStandardPaths to QML. Got an example handy? All I can find is:

https://github.com/KDE/plasma-framework/blob/master/src/declarativeimports/plasmacomponents/enums.h
https://github.com/KDE/plasma-framework/blob/master/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp#L91

That seems to require the enum to be a child of a QObject.
The actual class itself isn't a QObject.
https://github.com/qt/qtbase/blob/dev/src/corelib/io/qstandardpaths.h

Which would mean rewriting the entire class like this guy did, with qstatic_casting either an int, or a copy of the enum.
https://forum.qt.io/topic/61543/qstandardpaths-not-available-in-qml/11

hein added a comment.Mar 24 2017, 11:05 PM

I think it would be OK to add an enum to SystemSettings and Q_ENUM it, and initialize the values to QStandardPath enum values. It's not pretty but then the entire thing isn't - it exists in the hope that upstream will add a Qt.standardLocation() or so so we can drop it. (We should look into contributing that.)

Zren added a comment.Mar 25 2017, 5:11 PM

Oh neat! Hmm experimental Qt 5.8 library is fine, but would it be installed by default on say KDE Neon or would it need a package to be manually installed?

Zren added a comment.Mar 25 2017, 5:12 PM

And yes I know KDE Neon is Qt 5.7.1 at the moment, I meant to ask wither it's part of the standard install of Qt.

Zren abandoned this revision.Apr 5 2018, 8:05 PM