diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dbusinterface.cpp | 12 | ||||
| -rw-r--r-- | src/dbusinterface.h | 2 | ||||
| -rw-r--r-- | src/global.cpp | 7 | ||||
| -rw-r--r-- | src/global.h | 2 |
4 files changed, 23 insertions, 0 deletions
diff --git a/src/dbusinterface.cpp b/src/dbusinterface.cpp index cf1ad53ad..7e453f72a 100644 --- a/src/dbusinterface.cpp +++ b/src/dbusinterface.cpp @@ -59,6 +59,18 @@ void DBusInterface::ShowItemProperties(const QStringList& uriList, const QString } } +void DBusInterface::SortOrderForUrl(const QString &url, QString &role, QString &order) +{ + QUrl qurl(url); + auto sort = Dolphin::sortOrderForUrl(qurl); + role = sort.first; + if (sort.second == Qt::AscendingOrder) { + order = QStringLiteral("ascending"); + } else { + order = QStringLiteral("descending"); + } +} + void DBusInterface::setAsDaemon() { m_isDaemon = true; diff --git a/src/dbusinterface.h b/src/dbusinterface.h index 9b183384d..66659e976 100644 --- a/src/dbusinterface.h +++ b/src/dbusinterface.h @@ -20,6 +20,8 @@ public: Q_SCRIPTABLE void ShowItems(const QStringList& uriList, const QString& startUpId); Q_SCRIPTABLE void ShowItemProperties(const QStringList& uriList, const QString& startUpId); + Q_SCRIPTABLE void SortOrderForUrl(const QString &url, QString &role, QString &order); + /** * Set whether this interface has been created by dolphin --daemon. */ diff --git a/src/global.cpp b/src/global.cpp index 3d17a733b..197d6ec28 100644 --- a/src/global.cpp +++ b/src/global.cpp @@ -9,6 +9,7 @@ #include "dolphin_generalsettings.h" #include "dolphindebug.h" #include "dolphinmainwindowinterface.h" +#include "views/viewproperties.h" #include <KConfigWatcher> #include <KDialogJobUiDelegate> @@ -140,6 +141,12 @@ QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> Do return dolphinInterfaces; } +QPair<QString, Qt::SortOrder> Dolphin::sortOrderForUrl(QUrl &url) +{ + ViewProperties globalProps(url); + return QPair<QString, Qt::SortOrder>(globalProps.sortRole(), globalProps.sortOrder()); +} + double GlobalConfig::animationDurationFactor() { if (s_animationDurationFactor >= 0.0) { diff --git a/src/global.h b/src/global.h index 088e9c5b6..4f4eb890c 100644 --- a/src/global.h +++ b/src/global.h @@ -46,6 +46,8 @@ namespace Dolphin { */ QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> dolphinGuiInstances(const QString& preferredService); + QPair<QString, Qt::SortOrder> sortOrderForUrl(QUrl &url); + /** * TODO: Move this somewhere global to all KDE apps, not just Dolphin */ |
