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 
47  enum Policy {
48  CheckNever,
49  CheckIfPossible,
50  CheckAlways
51  };
52 
53  enum Scope {
54  ScopeUser,
55  ScopeSystem
56  };
58  NeverUncompress,
62  UseKPackageUncompression
63  };
64 
65  bool readConfig(const KConfigGroup &group);
66 
67 #if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 71)
68  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 71, "No longer use, feature obsolete")
69  bool isRemote() const;
70 #endif
71 
72 public Q_SLOTS:
84  void downloadPayload(const KNSCore::EntryInternal &entry);
85 
101  void install(const KNSCore::EntryInternal &entry);
102 
118  void uninstall(KNSCore::EntryInternal entry);
119 
126  UncompressionOptions uncompressionSetting() const;
127 
128  // TODO KF6: remove, was used with deprecated Security class.
129 #if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 31)
130  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 31, "No longer use")
131  void slotInstallationVerification(int result);
132 #endif
133 
134  void slotPayloadResult(KJob *job);
135 
141  QString targetInstallationPath() const;
142 
143 Q_SIGNALS:
144  void signalEntryChanged(const KNSCore::EntryInternal &entry);
145  void signalInstallationFinished();
146  void signalInstallationFailed(const QString &message);
152  void signalInstallationError(const QString &message);
153 
154  void signalPayloadLoaded(QUrl payload); // FIXME: return Entry
155 
156  // TODO KF6: remove, was used with deprecated Security class.
157 #if KNEWSTUFFCORE_ENABLE_DEPRECATED_SINCE(5, 31)
158  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 31, "No longer use")
159  void signalInformation(const QString &) const;
160  KNEWSTUFFCORE_DEPRECATED_VERSION(5, 31, "No longer use")
161  void signalError(const QString &) const;
162 #endif
163 
164 private:
165  void install(KNSCore::EntryInternal entry, const QString &downloadedFile);
166 
167  QStringList installDownloadedFileAndUncompress(const KNSCore::EntryInternal &entry, const QString &payloadfile, const QString installdir);
168  QProcess* runPostInstallationCommand(const QString &installPath);
169 
170  static QStringList archiveEntries(const QString &path, const KArchiveDirectory *dir);
171 
172  // applications can set this if they want the installed files/directories to be piped into a shell command
173  QString postInstallationCommand;
174  // a custom command to run for the uninstall
175  QString uninstallCommand;
176  // compression policy
177  QString uncompression;
178 
179  // only one of the five below can be set, that will be the target install path/file name
180  // FIXME: check this when reading the config and make one path out of it if possible?
181  QString standardResourceDirectory;
182  QString targetDirectory;
183  QString xdgTargetDirectory;
184  QString installPath;
185  QString absoluteInstallPath;
186 
187  // policies whether verification needs to be done
188  Policy checksumPolicy;
189  Policy signaturePolicy;
190  // scope: install into user or system dirs
191  Scope scope;
192 
193  // FIXME this throws together a file name from entry name and version - why would anyone want that?
194  bool customName;
195  bool acceptHtml;
196 
197  QMap<KJob *, EntryInternal> entry_jobs;
198 
199  Q_DISABLE_COPY(Installation)
200 };
201 
202 }
203 
204 #endif
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:59
< If the file is an archive, decompress it, otherwise just pass it on. Matches "archive" knsrc settin...
Definition: installation.h:61
< Assume all downloaded files are archives, and attempt to decompress them. Will cause failure if dec...
Definition: installation.h:60
KNewStuff data entry container.
Definition: entryinternal.h:49
KNewStuff entry installation.
Definition: installation.h:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:43:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.