KNewStuff

installation.h
1 /*
2  This file is part of KNewStuff2.
3  SPDX-FileCopyrightText: 2007 Josef Spillner <[email protected]>
4  SPDX-FileCopyrightText: 2009 Frederik Gladhorn <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8 
9 #ifndef KNEWSTUFF3_INSTALLATION_P_H
10 #define KNEWSTUFF3_INSTALLATION_P_H
11 
12 #include <QObject>
13 #include <QString>
14 
15 #include <KConfigGroup>
16 
17 #include "entryinternal.h"
18 
19 #include "knewstuffcore_export.h"
20 
21 class QProcess;
22 class KArchiveDirectory;
23 class KJob;
24 
25 namespace KNSCore
26 {
27 
38 class KNEWSTUFFCORE_EXPORT Installation : public QObject
39 {
40  Q_OBJECT
41 public:
45  explicit Installation(QObject *parent = nullptr);
46 #if KNEWSTUFFCORE_BUILD_DEPRECATED_SINCE(5, 79)
47  enum Policy {
48  CheckNever,
49  CheckIfPossible,
50  CheckAlways,
51  };
52 
53  enum Scope {
54  ScopeUser,
55  ScopeSystem,
56  };
57 #endif
58 
60  NeverUncompress,
66  };
67  Q_ENUM(UncompressionOptions)
68 
69  bool readConfig(const KConfigGroup &group);
70 
71 #if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 71)
72  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 71, "No longer use, feature obsolete")
73  bool isRemote() const;
74 #endif
75 
76 public Q_SLOTS:
88  void downloadPayload(const KNSCore::EntryInternal &entry);
89 
105  void install(const KNSCore::EntryInternal &entry);
106 
122  void uninstall(KNSCore::EntryInternal entry);
123 
130  UncompressionOptions uncompressionSetting() const;
131 
132  // TODO KF6: remove, was used with deprecated Security class.
133 #if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 31)
134  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 31, "No longer use")
135  void slotInstallationVerification(int result);
136 #endif
137 
138  void slotPayloadResult(KJob *job);
139 
145  QString targetInstallationPath() const;
146 
147 Q_SIGNALS:
148  void signalEntryChanged(const KNSCore::EntryInternal &entry);
149  void signalInstallationFinished();
150  void signalInstallationFailed(const QString &message);
156  void signalInstallationError(const QString &message);
157 
158  void signalPayloadLoaded(QUrl payload); // FIXME: return Entry
159 
160  // TODO KF6: remove, was used with deprecated Security class.
161 #if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 31)
162  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 31, "No longer use")
163  void signalInformation(const QString &) const;
164  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 31, "No longer use")
165  void signalError(const QString &) const;
166 #endif
167 
168 private:
169  void install(KNSCore::EntryInternal entry, const QString &downloadedFile);
170 
171  QStringList installDownloadedFileAndUncompress(const KNSCore::EntryInternal &entry, const QString &payloadfile, const QString installdir);
172  QProcess* runPostInstallationCommand(const QString &installPath);
173 
174  static QStringList archiveEntries(const QString &path, const KArchiveDirectory *dir);
175 
176  // applications can set this if they want the installed files/directories to be piped into a shell command
177  QString postInstallationCommand;
178  // a custom command to run for the uninstall
179  QString uninstallCommand;
180  // compression policy
181  QString uncompression;
182 
183  // only one of the five below can be set, that will be the target install path/file name
184  // FIXME: check this when reading the config and make one path out of it if possible?
185  QString standardResourceDirectory;
186  QString targetDirectory;
187  QString xdgTargetDirectory;
188  QString installPath;
189  QString absoluteInstallPath;
190 #if KNEWSTUFFCORE_BUILD_DEPRECATED_SINCE(5, 79)
191  // policies whether verification needs to be done
192  Policy checksumPolicy = CheckIfPossible;
193  Policy signaturePolicy = CheckIfPossible;
194  // scope: install into user or system dirs
195  Scope scope = ScopeUser;
196  // FIXME this throws together a file name from entry name and version - why would anyone want that?
197  bool customName = false;
198  bool acceptHtml = false;
199 #endif
200 
201  QMap<KJob *, EntryInternal> entry_jobs;
202 
203  Q_DISABLE_COPY(Installation)
204 };
205 
206 }
207 
208 #endif
< As Archive, except that if there is more than an item in the file, put contents in a subdirectory w...
Definition: installation.h:65
Contains the core functionality for handling interaction with NewStuff providers. ...
< Never attempt to decompress a file, whatever format it is. Matches "never" knsrc setting ...
Definition: installation.h:61
< If the file is an archive, decompress it in a subdirectory if it contains multiple files...
Definition: installation.h:64
< Assume all downloaded files are archives, and attempt to decompress them. Will cause failure if dec...
Definition: installation.h:62
KNewStuff data entry container.
Definition: entryinternal.h:49
KNewStuff entry installation.
Definition: installation.h:38
< If the file is an archive, decompress it, otherwise just pass it on. Matches "archive" knsrc settin...
Definition: installation.h:63
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 22:43:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.