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

KParts

browserrun_p.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (c) 2009 David Faure <faure@kde.org>
00003     Copyright (c) 2010 Sebastian Trueg <trueg@kde.org>
00004 
00005     This library is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU Lesser General Public License as published by
00007     the Free Software Foundation; either version 2 of the License or ( at
00008     your option ) version 3 or, at the discretion of KDE e.V. ( which shall
00009     act as a proxy as in section 14 of the GPLv3 ), 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     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 #ifndef BROWSERRUN_P_H
00022 #define BROWSERRUN_P_H
00023 
00024 #include <kio/copyjob.h>
00025 #include <kdebug.h>
00026 
00027 #include "config-nepomuk.h"
00028 
00029 #include <QtCore/QDateTime>
00030 
00031 #ifdef HAVE_NEPOMUK
00032 #include "../nepomuk/utils/utils.h"
00033 #endif
00034 
00035 namespace KParts {
00036 
00041 class DownloadJobWatcher : public QObject
00042 {
00043     Q_OBJECT
00044 public:
00045     DownloadJobWatcher(KIO::FileCopyJob* job, const QMap<QString, QString> &metaData)
00046         : QObject(job), m_metaData(metaData), m_downloadJobStartTime(QDateTime::currentDateTime())
00047     {
00048         kDebug() << "download started: srcUrl=" << job->srcUrl()
00049                  << "destUrl=" << job->destUrl()
00050                  << "referrer=" << m_metaData.value("referrer");
00051         connect(job, SIGNAL(result(KJob*)), this, SLOT(slotDownloadFinished(KJob*)));
00052     }
00053 
00054 private Q_SLOTS:
00055     void slotDownloadFinished(KJob* job)
00056     {
00057         KIO::FileCopyJob* fileCopyJob = static_cast<KIO::FileCopyJob *>(job);
00058         if (job->error()) {
00059             kDebug() << "error during download: srcUrl=" << fileCopyJob->srcUrl()
00060                      << "destUrl=" << fileCopyJob->destUrl()
00061                      << "referrer=" << m_metaData.value("referrer");
00062             // TODO: test whether destUrl+".part" exists
00063         } else {
00064             kDebug() << "download finished: srcUrl=" << fileCopyJob->srcUrl()
00065                      << "destUrl=" << fileCopyJob->destUrl()
00066                      << "referrer=" << m_metaData.value("referrer");
00067 #ifdef HAVE_NEPOMUK
00068             Nepomuk::Utils::createCopyEvent( fileCopyJob->srcUrl(),
00069                                              fileCopyJob->destUrl(),
00070                                              m_downloadJobStartTime,
00071                                              KUrl(m_metaData.value("referrer")) );
00072 #endif
00073         }
00074     }
00075 
00076 private:
00077     QMap<QString, QString> m_metaData;
00078     QDateTime m_downloadJobStartTime;
00079 };
00080 }
00081 
00082 #endif /* BROWSERRUN_P_H */
00083 

KParts

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal