[ring-kde/next] /: cleanup: Remove the hook subsystem
Emmanuel Lepage Vallee
null at kde.org
Fri Jun 9 06:53:07 UTC 2017
Git commit e4ae37bfe80ca4a57b018913fe73f109d041c82c by Emmanuel Lepage Vallee.
Committed on 08/06/2017 at 02:50.
Pushed by lepagevalleeemmanuel into branch 'next'.
cleanup: Remove the hook subsystem
Honestly, I am not even sure what's the use case for this. Someone
once paid for it and had a weird custom SIP server. I guess if
someone really, really want to do this, the Python API is the
place to do it.
It allowed (if it worked, I am not even capable of testing it) to
run commands and open apps on some MIME payload in the second part
of SIP packets.
M +1 -27 doc/advanced-use.docbook
M +0 -2 src/CMakeLists.txt
M +1 -16 src/conf/configurationdialog.cpp
M +0 -3 src/conf/configurationdialog.h
D +0 -77 src/conf/dlghooks.cpp
D +0 -59 src/conf/dlghooks.h
D +0 -296 src/conf/dlghooksbase.ui
M +0 -18 src/klib/ring-kde.kcfg
https://commits.kde.org/ring-kde/e4ae37bfe80ca4a57b018913fe73f109d041c82c
diff --git a/doc/advanced-use.docbook b/doc/advanced-use.docbook
index ccb8e282..b2e131a5 100644
--- a/doc/advanced-use.docbook
+++ b/doc/advanced-use.docbook
@@ -16,32 +16,6 @@
<title>Advanced use of &ring-kde;</title>
- <sect1 id="advanced-use-hooks">
- <title>Hooks</title>
-
- <para>
- An interesting feature of &Ring; is the hook handle. Hooks designate some actions you can choose to trigger on a particular signal, especially when receiving or sending a call. The two useful hooks that are implemented in &Ring; are the URL argument, and the phone number formatting.
- </para>
-
- <sect2 id="advanced-use-hooks-url">
- <title>URL argument</title>
- <para>
- This feature permits you to grab an URL sent in a particular header of the SIP or IAX message sent by Asterisk server, and execute it with the chosen browser command.
- </para>
- <para>
- To configure it, go to the <guilabel>Hooks</guilabel> page of the configuration menu. Then check the SIP or/and IAX checkbox, if you want to enable hooks with SIP accounts or/and with IAX accounts. Then type the name of custom header that your Asterisk server inserts into the invite message for the SIP protocol (if you do not know the name of the custom header, ask the one who configured the Asterisk server). For IAX there is a common header for that, so you do not have to configure it. Then type the command of the browser you want to have the URL opened with, or leave x-www-browser for the default browser.
- </para>
- </sect2>
-
- <sect2 id="advanced-use-hooks-formatting">
- <title>Phone number formattings</title>
- <para>
- This feature permits you to add the chosen prefix at the beginning of the phone number you are calling.
- </para>
- </sect2>
-
- </sect1>
-
<sect1 id="advanced-use-macro">
<title>Macros</title>
<para>
@@ -81,4 +55,4 @@
-</chapter>
\ No newline at end of file
+</chapter>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a634e409..4edea2cf 100755
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -210,7 +210,6 @@ SET(
conf/dlgdisplay.cpp
conf/dlgaudio.cpp
conf/dlgaddressbook.cpp
- conf/dlghooks.cpp
conf/dlgaccessibility.cpp
conf/dlgpresence.cpp
configurator/localhistoryconfigurator.cpp
@@ -310,7 +309,6 @@ SET(
conf/dlgdisplaybase.ui
conf/dlgaudiobase.ui
conf/dlgaddressbookbase.ui
- conf/dlghooksbase.ui
conf/dlgaccessibility.ui
conf/dlgaudiorecording.ui
conf/dlgpresence.ui
diff --git a/src/conf/configurationdialog.cpp b/src/conf/configurationdialog.cpp
index 01429233..e69c781e 100644
--- a/src/conf/configurationdialog.cpp
+++ b/src/conf/configurationdialog.cpp
@@ -31,7 +31,6 @@
#include "account/dlgaccount.h"
#include "dlgaudio.h"
#include "dlgaddressbook.h"
-#include "dlghooks.h"
#include "dlgaccessibility.h"
#include "dlgvideo.h"
#include "dlgpresence.h"
@@ -86,7 +85,7 @@ void PlaceHolderWidget::display(KPageWidgetItem *current)
///Constructor
ConfigurationDialog::ConfigurationDialog(View *parent)
:KConfigDialog(parent, QStringLiteral("settings"), ConfigurationSkeleton::self()),dlgVideo(nullptr),dlgDisplay(nullptr)
- ,dlgAudio(nullptr),dlgAddressBook(nullptr),dlgHooks(nullptr),dlgAccessibility(nullptr),dlgAccount(nullptr),
+ ,dlgAudio(nullptr),dlgAddressBook(nullptr),dlgAccessibility(nullptr),dlgAccount(nullptr),
dlgPresence(nullptr)
{
setWindowIcon( QIcon(":/appicon/icons/sc-apps-ring-kde.svgz") );
@@ -143,15 +142,6 @@ ConfigurationDialog::ConfigurationDialog(View *parent)
addPage( dlgHolder[ConfigurationDialog::Page::AddressBook] , i18n("Personal data") , QStringLiteral("x-office-address-book") )
->setProperty("id",ConfigurationDialog::Page::AddressBook);
- //Hooks
- dlgHolder[ConfigurationDialog::Page::Hooks] = new PlaceHolderWidget(Page::Hooks,this,[](ConfigurationDialog* dialog)->QWidget*{
- dialog->dlgHooks = new DlgHooks(dialog);
- dialog->m_pManager->addWidget(dialog->dlgHooks);
- return dialog->dlgHooks;
- });
- addPage( dlgHolder[ConfigurationDialog::Page::Hooks] , i18n("Hooks") , QStringLiteral("insert-link") )
- ->setProperty("id",ConfigurationDialog::Page::Hooks);
-
//Accessibility
dlgHolder[ConfigurationDialog::Page::Accessibility]= new PlaceHolderWidget(Page::Accessibility,this,[](ConfigurationDialog* dialog)->QWidget*{
dialog->dlgAccessibility = new DlgAccessibility (dialog);
@@ -193,7 +183,6 @@ ConfigurationDialog::ConfigurationDialog(View *parent)
connect(buttonBox()->button(QDialogButtonBox::Cancel), &QAbstractButton::clicked, this, &ConfigurationDialog::cancelSettings );
connect(dlgAccount, &DlgAccount::updateButtons,this,&ConfigurationDialog::updateButtons);
- connect(dlgHooks , &DlgHooks::updateButtons ,this,&ConfigurationDialog::updateButtons);
if (dlgPresence)
connect(dlgPresence, &DlgPresence::updateButtons ,this,&ConfigurationDialog::updateButtons);
@@ -208,7 +197,6 @@ ConfigurationDialog::~ConfigurationDialog()
if (dlgAccount ) delete dlgAccount ;
if (dlgAudio ) delete dlgAudio ;
if (dlgAddressBook ) delete dlgAddressBook ;
- if (dlgHooks ) delete dlgHooks ;
if (dlgAccessibility) delete dlgAccessibility;
if (dlgPresence ) delete dlgPresence ;
#ifdef ENABLE_VIDEO
@@ -225,7 +213,6 @@ void ConfigurationDialog::updateWidgets()
GUARD(dlgAddressBook,updateWidgets ());
GUARD(dlgAccessibility,updateWidgets());
GUARD(dlgPresence,updateWidgets ());
- GUARD(dlgHooks,updateWidgets ());
#ifdef ENABLE_VIDEO
GUARD(dlgVideo,updateWidgets ());
#endif
@@ -240,7 +227,6 @@ void ConfigurationDialog::updateSettings()
GUARD(dlgAccessibility,updateSettings());
GUARD(dlgDisplay,updateSettings ());
GUARD(dlgPresence,updateSettings ());
- GUARD(dlgHooks,updateSettings ());
#ifdef ENABLE_VIDEO
GUARD(dlgVideo,updateSettings ());
#endif
@@ -260,7 +246,6 @@ bool ConfigurationDialog::hasChanged()
|| (GUARD_FALSE(dlgDisplay,hasChanged() ))
|| (GUARD_FALSE(dlgAddressBook,hasChanged() ))
|| (GUARD_FALSE(dlgAccessibility,hasChanged() ))
- || (GUARD_FALSE(dlgHooks,hasChanged() ))
#ifdef ENABLE_VIDEO
|| (GUARD_FALSE(dlgVideo,hasChanged() ))
#endif
diff --git a/src/conf/configurationdialog.h b/src/conf/configurationdialog.h
index 86ed1217..13208fc0 100644
--- a/src/conf/configurationdialog.h
+++ b/src/conf/configurationdialog.h
@@ -33,7 +33,6 @@ class DlgDisplay;
class DlgAccount;
class DlgAudio;
class DlgAddressBook;
-class DlgHooks;
class DlgAccessibility;
class DlgVideo;
class View;
@@ -63,7 +62,6 @@ private:
Accounts,
Audio,
AddressBook,
- Hooks,
Accessibility,
Video,
Presence,
@@ -74,7 +72,6 @@ private:
DlgAccount* dlgAccount ;
DlgAudio* dlgAudio ;
DlgAddressBook* dlgAddressBook ;
- DlgHooks* dlgHooks ;
DlgAccessibility* dlgAccessibility;
DlgVideo* dlgVideo ;
DlgPresence* dlgPresence ;
diff --git a/src/conf/dlghooks.cpp b/src/conf/dlghooks.cpp
deleted file mode 100644
index b99d9c64..00000000
--- a/src/conf/dlghooks.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
- * Copyright (C) 2009-2015 by Savoir-Faire Linux *
- * Author : Jérémy Quentin <jeremy.quentin at savoirfairelinux.com> *
- * Emmanuel Lepage Vallee <elv1313 at gmail.com> *
- * *
- * This library is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * This library is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
-#include "dlghooks.h"
-
-#include <hookmanager.h>
-
-///Constructor
-DlgHooks::DlgHooks(QWidget *parent)
- : QWidget(parent),m_Changed(false)
-{
- setupUi(this);
- updateWidgets();
-}
-
-///Destructor
-DlgHooks::~DlgHooks()
-{
-}
-
-void DlgHooks::updateWidgets()
-{
- kcfg_enableHooksSIP->blockSignals(true);
- kcfg_hooksCommand->blockSignals(true);
- kcfg_prepend->blockSignals(true);
- kcfg_hooksSIPHeader->blockSignals(true);
- kcfg_addPrefix->blockSignals(true);
- kcfg_enableHooksSIP ->setChecked(HookManager::instance().isSipEnabled ());
- kcfg_hooksCommand ->setText (HookManager::instance().command ());
- kcfg_prepend ->setText (HookManager::instance().prefix ());
- kcfg_hooksSIPHeader ->setText (HookManager::instance().sipFeild ());
- kcfg_addPrefix ->setChecked(HookManager::instance().isContactMethodEnabled());
- kcfg_enableHooksSIP->blockSignals(false);
- kcfg_hooksCommand->blockSignals(false);
- kcfg_prepend->blockSignals(false);
- kcfg_hooksSIPHeader->blockSignals(false);
- kcfg_addPrefix->blockSignals(false);
-}
-
-void DlgHooks::updateSettings()
-{
- HookManager::instance().setSipEnabled (kcfg_enableHooksSIP ->isChecked());
- HookManager::instance().setCommand (kcfg_hooksCommand ->text ());
- HookManager::instance().setPrefix (kcfg_prepend ->text ());
- HookManager::instance().setSipFeild (kcfg_hooksSIPHeader ->text ());
- HookManager::instance().setContactMethodEnabled(kcfg_addPrefix ->isChecked());
- m_Changed = false;
- emit updateButtons();
-}
-
-void DlgHooks::setChanged()
-{
- m_Changed = true;
- emit updateButtons();
-}
-
-bool DlgHooks::hasChanged()
-{
- return m_Changed;
-}
-
-// kate: space-indent on; indent-width 3; replace-tabs on;
diff --git a/src/conf/dlghooks.h b/src/conf/dlghooks.h
deleted file mode 100644
index bcec5fc0..00000000
--- a/src/conf/dlghooks.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
- * Copyright (C) 2009-2015 by Savoir-Faire Linux *
- * Author : Jérémy Quentin <jeremy.quentin at savoirfairelinux.com> *
- * Emmanuel Lepage Vallee <elv1313 at gmail.com> *
- * *
- * This library is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 2.1 of the License, or (at your option) any later version. *
- * *
- * This library is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
- ***************************************************************************/
-
-#ifndef DLGHOOKS_H
-#define DLGHOOKS_H
-
-#include <QtWidgets/QWidget>
-
-#include "ui_dlghooksbase.h"
-
-/**
- @author Jérémy Quentin <jeremy.quentin at gmail.com>
-*/
-class DlgHooks : public QWidget, public Ui_DlgHooksBase
-{
-Q_OBJECT
-public:
- //Constructor
- explicit DlgHooks(QWidget *parent = nullptr);
-
- //Destructor
- virtual ~DlgHooks();
-
- bool hasChanged();
-
-private:
- bool m_Changed;
-
-public Q_SLOTS:
- void updateWidgets();
- void updateSettings();
-
-private Q_SLOTS:
- void setChanged();
-
-Q_SIGNALS:
- void updateButtons();
-
-};
-
-#endif
-
-// kate: space-indent on; indent-width 3; replace-tabs on;
diff --git a/src/conf/dlghooksbase.ui b/src/conf/dlghooksbase.ui
deleted file mode 100644
index 4f204f05..00000000
--- a/src/conf/dlghooksbase.ui
+++ /dev/null
@@ -1,296 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>DlgHooksBase</class>
- <widget class="QWidget" name="DlgHooksBase">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>520</width>
- <height>407</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string notr="true">Hook settings</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout">
- <item>
- <widget class="QGroupBox" name="groupBox_urlArgument">
- <property name="title">
- <string>URL Argument</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_12">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Custom commands on incoming calls with URL</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QWidget" name="widget_protocols" native="true">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <layout class="QHBoxLayout" name="horizontalLayout_8">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>4</number>
- </property>
- <property name="rightMargin">
- <number>4</number>
- </property>
- <property name="bottomMargin">
- <number>4</number>
- </property>
- <item>
- <widget class="QCheckBox" name="kcfg_enableHooksSIP">
- <property name="text">
- <string>Trigger on specific SIP header</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="kcfg_hooksSIPHeader">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="kcfg_enableHooksIAX">
- <property name="text">
- <string>Trigger on IAX2 URL</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QWidget" name="widget_urlArgumentForm" native="true">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>4</number>
- </property>
- <property name="rightMargin">
- <number>4</number>
- </property>
- <property name="bottomMargin">
- <number>4</number>
- </property>
- <item>
- <widget class="QLabel" name="label_command">
- <property name="text">
- <string>Command to run</string>
- </property>
- <property name="buddy">
- <cstring>kcfg_hooksCommand</cstring>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="kcfg_hooksCommand">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>%s will be replaced with the passed URL.</string>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QGroupBox" name="groupBox_phoneNumberFormatting">
- <property name="title">
- <string>Phone Number Rewriting</string>
- </property>
- <layout class="QVBoxLayout" name="verticalLayout_13">
- <item>
- <widget class="QWidget" name="widget_phoneNumberFormattingForm" native="true">
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>4</number>
- </property>
- <property name="rightMargin">
- <number>4</number>
- </property>
- <property name="bottomMargin">
- <number>4</number>
- </property>
- <item>
- <widget class="QCheckBox" name="kcfg_addPrefix">
- <property name="text">
- <string>Prefix dialed numbers with</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="kcfg_prepend">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <spacer name="verticalSpacer_configHooks">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>499</width>
- <height>96</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>kcfg_enableHooksSIP</sender>
- <signal>toggled(bool)</signal>
- <receiver>DlgHooksBase</receiver>
- <slot>setChanged()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>60</x>
- <y>65</y>
- </hint>
- <hint type="destinationlabel">
- <x>-1</x>
- <y>33</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>kcfg_enableHooksIAX</sender>
- <signal>toggled(bool)</signal>
- <receiver>DlgHooksBase</receiver>
- <slot>setChanged()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>40</x>
- <y>96</y>
- </hint>
- <hint type="destinationlabel">
- <x>-2</x>
- <y>100</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>kcfg_addPrefix</sender>
- <signal>toggled(bool)</signal>
- <receiver>DlgHooksBase</receiver>
- <slot>setChanged()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>215</y>
- </hint>
- <hint type="destinationlabel">
- <x>0</x>
- <y>213</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>kcfg_hooksCommand</sender>
- <signal>textEdited(QString)</signal>
- <receiver>DlgHooksBase</receiver>
- <slot>setChanged()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>500</x>
- <y>126</y>
- </hint>
- <hint type="destinationlabel">
- <x>519</x>
- <y>123</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>kcfg_hooksSIPHeader</sender>
- <signal>textEdited(QString)</signal>
- <receiver>DlgHooksBase</receiver>
- <slot>setChanged()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>473</x>
- <y>76</y>
- </hint>
- <hint type="destinationlabel">
- <x>518</x>
- <y>68</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>kcfg_prepend</sender>
- <signal>textEdited(QString)</signal>
- <receiver>DlgHooksBase</receiver>
- <slot>setChanged()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>469</x>
- <y>225</y>
- </hint>
- <hint type="destinationlabel">
- <x>522</x>
- <y>220</y>
- </hint>
- </hints>
- </connection>
- </connections>
- <slots>
- <slot>setChanged()</slot>
- </slots>
-</ui>
diff --git a/src/klib/ring-kde.kcfg b/src/klib/ring-kde.kcfg
index 4c086bbe..7202abcf 100644
--- a/src/klib/ring-kde.kcfg
+++ b/src/klib/ring-kde.kcfg
@@ -252,24 +252,6 @@
<label>List of bookmarked clients</label>
</entry>
- <!-- Hooks Settings -->
-
-<!-- <entry name="enableHooksSIP" type="Bool">
- <label>Defines whether to enable hooks for SIP accounts.</label>
- </entry>
- <entry name="hooksSIPHeader" type="String">
- <label>Defines which header to catch for SIP accounts hooks.</label>
- </entry>
- <entry name="hooksCommand" type="String">
- <label>Defines which command to execute.</label>
- </entry>
- <entry name="addPrefix" type="Bool">
- <label>Defines whether to add a prefix for outgoing calls.</label>
- </entry>
- <entry name="prepend" type="String">
- <label>Defines the prefix to add.</label>
- </entry>-->
-
<!-- Accessibility Settings -->
<entry name="enableVoiceFeedback" type="Bool">
<label>Enable audio feedback from common actions</label>
More information about the kde-doc-english
mailing list