]> cloud.milkyroute.net Git - dolphin.git/blob - src/dbusinterface.cpp
Merge branch 'Applications/18.04'
[dolphin.git] / src / dbusinterface.cpp
1 /*
2 * Copyright 2015 Ashish Bansal<bansal.ashish096@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #include "dbusinterface.h"
21 #include "global.h"
22
23 #include <KPropertiesDialog>
24
25 #include <QDBusConnection>
26
27 DBusInterface::DBusInterface() :
28 QObject()
29 {
30 QDBusConnection::sessionBus().registerService(QStringLiteral("org.freedesktop.FileManager1"));
31 QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/freedesktop/FileManager1"), this,
32 QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
33 }
34
35 void DBusInterface::ShowFolders(const QStringList& uriList, const QString& startUpId)
36 {
37 Q_UNUSED(startUpId);
38 const QList<QUrl> urls = Dolphin::validateUris(uriList);
39 if (urls.isEmpty()) {
40 return;
41 }
42 Dolphin::openNewWindow(urls);
43 }
44
45 void DBusInterface::ShowItems(const QStringList& uriList, const QString& startUpId)
46 {
47 Q_UNUSED(startUpId);
48 const QList<QUrl> urls = Dolphin::validateUris(uriList);
49 if (urls.isEmpty()) {
50 return;
51 }
52 Dolphin::openNewWindow(urls, nullptr, Dolphin::OpenNewWindowFlag::Select);
53 }
54
55 void DBusInterface::ShowItemProperties(const QStringList& uriList, const QString& startUpId)
56 {
57 Q_UNUSED(startUpId);
58 const QList<QUrl> urls = Dolphin::validateUris(uriList);
59 if (!urls.isEmpty()) {
60 KPropertiesDialog::showDialog(urls);
61 }
62 }