diff --git a/dialer/CMakeLists.txt b/dialer/CMakeLists.txt index 0481b8f8..c4a392e1 100644 --- a/dialer/CMakeLists.txt +++ b/dialer/CMakeLists.txt @@ -5,4 +5,3 @@ install(FILES package/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAM include_directories(${TELEPATHY_QT5_INCLUDE_DIR}) add_subdirectory(src) -add_subdirectory(plugin) diff --git a/dialer/plugin/CMakeLists.txt b/dialer/plugin/CMakeLists.txt deleted file mode 100644 index ca42c8a6..00000000 --- a/dialer/plugin/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -set(tpcallerplugin_SRCS - tp-call-plugin.cpp - tp-caller.cpp - ) - -add_library(tpcallerplugin SHARED ${tpcallerplugin_SRCS}) -target_link_libraries(tpcallerplugin Qt5::Core - Qt5::Qml - ${TELEPATHY_QT5_LIBRARIES}) - -install(TARGETS tpcallerplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/tpcaller) - -install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/plasma/private/tpcaller) diff --git a/dialer/plugin/qmldir b/dialer/plugin/qmldir deleted file mode 100644 index 75464047..00000000 --- a/dialer/plugin/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module org.kde.plasma.private.tpcaller - -plugin tpcallerplugin diff --git a/dialer/plugin/tp-call-plugin.cpp b/dialer/plugin/tp-call-plugin.cpp deleted file mode 100644 index 20cb2be3..00000000 --- a/dialer/plugin/tp-call-plugin.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2015 Martin Klapetek - - 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 Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "tp-call-plugin.h" -#include "tp-caller.h" - -#include - -void TpCallPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.tpcaller")); - - qmlRegisterType(uri, 1, 0, "TpCaller"); -} - diff --git a/dialer/plugin/tp-call-plugin.h b/dialer/plugin/tp-call-plugin.h deleted file mode 100644 index cc42dcab..00000000 --- a/dialer/plugin/tp-call-plugin.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Copyright (C) 2015 Martin Klapetek - - 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 Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - -#ifndef TPCALLPLUGIN_H -#define TPCALLPLUGIN_H - -#include - -class QQmlEngine; -class TpCallPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri); -}; - -#endif // TPCALLPLUGIN_H diff --git a/dialer/plugin/tp-caller.cpp b/dialer/plugin/tp-caller.cpp deleted file mode 100644 index ae3e7782..00000000 --- a/dialer/plugin/tp-caller.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (C) 2015 Martin Klapetek - - 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 Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "tp-caller.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -TpCaller::TpCaller(QObject *parent) - : QObject(parent) -{ - Tp::registerTypes(); - Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(), Tp::Features() << Tp::Connection::FeatureConnected); - - Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus()); - Tp::Features textFeatures = Tp::Features() << Tp::TextChannel::FeatureMessageQueue - << Tp::TextChannel::FeatureMessageSentSignal - << Tp::TextChannel::FeatureChatState - << Tp::TextChannel::FeatureMessageCapabilities; - - channelFactory->addCommonFeatures(Tp::Channel::FeatureCore); - channelFactory->addFeaturesForTextChats(textFeatures); - - m_simAccount = Tp::Account::create(TP_QT_ACCOUNT_MANAGER_BUS_NAME, QStringLiteral("/org/freedesktop/Telepathy/Account/ofono/ofono/account0"), connectionFactory, channelFactory); - Tp::PendingReady *op = m_simAccount->becomeReady(Tp::Features() << Tp::Account::FeatureCore); - - connect(op, &Tp::PendingOperation::finished, [=](){ - if (op->isError()) { - qWarning() << "SIM card account failed to get ready:" << op->errorMessage(); - } else { - qDebug() << "SIM Account ready to use"; - } - }); -} - -void TpCaller::dial(const QString &number) -{ - // FIXME: this should be replaced by kpeople thing - auto pendingContact = m_simAccount->connection()->contactManager()->contactsForIdentifiers(QStringList() << number); - - connect(pendingContact, &Tp::PendingOperation::finished, [=](){ - if (pendingContact->contacts().size() < 1) { - qWarning() << " no contacts"; - return; - } - qDebug() << "Starting call..."; - Tp::PendingChannel *pendingChannel = m_simAccount->ensureAndHandleAudioCall(pendingContact->contacts().first()); - connect(pendingChannel, &Tp::PendingChannel::finished, [=](){ - if (pendingChannel->isError()) { - qWarning() << "Error when requesting channel" << pendingChannel->errorMessage(); - return; - } - - m_callChannel = Tp::CallChannelPtr(qobject_cast(pendingChannel->channel().data())); - connect(m_callChannel.data(), &Tp::Channel::invalidated, this, &TpCaller::callInProgressChanged); - connect(m_callChannel.data(), &Tp::CallChannel::callStateChanged, this, &TpCaller::callInProgressChanged); - Q_EMIT callInProgressChanged(); - }); - }); -} - -bool TpCaller::callInProgress() -{ - return m_callChannel && m_callChannel->isValid(); -} - -void TpCaller::hangUp() -{ - if (m_callChannel && m_callChannel->isValid() && m_callChannel->connection()) { - qDebug() << "Hanging up"; - Tp::PendingOperation *op = m_callChannel->hangup(); - connect(op, &Tp::PendingOperation::finished, [=]() { - if (op->isError()) { - qWarning() << "Unable to hang up:" << op->errorMessage(); - } - m_callChannel->requestClose(); - }); - } -} diff --git a/dialer/plugin/tp-caller.h b/dialer/plugin/tp-caller.h deleted file mode 100644 index 86eab294..00000000 --- a/dialer/plugin/tp-caller.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2015 Martin Klapetek - - 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 Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef TPCALLER_H -#define TPCALLER_H - -#include -#include -#include - -class TpCaller : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool callInProgress READ callInProgress NOTIFY callInProgressChanged); - -public: - TpCaller(QObject *parent = 0); - Q_INVOKABLE void dial(const QString &number); - Q_INVOKABLE void hangUp(); - - bool callInProgress(); - -Q_SIGNALS: - void callInProgressChanged(); - -private: - Tp::AccountPtr m_simAccount; - Tp::CallChannelPtr m_callChannel; -}; - -#endif // TPCALLER_H -