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

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • transfer-plugins
  • metalink
metalinkfactory.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE project
2 
3  Copyright (C) 2004 Dario Massarin <nekkar@libero.it>
4  Copyright (C) 2007 Manolo Valdes <nolis71cu@gmail.com>
5  Copyright (C) 2012 Aish Raj Dahal <dahalaishraj@gmail.com>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 */
12 
13 #include "metalinkfactory.h"
14 
15 #include "core/scheduler.h"
16 #include "core/transfergroup.h"
17 #include "metalinkhttp.h"
18 #include "metalinkxml.h"
19 
20 #include <kdebug.h>
21 
22 KGET_EXPORT_PLUGIN( MetalinkFactory )
23 
24 MetalinkFactory::MetalinkFactory(QObject *parent, const QVariantList &args)
25  : TransferFactory(parent, args)
26 {
27 }
28 
29 MetalinkFactory::~MetalinkFactory()
30 {
31 }
32 
33 Transfer * MetalinkFactory::createTransfer( const KUrl &srcUrl, const KUrl &destUrl,
34  TransferGroup * parent,
35  Scheduler * scheduler,
36  const QDomElement * e )
37 {
38  kDebug(5001) << "metalinkFactory::createTransfer";
39  KGetMetalink::MetalinkHttpParser *metalinkHttpChecker = new KGetMetalink::MetalinkHttpParser(srcUrl);
40 
41  if (metalinkHttpChecker->isMetalinkHttp()) {
42  return new MetalinkHttp(parent, this, scheduler, srcUrl, destUrl, metalinkHttpChecker, e);
43  }
44  else
45  {
46  // No one takes ownership of this checker
47  metalinkHttpChecker->deleteLater();
48 
49  if (isSupported(srcUrl)) {
50  return new MetalinkXml(parent, this, scheduler, srcUrl, destUrl, e);
51  }
52 
53  return 0;
54  }
55 }
56 
57 bool MetalinkFactory::isSupported(const KUrl &url) const
58 {
59  return (url.fileName().endsWith(QLatin1String(".metalink")) || url.fileName().endsWith(QLatin1String(".meta4")));
60 }
metalinkxml.h
TransferGroup
class TransferGroup:
Definition: transfergroup.h:46
Scheduler
Scheduler class: what handle all the jobs in kget.
Definition: scheduler.h:32
MetalinkFactory
Definition: metalinkfactory.h:23
KGetMetalink::MetalinkHttpParser
Definition: metalinker.h:419
QObject
scheduler.h
MetalinkFactory::createTransfer
Transfer * createTransfer(const KUrl &srcUrl, const KUrl &destUrl, TransferGroup *parent, Scheduler *scheduler, const QDomElement *e=0)
Definition: metalinkfactory.cpp:33
transfergroup.h
MetalinkHttp
Definition: metalinkhttp.h:25
KGetMetalink::MetalinkHttpParser::isMetalinkHttp
bool isMetalinkHttp()
Definition: metalinker.cpp:1399
metalinkhttp.h
MetalinkFactory::isSupported
bool isSupported(const KUrl &url) const
Checks if a URL is supported by this plugin.
Definition: metalinkfactory.cpp:57
metalinkfactory.h
MetalinkFactory::~MetalinkFactory
~MetalinkFactory()
Definition: metalinkfactory.cpp:29
KGET_EXPORT_PLUGIN
#define KGET_EXPORT_PLUGIN(classname)
Declares a class as plugin.
Definition: kget_export.h:40
MetalinkXml
Definition: metalinkxml.h:25
TransferFactory
TransferFactory.
Definition: transferfactory.h:52
Transfer
Definition: transfer.h:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

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