]> cloud.milkyroute.net Git - dolphin.git/blob - src/global.h
Merge branch 'release/20.08' into master
[dolphin.git] / src / global.h
1 /*
2 * SPDX-FileCopyrightText: 2015 Ashish Bansal <bansal.ashish096@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #ifndef GLOBAL_H
8 #define GLOBAL_H
9
10 #include <QList>
11 #include <QUrl>
12 #include <QWidget>
13
14 class OrgKdeDolphinMainWindowInterface;
15
16 namespace Dolphin {
17 QList<QUrl> validateUris(const QStringList& uriList);
18
19 /**
20 * Returns the home url which is defined in General Settings
21 */
22 QUrl homeUrl();
23
24 enum class OpenNewWindowFlag {
25 None = 0,
26 Select = 1<<1
27 };
28 Q_DECLARE_FLAGS(OpenNewWindowFlags, OpenNewWindowFlag)
29
30 /**
31 * Opens a new Dolphin window
32 */
33 void openNewWindow(const QList<QUrl> &urls = {}, QWidget *window = nullptr, const OpenNewWindowFlags &flags = OpenNewWindowFlag::None);
34
35 /**
36 * Attaches URLs to an existing Dolphin instance if possible.
37 * If @p preferredService is a valid dbus service, it will be tried first.
38 * @p preferredService needs to support the org.kde.dolphin.MainWindow dbus interface with the /dolphin/Dolphin_1 path.
39 * Returns true if the URLs were successfully attached.
40 */
41 bool attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFiles, bool splitView, const QString& preferredService = QString());
42
43 /**
44 * Returns a QVector with all GUI-capable Dolphin instances
45 */
46 QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> dolphinGuiInstances(const QString& preferredService);
47
48 /**
49 * TODO: Move this somewhere global to all KDE apps, not just Dolphin
50 */
51 const int VERTICAL_SPACER_HEIGHT = 12;
52 const int LAYOUT_SPACING_SMALL = 2;
53 }
54
55 #endif //GLOBAL_H