[network/ktorrent] /: Remove cross scripting
Alexander Lohnau
null at kde.org
Sun Aug 22 19:20:51 BST 2021
Git commit 023def08d07a4a3e346eef34e6142bf574435f6c by Alexander Lohnau.
Committed on 22/08/2021 at 11:26.
Pushed by stikonas into branch 'master'.
Remove cross scripting
Cross is not well maintained, even before the Qt5 port.
For KF5 it is marked as porting aid. Considering that there
are no known users of this scripting and there is already a DBus
API it was agreed on removing it.
If there comes up the need for more scripting options one could extend the DBus
API or implement sth. in QJSEngine.
Task: https://phabricator.kde.org/T11608
M +0 -10 CMakeLists.txt
M +1 -2 doc/index.docbook
M +0 -31 ktorrent/org.kde.ktorrent.appdata.xml
M +0 -3 plugins/CMakeLists.txt
D +0 -35 plugins/scripting/CMakeLists.txt
D +0 -37 plugins/scripting/api/scriptablegroup.cpp
D +0 -34 plugins/scripting/api/scriptablegroup.h
D +0 -139 plugins/scripting/api/scriptingmodule.cpp
D +0 -67 plugins/scripting/api/scriptingmodule.h
D +0 -108 plugins/scripting/ktorrent_scripting.desktop
D +0 -27 plugins/scripting/ktorrent_scriptingui.rc
D +0 -158 plugins/scripting/script.cpp
D +0 -132 plugins/scripting/script.h
D +0 -178 plugins/scripting/scriptdelegate.cpp
D +0 -44 plugins/scripting/scriptdelegate.h
D +0 -222 plugins/scripting/scriptingplugin.cpp
D +0 -51 plugins/scripting/scriptingplugin.h
D +0 -245 plugins/scripting/scriptmanager.cpp
D +0 -79 plugins/scripting/scriptmanager.h
D +0 -287 plugins/scripting/scriptmodel.cpp
D +0 -85 plugins/scripting/scriptmodel.h
D +0 -131 plugins/scripting/scriptproperties.ui
D +0 -4 plugins/scripting/scripts/CMakeLists.txt
D +0 -3 plugins/scripting/scripts/auto_remove/CMakeLists.txt
D +0 -108 plugins/scripting/scripts/auto_remove/auto_remove.desktop
D +0 -74 plugins/scripting/scripts/auto_remove/auto_remove.py
D +0 -41 plugins/scripting/scripts/auto_remove/auto_remove.ui
D +0 -3 plugins/scripting/scripts/auto_resume/CMakeLists.txt
D +0 -104 plugins/scripting/scripts/auto_resume/auto_resume.desktop
D +0 -83 plugins/scripting/scripts/auto_resume/auto_resume.py
D +0 -123 plugins/scripting/scripts/auto_resume/auto_resume.ui
D +0 -4 plugins/scripting/scripts/email_notifications/CMakeLists.txt
D +0 -110 plugins/scripting/scripts/email_notifications/email_notifications.desktop
D +0 -169 plugins/scripting/scripts/email_notifications/email_notifications.py
D +0 -163 plugins/scripting/scripts/email_notifications/emailconfig.ui
D +0 -24 plugins/scripting/scripts/test.py
D +0 -2 plugins/scripting/scripts/tracker_groups/CMakeLists.txt
D +0 -102 plugins/scripting/scripts/tracker_groups/tracker_groups.desktop
D +0 -101 plugins/scripting/scripts/tracker_groups/tracker_groups.py
https://invent.kde.org/network/ktorrent/commit/023def08d07a4a3e346eef34e6142bf574435f6c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08378359..17b1cf99 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,16 +97,6 @@ if(KF5ItemViews_FOUND)
set(HAVE_KF5ItemViews 1)
endif()
-find_package(KF5Kross ${KF5_MIN_VERSION})
-set_package_properties(KF5Kross
- PROPERTIES
- TYPE OPTIONAL
- PURPOSE "Required for KTorrent's scripting plugin"
-)
-if(KF5Kross_FOUND)
- set(HAVE_KF5Kross 1)
-endif()
-
find_package(KF5Plotting ${KF5_MIN_VERSION})
set_package_properties(KF5Plotting
PROPERTIES
diff --git a/doc/index.docbook b/doc/index.docbook
index 5e4b436e..deaa7b62 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -56,11 +56,10 @@ either 'xx.yy.zz (&kde; x.y)' or '&kde; x.y'
<listitem><para>Support for distributed hash tables (DHT, the Mainline version)</para></listitem>
<listitem><para>Support for UPnP to automatically forward ports on a LAN with dynamic assigned hosts</para></listitem>
<listitem><para>Support for webseeds</para></listitem>
-<listitem><para>Scripting support via Kross and interprocess control via DBus interface</para></listitem>
<listitem><para>System tray integration</para></listitem>
<listitem><para>Tracker authentication support</para></listitem>
<listitem><para>Connection though a proxy</para></listitem>
-<listitem><para>Scripting support via Kross and interprocess control via DBus interface</para></listitem>
+<listitem><para>Interprocess control via DBus interface</para></listitem>
</itemizedlist>
<itemizedlist>
diff --git a/ktorrent/org.kde.ktorrent.appdata.xml b/ktorrent/org.kde.ktorrent.appdata.xml
index 705121e5..18dfa79b 100644
--- a/ktorrent/org.kde.ktorrent.appdata.xml
+++ b/ktorrent/org.kde.ktorrent.appdata.xml
@@ -631,37 +631,6 @@
<li xml:lang="uk">Підтримка вебпоширення</li>
<li xml:lang="x-test">xxSupport for webseedsxx</li>
<li xml:lang="zh-CN">支持 Webseed</li>
- <li>Scripting support via Kross, and interprocess control via D-Bus interface</li>
- <li xml:lang="ca">Suport per a crear scripts mitjançant el Kross i control entre processos a través de la interfície de D-Bus</li>
- <li xml:lang="ca-valencia">Suport per a crear scripts mitjançant el Kross i control entre processos a través de la interfície de D-Bus</li>
- <li xml:lang="da">Scripting-understøttelse via Kross og interproceskontrol via D-Bus-grænseflade</li>
- <li xml:lang="de">Skript-Unterstützung mit Kross und Interprozess-Steuerung über die D-Bus-Schnittstelle</li>
- <li xml:lang="el">Υποστήριξη συγγραφής σεναρίων με Kross και έλεγχος επικοινωνίας διεργασιών με D-Bus διεπαφή</li>
- <li xml:lang="en-GB">Scripting support via Kross, and interprocess control via D-Bus interface</li>
- <li xml:lang="es">Admite el uso de guiones vía Kross y control de interprocesos vía la interfaz D-Bus</li>
- <li xml:lang="et">Skriptimise toetus Krossi kaudu ja protsesside juhtimine D-Busi liidese abil</li>
- <li xml:lang="fi">Skriptaustuki Krossin kautta sekä prosessienvälinen hallinta D-Bus-liitännän kautta</li>
- <li xml:lang="fr">Scriptable par Kross et contrôle inter-processus par l'interface D-Bus</li>
- <li xml:lang="gl">Funcionalidade de scripting mediante Kross, e control entre procesos mediante unha interface de D-Bus.</li>
- <li xml:lang="id">Dukungan penskripan via Kross, dan kendali interproses via D-Bus interface</li>
- <li xml:lang="it">Supporto per lo scripting tramite Kross, e per il controllo dei processi tramite interfaccia D-Bus</li>
- <li xml:lang="ko">Kross를 통한 스크립팅 및 D-Bus 인터페이스를 통한 원격 제어 지원</li>
- <li xml:lang="nl">Ondersteuning voor scripts via Kross en interprocescontrole via het D-Bus-interface</li>
- <li xml:lang="pl">Obsługa skryptów przez Kross i sterowania międzyprocesowego poprzez interfejs D-Bus</li>
- <li xml:lang="pt">Suporte de programação através do Kross e controlo entre processos por uma interface de D-Bus</li>
- <li xml:lang="pt-BR">Suporte a scripts via Kross e controle de interprocessos via interface D-Bus</li>
- <li xml:lang="ru">Поддержка сценариев при помощи Kross и внешнего управления через интерфейс D-Bus</li>
- <li xml:lang="sk">Podpora skriptovania cez Kross a medziprocesové ovládanie cez rozhrani D-Bus</li>
- <li xml:lang="sl">Podpora za skripte prek Kross-a in medprocesni nadzor prek vmesnika D-Bus</li>
- <li xml:lang="sr">Подршка за скриптовање преко Кроса и међупроцесно управљање преко д‑бус сучеља.</li>
- <li xml:lang="sr-Latn">Podrška za skriptovanje preko Krossa i međuprocesno upravljanje preko D‑Bus sučelja.</li>
- <li xml:lang="sr-ijekavian">Подршка за скриптовање преко Кроса и међупроцесно управљање преко д‑бус сучеља.</li>
- <li xml:lang="sr-ijekavianlatin">Podrška za skriptovanje preko Krossa i međuprocesno upravljanje preko D‑Bus sučelja.</li>
- <li xml:lang="sv">Skriptstöd via Kross och styrning mellan processer via D-Bus gränssnitt</li>
- <li xml:lang="tr">Kross üzerinden betik yazma desteği ve D-Bus arayüzü ile süreçler arası denetim</li>
- <li xml:lang="uk">Підтримка керування за допомогою скриптів на Kross та обміну даними між процесами за допомогою D-Bus</li>
- <li xml:lang="x-test">xxScripting support via Kross, and interprocess control via D-Bus interfacexx</li>
- <li xml:lang="zh-CN">通过 Kross 支持脚本编程,通过 D-Bus 接口实现进程间控制</li>
<li>System tray integration</li>
<li xml:lang="ca">Integració amb la safata del sistema</li>
<li xml:lang="ca-valencia">Integració amb la safata del sistema</li>
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index b918a3c1..4434e245 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -31,9 +31,6 @@ macro_kt_plugin(ENABLE_BWSCHEDULER_PLUGIN bwscheduler bwscheduler)
if (HAVE_Taglib AND PHONON_FOUND_EXPERIMENTAL) #AND Qt5Multimedia_FOUND)
macro_kt_plugin(ENABLE_MEDIAPLAYER_PLUGIN mediaplayer mediaplayer)
endif()
-if (HAVE_KF5Archive AND HAVE_KF5ItemViews AND HAVE_KF5Kross)
- macro_kt_plugin(ENABLE_SCRIPTING_PLUGIN scripting scripting)
-endif()
if (HAVE_KF5Syndication AND HAVE_Qt5WebEngineWidgets)
macro_kt_plugin(ENABLE_SYNDICATION_PLUGIN syndication syndication)
endif()
diff --git a/plugins/scripting/CMakeLists.txt b/plugins/scripting/CMakeLists.txt
deleted file mode 100644
index ea8d3cff..00000000
--- a/plugins/scripting/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-add_subdirectory(scripts)
-
-add_library(ktorrent_scripting MODULE)
-
-target_sources(ktorrent_scripting PRIVATE
- api/scriptingmodule.cpp
- api/scriptablegroup.cpp
- scriptingplugin.cpp
- scriptmanager.cpp
- scriptmodel.cpp
- scriptdelegate.cpp
- script.cpp)
-
-ki18n_wrap_ui(ktorrent_scripting scriptproperties.ui)
-
-kcoreaddons_desktop_to_json(ktorrent_scripting ktorrent_scripting.desktop)
-
-target_link_libraries(
- ktorrent_scripting
- ktcore
- Qt5::Core
- KF5::Torrent
- KF5::Archive
- KF5::ConfigCore
- KF5::CoreAddons
- KF5::I18n
- KF5::IconThemes
- KF5::ItemViews
- KF5::KIOWidgets
- KF5::KrossCore
- KF5::XmlGui
-)
-
-install(TARGETS ktorrent_scripting DESTINATION ${KTORRENT_PLUGIN_INSTALL_DIR} )
-install(FILES ktorrent_scriptingui.rc DESTINATION ${KXMLGUI_INSTALL_DIR}/ktorrent )
diff --git a/plugins/scripting/api/scriptablegroup.cpp b/plugins/scripting/api/scriptablegroup.cpp
deleted file mode 100644
index c134e110..00000000
--- a/plugins/scripting/api/scriptablegroup.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include "scriptablegroup.h"
-#include <dbus/dbus.h>
-#include <interfaces/torrentinterface.h>
-#include <util/log.h>
-#include <util/sha1hash.h>
-
-using namespace bt;
-
-namespace kt
-{
-ScriptableGroup::ScriptableGroup(const QString &name, const QString &icon, const QString &path, Kross::Object::Ptr script, DBus *api)
- : kt::Group(name, MIXED_GROUP, path)
- , script(script)
- , api(api)
-{
- setIconByName(icon);
-}
-
-ScriptableGroup::~ScriptableGroup()
-{
-}
-
-bool ScriptableGroup::isMember(bt::TorrentInterface *tor)
-{
- QVariantList args;
- args << tor->getInfoHash().toString();
- QVariant ret = script->callMethod(QStringLiteral("isMember"), args);
- return ret.toBool();
-}
-
-}
diff --git a/plugins/scripting/api/scriptablegroup.h b/plugins/scripting/api/scriptablegroup.h
deleted file mode 100644
index 997d4eaf..00000000
--- a/plugins/scripting/api/scriptablegroup.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#ifndef KTAPISCRIPTABLEGROUP_H
-#define KTAPISCRIPTABLEGROUP_H
-
-#include <Kross/Core/Object>
-#include <groups/group.h>
-
-namespace kt
-{
-class DBus;
-
-/**
- Group which uses objects in a script to determine if a torrent is a member of the group.
-*/
-class ScriptableGroup : public kt::Group
-{
- Kross::Object::Ptr script;
- DBus *api;
-
-public:
- ScriptableGroup(const QString &name, const QString &icon, const QString &path, Kross::Object::Ptr script, DBus *api);
- ~ScriptableGroup() override;
-
- bool isMember(bt::TorrentInterface *tor) override;
-};
-
-}
-
-#endif
diff --git a/plugins/scripting/api/scriptingmodule.cpp b/plugins/scripting/api/scriptingmodule.cpp
deleted file mode 100644
index 2bb447a1..00000000
--- a/plugins/scripting/api/scriptingmodule.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include <QStandardPaths>
-#include <QTimer>
-
-#include <KConfigGroup>
-#include <KSharedConfig>
-
-#include "scriptablegroup.h"
-#include "scriptingmodule.h"
-#include <groups/groupmanager.h>
-#include <interfaces/coreinterface.h>
-#include <util/functions.h>
-
-namespace kt
-{
-ScriptingModule::ScriptingModule(GUIInterface *gui, CoreInterface *core, QObject *parent)
- : QObject(parent)
- , gui(gui)
- , core(core)
-{
-}
-
-ScriptingModule::~ScriptingModule()
-{
-}
-
-QString ScriptingModule::scriptsDir() const
-{
- QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("ktorrent/scripts"), QStandardPaths::LocateDirectory);
- if (dirs.count() == 0)
- return QString();
-
- QString ret = dirs.front();
- if (!ret.endsWith(bt::DirSeparator()))
- ret += bt::DirSeparator();
-
- return ret;
-}
-
-QString ScriptingModule::scriptDir(const QString &script) const
-{
- QStringList dirs =
- QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("ktorrent/scripts/") + script, QStandardPaths::LocateDirectory);
- if (dirs.count() == 0)
- return QString();
-
- QString ret = dirs.front();
- if (!ret.endsWith(bt::DirSeparator()))
- ret += bt::DirSeparator();
-
- return ret;
-}
-
-QString ScriptingModule::readConfigEntry(const QString &group, const QString &name, const QString &default_value)
-{
- KConfigGroup g = KSharedConfig::openConfig()->group(group);
- return g.readEntry(name, default_value);
-}
-
-bool ScriptingModule::readConfigEntryBool(const QString &group, const QString &name, bool default_value)
-{
- KConfigGroup g = KSharedConfig::openConfig()->group(group);
- return g.readEntry(name, default_value);
-}
-
-int ScriptingModule::readConfigEntryInt(const QString &group, const QString &name, int default_value)
-{
- KConfigGroup g = KSharedConfig::openConfig()->group(group);
- return g.readEntry(name, default_value);
-}
-
-float ScriptingModule::readConfigEntryFloat(const QString &group, const QString &name, float default_value)
-{
- KConfigGroup g = KSharedConfig::openConfig()->group(group);
- return g.readEntry(name, default_value);
-}
-
-void ScriptingModule::writeConfigEntry(const QString &group, const QString &name, const QString &value)
-{
- KConfigGroup g = KSharedConfig::openConfig()->group(group);
- g.writeEntry(name, value);
-}
-
-void ScriptingModule::writeConfigEntryBool(const QString &group, const QString &name, bool value)
-{
- KConfigGroup g = KSharedConfig::openConfig()->group(group);
- g.writeEntry(name, value);
-}
-
-void ScriptingModule::writeConfigEntryInt(const QString &group, const QString &name, int value)
-{
- KConfigGroup g = KSharedConfig::openConfig()->group(group);
- g.writeEntry(name, value);
-}
-
-void ScriptingModule::writeConfigEntryFloat(const QString &group, const QString &name, float value)
-{
- KConfigGroup g = KSharedConfig::openConfig()->group(group);
- g.writeEntry(name, value);
-}
-
-void ScriptingModule::syncConfig(const QString &group)
-{
- KConfigGroup g = KSharedConfig::openConfig()->group(group);
- g.sync();
-}
-
-QObject *ScriptingModule::createTimer(bool single_shot)
-{
- QTimer *t = new QTimer(this);
- t->setSingleShot(single_shot);
- return t;
-}
-
-bool ScriptingModule::addGroup(const QString &name, const QString &icon, const QString &path, Kross::Object::Ptr obj)
-{
- ScriptableGroup *g = new ScriptableGroup(name, icon, path, obj, core->getExternalInterface());
- kt::GroupManager *gman = core->getGroupManager();
- gman->addDefaultGroup(g);
- sgroups.insert(name, g);
- return true;
-}
-
-void ScriptingModule::removeGroup(const QString &name)
-{
- if (!sgroups.contains(name))
- return;
-
- kt::GroupManager *gman = core->getGroupManager();
- ScriptableGroup *g = sgroups[name];
- sgroups.remove(name);
- gman->removeDefaultGroup(g);
-}
-}
diff --git a/plugins/scripting/api/scriptingmodule.h b/plugins/scripting/api/scriptingmodule.h
deleted file mode 100644
index 245194ff..00000000
--- a/plugins/scripting/api/scriptingmodule.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-#ifndef KTSCRIPTINGMODULE_H
-#define KTSCRIPTINGMODULE_H
-
-#include "scriptablegroup.h"
-#include <QObject>
-#include <kross/core/object.h>
-
-namespace kt
-{
-class GUIInterface;
-class CoreInterface;
-
-/**
- Additional functions to be used in scripts
-*/
-class ScriptingModule : public QObject
-{
- Q_OBJECT
-public:
- ScriptingModule(GUIInterface *gui, CoreInterface *core, QObject *parent);
- ~ScriptingModule() override;
-
-public Q_SLOTS:
- /// Get the scripts directory
- QString scriptsDir() const;
-
- /// Get the data directory of a script
- QString scriptDir(const QString &script) const;
-
- /// Read a config entry
- QString readConfigEntry(const QString &group, const QString &name, const QString &default_value);
- int readConfigEntryInt(const QString &group, const QString &name, int default_value);
- float readConfigEntryFloat(const QString &group, const QString &name, float default_value);
- bool readConfigEntryBool(const QString &group, const QString &name, bool default_value);
-
- /// Write a config entry
- void writeConfigEntry(const QString &group, const QString &name, const QString &value);
- void writeConfigEntryInt(const QString &group, const QString &name, int value);
- void writeConfigEntryFloat(const QString &group, const QString &name, float value);
- void writeConfigEntryBool(const QString &group, const QString &name, bool value);
-
- /// Sync a group
- void syncConfig(const QString &group);
-
- /// Create a timer
- QObject *createTimer(bool single_shot);
-
- /// Add a new scriptable group
- bool addGroup(const QString &name, const QString &icon, const QString &path, Kross::Object::Ptr obj);
-
- /// Remove a previously added group
- void removeGroup(const QString &name);
-
-private:
- GUIInterface *gui;
- CoreInterface *core;
- QMap<QString, ScriptableGroup *> sgroups;
-};
-
-}
-
-#endif
diff --git a/plugins/scripting/ktorrent_scripting.desktop b/plugins/scripting/ktorrent_scripting.desktop
deleted file mode 100644
index 1a95419c..00000000
--- a/plugins/scripting/ktorrent_scripting.desktop
+++ /dev/null
@@ -1,108 +0,0 @@
-[Desktop Entry]
-Name=Scripting
-Name[bg]=Скриптиране
-Name[bs]=Skriptovanje
-Name[ca]=Crea scripts
-Name[ca at valencia]=Crea scripts
-Name[cs]=Skriptování
-Name[da]=Scripting
-Name[de]=Skripte
-Name[el]=Σενάρια
-Name[en_GB]=Scripting
-Name[es]=Programación
-Name[et]=Skriptid
-Name[fi]=Skriptaus
-Name[fr]=Langage de scripts
-Name[ga]=Scriptiú
-Name[gl]=Scripts
-Name[hu]=Parancsfájlkezelés
-Name[ia]=Scripting
-Name[is]=Skriftun
-Name[it]=Script
-Name[ja]=スクリプティング
-Name[kk]=Скриптті жазу
-Name[km]=ការស្គ្រីប
-Name[ko]=스크립팅
-Name[lt]=Scenarijai
-Name[lv]=Skriptēšana
-Name[nb]=Skripting
-Name[nds]=Skripten
-Name[nl]=Scripting
-Name[nn]=Skripting
-Name[pl]=Skrypty
-Name[pt]=Programação
-Name[pt_BR]=Scripts
-Name[ro]=Scriptare
-Name[ru]=Сценарии
-Name[si]=විධානාවලි
-Name[sk]=Skriptovanie
-Name[sl]=Skriptno izvajanje
-Name[sq]=Skriptimi
-Name[sr]=Скрипте
-Name[sr at ijekavian]=Скрипте
-Name[sr at ijekavianlatin]=Skripte
-Name[sr at latin]=Skripte
-Name[sv]=Skripthantering
-Name[tr]=Betikleme
-Name[ug]=قوليازما
-Name[uk]=Запис сценаріїв
-Name[x-test]=xxScriptingxx
-Name[zh_CN]=脚本
-Name[zh_TW]=文稿
-Comment=Enables Kross scripting support
-Comment[bg]=Включване на поддръжка на скриптиране на Kross
-Comment[bs]=Omogućava podršku za skriptovanje Krosom
-Comment[ca]=Habilita l'ús per a crear scripts del Kross
-Comment[ca at valencia]=Habilita l'ús per a crear scripts del Kross
-Comment[cs]=Podpora skriptování Kross
-Comment[da]=Aktiverer understøttelse af Kross-scripting
-Comment[de]=Aktiviert die Unterstützung für Kross-Skripte
-Comment[el]=Ενεργοποίηση υποστήριξης σεναρίων Kross
-Comment[en_GB]=Enables Kross scripting support
-Comment[es]=Activa el uso de scripts con Kross
-Comment[et]=Krossi skriptimise toetus
-Comment[fi]=Ottaa käyttöön Kross-skriptaustuen
-Comment[fr]=Active la prise en charge du langage de scripts Kross
-Comment[ga]=Breiseán a chumasaíonn scriptiú Kross
-Comment[gl]=Permite o uso de scripts escritos en Kross.
-Comment[hu]=A Kross parancsfájlok támogatásának engedélyezése
-Comment[is]=Virkja stuðning við Kross skriftun
-Comment[it]=Abilita il supporto script Kross
-Comment[ja]=Kross スクリプティングサポートを有効にします
-Comment[kk]=Kross скриптін рұқсат ету
-Comment[km]=អនុញ្ញាតការគាំទ្រការស្គ្រីប Kross
-Comment[ko]=Kross 스크립팅 지원 사용
-Comment[lt]=Įgalina kryžminį scenarijų palaikymą
-Comment[lv]=Kross skriptēšanas spraudnis
-Comment[nb]=Skru på støtte for Kross skripting
-Comment[nds]=Ünnerstütten för Kross-Skripten
-Comment[nl]=Schakelt ondersteuning voor kross-scripting in
-Comment[nn]=Slår på støtte for Kross-skripting
-Comment[pl]=Włącza obsługę skryptową Kross
-Comment[pt]=Activa o suporte de programação com o Kross
-Comment[pt_BR]=Habilita suporte à scripts do Kross
-Comment[ro]=Activează suportul pentru scripturi Kross
-Comment[ru]=Модуль поддержки сценариев Kross в KTorrent
-Comment[si]=Kross විධානාවලි සහාය සක්රීය කරයි
-Comment[sk]=Povolí podporu Kross scripting
-Comment[sl]=Omogoči podporo za pisanje skript Kross
-Comment[sr]=Додаје подршку за скриптовање Кросом
-Comment[sr at ijekavian]=Додаје подршку за скриптовање Кросом
-Comment[sr at ijekavianlatin]=Dodaje podršku za skriptovanje Krossom
-Comment[sr at latin]=Dodaje podršku za skriptovanje Krossom
-Comment[sv]=Aktiverar stöd för skripthantering med Kross
-Comment[tr]=Kross betikleme desteğini etkinleştirir
-Comment[uk]=Уможливлює підтримку Kross
-Comment[x-test]=xxEnables Kross scripting supportxx
-Comment[zh_CN]=启用 Kross 脚本支持
-Comment[zh_TW]=Kross 文稿支援
-Type=Service
-X-KDE-Library=ktscriptingplugin
-X-KDE-PluginInfo-Author=Joris Guisson
-X-KDE-PluginInfo-Email=joris.guisson at gmail.com
-X-KDE-PluginInfo-Name=ScriptingPlugin
-X-KDE-PluginInfo-Version=0.1
-X-KDE-PluginInfo-Website=http://kde.org/applications/internet/ktorrent/
-X-KDE-PluginInfo-License=GPL
-X-KDE-PluginInfo-EnabledByDefault=false
-Icon=text-x-script
diff --git a/plugins/scripting/ktorrent_scriptingui.rc b/plugins/scripting/ktorrent_scriptingui.rc
deleted file mode 100644
index 7ad609d8..00000000
--- a/plugins/scripting/ktorrent_scriptingui.rc
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE gui SYSTEM "kpartgui.dtd">
-<gui library="libktscriptingplugin" name="ktscriptingplugin" version="1">
- <ToolBar name="ScriptingToolbar">
- <text>Scripting</text>
- <Action name="add_script" />
- <Action name="remove_script" />
- <Separator/>
- <Action name="run_script" />
- <Action name="stop_script" />
- <Separator/>
- <Action name="configure_script" />
- </ToolBar>
-
- <Menu name="ScriptingMenu">
- <text>Scripting</text>
- <Action name="add_script" />
- <Action name="remove_script" />
- <Separator/>
- <Action name="run_script" />
- <Action name="stop_script" />
- <Action name="edit_script" />
- <Separator/>
- <Action name="script_properties" />
- <Action name="configure_script" />
- </Menu>
-</gui>
diff --git a/plugins/scripting/script.cpp b/plugins/scripting/script.cpp
deleted file mode 100644
index 75a8332f..00000000
--- a/plugins/scripting/script.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include <QMimeDatabase>
-#include <QMimeType>
-
-#include <KConfigGroup>
-#include <KDesktopFile>
-#include <Kross/Core/ActionCollection>
-#include <Kross/Core/Manager>
-
-#include "script.h"
-#include <util/fileops.h>
-#include <util/log.h>
-
-using namespace bt;
-
-namespace kt
-{
-Script::Script(QObject *parent)
- : QObject(parent)
- , action(nullptr)
- , executing(false)
- , can_be_removed(true)
-{
-}
-
-Script::Script(const QString &file, QObject *parent)
- : QObject(parent)
- , file(file)
- , action(nullptr)
- , executing(false)
- , can_be_removed(true)
-{
-}
-
-Script::~Script()
-{
- stop();
-}
-
-bool Script::loadFromDesktopFile(const QString &dir, const QString &desktop_file)
-{
- KDesktopFile df(dir + desktop_file);
- // check if everything is OK
- if (df.readType().trimmed() != QStringLiteral("KTorrentScript"))
- return false;
-
- info.name = df.readName();
- info.comment = df.readComment();
- info.icon = df.readIcon();
-
- KConfigGroup g = df.group("Desktop Entry");
- info.author = g.readEntry("X-KTorrent-Script-Author", QString());
- info.email = g.readEntry("X-KTorrent-Script-Email", QString());
- info.website = g.readEntry("X-KTorrent-Script-Website", QString());
- info.license = g.readEntry("X-KTorrent-Script-License", QString());
- file = g.readEntry("X-KTorrent-Script-File", QString());
- if (file.isEmpty() || !bt::Exists(dir + file)) // the script file must exist
- return false;
-
- file = dir + file;
- return true;
-}
-
-bool Script::executeable() const
-{
- return bt::Exists(file) && !Kross::Manager::self().interpreternameForFile(file).isNull();
-}
-
-bool Script::execute()
-{
- if (!bt::Exists(file) || action)
- return false;
-
- QMimeDatabase db;
- QMimeType mt = db.mimeTypeForFile(file);
- QString name = QFileInfo(file).fileName();
- action = new Kross::Action(this, name);
- action->setText(name);
- action->setDescription(name);
- action->setFile(file);
- action->setIconName(mt.iconName());
- QString interpreter = Kross::Manager::self().interpreternameForFile(file);
- if (interpreter.isNull()) {
- delete action;
- action = nullptr;
- return false;
- } else {
- action->setInterpreter(interpreter);
- Kross::Manager::self().actionCollection()->addAction(file, action);
- action->trigger();
- executing = true;
- return true;
- }
-}
-
-void Script::stop()
-{
- if (!executing)
- return;
-
- // Call unload function if the script has one
- if (action->functionNames().contains(QStringLiteral("unload"))) {
- QVariantList args;
- action->callFunction(QStringLiteral("unload"), args);
- }
-
- Kross::ActionCollection *col = Kross::Manager::self().actionCollection();
- col->removeAction(action->file());
- action->deleteLater();
- action = nullptr;
- executing = false;
-}
-
-QString Script::name() const
-{
- if (!info.name.isEmpty())
- return info.name;
- else if (action)
- return action->name();
- else
- return QFileInfo(file).fileName();
-}
-
-QString Script::iconName() const
-{
- QMimeDatabase db;
- if (!info.icon.isEmpty())
- return info.icon;
- else if (action)
- return action->iconName();
- else
- return db.mimeTypeForFile(file).iconName();
-}
-
-bool Script::hasConfigure() const
-{
- if (!action)
- return false;
-
- QStringList functions = action->functionNames();
- return functions.contains(QStringLiteral("configure"));
-}
-
-void Script::configure()
-{
- if (!action)
- return;
-
- QVariantList args;
- action->callFunction(QStringLiteral("configure"), args);
-}
-
-}
diff --git a/plugins/scripting/script.h b/plugins/scripting/script.h
deleted file mode 100644
index 4ba1d712..00000000
--- a/plugins/scripting/script.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#ifndef KTSCRIPT_H
-#define KTSCRIPT_H
-
-#include <QObject>
-
-namespace Kross
-{
-class Action;
-}
-
-namespace kt
-{
-/**
- Keeps track of a script
-*/
-class Script : public QObject
-{
- Q_OBJECT
-public:
- Script(QObject *parent);
- Script(const QString &file, QObject *parent);
- ~Script() override;
-
- struct MetaInfo {
- QString name;
- QString comment;
- QString icon;
- QString author;
- QString email;
- QString website;
- QString license;
-
- bool valid() const
- {
- return !name.isEmpty() && !comment.isEmpty() && !icon.isEmpty() && !author.isEmpty() && !license.isEmpty();
- }
- };
-
- /**
- * Load the script from a desktop file
- * @param dir THe directory the desktop file is in
- * @param desktop_file The desktop file itself (relative to dir)
- * @return true upon success
- */
- bool loadFromDesktopFile(const QString &dir, const QString &desktop_file);
-
- /**
- * Load and execute the script
- * @return true upon success
- */
- bool execute();
-
- /// Is the script executeable (i.e. is the interpreter not installed)
- bool executeable() const;
-
- /**
- * Stop the script
- */
- void stop();
-
- /// Is the script running
- bool running() const
- {
- return executing;
- }
-
- /// Get the name of the script
- QString name() const;
-
- /// Get the icon name of the script
- QString iconName() const;
-
- /// Get the file
- QString scriptFile() const
- {
- return file;
- }
-
- /// Get the package directory, this returns an empty string if the script is just a file
- QString packageDirectory() const
- {
- return package_directory;
- }
-
- /// Set the package directory
- void setPackageDirectory(const QString &dir)
- {
- package_directory = dir;
- }
-
- /// Get the meta info of the script
- const MetaInfo &metaInfo() const
- {
- return info;
- }
-
- /// Does the script has a configure function
- bool hasConfigure() const;
-
- /// Call the configure function of the script
- void configure();
-
- /// Whether or not the script can be removed
- bool removable() const
- {
- return can_be_removed;
- }
-
- /// Set the script to be removable or not
- void setRemovable(bool on)
- {
- can_be_removed = on;
- }
-
-private:
- QString file;
- Kross::Action *action;
- bool executing;
- MetaInfo info;
- bool can_be_removed;
- QString package_directory;
-};
-
-}
-
-#endif
diff --git a/plugins/scripting/scriptdelegate.cpp b/plugins/scripting/scriptdelegate.cpp
deleted file mode 100644
index 68c91b91..00000000
--- a/plugins/scripting/scriptdelegate.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2009 Joris Guisson <joris.guisson at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include <algorithm>
-
-#include <KIconLoader>
-#include <QApplication>
-#include <QPainter>
-#include <QPushButton>
-
-#include "scriptdelegate.h"
-#include "scriptmodel.h"
-
-#define MARGIN 5
-
-namespace kt
-{
-ScriptDelegate::ScriptDelegate(QAbstractItemView *parent)
- : KWidgetItemDelegate(parent, parent)
- , check_box(new QCheckBox)
- , push_button(new QPushButton)
-{
-}
-
-ScriptDelegate::~ScriptDelegate()
-{
- delete check_box;
- delete push_button;
-}
-
-QFont ScriptDelegate::titleFont(const QFont &base) const
-{
- QFont font(base);
- font.setBold(true);
- return font;
-}
-
-void ScriptDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
- if (!index.isValid())
- return;
-
- int x_offset = check_box->sizeHint().width();
-
- painter->save();
- QApplication::style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, nullptr);
-
- int iconSize = option.rect.height() - MARGIN * 2;
-
- QString icon = index.model()->data(index, Qt::DecorationRole).toString();
- KIconLoader::States state = option.state & QStyle::State_Enabled ? KIconLoader::DefaultState : KIconLoader::DisabledState;
- QPixmap pixmap = KIconLoader::global()->loadIcon(icon, KIconLoader::Desktop, iconSize, state);
-
- int x = MARGIN + option.rect.left() + x_offset;
- painter->drawPixmap(QRect(x, MARGIN + option.rect.top(), iconSize, iconSize), pixmap, QRect(0, 0, iconSize, iconSize));
-
- x = MARGIN * 2 + iconSize + option.rect.left() + x_offset;
- QRect contentsRect(x, MARGIN + option.rect.top(), option.rect.width() - MARGIN * 3 - iconSize - x_offset, option.rect.height() - MARGIN * 2);
-
- int lessHorizontalSpace = MARGIN * 2 + push_button->sizeHint().width();
- contentsRect.setWidth(contentsRect.width() - lessHorizontalSpace);
-
- QPalette::ColorGroup cg = QPalette::Active;
- if (!(option.state & QStyle::State_Enabled))
- cg = QPalette::Inactive;
-
- if (option.state & QStyle::State_Selected)
- painter->setPen(option.palette.color(cg, QPalette::HighlightedText));
- else
- painter->setPen(option.palette.color(cg, QPalette::WindowText));
-
- painter->save();
- painter->save();
- QFont font = titleFont(option.font);
- QFontMetrics fmTitle(font);
- painter->setFont(font);
- QString text = index.model()->data(index, Qt::DisplayRole).toString();
- painter->drawText(contentsRect, Qt::AlignLeft | Qt::AlignTop, fmTitle.elidedText(text, Qt::ElideRight, contentsRect.width()));
- painter->restore();
-
- QString comment = index.model()->data(index, ScriptModel::CommentRole).toString();
- painter->drawText(contentsRect, Qt::AlignLeft | Qt::AlignBottom, option.fontMetrics.elidedText(comment, Qt::ElideRight, contentsRect.width()));
-
- painter->restore();
- painter->restore();
-}
-
-QSize ScriptDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
-{
- QFont font = titleFont(option.font);
- QFontMetrics fm(font);
-
- int w = std::max(fm.horizontalAdvance(index.model()->data(index, Qt::DisplayRole).toString()),
- option.fontMetrics.horizontalAdvance(index.model()->data(index, ScriptModel::CommentRole).toString()));
- int h = std::max(KIconLoader::SizeMedium + MARGIN * 2, fm.height() + option.fontMetrics.height() + MARGIN * 2);
- return QSize(w + KIconLoader::SizeMedium, h);
-}
-
-QList<QWidget *> ScriptDelegate::createItemWidgets(const QModelIndex &index) const
-{
- Q_UNUSED(index)
- QList<QWidget *> widgets;
-
- QCheckBox *enabled_check = new QCheckBox;
- connect(enabled_check, &QCheckBox::clicked, this, &ScriptDelegate::toggled);
-
- QPushButton *about_button = new QPushButton;
- about_button->setIcon(QIcon::fromTheme(QStringLiteral("dialog-information")));
- connect(about_button, &QPushButton::clicked, this, &ScriptDelegate::aboutClicked);
-
- QPushButton *configure_button = new QPushButton;
- configure_button->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
- connect(configure_button, &QPushButton::clicked, this, &ScriptDelegate::settingsClicked);
-
- QList<QEvent::Type> blocked;
- blocked << QEvent::MouseButtonPress << QEvent::MouseButtonRelease << QEvent::MouseButtonDblClick;
- setBlockedEventTypes(enabled_check, blocked);
- setBlockedEventTypes(about_button, blocked);
- setBlockedEventTypes(configure_button, blocked);
-
- widgets << enabled_check << configure_button << about_button;
- return widgets;
-}
-
-void ScriptDelegate::updateItemWidgets(const QList<QWidget *> widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
-{
- QCheckBox *check_box = static_cast<QCheckBox *>(widgets[0]);
- check_box->resize(check_box->sizeHint());
- int x = MARGIN;
- check_box->move(x, option.rect.height() / 2 - check_box->sizeHint().height() / 2);
-
- QPushButton *about_button = static_cast<QPushButton *>(widgets[2]);
- QSize about_size_hint = about_button->sizeHint();
- about_button->resize(about_size_hint);
- x = option.rect.width() - MARGIN - about_size_hint.width();
- about_button->move(x, option.rect.height() / 2 - about_size_hint.height() / 2);
-
- QPushButton *configure_button = static_cast<QPushButton *>(widgets[1]);
- QSize configure_size_hint = configure_button->sizeHint();
- configure_button->resize(configure_size_hint);
- x = option.rect.width() - MARGIN * 2 - configure_size_hint.width() - about_size_hint.width();
- configure_button->move(x, option.rect.height() / 2 - configure_size_hint.height() / 2);
-
- if (!index.isValid()) {
- check_box->setVisible(false);
- about_button->setVisible(false);
- configure_button->setVisible(false);
- } else {
- check_box->setChecked(index.model()->data(index, Qt::CheckStateRole).toBool());
- check_box->setEnabled(true);
- configure_button->setVisible(true);
- configure_button->setEnabled(index.model()->data(index, ScriptModel::ConfigurableRole).toBool());
- }
-}
-
-void ScriptDelegate::aboutClicked()
-{
- QModelIndex index = focusedIndex();
- QAbstractItemModel *model = (QAbstractItemModel *)index.model();
- model->setData(index, 0, ScriptModel::AboutRole);
-}
-
-void ScriptDelegate::settingsClicked()
-{
- QModelIndex index = focusedIndex();
- QAbstractItemModel *model = (QAbstractItemModel *)index.model();
- model->setData(index, 0, ScriptModel::ConfigureRole);
-}
-
-void ScriptDelegate::toggled(bool on)
-{
- QModelIndex index = focusedIndex();
- QAbstractItemModel *model = (QAbstractItemModel *)index.model();
- model->setData(index, on, Qt::CheckStateRole);
-}
-}
diff --git a/plugins/scripting/scriptdelegate.h b/plugins/scripting/scriptdelegate.h
deleted file mode 100644
index 5fcfa6a6..00000000
--- a/plugins/scripting/scriptdelegate.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2009 Joris Guisson <joris.guisson at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#ifndef KT_SCRIPTDELEGATE_H
-#define KT_SCRIPTDELEGATE_H
-
-#include <QAbstractItemView>
-#include <QCheckBox>
-#include <QPushButton>
-
-#include <KWidgetItemDelegate>
-
-namespace kt
-{
-class ScriptDelegate : public KWidgetItemDelegate
-{
- Q_OBJECT
-public:
- ScriptDelegate(QAbstractItemView *parent);
- ~ScriptDelegate() override;
-
- void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
- QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
- QList<QWidget *> createItemWidgets(const QModelIndex &index) const override;
- void updateItemWidgets(const QList<QWidget *> widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const override;
-
-private:
- QFont titleFont(const QFont &baseFont) const;
-
-private Q_SLOTS:
- void toggled(bool on);
- void aboutClicked();
- void settingsClicked();
-
-private:
- QCheckBox *check_box;
- QPushButton *push_button;
-};
-
-}
-
-#endif // KT_SCRIPTDELEGATE_H
diff --git a/plugins/scripting/scriptingplugin.cpp b/plugins/scripting/scriptingplugin.cpp
deleted file mode 100644
index fec13097..00000000
--- a/plugins/scripting/scriptingplugin.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include <QFileDialog>
-
-#include <KActionCollection>
-#include <KConfigGroup>
-#include <KIO/CopyJob>
-#include <KLocalizedString>
-#include <KMainWindow>
-#include <KMessageBox>
-#include <KPluginFactory>
-#include <Kross/Core/ActionCollection>
-#include <Kross/Core/Interpreter>
-#include <Kross/Core/Manager>
-
-#include <dbus/dbus.h>
-#include <interfaces/coreinterface.h>
-#include <interfaces/functions.h>
-#include <interfaces/guiinterface.h>
-#include <util/error.h>
-#include <util/fileops.h>
-#include <util/functions.h>
-#include <util/log.h>
-#include <util/logsystemmanager.h>
-
-#include "api/scriptingmodule.h"
-#include "script.h"
-#include "scriptingplugin.h"
-#include "scriptmanager.h"
-#include "scriptmodel.h"
-
-K_PLUGIN_FACTORY_WITH_JSON(ktorrent_scripting, "ktorrent_scripting.json", registerPlugin<kt::ScriptingPlugin>();)
-
-using namespace bt;
-
-namespace kt
-{
-ScriptingPlugin::ScriptingPlugin(QObject *parent, const QVariantList &args)
- : Plugin(parent)
-{
- Q_UNUSED(args);
-}
-
-ScriptingPlugin::~ScriptingPlugin()
-{
-}
-
-void ScriptingPlugin::load()
-{
- // make sure script dir exists
- QString script_dir = kt::DataDir() + QStringLiteral("scripts") + bt::DirSeparator();
- if (!bt::Exists(script_dir))
- bt::MakeDir(script_dir, true);
-
- LogSystemManager::instance().registerSystem(i18n("Scripting"), SYS_SCR);
- model = new ScriptModel(this);
- // add the KTorrent object
- Kross::Manager::self().addObject(getCore()->getExternalInterface(), QStringLiteral("KTorrent"));
- Kross::Manager::self().addObject(new ScriptingModule(getGUI(), getCore(), this), QStringLiteral("KTScriptingPlugin"));
- loadScripts();
-
- Out(SYS_SCR | LOG_DEBUG) << "Supported interpreters : " << endl;
- const QStringList interpreters = Kross::Manager::self().interpreters();
- for (const QString &s : interpreters)
- Out(SYS_SCR | LOG_DEBUG) << s << endl;
-
- sman = new ScriptManager(model, nullptr);
- connect(sman, &ScriptManager::addScript, this, &ScriptingPlugin::addScript);
- connect(sman, &ScriptManager::removeScript, this, &ScriptingPlugin::removeScript);
- connect(model, &ScriptModel::showPropertiesDialog, sman, qOverload<Script *>(&ScriptManager::showProperties));
- getGUI()->addActivity(sman);
-}
-
-void ScriptingPlugin::unload()
-{
- LogSystemManager::instance().unregisterSystem(i18n("Scripting"));
- // save currently loaded scripts
- saveScripts();
- getGUI()->removeActivity(sman);
- delete sman;
- sman = nullptr;
- delete model;
- model = nullptr;
-}
-
-void ScriptingPlugin::loadScripts()
-{
- const QStringList dir_list =
- QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("ktorrent/scripts"), QStandardPaths::LocateDirectory);
- for (const QString &dir : dir_list) {
- QDir d(dir);
- const QStringList subdirs = d.entryList(QDir::Dirs);
- for (const QString &sdir : subdirs) {
- if (sdir != QStringLiteral("..") && sdir != QStringLiteral(".")) {
- QString absolute_path = d.absoluteFilePath(sdir);
- Script *s = loadScriptDir(absolute_path);
- if (s) {
- // Scripts in the home directory can be deleted
- s->setRemovable(absolute_path.startsWith(kt::DataDir()));
- }
- }
- }
- }
-
- //
- KConfigGroup g = KSharedConfig::openConfig()->group(QLatin1String("Scripting"));
- const QStringList scripts = g.readEntry(QLatin1String("scripts"), QStringList());
- for (const QString &s : scripts) {
- Out(SYS_SCR | LOG_DEBUG) << "Loading script " << s << endl;
- if (bt::Exists(s)) {
- try {
- model->addScript(s);
- } catch (bt::Error &err) {
- getGUI()->errorMsg(err.toString());
- }
- }
- }
-
- // Start scripts which where running the previous time
- QStringList running = g.readEntry("running", QStringList());
- if (running.count())
- model->runScripts(running);
-}
-
-Script *ScriptingPlugin::loadScriptDir(const QString &dir)
-{
- QDir d(dir);
- const QStringList files = d.entryList(QDir::Files);
- QString desktop_file;
- QString dir_path = dir;
- if (!dir_path.endsWith(bt::DirSeparator()))
- dir_path.append(bt::DirSeparator());
-
- // look for desktop files
- for (const QString &file : files) {
- if (file.endsWith(QStringLiteral(".desktop"))) {
- return model->addScriptFromDesktopFile(dir_path, file);
- }
- }
-
- return nullptr;
-}
-
-void ScriptingPlugin::saveScripts()
-{
- KConfigGroup g = KSharedConfig::openConfig()->group("Scripting");
- g.writeEntry("scripts", model->scriptFiles());
- g.writeEntry("running", model->runningScriptFiles());
- g.sync();
-}
-
-void ScriptingPlugin::addScript()
-{
- QString filter = QStringLiteral("*.tar.gz *.tar.bz2 *.zip | ") + i18n("KTorrent Script Packages") + QStringLiteral("\n *.rb *.py *.js | ") + i18n("Scripts")
- + QStringLiteral("\n* |") + i18n("All files");
-
- QUrl url = QFileDialog::getOpenFileUrl(getGUI()->getMainWindow(), QString(), QUrl(QStringLiteral("kfiledialog:///addScript")), filter);
- if (!url.isValid())
- return;
-
- try {
- if (url.isLocalFile()) {
- model->addScript(url.toLocalFile());
- } else {
- QString script_dir = kt::DataDir() + QStringLiteral("scripts") + bt::DirSeparator();
- KIO::CopyJob *j = KIO::copy(url, QUrl::fromLocalFile(script_dir + url.fileName()));
- connect(j, &KIO::CopyJob::result, this, &ScriptingPlugin::scriptDownloadFinished);
- }
- } catch (bt::Error &err) {
- getGUI()->errorMsg(err.toString());
- }
-}
-
-void ScriptingPlugin::scriptDownloadFinished(KJob *job)
-{
- KIO::CopyJob *j = (KIO::CopyJob *)job;
- if (j->error()) {
- getGUI()->errorMsg(j);
- } else {
- try {
- QString script_dir = kt::DataDir() + QStringLiteral("scripts") + bt::DirSeparator();
- model->addScript(script_dir + j->destUrl().fileName());
- } catch (bt::Error &err) {
- getGUI()->errorMsg(err.toString());
- }
- }
-}
-
-void ScriptingPlugin::removeScript()
-{
- QStringList scripts_to_delete;
- const QModelIndexList indices = sman->selectedScripts();
- for (const QModelIndex &idx : indices) {
- Script *s = model->scriptForIndex(idx);
- if (s && !s->packageDirectory().isEmpty())
- scripts_to_delete.append(s->name());
- }
-
- if (scripts_to_delete.count() > 0) {
- QString msg = i18n(
- "Removing these scripts will fully delete them from your disk. "
- "Are you sure you want to do this?");
- if (KMessageBox::questionYesNoList(getGUI()->getMainWindow(), msg, scripts_to_delete) != KMessageBox::Yes)
- return;
- }
-
- model->removeScripts(indices);
- saveScripts();
- sman->updateActions(sman->selectedScripts());
-}
-
-bool ScriptingPlugin::versionCheck(const QString &version) const
-{
- return version == QStringLiteral(VERSION);
-}
-}
-
-#include "scriptingplugin.moc"
diff --git a/plugins/scripting/scriptingplugin.h b/plugins/scripting/scriptingplugin.h
deleted file mode 100644
index bd642841..00000000
--- a/plugins/scripting/scriptingplugin.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#ifndef KTSCRIPTINGPLUGIN_H
-#define KTSCRIPTINGPLUGIN_H
-
-#include <interfaces/plugin.h>
-
-class KJob;
-
-namespace kt
-{
-class Script;
-class ScriptManager;
-class ScriptModel;
-
-/**
- @author
-*/
-class ScriptingPlugin : public Plugin
-{
- Q_OBJECT
-public:
- ScriptingPlugin(QObject *parent, const QVariantList &args);
- ~ScriptingPlugin() override;
-
- void load() override;
- void unload() override;
- bool versionCheck(const QString &version) const override;
-
-private:
- void scriptDownloadFinished(KJob *job);
- void loadScripts();
- void saveScripts();
- Script *loadScriptDir(const QString &dir);
-
-private Q_SLOTS:
- void addScript();
- void removeScript();
-
-private:
- ScriptManager *sman;
- ScriptModel *model;
-};
-
-}
-
-#endif
diff --git a/plugins/scripting/scriptmanager.cpp b/plugins/scripting/scriptmanager.cpp
deleted file mode 100644
index 34d427f0..00000000
--- a/plugins/scripting/scriptmanager.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include <QAction>
-#include <QDialog>
-#include <QDialogButtonBox>
-#include <QMenu>
-#include <QPushButton>
-#include <QVBoxLayout>
-
-#include <KActionCollection>
-#include <KConfigGroup>
-#include <KIconLoader>
-#include <KLocalizedString>
-#include <KRun>
-#include <Kross/Core/Manager>
-
-#include "script.h"
-#include "scriptdelegate.h"
-#include "scriptmanager.h"
-#include "scriptmodel.h"
-#include "ui_scriptproperties.h"
-#include <util/log.h>
-
-using namespace Kross;
-using namespace bt;
-
-namespace kt
-{
-ScriptManager::ScriptManager(ScriptModel *model, QWidget *parent)
- : Activity(i18n("Scripts"), QStringLiteral("text-x-script"), 40, parent)
- , model(model)
-{
- setXMLGUIFile(QStringLiteral("ktorrent_scriptingui.rc"));
- setupActions();
- setToolTip(i18n("Widget to start, stop and manage scripts"));
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setSpacing(0);
- layout->setMargin(0);
-
- view = new QListView(this);
- delegate = new ScriptDelegate(view);
- view->setItemDelegate(delegate);
- view->setAlternatingRowColors(true);
- layout->addWidget(view);
-
- view->setModel(model);
- view->setContextMenuPolicy(Qt::CustomContextMenu);
- view->setSelectionMode(QAbstractItemView::ExtendedSelection);
- view->setSelectionBehavior(QAbstractItemView::SelectRows);
-
- connect(view->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ScriptManager::onSelectionChanged);
-
- connect(view, &QListView::customContextMenuRequested, this, &ScriptManager::showContextMenu);
-
- connect(model, &ScriptModel::dataChanged, this, &ScriptManager::dataChanged);
-
- add_script->setEnabled(true);
- remove_script->setEnabled(false);
- run_script->setEnabled(false);
- stop_script->setEnabled(false);
- edit_script->setEnabled(false);
- properties->setEnabled(false);
- configure_script->setEnabled(false);
-}
-
-ScriptManager::~ScriptManager()
-{
- delete delegate;
-}
-
-void ScriptManager::setupActions()
-{
- KActionCollection *ac = part()->actionCollection();
-
- add_script = new QAction(QIcon::fromTheme(QStringLiteral("list-add")), i18n("Add Script"), this);
- connect(add_script, &QAction::triggered, this, &ScriptManager::addScript);
- ac->addAction(QStringLiteral("add_script"), add_script);
-
- remove_script = new QAction(QIcon::fromTheme(QStringLiteral("list-remove")), i18n("Remove Script"), this);
- connect(remove_script, &QAction::triggered, this, &ScriptManager::removeScript);
- ac->addAction(QStringLiteral("remove_script"), remove_script);
-
- run_script = new QAction(QIcon::fromTheme(QStringLiteral("system-run")), i18n("Run Script"), this);
- connect(run_script, &QAction::triggered, this, &ScriptManager::runScript);
- ac->addAction(QStringLiteral("run_script"), run_script);
-
- stop_script = new QAction(QIcon::fromTheme(QStringLiteral("media-playback-stop")), i18n("Stop Script"), this);
- connect(stop_script, &QAction::triggered, this, &ScriptManager::stopScript);
- ac->addAction(QStringLiteral("stop_script"), stop_script);
-
- edit_script = new QAction(QIcon::fromTheme(QStringLiteral("document-open")), i18n("Edit Script"), this);
- connect(edit_script, &QAction::triggered, this, &ScriptManager::editScript);
- ac->addAction(QStringLiteral("edit_script"), edit_script);
-
- properties = new QAction(QIcon::fromTheme(QStringLiteral("dialog-information")), i18n("Properties"), this);
- connect(properties, &QAction::triggered, this, qOverload<>(&ScriptManager::showProperties));
- ac->addAction(QStringLiteral("script_properties"), properties);
-
- configure_script = new QAction(QIcon::fromTheme(QStringLiteral("preferences-other")), i18n("Configure"), this);
- connect(configure_script, &QAction::triggered, this, &ScriptManager::configureScript);
- ac->addAction(QStringLiteral("configure_script"), configure_script);
-}
-
-void ScriptManager::onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
-{
- Q_UNUSED(deselected);
- Q_UNUSED(selected);
- updateActions(selectedScripts());
-}
-
-void ScriptManager::updateActions(const QModelIndexList &selected)
-{
- int num_removable = 0;
- int num_running = 0;
- int num_not_running = 0;
- for (const QModelIndex &idx : selected) {
- Script *s = model->scriptForIndex(idx);
- if (s) {
- if (s->running())
- num_running++;
- else
- num_not_running++;
- if (s->removable())
- num_removable++;
- } else
- num_not_running++;
- }
-
- remove_script->setEnabled(num_removable > 0);
- run_script->setEnabled(selected.count() > 0 && num_not_running > 0);
- stop_script->setEnabled(selected.count() > 0 && num_running > 0);
- Script *s = nullptr;
- if (selected.count() > 0)
- s = model->scriptForIndex(selected.front());
- properties->setEnabled(selected.count() == 1 && s && s->metaInfo().valid());
- configure_script->setEnabled(selected.count() == 1 && s && s->hasConfigure());
- edit_script->setEnabled(selected.count() == 1);
-}
-
-QModelIndexList ScriptManager::selectedScripts()
-{
- return view->selectionModel()->selectedRows();
-}
-
-void ScriptManager::showContextMenu(const QPoint &p)
-{
- QMenu *m = part()->menu(QStringLiteral("ScriptingMenu"));
- if (m)
- m->popup(view->viewport()->mapToGlobal(p));
-}
-
-void ScriptManager::dataChanged(const QModelIndex &from, const QModelIndex &to)
-{
- Q_UNUSED(from);
- Q_UNUSED(to);
- updateActions(selectedScripts());
-}
-
-void ScriptManager::runScript()
-{
- const QModelIndexList sel = selectedScripts();
- for (const QModelIndex &idx : sel) {
- if (!model->setData(idx, Qt::Checked, Qt::CheckStateRole))
- Out(SYS_SCR | LOG_DEBUG) << "setData failed" << endl;
- }
- updateActions(sel);
-}
-
-void ScriptManager::stopScript()
-{
- const QModelIndexList sel = selectedScripts();
- for (const QModelIndex &idx : sel) {
- if (!model->setData(idx, Qt::Unchecked, Qt::CheckStateRole))
- Out(SYS_SCR | LOG_DEBUG) << "setData failed" << endl;
- }
- updateActions(sel);
-}
-
-void ScriptManager::editScript()
-{
- const QModelIndexList sel = selectedScripts();
- for (const QModelIndex &idx : sel) {
- Script *s = model->scriptForIndex(idx);
- if (s)
- new KRun(QUrl::fromLocalFile(s->scriptFile()), nullptr);
- }
-}
-
-void ScriptManager::showProperties()
-{
- QModelIndexList sel = selectedScripts();
- if (sel.count() != 1)
- return;
-
- Script *s = model->scriptForIndex(sel.front());
- if (!s || !s->metaInfo().valid())
- return;
-
- showProperties(s);
-}
-
-void ScriptManager::showProperties(kt::Script *s)
-{
- Ui_ScriptProperties prop;
- QDialog *dialog = new QDialog(this);
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
- QWidget *mainWidget = new QWidget(this);
- QVBoxLayout *mainLayout = new QVBoxLayout;
- dialog->setLayout(mainLayout);
- mainLayout->addWidget(mainWidget);
- QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
- okButton->setDefault(true);
- okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
- dialog->connect(okButton, &QPushButton::clicked, dialog, &QDialog::accept);
- mainLayout->addWidget(buttonBox);
- dialog->setWindowTitle(i18n("Script Properties"));
- prop.setupUi(mainWidget);
- prop.m_icon->setPixmap(QIcon::fromTheme(s->iconName()).pixmap(KIconLoader::StdSizes::SizeMedium));
- prop.m_name->setText(s->name());
- prop.m_description->setText(s->metaInfo().comment);
- prop.m_author->setText(s->metaInfo().author);
- prop.m_license->setText(s->metaInfo().license);
- prop.m_email->setText(s->metaInfo().email);
- prop.m_website->setText(s->metaInfo().website);
- dialog->exec();
- delete dialog;
-}
-
-void ScriptManager::configureScript()
-{
- QModelIndexList sel = selectedScripts();
- if (sel.count() != 1)
- return;
-
- Script *s = model->scriptForIndex(sel.front());
- if (!s || !s->metaInfo().valid() || !s->hasConfigure())
- return;
-
- s->configure();
-}
-}
diff --git a/plugins/scripting/scriptmanager.h b/plugins/scripting/scriptmanager.h
deleted file mode 100644
index d5532686..00000000
--- a/plugins/scripting/scriptmanager.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#ifndef KTSCRIPTMANAGER_H
-#define KTSCRIPTMANAGER_H
-
-#include <QListView>
-#include <interfaces/activity.h>
-
-class QAction;
-class KActionCollection;
-
-namespace Kross
-{
-class Action;
-}
-
-namespace kt
-{
-class Script;
-class ScriptModel;
-class ScriptDelegate;
-
-/**
- Widget to display all scripts.
-*/
-class ScriptManager : public Activity
-{
- Q_OBJECT
-public:
- ScriptManager(ScriptModel *model, QWidget *parent);
- ~ScriptManager() override;
-
- /// Get all selected scripts
- QModelIndexList selectedScripts();
-
- /// Update all actions and make sure they are properly enabled or disabled
- void updateActions(const QModelIndexList &selected);
-
-private Q_SLOTS:
- void onSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
- void showContextMenu(const QPoint &p);
- void dataChanged(const QModelIndex &f, const QModelIndex &to);
- void runScript();
- void stopScript();
- void editScript();
- void configureScript();
- void showProperties();
-
-public:
- void showProperties(Script *script);
-
-private:
- void setupActions();
-
-Q_SIGNALS:
- void addScript();
- void removeScript();
-
-private:
- ScriptModel *model;
- ScriptDelegate *delegate;
- QListView *view;
-
- QAction *add_script;
- QAction *remove_script;
- QAction *run_script;
- QAction *stop_script;
- QAction *edit_script;
- QAction *properties;
- QAction *configure_script;
-};
-
-}
-
-#endif
diff --git a/plugins/scripting/scriptmodel.cpp b/plugins/scripting/scriptmodel.cpp
deleted file mode 100644
index 150ded78..00000000
--- a/plugins/scripting/scriptmodel.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include <QIcon>
-#include <QMimeDatabase>
-#include <QMimeType>
-
-#include <KLocalizedString>
-#include <KTar>
-#include <KZip>
-
-#include <interfaces/functions.h>
-#include <util/error.h>
-#include <util/fileops.h>
-#include <util/log.h>
-
-#include "script.h"
-#include "scriptmodel.h"
-
-using namespace bt;
-
-namespace kt
-{
-ScriptModel::ScriptModel(QObject *parent)
- : QAbstractListModel(parent)
-{
-}
-
-ScriptModel::~ScriptModel()
-{
-}
-
-void ScriptModel::addScript(const QString &file)
-{
- Out(SYS_SCR | LOG_NOTICE) << "Adding script from " << file << endl;
- QMimeDatabase db;
- QMimeType ptr = db.mimeTypeForFile(file);
-
- bool is_tar = ptr.name() == QStringLiteral("application/x-compressed-tar") || ptr.name() == QStringLiteral("application/x-bzip-compressed-tar");
- bool is_zip = ptr.name() == QStringLiteral("application/zip");
- if (is_tar || is_zip) {
- // It's a package
- if (is_tar) {
- KTar tar(file);
- addScriptFromArchive(&tar);
- } else {
- KZip zip(file);
- addScriptFromArchive(&zip);
- }
- } else {
- // make sure we don't add dupes
- for (Script *s : qAsConst(scripts))
- if (s->scriptFile() == file)
- return;
-
- Script *s = new Script(file, this);
- scripts.append(s);
- insertRow(scripts.count() - 1);
- }
-}
-
-Script *ScriptModel::addScriptFromDesktopFile(const QString &dir, const QString &desktop_file)
-{
- Script *s = new Script(this);
- if (!s->loadFromDesktopFile(dir, desktop_file)) {
- delete s;
- return nullptr;
- }
-
- // we don't want dupes
- for (Script *os : qAsConst(scripts)) {
- if (s->scriptFile() == os->scriptFile()) {
- delete s;
- return nullptr;
- }
- }
-
- s->setPackageDirectory(dir);
- scripts.append(s);
- insertRow(scripts.count() - 1);
- return s;
-}
-
-void ScriptModel::addScriptFromArchive(KArchive *archive)
-{
- if (!archive->open(QIODevice::ReadOnly))
- throw bt::Error(i18n("Cannot open archive for reading."));
-
- const KArchiveDirectory *dir = archive->directory();
- if (!dir)
- throw bt::Error(i18n("Invalid archive."));
-
- const QStringList entries = dir->entries();
- for (const QString &e : entries) {
- const KArchiveEntry *entry = dir->entry(e);
- if (entry && entry->isDirectory()) {
- addScriptFromArchiveDirectory((const KArchiveDirectory *)entry);
- }
- }
-}
-
-void ScriptModel::addScriptFromArchiveDirectory(const KArchiveDirectory *dir)
-{
- const QStringList files = dir->entries();
- for (const QString &file : files) {
- // look for the desktop file
- if (!file.endsWith(QStringLiteral(".desktop")) && !file.endsWith(QStringLiteral(".DESKTOP")))
- continue;
-
- // check for duplicate packages
- QString dest_dir = kt::DataDir() + QStringLiteral("scripts/") + dir->name() + QLatin1Char('/');
- for (Script *s : qAsConst(scripts)) {
- if (s->packageDirectory() == dest_dir)
- throw bt::Error(i18n("There is already a script package named %1 installed.", dir->name()));
- }
-
- // extract to the scripts dir
- dir->copyTo(dest_dir, true);
- if (!addScriptFromDesktopFile(dest_dir, file))
- throw bt::Error(i18n("Failed to load script from archive. There is something wrong with the desktop file."));
-
- return;
- }
-
- throw bt::Error(i18n("No script found in archive."));
-}
-
-int ScriptModel::rowCount(const QModelIndex &parent) const
-{
- return parent.isValid() ? 0 : scripts.count();
-}
-
-QVariant ScriptModel::data(const QModelIndex &index, int role) const
-{
- Script *s = scriptForIndex(index);
- if (!s)
- return QVariant();
-
- switch (role) {
- case Qt::DisplayRole:
- return s->name();
- case Qt::DecorationRole:
- return s->iconName();
- case Qt::CheckStateRole:
- return s->running();
- case Qt::ToolTipRole:
- if (s->executeable())
- return i18n("<b>%1</b><br/><br/>%2", s->name(), s->metaInfo().comment);
- else
- return i18n(
- "No interpreter for this script could be found, so it cannot be executed. "
- "Please make sure the right interpreter is installed.<br/><br/>"
- "<b>Hint:</b> All standard ktorrent scripts require krosspython");
- case CommentRole:
- return s->metaInfo().comment;
- case ConfigurableRole:
- return s->running() && s->hasConfigure();
- default:
- return QVariant();
- }
-}
-
-bool ScriptModel::setData(const QModelIndex &index, const QVariant &value, int role)
-{
- if (!index.isValid())
- return false;
-
- Script *s = scriptForIndex(index);
- if (!s)
- return false;
-
- if (role == Qt::CheckStateRole) {
- if (value.toBool())
- s->execute();
- else
- s->stop();
-
- dataChanged(index, index);
- return true;
- } else if (role == ConfigureRole) {
- s->configure();
- return true;
- } else if (role == AboutRole) {
- showPropertiesDialog(s);
- return true;
- }
- return false;
-}
-
-Qt::ItemFlags ScriptModel::flags(const QModelIndex &index) const
-{
- if (!index.isValid())
- return QAbstractItemModel::flags(index);
-
- Script *s = scriptForIndex(index);
- if (!s)
- return QAbstractItemModel::flags(index);
-
- if (s->executeable())
- return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
- else
- return Qt::ItemIsSelectable | Qt::ItemIsUserCheckable;
-}
-
-Script *ScriptModel::scriptForIndex(const QModelIndex &index) const
-{
- if (!index.isValid())
- return nullptr;
-
- if (index.row() < 0 || index.row() >= scripts.count())
- return nullptr;
-
- return scripts[index.row()];
-}
-
-bool ScriptModel::removeRows(int row, int count, const QModelIndex &parent)
-{
- Q_UNUSED(parent);
- beginRemoveRows(QModelIndex(), row, row + count - 1);
- endRemoveRows();
- return true;
-}
-
-bool ScriptModel::insertRows(int row, int count, const QModelIndex &parent)
-{
- Q_UNUSED(parent);
- beginInsertRows(QModelIndex(), row, row + count - 1);
- endInsertRows();
- return true;
-}
-
-QStringList ScriptModel::scriptFiles() const
-{
- QStringList ret;
- for (Script *s : qAsConst(scripts))
- ret << s->scriptFile();
- return ret;
-}
-
-QStringList ScriptModel::runningScriptFiles() const
-{
- QStringList ret;
- for (Script *s : qAsConst(scripts)) {
- if (s->running())
- ret << s->scriptFile();
- }
- return ret;
-}
-
-void ScriptModel::runScripts(const QStringList &r)
-{
- int idx = 0;
- for (Script *s : qAsConst(scripts)) {
- if (r.contains(s->scriptFile()) && !s->running()) {
- s->execute();
- QModelIndex i = index(idx, 0);
- Q_EMIT dataChanged(i, i);
- }
- idx++;
- }
-}
-
-void ScriptModel::removeScripts(const QModelIndexList &indices)
-{
- QList<Script *> to_remove;
-
- for (const QModelIndex &idx : indices) {
- Script *s = scriptForIndex(idx);
- if (s && s->removable())
- to_remove << s;
- }
-
- beginResetModel();
- for (Script *s : qAsConst(to_remove)) {
- if (!s->packageDirectory().isEmpty())
- bt::Delete(s->packageDirectory(), true);
- scripts.removeAll(s);
- s->stop();
- s->deleteLater();
- }
-
- endResetModel();
-}
-}
diff --git a/plugins/scripting/scriptmodel.h b/plugins/scripting/scriptmodel.h
deleted file mode 100644
index ce209060..00000000
--- a/plugins/scripting/scriptmodel.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Joris Guisson <joris.guisson at gmail.com>
- SPDX-FileCopyrightText: 2008 Ivan Vasic <ivasic at gmail.com>
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#ifndef KTSCRIPTMODEL_H
-#define KTSCRIPTMODEL_H
-
-#include <QAbstractListModel>
-
-class KArchive;
-class KArchiveDirectory;
-
-namespace kt
-{
-class Script;
-
-/**
- Model which keeps track of all scripts
-*/
-class ScriptModel : public QAbstractListModel
-{
- Q_OBJECT
-public:
- ScriptModel(QObject *parent);
- ~ScriptModel() override;
-
- enum Role {
- CommentRole = Qt::UserRole,
- ConfigurableRole,
- ConfigureRole,
- AboutRole,
- };
-
- /**
- * Add a script to the model
- * @param file
- */
- void addScript(const QString &file);
-
- /**
- * Add script which is described by a desktop file.
- * @param dir The directory the script is in
- * @param desktop_file The desktop file (relative to dir, not an absolute path)
- * @return The Script or 0 if something goes wrong
- */
- Script *addScriptFromDesktopFile(const QString &dir, const QString &desktop_file);
-
- /// Get a script given an index
- Script *scriptForIndex(const QModelIndex &index) const;
-
- /// Get a list of all scripts
- QStringList scriptFiles() const;
-
- /// Get a list of all running scripts
- QStringList runningScriptFiles() const;
-
- /// Remove a bunch of scripts
- void removeScripts(const QModelIndexList &indices);
-
- /// Run all the scripts in the string list
- void runScripts(const QStringList &r);
-
- int rowCount(const QModelIndex &parent) const override;
- QVariant data(const QModelIndex &index, int role) const override;
- bool setData(const QModelIndex &index, const QVariant &value, int role) override;
- Qt::ItemFlags flags(const QModelIndex &index) const override;
- bool removeRows(int row, int count, const QModelIndex &parent) override;
- bool insertRows(int row, int count, const QModelIndex &parent) override;
-
-private:
- void addScriptFromArchive(KArchive *archive);
- void addScriptFromArchiveDirectory(const KArchiveDirectory *dir);
-
-Q_SIGNALS:
- void showPropertiesDialog(Script *s);
-
-private:
- QList<Script *> scripts;
-};
-
-}
-
-#endif
diff --git a/plugins/scripting/scriptproperties.ui b/plugins/scripting/scriptproperties.ui
deleted file mode 100644
index cb145458..00000000
--- a/plugins/scripting/scriptproperties.ui
+++ /dev/null
@@ -1,131 +0,0 @@
-<ui version="4.0" >
- <class>ScriptProperties</class>
- <widget class="QWidget" name="ScriptProperties" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>320</width>
- <height>177</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Script Properties</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <item>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="m_icon" >
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLabel" name="m_name" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="font" >
- <font>
- <pointsize>14</pointsize>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text" >
- <string comment="KDE::DoNotExtract" >TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Description:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QLabel" name="m_description" >
- <property name="text" >
- <string comment="KDE::DoNotExtract" >TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_5" >
- <property name="text" >
- <string>License:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QLabel" name="m_license" >
- <property name="text" >
- <string comment="KDE::DoNotExtract" >TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>Author:</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1" >
- <widget class="QLabel" name="m_author" >
- <property name="text" >
- <string comment="KDE::DoNotExtract" >TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>E-Mail:</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1" >
- <widget class="QLabel" name="m_email" >
- <property name="text" >
- <string comment="KDE::DoNotExtract" >TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0" >
- <widget class="QLabel" name="label_6" >
- <property name="text" >
- <string>Website:</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1" >
- <widget class="QLabel" name="m_website" >
- <property name="text" >
- <string comment="KDE::DoNotExtract" >TextLabel</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="Line" name="line" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/plugins/scripting/scripts/CMakeLists.txt b/plugins/scripting/scripts/CMakeLists.txt
deleted file mode 100644
index dcdf9bc7..00000000
--- a/plugins/scripting/scripts/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-add_subdirectory(email_notifications)
-add_subdirectory(auto_resume)
-add_subdirectory(tracker_groups)
-add_subdirectory(auto_remove)
diff --git a/plugins/scripting/scripts/auto_remove/CMakeLists.txt b/plugins/scripting/scripts/auto_remove/CMakeLists.txt
deleted file mode 100644
index 74ee07b9..00000000
--- a/plugins/scripting/scripts/auto_remove/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-install(FILES auto_remove.desktop DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/auto_remove)
-install(FILES auto_remove.py DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/auto_remove)
-install(FILES auto_remove.ui DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/auto_remove)
diff --git a/plugins/scripting/scripts/auto_remove/auto_remove.desktop b/plugins/scripting/scripts/auto_remove/auto_remove.desktop
deleted file mode 100644
index 36607c84..00000000
--- a/plugins/scripting/scripts/auto_remove/auto_remove.desktop
+++ /dev/null
@@ -1,108 +0,0 @@
-[Desktop Entry]
-Name=Automatic Remove
-Name[ar]=الإزالة الآليّة
-Name[ast]=Desaniciu automáticu
-Name[bg]=Автоматично премахване
-Name[bs]=Automatsko uklanjanje
-Name[ca]=Supressió automàtica
-Name[ca at valencia]=Supressió automàtica
-Name[cs]=Automatické odstranění
-Name[da]=Fjern automatisk
-Name[de]=Automatisch entfernen
-Name[el]=Αυτόματη αφαίρεση
-Name[en_GB]=Automatic Remove
-Name[es]=Eliminación automática
-Name[et]=Automaatne eemaldamine
-Name[fi]=Automaattinen poisto
-Name[fr]=Suppression automatique
-Name[ga]=Baint Uathoibríoch
-Name[gl]=Retiro automático
-Name[hu]=Automatikus eltávolítás
-Name[is]=Fjarlægja sjálfkrafa
-Name[it]=Rimozione automatica
-Name[ja]=自動削除
-Name[kk]=Автоматты түрде өшіру
-Name[km]=យកចេញដោយស្វ័យប្រវត្តិ
-Name[ko]=자동 삭제
-Name[lt]=Automatinis šalinimas
-Name[lv]=Automātiska izņemšana
-Name[mr]=स्वयंचलित काढून टाका
-Name[nb]=Automatisk fjerning
-Name[nds]=Automaatsch wegmaken
-Name[nl]=Automatisch verwijderen
-Name[nn]=Fjern automatisk
-Name[pl]=Automatyczne Usuwanie
-Name[pt]=Remoção Automática
-Name[pt_BR]=Remoção automática
-Name[ro]=Eliminare automată
-Name[ru]=Автоматическое удаление
-Name[si]=ස්වයංක්රීය ඉවත් කිරීම
-Name[sk]=Automatické odstránenie
-Name[sl]=Samodejna odstranitev
-Name[sq]=Hiqe Automatikisht
-Name[sr]=Аутоматско уклањање
-Name[sr at ijekavian]=Аутоматско уклањање
-Name[sr at ijekavianlatin]=Automatsko uklanjanje
-Name[sr at latin]=Automatsko uklanjanje
-Name[sv]=Automatisk borttagning
-Name[tr]=Otomatik Silme
-Name[uk]=Автоматичне вилучення
-Name[x-test]=xxAutomatic Removexx
-Name[zh_CN]=自动移除
-Name[zh_TW]=自動移除
-Comment=Script to automatically remove torrents when they finish downloading or seeding
-Comment[ar]=سكربت لإزالة السّيول آليًّا عندما ينتهي تنزيلها أو تزويدها
-Comment[bg]=Скрипт за автоматично премахване на торенти при приключване с изтеглянето или разпръскването им
-Comment[bs]=Skripta za automatsko uklanjanje torenata nakon što završe preuzimanje ili sijanje
-Comment[ca]=Script per a suprimir automàticament els torrent quan s'han acabat de baixar o sembrar
-Comment[ca at valencia]=Script per a suprimir automàticament els torrent quan s'han acabat de baixar o sembrar
-Comment[cs]=Skript, který automaticky odstraní torrenty pokud dokončily stahování nebo sdílení
-Comment[da]=Script til automatisk at fjerne torrents når de er færdige med at downloade eller seede
-Comment[de]=Skript zum automatischen Entfernen von Torrents, wenn sie vollständig hoch- oder heruntergeladen sind
-Comment[el]=Σενάριο για την αυτόματη αφαίρεση torrent μετά το πέρας λήψης ή σποράς
-Comment[en_GB]=Script to automatically remove torrents when they finish downloading or seeding
-Comment[es]=Script para eliminar automáticamente los torrents cuando se acaben de descargar o sembrar
-Comment[et]=Skript torrentite automaatseks eemaldamiseks, kui allalaadimine või levitamine on lõpetatud
-Comment[fi]=Skripti torrentien automaattiseen poistoon, kun niiden lataus tai jakaminen on valmistunut
-Comment[fr]=Script pour supprimer automatiquement des torrents lorsqu'ils ont fini leurs téléchargements ou leurs partages
-Comment[ga]=Script a bhaineann torrents nuair atá an t-íosluchtú nó an síolú críochnaithe
-Comment[gl]=Un script para retirar os torrentes automaticamente cando remate a súa descarga ou espallamento.
-Comment[hu]=A torrentek automatikus eltávolítása a letöltés vagy megosztás befejeződésekor
-Comment[is]=Skrifta sem fjarlægir strauma sjálfvirkt þegar þeir hafa lokið sáningu eða niðurhali
-Comment[it]=Script per rimuovere automaticamente gli scaricamenti al termine dello scaricamento o distribuzione seme
-Comment[ja]=ダウンロードまたはシードを完了したときに自動的に torrent を削除するスクリプト
-Comment[kk]=Жүктеп алу не тарату аяқталған соң автоматты түрде торрентті өшіру скрипті
-Comment[km]=ស្គ្រីប ដើម្បីយក torrents ចេញដោយស្វ័យប្រវត្តិ នៅពេលដែលពួកគេបញ្ចប់ការទាញយក ឬបណ្ដុះ
-Comment[ko]=토렌트 다운로드 및 시드가 끝났을 때 자동으로 토렌트 삭제
-Comment[lt]=Scenarijus automatiškai pašalinti torrentus kai jie baigiami atsiųsti ar skleisti
-Comment[lv]=Skripts automātiski izņem torrnetus, kad pabeigta lejupielāde vai piedāvāšana
-Comment[nb]=Et skript som automatisk fjerner strømmer når de er ferdig lastet ned eller opp
-Comment[nds]=Dat Skript maakt Torrents automaatsch weg, wenn ehr Daalladen oder Verdelen afslaten is.
-Comment[nl]=Script voor het automatisch verwijderen van torrents bij het beëindigen van downloaden of 'seeding'
-Comment[nn]=Skript som automatisk fjernar torrentar når dei er ferdignedlasta eller -delte
-Comment[pl]=Skrypt do automatycznego usuwania torrentów po zakończonym pobieraniu lub wysyłaniu
-Comment[pt]=Um programa para remover automaticamente as torrentes quando terminar a sua transferência ou publicação
-Comment[pt_BR]=Script para remover automaticamente os torrents, quando o download ou a semeação forem concluídos
-Comment[ro]=Script pentru eliminarea automată a torentelor la încheierea descărcării sau încărcării acestora
-Comment[ru]=Сценарий для автоматического удаления торрентов после окончания их загрузки или отдачи
-Comment[si]=බාගැනීම හෝ සීඩ් කිරීම අවසන් විට ටොරෙන්ට් ස්වයංක්රීයව ඉවත් කිරීම සඳහා විධානාවලිය
-Comment[sk]=Skript na automatické odstránenie torrentov, keď skončia sťahovanie alebo zdieľanie
-Comment[sl]=Skript za samodejno odstranitev torrentov, ko se zaključi prejemanje ali sejanje
-Comment[sr]=Скрипта за аутоматско уклањање торената пошто се заврши преузимање или сејање
-Comment[sr at ijekavian]=Скрипта за аутоматско уклањање торената пошто се заврши преузимање или сијање
-Comment[sr at ijekavianlatin]=Skripta za automatsko uklanjanje torenata pošto se završi preuzimanje ili sijanje
-Comment[sr at latin]=Skripta za automatsko uklanjanje torenata pošto se završi preuzimanje ili sejanje
-Comment[sv]=Skript för att automatiskt ta bort dataflöden när nerladdning är klar eller de inte erbjuds längre
-Comment[tr]=İndirilmesi ya da gönderilmesi biten torrentleri otomatik olarak kaldıran bir betik
-Comment[uk]=Скрипт для автоматичного вилучення торентів після завершення їхнього отримання або поширення.
-Comment[x-test]=xxScript to automatically remove torrents when they finish downloading or seedingxx
-Comment[zh_CN]=下载完成或出种时自动移除种子的脚本
-Comment[zh_TW]=在完成下載或播種後自動移除 torrent 的文稿
-Type=KTorrentScript
-Icon=kt-remove
-X-KTorrent-Script-Author=Joris Guisson
-X-KTorrent-Script-Email=joris.guisson at gmail.com
-X-KTorrent-Script-Website=http://kde.org/applications/internet/ktorrent/
-X-KTorrent-Script-License=GPL
-X-KTorrent-Script-File=auto_remove.py
-
diff --git a/plugins/scripting/scripts/auto_remove/auto_remove.py b/plugins/scripting/scripts/auto_remove/auto_remove.py
deleted file mode 100644
index 37395ca0..00000000
--- a/plugins/scripting/scripts/auto_remove/auto_remove.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env kf5kross
-# -*- coding: utf-8 -*-
-import KTorrent
-import KTScriptingPlugin
-import Kross
-#from PyQt4 import QtCore
-
-t = Kross.module("kdetranslation")
-
-class AutoRemove:
- def __init__(self):
- self.auto_resume = False
- self.remove_on_finish_downloading = False
- self.remove_on_finish_seeding = False
- self.timer = KTScriptingPlugin.createTimer(True)
- KTorrent.connect("torrentAdded(const QString &)",self.torrentAdded)
- tors = KTorrent.torrents()
- # bind to signals for each torrent
- for t in tors:
- self.torrentAdded(t)
-
-
- def torrentFinished(self,tor):
- KTorrent.log("Torrent finished %s" % tor.name())
- if self.remove_on_finish_downloading:
- KTorrent.log("Removing %s" % tor.name())
- KTorrent.removeDelayed(tor.infoHash(),False)
-
-
- def seedingAutoStopped(self,tor,reason):
- KTorrent.log("Torrent finished seeding %s" % tor.name())
- if self.remove_on_finish_seeding:
- KTorrent.log("Removing %s" % tor.name())
- KTorrent.removeDelayed(tor.infoHash(),False)
-
- def torrentAdded(self,ih):
- tor = KTorrent.torrent(ih)
- KTorrent.log("Torrent added %s" % tor.name())
- tor.connect("finished(QObject* )",self.torrentFinished)
- tor.connect("seedingAutoStopped(QObject* ,const QString & )",self.seedingAutoStopped)
-
- def save(self):
- KTScriptingPlugin.writeConfigEntryBool("AutoRemoveScript","remove_on_finish_downloading",self.remove_on_finish_downloading)
- KTScriptingPlugin.writeConfigEntryBool("AutoRemoveScript","remove_on_finish_seeding",self.remove_on_finish_seeding)
- KTScriptingPlugin.syncConfig("AutoRemoveScript")
-
- def load(self):
- self.remove_on_finish_downloading = KTScriptingPlugin.readConfigEntryBool("AutoRemoveScript","remove_on_finish_downloading",False)
- self.remove_on_finish_seeding = KTScriptingPlugin.readConfigEntryBool("AutoRemoveScript","remove_on_finish_seeding",False)
-
- def configure(self):
- forms = Kross.module("forms")
- dialog = forms.createDialog(t.i18n("Auto Remove Settings"))
- dialog.setButtons("Ok|Cancel")
- page = dialog.addPage(t.i18n("Auto Remove"),t.i18n("Auto Remove"),"kt-remove")
- widget = forms.createWidgetFromUIFile(page,KTScriptingPlugin.scriptDir("auto_remove") + "auto_remove.ui")
- widget["finish_seeding"].checked = self.remove_on_finish_seeding
- widget["finish_downloading"].checked = self.remove_on_finish_downloading
- if dialog.exec_loop():
- self.remove_on_finish_seeding = widget["finish_seeding"].checked
- self.remove_on_finish_downloading = widget["finish_downloading"].checked
- self.save()
-
-
-ar = AutoRemove()
-ar.load()
-
-def configure():
- global ar
- ar.configure()
-
-def unload():
- global ar
- del ar
diff --git a/plugins/scripting/scripts/auto_remove/auto_remove.ui b/plugins/scripting/scripts/auto_remove/auto_remove.ui
deleted file mode 100644
index e5b0f002..00000000
--- a/plugins/scripting/scripts/auto_remove/auto_remove.ui
+++ /dev/null
@@ -1,41 +0,0 @@
-<ui version="4.0" >
- <class>AutoRemoveConfig</class>
- <widget class="QWidget" name="AutoRemoveConfig" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>366</width>
- <height>81</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Auto Resume Settings</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Auto remove a torrent when:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="finish_downloading" >
- <property name="text" >
- <string>The torrent finishes downloading</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="finish_seeding" >
- <property name="text" >
- <string>The torrent finishes seeding</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
diff --git a/plugins/scripting/scripts/auto_resume/CMakeLists.txt b/plugins/scripting/scripts/auto_resume/CMakeLists.txt
deleted file mode 100644
index 7935f90c..00000000
--- a/plugins/scripting/scripts/auto_resume/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-install(FILES auto_resume.desktop DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/auto_resume)
-install(FILES auto_resume.py DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/auto_resume)
-install(FILES auto_resume.ui DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/auto_resume)
diff --git a/plugins/scripting/scripts/auto_resume/auto_resume.desktop b/plugins/scripting/scripts/auto_resume/auto_resume.desktop
deleted file mode 100644
index 18d1b63e..00000000
--- a/plugins/scripting/scripts/auto_resume/auto_resume.desktop
+++ /dev/null
@@ -1,104 +0,0 @@
-[Desktop Entry]
-Name=Automatic Resume
-Name[ar]=الاستكمال الآليّ
-Name[bg]=Автоматично продължаване
-Name[bs]=Automatsko nastavljanje
-Name[ca]=Represa automàtica
-Name[ca at valencia]=Represa automàtica
-Name[cs]=Automatické pokračování
-Name[da]=Genoptag automatisk
-Name[de]=Automatisch fortsetzen
-Name[el]=Αυτόματη συνέχιση
-Name[en_GB]=Automatic Resume
-Name[es]=Reanudación automática
-Name[et]=Automaatne taasalustamine
-Name[fi]=Automaattinen jatkaminen
-Name[fr]=Reprise automatique
-Name[ga]=Lean go hUathoibríoch
-Name[gl]=Continuación automática
-Name[hne]=अपने अपन रीज्यूम करव
-Name[hu]=Automatikus folytatás
-Name[is]=Sjálfvirkt haldið áfram
-Name[it]=Ripresa automatica
-Name[ja]=自動再開
-Name[kk]=Автоматты түрде жалғастыру
-Name[km]=បន្តដោយស្វ័យប្រវត្តិ
-Name[ko]=자동 다시 시작
-Name[lt]=Automatinis pratęsimas
-Name[lv]=Automātiska atsākšana
-Name[mr]=स्वयंचलित पुन्हा सुरु करा
-Name[nb]=Automatisk gjenopptaking
-Name[nds]=Automaatsch Wiedermaken
-Name[nl]=Automatisch verdergaan
-Name[nn]=Hald fram automatisk
-Name[pl]=Automatyczne Wznawianie
-Name[pt]=Continuação Automática
-Name[pt_BR]=Reinício automático
-Name[ro]=Reluare automată
-Name[ru]=Автоматическое возобновление
-Name[si]=ස්වයංක්රීය ඉදිරියට යෑම
-Name[sk]=Automatické pokračovanie
-Name[sl]=Samodejno nadaljevanje
-Name[sq]=Nisje Automatike
-Name[sr]=Аутоматско настављање
-Name[sr at ijekavian]=Аутоматско настављање
-Name[sr at ijekavianlatin]=Automatsko nastavljanje
-Name[sr at latin]=Automatsko nastavljanje
-Name[sv]=Automatisk återupptagning
-Name[tr]=Otomatik Devam Et
-Name[uk]=Автоматичне відновлення
-Name[x-test]=xxAutomatic Resumexx
-Name[zh_CN]=自动恢复
-Name[zh_TW]=自動回復
-Comment=Script to automatically resume after some time, when the suspended state is enabled
-Comment[bs]=Skripta za automatsko nastavljanje nakon određenog vremena, kada se pređe u stanje suspendovanosti
-Comment[ca]=Script per a reprendre automàticament després d'un temps, quan està activat l'estat de suspensió
-Comment[ca at valencia]=Script per a reprendre automàticament després d'un temps, quan està activat l'estat de suspensió
-Comment[cs]=Skript, který automaticky po určité době spustí stahování, pokud je torrent pozastaven
-Comment[da]=Script til at genoptage automatisk efter et stykke tid, når suspenderet tilstand aktiveres
-Comment[de]=Skript zum automatischen Fortsetzen von ausgesetzten Torrents nach Ablauf einer festgelegten Zeit
-Comment[el]=Σενάριο για την αυτόματη συνέχιση μετά από κάποιο χρονικό διάστημα, όταν η κατάσταση
παύσης είναι ενεργοποιημένη
-Comment[en_GB]=Script to automatically resume after some time, when the suspended state is enabled
-Comment[es]=Script para reanudar automáticamente tras cierto tiempo, cuando está activado el estado de suspensión
-Comment[et]=Skript automaatseks taasalustamiseks mõne aja pärast, kui sisse on lülitatud paus
-Comment[fi]=Skripti torrentin automaattiseen jatkamiseen, kun keskeytystila on käytössä
-Comment[fr]=Script pour reprendre automatiquement après un certain temps, lorsque l'état suspendu est activé
-Comment[ga]=Script a leanann ar aghaidh go huathoibríoch tar éis tréimhse éigin, nó atá an clár curtha ar fionraí
-Comment[gl]=Un script para continuar automaticamente despois dun tempo, cando se activa o estado de suspensión.
-Comment[hu]=Automatikus folytatás bizonyos idő után, ha a felfüggesztett állapot engedélyezett
-Comment[is]=Skrifta sem ræsir aftur sjálfkrafa eftir einhvern tíma, þegar biðstaða er virk
-Comment[it]=Script per riprendere automaticamente gli scaricamenti dopo un certo tempo se lo stato di sospensione è attivo
-Comment[kk]=Аялдау күйінде біршама уақыттан кейін автоматты түрде жалғастыру скрипті
-Comment[km]=ស្គ្រីបដើម្បីបន្តដោយស្វ័យប្រវត្តិ បន្ទាប់ពីពេលមួយ នៅពេលស្ថានភាពផ្អាកត្រូវបានបើក
-Comment[ko]=대기 상태가 활성화되었을 때 지정한 시간 이후 자동으로 다시 시작하는 스크립트
-Comment[lt]=Scenarijus automatiškai tęsti po kurio laiko kai sustabdymo būsena yra įjungta
-Comment[nb]=Et skript som gjenopptar aktiviteten etter en stund hvis hvilefunksjonen er slått på
-Comment[nds]=Dat Skript maakt automaatsch na en wiss Tiet wieder, wenn de Anhollen-Status anmaakt is.
-Comment[nl]=Script voor het automatisch verdergaan na enige tijd, als de onderbreek-status is ingeschakeld
-Comment[nn]=Skrift som automatisk held fram nedlastinga etter at ei nedlasting har stått på pause ei viss tid
-Comment[pl]=Skrypt do automatycznego wznawiania po ustalonym czasie po wstrzymaniu torrentów
-Comment[pt]=Um programa para prosseguir automaticamente, ao fim de algum tempo, quando for activado o estado suspenso
-Comment[pt_BR]=Script para reiniciar automaticamente após algum tempo, quando o estado suspender estiver habilitado
-Comment[ro]=Script pentru reluarea automată după un timp, cînd e activată starea suspendată
-Comment[ru]=Сценарий для автоматического возобновления работы после некоторого времени, если она была приостановлена
-Comment[si]=අත්හිටවුම් තත්වය සක්රීය විට, යම් කාලයකට පසු නැවත ක්රියාත්මක වීමට විධානාවලිය
-Comment[sk]=Skript na automatické pokračovanie po nejakom čase, keď je povolený úsporný režim
-Comment[sl]=Skript za samodejno nadaljevanje po določenem času, ko je omogočeno stanje pripravljenosti
-Comment[sr]=Скрипта за аутоматско настављање након одређеног времена, када се пређе у стање суспендованости
-Comment[sr at ijekavian]=Скрипта за аутоматско настављање након одређеног времена, када се пређе у стање суспендованости
-Comment[sr at ijekavianlatin]=Skripta za automatsko nastavljanje nakon određenog vremena, kada se pređe u stanje suspendovanosti
-Comment[sr at latin]=Skripta za automatsko nastavljanje nakon određenog vremena, kada se pređe u stanje suspendovanosti
-Comment[sv]=Skript för att automatiskt fortsätta efter en viss tid, när vilotillståndet aktiveras
-Comment[tr]=Duraklatılmış bir torrent görevini, bir süre sonra otomatik olarak devam ettiren betik
-Comment[uk]=Скрипт для автоматичного поновлення через певний проміжок часу, якщо увімкнено стан присипляння.
-Comment[x-test]=xxScript to automatically resume after some time, when the suspended state is enabledxx
-Comment[zh_CN]=当启用暂停状态时,自动在某段时间后恢复下载的脚本
-Comment[zh_TW]=在暫停一段時間後自動回復的文稿
-Type=KTorrentScript
-Icon=kt-bandwidth-scheduler
-X-KTorrent-Script-Author=Joris Guisson
-X-KTorrent-Script-Email=joris.guisson at gmail.com
-X-KTorrent-Script-Website=http://kde.org/applications/internet/ktorrent/
-X-KTorrent-Script-License=GPL
-X-KTorrent-Script-File=auto_resume.py
-
diff --git a/plugins/scripting/scripts/auto_resume/auto_resume.py b/plugins/scripting/scripts/auto_resume/auto_resume.py
deleted file mode 100644
index 11cad004..00000000
--- a/plugins/scripting/scripts/auto_resume/auto_resume.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env kf5kross
-# -*- coding: utf-8 -*-
-import KTorrent
-import KTScriptingPlugin
-import Kross
-#from PyQt4 import QtCore
-
-t = Kross.module("kdetranslation")
-
-class AutoResume:
- def __init__(self):
- self.auto_resume = False
- self.hours = 0
- self.minutes = 5
- self.seconds = 0
- KTorrent.connect("suspendStateChanged(bool)",self.suspendedStateChanged)
- self.timer = KTScriptingPlugin.createTimer(True)
- self.timer.connect('timeout()',self.timerFired)
-
-
- def timerFired(self):
- if KTorrent.suspended():
- KTorrent.log("AutoResumeScript: resuming suspended torrents")
- KTorrent.setSuspended(False)
-
- def startTimer(self):
- self.timer.start((self.hours * 3600 + self.minutes * 60 + self.seconds)*1000)
-
- def save(self):
- KTScriptingPlugin.writeConfigEntryBool("AutoResumeScript","auto_resume",self.auto_resume)
- KTScriptingPlugin.writeConfigEntryInt("AutoResumeScript","hours",self.hours)
- KTScriptingPlugin.writeConfigEntryInt("AutoResumeScript","minutes",self.minutes)
- KTScriptingPlugin.writeConfigEntryInt("AutoResumeScript","seconds",self.seconds)
- KTScriptingPlugin.syncConfig("AutoResumeScript")
-
- def load(self):
- self.auto_resume = KTScriptingPlugin.readConfigEntryBool("AutoResumeScript","auto_resume",self.auto_resume)
- self.hours = KTScriptingPlugin.readConfigEntryInt("AutoResumeScript","hours",self.hours)
- self.minutes = KTScriptingPlugin.readConfigEntryInt("AutoResumeScript","minutes",self.minutes)
- self.seconds = KTScriptingPlugin.readConfigEntryInt("AutoResumeScript","seconds",self.seconds)
- if self.auto_resume and KTorrent.suspended():
- self.startTimer()
-
- def suspendedStateChanged(self,on):
- if on and self.auto_resume:
- KTorrent.log("AutoResumeScript: torrents suspended, starting timer")
- self.startTimer()
- else:
- self.timer.stop()
-
- def configure(self):
- forms = Kross.module("forms")
- dialog = forms.createDialog(t.i18n("Auto Resume Settings"))
- dialog.setButtons("Ok|Cancel")
- page = dialog.addPage(t.i18n("Auto Resume"),t.i18n("Auto Resume"),"kt-bandwidth-scheduler")
- widget = forms.createWidgetFromUIFile(page,KTScriptingPlugin.scriptDir("auto_resume") + "auto_resume.ui")
- widget["auto_resume"].checked = self.auto_resume
- widget["hours"].value = self.hours
- widget["minutes"].value = self.minutes
- widget["seconds"].value = self.seconds
- widget["hours"].enabled = self.auto_resume
- widget["minutes"].enabled = self.auto_resume
- widget["seconds"].enabled = self.auto_resume
- if dialog.exec_loop():
- self.auto_resume = widget["auto_resume"].checked
- self.hours = widget["hours"].value
- self.minutes = widget["minutes"].value
- self.seconds = widget["seconds"].value
- self.save()
- if self.auto_resume and KTorrent.suspended():
- self.startTimer()
-
-
-ar = AutoResume()
-ar.load()
-
-def configure():
- global ar
- ar.configure()
-
-def unload():
- global ar
- del ar
diff --git a/plugins/scripting/scripts/auto_resume/auto_resume.ui b/plugins/scripting/scripts/auto_resume/auto_resume.ui
deleted file mode 100644
index bc9dab6b..00000000
--- a/plugins/scripting/scripts/auto_resume/auto_resume.ui
+++ /dev/null
@@ -1,123 +0,0 @@
-<ui version="4.0" >
- <class>AutoResumeConfig</class>
- <widget class="QWidget" name="AutoResumeConfig" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>366</width>
- <height>64</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Auto Resume Settings</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <widget class="QCheckBox" name="auto_resume" >
- <property name="text" >
- <string>Auto resume after:</string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <item>
- <spacer name="horizontalSpacer" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QSpinBox" name="hours" >
- <property name="suffix" >
- <string> hours</string>
- </property>
- <property name="maximum" >
- <number>1000</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="minutes" >
- <property name="suffix" >
- <string> minutes</string>
- </property>
- <property name="maximum" >
- <number>59</number>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="seconds" >
- <property name="suffix" >
- <string> seconds</string>
- </property>
- <property name="maximum" >
- <number>59</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>auto_resume</sender>
- <signal>toggled(bool)</signal>
- <receiver>hours</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>70</x>
- <y>17</y>
- </hint>
- <hint type="destinationlabel" >
- <x>78</x>
- <y>40</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>auto_resume</sender>
- <signal>toggled(bool)</signal>
- <receiver>minutes</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>167</x>
- <y>14</y>
- </hint>
- <hint type="destinationlabel" >
- <x>172</x>
- <y>40</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>auto_resume</sender>
- <signal>toggled(bool)</signal>
- <receiver>seconds</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>261</x>
- <y>14</y>
- </hint>
- <hint type="destinationlabel" >
- <x>275</x>
- <y>57</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/plugins/scripting/scripts/email_notifications/CMakeLists.txt b/plugins/scripting/scripts/email_notifications/CMakeLists.txt
deleted file mode 100644
index 375eb2f2..00000000
--- a/plugins/scripting/scripts/email_notifications/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-install(FILES email_notifications.desktop DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/email_notifications )
-install(FILES email_notifications.py DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/email_notifications )
-install(FILES emailconfig.ui DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/email_notifications )
-
diff --git a/plugins/scripting/scripts/email_notifications/email_notifications.desktop b/plugins/scripting/scripts/email_notifications/email_notifications.desktop
deleted file mode 100644
index 3c88f891..00000000
--- a/plugins/scripting/scripts/email_notifications/email_notifications.desktop
+++ /dev/null
@@ -1,110 +0,0 @@
-[Desktop Entry]
-Name=E-Mail Notifications
-Name[ar]=إخطارات البريد الإلكترونيّ
-Name[ast]=Avisos per corréu
-Name[bg]=Уведомления по е-поща
-Name[bs]=Obavještenja E-poštom
-Name[ca]=Notificacions per correu electrònic
-Name[ca at valencia]=Notificacions per correu electrònic
-Name[cs]=Upozornění e-mailem
-Name[da]=E-mail-bekendtgørelser
-Name[de]=E-Mail-Benachrichtigungen
-Name[el]=Ειδοποιήσεις E-Mail
-Name[en_GB]=E-Mail Notifications
-Name[es]=Notificaciones por correo electrónico
-Name[et]=Teadaanne e-postiga
-Name[fi]=Sähköposti-ilmoitukset
-Name[fr]=Envoyer des notifications par courrier électronique
-Name[ga]=Fógairtí Ríomhphoist
-Name[gl]=Notificacións por correo
-Name[hne]=ईमेल सूचना
-Name[hu]=Értesítés az eseményekről e-mailen keresztül
-Name[is]=Tilkynningar í tölvupósti
-Name[it]=Notifiche via messaggi di posta
-Name[ja]=メール通知
-Name[kk]=Эл.поштамен құлақтандыру
-Name[km]=ការជូនដំណឹងតាមអ៊ីមែល
-Name[ko]=이메일 알림
-Name[lt]=El. pašto pranešimai
-Name[lv]=E-pasta paziņojumi
-Name[mr]=इ-मेल सूचना
-Name[nb]=E-postbeskjeder
-Name[nds]=Nettpost-Narichten
-Name[nl]=E-mail-meldingen
-Name[nn]=E-postvarsel
-Name[pl]=Powiadomienia e-mail
-Name[pt]=Notificações por E-Mail
-Name[pt_BR]=Notificações por e-mail
-Name[ro]=Notificări prin poștă
-Name[ru]=Уведомления по электронной почте
-Name[si]=E-Mail දැන්වීම
-Name[sk]=E-mailové notifikácie
-Name[sl]=E-poštna obvestila
-Name[sq]=Njoftime E-Mail
-Name[sr]=Обавештења е‑поштом
-Name[sr at ijekavian]=Обавјештења е‑поштом
-Name[sr at ijekavianlatin]=Obavještenja e‑poštom
-Name[sr at latin]=Obaveštenja e‑poštom
-Name[sv]=Underrättelser med e-post
-Name[tr]=E-posta Bildirimleri
-Name[uk]=Сповіщення електронною поштою
-Name[x-test]=xxE-Mail Notificationsxx
-Name[zh_CN]=电子邮件通知
-Name[zh_TW]=電子郵件通知
-Comment=Script to notify you of events via e-mail
-Comment[ar]=سكربت لإخطارك بالأحداث عبر البريد الإلكترونيّ
-Comment[bg]=Скрипт за уведомяване за събития по електронната поща
-Comment[bs]=Skripta koja vas obavještava o dešavanjima putem e-pošte
-Comment[ca]=Script per a notificar els esdeveniments via correu electrònic
-Comment[ca at valencia]=Script per a notificar els esdeveniments via correu electrònic
-Comment[cs]=Skript informující o událostech přes e-mail
-Comment[da]=Script til at give besked om hændelser via e-mail
-Comment[de]=Skript zur Benachrichtigung über Ereignisse per E-Mail
-Comment[el]=Σενάριο για την ειδοποίηση γεγονότων μέσω e-mail
-Comment[en_GB]=Script to notify you of events via e-mail
-Comment[es]=Script para notificarle de eventos a través del correo electrónico
-Comment[et]=Skript sündmustest teavitamiseks e-postitsi
-Comment[fi]=Sähköpostitse tapahtumista tiedottava skripti
-Comment[fr]=Script pour vous avertir d'évènements par courrier électronique
-Comment[ga]=Script a chuireann teagmhais in iúl duit trí ríomhphost
-Comment[gl]=Un script para notificarlle por correo os sucesos.
-Comment[hu]=Értesítés az eseményekről e-mailen keresztül
-Comment[is]=Skrifta til að láta þig vita að uppákomum með tölvupósti
-Comment[it]=Script per notificare gli eventi usando messaggi di posta
-Comment[ja]=イベントをメールで通知するスクリプト
-Comment[kk]=Оқиғалар туралы эл.пошта арқылы құлақтандыру скрипті
-Comment[km]=ស្គ្រីបដើម្បីជូនដំណឹងអ្នកនូវព្រឹត្តិការណ៍តាមរយៈអ៊ីមែល
-Comment[ko]=이메일로 이벤트 알림
-Comment[lt]=Scenarijus informuoti jus apie įvykius per el. paštą
-Comment[lv]=Skripts automātiskai notikumu paziņošnai pa e-pastu
-Comment[nb]=Et skript som sender varslinger per e-post
-Comment[nds]=Skript, dat Di en Nettbreef över Begeefnissen tostüert
-Comment[nl]=Script voor het geven van meldingen van een gebeurtenis via e-mail
-Comment[nn]=Skript som varslar deg om hendingar på e-post
-Comment[pl]=Skrypt do powiadamiania o zdarzeniach przy pomocy e-mail
-Comment[pt]=Um programa para o notificar sobre eventos por e-mail
-Comment[pt_BR]=Script para notificá-lo de eventos através de e-mail
-Comment[ro]=Script ce vă notifică despre evenimente prin poșta electronică
-Comment[ru]=Сценарий для отправки по электронной почте уведомлений о событиях
-Comment[si]=ඔබට අවස්ථා විද්යුත් තැපෑල මඟින් දැන්වීමට විධානාවලිය
-Comment[sk]=Skript na upozornenie udalostí cez e-mail
-Comment[sl]=Skript, ki vas o dogodkih obvešča po e-pošti
-Comment[sq]=Skript që ju njofton për ngjarjet me anë të e-mailit
-Comment[sr]=Скрипта која вас обавештава о дешавањима путем е‑поште
-Comment[sr at ijekavian]=Скрипта која вас обавјештава о дешавањима путем е‑поште
-Comment[sr at ijekavianlatin]=Skripta koja vas obavještava o dešavanjima putem e‑pošte
-Comment[sr at latin]=Skripta koja vas obaveštava o dešavanjima putem e‑pošte
-Comment[sv]=Skript för att underrätta dig om händelser via e-post
-Comment[tr]=Olaylar hakkında sizi e-posta ile bilgilendiren bir betik
-Comment[uk]=Скрипт для вашого сповіщення про події електронною поштою
-Comment[x-test]=xxScript to notify you of events via e-mailxx
-Comment[zh_CN]=将事件通过电子邮件通知您的脚本
-Comment[zh_TW]=透過電子郵件通知您事件的文稿
-Type=KTorrentScript
-Icon=mail-send
-X-KTorrent-Script-Author=Joris Guisson
-X-KTorrent-Script-Email=joris.guisson at gmail.com
-X-KTorrent-Script-Website=http://kde.org/applications/internet/ktorrent/
-X-KTorrent-Script-License=GPL
-X-KTorrent-Script-File=email_notifications.py
-
diff --git a/plugins/scripting/scripts/email_notifications/email_notifications.py b/plugins/scripting/scripts/email_notifications/email_notifications.py
deleted file mode 100644
index ad1c4e19..00000000
--- a/plugins/scripting/scripts/email_notifications/email_notifications.py
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/env kf5kross
-# -*- coding: utf-8 -*-
-import KTorrent
-import KTScriptingPlugin
-import Kross
-
-import smtplib
-from email.MIMEMultipart import MIMEMultipart
-from email.MIMEBase import MIMEBase
-from email.MIMEText import MIMEText
-from email import Encoders
-import os
-import socket
-
-t = Kross.module("kdetranslation")
-
-class EMailNotifier:
- def __init__(self):
- self.mail_user = "your_email at gmail.com"
- self.mail_pwd = "your_password"
- self.mail_server = "smtp.gmail.com"
- self.mail_port = 587
- self.mail_dest = "your_email at gmail.com"
- self.mail_add_cc = False
- self.mail_cc = ""
- self.mail_add_bcc = False
- self.mail_bcc = ""
- self.mail_use_tls = True
- KTorrent.connect("torrentAdded(const QString &)",self.torrentAdded)
- tors = KTorrent.torrents()
- # bind to signals for each torrent
- for t in tors:
- self.torrentAdded(t)
-
- def mail(self,subject, text):
- msg = MIMEMultipart()
-
- msg['From'] = self.mail_user
- msg['To'] = self.mail_dest
- msg['Subject'] = subject
- if self.mail_add_cc:
- msg['CC'] = self.mail_cc
- if self.mail_add_bcc:
- msg['BCC'] = self.mail_bcc
-
- msg.attach(MIMEText(text))
- KTorrent.log("Sending mail : " + subject)
-
- try:
- mailServer = smtplib.SMTP(self.mail_server, self.mail_port)
- mailServer.ehlo()
- if self.mail_use_tls:
- mailServer.starttls()
- mailServer.ehlo()
-
- mailServer.login(self.mail_user, self.mail_pwd)
- mailServer.sendmail(self.mail_user, self.mail_dest, msg.as_string())
- mailServer.quit()
- except smtplib.SMTPRecipientsRefused:
- KTorrent.log("Failed to send e-mail notification: recipients refushed")
- except smtplib.SMTPHeloError:
- KTorrent.log("Failed to send e-mail notification: helo error")
- except smtplib.SMTPSenderRefused:
- KTorrent.log("Failed to send e-mail notification: sender refused")
- except smtplib.SMTPDataError:
- KTorrent.log("Failed to send e-mail notification: something went wrong sending data")
- except smtplib.SMTPAuthenticationError:
- KTorrent.log("Failed to send e-mail notification: authentication failed")
- except smtplib.SMTPException:
- KTorrent.log("Failed to send e-mail notification")
- except socket.error, err:
- KTorrent.log("Failed to send e-mail notification: %s " % err)
- except:
- KTorrent.log("Failed to send e-mail notification")
- else:
- KTorrent.log("Successfully sent e-mail notification")
-
- def save(self):
- KTScriptingPlugin.writeConfigEntry("EMailNotificationsScript","username",self.mail_user)
- KTScriptingPlugin.writeConfigEntry("EMailNotificationsScript","password",self.mail_pwd)
- KTScriptingPlugin.writeConfigEntry("EMailNotificationsScript","server",self.mail_server)
- KTScriptingPlugin.writeConfigEntryInt("EMailNotificationsScript","port",self.mail_port)
- KTScriptingPlugin.writeConfigEntry("EMailNotificationsScript","dest",self.mail_dest)
- KTScriptingPlugin.writeConfigEntryBool("EMailNotificationsScript","add_cc",self.mail_add_cc)
- KTScriptingPlugin.writeConfigEntry("EMailNotificationsScript","cc",self.mail_cc)
- KTScriptingPlugin.writeConfigEntryBool("EMailNotificationsScript","add_bcc",self.mail_add_bcc)
- KTScriptingPlugin.writeConfigEntry("EMailNotificationsScript","bcc",self.mail_bcc)
- KTScriptingPlugin.writeConfigEntryBool("EMailNotificationsScript","use_tls",self.mail_use_tls)
- KTScriptingPlugin.syncConfig("EMailNotificationsScript")
-
- def load(self):
- self.mail_user = KTScriptingPlugin.readConfigEntry("EMailNotificationsScript","username",self.mail_user)
- self.mail_pwd = KTScriptingPlugin.readConfigEntry("EMailNotificationsScript","password",self.mail_pwd)
- self.mail_server = KTScriptingPlugin.readConfigEntry("EMailNotificationsScript","server",self.mail_server)
- self.mail_port = KTScriptingPlugin.readConfigEntryInt("EMailNotificationsScript","port",self.mail_port)
- self.mail_dest = KTScriptingPlugin.readConfigEntry("EMailNotificationsScript","dest",self.mail_dest)
- self.mail_add_cc = KTScriptingPlugin.readConfigEntryBool("EMailNotificationsScript","add_cc",self.mail_add_cc)
- self.mail_cc = KTScriptingPlugin.readConfigEntry("EMailNotificationsScript","cc",self.mail_cc)
- self.mail_add_bcc = KTScriptingPlugin.readConfigEntryBool("EMailNotificationsScript","add_bcc",self.mail_add_bcc)
- self.mail_bcc = KTScriptingPlugin.readConfigEntry("EMailNotificationsScript","bcc",self.mail_bcc)
- self.mail_use_tls = KTScriptingPlugin.readConfigEntryBool("EMailNotificationsScript","use_tls",self.mail_use_tls)
-
- def configure(self):
- forms = Kross.module("forms")
- dialog = forms.createDialog(t.i18n("E-Mail Script Settings"))
- dialog.setButtons("Ok|Cancel")
- page = page = dialog.addPage(t.i18n("E-Mail Settings"),t.i18n("E-Mail Settings"),"mail-send")
- widget = forms.createWidgetFromUIFile(page,KTScriptingPlugin.scriptDir("email_notifications") + "emailconfig.ui")
- widget["username"].text = self.mail_user
- widget["password"].text = self.mail_pwd
- widget["server"].text = self.mail_server
- widget["port"].value = self.mail_port
- widget["to"].text = self.mail_dest
- widget["cc"].text = self.mail_cc
- widget["bcc"].text = self.mail_bcc
- widget["add_cc"].checked = self.mail_add_cc
- widget["add_bcc"].checked = self.mail_add_bcc
- widget["cc"].enabled = self.mail_add_cc
- widget["bcc"].enabled = self.mail_add_bcc
- widget["tls"].checked = self.mail_use_tls
- if dialog.exec_loop():
- # update settings
- self.mail_user = widget["username"].text
- self.mail_pwd = widget["password"].text
- self.mail_server = widget["server"].text
- self.mail_port = widget["port"].value
- self.mail_dest = widget["to"].text
- self.mail_cc = widget["cc"].text
- self.mail_bcc = widget["bcc"].text
- self.mail_add_cc = widget["add_cc"].checked
- self.mail_add_bcc = widget["add_bcc"].checked
- self.mail_use_tls = widget["tls"].checked
- self.save()
-
- def torrentFinished(self,tor):
- self.mail("Torrent " + tor.name() + " has finished","The download of the torrent " + tor.name() + " has finished")
-
- def torrentStoppedByError(self,tor,error_message):
- self.mail("Torrent " + tor.name() + " was stopped by an error", "Error: " + error_message)
-
- def seedingAutoStopped(self,tor,reason):
- self.mail("Torrent " + tor.name() + " has finished seeding", "Seeding stopped because " + reason)
-
- def corruptedDataFound(self,tor):
- self.mail("Corrupted data found","KTorrent has found corrupted data in the torrent " + tor.name())
-
-
- def connectSignals(self,tor):
- KTorrent.log("connectSignals " + tor.name())
- tor.connect("finished(QObject* )",self.torrentFinished)
- tor.connect("stoppedByError(QObject* ,const QString & )",self.torrentStoppedByError)
- tor.connect("seedingAutoStopped(QObject* ,const QString & )",self.seedingAutoStopped)
- tor.connect("corruptedDataFound(QObject* )",self.corruptedDataFound)
-
- def torrentAdded(self,ih):
- tor = KTorrent.torrent(ih)
- self.connectSignals(tor)
-
- # load settings
-notifier = EMailNotifier()
-notifier.load()
-
-def configure():
- global notifier
- notifier.configure()
-
-def unload():
- global notifier
- del notifier
diff --git a/plugins/scripting/scripts/email_notifications/emailconfig.ui b/plugins/scripting/scripts/email_notifications/emailconfig.ui
deleted file mode 100644
index 24faaf8b..00000000
--- a/plugins/scripting/scripts/email_notifications/emailconfig.ui
+++ /dev/null
@@ -1,163 +0,0 @@
-<ui version="4.0" >
- <class>EMailConfigWidget</class>
- <widget class="QWidget" name="EMailConfigWidget" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>511</width>
- <height>319</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>EMail Settings</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <widget class="QGroupBox" name="groupBox" >
- <property name="title" >
- <string>SMTP Server</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>Username:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="username" />
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string>Password:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="password" >
- <property name="echoMode" >
- <enum>QLineEdit::Password</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>SMTP server:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <item>
- <widget class="QLineEdit" name="server" />
- </item>
- <item>
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>Port:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QSpinBox" name="port" >
- <property name="minimum" >
- <number>1</number>
- </property>
- <property name="maximum" >
- <number>65535</number>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="0" colspan="2" >
- <widget class="QCheckBox" name="tls" >
- <property name="text" >
- <string>Use SSL/TLS encryption</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_2" >
- <property name="title" >
- <string>Destination</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2" >
- <item row="0" column="0" >
- <widget class="QLabel" name="label_5" >
- <property name="text" >
- <string>Send mails to:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QLineEdit" name="to" />
- </item>
- <item row="1" column="0" >
- <widget class="QCheckBox" name="add_cc" >
- <property name="text" >
- <string>Add CC:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QLineEdit" name="cc" />
- </item>
- <item row="2" column="0" >
- <widget class="QCheckBox" name="add_bcc" >
- <property name="text" >
- <string>Add BCC:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1" >
- <widget class="QLineEdit" name="bcc" />
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>add_cc</sender>
- <signal>toggled(bool)</signal>
- <receiver>cc</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>45</x>
- <y>220</y>
- </hint>
- <hint type="destinationlabel" >
- <x>187</x>
- <y>219</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>add_bcc</sender>
- <signal>toggled(bool)</signal>
- <receiver>bcc</receiver>
- <slot>setEnabled(bool)</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>93</x>
- <y>253</y>
- </hint>
- <hint type="destinationlabel" >
- <x>152</x>
- <y>258</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
diff --git a/plugins/scripting/scripts/test.py b/plugins/scripting/scripts/test.py
deleted file mode 100644
index 05d81499..00000000
--- a/plugins/scripting/scripts/test.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/python
-import KTorrent
-import Kross
-
-def torrentAdded(ih):
- tor = KTorrent.torrent(ih)
- KTorrent.log("torrentAdded=%s" % tor.name())
-
-def torrentRemoved(ih):
- tor = KTorrent.torrent(ih)
- KTorrent.log("torrentRemoved=%s" % tor.name())
-
-
-KTorrent.connect("torrentAdded(const QString &)",torrentAdded)
-KTorrent.connect("torrentRemoved(const QString &)",torrentRemoved)
-
-tors = KTorrent.torrents()
-
-KTorrent.log("Num torrents : %i" % len(tors))
-for t in tors:
- tor = KTorrent.torrent(t)
- KTorrent.log("Torrent %s = %s" % (t, tor.name()))
- for i in range(0,tor.numFiles()):
- KTorrent.log("File %i = %s" % (i,tor.filePath(i)))
diff --git a/plugins/scripting/scripts/tracker_groups/CMakeLists.txt b/plugins/scripting/scripts/tracker_groups/CMakeLists.txt
deleted file mode 100644
index 27cbe668..00000000
--- a/plugins/scripting/scripts/tracker_groups/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-install(FILES tracker_groups.desktop DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/tracker_groups)
-install(FILES tracker_groups.py DESTINATION ${DATA_INSTALL_DIR}/ktorrent/scripts/tracker_groups)
diff --git a/plugins/scripting/scripts/tracker_groups/tracker_groups.desktop b/plugins/scripting/scripts/tracker_groups/tracker_groups.desktop
deleted file mode 100644
index d79fb27e..00000000
--- a/plugins/scripting/scripts/tracker_groups/tracker_groups.desktop
+++ /dev/null
@@ -1,102 +0,0 @@
-[Desktop Entry]
-Name=Tracker Grouping
-Name[bg]=Групиране по сървъри
-Name[bs]=Grupisanje pratilaca
-Name[ca]=Agrupa els seguidors
-Name[ca at valencia]=Agrupa els seguidors
-Name[cs]=Seskupování trackerů
-Name[da]=Tracker-gruppering
-Name[de]=Tracker-Gruppierung
-Name[el]=Ομαδοποίηση ανιχνευτών
-Name[en_GB]=Tracker Grouping
-Name[es]=Agrupación de localizadores
-Name[et]=Tracker'ite rühmitamine
-Name[fi]=Seurantapalvelimien ryhmittely
-Name[fr]=Groupement de traqueurs
-Name[ga]=Grúpáil Lorgaire
-Name[gl]=Agrupamento por localizador
-Name[hne]=ट्रेकल समूह
-Name[hu]=Követőcsoportosítás
-Name[is]=Hópun skrásetjara (trackers)
-Name[it]=Raggruppamento server traccia
-Name[ja]=トラッカーによるグループ
-Name[kk]=Трекер бойынша топтастыру
-Name[km]=ការដាក់កម្មវិធីតាមដានជាក្រុម
-Name[ko]=트래커로 묶기
-Name[lt]=Vedlių grupavimas
-Name[lv]=Trakeru grupēšana
-Name[nb]=Sporergruppering
-Name[nds]=Tracker-Koppeln
-Name[nl]=Tracker-groepering
-Name[nn]=Sporargruppering
-Name[pl]=Grupowanie trackerów
-Name[pt]=Agrupamento de Localizadores
-Name[pt_BR]=Agrupamento de rastreadores
-Name[ro]=Grupare Tracker
-Name[ru]=Категоризация по трекерам
-Name[si]=හඹායෑම් සමූහනය
-Name[sk]=Zoskupovanie trackerov
-Name[sl]=Združevanje sledilnikov
-Name[sq]=Grupim i Gjurmuesve
-Name[sr]=Груписање пратилаца
-Name[sr at ijekavian]=Груписање пратилаца
-Name[sr at ijekavianlatin]=Grupisanje pratilaca
-Name[sr at latin]=Grupisanje pratilaca
-Name[sv]=Gruppering av spårare
-Name[tr]=İzleyici Gruplandırması
-Name[uk]=Групування координаторів
-Name[x-test]=xxTracker Groupingxx
-Name[zh_CN]=Tracker 分组
-Name[zh_TW]=追蹤器分組
-Comment=Script to create automatic groups based upon tracker URLs
-Comment[bg]=Скрипт за автоматично групиране според адресите на следящите сървъри
-Comment[bs]=Skripta za pravljenje automatskih grupa na osnovu URL‑ova pratilaca
-Comment[ca]=Script per a crear grups automàtics basats en els URL dels seguidors
-Comment[ca at valencia]=Script per a crear grups automàtics basats en els URL dels seguidors
-Comment[cs]=Skript pro automatické vytvoření skupin podle URL adres trackerů
-Comment[da]=Script til at oprette grupper automatisk baseret på tracker-URL'er
-Comment[de]=Skript zum automatischen Gruppieren anhand der Tracker-Adressen
-Comment[el]=Σενάριο αυτόματης ομαδοποίησης ανιχνευτών με βάση τα URL τους
-Comment[en_GB]=Script to create automatic groups based upon tracker URLs
-Comment[es]=Script para crear grupos automáticos basándose en los URL de los rastreadores
-Comment[et]=Skript automaatsete rühmade loomiseks tracker'ite URL-ide järgi
-Comment[fi]=Skripti, joka luo automaattisesti ryhmiä seurantapalvelinten osoitteiden perusteella
-Comment[fr]=Script pour créer des groupes automatiques en fonction des URL des traqueurs
-Comment[ga]=Script a chruthaíonn grúpaí go huathoibríoch bunaithe ar URLanna na lorgairí
-Comment[gl]=Un script para crear grupos automaticamente baseados no URL dos localizadores.
-Comment[hu]=Parancsfájl a követők URL-címén alapuló csoportok automatikus létrehozására
-Comment[it]=Script per creare automaticamente gruppi in base agli URL dei server traccia
-Comment[kk]=Трекер URL бойынша автоматы түрде топтастыру скрипті
-Comment[km]=ស្គ្រីបដើម្បីបង្កើតក្រុមដោយស្វ័យប្រវត្តិ ដែលមានមូលដ្ឋានលើ URL របស់កម្មវិធីតាមដាន
-Comment[ko]=트래커 URL을 기반으로 자동으로 그룹 생성
-Comment[lt]=Scenarijus sukurti automatines grupes paremtas seklio URL
-Comment[nb]=Et skript som lager grupper automatisk basert på URL'ene til sporere
-Comment[nds]=Skript, dat ut de Tracker-URLs automaatsch Koppeln opstellt
-Comment[nl]=Script voor het automatisch aanmaken van groepen gebaseerd op tracker-URL's
-Comment[nn]=Skript som lagar automatiske grupper basert på nettadressene til sporarar
-Comment[pl]=Skrypt do automatycznego tworzenia grup na podstawie adresów URL trackera
-Comment[pt]=Um programa para criar grupos automáticos com base nos URL's do localizador
-Comment[pt_BR]=Script para criar grupos automaticamente, baseado nas URLs dos rastreadores
-Comment[ro]=Script pentru crearea grupurilor automate pe baza URL-urilor tracker-ului
-Comment[ru]=Сценарий для автоматического организации торрентов в группы на основе адресов трекеров, к которым они привязаны
-Comment[si]=හඹායන්නාගේ URL පදනම්කරගෙන ස්වයංක්රීයව සමූහයන් තැනීමට විධානාවලිය
-Comment[sk]=Skript na vytvorenie automatických skupín založených na URL trackerov
-Comment[sl]=Skript, ki glede na URL sledilnika samodejno ustvari skupino
-Comment[sr]=Скрипта за прављење група на основу УРЛ‑ова пратилаца
-Comment[sr at ijekavian]=Скрипта за прављење група на основу УРЛ‑ова пратилаца
-Comment[sr at ijekavianlatin]=Skripta za pravljenje grupa na osnovu URL‑ova pratilaca
-Comment[sr at latin]=Skripta za pravljenje grupa na osnovu URL‑ova pratilaca
-Comment[sv]=Skript för att skapa automatiska grupper baserat på spårarnas webbadresser
-Comment[tr]=İzleyici adreslerini temel alarak otomatik gruplar oluşturan bir betik
-Comment[uk]=Скрипт для створення автоматичних груп за адресами координаторів
-Comment[x-test]=xxScript to create automatic groups based upon tracker URLsxx
-Comment[zh_CN]=基于 tracker URL 创建自动分组的脚本
-Comment[zh_TW]=依追蹤器的網址自動建立群組的文稿
-Type=KTorrentScript
-Icon=network-server
-X-KTorrent-Script-Author=Joris Guisson
-X-KTorrent-Script-Email=joris.guisson at gmail.com
-X-KTorrent-Script-Website=http://kde.org/applications/internet/ktorrent/
-X-KTorrent-Script-License=GPL
-X-KTorrent-Script-File=tracker_groups.py
-
diff --git a/plugins/scripting/scripts/tracker_groups/tracker_groups.py b/plugins/scripting/scripts/tracker_groups/tracker_groups.py
deleted file mode 100644
index e0080608..00000000
--- a/plugins/scripting/scripts/tracker_groups/tracker_groups.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/env kf5kross
-# -*- coding: utf-8 -*-
-import KTorrent
-import KTScriptingPlugin
-import Kross
-from urlparse import urlparse
-
-t = Kross.module("kdetranslation")
-
-def fqdn(tracker):
- netloc = urlparse(tracker).netloc
- if ':' in netloc:
- netloc = netloc[:netloc.find(':')]
- return netloc
-
-class TrackerGroup:
- def __init__(self,url):
- self.url = url
- self.ref_count = 0
- self.cache = {}
-
- def isMember(self,info_hash):
- if info_hash in self.cache:
- return self.cache[info_hash]
- else:
- tor = KTorrent.torrent(info_hash)
- ret = self.url in [fqdn(tracker) for tracker in tor.trackers()]
- self.cache[info_hash] = ret
- return ret
-
-
- def ref(self):
- self.ref_count += 1
-
- def unref(self):
- if self.ref_count > 0:
- self.ref_count -= 1
-
- def canBeRemoved(self):
- return self.ref_count == 0
-
-
-class TrackerGroupsScript:
- def __init__(self):
- self.tracker_map = {} # initialize the dictionary
- self.id = 0
- KTorrent.connect("torrentAdded(const QString &)",self.torrentAdded)
- KTorrent.connect("torrentRemoved(const QString &)",self.torrentRemoved)
- tors = KTorrent.torrents()
- # go over each torrent and collect all the trackers
- for t in tors:
- self.torrentAdded(t)
-
- def addTracker(self,tracker):
- g = TrackerGroup(tracker)
- g.ref()
- self.tracker_map[tracker] = g
- KTorrent.log("Adding group for tracker " + tracker)
- KTScriptingPlugin.addGroup(tracker,"network-server","/all/" + t.i18n("Trackers") + "/" + str(self.id),g)
- self.id += 1
-
- def removeTracker(self,tracker):
- g = self.tracker_map[fqdn(tracker)]
- g.unref()
- if g.canBeRemoved():
- KTorrent.log("Removing group for tracker " + tracker)
- KTScriptingPlugin.removeGroup(g.url)
- del self.tracker_map[tracker]
-
- def torrentAdded(self,info_hash):
- tor = KTorrent.torrent(info_hash)
- trackers = tor.trackers()
- for tracker in trackers:
- hostname = fqdn(tracker)
- if not hostname in self.tracker_map:
- self.addTracker(hostname)
- else:
- self.tracker_map[hostname].ref()
-
- def torrentRemoved(self,info_hash):
- tor = KTorrent.torrent(info_hash)
- trackers = tor.trackers()
- for tracker in trackers:
- if tracker in self.tracker_map:
- self.removeTracker(tracker)
-
- def unload(self):
- trackers = self.tracker_map.keys()
- for tracker in trackers:
- g = self.tracker_map[tracker]
- KTorrent.log("Removing group for tracker " + tracker)
- KTScriptingPlugin.removeGroup(g.url)
- del self.tracker_map[tracker]
-
-s = TrackerGroupsScript()
-
-# Called when script is unloaded
-def unload():
- global s
- s.unload()
- del s
More information about the kde-doc-english
mailing list