KNewStuff
installation.h
Go to the documentation of this file.
00001 /* 00002 This file is part of KNewStuff2. 00003 Copyright (c) 2007 Josef Spillner <spillner@kde.org> 00004 Copyright (C) 2009 Frederik Gladhorn <gladhorn@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public 00017 License along with this library. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 #ifndef KNEWSTUFF3_INSTALLATION_H 00020 #define KNEWSTUFF3_INSTALLATION_H 00021 00022 #include <QtCore/QObject> 00023 #include <QtCore/QString> 00024 00025 #include <kconfiggroup.h> 00026 00027 #include "entryinternal.h" 00028 00029 class KArchiveDirectory; 00030 class KJob; 00031 00032 namespace KNS3 00033 { 00034 00045 class Installation :public QObject 00046 { 00047 Q_OBJECT 00048 public: 00052 Installation(QObject* parent = 0); 00053 00054 enum Policy { 00055 CheckNever, 00056 CheckIfPossible, 00057 CheckAlways 00058 }; 00059 00060 enum Scope { 00061 ScopeUser, 00062 ScopeSystem 00063 }; 00064 00065 bool readConfig(const KConfigGroup& group); 00066 bool isRemote() const; 00067 00068 public Q_SLOTS: 00080 void downloadPayload(const KNS3::EntryInternal& entry); 00081 00096 void install(KNS3::EntryInternal entry); 00097 00108 void uninstall(KNS3::EntryInternal entry); 00109 00110 void slotInstallationVerification(int result); 00111 void slotPayloadResult(KJob *job); 00112 00113 Q_SIGNALS: 00114 void signalEntryChanged(const KNS3::EntryInternal& entry); 00115 void signalInstallationFinished(); 00116 void signalInstallationFailed(const QString& message); 00117 00118 void signalPayloadLoaded(KUrl payload); // FIXME: return Entry 00119 00120 private: 00121 void install(KNS3::EntryInternal entry, const QString& downloadedFile); 00122 00123 QString targetInstallationPath(const QString& payloadfile); 00124 QStringList installDownloadedFileAndUncompress(const KNS3::EntryInternal& entry, const QString& payloadfile, const QString installdir); 00125 void runPostInstallationCommand(const QString& installPath); 00126 00127 static QStringList archiveEntries(const QString& path, const KArchiveDirectory * dir); 00128 00129 // applications can set this if they want the installed files/directories to be piped into a shell command 00130 QString postInstallationCommand; 00131 // a custom command to run for the uninstall 00132 QString uninstallCommand; 00133 // compression policy 00134 QString uncompression; 00135 00136 // only one of the five below can be set, that will be the target install path/file name 00137 // FIXME: check this when reading the config and make one path out of it if possible? 00138 QString standardResourceDirectory; 00139 QString targetDirectory; 00140 QString xdgTargetDirectory; 00141 QString installPath; 00142 QString absoluteInstallPath; 00143 00144 // policies whether verification needs to be done 00145 Policy checksumPolicy; 00146 Policy signaturePolicy; 00147 // scope: install into user or system dirs 00148 Scope scope; 00149 00150 // FIXME this throws together a file name from entry name and version - why would anyone want that? 00151 bool customName; 00152 bool acceptHtml; 00153 00154 QMap<KJob*, EntryInternal> entry_jobs; 00155 00156 Q_DISABLE_COPY(Installation) 00157 }; 00158 00159 } 00160 00161 #endif
KDE 4.6 API Reference