1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2016 Kai Uwe Broulik <kde@privat.broulik.de> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-or-later |
6 | */ |
7 | |
8 | #ifndef OPENFILEMANAGERWINDOWJOB_P_H |
9 | #define OPENFILEMANAGERWINDOWJOB_P_H |
10 | |
11 | #if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) |
12 | #define USE_DBUS 1 |
13 | #else |
14 | #define USE_DBUS 0 |
15 | #endif |
16 | |
17 | #include <KJob> |
18 | |
19 | namespace KIO |
20 | { |
21 | class OpenFileManagerWindowJob; |
22 | |
23 | class AbstractOpenFileManagerWindowStrategy |
24 | { |
25 | public: |
26 | explicit AbstractOpenFileManagerWindowStrategy(OpenFileManagerWindowJob *job) |
27 | : m_job(job) |
28 | { |
29 | } |
30 | |
31 | virtual ~AbstractOpenFileManagerWindowStrategy() |
32 | { |
33 | } |
34 | virtual void start(const QList<QUrl> &urls, const QByteArray &asn) = 0; |
35 | |
36 | void emitResultProxy(int error = KJob::NoError) |
37 | { |
38 | m_job->setError(error); |
39 | m_job->emitResult(); |
40 | } |
41 | |
42 | protected: |
43 | OpenFileManagerWindowJob *m_job; |
44 | }; |
45 | |
46 | #if USE_DBUS |
47 | class OpenFileManagerWindowDBusStrategy : public AbstractOpenFileManagerWindowStrategy |
48 | { |
49 | public: |
50 | explicit OpenFileManagerWindowDBusStrategy(OpenFileManagerWindowJob *job) |
51 | : AbstractOpenFileManagerWindowStrategy(job) |
52 | { |
53 | } |
54 | void start(const QList<QUrl> &urls, const QByteArray &asn) override; |
55 | }; |
56 | #endif |
57 | |
58 | class OpenFileManagerWindowKRunStrategy : public AbstractOpenFileManagerWindowStrategy |
59 | { |
60 | public: |
61 | explicit OpenFileManagerWindowKRunStrategy(OpenFileManagerWindowJob *job) |
62 | : AbstractOpenFileManagerWindowStrategy(job) |
63 | { |
64 | } |
65 | void start(const QList<QUrl> &urls, const QByteArray &asn) override; |
66 | }; |
67 | |
68 | #if defined(Q_OS_WINDOWS) |
69 | class OpenFileManagerWindowWindowsShellStrategy : public AbstractOpenFileManagerWindowStrategy |
70 | { |
71 | public: |
72 | explicit OpenFileManagerWindowWindowsShellStrategy(OpenFileManagerWindowJob *job) |
73 | : AbstractOpenFileManagerWindowStrategy(job) |
74 | { |
75 | } |
76 | void start(const QList<QUrl> &urls, const QByteArray &asn) override; |
77 | }; |
78 | #endif |
79 | } |
80 | |
81 | #endif // OPENFILEMANAGERWINDOWJOB_P_H |
82 | |