digiKam
dservicemenu.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2014-05-08
7  * Description : Service menu operation methods
8  *
9  * Copyright (C) 2014-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
10  *
11  * This program is free software; you can redistribute it
12  * and/or modify it under the terms of the GNU General
13  * Public License as published by the Free Software Foundation;
14  * either version 2, or (at your option)
15  * any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * ============================================================ */
23 
24 #ifndef DIGIKAM_DSERVICE_MENU_H
25 #define DIGIKAM_DSERVICE_MENU_H
26 
27 // Qt includes
28 
29 #include <QUrl>
30 #include <QString>
31 #include <QStringList>
32 
33 // KDE includes
34 
35 // Pragma directives to reduce warnings from KDE header files.
36 #if defined(Q_CC_GNU)
37 # pragma GCC diagnostic push
38 # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
39 #endif
40 
41 #if defined(Q_CC_CLANG)
42 # pragma clang diagnostic push
43 # pragma clang diagnostic ignored "-Wmismatched-tags"
44 # pragma clang diagnostic ignored "-Wdeprecated-declarations"
45 #endif
46 
47 #include <kservice.h>
48 
49 // Restore warnings
50 #if defined(Q_CC_GNU)
51 # pragma GCC diagnostic pop
52 #endif
53 
54 #if defined(Q_CC_CLANG)
55 # pragma clang diagnostic pop
56 #endif
57 
58 // Local includes
59 
60 #include "digikam_export.h"
61 
62 namespace Digikam
63 {
64 
65 class DIGIKAM_EXPORT DServiceMenu
66 {
67 public:
68 
70 
71  // Linux Services methods implemented in dservicemenu_linux.cpp
72 
76  static bool runFiles(KService* const service, const QList<QUrl>& urls);
77 
81  static bool runFiles(const QString& appCmd,
82  const QList<QUrl>& urls,
83  KService* const service = nullptr);
84 
88  static KService::List servicesForOpenWith(const QList<QUrl>& urls);
89 
91 
93 
94  // MacOS Application Bundles methods implemented in dservicemenu_mac.mm
95 
96 #ifdef Q_OS_MAC
97 
104  static QList<QUrl> MacApplicationForFileExtension(const QString& suffix);
105 
110  static bool MacOpenFilesWithApplication(const QList<QUrl>& fileUrls, const QUrl& appUrl);
111 
118  static QList<QUrl> MacApplicationsForFiles(const QList<QUrl>& files);
119 
123  static QString MacApplicationBundleName(const QUrl& appUrl);
124 
128  static QIcon MacApplicationBundleIcon(const QUrl& appUrl, int size = 32);
129 
130 #endif
131 
133 
134 };
135 
136 } // namespace Digikam
137 
138 #endif // DIGIKAM_DSERVICE_MENU_H
Definition: dservicemenu.h:66
QStringView suffix
Definition: itemviewutilities.cpp:594
Definition: datefolderview.cpp:43