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

KParts

  • sources
  • kde-4.14
  • kdelibs
  • kparts
browserrun_p.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (c) 2009 David Faure <faure@kde.org>
3  Copyright (c) 2010 Sebastian Trueg <trueg@kde.org>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation; either version 2 of the License or ( at
8  your option ) version 3 or, at the discretion of KDE e.V. ( which shall
9  act as a proxy as in section 14 of the GPLv3 ), 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  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 #ifndef BROWSERRUN_P_H
22 #define BROWSERRUN_P_H
23 
24 #include <kio/copyjob.h>
25 #include <kdebug.h>
26 
27 #include "config-nepomuk.h"
28 
29 #include <QtCore/QDateTime>
30 
31 #ifdef HAVE_NEPOMUK
32 #include "../nepomuk/utils/utils.h"
33 #endif
34 
35 namespace KParts {
36 
41 class DownloadJobWatcher : public QObject
42 {
43  Q_OBJECT
44 public:
45  DownloadJobWatcher(KIO::FileCopyJob* job, const QMap<QString, QString> &metaData)
46  : QObject(job), m_metaData(metaData), m_downloadJobStartTime(QDateTime::currentDateTime())
47  {
48  kDebug() << "download started: srcUrl=" << job->srcUrl()
49  << "destUrl=" << job->destUrl()
50  << "referrer=" << m_metaData.value("referrer");
51  connect(job, SIGNAL(result(KJob*)), this, SLOT(slotDownloadFinished(KJob*)));
52  }
53 
54 private Q_SLOTS:
55  void slotDownloadFinished(KJob* job)
56  {
57  KIO::FileCopyJob* fileCopyJob = static_cast<KIO::FileCopyJob *>(job);
58  if (job->error()) {
59  kDebug() << "error during download: srcUrl=" << fileCopyJob->srcUrl()
60  << "destUrl=" << fileCopyJob->destUrl()
61  << "referrer=" << m_metaData.value("referrer");
62  // TODO: test whether destUrl+".part" exists
63  } else {
64  kDebug() << "download finished: srcUrl=" << fileCopyJob->srcUrl()
65  << "destUrl=" << fileCopyJob->destUrl()
66  << "referrer=" << m_metaData.value("referrer");
67 #ifdef HAVE_NEPOMUK
68  Nepomuk::Utils::createCopyEvent( fileCopyJob->srcUrl(),
69  fileCopyJob->destUrl(),
70  m_downloadJobStartTime,
71  KUrl(m_metaData.value("referrer")) );
72 #endif
73  }
74  }
75 
76 private:
77  QMap<QString, QString> m_metaData;
78  QDateTime m_downloadJobStartTime;
79 };
80 }
81 
82 #endif /* BROWSERRUN_P_H */
83 
kdebug.h
QMap< QString, QString >
KIO::FileCopyJob::destUrl
KUrl destUrl() const
kDebug
static QDebug kDebug(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
KUrl
KParts::DownloadJobWatcher::DownloadJobWatcher
DownloadJobWatcher(KIO::FileCopyJob *job, const QMap< QString, QString > &metaData)
Definition: browserrun_p.h:45
KIO::FileCopyJob::srcUrl
KUrl srcUrl() const
KParts::DownloadJobWatcher
This watcher is notified when the "download" job is done, so we can remember where a downloaded file ...
Definition: browserrun_p.h:41
QObject
copyjob.h
KIO::FileCopyJob
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KJob
QDateTime
QMap::value
const T value(const Key &key) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KParts

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

kdelibs API Reference

Skip menu "kdelibs 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

Search



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