1 | /* |
2 | This file is part of the KDE project |
3 | SPDX-FileCopyrightText: 1999 Simon Hausmann <hausmann@kde.org> |
4 | SPDX-FileCopyrightText: 1999-2005 David Faure <faure@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef _KPARTS_READONLYPART_P_H |
10 | #define _KPARTS_READONLYPART_P_H |
11 | |
12 | #include "openurlarguments.h" |
13 | #include "part_p.h" |
14 | #include "readonlypart.h" |
15 | |
16 | namespace KIO |
17 | { |
18 | class FileCopyJob; |
19 | class StatJob; |
20 | } |
21 | |
22 | namespace KParts |
23 | { |
24 | class ReadOnlyPartPrivate : public PartPrivate |
25 | { |
26 | public: |
27 | Q_DECLARE_PUBLIC(ReadOnlyPart) |
28 | |
29 | explicit ReadOnlyPartPrivate(ReadOnlyPart *qq, const KPluginMetaData &data) |
30 | : PartPrivate(qq, data) |
31 | { |
32 | m_job = nullptr; |
33 | m_statJob = nullptr; |
34 | m_uploadJob = nullptr; |
35 | m_showProgressInfo = true; |
36 | m_saveOk = false; |
37 | m_waitForSave = false; |
38 | m_duringSaveAs = false; |
39 | m_bTemp = false; |
40 | m_bAutoDetectedMime = false; |
41 | m_closeUrlFromOpenUrl = false; |
42 | m_closeUrlFromDestructor = false; |
43 | } |
44 | |
45 | ~ReadOnlyPartPrivate() override |
46 | { |
47 | } |
48 | |
49 | void slotJobFinished(KJob *job); |
50 | void slotStatJobFinished(KJob *job); |
51 | void slotGotMimeType(KIO::Job *job, const QString &mime); |
52 | bool openLocalFile(); |
53 | void openRemoteFile(); |
54 | |
55 | KIO::FileCopyJob *m_job; |
56 | KIO::StatJob *m_statJob; |
57 | KIO::FileCopyJob *m_uploadJob; |
58 | QUrl m_originalURL; // for saveAs |
59 | QString m_originalFilePath; // for saveAs |
60 | bool m_showProgressInfo : 1; |
61 | bool m_saveOk : 1; |
62 | bool m_waitForSave : 1; |
63 | bool m_duringSaveAs : 1; |
64 | |
65 | /** |
66 | * If @p true, @p m_file is a temporary file that needs to be deleted later. |
67 | */ |
68 | bool m_bTemp : 1; |
69 | |
70 | // whether the mimetype in the arguments was detected by the part itself |
71 | bool m_bAutoDetectedMime : 1; |
72 | // Whether we are calling closeUrl() from openUrl(). |
73 | bool m_closeUrlFromOpenUrl; |
74 | // Whether we are calling closeUrl() from ~ReadOnlyPart(). |
75 | bool m_closeUrlFromDestructor; |
76 | |
77 | /** |
78 | * Remote (or local) url - the one displayed to the user. |
79 | */ |
80 | QUrl m_url; |
81 | |
82 | /** |
83 | * Local file - the only one the part implementation should deal with. |
84 | */ |
85 | QString m_file; |
86 | |
87 | OpenUrlArguments m_arguments; |
88 | }; |
89 | |
90 | } // namespace |
91 | |
92 | #endif |
93 | |