• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.30 API Reference
  • KDE Home
  • Contact Us
 

KNewStuff

  • knewstuff
  • knewstuff3
  • core
knewstuff3/core/installation.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KNewStuff2.
3  Copyright (c) 2007 Josef Spillner <spillner@kde.org>
4  Copyright (C) 2009 Frederik Gladhorn <gladhorn@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "installation.h"
21 
22 #include <QDir>
23 #include <QFile>
24 
25 #include "kstandarddirs.h"
26 #include "kmimetype.h"
27 #include "karchive.h"
28 #include "kzip.h"
29 #include "ktar.h"
30 #include "kprocess.h"
31 #include "kio/job.h"
32 #include "krandom.h"
33 #include "kshell.h"
34 #include "kmessagebox.h" // TODO get rid of message box
35 #include "ktoolinvocation.h" // TODO remove, this was only for my playing round
36 #include "klocalizedstring.h"
37 #include "kdebug.h"
38 
39 #include "core/security.h"
40 #ifdef Q_OS_WIN
41 #include <windows.h>
42 #include <shlobj.h>
43 #endif
44 
45 using namespace KNS3;
46 
47 Installation::Installation(QObject* parent)
48  : QObject(parent)
49  , checksumPolicy(Installation::CheckIfPossible)
50  , signaturePolicy(Installation::CheckIfPossible)
51  , scope(Installation::ScopeUser)
52  , customName(false)
53  , acceptHtml(false)
54 {
55 }
56 
57 bool Installation::readConfig(const KConfigGroup& group)
58 {
59  // FIXME: add support for several categories later on
60  // FIXME: read out only when actually installing as a performance improvement?
61  QString uncompresssetting = group.readEntry("Uncompress", QString("never"));
62  // support old value of true as equivalent of always
63  if (uncompresssetting == "true") {
64  uncompresssetting = "always";
65  }
66  if (uncompresssetting != "always" && uncompresssetting != "archive" && uncompresssetting != "never") {
67  kError() << "invalid Uncompress setting chosen, must be one of: always, archive, or never" << endl;
68  return false;
69  }
70  uncompression = uncompresssetting;
71  postInstallationCommand = group.readEntry("InstallationCommand", QString());
72  uninstallCommand = group.readEntry("UninstallCommand", QString());
73  standardResourceDirectory = group.readEntry("StandardResource", QString());
74  targetDirectory = group.readEntry("TargetDir", QString());
75  xdgTargetDirectory = group.readEntry("XdgTargetDir", QString());
76  installPath = group.readEntry("InstallPath", QString());
77  absoluteInstallPath = group.readEntry("AbsoluteInstallPath", QString());
78  customName = group.readEntry("CustomName", false);
79  acceptHtml = group.readEntry("AcceptHtmlDownloads", false);
80 
81  if (standardResourceDirectory.isEmpty() &&
82  targetDirectory.isEmpty() &&
83  xdgTargetDirectory.isEmpty() &&
84  installPath.isEmpty() &&
85  absoluteInstallPath.isEmpty()) {
86  kError() << "No installation target set";
87  return false;
88  }
89 
90  QString checksumpolicy = group.readEntry("ChecksumPolicy", QString());
91  if (!checksumpolicy.isEmpty()) {
92  if (checksumpolicy == "never")
93  checksumPolicy = Installation::CheckNever;
94  else if (checksumpolicy == "ifpossible")
95  checksumPolicy = Installation::CheckIfPossible;
96  else if (checksumpolicy == "always")
97  checksumPolicy = Installation::CheckAlways;
98  else {
99  kError() << "The checksum policy '" + checksumpolicy + "' is unknown." << endl;
100  return false;
101  }
102  }
103 
104  QString signaturepolicy = group.readEntry("SignaturePolicy", QString());
105  if (!signaturepolicy.isEmpty()) {
106  if (signaturepolicy == "never")
107  signaturePolicy = Installation::CheckNever;
108  else if (signaturepolicy == "ifpossible")
109  signaturePolicy = Installation::CheckIfPossible;
110  else if (signaturepolicy == "always")
111  signaturePolicy = Installation::CheckAlways;
112  else {
113  kError() << "The signature policy '" + signaturepolicy + "' is unknown." << endl;
114  return false;
115  }
116  }
117 
118  QString scopeString = group.readEntry("Scope", QString());
119  if (!scopeString.isEmpty()) {
120  if (scopeString == "user")
121  scope = ScopeUser;
122  else if (scopeString == "system")
123  scope = ScopeSystem;
124  else {
125  kError() << "The scope '" + scopeString + "' is unknown." << endl;
126  return false;
127  }
128 
129  if (scope == ScopeSystem) {
130  if (!installPath.isEmpty()) {
131  kError() << "System installation cannot be mixed with InstallPath." << endl;
132  return false;
133  }
134  }
135  }
136  return true;
137 }
138 
139 bool Installation::isRemote() const
140 {
141  if (!installPath.isEmpty()) return false;
142  if (!targetDirectory.isEmpty()) return false;
143  if (!xdgTargetDirectory.isEmpty()) return false;
144  if (!absoluteInstallPath.isEmpty()) return false;
145  if (!standardResourceDirectory.isEmpty()) return false;
146  return true;
147 }
148 
149 void Installation::install(EntryInternal entry)
150 {
151  downloadPayload(entry);
152 }
153 
154 void Installation::downloadPayload(const KNS3::EntryInternal& entry)
155 {
156  if(!entry.isValid()) {
157  emit signalInstallationFailed(i18n("Invalid item."));
158  return;
159  }
160  KUrl source = KUrl(entry.payload());
161 
162  if (!source.isValid()) {
163  kError() << "The entry doesn't have a payload." << endl;
164  emit signalInstallationFailed(i18n("Download of item failed: no download URL for \"%1\".", entry.name()));
165  return;
166  }
167 
168  // FIXME no clue what this is supposed to do
169  if (isRemote()) {
170  // Remote resource
171  //kDebug() << "Relaying remote payload '" << source << "'";
172  install(entry, source.pathOrUrl());
173  emit signalPayloadLoaded(source);
174  // FIXME: we still need registration for eventual deletion
175  return;
176  }
177 
178  QString fileName(source.fileName());
179  KUrl destination = QString(KGlobal::dirs()->saveLocation("tmp") + KRandom::randomString(10) + '-' + fileName);
180  kDebug() << "Downloading payload '" << source << "' to '" << destination << "'";
181 
182  // FIXME: check for validity
183  KIO::FileCopyJob *job = KIO::file_copy(source, destination, -1, KIO::Overwrite | KIO::HideProgressInfo);
184  connect(job,
185  SIGNAL(result(KJob*)),
186  SLOT(slotPayloadResult(KJob*)));
187 
188  entry_jobs[job] = entry;
189 }
190 
191 
192 void Installation::slotPayloadResult(KJob *job)
193 {
194  // for some reason this slot is getting called 3 times on one job error
195  if (entry_jobs.contains(job)) {
196  EntryInternal entry = entry_jobs[job];
197  entry_jobs.remove(job);
198 
199  if (job->error()) {
200  emit signalInstallationFailed(i18n("Download of \"%1\" failed, error: %2", entry.name(), job->errorString()));
201  } else {
202  KIO::FileCopyJob *fcjob = static_cast<KIO::FileCopyJob*>(job);
203 
204  // check if the app likes html files - disabled by default as too many bad links have been submitted to opendesktop.org
205  if (!acceptHtml) {
206  KMimeType::Ptr mimeType = KMimeType::findByPath(fcjob->destUrl().toLocalFile());
207  if (mimeType->is("text/html") || mimeType->is("application/x-php")) {
208  if (KMessageBox::questionYesNo(0, i18n("The downloaded file is a html file. This indicates a link to a website instead of the actual download. Would you like to open the site with a browser instead?"), i18n("Possibly bad download link"))
209  == KMessageBox::Yes) {
210  KToolInvocation::invokeBrowser(fcjob->srcUrl().url());
211  emit signalInstallationFailed(i18n("Downloaded file was a HTML file. Opened in browser."));
212  entry.setStatus(Entry::Invalid);
213  emit signalEntryChanged(entry);
214  return;
215  }
216  }
217  }
218 
219  install(entry, fcjob->destUrl().toLocalFile());
220  emit signalPayloadLoaded(fcjob->destUrl());
221  }
222  }
223 }
224 
225 
226 void Installation::install(KNS3::EntryInternal entry, const QString& downloadedFile)
227 {
228  kDebug() << "Install: " << entry.name() << " from " << downloadedFile;
229 
230  if (entry.payload().isEmpty()) {
231  kDebug() << "No payload associated with: " << entry.name();
232  return;
233  }
234 
235  // FIXME: first of all, do the security stuff here
236  // this means check sum comparison and signature verification
237  // signature verification might take a long time - make async?!
238  /*
239  if (checksumPolicy() != Installation::CheckNever) {
240  if (entry.checksum().isEmpty()) {
241  if (checksumPolicy() == Installation::CheckIfPossible) {
242  //kDebug() << "Skip checksum verification";
243  } else {
244  kError() << "Checksum verification not possible" << endl;
245  return false;
246  }
247  } else {
248  //kDebug() << "Verify checksum...";
249  }
250  }
251  if (signaturePolicy() != Installation::CheckNever) {
252  if (entry.signature().isEmpty()) {
253  if (signaturePolicy() == Installation::CheckIfPossible) {
254  //kDebug() << "Skip signature verification";
255  } else {
256  kError() << "Signature verification not possible" << endl;
257  return false;
258  }
259  } else {
260  //kDebug() << "Verify signature...";
261  }
262  }
263  */
264 
265  QString targetPath = targetInstallationPath(downloadedFile);
266  QStringList installedFiles = installDownloadedFileAndUncompress(entry, downloadedFile, targetPath);
267 
268  if (installedFiles.isEmpty()) {
269  if (entry.status() == Entry::Installing) {
270  entry.setStatus(Entry::Downloadable);
271  } else if (entry.status() == Entry::Updating) {
272  entry.setStatus(Entry::Updateable);
273  }
274  emit signalEntryChanged(entry);
275  emit signalInstallationFailed(i18n("Could not install \"%1\": file not found.", entry.name()));
276  return;
277  }
278 
279  entry.setInstalledFiles(installedFiles);
280 
281  if (!postInstallationCommand.isEmpty()) {
282  QString target;
283  if (installedFiles.size() == 1) {
284  runPostInstallationCommand(installedFiles.first());
285  } else {
286  runPostInstallationCommand(targetPath);
287  }
288  }
289 
290  // ==== FIXME: security code below must go above, when async handling is complete ====
291 
292  // FIXME: security object lifecycle - it is a singleton!
293  Security *sec = Security::ref();
294 
295  connect(sec,
296  SIGNAL(validityResult(int)),
297  SLOT(slotInstallationVerification(int)));
298 
299  // FIXME: change to accept filename + signature
300  sec->checkValidity(QString());
301 
302  // update version and release date to the new ones
303  if (entry.status() == Entry::Updating) {
304  if (!entry.updateVersion().isEmpty()) {
305  entry.setVersion(entry.updateVersion());
306  }
307  if (entry.updateReleaseDate().isValid()) {
308  entry.setReleaseDate(entry.updateReleaseDate());
309  }
310  }
311 
312  entry.setStatus(Entry::Installed);
313  emit signalEntryChanged(entry);
314  emit signalInstallationFinished();
315 }
316 
317 QString Installation::targetInstallationPath(const QString& payloadfile)
318 {
319  QString installpath(payloadfile);
320  QString installdir;
321 
322  if (!isRemote()) {
323  // installdir is the target directory
324 
325  // installpath also contains the file name if it's a single file, otherwise equal to installdir
326  int pathcounter = 0;
327  if (!standardResourceDirectory.isEmpty()) {
328  if (scope == ScopeUser) {
329  installdir = KStandardDirs::locateLocal(standardResourceDirectory.toUtf8(), "/");
330  } else { // system scope
331  installdir = KStandardDirs::installPath(standardResourceDirectory.toUtf8());
332  }
333  pathcounter++;
334  }
335  if (!targetDirectory.isEmpty()) {
336  if (scope == ScopeUser) {
337  installdir = KStandardDirs::locateLocal("data", targetDirectory + '/');
338  } else { // system scope
339  installdir = KStandardDirs::installPath("data") + targetDirectory + '/';
340  }
341  pathcounter++;
342  }
343  if (!xdgTargetDirectory.isEmpty()) {
344  installdir = KStandardDirs().localxdgdatadir() + '/' + xdgTargetDirectory + '/';
345  pathcounter++;
346  }
347  if (!installPath.isEmpty()) {
348 #if defined(Q_WS_WIN)
349 #ifndef _WIN32_WCE
350  WCHAR wPath[MAX_PATH+1];
351  if ( SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, wPath) == S_OK) {
352  installdir = QString::fromUtf16((const ushort *) wPath) + QLatin1Char('/') + installpath + QLatin1Char('/');
353  } else {
354 #endif
355  installdir = QDir::home().path() + QLatin1Char('/') + installPath + QLatin1Char('/');
356 #ifndef _WIN32_WCE
357  }
358 #endif
359 #else
360  installdir = QDir::home().path() + '/' + installPath + '/';
361 #endif
362  pathcounter++;
363  }
364  if (!absoluteInstallPath.isEmpty()) {
365  installdir = absoluteInstallPath + '/';
366  pathcounter++;
367  }
368  if (pathcounter != 1) {
369  kError() << "Wrong number of installation directories given." << endl;
370  return QString();
371  }
372 
373  kDebug() << "installdir: " << installdir;
374 
375  }
376 
377  return installdir;
378 }
379 
380 QStringList Installation::installDownloadedFileAndUncompress(const KNS3::EntryInternal& entry, const QString& payloadfile, const QString installdir)
381 {
382  QString installpath(payloadfile);
383  // Collect all files that were installed
384  QStringList installedFiles;
385 
386  if (!isRemote()) {
387  bool isarchive = true;
388 
389  // respect the uncompress flag in the knsrc
390  if (uncompression == "always" || uncompression == "archive") {
391  // this is weird but a decompression is not a single name, so take the path instead
392  installpath = installdir;
393  KMimeType::Ptr mimeType = KMimeType::findByPath(payloadfile);
394  //kDebug() << "Postinstallation: uncompress the file";
395 
396  // FIXME: check for overwriting, malicious archive entries (../foo) etc.
397  // FIXME: KArchive should provide "safe mode" for this!
398  KArchive *archive = 0;
399 
400 
401  if (mimeType->is("application/zip")) {
402  archive = new KZip(payloadfile);
403  } else if (mimeType->is("application/tar")
404  || mimeType->is("application/x-gzip")
405  || mimeType->is("application/x-bzip")
406  || mimeType->is("application/x-lzma")
407  || mimeType->is("application/x-xz")
408  || mimeType->is("application/x-bzip-compressed-tar")
409  || mimeType->is("application/x-compressed-tar") ) {
410  archive = new KTar(payloadfile);
411  } else {
412  delete archive;
413  kError() << "Could not determine type of archive file '" << payloadfile << "'";
414  if (uncompression == "always") {
415  return QStringList();
416  }
417  isarchive = false;
418  }
419 
420  if (isarchive) {
421  bool success = archive->open(QIODevice::ReadOnly);
422  if (!success) {
423  kError() << "Cannot open archive file '" << payloadfile << "'";
424  if (uncompression == "always") {
425  return QStringList();
426  }
427  // otherwise, just copy the file
428  isarchive = false;
429  }
430 
431  if (isarchive) {
432  const KArchiveDirectory *dir = archive->directory();
433  //if there is more than an item in the file,
434  //put contents in a subdirectory with the same name as the file
435  if (dir->entries().count() > 1) {
436  installpath = installdir + QLatin1Char('/') + QFileInfo(archive->fileName()).baseName();
437  }
438  dir->copyTo(installpath);
439 
440  installedFiles << archiveEntries(installpath, dir);
441  installedFiles << installpath + '/';
442 
443  archive->close();
444  QFile::remove(payloadfile);
445  delete archive;
446  }
447  }
448  }
449 
450  kDebug() << "isarchive: " << isarchive;
451 
452  if (uncompression == "never" || (uncompression == "archive" && !isarchive)) {
453  // no decompress but move to target
454 
456  // FIXME: make naming convention configurable through *.knsrc? e.g. for kde-look.org image names
457  KUrl source = KUrl(entry.payload());
458  kDebug() << "installing non-archive from " << source.url();
459  QString installfile;
460  QString ext = source.fileName().section('.', -1);
461  if (customName) {
462  installfile = entry.name();
463  installfile += '-' + entry.version();
464  if (!ext.isEmpty()) installfile += '.' + ext;
465  } else {
466  // TODO HACK This is a hack, the correct way of fixing it would be doing the KIO::get
467  // and using the http headers if they exist to get the file name, but as discussed in
468  // Randa this is not going to happen anytime soon (if ever) so go with the hack
469  if (source.url().startsWith("http://newstuff.kde.org/cgi-bin/hotstuff-access?file=")) {
470  installfile = source.queryItemValue("file");
471  int lastSlash = installfile.lastIndexOf('/');
472  if (lastSlash >= 0)
473  installfile = installfile.mid(lastSlash);
474  }
475  if (installfile.isEmpty()) {
476  installfile = source.fileName();
477  }
478  }
479  installpath = installdir + '/' + installfile;
480 
481  //kDebug() << "Install to file " << installpath;
482  // FIXME: copy goes here (including overwrite checking)
483  // FIXME: what must be done now is to update the cache *again*
484  // in order to set the new payload filename (on root tag only)
485  // - this might or might not need to take uncompression into account
486  // FIXME: for updates, we might need to force an overwrite (that is, deleting before)
487  QFile file(payloadfile);
488  bool success = true;
489  const bool update = ((entry.status() == Entry::Updateable) || (entry.status() == Entry::Updating));
490 
491  if (QFile::exists(installpath)) {
492  if (!update) {
493  if (KMessageBox::warningContinueCancel(0, i18n("Overwrite existing file?") + "\n'" + installpath + '\'', i18n("Download File")) == KMessageBox::Cancel) {
494  return QStringList();
495  }
496  }
497  success = QFile::remove(installpath);
498  }
499  if (success) {
500  success = file.rename(KUrl(installpath).toLocalFile());
501  kDebug() << "move: " << file.fileName() << " to " << installpath;
502  }
503  if (!success) {
504  kError() << "Cannot move file '" << payloadfile << "' to destination '" << installpath << "'";
505  return QStringList();
506  }
507  installedFiles << installpath;
508  }
509  }
510  return installedFiles;
511 }
512 
513 void Installation::runPostInstallationCommand(const QString& installPath)
514 {
515  KProcess process;
516  QString command(postInstallationCommand);
517  QString fileArg(KShell::quoteArg(installPath));
518  command.replace("%f", fileArg);
519 
520  kDebug() << "Run command: " << command;
521 
522  process.setShellCommand(command);
523  int exitcode = process.execute();
524 
525  if (exitcode) {
526  kError() << "Command failed" << endl;
527  }
528 }
529 
530 
531 void Installation::uninstall(EntryInternal entry)
532 {
533  entry.setStatus(Entry::Deleted);
534 
535  if (!uninstallCommand.isEmpty()) {
536  KProcess process;
537  foreach (const QString& file, entry.installedFiles()) {
538  QFileInfo info(file);
539  if (info.isFile()) {
540  QString fileArg(KShell::quoteArg(file));
541  QString command(uninstallCommand);
542  command.replace("%f", fileArg);
543 
544  process.setShellCommand(command);
545  int exitcode = process.execute();
546 
547  if (exitcode) {
548  kError() << "Command failed" << endl;
549  } else {
550  //kDebug() << "Command executed successfully";
551  }
552  }
553  }
554  }
555 
556  foreach(const QString &file, entry.installedFiles()) {
557  if (file.endsWith('/')) {
558  QDir dir;
559  bool worked = dir.rmdir(file);
560  if (!worked) {
561  // Maybe directory contains user created files, ignore it
562  continue;
563  }
564  } else {
565  QFileInfo info(file);
566  if (info.exists() || info.isSymLink()) {
567  bool worked = QFile::remove(file);
568  if (!worked) {
569  kWarning() << "unable to delete file " << file;
570  return;
571  }
572  } else {
573  kWarning() << "unable to delete file " << file << ". file does not exist.";
574  }
575  }
576  }
577  entry.setUnInstalledFiles(entry.installedFiles());
578  entry.setInstalledFiles(QStringList());
579 
580  emit signalEntryChanged(entry);
581 }
582 
583 
584 void Installation::slotInstallationVerification(int result)
585 {
586  //kDebug() << "SECURITY result " << result;
587 
588  //FIXME do something here ??? and get the right entry again
589  EntryInternal entry;
590 
591  if (result & Security::SIGNED_OK)
592  emit signalEntryChanged(entry);
593  else
594  emit signalEntryChanged(entry);
595 }
596 
597 
598 QStringList Installation::archiveEntries(const QString& path, const KArchiveDirectory * dir)
599 {
600  QStringList files;
601  foreach(const QString &entry, dir->entries()) {
602  QString childPath = path + '/' + entry;
603  if (dir->entry(entry)->isFile()) {
604  files << childPath;
605  }
606 
607  if (dir->entry(entry)->isDirectory()) {
608  const KArchiveDirectory* childDir = static_cast<const KArchiveDirectory*>(dir->entry(entry));
609  files << archiveEntries(childPath, childDir);
610  files << childPath + '/';
611  }
612  }
613  return files;
614 }
615 
616 
617 #include "installation.moc"
KProcess::setShellCommand
void setShellCommand(const QString &cmd)
KNS3::Entry::Deleted
Definition: knewstuff3/entry.h:63
i18n
QString i18n(const char *text)
KIO::Overwrite
Overwrite
KNS3::EntryInternal::installedFiles
QStringList installedFiles() const
Retrieve the locally installed files.
Definition: entryinternal.cpp:382
KSharedPtr< KMimeType >
KNS3::EntryInternal::setVersion
void setVersion(const QString &version)
Sets the version number.
Definition: entryinternal.cpp:219
KUrl::toLocalFile
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
KNS3::Entry::Invalid
Definition: knewstuff3/entry.h:59
krandom.h
KProcess
kdebug.h
KNS3::EntryInternal
KNewStuff data entry container.
Definition: entryinternal.h:54
kmimetype.h
KStandardDirs::localxdgdatadir
QString localxdgdatadir() const
KNS3::Installation::CheckNever
Definition: knewstuff3/core/installation.h:55
KIO::HideProgressInfo
HideProgressInfo
KArchive
KMimeType::findByPath
static Ptr findByPath(const QString &path, mode_t mode=0, bool fast_mode=false, int *accuracy=0)
kshell.h
KNS3::EntryInternal::isValid
bool isValid() const
Definition: entryinternal.cpp:119
KGlobal::dirs
KStandardDirs * dirs()
kError
static QDebug kError(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KNS3::Installation::signalInstallationFinished
void signalInstallationFinished()
KUrl::pathOrUrl
QString pathOrUrl() const
ktoolinvocation.h
QObject
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KArchive::fileName
QString fileName() const
installation.h
KArchive::close
virtual bool close()
KUrl
KNS3::Installation::slotInstallationVerification
void slotInstallationVerification(int result)
Definition: knewstuff3/core/installation.cpp:584
KMessageBox::Cancel
Cancel
KNS3::EntryInternal::setReleaseDate
void setReleaseDate(const QDate &releasedate)
Sets the release date.
Definition: entryinternal.cpp:229
KNS3::Installation::readConfig
bool readConfig(const KConfigGroup &group)
Definition: knewstuff3/core/installation.cpp:57
KNS3::Installation::signalEntryChanged
void signalEntryChanged(const KNS3::EntryInternal &entry)
KNS3::Installation::downloadPayload
void downloadPayload(const KNS3::EntryInternal &entry)
Downloads a payload file.
Definition: knewstuff3/core/installation.cpp:154
KArchiveDirectory::entries
QStringList entries() const
kzip.h
KNS3::EntryInternal::updateReleaseDate
QDate updateReleaseDate() const
Retrieve the date of the newer version that is available as update.
Definition: entryinternal.cpp:244
karchive.h
KArchive::open
virtual bool open(QIODevice::OpenMode mode)
kprocess.h
KNS3::Installation::signalInstallationFailed
void signalInstallationFailed(const QString &message)
KIO::file_copy
FileCopyJob * file_copy(const KUrl &src, const KUrl &dest, int permissions=-1, JobFlags flags=DefaultFlags)
KNS3::Entry::Installed
Definition: knewstuff3/entry.h:61
KStandardDirs
KNS3::Installation::ScopeUser
Definition: knewstuff3/core/installation.h:61
KTar
KMimeType::is
bool is(const QString &mimeTypeName) const
KNS3::Installation::uninstall
void uninstall(KNS3::EntryInternal entry)
Uninstalls an entry.
Definition: knewstuff3/core/installation.cpp:531
KZip
KNS3::Security::SIGNED_OK
The MD5 sum check is OK.
Definition: knewstuff3/core/security.h:86
KArchiveEntry::isFile
virtual bool isFile() const
KIO::FileCopyJob::srcUrl
KUrl srcUrl() const
KNS3::Entry::Downloadable
Definition: knewstuff3/entry.h:60
KNS3::Installation::CheckIfPossible
Definition: knewstuff3/core/installation.h:56
KNS3::EntryInternal::version
QString version() const
Retrieve the version string of the object.
Definition: entryinternal.cpp:214
KMessageBox::questionYesNo
static int questionYesNo(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonYes=KStandardGuiItem::yes(), const KGuiItem &buttonNo=KStandardGuiItem::no(), const QString &dontAskAgainName=QString(), Options options=Notify)
KJob::error
int error() const
KShell::quoteArg
QString quoteArg(const QString &arg)
KStandardDirs::installPath
static QString installPath(const char *type)
KNS3::EntryInternal::payload
QString payload() const
Retrieve the file name of the object.
Definition: entryinternal.cpp:234
ktar.h
KNS3::EntryInternal::status
Entry::Status status() const
Retrieves the entry&#39;s status.
Definition: entryinternal.cpp:367
job.h
KConfigGroup
KArchiveDirectory
KNS3::Entry::Installing
Definition: knewstuff3/entry.h:64
dir
QString dir(const QString &fileClass)
KNS3::Security::checkValidity
void checkValidity(const QString &fileName)
Verifies the integrity and the signature of a tarball file.
Definition: knewstuff3/core/security.cpp:227
KConfigGroup::readEntry
T readEntry(const QString &key, const T &aDefault) const
klocalizedstring.h
KStandardDirs::locateLocal
static QString locateLocal(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
KNS3::EntryInternal::updateVersion
QString updateVersion() const
Retrieve the version string of the object that is available as update.
Definition: entryinternal.cpp:254
KJob::errorString
virtual QString errorString() const
KIO::FileCopyJob
kstandarddirs.h
KArchiveDirectory::copyTo
void copyTo(const QString &dest, bool recursive=true) const
KNS3::Security
Handles security related issues, like signing, verifying.
Definition: knewstuff3/core/security.h:47
KArchiveDirectory::entry
const KArchiveEntry * entry(const QString &name) const
KIO::FileCopyJob::destUrl
KUrl destUrl() const
KProcess::execute
int execute(int msecs=-1)
kWarning
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KNS3::Entry::Updating
Definition: knewstuff3/entry.h:65
KNS3::Installation::ScopeSystem
Definition: knewstuff3/core/installation.h:62
KUrl::url
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
KNS3::EntryInternal::setUnInstalledFiles
void setUnInstalledFiles(const QStringList &files)
Set the files that have been uninstalled by the uninstall command.
Definition: entryinternal.cpp:387
KArchiveEntry::isDirectory
virtual bool isDirectory() const
KNS3::Installation
KNewStuff entry installation.
Definition: knewstuff3/core/installation.h:45
KMessageBox::Yes
Yes
KNS3::Installation::slotPayloadResult
void slotPayloadResult(KJob *job)
Definition: knewstuff3/core/installation.cpp:192
KNS3::EntryInternal::setStatus
void setStatus(Entry::Status status)
Returns the checksum for the entry.
Definition: entryinternal.cpp:372
KToolInvocation::invokeBrowser
static void invokeBrowser(const QString &url, const QByteArray &startup_id=QByteArray())
KNS3::Installation::Installation
Installation(QObject *parent=0)
Constructor.
Definition: knewstuff3/core/installation.cpp:47
KNS3
Definition: atticaprovider.cpp:35
kmessagebox.h
KUrl::fileName
QString fileName(const DirectoryOptions &options=IgnoreTrailingSlash) const
KRandom::randomString
QString randomString(int length)
KNS3::Installation::install
void install(KNS3::EntryInternal entry)
Installs an entry&#39;s payload file.
Definition: knewstuff3/core/installation.cpp:149
KNS3::Installation::CheckAlways
Definition: knewstuff3/core/installation.h:57
KMessageBox::warningContinueCancel
static int warningContinueCancel(QWidget *parent, const QString &text, const QString &caption=QString(), const KGuiItem &buttonContinue=KStandardGuiItem::cont(), const KGuiItem &buttonCancel=KStandardGuiItem::cancel(), const QString &dontAskAgainName=QString(), Options options=Notify)
KJob
KArchive::directory
const KArchiveDirectory * directory() const
KNS3::Installation::signalPayloadLoaded
void signalPayloadLoaded(KUrl payload)
KNS3::EntryInternal::name
QString name() const
Retrieve the name of the data object.
Definition: entryinternal.cpp:124
KNS3::EntryInternal::setInstalledFiles
void setInstalledFiles(const QStringList &files)
Set the files that have been installed by the install command.
Definition: entryinternal.cpp:377
KNS3::Entry::Updateable
Definition: knewstuff3/entry.h:62
KNS3::Security::ref
static Security * ref()
Definition: knewstuff3/core/security.h:51
KNS3::Installation::isRemote
bool isRemote() const
Definition: knewstuff3/core/installation.cpp:139
This file is part of the KDE documentation.
Documentation copyright © 1996-2017 The KDE developers.
Generated on Tue May 16 2017 10:24:04 by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNewStuff

Skip menu "KNewStuff"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.30 API Reference

Skip menu "kdelibs-4.14.30 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal