mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
kget: drop mirror search and multi-segment transfer plugins
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
660e727abc
commit
fda1c192be
32 changed files with 0 additions and 2767 deletions
|
@ -1,7 +1,5 @@
|
|||
add_subdirectory(kio)
|
||||
add_subdirectory(multisegmentkio)
|
||||
add_subdirectory(metalink)
|
||||
add_subdirectory(mirrorsearch)
|
||||
if (LIBMMS_FOUND)
|
||||
add_subdirectory(mmsthreads)
|
||||
endif (LIBMMS_FOUND)
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
include_directories(
|
||||
../../
|
||||
)
|
||||
|
||||
set(kget_mirrorsearchfactory_PART_SRCS
|
||||
mirrors.cpp
|
||||
mirrorsearchtransferdatasource.cpp
|
||||
mirrorsearchfactory.cpp
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kget_mirrorsearchfactory_PART_SRCS mirrorsearchsettings.kcfgc)
|
||||
|
||||
kde4_add_plugin(kget_mirrorsearchfactory ${kget_mirrorsearchfactory_PART_SRCS})
|
||||
|
||||
target_link_libraries(kget_mirrorsearchfactory ${KDE4_KIO_LIBS} kgetcore)
|
||||
|
||||
install(TARGETS kget_mirrorsearchfactory DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
||||
install(FILES kget_mirrorsearchfactory.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
||||
install(FILES kget_mirrorsearchfactory.kcfg DESTINATION ${KDE4_KCFG_INSTALL_DIR})
|
||||
|
||||
###Build KCM-Module
|
||||
set(kcm_kget_mirrorsearchfactory_PART_SRCS
|
||||
dlgmirrorsearch.cpp
|
||||
dlgmirrorsearch.ui
|
||||
dlgengineediting.ui
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kcm_kget_mirrorsearchfactory_PART_SRCS mirrorsearchsettings.kcfgc)
|
||||
kde4_add_plugin(kcm_kget_mirrorsearchfactory ${kcm_kget_mirrorsearchfactory_PART_SRCS})
|
||||
target_link_libraries(kcm_kget_mirrorsearchfactory ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
|
||||
install(TARGETS kcm_kget_mirrorsearchfactory DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
||||
|
||||
install(FILES kget_mirrorsearchfactory_config.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
|
@ -1,52 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>DlgEngineEditing</class>
|
||||
<widget class="QWidget" name="DlgEngineEditing" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>419</width>
|
||||
<height>132</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="engineNameLabel" >
|
||||
<property name="text" >
|
||||
<string>Engine name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="KLineEdit" name="engineNameEdit" >
|
||||
<property name="showClearButton" stdset="0" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="urlLabel" >
|
||||
<property name="text" >
|
||||
<string>URL:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="KLineEdit" name="urlEdit" >
|
||||
<property name="showClearButton" stdset="0" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>klineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,141 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "dlgmirrorsearch.h"
|
||||
|
||||
#include "kget_export.h"
|
||||
#include "mirrorsearchsettings.h"
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
DlgEngineEditing::DlgEngineEditing(QWidget *parent)
|
||||
: KDialog(parent)
|
||||
{
|
||||
QWidget *mainWidget = new QWidget(this);
|
||||
ui.setupUi(mainWidget);
|
||||
setMainWidget(mainWidget);
|
||||
|
||||
setWindowTitle(i18n("Insert Engine"));
|
||||
setModal(true);
|
||||
setButtons(KDialog::Ok | KDialog::Cancel);
|
||||
showButtonSeparator(true);
|
||||
|
||||
ui.engineNameLabel->setText(i18n("Engine name:"));
|
||||
ui.urlLabel->setText(i18n("URL:"));
|
||||
connect(ui.urlEdit,SIGNAL(textChanged(QString)), SLOT(slotChangeText()));
|
||||
connect(ui.engineNameEdit,SIGNAL(textChanged(QString)),SLOT(slotChangeText()));
|
||||
slotChangeText();
|
||||
}
|
||||
|
||||
DlgEngineEditing::~DlgEngineEditing()
|
||||
{
|
||||
}
|
||||
|
||||
void DlgEngineEditing::slotChangeText()
|
||||
{
|
||||
enableButton(KDialog::Ok, !ui.urlEdit->text().isEmpty());
|
||||
}
|
||||
|
||||
QString DlgEngineEditing::engineName() const
|
||||
{
|
||||
return ui.engineNameEdit->text();
|
||||
}
|
||||
|
||||
QString DlgEngineEditing::engineUrl() const
|
||||
{
|
||||
return ui.urlEdit->text();
|
||||
}
|
||||
|
||||
KGET_EXPORT_PLUGIN_CONFIG(DlgSettingsWidget)
|
||||
|
||||
DlgSettingsWidget::DlgSettingsWidget(QWidget *parent, const QVariantList &args)
|
||||
: KCModule(KGetFactory::componentData(), parent, args)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.newEngineBt->setIcon(KIcon("list-add"));
|
||||
ui.removeEngineBt->setIcon(KIcon("list-remove"));
|
||||
|
||||
connect(ui.newEngineBt, SIGNAL(clicked()), SLOT(slotNewEngine()));
|
||||
connect(ui.removeEngineBt, SIGNAL(clicked()), SLOT(slotRemoveEngine()));
|
||||
}
|
||||
|
||||
DlgSettingsWidget::~DlgSettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void DlgSettingsWidget::slotNewEngine()
|
||||
{
|
||||
DlgEngineEditing dialog;
|
||||
if(dialog.exec()) {
|
||||
addSearchEngineItem(dialog.engineName(), dialog.engineUrl());
|
||||
changed();
|
||||
}
|
||||
}
|
||||
|
||||
void DlgSettingsWidget::slotRemoveEngine()
|
||||
{
|
||||
QList<QTreeWidgetItem *> selectedItems = ui.enginesTreeWidget->selectedItems();
|
||||
|
||||
foreach(QTreeWidgetItem * selectedItem, selectedItems)
|
||||
delete(selectedItem);
|
||||
|
||||
changed();
|
||||
}
|
||||
|
||||
void DlgSettingsWidget::load()
|
||||
{
|
||||
loadSearchEnginesSettings();
|
||||
}
|
||||
|
||||
void DlgSettingsWidget::addSearchEngineItem(const QString &name, const QString &url)
|
||||
{
|
||||
ui.enginesTreeWidget->addTopLevelItem(new QTreeWidgetItem(QStringList() << name << url));
|
||||
changed();
|
||||
}
|
||||
|
||||
void DlgSettingsWidget::loadSearchEnginesSettings()
|
||||
{
|
||||
ui.enginesTreeWidget->clear();//Cleanup things first
|
||||
|
||||
QStringList enginesNames = MirrorSearchSettings::self()->searchEnginesNameList();
|
||||
QStringList enginesUrls = MirrorSearchSettings::self()->searchEnginesUrlList();
|
||||
|
||||
for(int i = 0; i < enginesNames.size(); i++)
|
||||
{
|
||||
addSearchEngineItem(enginesNames[i], enginesUrls[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void DlgSettingsWidget::saveSearchEnginesSettings()
|
||||
{
|
||||
QStringList enginesNames;
|
||||
QStringList enginesUrls;
|
||||
|
||||
for(int i = 0; i < ui.enginesTreeWidget->topLevelItemCount(); i++)
|
||||
{
|
||||
enginesNames.append(ui.enginesTreeWidget->topLevelItem(i)->text(0));
|
||||
enginesUrls.append(ui.enginesTreeWidget->topLevelItem(i)->text(1));
|
||||
}
|
||||
|
||||
MirrorSearchSettings::self()->setSearchEnginesNameList(enginesNames);
|
||||
MirrorSearchSettings::self()->setSearchEnginesUrlList(enginesUrls);
|
||||
|
||||
MirrorSearchSettings::self()->writeConfig();
|
||||
}
|
||||
|
||||
void DlgSettingsWidget::save()
|
||||
{
|
||||
kDebug(5001);
|
||||
saveSearchEnginesSettings();
|
||||
|
||||
MirrorSearchSettings::self()->writeConfig();
|
||||
}
|
||||
|
||||
#include "moc_dlgmirrorsearch.cpp"
|
|
@ -1,63 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef DLGMIRRORSEARCH_H
|
||||
#define DLGMIRRORSEARCH_H
|
||||
|
||||
#include "ui_dlgengineediting.h"
|
||||
#include "ui_dlgmirrorsearch.h"
|
||||
|
||||
#include <KCModule>
|
||||
#include <KDialog>
|
||||
|
||||
class DlgEngineEditing : public KDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DlgEngineEditing(QWidget *parent = 0);
|
||||
~DlgEngineEditing();
|
||||
|
||||
QString engineName() const;
|
||||
QString engineUrl() const;
|
||||
private slots:
|
||||
void slotChangeText();
|
||||
|
||||
private:
|
||||
Ui::DlgEngineEditing ui;
|
||||
};
|
||||
|
||||
class DlgSettingsWidget : public KCModule
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DlgSettingsWidget(QWidget *parent = 0, const QVariantList &args = QVariantList());
|
||||
~DlgSettingsWidget();
|
||||
|
||||
public slots:
|
||||
void save();
|
||||
void load();
|
||||
|
||||
private slots:
|
||||
void slotNewEngine();
|
||||
void slotRemoveEngine();
|
||||
|
||||
private:
|
||||
void addSearchEngineItem(const QString &name, const QString &url);
|
||||
|
||||
void loadSearchEnginesSettings();
|
||||
void saveSearchEnginesSettings();
|
||||
|
||||
Ui::DlgMirrorSearch ui;
|
||||
KDialog *m_parent;
|
||||
};
|
||||
|
||||
#endif // DLGMULTISEGKIO_H
|
|
@ -1,79 +0,0 @@
|
|||
<ui version="4.0" >
|
||||
<class>DlgMirrorSearch</class>
|
||||
<widget class="QWidget" name="DlgMirrorSearch" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>403</width>
|
||||
<height>439</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="KTitleWidget" name="ktitlewidget" >
|
||||
<property name="text" >
|
||||
<string>Search Engines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="enginesTreeWidget" >
|
||||
<property name="rootIsDecorated" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Engine Name</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>URL</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<item>
|
||||
<spacer name="spacer" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>91</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newEngineBt" >
|
||||
<property name="text" >
|
||||
<string>New Engine...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeEngineBt" >
|
||||
<property name="text" >
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KTitleWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ktitlewidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,131 +0,0 @@
|
|||
[Desktop Entry]
|
||||
# service definition
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KGet/Plugin
|
||||
Icon=kget
|
||||
|
||||
# standard fields
|
||||
Name=Mirror Search
|
||||
Name[ar]=بحث المرآة
|
||||
Name[ast]=Guetador n'Espeyos
|
||||
Name[bg]=Търсене в огледала
|
||||
Name[bs]=Pretraga ogledala
|
||||
Name[ca]=Cerca de rèpliques
|
||||
Name[ca@valencia]=Cerca de rèpliques
|
||||
Name[cs]=Mirror Search
|
||||
Name[da]=Mirror Search
|
||||
Name[de]=Spiegel-Suche
|
||||
Name[el]=Αναζήτηση Mirror
|
||||
Name[en_GB]=Mirror Search
|
||||
Name[es]=Mirror Search
|
||||
Name[et]=Peegliotsing
|
||||
Name[eu]=Ispiluko bilaketa
|
||||
Name[fi]=Peilihaku
|
||||
Name[fr]=Recherche de miroirs
|
||||
Name[ga]=Mirror Search
|
||||
Name[gl]=Procura de réplicas
|
||||
Name[hne]=मिरर खोज
|
||||
Name[hr]=sMirror Search
|
||||
Name[hu]=Tükörkiszolgáló keresése
|
||||
Name[ia]=Cerca de sito speculo
|
||||
Name[is]=Leitar að speglum
|
||||
Name[it]=Ricerca dei mirror
|
||||
Name[ja]=ミラー検索
|
||||
Name[kk]=Айналарын іздеу
|
||||
Name[km]=ការស្វែងរកកញ្ចក់
|
||||
Name[ko]=미러 검색
|
||||
Name[lt]=Kopijų paieška
|
||||
Name[lv]=Spoguļu meklēšana
|
||||
Name[ml]=കണ്ണാടിസ്ഥാനം അന്വേഷിക്കല്
|
||||
Name[nb]=Mirror Search
|
||||
Name[nds]=Mirror Search
|
||||
Name[nl]=Zoeken op mirrors
|
||||
Name[nn]=MirrorSearch
|
||||
Name[pa]=ਮਿੱਰਰ ਖੋਜ
|
||||
Name[pl]=Wyszukiwanie na serwerach zwierciadlanych
|
||||
Name[pt]=Pesquisa de Réplicas
|
||||
Name[pt_BR]=Pesquisa de sites espelho
|
||||
Name[ro]=Căutare oglindă
|
||||
Name[ru]=Поиск зеркал
|
||||
Name[si]=කැඩපත් සෙවුම
|
||||
Name[sk]=Hľadanie zrkadiel
|
||||
Name[sl]=Iskanje zrcalnih strežnikov
|
||||
Name[sr]=Претрага огледала
|
||||
Name[sr@ijekavian]=Претрага огледала
|
||||
Name[sr@ijekavianlatin]=Pretraga ogledala
|
||||
Name[sr@latin]=Pretraga ogledala
|
||||
Name[sv]=Spegelsökning
|
||||
Name[tr]=Yansı Arama
|
||||
Name[ug]=تەسۋىر ئىزدەش
|
||||
Name[uk]=Пошук дзеркал
|
||||
Name[wa]=Cweraedje e muroe
|
||||
Name[x-test]=xxMirror Searchxx
|
||||
Name[zh_CN]=镜像搜索
|
||||
Name[zh_TW]=映射搜尋
|
||||
|
||||
Comment=Allows KGet to search through mirror search engines for files
|
||||
Comment[ast]=Habilitar que KGet pueda guetar el ficheru per aciu de répliques de los motores de gueta
|
||||
Comment[bg]=Позволява KGet да търси за файлове в търсачки на огледала
|
||||
Comment[bs]=Omogućava KGetu da traži datoteke preko kopiranih pogona za traženje
|
||||
Comment[ca]=Permet que el KGet cerqui els fitxers a rèpliques amb els motors de cerca
|
||||
Comment[ca@valencia]=Permet que el KGet cerque els fitxers a rèpliques de motors de cerques
|
||||
Comment[cs]=Umožní KGetu vyhledávat soubory pomocí nástrojů prohledávajících zrcadla
|
||||
Comment[da]=Gør KGet i stand til at søge efter filer via filspejl-søgemaskiner
|
||||
Comment[de]=Ermöglicht es KGet, nach Dateien über Spiegel-Suchmaschinen zu suchen
|
||||
Comment[el]=Επιτρέπει στο KGet την αναζήτηση του αρχείου σε μηχανές αναζήτησης αντίγραφα
|
||||
Comment[en_GB]=Allows KGet to search through mirror search engines for files
|
||||
Comment[es]=Habilitar que KGet pueda buscar el archivo por medio de réplicas de los motores de búsqueda
|
||||
Comment[et]=Võimaldab KGetil otsida faile peegelotsingumootorite vahendusel
|
||||
Comment[eu]=KGet-ek ispiluko bilaketa-motorren bidez fitxategiak bilatzea baimentzen du
|
||||
Comment[fi]=Sallii KGetin etsiä tiedostoja peilihakukoneilla
|
||||
Comment[fr]=Permettre à KGet de rechercher des fichiers depuis les moteurs de recherches en miroirs
|
||||
Comment[ga]=Ceadaíonn sé seo do KGet comhaid a lorg trí innill chuardaigh scáthánaithe
|
||||
Comment[gl]=Permite que KGet procure ficheiros en buscadores
|
||||
Comment[hr]=Omogućuje KGetu pretraživanje kroz zrcalne pretraživačke mehanizme za datoteke
|
||||
Comment[hu]=Lehetővé teszi fájlok keresését tükörkiszolgálókon
|
||||
Comment[ia]=Il permitte KGet de cercar files per motores de cerca de sitos speculo
|
||||
Comment[is]=Leyfir KGet að leita eftir skrám í leitarvélaspeglum
|
||||
Comment[it]=Consente a KGet di cercare file con motori di ricerca di mirror
|
||||
Comment[ja]=KGet でミラー検索エンジンを使ってファイルを検索します
|
||||
Comment[kk]=KGet-ке файлдарды айналарда іздеу тетігінің көмегімен іздеуді рұқсат ету
|
||||
Comment[km]=អនុញ្ញាត KGet ស្វែងរកឯកសារតាមរយៈម៉ាស៊ីនស្វែងរកកញ្ចក់
|
||||
Comment[ko]=미러 검색 엔진에서 파일 찾기
|
||||
Comment[lt]=Leidžia KGet ieškoti failų naudojant kopijų paieškos variklius
|
||||
Comment[lv]=Ļaut KGet meklēt failus spoguļu meklēšanas dzinējos
|
||||
Comment[nb]=Tillater KGet å søke etter filer via speil-søkemotorer
|
||||
Comment[nds]=Lett KGet Dateien över Spegelserver-Söökmaschinen söken
|
||||
Comment[nl]=Staat KGet toe om bestanden te zoeken met mirrorzoekmachines
|
||||
Comment[nn]=Lèt deg søkja etter filer gjennom MirrorSearch i KGet
|
||||
Comment[pl]=Włącza wyszukiwanie plików w KGet za pomocą zwierciadlanych wyszukiwarek
|
||||
Comment[pt]=Permite ao KGet procurar pelos ficheiros nas réplicas dos motores de busca
|
||||
Comment[pt_BR]=Permite ao KGet pesquisar por arquivos nos sites espelho dos mecanismos de busca
|
||||
Comment[ro]=Permite KGet să caute fișiere prin motoare de căutare a oglinzilor
|
||||
Comment[ru]=Поиск зеркал для файлов через поисковые системы
|
||||
Comment[si]=KGet වෙත ගොනු සඳහා කැඩපත් සෙවුම් එළවුම් තුළ සෙවීමට ඉඩදෙයි
|
||||
Comment[sk]=Umožňuje KGetu vyhľadávanie súborov pomocou zrkadiel
|
||||
Comment[sl]=Omogoči, da KGet datoteke poišče prek iskalnikov po zrcalnih strežnikih
|
||||
Comment[sr]=Омогућава К‑гету да тражи фајлове преко моторâ за тражење огледала
|
||||
Comment[sr@ijekavian]=Омогућава К‑гету да тражи фајлове преко моторâ за тражење огледала
|
||||
Comment[sr@ijekavianlatin]=Omogućava KGetu da traži fajlove preko motorâ za traženje ogledala
|
||||
Comment[sr@latin]=Omogućava KGetu da traži fajlove preko motorâ za traženje ogledala
|
||||
Comment[sv]=Gör det möjligt för Kget att söka efter filen via spegelsöktjänster
|
||||
Comment[tr]=KGet uygulamasının yansı motorlarında arama yapmasını sağlar
|
||||
Comment[ug]=KGet نىڭ ھۆججەتلەرنى تەسۋىر ئىزدەش موتورلىتىدىن ئىزدىشىگە يول قويىدۇ
|
||||
Comment[uk]=Вмикає у KGet можливість пошуку за допомогою рушіїв пошуку дзеркал
|
||||
Comment[x-test]=xxAllows KGet to search through mirror search engines for filesxx
|
||||
Comment[zh_CN]=允许 KGet 通过镜像搜索引擎查找文件
|
||||
Comment[zh_TW]=允許 KGet 透過鏡射搜尋引擎來搜尋檔案
|
||||
|
||||
# options for library loader
|
||||
X-KDE-Library=kget_mirrorsearchfactory
|
||||
X-KDE-KGet-plugintype=TransferFactory
|
||||
X-KDE-KGet-rank=40
|
||||
X-KDE-KGet-framework-version=1
|
||||
|
||||
X-KDE-PluginInfo-Author=Manolo Valdes
|
||||
X-KDE-PluginInfo-Email=nolis71cu@gmail.com
|
||||
X-KDE-PluginInfo-Version=1.0
|
||||
X-KDE-PluginInfo-Category=Service
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
X-KDE-PluginInfo-Name=kget_mirrorsearch_plugin
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<include>kdemacros.h</include>
|
||||
<kcfgfile name="kget_mirrorsearchfactory.rc"/>
|
||||
<group name="SearchEngines">
|
||||
<entry name="UseSearchEngines" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="SearchEnginesNameList" type="StringList" key="NameItems">
|
||||
<label>List of the available search engines</label>
|
||||
<default></default>
|
||||
</entry>
|
||||
<entry name="SearchEnginesUrlList" type="StringList" key="UrlItems">
|
||||
<label>List of the available search engine URLs</label>
|
||||
<default></default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
|
@ -1,64 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KCModule
|
||||
|
||||
X-KDE-Library=kcm_kget_mirrorsearchfactory
|
||||
X-KDE-ParentComponents=kget_mirrorsearch_plugin
|
||||
|
||||
Name=MirrorSearch
|
||||
Name[ar]=بحث المرآة
|
||||
Name[ast]=GuetadorEspeyos
|
||||
Name[bg]=ТърсенеОгледала
|
||||
Name[bs]=MirrorSearch
|
||||
Name[ca]=Cerca de rèplica
|
||||
Name[ca@valencia]=Cerca de rèplica
|
||||
Name[cs]=MirrorSearch
|
||||
Name[da]=MirrorSearch
|
||||
Name[de]=Spiegel-Suche
|
||||
Name[el]=MirrorSearch
|
||||
Name[en_GB]=MirrorSearch
|
||||
Name[es]=MirrorSearch
|
||||
Name[et]=Peegliotsing
|
||||
Name[eu]=Ispiluko bilaketa
|
||||
Name[fi]=Peilihaku
|
||||
Name[fr]=MirrorSearch
|
||||
Name[ga]=MirrorSearch
|
||||
Name[gl]=MirrorSearch
|
||||
Name[hne]=मिररखोज
|
||||
Name[hr]=MirrorSearch
|
||||
Name[hu]=MirrorSearch
|
||||
Name[ia]=MirrorSearch (Cerca de Sito speculo
|
||||
Name[is]=SpeglaLeit
|
||||
Name[it]=MirrorSearch
|
||||
Name[ja]=ミラー検索
|
||||
Name[kk]=MirrorSearch
|
||||
Name[km]=MirrorSearch
|
||||
Name[ko]=미러 검색
|
||||
Name[lt]=MirrorSearch
|
||||
Name[lv]=SpoguļuMeklēšana
|
||||
Name[ml]=കണ്ണാടിസ്ഥാനപരതല്
|
||||
Name[nb]=MirrorSearch
|
||||
Name[nds]=MirrorSearch
|
||||
Name[nl]=MirrorSearch
|
||||
Name[nn]=MirrorSearch
|
||||
Name[pa]=ਮਿੱਰਰ ਖੋਜ
|
||||
Name[pl]=MirrorSearch
|
||||
Name[pt]=Pesquisa de Réplicas
|
||||
Name[pt_BR]=Pesquisa de sites espelho
|
||||
Name[ro]=MirrorSearch
|
||||
Name[ru]=Поиск зеркал
|
||||
Name[si]=කැඩපත් සෙවුම
|
||||
Name[sk]=MirrorSearch
|
||||
Name[sl]=Iskanje zrcalnih strežnikov
|
||||
Name[sr]=Претрага огледала
|
||||
Name[sr@ijekavian]=Претрага огледала
|
||||
Name[sr@ijekavianlatin]=Pretraga ogledala
|
||||
Name[sr@latin]=Pretraga ogledala
|
||||
Name[sv]=Spegelsökning
|
||||
Name[tr]=Yansı Arama
|
||||
Name[ug]=تەسۋىر ئىزدەش
|
||||
Name[uk]=MirrorSearch
|
||||
Name[wa]=MirrorSearch
|
||||
Name[x-test]=xxMirrorSearchxx
|
||||
Name[zh_CN]=镜像搜索
|
||||
Name[zh_TW]=映射搜尋
|
|
@ -1,102 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2006 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "mirrors.h"
|
||||
#include "mirrorsearchsettings.h"
|
||||
|
||||
#include <KDebug>
|
||||
|
||||
mirror::mirror()
|
||||
{
|
||||
if( !MirrorSearchSettings::searchEnginesUrlList().isEmpty())
|
||||
m_search_engine = MirrorSearchSettings::searchEnginesUrlList().takeFirst();
|
||||
}
|
||||
|
||||
void mirror::search(const KUrl &url, QObject *receiver, const char *member)
|
||||
{
|
||||
kDebug(5001);
|
||||
|
||||
m_url = url;
|
||||
if (m_url.path() != m_url.fileName())
|
||||
{
|
||||
m_Urls << m_url;
|
||||
}
|
||||
|
||||
search(m_url.fileName(),receiver,member);
|
||||
}
|
||||
|
||||
void mirror::search(const QString &fileName, QObject *receiver, const char *member)
|
||||
{
|
||||
kDebug(5001);
|
||||
|
||||
KUrl search(m_search_engine.replace("${filename}",fileName));
|
||||
m_job = KIO::get(search, KIO::NoReload, KIO::HideProgressInfo);
|
||||
connect(m_job,SIGNAL(data(KIO::Job*,QByteArray)),
|
||||
SLOT(slotData(KIO::Job*,QByteArray)));
|
||||
connect(m_job,SIGNAL(result(KJob*)),
|
||||
SLOT(slotResult(KJob*)));
|
||||
connect(this,SIGNAL(urls(QList<KUrl>&)),receiver,member);
|
||||
}
|
||||
|
||||
void mirror::slotData(KIO::Job *, const QByteArray& data)
|
||||
{
|
||||
kDebug(5001);
|
||||
if (data.size() == 0)
|
||||
return;
|
||||
m_data.append(data);
|
||||
}
|
||||
|
||||
void mirror::slotResult( KJob *job )
|
||||
{
|
||||
kDebug(5001);
|
||||
m_job = 0;
|
||||
int minUrlsNeeded = static_cast<int>(!m_Urls.isEmpty());
|
||||
|
||||
if( job->error() )
|
||||
{
|
||||
deleteLater();
|
||||
return;
|
||||
}
|
||||
QString str(m_data);
|
||||
|
||||
int start = 0, posOfTagA = 0, posOfTagHref = 0, hrefEnd = 0;
|
||||
|
||||
while ((posOfTagA = str.indexOf("<a " , start, Qt::CaseInsensitive)) != -1 )
|
||||
{
|
||||
posOfTagHref = str.indexOf("href=\"", posOfTagA, Qt::CaseInsensitive);
|
||||
hrefEnd = str.indexOf("\"",posOfTagHref + 6,Qt::CaseInsensitive);
|
||||
QString u = str.mid(posOfTagHref + 6, (hrefEnd - posOfTagHref -6));
|
||||
|
||||
start = hrefEnd + 1;
|
||||
if ( u.endsWith( '/' + m_url.fileName() ) )
|
||||
{
|
||||
m_Urls << KUrl(u);
|
||||
kDebug(5001) << "url: " << u;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Urls.size() > minUrlsNeeded)
|
||||
emit urls(m_Urls);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void MirrorSearch ( const KUrl &url, QObject *receiver, const char *member )
|
||||
{
|
||||
mirror *searcher = new mirror();
|
||||
searcher->search(url, receiver, member);
|
||||
}
|
||||
|
||||
void MirrorSearch ( const QString &fileName, QObject *receiver, const char *member )
|
||||
{
|
||||
mirror *searcher = new mirror();
|
||||
searcher->search(fileName, receiver, member);
|
||||
}
|
||||
|
||||
#include "moc_mirrors.cpp"
|
|
@ -1,46 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2006 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef MIRROR_H
|
||||
#define MIRROR_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <kio/job.h>
|
||||
|
||||
class mirror : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
mirror();
|
||||
void search(const KUrl &url, QObject *receiver, const char *member);
|
||||
void search(const QString &fileName, QObject *receiver, const char *member);
|
||||
|
||||
Q_SIGNALS:
|
||||
|
||||
void urls (QList<KUrl>&);
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
void slotData(KIO::Job *, const QByteArray& data);
|
||||
void slotResult( KJob *job );
|
||||
|
||||
private:
|
||||
|
||||
QString m_search_engine;
|
||||
KIO::TransferJob *m_job;
|
||||
KUrl m_url;
|
||||
QList<KUrl> m_Urls;
|
||||
QByteArray m_data;
|
||||
};
|
||||
|
||||
void MirrorSearch ( const KUrl &url, QObject *receiver, const char *member );
|
||||
|
||||
#endif // MIRROR_H
|
|
@ -1,40 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "mirrorsearchfactory.h"
|
||||
#include "mirrorsearchtransferdatasource.h"
|
||||
|
||||
#include "core/scheduler.h"
|
||||
#include "core/transfergroup.h"
|
||||
|
||||
#include <QtXml/qdom.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
KGET_EXPORT_PLUGIN( MirrorSearchFactory )
|
||||
|
||||
MirrorSearchFactory::MirrorSearchFactory(QObject *parent, const QVariantList &args)
|
||||
: TransferFactory(parent, args)
|
||||
{
|
||||
}
|
||||
|
||||
MirrorSearchFactory::~MirrorSearchFactory()
|
||||
{
|
||||
}
|
||||
|
||||
TransferDataSource *MirrorSearchFactory::createTransferDataSource(const KUrl &srcUrl, const QDomElement &type, QObject *parent)
|
||||
{
|
||||
kDebug(5001);
|
||||
|
||||
if (type.attribute("type") == "search") {
|
||||
return new MirrorSearchTransferDataSource(srcUrl, parent);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef MIRRORSEARCH_FACTORY_H
|
||||
#define MIRRORSEARCH_FACTORY_H
|
||||
|
||||
#include "core/plugin/transferfactory.h"
|
||||
|
||||
class Transfer;
|
||||
class TransferGroup;
|
||||
class Scheduler;
|
||||
class TransferDataSource;
|
||||
|
||||
class MirrorSearchFactory : public TransferFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MirrorSearchFactory(QObject *parent, const QVariantList &args);
|
||||
~MirrorSearchFactory();
|
||||
|
||||
TransferDataSource * createTransferDataSource(const KUrl &srcUrl, const QDomElement &type, QObject *parent);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,5 +0,0 @@
|
|||
ClassName=MirrorSearchSettings
|
||||
File=kget_mirrorsearchfactory.kcfg
|
||||
Mutators=true
|
||||
Singleton=true
|
||||
Visibility=KDE_EXPORT
|
|
@ -1,46 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "mirrorsearchtransferdatasource.h"
|
||||
#include "mirrors.h"
|
||||
#include <kdebug.h>
|
||||
|
||||
MirrorSearchTransferDataSource::MirrorSearchTransferDataSource(const KUrl &srcUrl, QObject *parent)
|
||||
: TransferDataSource(srcUrl, parent)
|
||||
{
|
||||
m_filename = m_sourceUrl.fileName();
|
||||
kDebug(5001) << m_filename;
|
||||
}
|
||||
|
||||
void MirrorSearchTransferDataSource::start()
|
||||
{
|
||||
kDebug(5001);
|
||||
if(!m_filename.isEmpty())
|
||||
MirrorSearch (m_filename, this, SLOT(slotSearchUrls(QList<KUrl>&)));
|
||||
}
|
||||
|
||||
void MirrorSearchTransferDataSource::stop()
|
||||
{
|
||||
kDebug(5001);
|
||||
}
|
||||
|
||||
void MirrorSearchTransferDataSource::addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange)
|
||||
{
|
||||
Q_UNUSED(segmentSize)
|
||||
Q_UNUSED(segmentRange)
|
||||
kDebug(5001);
|
||||
}
|
||||
|
||||
void MirrorSearchTransferDataSource::slotSearchUrls(QList<KUrl>& Urls)
|
||||
{
|
||||
emit data(Urls);
|
||||
}
|
||||
|
||||
#include "moc_mirrorsearchtransferdatasource.cpp"
|
|
@ -1,35 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef MIRRORSEARCHTRANSFERDATASOURCE_H
|
||||
#define MIRRORSEARCHTRANSFERDATASOURCE_H
|
||||
|
||||
#include "core/transferdatasource.h"
|
||||
|
||||
#include <kio/job.h>
|
||||
|
||||
class MirrorSearchTransferDataSource : public TransferDataSource
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MirrorSearchTransferDataSource(const KUrl &srcUrl, QObject *parent);
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
void addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange);
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotSearchUrls(QList<KUrl>& Urls);
|
||||
|
||||
private:
|
||||
QString m_filename;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,33 +0,0 @@
|
|||
include_directories(
|
||||
../../
|
||||
)
|
||||
|
||||
set(kget_multisegkiofactory_PART_SRCS
|
||||
segment.cpp
|
||||
multisegkiodatasource.cpp
|
||||
transfermultisegkio.cpp
|
||||
transfermultisegkiofactory.cpp
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kget_multisegkiofactory_PART_SRCS multisegkiosettings.kcfgc)
|
||||
|
||||
kde4_add_plugin(kget_multisegkiofactory ${kget_multisegkiofactory_PART_SRCS})
|
||||
|
||||
target_link_libraries(kget_multisegkiofactory ${KDE4_KIO_LIBS} kgetcore)
|
||||
|
||||
install(TARGETS kget_multisegkiofactory DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
||||
install(FILES kget_multisegkiofactory.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
||||
install(FILES kget_multisegkiofactory.kcfg DESTINATION ${KDE4_KCFG_INSTALL_DIR})
|
||||
|
||||
###Build KCM-Module
|
||||
set(kcm_kget_multisegkiofactory_PART_SRCS
|
||||
dlgmultisegkio.cpp
|
||||
dlgmultisegkio.ui
|
||||
)
|
||||
|
||||
kde4_add_kcfg_files(kcm_kget_multisegkiofactory_PART_SRCS multisegkiosettings.kcfgc)
|
||||
kde4_add_plugin(kcm_kget_multisegkiofactory ${kcm_kget_multisegkiofactory_PART_SRCS})
|
||||
target_link_libraries(kcm_kget_multisegkiofactory ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
|
||||
install(TARGETS kcm_kget_multisegkiofactory DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
||||
|
||||
install(FILES kget_multisegkiofactory_config.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
|
@ -1,51 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2006 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "dlgmultisegkio.h"
|
||||
|
||||
#include "multisegkiosettings.h"
|
||||
|
||||
#include "kget_export.h"
|
||||
|
||||
KGET_EXPORT_PLUGIN_CONFIG(DlgSettingsWidget)
|
||||
|
||||
DlgSettingsWidget::DlgSettingsWidget(QWidget *parent, const QVariantList &args)
|
||||
: KCModule(KGetFactory::componentData(), parent, args)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.numSegSpinBox, SIGNAL(valueChanged(int)), SLOT(changed()));
|
||||
connect(ui.enginesCheckBox, SIGNAL(clicked(bool)), SLOT(changed()));
|
||||
connect(ui.verificationCheckBox, SIGNAL(clicked(bool)), SLOT(changed()));
|
||||
}
|
||||
|
||||
DlgSettingsWidget::~DlgSettingsWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void DlgSettingsWidget::load()
|
||||
{
|
||||
ui.numSegSpinBox->setValue(MultiSegKioSettings::segments());
|
||||
|
||||
ui.enginesCheckBox->setChecked(MultiSegKioSettings::useSearchEngines());
|
||||
ui.verificationCheckBox->setChecked(MultiSegKioSettings::useSearchVerification());
|
||||
}
|
||||
|
||||
void DlgSettingsWidget::save()
|
||||
{
|
||||
kDebug(5001) << "Saving Multithreaded config";
|
||||
MultiSegKioSettings::setSegments(ui.numSegSpinBox->value());
|
||||
MultiSegKioSettings::setUseSearchEngines(ui.enginesCheckBox->isChecked());
|
||||
MultiSegKioSettings::setUseSearchVerification(ui.verificationCheckBox->isChecked());
|
||||
|
||||
MultiSegKioSettings::self()->writeConfig();
|
||||
}
|
||||
|
||||
#include "moc_dlgmultisegkio.cpp"
|
|
@ -1,33 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2006 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef DLGMULTISEGKIO_H
|
||||
#define DLGMULTISEGKIO_H
|
||||
|
||||
#include "ui_dlgmultisegkio.h"
|
||||
|
||||
#include <KCModule>
|
||||
|
||||
class DlgSettingsWidget : public KCModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DlgSettingsWidget(QWidget * parent = 0, const QVariantList &args = QVariantList());
|
||||
~DlgSettingsWidget();
|
||||
|
||||
public slots:
|
||||
virtual void save();
|
||||
virtual void load();
|
||||
|
||||
private:
|
||||
Ui::DlgMultiSeg ui;
|
||||
};
|
||||
|
||||
#endif // DLGMULTISEGKIO_H
|
|
@ -1,72 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DlgMultiSeg</class>
|
||||
<widget class="QWidget" name="DlgMultiSeg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>414</width>
|
||||
<height>155</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Number of connections per URL:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="numSegSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enginesCheckBox">
|
||||
<property name="text">
|
||||
<string>Use search engines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="verificationCheckBox">
|
||||
<property name="text">
|
||||
<string>Search for verification information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="spacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>39</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,133 +0,0 @@
|
|||
[Desktop Entry]
|
||||
# service definition
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KGet/Plugin
|
||||
Icon=kget
|
||||
|
||||
# standard fields
|
||||
Name=Multi Segment KIO
|
||||
Name[ar]=متعدد اجزاء KIO
|
||||
Name[ast]=Multi SegmentuKIO
|
||||
Name[bs]=Više-segmentni KIO
|
||||
Name[ca]=KIO per a multi-segment
|
||||
Name[ca@valencia]=Multisegment KIO
|
||||
Name[cs]=Multi Segment KIO
|
||||
Name[da]=Multi Segment-KIO
|
||||
Name[de]=KIO-Übertragungsmodul für Mehrfachsegmente
|
||||
Name[el]=ΚΙΟ πολλαπλών τμημάτων
|
||||
Name[en_GB]=Multi Segment KIO
|
||||
Name[es]=Multi Segment KIO
|
||||
Name[et]=Mitmesegmendiline KIO
|
||||
Name[eu]=Segmentu anitzeko KIO
|
||||
Name[fi]=Monisegmentti-KIO
|
||||
Name[fr]=Module d'entrées / sorties multi-segments
|
||||
Name[ga]=Il-Deighleán KIO
|
||||
Name[gl]=KIO multisegmento
|
||||
Name[hne]=मल्टी सेगमेंट केआईओ
|
||||
Name[hr]=Višesegmentni KIO
|
||||
Name[hu]=Többszakaszos KIO
|
||||
Name[ia]=Segmento multiple de KIO
|
||||
Name[is]=Marghluta KIO
|
||||
Name[it]=KIO a segmenti multipli
|
||||
Name[ja]=マルチセグメントの KIO
|
||||
Name[kk]=Көп сегментті KIO
|
||||
Name[km]=ផ្នែកច្រើនរបស់ KIO
|
||||
Name[ko]=다중 세그먼트 KIO
|
||||
Name[lt]=Daugelio segmentų KIO
|
||||
Name[lv]=Multisegmentu KIO
|
||||
Name[ml]=ബഹു ഖണ്ഡ കിയോ
|
||||
Name[nb]=Multi-segment KIO
|
||||
Name[nds]=Mehrsegment-KIO
|
||||
Name[nl]=Multisegment-KIO
|
||||
Name[nn]=Fleirsegmentert KIO
|
||||
Name[pa]=ਮਲਟੀ ਸਿਗਮੈਂਟ KIO
|
||||
Name[pl]=Wielosegmentowe KIO
|
||||
Name[pt]=KIO Multi-Segmentos
|
||||
Name[pt_BR]=KIO multissegmentado
|
||||
Name[ro]=KIO Multi-segment
|
||||
Name[ru]=Многопоточная загрузка
|
||||
Name[si]=බහු කොටස් KIO
|
||||
Name[sk]=Multi segmentové KIO
|
||||
Name[sl]=Več-delčni KIO
|
||||
Name[sq]=Multi Segment KIO
|
||||
Name[sr]=Вишесегментни К‑У/И
|
||||
Name[sr@ijekavian]=Вишесегментни К‑У/И
|
||||
Name[sr@ijekavianlatin]=Višesegmentni K‑U/I
|
||||
Name[sr@latin]=Višesegmentni K‑U/I
|
||||
Name[sv]=Flersegments-KIO
|
||||
Name[tr]=Çok Parçalı KIO
|
||||
Name[ug]=كۆپ بۆلەك KIO
|
||||
Name[uk]=Багатосегментний KIO
|
||||
Name[x-test]=xxMulti Segment KIOxx
|
||||
Name[zh_CN]=多段式 KIO
|
||||
Name[zh_TW]=多段式 KIO
|
||||
Comment=Multithreaded file download plugin
|
||||
Comment[ar]=ملحق تعدد تنزيل الملف
|
||||
Comment[ast]=Complementu de baxada de ficheru multicapa
|
||||
Comment[bg]=Приставка за многонишково изтегляне на файлове
|
||||
Comment[bs]=Dodatak za više-nitno preuzimanje datoteka
|
||||
Comment[ca]=Connector de transferències multi-fil per al KGet
|
||||
Comment[ca@valencia]=Connector de transferències multifil per al KGet
|
||||
Comment[cs]=Modul pro stahování ve více vláknech
|
||||
Comment[da]=Plugin til flertrådet fildownload
|
||||
Comment[de]=Multithread-Übertragungsmodul für KGet
|
||||
Comment[el]=Πολυνηματικό πρόσθετο λήψης αρχείων
|
||||
Comment[en_GB]=Multithreaded file download plugin
|
||||
Comment[es]=Complemento de descarga de archivo multicapa
|
||||
Comment[et]=Mitmelõimelise failide allalaadimise plugin
|
||||
Comment[eu]=Hainbat haritako fitxategiaren deskargaren plugina
|
||||
Comment[fi]=Monisäikeinen tiedostonlatausliitännäinen
|
||||
Comment[fr]=Module externe multi-tâche pour le téléchargement de fichiers
|
||||
Comment[ga]=Breiseán íosluchtaithe ilsnáitheanna
|
||||
Comment[gl]=Engadido multifío de transferencias de ficheiros
|
||||
Comment[hne]=मल्टीथ्रेडेड फाइल डाउनलोड प्लगइन
|
||||
Comment[hr]=Priključak za višedretveno preuzimanje datoteka
|
||||
Comment[hu]=Többszálas fájlletöltő modul
|
||||
Comment[ia]=Plug-in de discargamento de file Multithreaded
|
||||
Comment[is]=Margþráða niðurhalsíforrit
|
||||
Comment[it]=Estensione di scaricamento dei file in parallelo
|
||||
Comment[ja]=マルチスレッドのファイルダウンロード用プラグイン
|
||||
Comment[kk]=Файлды бірнеше ағынға бөліп жүктеу плагині
|
||||
Comment[km]=កម្មវិធីជំនួយទាញយកឯកសាររបស់ Multithreaded
|
||||
Comment[ko]=다중 스레드 파일 다운로드 플러그인
|
||||
Comment[lt]=Kelių atsiuntimo gijų priedas
|
||||
Comment[lv]=Daudzpavedienu failu lejupielādes spraudnis
|
||||
Comment[ml]=ഫയല് ഇറക്കിവെക്കനുള്ള ബഹുപിരിയന് സംയോജകം
|
||||
Comment[nb]=Programtillegg for flertrådete filnedlastinger
|
||||
Comment[nds]=Mehrsträngsch Datei-Daallaadmoduul
|
||||
Comment[nl]=Multithreaded bestandsdownloadplugin
|
||||
Comment[nn]=Programtillegg for fleirtråda nedlasting av filer
|
||||
Comment[pa]=ਮਲਟੀਥਰਿੱਡ ਫਾਇਲ ਡਾਈਲਾਗ ਪਲੱਗਇਨ
|
||||
Comment[pl]=Wielowątkowa wtyczka do pobierania plików
|
||||
Comment[pt]='Plugin' de transferências de ficheiros multitarefa
|
||||
Comment[pt_BR]=Plugin de download de arquivos multitarefa
|
||||
Comment[ro]=Modul de descărcare multi-fir
|
||||
Comment[ru]=Модуль многопоточной загрузки файлов
|
||||
Comment[si]=බහු ත්රෙඩ ගොනු බාගත ප්ලගිනය
|
||||
Comment[sk]=Modul pre viacvláknové sťahovanie súborov
|
||||
Comment[sl]=Vstavek za večnitni prejem datoteke
|
||||
Comment[sr]=Прикључак за вишенитно преузимање фајлова
|
||||
Comment[sr@ijekavian]=Прикључак за вишенитно преузимање фајлова
|
||||
Comment[sr@ijekavianlatin]=Priključak za višenitno preuzimanje fajlova
|
||||
Comment[sr@latin]=Priključak za višenitno preuzimanje fajlova
|
||||
Comment[sv]=Flertrådat insticksprogram för filnerladdning
|
||||
Comment[tr]=Çoklu işleyebilen indirme eklentisi
|
||||
Comment[ug]=كۆپ يوللۇق ھۆججەت چۈشۈرۈش قىستۇرمىسى
|
||||
Comment[uk]=Додаток звантаження файлів у декілька потоків
|
||||
Comment[x-test]=xxMultithreaded file download pluginxx
|
||||
Comment[zh_CN]=多线程文件下载插件
|
||||
Comment[zh_TW]=多緒檔案下載外掛程式
|
||||
|
||||
# options for library loader
|
||||
X-KDE-Library=kget_multisegkiofactory
|
||||
X-KDE-KGet-plugintype=TransferFactory
|
||||
X-KDE-KGet-rank=70
|
||||
X-KDE-KGet-framework-version=1
|
||||
|
||||
X-KDE-PluginInfo-Author=Manolo Valdes
|
||||
X-KDE-PluginInfo-Email=nolis71cu@gmail.com
|
||||
X-KDE-PluginInfo-Version=1.0
|
||||
X-KDE-PluginInfo-Category=Service
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
||||
X-KDE-PluginInfo-Name=kget_multisegkio_plugin
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<include>kdemacros.h</include>
|
||||
<kcfgfile name="kget_multisegkiofactory.rc"/>
|
||||
<group name="Segments">
|
||||
<entry name="Segments" type="Int">
|
||||
<default>5</default>
|
||||
</entry>
|
||||
<entry name="SaveSegSize" type="Int">
|
||||
<default>100</default>
|
||||
</entry>
|
||||
</group>
|
||||
<group name="SearchEngines">
|
||||
<entry name="UseSearchEngines" type="Bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
</group>
|
||||
<group name="Verification">
|
||||
<entry name="UseSearchVerification" type="Bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
</group>
|
||||
</kcfg>
|
|
@ -1,63 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Type=Service
|
||||
X-KDE-ServiceTypes=KCModule
|
||||
|
||||
X-KDE-Library=kcm_kget_multisegkiofactory
|
||||
X-KDE-ParentComponents=kget_multisegkio_plugin
|
||||
|
||||
Name=MultiSegmentKIO
|
||||
Name[ar]=متعدد أجزاء KIO
|
||||
Name[ast]=MultiSegmentKIO
|
||||
Name[bs]=MultiSegmentKIO
|
||||
Name[ca]=MultiSegmentKIO
|
||||
Name[ca@valencia]=MultiSegmentKIO
|
||||
Name[cs]=MultiSegmentKIO
|
||||
Name[da]=MultiSegmentKIO
|
||||
Name[de]=MultiSegmentKIO
|
||||
Name[el]=MultiSegmentKIO
|
||||
Name[en_GB]=MultiSegmentKIO
|
||||
Name[es]=MultiSegmentKIO
|
||||
Name[et]=Mitmesegmendiline KIO
|
||||
Name[eu]=Segmentu anitzeko KIO
|
||||
Name[fi]=MonisegmenttiKIO
|
||||
Name[fr]=Module d'entrées / sorties multi-segments
|
||||
Name[ga]=MultiSegmentKIO
|
||||
Name[gl]=MultiSegmentKIO
|
||||
Name[hne]=मल्टी सेगमेंट केआईओ
|
||||
Name[hr]=MultiSegmentKIO
|
||||
Name[hu]=Többszakaszos KIO letöltéskezelő
|
||||
Name[ia]=MultiSegmentKIO
|
||||
Name[is]=Marghluta KIO
|
||||
Name[it]=KIO a segmenti multipli
|
||||
Name[ja]=MultiSegmentKIO
|
||||
Name[kk]=MultiSegmentKIO
|
||||
Name[km]=MultiSegmentKIO
|
||||
Name[ko]=다중 세그먼트 KIO
|
||||
Name[lt]=Daugelio segmentų KIO
|
||||
Name[lv]=MultisegmentuKIO
|
||||
Name[ml]=ബഹുഖണ്ഡകിയോ
|
||||
Name[nb]=MultiSegmentKIO
|
||||
Name[nds]=Mehrsegment-KIO-Moduul
|
||||
Name[nl]=MultiSegmentKIO
|
||||
Name[nn]=Fleirsegmentert KIO
|
||||
Name[pa]=MultiSegmentKIO
|
||||
Name[pl]=WielosegmentoweKIO
|
||||
Name[pt]=KIO Multi-Segmentos
|
||||
Name[pt_BR]=KIOMultiSegmentado
|
||||
Name[ro]=MultiSegmentKIO
|
||||
Name[ru]=Многопоточная загрузка
|
||||
Name[si]=බහු කොටස් KIO
|
||||
Name[sk]=MultiSegmentKIO
|
||||
Name[sl]=Več-delčni KIO
|
||||
Name[sq]=MultiSegmentKIO
|
||||
Name[sr]=вишесегментни К‑У/И
|
||||
Name[sr@ijekavian]=вишесегментни К‑У/И
|
||||
Name[sr@ijekavianlatin]=višesegmentni K‑U/I
|
||||
Name[sr@latin]=višesegmentni K‑U/I
|
||||
Name[sv]=Flersegments-KIO
|
||||
Name[tr]=Çok Parçalı KIO
|
||||
Name[ug]=كۆپ بۆلەك KIO
|
||||
Name[uk]=MultiSegmentKIO
|
||||
Name[x-test]=xxMultiSegmentKIOxx
|
||||
Name[zh_CN]=多段式 KIO
|
||||
Name[zh_TW]=多段式 KIO
|
|
@ -1,264 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
|
||||
Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "multisegkiodatasource.h"
|
||||
#include "segment.h"
|
||||
#include "core/transfer.h"
|
||||
|
||||
#include <KDebug>
|
||||
|
||||
MultiSegKioDataSource::MultiSegKioDataSource(const KUrl &srcUrl, QObject *parent)
|
||||
: TransferDataSource(srcUrl, parent),
|
||||
m_size(0),
|
||||
m_canResume(false),
|
||||
m_started(false)
|
||||
{
|
||||
kDebug(5001) << "Create MultiSegKioDataSource for" << m_sourceUrl << this;
|
||||
setCapabilities(capabilities() | Transfer::Cap_FindFilesize);
|
||||
}
|
||||
|
||||
MultiSegKioDataSource::~MultiSegKioDataSource()
|
||||
{
|
||||
kDebug(5001) << this;
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::start()
|
||||
{
|
||||
kDebug(5001) << this;
|
||||
|
||||
m_started = true;
|
||||
foreach (Segment *segment, m_segments)
|
||||
{
|
||||
segment->startTransfer();
|
||||
}
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::stop()
|
||||
{
|
||||
kDebug(5001) << this << m_segments.count() << "segments stopped.";
|
||||
|
||||
m_started = false;
|
||||
foreach (Segment *segment, m_segments)
|
||||
{
|
||||
if (segment->findingFileSize()) {
|
||||
kDebug(5001) << "Removing findingFileSize segment" << this;
|
||||
m_segments.removeAll(segment);
|
||||
segment->deleteLater();
|
||||
} else {
|
||||
segment->stopTransfer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QList<QPair<int, int> > MultiSegKioDataSource::assignedSegments() const
|
||||
{
|
||||
QList<QPair<int, int> > assigned;
|
||||
foreach (Segment *segment, m_segments)
|
||||
{
|
||||
assigned.append(segment->assignedSegments());
|
||||
}
|
||||
|
||||
return assigned;
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange)
|
||||
{
|
||||
Segment *segment = new Segment(m_sourceUrl, segmentSize, segmentRange, this);
|
||||
m_segments.append(segment);
|
||||
|
||||
connect(segment, SIGNAL(canResume()), this, SLOT(slotCanResume()));
|
||||
connect(segment, SIGNAL(totalSize(KIO::filesize_t,QPair<int,int>)), this, SLOT(slotTotalSize(KIO::filesize_t,QPair<int,int>)));
|
||||
connect(segment, SIGNAL(data(KIO::fileoffset_t,QByteArray,bool&)), this, SIGNAL(data(KIO::fileoffset_t,QByteArray,bool&)));
|
||||
connect(segment, SIGNAL(finishedSegment(Segment*,int,bool)), this, SLOT(slotFinishedSegment(Segment*,int,bool)));
|
||||
connect(segment, SIGNAL(error(Segment*,QString,Transfer::LogLevel)), this, SLOT(slotError(Segment*,QString,Transfer::LogLevel)));
|
||||
connect(segment, SIGNAL(finishedDownload(KIO::filesize_t)), this, SLOT(slotFinishedDownload(KIO::filesize_t)));
|
||||
connect(segment, SIGNAL(urlChanged(KUrl)), this, SLOT(slotUrlChanged(KUrl)));
|
||||
|
||||
if (m_started) {
|
||||
segment->startTransfer();
|
||||
}
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::slotUrlChanged(const KUrl &url)
|
||||
{
|
||||
if (m_sourceUrl != url) {
|
||||
emit urlChanged(m_sourceUrl, url);
|
||||
m_sourceUrl = url;
|
||||
}
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::findFileSize(KIO::fileoffset_t segmentSize)
|
||||
{
|
||||
addSegments(qMakePair(segmentSize, segmentSize), qMakePair(-1, -1));
|
||||
Segment *segment = m_segments.last();
|
||||
segment->startTransfer();
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::slotSpeed(ulong downloadSpeed)
|
||||
{
|
||||
m_speed = downloadSpeed;
|
||||
emit speed(m_speed);
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::slotFinishedSegment(Segment *segment, int segmentNum, bool connectionFinished)
|
||||
{
|
||||
if (connectionFinished) {
|
||||
m_segments.removeAll(segment);
|
||||
segment->deleteLater();
|
||||
}
|
||||
emit finishedSegment(this, segmentNum, connectionFinished);
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::setSupposedSize(KIO::filesize_t supposedSize)
|
||||
{
|
||||
m_supposedSize = supposedSize;
|
||||
|
||||
//check if the size is correct
|
||||
slotTotalSize(m_size);
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::slotTotalSize(KIO::filesize_t size, const QPair<int, int> &range)
|
||||
{
|
||||
kDebug(5001) << "Size found for" << m_sourceUrl << size << "bytes";
|
||||
|
||||
m_size = size;
|
||||
|
||||
//findFileSize was called
|
||||
if ((range.first != -1) && (range.second != -1)) {
|
||||
emit foundFileSize(this, size, range);
|
||||
}
|
||||
|
||||
//the filesize is not what it should be, maybe using a wrong mirror
|
||||
if (m_size && m_supposedSize && (m_size != m_supposedSize))
|
||||
{
|
||||
kDebug(5001) << "Size does not match for" << m_sourceUrl << this;
|
||||
emit broken(this, WrongDownloadSize);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::slotCanResume()
|
||||
{
|
||||
kDebug(5001) << this;
|
||||
|
||||
if (!m_canResume) {
|
||||
m_canResume = true;
|
||||
setCapabilities(capabilities() | Transfer::Cap_Resuming);
|
||||
}
|
||||
}
|
||||
|
||||
int MultiSegKioDataSource::currentSegments() const
|
||||
{
|
||||
return m_segments.count();
|
||||
}
|
||||
|
||||
Segment *MultiSegKioDataSource::mostUnfinishedSegments(int *unfin) const
|
||||
{
|
||||
int unfinished = 0;
|
||||
Segment *seg = 0;
|
||||
foreach (Segment *segment, m_segments)
|
||||
{
|
||||
if (segment->countUnfinishedSegments() > unfinished)
|
||||
{
|
||||
unfinished = segment->countUnfinishedSegments();
|
||||
seg = segment;
|
||||
}
|
||||
}
|
||||
|
||||
if (unfin)
|
||||
{
|
||||
*unfin = unfinished;
|
||||
}
|
||||
|
||||
return seg;
|
||||
}
|
||||
|
||||
int MultiSegKioDataSource::countUnfinishedSegments() const
|
||||
{
|
||||
int unfinished = 0;
|
||||
mostUnfinishedSegments(&unfinished);
|
||||
|
||||
return unfinished;
|
||||
}
|
||||
|
||||
QPair<int, int> MultiSegKioDataSource::split()
|
||||
{
|
||||
QPair<int, int> unassigned = qMakePair(-1, -1);
|
||||
Segment *seg = mostUnfinishedSegments();
|
||||
if (seg) {
|
||||
unassigned = seg->split();
|
||||
}
|
||||
|
||||
return unassigned;
|
||||
}
|
||||
|
||||
QPair<int, int> MultiSegKioDataSource::removeConnection()
|
||||
{
|
||||
QPair<int, int> unassigned = qMakePair(-1, -1);
|
||||
Segment *seg = mostUnfinishedSegments();
|
||||
if (seg) {
|
||||
unassigned = seg->assignedSegments();
|
||||
m_segments.removeAll(seg);
|
||||
seg->deleteLater();
|
||||
}
|
||||
|
||||
return unassigned;
|
||||
}
|
||||
|
||||
bool MultiSegKioDataSource::tryMerge(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange)
|
||||
{
|
||||
foreach (Segment *segment, m_segments) {
|
||||
if (segment->merge(segmentSize, segmentRange)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::slotError(Segment *segment, const QString &errorText, Transfer::LogLevel logLevel)
|
||||
{
|
||||
kDebug(5001) << "Error" << errorText << "segment" << segment;
|
||||
|
||||
const QPair<KIO::fileoffset_t, KIO::fileoffset_t> size = segment->segmentSize();
|
||||
const QPair<int, int> range = segment->assignedSegments();
|
||||
m_segments.removeAll(segment);
|
||||
segment->deleteLater();
|
||||
|
||||
emit log(errorText, logLevel);
|
||||
if (m_segments.isEmpty()) {
|
||||
kDebug(5001) << this << "has broken segments.";
|
||||
emit brokenSegments(this, range);
|
||||
} else {
|
||||
//decrease the number of maximum paralell downloads, maybe the server does not support so many connections
|
||||
if (m_paralellSegments > 1) {
|
||||
--m_paralellSegments;
|
||||
}
|
||||
kDebug(5001) << this << "reducing connections to" << m_paralellSegments << "and freeing range of semgents" << range;
|
||||
if (!tryMerge(size, range)) {
|
||||
emit freeSegments(this, range);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::slotFinishedDownload(KIO::filesize_t size)
|
||||
{
|
||||
stop();
|
||||
emit finishedDownload(this, size);
|
||||
}
|
||||
|
||||
void MultiSegKioDataSource::slotRestartBrokenSegment()
|
||||
{
|
||||
kDebug(5001) << this;
|
||||
start();
|
||||
}
|
||||
|
||||
|
||||
#include "moc_multisegkiodatasource.cpp"
|
|
@ -1,73 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2008 Manolo Valdes <nolis71cu@gmail.com>
|
||||
Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef KGET_MULTISEGKIODATASOURCE_H
|
||||
#define KGET_MULTISEGKIODATASOURCE_H
|
||||
|
||||
#include "core/transferdatasource.h"
|
||||
|
||||
class Segment;
|
||||
|
||||
class MultiSegKioDataSource : public TransferDataSource
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MultiSegKioDataSource(const KUrl &srcUrl, QObject *parent);
|
||||
~MultiSegKioDataSource();
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
void findFileSize(KIO::fileoffset_t segmentSize);
|
||||
void addSegments(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange);
|
||||
QPair<int, int> removeConnection();
|
||||
QList<QPair<int, int> > assignedSegments() const;
|
||||
int countUnfinishedSegments() const;
|
||||
QPair<int, int> split();
|
||||
|
||||
void setSupposedSize(KIO::filesize_t supposedSize);
|
||||
int currentSegments() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotSpeed(ulong speed);
|
||||
void slotFinishedSegment(Segment *segment, int segmentNum, bool connectionFinished);
|
||||
void slotRestartBrokenSegment();
|
||||
|
||||
/**
|
||||
* There was an error while downloading segment, the number of connections this
|
||||
* TransferDataSource uses simultanously gets reduced
|
||||
*/
|
||||
void slotError(Segment *segment, const QString &errorText, Transfer::LogLevel logLevel);
|
||||
|
||||
/**the following slots are there to check if the size reported by the mirror
|
||||
* Checks if the sizre reported by the mirror is correct
|
||||
*/
|
||||
void slotTotalSize(KIO::filesize_t size, const QPair<int, int> &range = qMakePair(-1, -1));
|
||||
|
||||
void slotCanResume();
|
||||
|
||||
void slotFinishedDownload(KIO::filesize_t size);
|
||||
|
||||
void slotUrlChanged(const KUrl &url);
|
||||
|
||||
private:
|
||||
Segment *mostUnfinishedSegments(int *unfinished = 0) const;
|
||||
bool tryMerge(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int,int> &segmentRange);
|
||||
|
||||
private:
|
||||
QList<Segment*> m_segments;
|
||||
KIO::filesize_t m_size;
|
||||
bool m_canResume;
|
||||
bool m_started;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,5 +0,0 @@
|
|||
ClassName=MultiSegKioSettings
|
||||
File=kget_multisegkiofactory.kcfg
|
||||
Mutators=true
|
||||
Singleton=true
|
||||
Visibility=KDE_EXPORT
|
|
@ -1,376 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2006 Manolo Valdes <nolis71cu@gmail.com>
|
||||
Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "segment.h"
|
||||
#include "multisegkiosettings.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <KDebug>
|
||||
#include <KLocale>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
Segment::Segment(const KUrl &src, const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_findFilesize((segmentRange.first == -1) && (segmentRange.second == -1)),
|
||||
m_canResume(true),
|
||||
m_status(Stopped),
|
||||
m_currentSegment(segmentRange.first),
|
||||
m_endSegment(segmentRange.second),
|
||||
m_errorCount(0),
|
||||
m_offset(segmentSize.first * segmentRange.first),
|
||||
m_currentSegSize(segmentSize.first),
|
||||
m_bytesWritten(0),
|
||||
m_getJob(0),
|
||||
m_url(src),
|
||||
m_segSize(segmentSize)
|
||||
{
|
||||
//last segment
|
||||
if (m_endSegment - m_currentSegment == 0) {
|
||||
m_currentSegSize = m_segSize.second;
|
||||
}
|
||||
|
||||
if (m_findFilesize) {
|
||||
m_offset = 0;
|
||||
m_currentSegSize = 0;
|
||||
m_currentSegment = 0;
|
||||
m_endSegment = 0;
|
||||
m_totalBytesLeft = 0;
|
||||
} else {
|
||||
m_totalBytesLeft = m_segSize.first * (m_endSegment - m_currentSegment) + m_segSize.second;
|
||||
}
|
||||
}
|
||||
|
||||
Segment::~Segment()
|
||||
{
|
||||
if (m_getJob)
|
||||
{
|
||||
kDebug(5001) << "Closing transfer ...";
|
||||
m_getJob->kill(KJob::Quietly);
|
||||
}
|
||||
}
|
||||
|
||||
bool Segment::findingFileSize() const
|
||||
{
|
||||
return m_findFilesize;
|
||||
}
|
||||
|
||||
bool Segment::createTransfer()
|
||||
{
|
||||
kDebug(5001) << " -- " << m_url;
|
||||
if ( m_getJob )
|
||||
return false;
|
||||
|
||||
m_getJob = KIO::get(m_url, KIO::Reload, KIO::HideProgressInfo);
|
||||
m_getJob->suspend();
|
||||
m_getJob->addMetaData( "errorPage", "false" );
|
||||
m_getJob->addMetaData( "AllowCompressedPage", "false" );
|
||||
if (m_offset)
|
||||
{
|
||||
m_canResume = false;//FIXME set m_canResume to false by default!!
|
||||
m_getJob->addMetaData( "resume", KIO::number(m_offset) );
|
||||
connect(m_getJob, SIGNAL(canResume(KIO::Job*,KIO::filesize_t)),
|
||||
SLOT(slotCanResume(KIO::Job*,KIO::filesize_t)));
|
||||
}
|
||||
#if 0 //TODO: we disable that code till it's implemented in kdelibs, also we need to think, which settings we should use
|
||||
if (Settings::speedLimit())
|
||||
{
|
||||
m_getJob->addMetaData( "speed-limit", KIO::number(Settings::transferSpeedLimit() * 1024) );
|
||||
}
|
||||
#endif
|
||||
connect(m_getJob, SIGNAL(totalSize(KJob*,qulonglong)), this, SLOT(slotTotalSize(KJob*,qulonglong)));
|
||||
connect(m_getJob, SIGNAL(data(KIO::Job*,QByteArray)),
|
||||
SLOT(slotData(KIO::Job*,QByteArray)));
|
||||
connect(m_getJob, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*)));
|
||||
connect(m_getJob, SIGNAL(redirection(KIO::Job *,const KUrl &)), SLOT(slotRedirection(KIO::Job *, const KUrl &)));
|
||||
return true;
|
||||
}
|
||||
|
||||
void Segment::slotRedirection(KIO::Job* , const KUrl &url)
|
||||
{
|
||||
m_url = url;
|
||||
emit urlChanged(url);
|
||||
}
|
||||
|
||||
void Segment::slotCanResume( KIO::Job* job, KIO::filesize_t offset )
|
||||
{
|
||||
Q_UNUSED(job)
|
||||
Q_UNUSED(offset)
|
||||
kDebug(5001);
|
||||
m_canResume = true;
|
||||
emit canResume();
|
||||
}
|
||||
|
||||
void Segment::slotTotalSize(KJob *job, qulonglong size)
|
||||
{
|
||||
Q_UNUSED(job)
|
||||
kDebug(5001) << "Size found for" << m_url;
|
||||
|
||||
if (m_findFilesize) {
|
||||
int numSegments = size / m_segSize.first;
|
||||
KIO::fileoffset_t rest = size % m_segSize.first;
|
||||
if (rest) {
|
||||
++numSegments;
|
||||
m_segSize.second = rest;
|
||||
}
|
||||
|
||||
m_endSegment = numSegments - 1;
|
||||
|
||||
m_currentSegment = 0;
|
||||
m_currentSegSize = (numSegments == 1 ? m_segSize.second : m_segSize.first);
|
||||
m_totalBytesLeft = size;
|
||||
|
||||
emit totalSize(size, qMakePair(m_currentSegment, m_endSegment));
|
||||
m_findFilesize = false;
|
||||
} else {
|
||||
emit totalSize(size, qMakePair(-1, -1));
|
||||
}
|
||||
}
|
||||
|
||||
bool Segment::startTransfer ()
|
||||
{
|
||||
kDebug(5001) << m_url;
|
||||
if (!m_getJob) {
|
||||
createTransfer();
|
||||
}
|
||||
if (m_getJob && (m_status != Running)) {
|
||||
setStatus(Running, false);
|
||||
m_getJob->resume();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Segment::stopTransfer()
|
||||
{
|
||||
kDebug(5001);
|
||||
|
||||
setStatus(Stopped, false);
|
||||
if (m_getJob) {
|
||||
if (m_getJob) {
|
||||
m_getJob->kill(KJob::EmitResult);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Segment::slotResult( KJob *job )
|
||||
{
|
||||
kDebug(5001) << "Job:" << job << m_url << "error:" << job->error();
|
||||
|
||||
m_getJob = 0;
|
||||
|
||||
//clear the buffer as the download might be moved around
|
||||
if (m_status == Stopped)
|
||||
{
|
||||
m_buffer.clear();
|
||||
}
|
||||
if ( !m_buffer.isEmpty() )
|
||||
{
|
||||
if (m_findFilesize && !job->error()) {
|
||||
kDebug(5001) << "Looping until write the buffer ..." << m_url;
|
||||
slotWriteRest();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!m_totalBytesLeft && !m_findFilesize)
|
||||
{
|
||||
setStatus(Finished);
|
||||
return;
|
||||
}
|
||||
if( m_status == Killed )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (job->error() && (m_status == Running)) {
|
||||
emit error(this, job->errorString(), Transfer::Log_Error);
|
||||
}
|
||||
}
|
||||
|
||||
void Segment::slotData(KIO::Job *, const QByteArray& _data)
|
||||
{
|
||||
// Check if the transfer allows resuming...
|
||||
if (m_offset && !m_canResume)
|
||||
{
|
||||
kDebug(5001) << m_url << "does not allow resuming.";
|
||||
stopTransfer();
|
||||
setStatus(Killed, false );
|
||||
const QString errorText = KIO::buildErrorString(KIO::ERR_CANNOT_RESUME, m_url.prettyUrl());
|
||||
emit error(this, errorText, Transfer::Log_Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
m_buffer.append(_data);
|
||||
if (!m_findFilesize && m_totalBytesLeft && static_cast<uint>(m_buffer.size()) >= m_totalBytesLeft)
|
||||
{
|
||||
kDebug(5001) << "Segment::slotData() buffer full. stoping transfer...";//TODO really stop it? is this even needed?
|
||||
if (m_getJob) {
|
||||
m_getJob->kill(KJob::Quietly);
|
||||
m_getJob = 0;
|
||||
}
|
||||
m_buffer.truncate(m_totalBytesLeft);
|
||||
slotWriteRest();
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
write to the local file only if the buffer has more than 100kbytes
|
||||
this hack try to avoid too much cpu usage. it seems to be due KIO::Filejob
|
||||
so remove it when it works property
|
||||
*/
|
||||
if (m_buffer.size() > MultiSegKioSettings::saveSegSize() * 1024)
|
||||
writeBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
bool Segment::writeBuffer()
|
||||
{
|
||||
kDebug(5001) << "Segment::writeBuffer() sending:" << m_buffer.size() << "from job:" << m_getJob;
|
||||
if (m_buffer.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool worked = false;
|
||||
emit data(m_offset, m_buffer, worked);
|
||||
|
||||
if (worked) {
|
||||
m_currentSegSize -= m_buffer.size();
|
||||
if (!m_findFilesize) {
|
||||
m_totalBytesLeft -= m_buffer.size();
|
||||
}
|
||||
m_offset += m_buffer.size();
|
||||
m_bytesWritten += m_buffer.size();
|
||||
m_buffer.clear();
|
||||
kDebug(5001) << "Segment::writeBuffer() updating segment record of job:" << m_getJob << "--" << m_totalBytesLeft << "bytes left";
|
||||
}
|
||||
|
||||
//finding filesize, so no segments defined yet
|
||||
if (m_findFilesize) {
|
||||
return worked;
|
||||
}
|
||||
|
||||
//check which segments have been finished
|
||||
bool finished = false;
|
||||
//m_currentSegSize being smaller than 1 means that at least one segment has been finished
|
||||
while (m_currentSegSize <= 0 && !finished) {
|
||||
finished = (m_currentSegment == m_endSegment);
|
||||
emit finishedSegment(this, m_currentSegment, finished);
|
||||
|
||||
if (!finished) {
|
||||
++m_currentSegment;
|
||||
m_currentSegSize += (m_currentSegment == m_endSegment ? m_segSize.second : m_segSize.first);
|
||||
}
|
||||
}
|
||||
|
||||
return worked;
|
||||
}
|
||||
|
||||
void Segment::slotWriteRest()
|
||||
{
|
||||
if (m_buffer.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
kDebug() << this;
|
||||
|
||||
if (writeBuffer()) {
|
||||
m_errorCount = 0;
|
||||
if (m_findFilesize) {
|
||||
emit finishedDownload(m_bytesWritten);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (++m_errorCount >= 100) {
|
||||
kWarning() << "Failed to write to the file:" << m_url << this;
|
||||
emit error(this, i18n("Failed to write to the file."), Transfer::Log_Error);
|
||||
} else {
|
||||
kDebug() << "Wait 50 msec:" << this;
|
||||
QTimer::singleShot(50, this, SLOT(slotWriteRest()));
|
||||
}
|
||||
}
|
||||
|
||||
void Segment::setStatus(Status stat, bool doEmit)
|
||||
{
|
||||
m_status = stat;
|
||||
if (doEmit)
|
||||
emit statusChanged(this);
|
||||
}
|
||||
|
||||
QPair<int, int> Segment::assignedSegments() const
|
||||
{
|
||||
return QPair<int, int>(m_currentSegment, m_endSegment);
|
||||
}
|
||||
|
||||
QPair<KIO::fileoffset_t, KIO::fileoffset_t> Segment::segmentSize() const
|
||||
{
|
||||
return m_segSize;
|
||||
}
|
||||
|
||||
int Segment::countUnfinishedSegments() const
|
||||
{
|
||||
return m_endSegment - m_currentSegment;
|
||||
}
|
||||
|
||||
QPair<int, int> Segment::split()
|
||||
{
|
||||
if (m_getJob)
|
||||
{
|
||||
m_getJob->suspend();
|
||||
}
|
||||
|
||||
QPair<int, int> freed = QPair<int, int>(-1, -1);
|
||||
const int free = std::ceil((countUnfinishedSegments() + 1) / static_cast<double>(2));
|
||||
|
||||
if (!free)
|
||||
{
|
||||
kDebug(5001) << "None freed, start:" << m_currentSegment << "end:" << m_endSegment;
|
||||
|
||||
if (m_getJob)
|
||||
{
|
||||
m_getJob->resume();
|
||||
}
|
||||
return freed;
|
||||
}
|
||||
|
||||
const int newEnd = m_endSegment - free;
|
||||
freed = QPair<int, int>(newEnd + 1, m_endSegment);
|
||||
kDebug(5001) << "Start:" << m_currentSegment << "old end:" << m_endSegment << "new end:" << newEnd << "freed:" << freed;
|
||||
m_endSegment = newEnd;
|
||||
m_totalBytesLeft -= m_segSize.first * (free - 1) + m_segSize.second;
|
||||
|
||||
//end changed, so in any case the lastSegSize should be the normal segSize
|
||||
if (free)
|
||||
{
|
||||
m_segSize.second = m_segSize.first;
|
||||
}
|
||||
|
||||
if (m_getJob)
|
||||
{
|
||||
m_getJob->resume();
|
||||
}
|
||||
return freed;
|
||||
}
|
||||
|
||||
bool Segment::merge(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange)
|
||||
{
|
||||
if (m_endSegment + 1 == segmentRange.first) {
|
||||
m_endSegment = segmentRange.second;
|
||||
m_segSize.second = segmentSize.second;
|
||||
m_totalBytesLeft += segmentSize.first * (m_endSegment - segmentRange.first) + m_segSize.second;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#include "moc_segment.cpp"
|
|
@ -1,161 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2006 Manolo Valdes <nolis71cu@gmail.com>
|
||||
Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SEGMENT_H
|
||||
#define SEGMENT_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include <KIO/Job>
|
||||
|
||||
#include "core/transfer.h"
|
||||
|
||||
/**
|
||||
* class Segment
|
||||
*/
|
||||
|
||||
class Segment : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* The status property describes the current segment status
|
||||
*
|
||||
* @param Running The transfer is being executed
|
||||
* @param Stopped The transfer is stopped
|
||||
* @param Killed The transfer have been killed due unhandled errors
|
||||
* @param Timeout The transfer is broken because an error ocoured
|
||||
* @param Finished The transfer exited successfully
|
||||
*/
|
||||
enum Status
|
||||
{
|
||||
Running,
|
||||
Stopped,
|
||||
Killed,
|
||||
Timeout,
|
||||
Finished
|
||||
};
|
||||
|
||||
Segment(const KUrl &src, const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int, int> &segmentRange, QObject *parent);
|
||||
|
||||
~Segment();
|
||||
|
||||
/**
|
||||
* Create the segment transfer
|
||||
*/
|
||||
bool createTransfer();
|
||||
|
||||
/**
|
||||
* stop the segment transfer
|
||||
*/
|
||||
bool stopTransfer ( );
|
||||
|
||||
/**
|
||||
* Get the value of m_offset set
|
||||
*/
|
||||
KIO::fileoffset_t offset() const {return m_offset;}
|
||||
|
||||
/**
|
||||
* Returns the size the current segment has
|
||||
* @return the size of the segment
|
||||
*/
|
||||
KIO::filesize_t size() const {return m_currentSegSize;}
|
||||
|
||||
/**
|
||||
* Returns the written bytes
|
||||
* @return the value of m_bytesWritten
|
||||
*/
|
||||
KIO::filesize_t BytesWritten ( ){ return m_bytesWritten; }//TODO needed???
|
||||
|
||||
/**
|
||||
* Get the job
|
||||
* @return the value of m_getJob
|
||||
*/
|
||||
KIO::TransferJob *job(){ return m_getJob; }//TODO needed?
|
||||
|
||||
/**
|
||||
* Get the segment status
|
||||
* @return the value of m_status
|
||||
*/
|
||||
Status status() const {return m_status;}//TODO needed?
|
||||
|
||||
QPair<int, int> assignedSegments() const;
|
||||
QPair<KIO::fileoffset_t, KIO::fileoffset_t> segmentSize() const;
|
||||
int countUnfinishedSegments() const;
|
||||
QPair<int, int> split();
|
||||
bool merge(const QPair<KIO::fileoffset_t, KIO::fileoffset_t> &segmentSize, const QPair<int,int> &segmentRange);
|
||||
bool findingFileSize() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
/**
|
||||
* start the segment transfer
|
||||
*/
|
||||
bool startTransfer ( );
|
||||
|
||||
/**
|
||||
* Called whenever a subjob finishes
|
||||
* @param job the job that emitted this signal
|
||||
*/
|
||||
void slotResult( KJob *job );
|
||||
|
||||
Q_SIGNALS:
|
||||
void data(KIO::fileoffset_t offset, const QByteArray &data, bool &worked);
|
||||
/**
|
||||
* Emitted whenever the transfer is closed with an error
|
||||
*/
|
||||
void error(Segment *segment, const QString &errorText, Transfer::LogLevel logLevel);
|
||||
void finishedSegment(Segment *segment, int segmentNum, bool connectionFinished = true);
|
||||
void statusChanged( Segment*);
|
||||
void speed(ulong speed);
|
||||
void connectionProblem();
|
||||
void totalSize(KIO::filesize_t size, QPair<int, int> segmentRange);
|
||||
void finishedDownload(KIO::filesize_t size);
|
||||
void canResume();
|
||||
void urlChanged(const KUrl &newUrl);
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotData(KIO::Job *job, const QByteArray &data);
|
||||
void slotCanResume(KIO::Job *job, KIO::filesize_t);//TODO remove
|
||||
void slotTotalSize(KJob *job, qulonglong size);
|
||||
|
||||
/**
|
||||
* Writes the buffer, assuming that this segment is finished and the rest should be written.
|
||||
* Tries to write and if that fails waits for 50 msec and retries again.
|
||||
* If this whole process still fails after 100 times, then error is emitted.
|
||||
*/
|
||||
void slotWriteRest();
|
||||
|
||||
void slotRedirection(KIO::Job*, const KUrl &);
|
||||
|
||||
private:
|
||||
bool writeBuffer();
|
||||
void setStatus(Status stat, bool doEmit=true);
|
||||
|
||||
private:
|
||||
bool m_findFilesize;
|
||||
bool m_canResume;
|
||||
Status m_status;
|
||||
int m_currentSegment;
|
||||
int m_endSegment;
|
||||
int m_errorCount;
|
||||
KIO::fileoffset_t m_offset;
|
||||
KIO::fileoffset_t m_currentSegSize;
|
||||
KIO::filesize_t m_bytesWritten;
|
||||
KIO::filesize_t m_totalBytesLeft;
|
||||
KIO::TransferJob *m_getJob;
|
||||
KUrl m_url;
|
||||
QByteArray m_buffer;
|
||||
QPair<KIO::fileoffset_t, KIO::fileoffset_t> m_segSize;
|
||||
};
|
||||
|
||||
#endif // SEGMENT_H
|
|
@ -1,378 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2004 Dario Massarin <nekkar@libero.it>
|
||||
Copyright (C) 2006 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "transfermultisegkio.h"
|
||||
|
||||
#include "multisegkiosettings.h"
|
||||
#include "core/kget.h"
|
||||
#include "core/transferdatasource.h"
|
||||
// #include "mirrors.h"
|
||||
#include "core/filemodel.h"
|
||||
#include "core/verifier.h"
|
||||
#include "core/signature.h"
|
||||
|
||||
#include <utime.h>
|
||||
|
||||
#include <kiconloader.h>
|
||||
#include <KIO/CopyJob>
|
||||
#include <KIO/NetAccess>
|
||||
#include <klocale.h>
|
||||
#include <KMessageBox>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <QtXml/qdom.h>
|
||||
#include <QFile>
|
||||
|
||||
TransferMultiSegKio::TransferMultiSegKio(TransferGroup *parent, TransferFactory *factory,
|
||||
Scheduler *scheduler, const KUrl &source, const KUrl &dest,
|
||||
const QDomElement *e)
|
||||
: Transfer(parent, factory, scheduler, source, dest, e),
|
||||
m_movingFile(false),
|
||||
m_searchStarted(false),
|
||||
m_verificationSearch(false),
|
||||
m_dataSourceFactory(0),
|
||||
m_fileModel(0)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::init()
|
||||
{
|
||||
Transfer::init();
|
||||
|
||||
if (!m_dataSourceFactory) {
|
||||
m_dataSourceFactory = new DataSourceFactory(this, m_dest);
|
||||
connect(m_dataSourceFactory, SIGNAL(capabilitiesChanged()), this, SLOT(slotUpdateCapabilities()));
|
||||
connect(m_dataSourceFactory, SIGNAL(dataSourceFactoryChange(Transfer::ChangesFlags)), this, SLOT(slotDataSourceFactoryChange(Transfer::ChangesFlags)));
|
||||
connect(m_dataSourceFactory->verifier(), SIGNAL(verified(bool)), this, SLOT(slotVerified(bool)));
|
||||
connect(m_dataSourceFactory, SIGNAL(log(QString,Transfer::LogLevel)), this, SLOT(setLog(QString,Transfer::LogLevel)));
|
||||
|
||||
m_dataSourceFactory->addMirror(m_source, MultiSegKioSettings::segments());
|
||||
|
||||
slotUpdateCapabilities();
|
||||
}
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::deinit(Transfer::DeleteOptions options)
|
||||
{
|
||||
if (options & Transfer::DeleteFiles)//if the transfer is not finished, we delete the *.part-file
|
||||
{
|
||||
m_dataSourceFactory->deinit();
|
||||
}//TODO: Ask the user if he/she wants to delete the *.part-file? To discuss (boom1992)
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::start()
|
||||
{
|
||||
kDebug(5001) << "Start TransferMultiSegKio";
|
||||
if (status() == Running) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_dataSourceFactory->start();
|
||||
|
||||
if (MultiSegKioSettings::useSearchEngines() && !m_searchStarted) {
|
||||
m_searchStarted = true;
|
||||
QDomDocument doc;
|
||||
QDomElement element = doc.createElement("TransferDataSource");
|
||||
element.setAttribute("type", "search");
|
||||
doc.appendChild(element);
|
||||
|
||||
TransferDataSource *mirrorSearch = KGet::createTransferDataSource(m_source, element, this);
|
||||
if (mirrorSearch) {
|
||||
connect(mirrorSearch, SIGNAL(data(QList<KUrl>)), this, SLOT(slotSearchUrls(QList<KUrl>)));
|
||||
mirrorSearch->start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::stop()
|
||||
{
|
||||
kDebug(5001);
|
||||
|
||||
if ((status() == Stopped) || (status() == Finished)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_dataSourceFactory)
|
||||
{
|
||||
m_dataSourceFactory->stop();
|
||||
}
|
||||
}
|
||||
|
||||
bool TransferMultiSegKio::repair(const KUrl &file)
|
||||
{
|
||||
if (!file.isValid() || (m_dest == file))
|
||||
{
|
||||
if (m_dataSourceFactory && (m_dataSourceFactory->verifier()->status() == Verifier::NotVerified))
|
||||
{
|
||||
m_dataSourceFactory->repair();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TransferMultiSegKio::setDirectory(const KUrl& newDirectory)
|
||||
{
|
||||
KUrl newDest = newDirectory;
|
||||
newDest.addPath(m_dest.fileName());
|
||||
return setNewDestination(newDest);
|
||||
}
|
||||
|
||||
bool TransferMultiSegKio::setNewDestination(const KUrl &newDestination)
|
||||
{
|
||||
kDebug(5001) << "New destination: " << newDestination;
|
||||
if (newDestination.isValid() && (newDestination != dest()) && m_dataSourceFactory)
|
||||
{
|
||||
m_movingFile = true;
|
||||
stop();
|
||||
m_dataSourceFactory->setNewDestination(newDestination);
|
||||
|
||||
m_dest = newDestination;
|
||||
|
||||
if (m_fileModel)
|
||||
{
|
||||
m_fileModel->setDirectory(directory());
|
||||
}
|
||||
|
||||
setTransferChange(Tc_FileName);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::load(const QDomElement *element)
|
||||
{
|
||||
kDebug(5001);
|
||||
|
||||
Transfer::load(element);
|
||||
m_dataSourceFactory->load(element);
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::save(const QDomElement &element)
|
||||
{
|
||||
kDebug(5001);
|
||||
Transfer::save(element);
|
||||
m_dataSourceFactory->save(element);
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::slotDataSourceFactoryChange(Transfer::ChangesFlags change)
|
||||
{
|
||||
if (change & Tc_FileName) {
|
||||
QList<KUrl> urls = m_dataSourceFactory->mirrors().keys();
|
||||
QString filename = urls.first().fileName();
|
||||
if (filename.isEmpty())
|
||||
return;
|
||||
foreach (const KUrl url, urls) {
|
||||
if (filename != url.fileName())
|
||||
return;
|
||||
}
|
||||
KUrl path = m_dest.directory();
|
||||
path.addPath(filename);
|
||||
setNewDestination(path);
|
||||
}
|
||||
if (change & Tc_Source) {
|
||||
m_source = KUrl();
|
||||
QHash< KUrl, QPair<bool, int> >::const_iterator it = m_dataSourceFactory->mirrors().constBegin();
|
||||
QHash< KUrl, QPair<bool, int> >::const_iterator end = m_dataSourceFactory->mirrors().constEnd();
|
||||
for (; it != end; it++) {
|
||||
if (it.value().first) {
|
||||
m_source = it.key();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (change & Tc_Status) {
|
||||
if ((m_dataSourceFactory->status() == Job::Finished) && m_source.protocol() == "ftp") {
|
||||
KIO::StatJob * statJob = KIO::stat(m_source);
|
||||
connect(statJob, SIGNAL(result(KJob*)), this, SLOT(slotStatResult(KJob*)));
|
||||
statJob->start();
|
||||
} else {
|
||||
setStatus(m_dataSourceFactory->status());
|
||||
}
|
||||
|
||||
if (m_fileModel) {
|
||||
QModelIndex statusIndex = m_fileModel->index(m_dest, FileItem::Status);
|
||||
m_fileModel->setData(statusIndex, status());
|
||||
}
|
||||
}
|
||||
if (change & Tc_TotalSize) {
|
||||
m_totalSize = m_dataSourceFactory->size();
|
||||
if (m_fileModel) {
|
||||
QModelIndex sizeIndex = m_fileModel->index(m_dest, FileItem::Size);
|
||||
m_fileModel->setData(sizeIndex, static_cast<qlonglong>(m_totalSize));
|
||||
}
|
||||
}
|
||||
if (change & Tc_DownloadedSize) {
|
||||
KIO::filesize_t processedSize = m_dataSourceFactory->downloadedSize();
|
||||
//only start the verification search _after_ data has come in, that way only connections
|
||||
//are requested if there is already a successful one
|
||||
if ((processedSize != m_downloadedSize) && !m_verificationSearch && MultiSegKioSettings::useSearchVerification()) {
|
||||
m_verificationSearch = true;
|
||||
QDomDocument doc;
|
||||
QDomElement element = doc.createElement("TransferDataSource");
|
||||
element.setAttribute("type", "checksumsearch");
|
||||
doc.appendChild(element);
|
||||
|
||||
TransferDataSource *checksumSearch = KGet::createTransferDataSource(m_source, element, this);
|
||||
if (checksumSearch) {
|
||||
connect(checksumSearch, SIGNAL(data(QString,QString)), this, SLOT(slotChecksumFound(QString,QString)));
|
||||
checksumSearch->start();
|
||||
}
|
||||
}
|
||||
m_downloadedSize = m_dataSourceFactory->downloadedSize();
|
||||
}
|
||||
if (change & Tc_Percent) {
|
||||
m_percent = m_dataSourceFactory->percent();
|
||||
}
|
||||
if (change & Tc_DownloadSpeed) {
|
||||
kDebug(5001) << "speed:" << m_downloadSpeed;
|
||||
m_downloadSpeed = m_dataSourceFactory->currentSpeed();
|
||||
}
|
||||
|
||||
setTransferChange(change, true);
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::slotVerified(bool isVerified)
|
||||
{
|
||||
if (m_fileModel) {
|
||||
QModelIndex checksumVerified = m_fileModel->index(m_dest, FileItem::ChecksumVerified);
|
||||
m_fileModel->setData(checksumVerified, verifier()->status());
|
||||
}
|
||||
|
||||
if (!isVerified) {
|
||||
QString text = i18n("The download (%1) could not be verified. Do you want to repair it?", m_dest.fileName());
|
||||
|
||||
if (!verifier()->partialChunkLength()) {
|
||||
text = i18n("The download (%1) could not be verified. Do you want to redownload it?", m_dest.fileName());
|
||||
}
|
||||
if (KMessageBox::warningYesNo(0,
|
||||
text,
|
||||
i18n("Verification failed.")) == KMessageBox::Yes) {
|
||||
repair();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::slotStatResult(KJob* kioJob)
|
||||
{
|
||||
KIO::StatJob * statJob = qobject_cast<KIO::StatJob *>(kioJob);
|
||||
|
||||
if (!statJob->error()) {
|
||||
const KIO::UDSEntry entryResult = statJob->statResult();
|
||||
struct utimbuf time;
|
||||
|
||||
time.modtime = entryResult.numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME);
|
||||
time.actime = QDateTime::currentDateTime().toTime_t();
|
||||
utime(m_dest.toLocalFile().toUtf8().constData(), &time);
|
||||
}
|
||||
|
||||
setStatus(Job::Finished);
|
||||
setTransferChange(Tc_Status, true);
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::slotSearchUrls(const QList<KUrl> &urls)
|
||||
{
|
||||
kDebug(5001) << "Found " << urls.size() << " urls.";
|
||||
|
||||
foreach (const KUrl &url, urls)
|
||||
{
|
||||
m_dataSourceFactory->addMirror(url, MultiSegKioSettings::segments());
|
||||
}
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::slotChecksumFound(QString type, QString checksum)
|
||||
{
|
||||
m_dataSourceFactory->verifier()->addChecksum(type, checksum);
|
||||
}
|
||||
|
||||
QHash<KUrl, QPair<bool, int> > TransferMultiSegKio::availableMirrors(const KUrl &file) const
|
||||
{
|
||||
Q_UNUSED(file)
|
||||
|
||||
return m_dataSourceFactory->mirrors();
|
||||
}
|
||||
|
||||
|
||||
void TransferMultiSegKio::setAvailableMirrors(const KUrl &file, const QHash<KUrl, QPair<bool, int> > &mirrors)
|
||||
{
|
||||
Q_UNUSED(file)
|
||||
|
||||
m_dataSourceFactory->setMirrors(mirrors);
|
||||
|
||||
m_source = KUrl();
|
||||
QHash< KUrl, QPair<bool, int> >::const_iterator it = mirrors.begin();
|
||||
QHash< KUrl, QPair<bool, int> >::const_iterator end = mirrors.end();
|
||||
for (; it != end; it++) {
|
||||
if (it.value().first) {
|
||||
m_source = it.key();
|
||||
break;
|
||||
}
|
||||
}
|
||||
setTransferChange(Tc_Source, true);
|
||||
}
|
||||
|
||||
Verifier *TransferMultiSegKio::verifier(const KUrl &file)
|
||||
{
|
||||
Q_UNUSED(file)
|
||||
|
||||
return m_dataSourceFactory->verifier();
|
||||
}
|
||||
|
||||
Signature *TransferMultiSegKio::signature(const KUrl &file)
|
||||
{
|
||||
Q_UNUSED(file)
|
||||
|
||||
return m_dataSourceFactory->signature();
|
||||
}
|
||||
|
||||
FileModel *TransferMultiSegKio::fileModel()
|
||||
{
|
||||
if (!m_fileModel)
|
||||
{
|
||||
m_fileModel = new FileModel(QList<KUrl>() << m_dest, m_dest.upUrl(), this);
|
||||
connect(m_fileModel, SIGNAL(rename(KUrl,KUrl)), this, SLOT(slotRename(KUrl,KUrl)));
|
||||
|
||||
QModelIndex statusIndex = m_fileModel->index(m_dest, FileItem::Status);
|
||||
m_fileModel->setData(statusIndex, m_dataSourceFactory->status());
|
||||
QModelIndex sizeIndex = m_fileModel->index(m_dest, FileItem::Size);
|
||||
m_fileModel->setData(sizeIndex, static_cast<qlonglong>(m_dataSourceFactory->size()));
|
||||
QModelIndex checksumVerified = m_fileModel->index(m_dest, FileItem::ChecksumVerified);
|
||||
m_fileModel->setData(checksumVerified, verifier()->status());
|
||||
QModelIndex signatureVerified = m_fileModel->index(m_dest, FileItem::SignatureVerified);
|
||||
m_fileModel->setData(signatureVerified, signature()->status());
|
||||
}
|
||||
|
||||
return m_fileModel;
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::slotRename(const KUrl &oldUrl, const KUrl &newUrl)
|
||||
{
|
||||
Q_UNUSED(oldUrl)
|
||||
|
||||
if (newUrl.isValid() && (newUrl != dest()) && m_dataSourceFactory)
|
||||
{
|
||||
m_movingFile = true;
|
||||
stop();
|
||||
m_dataSourceFactory->setNewDestination(newUrl);
|
||||
|
||||
m_dest = newUrl;
|
||||
|
||||
setTransferChange(Tc_FileName);
|
||||
}
|
||||
}
|
||||
|
||||
void TransferMultiSegKio::slotUpdateCapabilities()
|
||||
{
|
||||
setCapabilities(m_dataSourceFactory->capabilities());
|
||||
}
|
||||
|
||||
#include "moc_transfermultisegkio.cpp"
|
|
@ -1,95 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2004 Dario Massarin <nekkar@libero.it>
|
||||
Copyright (C) 2006 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef TRANSFER_MULTISEGKIO_H
|
||||
#define TRANSFER_MULTISEGKIO_H
|
||||
|
||||
#include <KIO/Job>
|
||||
|
||||
#include "core/transfer.h"
|
||||
#include "core/datasourcefactory.h"
|
||||
|
||||
/**
|
||||
* This transfer uses multiple segments to download a file
|
||||
*/
|
||||
|
||||
class DataSourceFactory;
|
||||
class FileModel;
|
||||
|
||||
class TransferMultiSegKio : public Transfer
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TransferMultiSegKio(TransferGroup * parent, TransferFactory * factory,
|
||||
Scheduler * scheduler, const KUrl & src, const KUrl & dest,
|
||||
const QDomElement * e = 0);
|
||||
|
||||
bool repair(const KUrl &file = KUrl());
|
||||
|
||||
/**
|
||||
* Move the download to the new destination
|
||||
* @param newDirectory is a directory where the download should be stored
|
||||
* @returns true if newDestination can be used
|
||||
*/
|
||||
virtual bool setDirectory(const KUrl &newDirectory);
|
||||
|
||||
virtual void init();
|
||||
virtual void deinit(Transfer::DeleteOptions options);
|
||||
|
||||
QHash<KUrl, QPair<bool, int> > availableMirrors(const KUrl &file) const;
|
||||
void setAvailableMirrors(const KUrl &file, const QHash<KUrl, QPair<bool, int> > &mirrors);
|
||||
|
||||
/**
|
||||
* @param file for which to get the verifier
|
||||
* @return Verifier that allows you to add checksums manually verify a file etc.
|
||||
*/
|
||||
virtual Verifier *verifier(const KUrl &file = KUrl());
|
||||
|
||||
/**
|
||||
* @param file for which to get the signature
|
||||
* @return Signature that allows you to add signatures and verify them
|
||||
*/
|
||||
virtual Signature *signature(const KUrl &file = KUrl());
|
||||
|
||||
FileModel *fileModel();
|
||||
|
||||
public slots:
|
||||
bool setNewDestination(const KUrl &newDestination);
|
||||
// --- Job virtual functions ---
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
void save(const QDomElement &element);
|
||||
void load(const QDomElement *e);
|
||||
void slotChecksumFound(QString type, QString checksum);
|
||||
|
||||
private:
|
||||
void createJob();
|
||||
|
||||
private slots:
|
||||
void slotDataSourceFactoryChange(Transfer::ChangesFlags change);
|
||||
void slotUpdateCapabilities();
|
||||
void slotSearchUrls(const QList<KUrl> &urls);
|
||||
void slotRename(const KUrl &oldUrl, const KUrl &newUrl);
|
||||
void slotVerified(bool isVerified);
|
||||
void slotStatResult(KJob * kioJob);
|
||||
|
||||
private:
|
||||
bool m_movingFile;
|
||||
bool m_searchStarted;
|
||||
bool m_verificationSearch;
|
||||
DataSourceFactory *m_dataSourceFactory;
|
||||
FileModel *m_fileModel;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,77 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2004 Dario Massarin <nekkar@libero.it>
|
||||
Copyright (C) 2006 Manolo Valdes <nolis71cu@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include "transfermultisegkiofactory.h"
|
||||
|
||||
#include "core/scheduler.h"
|
||||
#include "core/transfergroup.h"
|
||||
#include "multisegkiosettings.h"
|
||||
#include "transfermultisegkio.h"
|
||||
#include "multisegkiodatasource.h"
|
||||
|
||||
#include <QtXml/qdom.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
KGET_EXPORT_PLUGIN( TransferMultiSegKioFactory )
|
||||
|
||||
TransferMultiSegKioFactory::TransferMultiSegKioFactory(QObject *parent, const QVariantList &args)
|
||||
: TransferFactory(parent, args)
|
||||
{
|
||||
}
|
||||
|
||||
TransferMultiSegKioFactory::~TransferMultiSegKioFactory()
|
||||
{
|
||||
}
|
||||
|
||||
Transfer * TransferMultiSegKioFactory::createTransfer( const KUrl &srcUrl, const KUrl &destUrl,
|
||||
TransferGroup * parent,
|
||||
Scheduler * scheduler,
|
||||
const QDomElement * e )
|
||||
{
|
||||
kDebug(5001);
|
||||
|
||||
if (isSupported(srcUrl) && (!e || !e->firstChildElement("factories").isNull()))
|
||||
{
|
||||
return new TransferMultiSegKio(parent, this, scheduler, srcUrl, destUrl, e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
TransferDataSource * TransferMultiSegKioFactory::createTransferDataSource(const KUrl &srcUrl, const QDomElement &type, QObject *parent)
|
||||
{
|
||||
kDebug(5001);
|
||||
|
||||
//only use this TransferDataSource if no type is specified and the protocolls match
|
||||
if (!type.attribute("type").isEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (isSupported(srcUrl))
|
||||
{
|
||||
return new MultiSegKioDataSource(srcUrl, parent);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TransferMultiSegKioFactory::isSupported(const KUrl &url) const
|
||||
{
|
||||
QString prot = url.protocol();
|
||||
kDebug(5001) << "Protocol = " << prot;
|
||||
return addsProtocols().contains(prot);
|
||||
}
|
||||
|
||||
QStringList TransferMultiSegKioFactory::addsProtocols() const
|
||||
{
|
||||
static const QStringList protocols = QStringList() << "http" << "https" << "ftp" << "sftp";
|
||||
return protocols;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/* This file is part of the KDE project
|
||||
|
||||
Copyright (C) 2004 Dario Massarin <nekkar@libero.it>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef MULTISEGKIO_FACTORY_H
|
||||
#define MULTISEGKIO_FACTORY_H
|
||||
|
||||
#include "core/plugin/transferfactory.h"
|
||||
|
||||
class Transfer;
|
||||
class TransferGroup;
|
||||
class Scheduler;
|
||||
|
||||
class TransferMultiSegKioFactory : public TransferFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TransferMultiSegKioFactory(QObject *parent, const QVariantList &args);
|
||||
~TransferMultiSegKioFactory();
|
||||
|
||||
Transfer * createTransfer( const KUrl &srcUrl, const KUrl &destUrl,
|
||||
TransferGroup * parent, Scheduler * scheduler,
|
||||
const QDomElement * e = 0 );
|
||||
|
||||
TransferDataSource * createTransferDataSource(const KUrl &srcUrl, const QDomElement &type, QObject *parent);
|
||||
bool isSupported(const KUrl &url) const;
|
||||
QStringList addsProtocols() const;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue