]> cloud.milkyroute.net Git - dolphin.git/blob - src/global.h
SVN_SILENT made messages (.desktop file) - always resolve ours
[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 KConfigGroup;
15 class OrgKdeDolphinMainWindowInterface;
16
17 namespace Dolphin
18 {
19 QList<QUrl> validateUris(const QStringList &uriList);
20
21 /**
22 * Returns the home url which is defined in General Settings
23 */
24 QUrl homeUrl();
25
26 enum class OpenNewWindowFlag { None = 0, Select = 1 << 1 };
27 Q_DECLARE_FLAGS(OpenNewWindowFlags, OpenNewWindowFlag)
28
29 /**
30 * Opens a new Dolphin window
31 */
32 void openNewWindow(const QList<QUrl> &urls = {}, QWidget *window = nullptr, const OpenNewWindowFlags &flags = OpenNewWindowFlag::None);
33
34 /**
35 * Attaches URLs to an existing Dolphin instance if possible.
36 * If @p preferredService is a valid dbus service, it will be tried first.
37 * @p preferredService needs to support the org.kde.dolphin.MainWindow dbus interface with the /dolphin/Dolphin_1 path.
38 * Returns true if the URLs were successfully attached.
39 */
40 bool attachToExistingInstance(const QList<QUrl> &inputUrls, bool openFiles, bool splitView, const QString &preferredService, const QString &activationToken);
41
42 /**
43 * Returns a QVector with all GUI-capable Dolphin instances
44 */
45 QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> dolphinGuiInstances(const QString &preferredService);
46
47 QPair<QString, Qt::SortOrder> sortOrderForUrl(QUrl &url);
48
49 /**
50 * TODO: Use global KDE spacings instead of Dolphin-specific ones once we have them.
51 */
52 constexpr int VERTICAL_SPACER_HEIGHT = 12;
53 constexpr int LAYOUT_SPACING_SMALL = 4;
54 }
55
56 enum Animated { WithAnimation, WithoutAnimation };
57
58 class GlobalConfig : public QObject
59 {
60 Q_OBJECT
61
62 public:
63 GlobalConfig() = delete;
64
65 /**
66 * @return a value from the global KDE config that should be
67 * multiplied with every animation duration once.
68 * 0.0 is returned if animations are globally turned off.
69 * 1.0 is the default value.
70 */
71 static double animationDurationFactor();
72
73 private:
74 static void updateAnimationDurationFactor(const KConfigGroup &group, const QByteArrayList &names);
75
76 private:
77 static double s_animationDurationFactor;
78 };
79
80 #endif //GLOBAL_H