mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
dialer: remove from repository
This has been split into separate repository at : https://invent.kde.org/kde/plasma-dialer/
This commit is contained in:
parent
8f7db8a915
commit
6107e39f49
29 changed files with 1 additions and 2594 deletions
|
|
@ -27,9 +27,8 @@ include(FeatureSummary)
|
|||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Gui Widgets Qml Quick Test Sql)
|
||||
|
||||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma Service Declarative I18n KIO People)
|
||||
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Plasma Service Declarative I18n KIO)
|
||||
find_package(KF5 REQUIRED COMPONENTS PlasmaQuick DBusAddons Notifications)
|
||||
find_package(TelepathyQt5 REQUIRED)
|
||||
find_package(KF5Wayland CONFIG)
|
||||
set_package_properties(KF5Wayland PROPERTIES
|
||||
TYPE REQUIRED
|
||||
|
|
@ -54,7 +53,6 @@ install( DIRECTORY qtvirtualkeyboardplugin/ DESTINATION ${KDE_INSTALL_QMLDIR}/Qt
|
|||
add_subdirectory(bin)
|
||||
add_subdirectory(applets)
|
||||
add_subdirectory(containments)
|
||||
add_subdirectory(dialer)
|
||||
add_subdirectory(sounds)
|
||||
#add_subdirectory(touchscreentest)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
install(FILES metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.phone.dialer.desktop)
|
||||
install(FILES dialer.svg DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps/)
|
||||
|
||||
include_directories(${TELEPATHY_QT5_INCLUDE_DIR})
|
||||
#
|
||||
|
||||
add_subdirectory(src)
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="48" height="48" version="1.1" viewBox="0 0 12.7 12.7" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<linearGradient id="linearGradient4886">
|
||||
<stop stop-color="#34495e" offset="0"/>
|
||||
<stop stop-color="#2980b9" stop-opacity=".23451327" offset="1"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient3861" x1="24" x2="24" y1="294" y2="257" gradientTransform="matrix(.26458333 0 0 .25828372 0 -64.293749)" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#1d99f3" offset="0"/>
|
||||
<stop stop-color="#3daee9" offset="1"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient4824" x1="8.7066565" x2="57.365421" y1="10.199831" y2="58.858597" gradientTransform="scale(.26458333)" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#fcfcfc" offset="0"/>
|
||||
<stop stop-color="#fff" stop-opacity=".36725664" offset="1"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient4832" x1="7.5606313" x2="30.16894" y1="1.7317699" y2="24.340078" gradientTransform="scale(.26458334)" gradientUnits="userSpaceOnUse" xlink:href="#linearGradient4886"/>
|
||||
<linearGradient id="linearGradient4865" x1="96.583733" x2="148.57768" y1="106.90627" y2="158.90022" gradientTransform="scale(.26458333)" gradientUnits="userSpaceOnUse" xlink:href="#linearGradient4886"/>
|
||||
</defs>
|
||||
<metadata>
|
||||
<rdf:RDF>
|
||||
<cc:Work rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||
<dc:title/>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g stroke-width=".26458332">
|
||||
<rect x="1.0583333" y="1.0583333" width="10.583333" height="10.583333" ry="1.8520839" fill="#2980b9" style="paint-order:markers fill stroke"/>
|
||||
<rect x="1.0583333" y="1.0583333" width="10.583333" height="10.318749" ry="1.8079867" fill="url(#linearGradient3861)" style="paint-order:markers fill stroke"/>
|
||||
<path transform="scale(.26458333)" d="m39.535156 33.705078c1.427335 1.425988 0 2.853516 0 2.853516l-2.234375 2.234375c-2.193735 2.193736-9.802268 0.002382-13.466797-3.66211l7.869141 7.869141h5.462891c3.172977 0 5.819572-2.144357 6.595703-5.066406l-4.226563-4.228516z" fill="url(#linearGradient4865)" opacity=".48200001" style="paint-order:normal"/>
|
||||
</g>
|
||||
<path d="m5.273159 3.7310126c0.3776498 0.3776493 0 0.754871 0 0.754871l-0.1886837 0.1886836c-0.3135807 0.3135807-0.3135804 0.8189314 0 1.1325116l0.7803024 0.7803022 0.1155344 0.1155346 0.7803024 0.7803019c0.3135803 0.313581 0.8189311 0.313581 1.1325113 0l0.1886841-0.1886834s0.3769342-0.3773105 0.7544606-2.8e-4l1.4e-4 -1.4e-4z" fill="url(#linearGradient4832)" opacity=".48200001" stroke-width=".07000434"/>
|
||||
<rect x="1.8551151" y="6.0670886" width=".15750976" height=".017501084" ry=".0087505421" fill="#fdbc4b" stroke-width=".26458332" style="paint-order:normal"/>
|
||||
<path d="m3.6497222 2.1075024c-0.3772926-0.377649-0.7548832 0-0.7548832 0l-0.5912028 0.5912029c-0.5804255 0.5804254-8.202e-4 2.5933061 0.968741 3.5628791l1.4591056 1.4591059 0.1155338 0.1155335 1.4591056 1.4591056c0.969573 0.9695726 2.9824537 1.5491666 3.5628791 0.9687416l0.5912027-0.5912032s0.377649-0.3775908 0-0.7548835l-1.6234631-1.6234632c-0.3776488-0.3776493-0.7548833 0-0.7548833 0l-0.1887209 0.1887207c-0.3135807 0.3135807-0.8189375 0.3135807-1.132518 3e-7l-0.7803105-0.7803102-0.1155335-0.1155335-0.7803102-0.7803105c-0.3135804-0.3135802-0.3135807-0.8189375 0-1.1325183l0.1887207-0.1887206s0.3776498-0.377234 0-0.7548833z" fill="url(#linearGradient4824)" stroke-width=".26458332"/>
|
||||
<flowRoot fill="#000000" font-family="sans-serif" font-size="10.583334px" letter-spacing="0px" stroke-width=".26458335" word-spacing="0px" style="line-height:1.25" xml:space="preserve"><flowRegion><rect x="-215.52615" y="-106.53525" width="190.08208" height="166.50893" stroke-width=".07000434"/></flowRegion><flowPara/></flowRoot>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.9 KiB |
|
|
@ -1,69 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Comment=Plasma phone dialer
|
||||
Comment[ca]=Marcador del telèfon del Plasma
|
||||
Comment[ca@valencia]=Marcador del telèfon del Plasma
|
||||
Comment[da]=Opkaldstastatur til telefon
|
||||
Comment[en_GB]=Plasma phone dialer
|
||||
Comment[es]=Marcador del teléfono Plasma
|
||||
Comment[et]=Plasma kõnevalija
|
||||
Comment[eu]=Plasma telefonoko markatzailea
|
||||
Comment[fi]=Plasman numerovalitsin
|
||||
Comment[fr]=Centre d'appel Plasma du téléphone
|
||||
Comment[gl]=Marcador de números de teléfono de Plasma.
|
||||
Comment[hu]=Plasma tárcsázó
|
||||
Comment[id]=Pendial ponsel Plasma
|
||||
Comment[it]=Combinatore telefonico di Plasma
|
||||
Comment[ko]=Plasma 전화 다이얼
|
||||
Comment[lt]=Plasma telefono numerio rinkiklis
|
||||
Comment[nl]=Telefoonkiezer van Plasma
|
||||
Comment[nn]=Telefonringjar for Plasma
|
||||
Comment[pl]=Pole wybierania telefonu
|
||||
Comment[pt]=Teclado do Plasma
|
||||
Comment[pt_BR]=Discador do telefone Plasma
|
||||
Comment[ru]=Номеронабиратель Plasma для телефона
|
||||
Comment[sk]=Plasma vytáčanie telefónu
|
||||
Comment[sv]=Plasma telefonuppringning
|
||||
Comment[tr]=Plasma telefon çevirici
|
||||
Comment[uk]=Засіб набирання номеру Плазми
|
||||
Comment[x-test]=xxPlasma phone dialerxx
|
||||
Comment[zh_CN]=Plasma 手机拨号器
|
||||
Comment[zh_TW]=Plasma 手機撥號程式
|
||||
Encoding=UTF-8
|
||||
Keywords=
|
||||
Name=Phone
|
||||
Name[ca]=Telèfon
|
||||
Name[ca@valencia]=Telèfon
|
||||
Name[cs]=Telefon
|
||||
Name[da]=Telefon
|
||||
Name[de]=Telefon
|
||||
Name[en_GB]=Phone
|
||||
Name[es]=Teléfono
|
||||
Name[et]=Telefon
|
||||
Name[eu]=Telefonoa
|
||||
Name[fi]=Phone
|
||||
Name[fr]=Téléphone
|
||||
Name[gl]=Teléfono
|
||||
Name[hu]=Telefon
|
||||
Name[ia]=Telephono
|
||||
Name[id]=Ponsel
|
||||
Name[it]=Telefono
|
||||
Name[ko]=전화
|
||||
Name[lt]=Telefonas
|
||||
Name[nl]=Telefoon
|
||||
Name[nn]=Telefon
|
||||
Name[pl]=Telefon
|
||||
Name[pt]=Telefone
|
||||
Name[pt_BR]=Telefone
|
||||
Name[ru]=Телефон
|
||||
Name[sk]=Telefón
|
||||
Name[sv]=Telefon
|
||||
Name[tr]=Telefon
|
||||
Name[uk]=Телефон
|
||||
Name[x-test]=xxPhonexx
|
||||
Name[zh_CN]=手机
|
||||
Name[zh_TW]=電話
|
||||
Type=Application
|
||||
Icon=dialer
|
||||
Exec=plasmaphonedialer %u
|
||||
|
||||
MimeType=x-scheme-handler/tel
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
set(plasmaphonedialer_SRCS
|
||||
main.cpp
|
||||
dialerutils.cpp
|
||||
call-handler.cpp
|
||||
callhistorymodel.cpp
|
||||
call-manager.cpp
|
||||
resources.qrc
|
||||
)
|
||||
add_executable(plasmaphonedialer ${plasmaphonedialer_SRCS})
|
||||
target_compile_definitions(plasmaphonedialer PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}")
|
||||
|
||||
find_package(PhoneNumber COMPONENTS PhoneNumber REQUIRED)
|
||||
|
||||
target_link_libraries(plasmaphonedialer
|
||||
PhoneNumber::PhoneNumber
|
||||
Qt5::Gui
|
||||
Qt5::Quick
|
||||
Qt5::Widgets
|
||||
Qt5::Sql
|
||||
KF5::Declarative
|
||||
KF5::I18n
|
||||
KF5::QuickAddons
|
||||
KF5::DBusAddons
|
||||
KF5::Notifications
|
||||
${TELEPATHY_QT5_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS plasmaphonedialer ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
install(FILES plasma_dialer.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFY5RCDIR})
|
||||
|
||||
configure_file(org.freedesktop.Telepathy.Client.Plasma.Dialer.service.in
|
||||
org.freedesktop.Telepathy.Client.Plasma.Dialer.service)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.Plasma.Dialer.service
|
||||
DESTINATION ${DBUS_SERVICES_INSTALL_DIR})
|
||||
|
||||
install(FILES Plasma.Dialer.client DESTINATION ${SHARE_INSTALL_PREFIX}/telepathy/clients/)
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
[org.freedesktop.Telepathy.Client]
|
||||
Interfaces=org.freedesktop.Telepathy.Client.Handler
|
||||
|
||||
[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0]
|
||||
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.Call1
|
||||
org.freedesktop.Telepathy.Channel.TargetHandleType u=1
|
||||
|
||||
[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 1]
|
||||
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.Call1
|
||||
org.freedesktop.Telepathy.Channel.TargetHandleType u=1
|
||||
org.freedesktop.Telepathy.Channel.Type.Call1.InitialAudio b=true
|
||||
|
||||
[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 2]
|
||||
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.Call1
|
||||
org.freedesktop.Telepathy.Channel.TargetHandleType u=1
|
||||
org.freedesktop.Telepathy.Channel.Type.Call1.InitialVideo b=true
|
||||
|
||||
[org.freedesktop.Telepathy.Client.Handler]
|
||||
BypassApproval=true
|
||||
|
||||
[org.freedesktop.Telepathy.Client.Handler.Capabilities]
|
||||
org.freedesktop.Telepathy.Channel.Type.Call1/audio=true
|
||||
org.freedesktop.Telepathy.Channel.Type.Call1/video=false
|
||||
org.freedesktop.Telepathy.Channel.Type.Call1/ice=true
|
||||
org.freedesktop.Telepathy.Channel.Type.Call1/gtalk-p2p=false
|
||||
org.freedesktop.Telepathy.Channel.Type.Call1/shm=true
|
||||
org.freedesktop.Telepathy.Channel.Type.Call1/video/h264=false
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2009-2012 George Kiagiadakis <kiagiadakis.george@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 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 "call-handler.h"
|
||||
#include "call-manager.h"
|
||||
#include "dialerutils.h"
|
||||
|
||||
#include <TelepathyQt/CallChannel>
|
||||
#include <TelepathyQt/ChannelClassSpec>
|
||||
|
||||
static inline Tp::ChannelClassSpecList channelClassSpecList()
|
||||
{
|
||||
return Tp::ChannelClassSpecList() << Tp::ChannelClassSpec::audioCall();
|
||||
}
|
||||
|
||||
static inline Tp::AbstractClientHandler::Capabilities capabilities()
|
||||
{
|
||||
Tp::AbstractClientHandler::Capabilities caps;
|
||||
|
||||
//we support both audio and video in calls
|
||||
caps.setToken(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String("/audio"));
|
||||
|
||||
//transport methods - farstream supports them all
|
||||
caps.setToken(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String("/ice"));
|
||||
caps.setToken(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String("/gtalk-p2p"));
|
||||
caps.setToken(TP_QT_IFACE_CHANNEL_TYPE_CALL + QLatin1String("/shm"));
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
CallHandler::CallHandler(DialerUtils *utils)
|
||||
: Tp::AbstractClientHandler(channelClassSpecList(), capabilities())
|
||||
{
|
||||
m_dialerUtils = utils;
|
||||
m_dialerUtils->setCallState("idle");
|
||||
qDebug() << "Call handler ready";
|
||||
}
|
||||
|
||||
CallHandler::~CallHandler()
|
||||
= default;
|
||||
|
||||
bool CallHandler::bypassApproval() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CallHandler::handleChannels(const Tp::MethodInvocationContextPtr<> & context,
|
||||
const Tp::AccountPtr & account,
|
||||
const Tp::ConnectionPtr & connection,
|
||||
const QList<Tp::ChannelPtr> & channels,
|
||||
const QList<Tp::ChannelRequestPtr> & requestsSatisfied,
|
||||
const QDateTime & userActionTime,
|
||||
const Tp::AbstractClientHandler::HandlerInfo & handlerInfo)
|
||||
{
|
||||
Q_UNUSED(account);
|
||||
Q_UNUSED(connection);
|
||||
Q_UNUSED(requestsSatisfied);
|
||||
Q_UNUSED(userActionTime);
|
||||
Q_UNUSED(handlerInfo);
|
||||
|
||||
Q_FOREACH(const Tp::ChannelPtr & channel, channels) {
|
||||
Tp::CallChannelPtr callChannel = Tp::CallChannelPtr::qObjectCast(channel);
|
||||
if (!callChannel) {
|
||||
qDebug() << "Channel is not a Call channel. Ignoring";
|
||||
continue;
|
||||
}
|
||||
//check if any call manager is already handling this channel
|
||||
if (!handledCallChannels.contains(callChannel)) {
|
||||
handledCallChannels.append(callChannel);
|
||||
new CallManager(callChannel, m_dialerUtils, this);
|
||||
}
|
||||
}
|
||||
|
||||
context->setFinished();
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2009 George Kiagiadakis <kiagiadakis.george@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 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 CALL_HANDLER_H
|
||||
#define CALL_HANDLER_H
|
||||
|
||||
#include <TelepathyQt/AbstractClientHandler>
|
||||
|
||||
class DialerUtils;
|
||||
|
||||
class CallHandler : public QObject, public Tp::AbstractClientHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CallHandler(DialerUtils *utils);
|
||||
~CallHandler() override;
|
||||
|
||||
bool bypassApproval() const override;
|
||||
void handleChannels(const Tp::MethodInvocationContextPtr<> & context,
|
||||
const Tp::AccountPtr & account,
|
||||
const Tp::ConnectionPtr & connection,
|
||||
const QList<Tp::ChannelPtr> & channels,
|
||||
const QList<Tp::ChannelRequestPtr> & requestsSatisfied,
|
||||
const QDateTime & userActionTime,
|
||||
const Tp::AbstractClientHandler::HandlerInfo & handlerInfo) override;
|
||||
private:
|
||||
QList<Tp::CallChannelPtr> handledCallChannels;
|
||||
DialerUtils *m_dialerUtils;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,272 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2012 George Kiagiadakis <kiagiadakis.george@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 Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "call-manager.h"
|
||||
#include "dialerutils.h"
|
||||
#include <QTimer>
|
||||
|
||||
#include <KNotification>
|
||||
#include <KLocalizedString>
|
||||
// #include "call-window.h"
|
||||
// #include "approver.h"
|
||||
// #include "../libktpcall/call-channel-handler.h"
|
||||
// #include "ktp_call_ui_debug.h"
|
||||
|
||||
// #include <KTp/telepathy-handler-application.h>
|
||||
|
||||
struct CallManager::Private
|
||||
{
|
||||
Tp::CallChannelPtr callChannel;
|
||||
// CallChannelHandler *channelHandler;
|
||||
// QPointer<CallWindow> callWindow;
|
||||
// QPointer<Approver> approver;
|
||||
DialerUtils *dialerUtils;
|
||||
KNotification *ringingNotification;
|
||||
KNotification *callsNotification;
|
||||
uint missedCalls;
|
||||
QTimer *callTimer;
|
||||
};
|
||||
|
||||
CallManager::CallManager(const Tp::CallChannelPtr &callChannel, DialerUtils *dialerUtils, QObject *parent)
|
||||
: QObject(parent), d(new Private)
|
||||
{
|
||||
// KTp::TelepathyHandlerApplication::newJob();
|
||||
|
||||
d->dialerUtils = dialerUtils;
|
||||
d->callChannel = callChannel;
|
||||
connect(callChannel.data(), &Tp::CallChannel::callStateChanged,
|
||||
this, &CallManager::onCallStateChanged);
|
||||
|
||||
connect(d->dialerUtils, &DialerUtils::acceptCall, this, &CallManager::onCallAccepted);
|
||||
connect(d->dialerUtils, &DialerUtils::rejectCall, this, &CallManager::onCallRejected);
|
||||
connect(d->dialerUtils, &DialerUtils::hangUp, this, &CallManager::onHangUpRequested);
|
||||
connect(d->callChannel.data(), &Tp::CallChannel::invalidated, this, [=]() {
|
||||
qDebug() << "Channel invalidated";
|
||||
d->dialerUtils->setCallState("idle");
|
||||
d->dialerUtils->emitCallEnded();
|
||||
deleteLater();
|
||||
});
|
||||
|
||||
d->ringingNotification = nullptr;
|
||||
d->callsNotification = nullptr;
|
||||
d->callTimer = nullptr;
|
||||
|
||||
//create the channel handler
|
||||
// d->channelHandler = new CallChannelHandler(callChannel, this);
|
||||
|
||||
//delete the CallManager when the channel has closed
|
||||
//and the farstream side has safely shut down.
|
||||
//NOTE this MUST be used with Qt::QueuedConnection because of
|
||||
// https://bugreports.qt-project.org/browse/QTBUG-24571
|
||||
// connect(d->channelHandler, SIGNAL(channelClosed()),
|
||||
// this, SLOT(deleteLater()), Qt::QueuedConnection);
|
||||
|
||||
//bring us up-to-date with the current call state
|
||||
onCallStateChanged(d->callChannel->callState());
|
||||
}
|
||||
|
||||
CallManager::~CallManager()
|
||||
{
|
||||
qDebug() << "Deleting CallManager";
|
||||
|
||||
//delete the window just in case CallManager was deleted
|
||||
//before the channel entered CallStateEnded
|
||||
// delete d->callWindow.data();
|
||||
// delete d;
|
||||
|
||||
// KTp::TelepathyHandlerApplication::jobFinished();
|
||||
}
|
||||
|
||||
void CallManager::onCallStateChanged(Tp::CallState state)
|
||||
{
|
||||
qDebug() << "new call state:" << state;
|
||||
|
||||
if (d->callChannel->targetContact()) {
|
||||
d->dialerUtils->setCallContactAlias(d->callChannel->targetContact()->alias());
|
||||
d->dialerUtils->setCallContactNumber(d->callChannel->targetContact()->id());
|
||||
}
|
||||
|
||||
if (d->callChannel->isValid()) {
|
||||
d->dialerUtils->setIsIncomingCall(!d->callChannel->isRequested());
|
||||
}
|
||||
|
||||
switch (state) {
|
||||
case Tp::CallStatePendingInitiator:
|
||||
Q_ASSERT(d->callChannel->isRequested());
|
||||
(void) d->callChannel->accept();
|
||||
break;
|
||||
case Tp::CallStateInitialising:
|
||||
if (d->callChannel->isRequested()) {
|
||||
d->dialerUtils->setCallState("dialing");
|
||||
|
||||
//show status that the call is connecting
|
||||
// ensureCallWindow();
|
||||
// d->callWindow.data()->setStatus(CallWindow::StatusConnecting);
|
||||
} else {
|
||||
qDebug() << "Call is initialising";
|
||||
}
|
||||
break;
|
||||
case Tp::CallStateInitialised:
|
||||
if (d->callChannel->isRequested()) {
|
||||
d->dialerUtils->setCallState("dialing");
|
||||
//show status that the remote end is ringing
|
||||
// ensureCallWindow();
|
||||
// d->callWindow.data()->setStatus(CallWindow::StatusRemoteRinging);
|
||||
} else {
|
||||
d->dialerUtils->setCallState("incoming");
|
||||
|
||||
//show approver;
|
||||
(void) d->callChannel->setRinging();
|
||||
if (!d->ringingNotification) {
|
||||
d->ringingNotification = new KNotification("ringing", KNotification::Persistent | KNotification::LoopSound, nullptr);
|
||||
d->ringingNotification->setComponentName("plasma_dialer");
|
||||
}
|
||||
d->ringingNotification->sendEvent();
|
||||
}
|
||||
break;
|
||||
case Tp::CallStateAccepted:
|
||||
if (d->callChannel->isRequested()) {
|
||||
d->dialerUtils->setCallState("answered");
|
||||
//show status that the remote end accepted the call
|
||||
// ensureCallWindow();
|
||||
// d->callWindow.data()->setStatus(CallWindow::StatusRemoteAccepted);
|
||||
} else {
|
||||
//hide approver & show call window
|
||||
if (d->ringingNotification) {
|
||||
d->ringingNotification->close();
|
||||
}
|
||||
// delete d->approver.data();
|
||||
// ensureCallWindow();
|
||||
// d->callWindow.data()->setStatus(CallWindow::StatusConnecting);
|
||||
}
|
||||
break;
|
||||
case Tp::CallStateActive:
|
||||
//normally the approver is already deleted and the call window
|
||||
//already exists at this point, but we just want to be safe
|
||||
//in case the CM decides to do a weird state jump
|
||||
if (!d->callChannel->isRequested()) {
|
||||
// delete d->approver.data();
|
||||
}
|
||||
d->dialerUtils->setCallState("active");
|
||||
d->callTimer = new QTimer(this);
|
||||
connect(d->callTimer, &QTimer::timeout, d->callTimer, [=]() {
|
||||
d->dialerUtils->setCallDuration(d->dialerUtils->callDuration() + 1);
|
||||
});
|
||||
d->callTimer->start(1000);
|
||||
|
||||
// ensureCallWindow();
|
||||
// d->callWindow.data()->setStatus(CallWindow::StatusActive);
|
||||
break;
|
||||
case Tp::CallStateEnded:
|
||||
d->dialerUtils->setCallState("ended");
|
||||
if (d->ringingNotification) {
|
||||
d->ringingNotification->close();
|
||||
}
|
||||
//FIXME this is defined in the spec, but try to find a proper enum value for it
|
||||
if (d->callChannel->callStateReason().reason == 5) {
|
||||
qDebug() << "Adding notification";
|
||||
d->missedCalls++;
|
||||
if (!d->callsNotification) {
|
||||
d->callsNotification = new KNotification("callMissed", KNotification::Persistent, nullptr);
|
||||
}
|
||||
d->callsNotification->setComponentName("plasma_dialer");
|
||||
d->callsNotification->setIconName("call-start");
|
||||
if (d->missedCalls == 1) {
|
||||
d->callsNotification->setTitle(i18n("Missed call from %1", d->callChannel->targetContact()->alias()));
|
||||
d->callsNotification->setText(QTime::currentTime().toString("HH:mm"));
|
||||
} else {
|
||||
d->callsNotification->setTitle(i18n("%1 calls missed", d->missedCalls));
|
||||
d->callsNotification->setText(i18n("Last call: %1", QTime::currentTime().toString("HH:mm")));
|
||||
}
|
||||
|
||||
if (d->missedCalls == 1) {
|
||||
d->callsNotification->sendEvent();
|
||||
} else {
|
||||
d->callsNotification->update();
|
||||
}
|
||||
}
|
||||
|
||||
if (d->callTimer) {
|
||||
d->callTimer->stop();
|
||||
d->callTimer->deleteLater();
|
||||
d->callTimer = nullptr;
|
||||
}
|
||||
//if we requested the call, make sure we have a window to show the error (if any)
|
||||
// if (d->callChannel->isRequested()) {
|
||||
// ensureCallWindow();
|
||||
// }
|
||||
|
||||
// if (d->callWindow) {
|
||||
// Tp::CallStateReason reason = d->callChannel->callStateReason();
|
||||
// d->callWindow.data()->setStatus(CallWindow::StatusDisconnected, reason);
|
||||
//
|
||||
// //kill the call manager when the call window is closed,
|
||||
// //after shutting down the channelHandler
|
||||
// connect(d->callWindow.data(), SIGNAL(destroyed()), d->channelHandler, SLOT(shutdown()));
|
||||
// } else {
|
||||
// //missed the call
|
||||
// qCDebug(KTP_CALL_UI) << "missed call";
|
||||
// delete d->approver.data();
|
||||
// d->channelHandler->shutdown();
|
||||
// }
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
void CallManager::onCallAccepted()
|
||||
{
|
||||
(void) d->callChannel->accept();
|
||||
}
|
||||
|
||||
void CallManager::onCallRejected()
|
||||
{
|
||||
(void) d->callChannel->hangup(Tp::CallStateChangeReasonRejected, TP_QT_ERROR_REJECTED);
|
||||
}
|
||||
|
||||
void CallManager::onHangUpRequested()
|
||||
{
|
||||
if (d->callChannel && d->callChannel->isValid()) {
|
||||
qDebug() << "Hanging up";
|
||||
Tp::PendingOperation *op = d->callChannel->hangup();
|
||||
connect(op, &Tp::PendingOperation::finished, [=]() {
|
||||
if (op->isError()) {
|
||||
qWarning() << "Unable to hang up:" << op->errorMessage();
|
||||
}
|
||||
// d->callChannel->requestClose();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void CallManager::ensureCallWindow()
|
||||
{
|
||||
// if (!d->callWindow) {
|
||||
// d->callWindow = new CallWindow(d->callChannel);
|
||||
// d->callWindow.data()->show();
|
||||
// d->callWindow.data()->setAttribute(Qt::WA_DeleteOnClose);
|
||||
//
|
||||
// connect(d->channelHandler, SIGNAL(contentAdded(CallContentHandler*)),
|
||||
// d->callWindow.data(), SLOT(onContentAdded(CallContentHandler*)));
|
||||
// connect(d->channelHandler, SIGNAL(contentRemoved(CallContentHandler*)),
|
||||
// d->callWindow.data(), SLOT(onContentRemoved(CallContentHandler*)));
|
||||
//
|
||||
// //inform the ui about already existing contents
|
||||
// Q_FOREACH(CallContentHandler *content, d->channelHandler->contents()) {
|
||||
// d->callWindow.data()->onContentAdded(content);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2012 George Kiagiadakis <kiagiadakis.george@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 Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CALL_MANAGER_H
|
||||
#define CALL_MANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <TelepathyQt/CallChannel>
|
||||
|
||||
class DialerUtils;
|
||||
|
||||
class CallManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CallManager(const Tp::CallChannelPtr &callChannel, DialerUtils *dialerUtils, QObject *parent = nullptr);
|
||||
~CallManager() override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onCallStateChanged(Tp::CallState state);
|
||||
void onCallAccepted();
|
||||
void onCallRejected();
|
||||
void onHangUpRequested();
|
||||
|
||||
private:
|
||||
void ensureCallWindow();
|
||||
|
||||
private:
|
||||
struct Private;
|
||||
Private *const d;
|
||||
};
|
||||
|
||||
#endif // CALL_MANAGER_H
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2019 Nicolas Fella <nicolas.fella@gmx.de>
|
||||
|
||||
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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "callhistorymodel.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QStandardPaths>
|
||||
#include <QSqlQuery>
|
||||
#include <QSqlError>
|
||||
#include <QDebug>
|
||||
|
||||
CallHistoryModel::CallHistoryModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
, m_db(QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), QStringLiteral("calldb")))
|
||||
{
|
||||
m_db.setDatabaseName(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "plasmaphonedialerdb.sqlite");
|
||||
bool open = m_db.open();
|
||||
|
||||
if (!open) {
|
||||
qWarning() << "Could not open call database" << m_db.lastError();
|
||||
}
|
||||
|
||||
QSqlQuery createTable(m_db);
|
||||
createTable.exec(QStringLiteral("CREATE TABLE IF NOT EXISTS History(id INTEGER PRIMARY KEY AUTOINCREMENT, number TEXT, time DATETIME, duration INTEGER, callType INTEGER)"));
|
||||
|
||||
QSqlQuery fetchCalls(m_db);
|
||||
fetchCalls.exec(QStringLiteral("SELECT id, number, time, duration, callType FROM History"));
|
||||
|
||||
beginResetModel();
|
||||
while (fetchCalls.next()) {
|
||||
CallData call;
|
||||
call.id = fetchCalls.value(0).toString();
|
||||
call.number = fetchCalls.value(1).toString();
|
||||
call.time = QDateTime::fromMSecsSinceEpoch(fetchCalls.value(2).toInt());
|
||||
call.duration = fetchCalls.value(3).toInt();
|
||||
call.callType = fetchCalls.value(4).toInt();
|
||||
|
||||
m_calls.append(call);
|
||||
}
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void CallHistoryModel::addCall(QString number, int duration, int type)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), m_calls.size(), m_calls.size());
|
||||
QSqlQuery putCall(m_db);
|
||||
putCall.prepare(QStringLiteral("INSERT INTO History (number, time, duration, callType) VALUES (:number, :time, :duration, :callType)"));
|
||||
putCall.bindValue(":number", number);
|
||||
putCall.bindValue(":time", QDateTime::currentDateTime().toMSecsSinceEpoch());
|
||||
putCall.bindValue(":duration", duration);
|
||||
putCall.bindValue(":callType", type);
|
||||
putCall.exec();
|
||||
|
||||
CallData data;
|
||||
data.id = putCall.lastInsertId().toString();
|
||||
data.number = number;
|
||||
data.duration = duration;
|
||||
data.time = QDateTime::currentDateTime();
|
||||
data.callType = type;
|
||||
|
||||
m_calls.append(data);
|
||||
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void CallHistoryModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
QSqlQuery clearCalls(m_db);
|
||||
clearCalls.exec(QStringLiteral("DELETE FROM History"));
|
||||
m_calls.clear();
|
||||
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
QVariant CallHistoryModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
int row = index.row();
|
||||
|
||||
switch (role) {
|
||||
case Roles::PhoneNumberRole:
|
||||
return m_calls[row].number;
|
||||
case Roles::CallTypeRole:
|
||||
return m_calls[row].callType;
|
||||
case Roles::DurationRole:
|
||||
return m_calls[row].duration;
|
||||
case Roles::TimeRole:
|
||||
return m_calls[row].time;
|
||||
case Roles::IdRole:
|
||||
return m_calls[row].id;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
int CallHistoryModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent)
|
||||
return m_calls.size();
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> CallHistoryModel::roleNames() const
|
||||
{
|
||||
QHash<int, QByteArray> roleNames;
|
||||
roleNames[PhoneNumberRole] = "number";
|
||||
roleNames[CallTypeRole] = "time";
|
||||
roleNames[DurationRole] = "duration";
|
||||
roleNames[TimeRole] = "callType";
|
||||
roleNames[IdRole] = "dbid";
|
||||
|
||||
return roleNames;
|
||||
}
|
||||
|
||||
bool CallHistoryModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
Q_UNUSED(count)
|
||||
|
||||
beginRemoveRows(parent, row, row);
|
||||
QSqlQuery remove(m_db);
|
||||
remove.prepare(QStringLiteral("DELETE FROM History WHERE id=:id"));
|
||||
remove.bindValue(":id", m_calls[row].id);
|
||||
remove.exec();
|
||||
|
||||
endRemoveRows();
|
||||
return true;
|
||||
}
|
||||
|
||||
void CallHistorySortFilterModel::remove(int index)
|
||||
{
|
||||
QSortFilterProxyModel::removeRow(index);
|
||||
}
|
||||
|
||||
void CallHistorySortFilterModel::sort(int column, Qt::SortOrder order)
|
||||
{
|
||||
QSortFilterProxyModel::sort(column, order);
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2019 Nicolas Fella <nicolas.fella@gmx.de>
|
||||
|
||||
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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QSqlDatabase>
|
||||
#include <QDateTime>
|
||||
#include <QVector>
|
||||
|
||||
struct CallData {
|
||||
QString id;
|
||||
QString number;
|
||||
QDateTime time;
|
||||
int duration;
|
||||
int callType;
|
||||
};
|
||||
|
||||
class CallHistoryModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
CallHistoryModel(QObject *parent = nullptr);
|
||||
|
||||
enum Roles {
|
||||
PhoneNumberRole = Qt::UserRole + 1,
|
||||
DurationRole,
|
||||
TimeRole,
|
||||
CallTypeRole,
|
||||
IdRole
|
||||
};
|
||||
Q_ENUM(Roles)
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QHash<int, QByteArray> roleNames() const override;
|
||||
|
||||
Q_INVOKABLE void addCall(QString number, int duration, int type);
|
||||
Q_INVOKABLE void clear();
|
||||
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
|
||||
|
||||
private:
|
||||
QSqlDatabase m_db;
|
||||
QVector<CallData> m_calls;
|
||||
};
|
||||
|
||||
class CallHistorySortFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_INVOKABLE void remove(int index);
|
||||
Q_INVOKABLE void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
|
||||
};
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* 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 "dialerutils.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <TelepathyQt/PendingOperation>
|
||||
#include <TelepathyQt/PendingChannelRequest>
|
||||
#include <TelepathyQt/PendingReady>
|
||||
#include <TelepathyQt/Constants>
|
||||
#include <TelepathyQt/PendingContacts>
|
||||
#include <TelepathyQt/Types>
|
||||
#include <TelepathyQt/ContactManager>
|
||||
|
||||
#include "phonenumbers/phonenumberutil.h"
|
||||
#include "phonenumbers/asyoutypeformatter.h"
|
||||
|
||||
DialerUtils::DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_missedCalls(0),
|
||||
m_simAccount(simAccount),
|
||||
m_callDuration(0),
|
||||
m_callContactAlias(QString())
|
||||
{
|
||||
if (!m_simAccount) {
|
||||
return;
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
DialerUtils::~DialerUtils()
|
||||
= default;
|
||||
|
||||
void DialerUtils::dial(const QString &number)
|
||||
{
|
||||
// FIXME: this should be replaced by kpeople thing
|
||||
qDebug() << "Starting call...";
|
||||
if (m_simAccount) {
|
||||
Tp::PendingChannelRequest *pendingChannel = m_simAccount->ensureAudioCall(number);
|
||||
connect(pendingChannel, &Tp::PendingChannelRequest::finished, pendingChannel, [=](){
|
||||
if (pendingChannel->isError()) {
|
||||
qWarning() << "Error when requesting channel" << pendingChannel->errorMessage();
|
||||
setCallState("failed");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setCallState("failed");
|
||||
}
|
||||
}
|
||||
|
||||
QString DialerUtils::callState() const
|
||||
{
|
||||
return m_callState;
|
||||
}
|
||||
|
||||
const QString DialerUtils::formatNumber(const QString& number)
|
||||
{
|
||||
using namespace ::i18n::phonenumbers;
|
||||
|
||||
// Get formatter instance
|
||||
QLocale locale;
|
||||
QStringList qcountry = locale.name().split('_');
|
||||
QString countrycode(qcountry.constLast());
|
||||
string country = countrycode.toUtf8().constData();
|
||||
PhoneNumberUtil* util = PhoneNumberUtil::GetInstance();
|
||||
AsYouTypeFormatter* formatter = util->PhoneNumberUtil::GetAsYouTypeFormatter(country);
|
||||
|
||||
// Normalize input
|
||||
string stdnumber = number.toUtf8().constData();
|
||||
util->NormalizeDiallableCharsOnly(&stdnumber);
|
||||
|
||||
// Format
|
||||
string formatted;
|
||||
formatter->Clear();
|
||||
for (char& c : stdnumber) {
|
||||
formatter->InputDigit(c, &formatted);
|
||||
}
|
||||
delete formatter;
|
||||
|
||||
return QString::fromStdString(formatted);
|
||||
}
|
||||
|
||||
void DialerUtils::setCallState(const QString &state)
|
||||
{
|
||||
if (m_callState != state) {
|
||||
m_callState = state;
|
||||
Q_EMIT callStateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
uint DialerUtils::callDuration() const
|
||||
{
|
||||
return m_callDuration;
|
||||
}
|
||||
|
||||
void DialerUtils::setCallDuration(uint duration)
|
||||
{
|
||||
m_callDuration = duration;
|
||||
Q_EMIT callDurationChanged();
|
||||
}
|
||||
|
||||
QString DialerUtils::callContactAlias() const
|
||||
{
|
||||
return m_callContactAlias;
|
||||
}
|
||||
|
||||
void DialerUtils::setCallContactAlias(const QString &contactAlias)
|
||||
{
|
||||
if (m_callContactAlias != contactAlias) {
|
||||
m_callContactAlias = contactAlias;
|
||||
Q_EMIT callContactAliasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QString DialerUtils::callContactNumber() const
|
||||
{
|
||||
return m_callContactNumber;
|
||||
}
|
||||
|
||||
void DialerUtils::setCallContactNumber(const QString &contactNumber)
|
||||
{
|
||||
if (m_callContactNumber != contactNumber) {
|
||||
m_callContactNumber = contactNumber;
|
||||
Q_EMIT callContactNumberChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool DialerUtils::isIncomingCall() const
|
||||
{
|
||||
return m_isIncomingCall;
|
||||
}
|
||||
|
||||
void DialerUtils::setIsIncomingCall(bool isIncomingCall)
|
||||
{
|
||||
if (m_isIncomingCall != isIncomingCall) {
|
||||
m_isIncomingCall = isIncomingCall;
|
||||
Q_EMIT isIncomingCallChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void DialerUtils::emitCallEnded()
|
||||
{
|
||||
qDebug() << "Call ended:" << m_callContactNumber << m_callDuration;
|
||||
Q_EMIT callEnded(m_callContactNumber, m_callDuration, m_isIncomingCall);
|
||||
m_callDuration = 0;
|
||||
m_callContactNumber = QString();
|
||||
m_callContactAlias = QString();
|
||||
}
|
||||
|
||||
void DialerUtils::resetMissedCalls()
|
||||
{
|
||||
m_missedCalls = 0;
|
||||
if (m_callsNotification) {
|
||||
m_callsNotification->close();
|
||||
}
|
||||
m_callsNotification.clear();
|
||||
}
|
||||
|
||||
#include "moc_dialerutils.cpp"
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* 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 DIALERUTILS_H
|
||||
#define DIALERUTILS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
#include <KNotification>
|
||||
|
||||
#include <TelepathyQt/Account>
|
||||
|
||||
class DialerUtils : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString callState READ callState NOTIFY callStateChanged);
|
||||
Q_PROPERTY(uint callDuration READ callDuration NOTIFY callDurationChanged);
|
||||
Q_PROPERTY(QString callContactAlias READ callContactAlias NOTIFY callContactAliasChanged);
|
||||
Q_PROPERTY(QString callContactNumber READ callContactNumber NOTIFY callContactNumberChanged);
|
||||
Q_PROPERTY(bool isIncomingCall READ isIncomingCall NOTIFY isIncomingCallChanged);
|
||||
|
||||
public:
|
||||
|
||||
DialerUtils(const Tp::AccountPtr &simAccount, QObject *parent = nullptr);
|
||||
~DialerUtils() override;
|
||||
|
||||
QString callState() const;
|
||||
void setCallState(const QString &state);
|
||||
|
||||
uint callDuration() const;
|
||||
void setCallDuration(uint duration);
|
||||
|
||||
QString callContactAlias() const;
|
||||
void setCallContactAlias(const QString &contactAlias);
|
||||
|
||||
QString callContactNumber() const;
|
||||
void setCallContactNumber(const QString &contactNumber);
|
||||
|
||||
bool isIncomingCall() const;
|
||||
void setIsIncomingCall(bool isIncomingCall);
|
||||
|
||||
void emitCallEnded();
|
||||
|
||||
Q_INVOKABLE void resetMissedCalls();
|
||||
Q_INVOKABLE void dial(const QString &number);
|
||||
Q_INVOKABLE const QString formatNumber(const QString& number);
|
||||
|
||||
Q_SIGNALS:
|
||||
void missedCallsActionTriggered();
|
||||
void callStateChanged();
|
||||
void callDurationChanged();
|
||||
void callContactAliasChanged();
|
||||
void callContactNumberChanged();
|
||||
void isIncomingCallChanged();
|
||||
void acceptCall();
|
||||
void rejectCall();
|
||||
void hangUp();
|
||||
void callEnded(const QString &callContactNumber, uint callDuration, bool isIncomingCall);
|
||||
|
||||
private:
|
||||
QPointer <KNotification> m_callsNotification;
|
||||
QPointer <KNotification> m_ringingNotification;
|
||||
int m_missedCalls;
|
||||
QString m_callState;
|
||||
Tp::AccountPtr m_simAccount;
|
||||
QString m_callContactNumber;
|
||||
uint m_callDuration;
|
||||
QString m_callContactAlias;
|
||||
bool m_isIncomingCall;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,217 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "dialerutils.h"
|
||||
#include "call-handler.h"
|
||||
#include "callhistorymodel.h"
|
||||
|
||||
#include <TelepathyQt/Types>
|
||||
#include <TelepathyQt/Debug>
|
||||
#include <TelepathyQt/ClientRegistrar>
|
||||
#include <TelepathyQt/CallChannel>
|
||||
#include <TelepathyQt/ChannelClassSpec>
|
||||
#include <TelepathyQt/ChannelFactory>
|
||||
#include <TelepathyQt/Account>
|
||||
#include <TelepathyQt/AccountSet>
|
||||
#include <TelepathyQt/AccountManager>
|
||||
#include <TelepathyQt/PendingReady>
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <KLocalizedContext>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
#include <QtQml>
|
||||
|
||||
#include <QQmlContext>
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickWindow>
|
||||
#include <KDeclarative/QmlObject>
|
||||
#include <KAboutData>
|
||||
#include <KDBusService>
|
||||
|
||||
|
||||
void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
|
||||
{
|
||||
QFile file(QDir::homePath() + "/dialer.log");
|
||||
|
||||
bool opened = file.open(QIODevice::WriteOnly | QIODevice::Append);
|
||||
Q_ASSERT(opened);
|
||||
|
||||
QString strout;
|
||||
QTextStream out(&strout);
|
||||
out << QTime::currentTime().toString("hh:mm:ss.zzz ");
|
||||
out << context.function << ":" << context.line << " ";
|
||||
|
||||
switch (type) {
|
||||
case QtDebugMsg: out << "DBG"; break;
|
||||
case QtInfoMsg: out << "NFO"; break;
|
||||
case QtWarningMsg: out << "WRN"; break;
|
||||
case QtCriticalMsg: out << "CRT"; break;
|
||||
case QtFatalMsg: out << "FTL"; break;
|
||||
}
|
||||
|
||||
out << " " << msg << '\n';
|
||||
|
||||
// Write to log file
|
||||
QTextStream fileout(&file);
|
||||
fileout << strout;
|
||||
out.flush();
|
||||
|
||||
// Write to stdout
|
||||
QTextStream console(stdout);
|
||||
console << strout;
|
||||
console.flush();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
qInstallMessageHandler(myMessageOutput);
|
||||
QCommandLineParser parser;
|
||||
QApplication app(argc, argv);
|
||||
|
||||
const QString description = i18n("Plasma Phone Dialer");
|
||||
const char version[] = PROJECT_VERSION;
|
||||
|
||||
// app.setQuitOnLastWindowClosed(false);
|
||||
app.setApplicationVersion(version);
|
||||
app.setOrganizationDomain("kde.org");
|
||||
|
||||
KDBusService service(KDBusService::Unique);
|
||||
|
||||
parser.addVersionOption();
|
||||
parser.addHelpOption();
|
||||
parser.setApplicationDescription(description);
|
||||
|
||||
QCommandLineOption daemonOption(QStringList() << QStringLiteral("d") <<
|
||||
QStringLiteral("daemon"),
|
||||
i18n("Daemon mode. run without displaying anything."));
|
||||
|
||||
parser.addPositionalArgument("number", i18n("Call the given number"));
|
||||
|
||||
parser.addOption(daemonOption);
|
||||
|
||||
parser.process(app);
|
||||
|
||||
qmlRegisterType<CallHistoryModel>("org.kde.plasma.dialer", 1, 0, "CallHistoryModel");
|
||||
qmlRegisterType<CallHistorySortFilterModel>("org.kde.plasma.dialer", 1, 0, "CallHistorySortFilterModel");
|
||||
|
||||
Tp::registerTypes();
|
||||
|
||||
Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(QDBusConnection::sessionBus(),
|
||||
Tp::Features() << Tp::Account::FeatureCore
|
||||
);
|
||||
|
||||
Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(QDBusConnection::sessionBus(),
|
||||
Tp::Features() << Tp::Connection::FeatureCore
|
||||
<< Tp::Connection::FeatureSelfContact
|
||||
<< Tp::Connection::FeatureConnected
|
||||
);
|
||||
|
||||
Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(QDBusConnection::sessionBus());
|
||||
channelFactory->addCommonFeatures(Tp::Channel::FeatureCore);
|
||||
channelFactory->addFeaturesForCalls(Tp::Features() << Tp::CallChannel::FeatureContents
|
||||
<< Tp::CallChannel::FeatureCallState
|
||||
<< Tp::CallChannel::FeatureCallMembers
|
||||
<< Tp::CallChannel::FeatureLocalHoldState
|
||||
);
|
||||
|
||||
// channelFactory->addFeaturesForTextChats(Tp::Features() << Tp::TextChannel::FeatureMessageQueue
|
||||
// << Tp::TextChannel::FeatureMessageSentSignal
|
||||
// << Tp::TextChannel::FeatureChatState
|
||||
// << Tp::TextChannel::FeatureMessageCapabilities);
|
||||
|
||||
Tp::ContactFactoryPtr contactFactory = Tp::ContactFactory::create(Tp::Features() << Tp::Contact::FeatureAlias
|
||||
<< Tp::Contact::FeatureAvatarData
|
||||
);
|
||||
|
||||
Tp::ClientRegistrarPtr registrar = Tp::ClientRegistrar::create(accountFactory, connectionFactory,
|
||||
channelFactory, contactFactory);
|
||||
QEventLoop loop;
|
||||
Tp::AccountManagerPtr manager = Tp::AccountManager::create();
|
||||
Tp::PendingReady *ready = manager->becomeReady();
|
||||
QObject::connect(ready, &Tp::PendingReady::finished, &loop, &QEventLoop::quit);
|
||||
loop.exec(QEventLoop::ExcludeUserInputEvents);
|
||||
|
||||
Tp::AccountPtr simAccount;
|
||||
const Tp::AccountSetPtr accountSet = manager->validAccounts();
|
||||
for (const Tp::AccountPtr &account : accountSet->accounts()) {
|
||||
static const QStringList supportedProtocols = {
|
||||
QLatin1String("ofono"),
|
||||
QLatin1String("tel"),
|
||||
};
|
||||
if (supportedProtocols.contains(account->protocolName())) {
|
||||
simAccount = account;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (simAccount.isNull()) {
|
||||
qCritical() << "Unable to get SIM account";
|
||||
}
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||
|
||||
auto *dialerUtils = new DialerUtils(simAccount);
|
||||
engine.rootContext()->setContextProperty("dialerUtils", QVariant::fromValue(dialerUtils));
|
||||
engine.rootContext()->setContextProperty("commandlineArguments", parser.positionalArguments());
|
||||
|
||||
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
|
||||
|
||||
Tp::SharedPtr<CallHandler> callHandler(new CallHandler(dialerUtils));
|
||||
registrar->registerClient(Tp::AbstractClientPtr::dynamicCast(callHandler), "Plasma.Dialer");
|
||||
|
||||
KAboutData aboutData("dialer", i18n("Dialer"), "0.9", i18n("Plasma phone dialer"), KAboutLicense::GPL);
|
||||
aboutData.setDesktopFileName("org.kde.phone.dialer");
|
||||
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
|
||||
QWindow *window = qobject_cast<QWindow *>(engine.rootObjects()[0]);
|
||||
|
||||
Q_ASSERT(window);
|
||||
|
||||
QObject::connect(&service, &KDBusService::activateRequested, [=](const QStringList &arguments, const QString &workingDirectory) {
|
||||
Q_UNUSED(workingDirectory);
|
||||
window->show();
|
||||
window->requestActivate();
|
||||
if (arguments.length() > 0) {
|
||||
QString numberArg = arguments[1];
|
||||
if (numberArg.startsWith("tel:")) {
|
||||
numberArg = numberArg.mid(4);
|
||||
}
|
||||
dialerUtils->dial(numberArg);
|
||||
}
|
||||
});
|
||||
if (!parser.isSet(daemonOption)) {
|
||||
window->show();
|
||||
window->requestActivate();
|
||||
}
|
||||
if (!parser.positionalArguments().isEmpty()) {
|
||||
QString numberArg = parser.positionalArguments().first();
|
||||
if (numberArg.startsWith("tel:")) {
|
||||
numberArg = numberArg.mid(4);
|
||||
}
|
||||
qWarning() << "Calling" << numberArg;
|
||||
dialerUtils->dial(numberArg);
|
||||
}
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
[D-BUS Service]
|
||||
Name=org.freedesktop.Telepathy.Client.Plasma.Dialer
|
||||
Exec=@CMAKE_INSTALL_PREFIX@/bin/plasmaphonedialer
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
[Global]
|
||||
IconName=call-start
|
||||
Comment=Phone
|
||||
Comment[ca]=Telèfon
|
||||
Comment[ca@valencia]=Telèfon
|
||||
Comment[cs]=Telefon
|
||||
Comment[da]=Telefon
|
||||
Comment[de]=Telefon
|
||||
Comment[en_GB]=Phone
|
||||
Comment[es]=Teléfono
|
||||
Comment[et]=Telefon
|
||||
Comment[eu]=Telefonoa
|
||||
Comment[fi]=Puhelin
|
||||
Comment[fr]=Téléphone
|
||||
Comment[gl]=Teléfono
|
||||
Comment[hu]=Telefon
|
||||
Comment[ia]=Telephono
|
||||
Comment[id]=Ponsel
|
||||
Comment[it]=Telefono
|
||||
Comment[ko]=전화
|
||||
Comment[lt]=Telefonas
|
||||
Comment[nl]=Telefoon
|
||||
Comment[nn]=Telefon
|
||||
Comment[pl]=Telefon
|
||||
Comment[pt]=Telefone
|
||||
Comment[pt_BR]=Telefone
|
||||
Comment[ru]=Телефон
|
||||
Comment[sk]=Telefón
|
||||
Comment[sv]=Telefon
|
||||
Comment[tr]=Telefon
|
||||
Comment[uk]=Телефон
|
||||
Comment[x-test]=xxPhonexx
|
||||
Comment[zh_CN]=手机
|
||||
Comment[zh_TW]=電話
|
||||
|
||||
[Event/callMissed]
|
||||
Name=Missed Call
|
||||
Name[ca]=Trucada perduda
|
||||
Name[ca@valencia]=Trucada perduda
|
||||
Name[cs]=Zmeškaný hovor
|
||||
Name[da]=Ubesvaret opkald
|
||||
Name[de]=Verpasster Anruf
|
||||
Name[en_GB]=Missed Call
|
||||
Name[es]=Llamada perdida
|
||||
Name[et]=Vastamata kõne
|
||||
Name[eu]=Dei galdua
|
||||
Name[fi]=Vastaamaton puhelu
|
||||
Name[fr]=Appel manqué
|
||||
Name[gl]=Chamada perdida
|
||||
Name[hu]=Nem fogadott hívás
|
||||
Name[ia]=Appello perdite
|
||||
Name[id]=Miskol
|
||||
Name[it]=Chiamata persa
|
||||
Name[ko]=부재 중 전화
|
||||
Name[lt]=Praleistas skambutis
|
||||
Name[nl]=Gemiste oproep
|
||||
Name[nn]=Tapt oppringing
|
||||
Name[pl]=Połączenie nieodebrane
|
||||
Name[pt]=Chamada Não Atendida
|
||||
Name[pt_BR]=Chamada não atendida
|
||||
Name[ru]=Пропущенный вызов
|
||||
Name[sk]=Zmeškaný hovor
|
||||
Name[sv]=Missat samtal
|
||||
Name[tr]=Cevapsız Çağrı
|
||||
Name[uk]=Пропущений дзвінок
|
||||
Name[x-test]=xxMissed Callxx
|
||||
Name[zh_CN]=错过的呼叫
|
||||
Name[zh_TW]=錯過的來電
|
||||
Comment=A call has been missed
|
||||
Comment[ca]=S'ha perdut una trucada
|
||||
Comment[ca@valencia]=S'ha perdut una trucada
|
||||
Comment[da]=Et opkald blev mistet
|
||||
Comment[de]=Ein Anruf wurde verpasst
|
||||
Comment[en_GB]=A call has been missed
|
||||
Comment[es]=Se ha perdido una llamada
|
||||
Comment[et]=Vastamata jäänud kõne
|
||||
Comment[eu]=Dei bat galdu da
|
||||
Comment[fi]=Vastaamaton puhelu
|
||||
Comment[fr]=Un appel a été manqué
|
||||
Comment[gl]=Ten unha chamada perdida.
|
||||
Comment[hu]=Egy hívást elmulasztott
|
||||
Comment[ia]=Un appello ha essite perdite
|
||||
Comment[id]=Sebuah panggilan yang tidak terjawab
|
||||
Comment[it]=Una chiamata è stata persa
|
||||
Comment[ko]=부재 중 전화가 있음
|
||||
Comment[lt]=Buvo praleistas skambutis
|
||||
Comment[nl]=Er is een gemiste oproep
|
||||
Comment[nn]=Du mista ei oppringing
|
||||
Comment[pl]=Nie odebrano połączenia
|
||||
Comment[pt]=Uma chamada não foi atendida
|
||||
Comment[pt_BR]=Uma chamada foi perdida
|
||||
Comment[ru]=Оповещение о пропущенном вызове
|
||||
Comment[sk]=Máte zmeškaný hovor
|
||||
Comment[sv]=Ett samtal har missats
|
||||
Comment[tr]=Cevaplanmamış bir çağrı var
|
||||
Comment[uk]=Було пропущено дзвінок
|
||||
Comment[x-test]=xxA call has been missedxx
|
||||
Comment[zh_CN]=错过了一个呼叫
|
||||
Comment[zh_TW]=錯過一次來電
|
||||
Action=Popup
|
||||
|
||||
[Event/ringing]
|
||||
Name=Ringing
|
||||
Name[ca]=Sonant
|
||||
Name[ca@valencia]=Sonant...
|
||||
Name[cs]=Zvoní
|
||||
Name[da]=Ringer
|
||||
Name[de]=Es klingelt
|
||||
Name[en_GB]=Ringing
|
||||
Name[es]=Sonando
|
||||
Name[et]=Helistamine
|
||||
Name[eu]=Jotzen ari da
|
||||
Name[fi]=Soi
|
||||
Name[fr]=Sonnerie en cours
|
||||
Name[gl]=Chámano
|
||||
Name[hu]=Kicseng
|
||||
Name[ia]=Sonante
|
||||
Name[id]=Berdering
|
||||
Name[it]=Sta squillando
|
||||
Name[ko]=전화 오는 중
|
||||
Name[lt]=Skambina
|
||||
Name[nl]=Bel gaat over
|
||||
Name[nn]=Ringjer
|
||||
Name[pl]=Dzwonienie
|
||||
Name[pt]=A tocar
|
||||
Name[pt_BR]=Chamando
|
||||
Name[ru]=Оповещение о вызове
|
||||
Name[sk]=Zvoní
|
||||
Name[sv]=Ringer
|
||||
Name[tr]=Çalıyor
|
||||
Name[uk]=Дзвінок
|
||||
Name[x-test]=xxRingingxx
|
||||
Name[zh_CN]=响铃中
|
||||
Name[zh_TW]=響鈴中
|
||||
Comment=The phone is ringing
|
||||
Comment[ca]=El telèfon està sonant
|
||||
Comment[ca@valencia]=El telèfon està sonant
|
||||
Comment[cs]=Telefon zvoní
|
||||
Comment[da]=Telefonen ringer
|
||||
Comment[de]=Das Telefon klingelt
|
||||
Comment[en_GB]=The phone is ringing
|
||||
Comment[es]=El teléfono está sonando
|
||||
Comment[et]=Telefon heliseb
|
||||
Comment[eu]=Telefonoa jotzen ari da
|
||||
Comment[fi]=Puhelin soi
|
||||
Comment[fr]=Le téléphone est en train de sonner
|
||||
Comment[gl]=Está a recibir unha chamada.
|
||||
Comment[hu]=A telefon kicseng
|
||||
Comment[id]=Ponsel berdering
|
||||
Comment[it]=Il telefono sta squillando
|
||||
Comment[ko]=수신 전화가 있음
|
||||
Comment[lt]=Telefonas skambina
|
||||
Comment[nl]=De telefoon gaat over
|
||||
Comment[nn]=Telefonen ringjer
|
||||
Comment[pl]=Telefon dzwoni
|
||||
Comment[pt]=O telefone está a tocar
|
||||
Comment[pt_BR]=O telefone está tocando
|
||||
Comment[ru]=Оповещение о вызове
|
||||
Comment[sk]=Telefón zvoní
|
||||
Comment[sv]=Telefonen ringer
|
||||
Comment[tr]=Telefon çalıyor
|
||||
Comment[uk]=Телефон дзвонить
|
||||
Comment[x-test]=xxThe phone is ringingxx
|
||||
Comment[zh_CN]=手机正在响铃
|
||||
Comment[zh_TW]=電話正在響鈴中
|
||||
Action=Sound
|
||||
Sound=Oxygen-Im-Phone-Ring.ogg
|
||||
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
|
||||
signal accepted
|
||||
signal rejected
|
||||
|
||||
Layout.minimumHeight: units.gridUnit * 5
|
||||
Layout.fillWidth: true
|
||||
property int handlePosition: (answerHandle.x + answerHandle.width/2)
|
||||
drag {
|
||||
target: answerHandle
|
||||
axis: Drag.XAxis
|
||||
minimumX: 0
|
||||
maximumX: width - answerHandle.width
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: height
|
||||
color: Qt.rgba((handlePosition > root.width/2 ? 0.6 : 0)+0.2, (handlePosition < root.width/2 ? 0.6 : 0)+0.2, 0.2, Math.abs(handlePosition - (root.width/2)) / answerHandle.width/2);
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
source: "call-start"
|
||||
width: icon.width
|
||||
height: width
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: units.largeSpacing
|
||||
}
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
source: "call-stop"
|
||||
width: icon.width
|
||||
height: width
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
leftMargin: units.largeSpacing
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: answerHandle
|
||||
x: parent.width/2 - width/2
|
||||
height: parent.height
|
||||
width: height
|
||||
radius: width
|
||||
color: Qt.rgba(0.2, 0.8, 0.2, 1)
|
||||
PlasmaCore.IconItem {
|
||||
id: icon
|
||||
source: "call-start"
|
||||
width: parent.width * 0.7
|
||||
height: width
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
Behavior on x {
|
||||
enabled: root.pressed
|
||||
XAnimator {
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
onReleased: {
|
||||
if (answerHandle.x <= answerHandle.width) {
|
||||
root.accepted();
|
||||
} else if (answerHandle.x + answerHandle.width >= root.width - answerHandle.width) {
|
||||
root.rejected();
|
||||
}
|
||||
|
||||
answerHandle.x = width/2 - answerHandle.width/2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.minimumHeight: parent.height/2
|
||||
Rectangle {
|
||||
height: Math.min(parent.width, parent.height)
|
||||
width: height
|
||||
radius: 5
|
||||
anchors.centerIn: parent
|
||||
PlasmaCore.IconItem {
|
||||
anchors {
|
||||
fill: parent
|
||||
centerIn: parent
|
||||
margins: 20
|
||||
}
|
||||
source: "im-user"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,185 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2015 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.kirigami 2.5 as Kirigami
|
||||
|
||||
import "../Dialpad"
|
||||
|
||||
Kirigami.Page {
|
||||
id: callPage
|
||||
|
||||
property string status: dialerUtils.callState
|
||||
|
||||
function secondsToTimeString(seconds) {
|
||||
var h = Math.floor(seconds / 3600);
|
||||
var m = Math.floor((seconds - (h * 3600)) / 60);
|
||||
var s = seconds - h * 3600 - m * 60;
|
||||
if(h < 10) h = '0' + h;
|
||||
if(m < 10) m = '0' + m;
|
||||
if(s < 10) s = '0' + s;
|
||||
return '' + h + ':' + m + ':' + s;
|
||||
}
|
||||
|
||||
onStatusChanged: {
|
||||
if (status != "active") {
|
||||
dialerButton.checked = false;
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: activeCallUi
|
||||
spacing: 10
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 20
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: topFlickable
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.minimumHeight: parent.height/2
|
||||
|
||||
contentWidth: topContents.width
|
||||
contentHeight: topContents.height
|
||||
interactive: status == "active";
|
||||
Row {
|
||||
id: topContents
|
||||
Avatar {
|
||||
width: topFlickable.width
|
||||
height: topFlickable.height
|
||||
}
|
||||
Dialpad {
|
||||
width: topFlickable.width
|
||||
height: topFlickable.height
|
||||
}
|
||||
}
|
||||
|
||||
onMovingChanged: {
|
||||
var checked = contentX > topFlickable.width/2;
|
||||
|
||||
if (checked) {
|
||||
topSlideAnim.to = topFlickable.width;
|
||||
} else {
|
||||
topSlideAnim.to = 0;
|
||||
}
|
||||
dialerButton.checked = checked;
|
||||
topSlideAnim.running = true;
|
||||
}
|
||||
PropertyAnimation {
|
||||
id: topSlideAnim
|
||||
target: topFlickable
|
||||
properties: "contentX"
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: implicitHeight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pointSize: theme.defaultFont.pointSize * 2
|
||||
text: dialerUtils.callContactAlias
|
||||
}
|
||||
PlasmaComponents.Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: implicitHeight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
text: {
|
||||
if (dialerUtils.callState == "dialing") {
|
||||
return i18n("Calling...");
|
||||
} else if (dialerUtils.callDuration > 0) {
|
||||
return secondsToTimeString(dialerUtils.callDuration);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaComponents.ButtonRow {
|
||||
opacity: status == "active" ? 1 : 0
|
||||
exclusive: false
|
||||
spacing: 0
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
PlasmaComponents.ToolButton {
|
||||
id: muteButton
|
||||
flat: false
|
||||
iconSource: "audio-volume-high"
|
||||
//TODO
|
||||
// iconSource: ofonoWrapper.isMicrophoneMuted ? "audio-volume-muted" : "audio-volume-high"
|
||||
onClicked: {
|
||||
//TODO
|
||||
// ofonoWrapper.isMicrophoneMuted = !ofonoWrapper.isMicrophoneMuted;
|
||||
}
|
||||
}
|
||||
PlasmaComponents.ToolButton {
|
||||
id: dialerButton
|
||||
flat: false
|
||||
iconSource: "input-keyboard"
|
||||
checkable: true
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
topSlideAnim.to = topFlickable.width;
|
||||
} else {
|
||||
topSlideAnim.to = 0;
|
||||
}
|
||||
topSlideAnim.running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Item {
|
||||
Layout.minimumHeight: units.gridUnit * 5
|
||||
Layout.fillWidth: true
|
||||
|
||||
AnswerSwipe {
|
||||
anchors.fill: parent
|
||||
//STATUS_INCOMING
|
||||
visible: status == "incoming"
|
||||
onAccepted: {
|
||||
dialerUtils.acceptCall();
|
||||
}
|
||||
onRejected: {
|
||||
dialerUtils.rejectCall();
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaComponents.Button {
|
||||
anchors.fill: parent
|
||||
//STATUS_INCOMING
|
||||
visible: status != "incoming"
|
||||
iconSource: "call-stop"
|
||||
Layout.fillWidth: true
|
||||
text: i18n("End Call")
|
||||
onClicked: {
|
||||
dialerUtils.hangUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Martin Klapetek <mklapetek@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.2 as Controls
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.kirigami 2.10 as Kirigami
|
||||
import org.kde.people 1.0 as KPeople
|
||||
|
||||
Kirigami.Page {
|
||||
|
||||
title: i18n("Contacts")
|
||||
|
||||
header: Kirigami.SearchField {
|
||||
id: searchField
|
||||
onTextChanged: contactsProxyModel.setFilterFixedString(text)
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
anchors.centerIn: parent
|
||||
text: i18n("No contacts")
|
||||
visible: contactsList.count === 0
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: contactsList
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
section.property: "display"
|
||||
section.criteria: ViewSection.FirstCharacter
|
||||
section.delegate: Kirigami.ListSectionHeader {text: section}
|
||||
clip: true
|
||||
|
||||
model: KPeople.PersonsSortFilterProxyModel {
|
||||
id: contactsProxyModel
|
||||
sourceModel: KPeople.PersonsModel {
|
||||
id: contactsModel
|
||||
}
|
||||
requiredProperties: "phoneNumber"
|
||||
filterRole: Qt.DisplayRole
|
||||
sortRole: Qt.DisplayRole
|
||||
filterCaseSensitivity: Qt.CaseInsensitive
|
||||
Component.onCompleted: sort(0)
|
||||
}
|
||||
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
Component {
|
||||
id: contactListDelegate
|
||||
|
||||
Kirigami.BasicListItem {
|
||||
icon: model.decoration
|
||||
label: model.display
|
||||
// onClicked: dialerUtils.dial(model.phoneNumber)
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Kirigami.DelegateRecycler {
|
||||
width: parent.width
|
||||
sourceComponent: contactListDelegate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2014 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 2.5 as QQC2
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.kirigami 2.9 as Kirigami
|
||||
import "Dialpad"
|
||||
|
||||
Kirigami.Page {
|
||||
id: dialer
|
||||
|
||||
property alias numberEntryText: status.text
|
||||
|
||||
title: i18n("Dialer")
|
||||
header: Kirigami.InlineMessage {
|
||||
type: Kirigami.MessageType.Error
|
||||
text: i18n("Unable to make a call at this moment")
|
||||
visible: dialerUtils.callState == "failed"
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: dialPadArea
|
||||
anchors.fill: parent
|
||||
|
||||
QQC2.Label {
|
||||
id: status
|
||||
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignBottom
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: units.largeSpacing * 2
|
||||
Layout.bottomMargin: units.largeSpacing
|
||||
Layout.minimumHeight: units.gridUnit * 3
|
||||
Layout.maximumHeight: Layout.minimumHeight
|
||||
font.pixelSize: units.gridUnit * 2.3
|
||||
|
||||
text: dialerUtils.formatNumber(dialPad.number)
|
||||
}
|
||||
|
||||
Dialpad {
|
||||
id: dialPad
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2014 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 2.2 as Controls
|
||||
|
||||
import org.kde.kirigami 2.2 as Kirigami
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
signal clicked(string text)
|
||||
|
||||
property string text
|
||||
property string sub
|
||||
property string display
|
||||
property string subdisplay
|
||||
property bool special: false
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
z: -1
|
||||
color: Kirigami.Theme.highlightColor
|
||||
radius: units.smallSpacing
|
||||
opacity: mouse.pressed ? 0.4 : 0
|
||||
Behavior on opacity {
|
||||
OpacityAnimator {
|
||||
duration: Kirigami.Units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
|
||||
onClicked: root.clicked(parent.text)
|
||||
|
||||
onPressAndHold: {
|
||||
var text = parent.sub.length > 0 ? parent.sub : parent.text
|
||||
if (text.length === 1) {
|
||||
root.clicked(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
spacing: -5
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Controls.Label {
|
||||
id: main
|
||||
|
||||
font.pixelSize: units.gridUnit * 2
|
||||
text: root.display || root.text
|
||||
opacity: special ? 0.4 : 1.0
|
||||
Layout.minimumWidth: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
Controls.Label {
|
||||
id: longHold
|
||||
|
||||
text: root.subdisplay || root.sub
|
||||
opacity: 0.4
|
||||
Layout.minimumWidth: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2014 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 2.2 as Controls
|
||||
|
||||
import org.kde.kirigami 2.2 as Kirigami
|
||||
|
||||
|
||||
Item {
|
||||
id: buttonRoot
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
signal pressed()
|
||||
|
||||
property var callback
|
||||
property string sub
|
||||
property alias source: icon.source
|
||||
property alias text: label.text
|
||||
property int size
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
z: -1
|
||||
color: Kirigami.Theme.highlightColor
|
||||
radius: units.smallSpacing
|
||||
opacity: mouse.pressed ? 0.4 : 0
|
||||
Behavior on opacity {
|
||||
OpacityAnimator {
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
anchors.centerIn: parent
|
||||
Kirigami.Icon {
|
||||
id: icon
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: height
|
||||
height: buttonRoot.size || buttonRoot.height * 0.6
|
||||
}
|
||||
Controls.Label {
|
||||
id: label
|
||||
height: buttonRoot.height
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
fontSizeMode: Text.VerticalFit
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouse
|
||||
anchors.fill: parent
|
||||
onClicked: buttonRoot.pressed()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2014 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Layouts 1.2
|
||||
|
||||
import org.kde.kirigami 2.5 as Kirigami
|
||||
|
||||
GridLayout {
|
||||
id: pad
|
||||
columns: 3
|
||||
rowSpacing: 10
|
||||
columnSpacing: 10
|
||||
Layout.leftMargin: Kirigami.Units.largeSpacing * 2
|
||||
Layout.rightMargin: Kirigami.Units.largeSpacing * 2
|
||||
|
||||
property string number
|
||||
|
||||
DialerButton { id: one; text: "1"; onClicked: pad.number += text }
|
||||
DialerButton { text: "2"; sub: "ABC"; onClicked: pad.number += text }
|
||||
DialerButton { text: "3"; sub: "DEF"; onClicked: pad.number += text }
|
||||
|
||||
DialerButton { text: "4"; sub: "GHI"; onClicked: pad.number += text }
|
||||
DialerButton { text: "5"; sub: "JKL"; onClicked: pad.number += text }
|
||||
DialerButton { text: "6"; sub: "MNO"; onClicked: pad.number += text }
|
||||
|
||||
DialerButton { text: "7"; sub: "PQRS"; onClicked: pad.number += text }
|
||||
DialerButton { text: "8"; sub: "TUV"; onClicked: pad.number += text }
|
||||
DialerButton { text: "9"; sub: "WXYZ"; onClicked: pad.number += text }
|
||||
|
||||
DialerButton { display: "*"; text: "*"; special: true; onClicked: pad.number += text }
|
||||
DialerButton { text: "0"; subdisplay: "+"; sub: "+"; onClicked: pad.number += text }
|
||||
DialerButton { display: "#"; text: "#"; special: true; onClicked: pad.number += text }
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
DialerIconButton {
|
||||
id: callButton
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
enabled: status.text.length > 0
|
||||
opacity: enabled ? 1 : 0.5
|
||||
source: "call-start"
|
||||
size: Kirigami.Units.gridUnit * 3
|
||||
onPressed: call(status.text)
|
||||
}
|
||||
DialerIconButton {
|
||||
id: delButton
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
enabled: status.text.length > 0
|
||||
opacity: enabled ? 1 : 0.5
|
||||
source: "edit-clear"
|
||||
size: Kirigami.Units.gridUnit * 2
|
||||
onPressed: {
|
||||
pad.number = pad.number.slice(0, -1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 2.2 as Controls
|
||||
|
||||
import org.kde.kirigami 2.2 as Kirigami
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
Item {
|
||||
id: delegateParent
|
||||
width: view.width
|
||||
height: childrenRect.height
|
||||
|
||||
Behavior on height {
|
||||
SpringAnimation { spring: 5; damping: 0.3 }
|
||||
}
|
||||
SequentialAnimation {
|
||||
id: removeAnim
|
||||
XAnimator {
|
||||
target: delegate
|
||||
from: delegate.x
|
||||
to: delegate.x > 0 ? width : -width
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
PropertyAnimation {
|
||||
target: delegateParent
|
||||
properties: "height"
|
||||
to: 0
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
ScriptAction {
|
||||
script: filterModel.remove(model.index)
|
||||
}
|
||||
}
|
||||
|
||||
XAnimator {
|
||||
id: resetAnim
|
||||
target: delegate
|
||||
from: delegate.x
|
||||
to: 0
|
||||
duration: units.longDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
PlasmaComponents.ListItem {
|
||||
id: delegate
|
||||
|
||||
MouseArea {
|
||||
width: parent.width
|
||||
height: childrenRect.height
|
||||
onClicked: call(model.number);
|
||||
drag.axis: Drag.XAxis
|
||||
drag.target: delegate
|
||||
onReleased: {
|
||||
if (drag.active) {
|
||||
if (delegate.x > delegate.width / 3 || delegate.x < width / -3) {
|
||||
removeAnim.running = true;
|
||||
} else {
|
||||
resetAnim.running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
width: parent.width
|
||||
//FIXME: ad hoc icons
|
||||
Kirigami.Icon {
|
||||
width: units.iconSizes.medium
|
||||
height: width
|
||||
source: {
|
||||
switch (model.callType) {
|
||||
case 0:
|
||||
return "list-remove";
|
||||
case 1:
|
||||
return "go-down";
|
||||
case 2:
|
||||
return "go-up";
|
||||
}
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
Controls.Label {
|
||||
text: "Name (todo)"
|
||||
}
|
||||
Controls.Label {
|
||||
text: model.number
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
Controls.Label {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text: Qt.formatTime(model.time, Qt.locale().timeFormat(Locale.ShortFormat));
|
||||
}
|
||||
Controls.Label {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text: i18n("Duration: %1", secondsToTimeString(model.duration));
|
||||
visible: model.duration > 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 Library General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.kirigami 2.0 as Kirigami
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.plasma.dialer 1.0
|
||||
|
||||
Kirigami.Page {
|
||||
|
||||
title: i18n("History")
|
||||
|
||||
function secondsToTimeString(seconds) {
|
||||
var h = Math.floor(seconds / 3600);
|
||||
var m = Math.floor((seconds - (h * 3600)) / 60);
|
||||
var s = seconds - h * 3600 - m * 60;
|
||||
if(h < 10) h = '0' + h;
|
||||
if(m < 10) m = '0' + m;
|
||||
if(s < 10) s = '0' + s;
|
||||
return '' + h + ':' + m + ':' + s;
|
||||
}
|
||||
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
text: i18n("No recent calls")
|
||||
visible: view.count == 0
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
visible: view.count > 0
|
||||
PlasmaComponents.ToolBar {
|
||||
Layout.fillWidth: true
|
||||
tools: RowLayout {
|
||||
id: toolBarLayout
|
||||
PlasmaComponents.TabBar {
|
||||
tabPosition: Qt.TopEdge
|
||||
PlasmaComponents.TabButton {
|
||||
iconSource: "call-start"
|
||||
text: i18n("All")
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
filterModel.setFilterFixedString("")
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaComponents.TabButton {
|
||||
iconSource: "list-remove"
|
||||
text: i18n("Missed")
|
||||
onCheckedChanged: {
|
||||
if (checked) {
|
||||
filterModel.setFilterFixedString("0")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
PlasmaComponents.Button {
|
||||
text: i18n("Clear")
|
||||
onClicked: historyModel.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
PlasmaExtras.ScrollArea {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
ListView {
|
||||
id: view
|
||||
model: CallHistorySortFilterModel {
|
||||
id: filterModel
|
||||
sourceModel: historyModel
|
||||
filterRole: CallHistoryModel.CallTypeRole
|
||||
sortRole: CallHistoryModel.TimeRole
|
||||
Component.onCompleted: sort(0, Qt.DescendingOrder)
|
||||
}
|
||||
section {
|
||||
property: "date"
|
||||
delegate: PlasmaComponents.ListItem {
|
||||
id: sectionItem
|
||||
sectionDelegate: true
|
||||
PlasmaComponents.Label {
|
||||
text: Qt.formatDate(section, Qt.locale().dateFormat(Locale.LongFormat));
|
||||
}
|
||||
}
|
||||
}
|
||||
delegate: HistoryDelegate {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/**
|
||||
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
|
||||
* Copyright 2014 Marco Martin <mart@kde.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2 or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
import QtQuick 2.3
|
||||
import QtQuick.Controls 2.3
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.LocalStorage 2.0
|
||||
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.kirigami 2.0 as Kirigami
|
||||
|
||||
import org.kde.plasma.dialer 1.0
|
||||
|
||||
Kirigami.ApplicationWindow {
|
||||
id: root
|
||||
|
||||
//BEGIN PROPERTIES
|
||||
width: 1080
|
||||
height: 800
|
||||
|
||||
visible: false
|
||||
|
||||
//keep track if we were visible when ringing
|
||||
property bool wasVisible
|
||||
//was the last call an incoming one?
|
||||
property bool isIncoming
|
||||
|
||||
pageStack.globalToolBar.style:Kirigami.ApplicationHeaderStyle.Titles
|
||||
//END PROPERTIES
|
||||
|
||||
//BEGIN SIGNAL HANDLERS
|
||||
Connections {
|
||||
target: dialerUtils
|
||||
onMissedCallsActionTriggered: {
|
||||
root.visible = true;
|
||||
}
|
||||
onCallEnded: {
|
||||
var callType;
|
||||
if (isIncomingCall && callDuration == 0) {
|
||||
callType = 0;
|
||||
} else if (isIncomingCall && callDuration > 0) {
|
||||
callType = 1;
|
||||
} else {
|
||||
callType = 2;
|
||||
}
|
||||
historyModel.addCall(callContactNumber, callDuration, callType)
|
||||
}
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
//TODO
|
||||
//reset missed calls if the status is not STATUS_INCOMING when got visible
|
||||
}
|
||||
//END SIGNAL HANDLERS
|
||||
|
||||
//BEGIN FUNCTIONS
|
||||
function call(number) {
|
||||
dialerUtils.dial(number);
|
||||
}
|
||||
//END FUNCTIONS
|
||||
|
||||
//BEGIN MODELS
|
||||
CallHistoryModel {
|
||||
id: historyModel
|
||||
}
|
||||
|
||||
//END MODELS
|
||||
|
||||
pageStack.initialPage: dialerUtils.callState == "idle" || dialerUtils.callState == "failed" ? [Qt.resolvedUrl("HistoryPage.qml"), Qt.resolvedUrl("ContactsPage.qml"), Qt.resolvedUrl("DialerPage.qml")] : Qt.resolvedUrl("Call/CallPage.qml")
|
||||
|
||||
footer: TabBar {
|
||||
height: 50
|
||||
|
||||
currentIndex: pageStack.currentIndex
|
||||
|
||||
TabButton {
|
||||
text: i18n("History")
|
||||
icon.name: "view-pim-contacts"
|
||||
onClicked: pageStack.currentIndex = 0
|
||||
}
|
||||
TabButton {
|
||||
text: i18n("Contacts")
|
||||
icon.name: "view-pim-contacts"
|
||||
onClicked: pageStack.currentIndex = 1
|
||||
}
|
||||
TabButton {
|
||||
text: i18n("Dialer")
|
||||
icon.name: "view-pim-contacts"
|
||||
onClicked: pageStack.currentIndex = 2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file alias="main.qml">qml/main.qml</file>
|
||||
<file alias="DialerPage.qml">qml/DialerPage.qml</file>
|
||||
<file alias="ContactsPage.qml">qml/ContactsPage.qml</file>
|
||||
<file alias="HistoryPage.qml">qml/HistoryPage.qml</file>
|
||||
<file alias="Call/AnswerSwipe.qml">qml/Call/AnswerSwipe.qml</file>
|
||||
<file alias="Call/CallPage.qml">qml/Call/CallPage.qml</file>
|
||||
<file alias="Call/Avatar.qml">qml/Call/Avatar.qml</file>
|
||||
<file alias="HistoryDelegate.qml">qml/HistoryDelegate.qml</file>
|
||||
<file alias="Dialpad/Dialpad.qml">qml/Dialpad/Dialpad.qml</file>
|
||||
<file alias="Dialpad/DialerButton.qml">qml/Dialpad/DialerButton.qml</file>
|
||||
<file alias="Dialpad/DialerIconButton.qml">qml/Dialpad/DialerIconButton.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
Loading…
Reference in a new issue