mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Remove dead code
This commit is contained in:
parent
e2160d3a02
commit
bd03f2114d
10 changed files with 0 additions and 909 deletions
|
|
@ -1,19 +0,0 @@
|
|||
set(quicksettings_SRCS
|
||||
quicksettings.cpp
|
||||
)
|
||||
|
||||
add_library(plasma_applet_quicksettings MODULE ${quicksettings_SRCS})
|
||||
|
||||
kcoreaddons_desktop_to_json(plasma_applet_quicksettings package/metadata.desktop)
|
||||
|
||||
target_link_libraries(plasma_applet_quicksettings
|
||||
Qt5::Gui
|
||||
KF5::Plasma
|
||||
KF5::I18n)
|
||||
|
||||
|
||||
install(TARGETS plasma_applet_quicksettings DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/applets)
|
||||
#install(FILES plasma-quicksettings-default.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
|
||||
plasma_install_package(package org.kde.phone.quicksettings)
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#! /usr/bin/env bash
|
||||
$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
|
||||
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.phone.quicksettings.pot
|
||||
rm -f rc.cpp
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <notmart@gmail.com>
|
||||
*
|
||||
* 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
|
||||
|
||||
Item {
|
||||
id: delegateRoot
|
||||
implicitWidth: delegate.implicitWidth
|
||||
implicitHeight: delegate.implicitHeight + (slider.opacity > 0 ? slider.height : 0)
|
||||
|
||||
property int screenBrightness
|
||||
readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] || 0 : 0
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: pmSource
|
||||
engine: "powermanagement"
|
||||
connectedSources: ["PowerDevil"]
|
||||
|
||||
onDataChanged: {
|
||||
delegateRoot.screenBrightness = source.data["PowerDevil"]["Screen Brightness"];
|
||||
}
|
||||
}
|
||||
|
||||
Delegate {
|
||||
id: delegate
|
||||
toggled: slider.opacity > 0
|
||||
function toggle() {
|
||||
slider.opacity = slider.opacity > 0 ? 0 : 1;
|
||||
}
|
||||
}
|
||||
PlasmaComponents.Slider {
|
||||
id: slider
|
||||
anchors.top: delegate.bottom
|
||||
width: flow.width
|
||||
opacity: 0
|
||||
x: -delegateRoot.parent.x
|
||||
value: screenBrightness
|
||||
minimumValue: maximumValue > 100 ? 1 : 0
|
||||
maximumValue: delegateRoot.maximumScreenBrightness
|
||||
Behavior on opacity {
|
||||
OpacityAnimator {
|
||||
duration: units.shortDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onScreenBrightnessChanged: {
|
||||
var service = pmSource.serviceForSource("PowerDevil");
|
||||
var operation = service.operationDescription("setBrightness");
|
||||
operation.brightness = slider.value;
|
||||
operation.silent = true
|
||||
service.startOperationCall(operation);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <notmart@gmail.com>
|
||||
*
|
||||
* 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.1
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
RowLayout {
|
||||
id: delegateRoot
|
||||
property bool toggled: model.enabled
|
||||
spacing: units.smallSpacing
|
||||
implicitWidth: flow.width / 2 - units.largeSpacing / 2
|
||||
Rectangle {
|
||||
Layout.minimumWidth: units.iconSizes.medium
|
||||
Layout.minimumHeight: width
|
||||
color: toggled ?
|
||||
Qt.rgba(PlasmaCore.ColorScope.highlightColor.r, PlasmaCore.ColorScope.highlightColor.g, PlasmaCore.ColorScope.highlightColor.b, iconMouseArea.pressed ? 0.5 : 0.3) :
|
||||
Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, iconMouseArea.pressed ? 0.5 : 0.2)
|
||||
|
||||
PlasmaCore.IconItem {
|
||||
colorGroup: PlasmaCore.ColorScope.colorGroup
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: units.smallSpacing
|
||||
}
|
||||
source: model.icon
|
||||
MouseArea {
|
||||
id: iconMouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (delegateRoot.toggle) {
|
||||
delegateRoot.toggle();
|
||||
} else if (model.toggleFunction) {
|
||||
root[model.toggleFunction]();
|
||||
} else if (model.settingsCommand) {
|
||||
plasmoid.nativeInterface.executeCommand(model.settingsCommand);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
color: Qt.rgba(PlasmaCore.ColorScope.textColor.r, PlasmaCore.ColorScope.textColor.g, PlasmaCore.ColorScope.textColor.b, labelMouseArea.pressed ? 0.5 : 0.2)
|
||||
PlasmaComponents.Label {
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: units.smallSpacing
|
||||
}
|
||||
text: model.text
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
MouseArea {
|
||||
id: labelMouseArea
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
if (model.settingsCommand) {
|
||||
plasmoid.nativeInterface.executeCommand(model.settingsCommand);
|
||||
} else if (model.toggleFunction) {
|
||||
root[model.toggleFunction]();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,171 +0,0 @@
|
|||
/*
|
||||
* Copyright 2015 Marco Martin <notmart@gmail.com>
|
||||
*
|
||||
* 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.1
|
||||
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.plasma.plasmoid 2.0
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
function toggleAirplane() {
|
||||
print("toggle airplane mode")
|
||||
}
|
||||
|
||||
Plasmoid.preferredRepresentation: plasmoid.fullRepresentation
|
||||
|
||||
Layout.minimumHeight: flow.implicitHeight + units.largeSpacing*2
|
||||
|
||||
property int screenBrightness
|
||||
readonly property int maximumScreenBrightness: pmSource.data["PowerDevil"] ? pmSource.data["PowerDevil"]["Maximum Screen Brightness"] || 0 : 0
|
||||
onScreenBrightnessChanged: {
|
||||
var service = pmSource.serviceForSource("PowerDevil");
|
||||
var operation = service.operationDescription("setBrightness");
|
||||
operation.brightness = screenBrightness;
|
||||
operation.silent = true
|
||||
service.startOperationCall(operation);
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: pmSource
|
||||
engine: "powermanagement"
|
||||
connectedSources: ["PowerDevil"]
|
||||
onSourceAdded: {
|
||||
if (source === "PowerDevil") {
|
||||
disconnectSource(source);
|
||||
connectSource(source);
|
||||
}
|
||||
}
|
||||
|
||||
onDataChanged: {
|
||||
root.screenBrightness = pmSource.data["PowerDevil"]["Screen Brightness"];
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: settingsModel
|
||||
|
||||
ListElement {
|
||||
text: "Settings"
|
||||
icon: "configure"
|
||||
enabled: false
|
||||
settingsCommand: "plasma-settings"
|
||||
toggleFunction: ""
|
||||
delegate: ""
|
||||
}
|
||||
ListElement {
|
||||
text: "Mobile network"
|
||||
icon: "network-mobile-80"
|
||||
enabled: true
|
||||
settingsCommand: ""
|
||||
}
|
||||
ListElement {
|
||||
text: "Airplane mode"
|
||||
icon: "flightmode-on"
|
||||
enabled: false
|
||||
settingsCommand: ""
|
||||
toggleFunction: "toggleAirplane"
|
||||
}
|
||||
ListElement {
|
||||
text: "Bluetooth"
|
||||
icon: "preferences-system-bluetooth"
|
||||
enabled: false
|
||||
settingsCommand: ""
|
||||
}
|
||||
ListElement {
|
||||
text: "Wireless"
|
||||
icon: "network-wireless-on"
|
||||
enabled: true
|
||||
settingsCommand: "plasmawindowed org.kde.plasma.networkmanagement"
|
||||
}
|
||||
ListElement {
|
||||
text: "Alarms"
|
||||
icon: "korgac"
|
||||
enabled: false
|
||||
settingsCommand: "ktimer"
|
||||
}
|
||||
ListElement {
|
||||
text: "Flashlight"
|
||||
icon: "package_games_puzzle"
|
||||
enabled: false
|
||||
settingsCommand: ""
|
||||
}
|
||||
ListElement {
|
||||
text: "Location"
|
||||
icon: "plasmaapplet-location"
|
||||
enabled: false
|
||||
settingsCommand: ""
|
||||
}
|
||||
}
|
||||
|
||||
Flow {
|
||||
id: flow
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: units.largeSpacing
|
||||
}
|
||||
spacing: units.largeSpacing
|
||||
Repeater {
|
||||
model: settingsModel
|
||||
delegate: Loader {
|
||||
width: item ? item.implicitWidth : 0
|
||||
height: item ? item.implicitHeight : 0
|
||||
source: Qt.resolvedUrl((model.delegate ? model.delegate : "Delegate") + ".qml")
|
||||
}
|
||||
}
|
||||
move: Transition {
|
||||
NumberAnimation {
|
||||
duration: units.shortDuration
|
||||
easing.type: Easing.InOutQuad
|
||||
properties: "x,y"
|
||||
}
|
||||
}
|
||||
RowLayout {
|
||||
width: flow.width
|
||||
PlasmaCore.IconItem {
|
||||
Layout.preferredWidth: units.iconSizes.small
|
||||
Layout.preferredHeight: Layout.preferredWidth
|
||||
//TODO: needs brightness
|
||||
source: "contrast"
|
||||
}
|
||||
PlasmaComponents.Slider {
|
||||
id: brightnessSlider
|
||||
Layout.fillWidth: true
|
||||
value: root.screenBrightness
|
||||
onValueChanged: {
|
||||
if (pressed) {
|
||||
root.screenBrightness = value
|
||||
}
|
||||
}
|
||||
minimumValue: maximumValue > 100 ? 1 : 0
|
||||
maximumValue: root.maximumScreenBrightness
|
||||
stepSize: 1
|
||||
}
|
||||
PlasmaCore.IconItem {
|
||||
Layout.preferredWidth: units.iconSizes.small
|
||||
Layout.preferredHeight: Layout.preferredWidth
|
||||
//TODO: needs brightness
|
||||
source: "contrast"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=Quick Settings
|
||||
Name[ca]=Opcions ràpides
|
||||
Name[ca@valencia]=Opcions ràpides
|
||||
Name[cs]=Rychlé nastavení
|
||||
Name[de]=Schnelleinstellungen
|
||||
Name[en_GB]=Quick Settings
|
||||
Name[es]=Ajustes rápidos
|
||||
Name[fi]=Pika-asetukset
|
||||
Name[fr]=Paramètres rapides
|
||||
Name[gl]=Configuración rápida
|
||||
Name[it]=Impostazioni rapide
|
||||
Name[ko]=빠른 설정
|
||||
Name[nl]=Snelle instellingen
|
||||
Name[nn]=Snøgginnstillingar
|
||||
Name[pl]=Szybkie ustawienia
|
||||
Name[pt]=Configuração Rápida
|
||||
Name[sv]=Snabbinställningar
|
||||
Name[tr]=Hızlı Ayarlar
|
||||
Name[uk]=Швидке налаштовування
|
||||
Name[x-test]=xxQuick Settingsxx
|
||||
Name[zh_TW]=快速設定
|
||||
|
||||
Comment=A panel to quickly access most important settings
|
||||
Comment[ca]=Un plafó per accedir ràpidament a les opcions més importants
|
||||
Comment[ca@valencia]=Un plafó per accedir ràpidament a les opcions més importants
|
||||
Comment[en_GB]=A panel to quickly access most important settings
|
||||
Comment[es]=Un panel para acceder rápidamente a los ajustes más importantes
|
||||
Comment[fi]=Paneeli, jolla päästä tärkeimpiin asetuksiin nopeasti
|
||||
Comment[fr]=Un tableau de bord vous permettant d'accéder rapidement aux paramètres les plus importants
|
||||
Comment[gl]=Un panel para acceder rapidamente á configuración máis importante.
|
||||
Comment[it]=Un pannello per accedere rapidamente alle impostazioni più importanti
|
||||
Comment[ko]=중요한 설정에 빠르게 접근하는 패널
|
||||
Comment[nl]=Een paneel voor snelle toegang tot de meest belangrijke instellingen
|
||||
Comment[nn]=Panel for rask tilgang til dei viktigaste innstillingane
|
||||
Comment[pl]=Panel szybkiego dostępu do najważniejszych ustawień
|
||||
Comment[pt]=Um painel para aceder rapidamente às configurações mais importantes
|
||||
Comment[sv]=En panel för att snabbt komma åt de viktigaste inställningarna
|
||||
Comment[tr]=Önemli ayarların hızlıca yapılabildiği bir panel
|
||||
Comment[uk]=Панель для пришвидшення доступу до найважливіших параметрів
|
||||
Comment[x-test]=xxA panel to quickly access most important settingsxx
|
||||
Comment[zh_TW]=快速存取重要設定的面板
|
||||
|
||||
Icon=systemsettings
|
||||
Type=Service
|
||||
X-KDE-ParentApp=
|
||||
X-KDE-PluginInfo-Author=Marco Martin
|
||||
X-KDE-PluginInfo-Email=mart@kde.org
|
||||
X-KDE-PluginInfo-License=GPL
|
||||
X-KDE-PluginInfo-Name=org.kde.phone.quicksettings
|
||||
X-KDE-Library=plasma_applet_quicksettings
|
||||
X-KDE-PluginInfo-Version=1.0
|
||||
X-KDE-PluginInfo-Website=plasma.kde.org
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-KDE-PluginInfo-Category=Settings
|
||||
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-RemoteLocation=
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 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 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, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
||||
***************************************************************************/
|
||||
|
||||
#include "quicksettings.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QProcess>
|
||||
|
||||
QuickSettings::QuickSettings(QObject *parent, const QVariantList &args)
|
||||
: Plasma::Applet(parent, args)
|
||||
{
|
||||
setHasConfigurationInterface(true);
|
||||
}
|
||||
|
||||
QuickSettings::~QuickSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void QuickSettings::executeCommand(const QString &command)
|
||||
{
|
||||
qWarning()<<"Executing"<<command;
|
||||
QProcess::startDetached(command);
|
||||
}
|
||||
|
||||
K_EXPORT_PLASMA_APPLET_WITH_JSON(quicksettings, QuickSettings, "metadata.json")
|
||||
|
||||
#include "quicksettings.moc"
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 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 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, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QUICKSETTINGS_H
|
||||
#define QUICKSETTINGS_H
|
||||
|
||||
|
||||
#include <Plasma/Applet>
|
||||
|
||||
|
||||
class QuickSettings : public Plasma::Applet
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QuickSettings( QObject *parent, const QVariantList &args );
|
||||
~QuickSettings();
|
||||
|
||||
public Q_SLOTS:
|
||||
void executeCommand(const QString &command);
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,128 +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.people 1.0 as KPeople
|
||||
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
|
||||
Item {
|
||||
PlasmaComponents.Label {
|
||||
anchors.centerIn: parent
|
||||
text: i18n("No contacts")
|
||||
visible: contactsModel.count == 0
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
//visible: contactsModel.count > 0
|
||||
|
||||
PlasmaComponents.ToolBar {
|
||||
Layout.fillWidth: true
|
||||
tools: RowLayout {
|
||||
id: toolBarLayout
|
||||
PlasmaComponents.TextField {
|
||||
id: searchField
|
||||
clearButtonShown: true
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
placeholderText: i18n("Search...")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaExtras.ScrollArea {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
ListView {
|
||||
id: view
|
||||
model: PlasmaCore.SortFilterModel {
|
||||
id: filterModel
|
||||
sourceModel: KPeople.PersonsModel {
|
||||
id: contactsModel
|
||||
}
|
||||
sortRole: "display"
|
||||
filterRole: "display"
|
||||
filterRegExp: ".*"+searchField.text+".*"
|
||||
sortOrder: Qt.AscendingOrder
|
||||
}
|
||||
section {
|
||||
property: "display"
|
||||
criteria: ViewSection.FirstCharacter
|
||||
delegate: PlasmaComponents.ListItem {
|
||||
id: sectionItem
|
||||
sectionDelegate: true
|
||||
PlasmaComponents.Label {
|
||||
text: section
|
||||
}
|
||||
}
|
||||
}
|
||||
delegate: PlasmaComponents.ListItem {
|
||||
RowLayout {
|
||||
id: delegateLayout
|
||||
|
||||
KQuickControlsAddons.QPixmapItem {
|
||||
id: avatarLabel
|
||||
|
||||
Layout.minimumWidth: units.iconSizes.medium
|
||||
Layout.maximumWidth: Layout.minimumWidth
|
||||
Layout.minimumHeight: Layout.minimumWidth
|
||||
Layout.maximumHeight: Layout.minimumWidth
|
||||
|
||||
pixmap: model.decoration
|
||||
fillMode: KQuickControlsAddons.QPixmapItem.PreserveAspectFit
|
||||
smooth: true
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: nickLabel
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: model.display
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
id: dataLabel
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: "605-909-123"
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: call(12345)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,281 +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 org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.nemomobile.voicecall 1.0
|
||||
import "../components"
|
||||
|
||||
Rectangle {
|
||||
id: dialer
|
||||
color: "black"
|
||||
opacity: 0.8
|
||||
visible: false
|
||||
|
||||
state: manager.activeVoiceCall ? manager.activeVoiceCall.statusText : "disconnected"
|
||||
property color textColor: "white"
|
||||
property bool calling: false // needs to be connected to a system service
|
||||
property bool enableButtons: calling
|
||||
property alias numberEntryText: status.text
|
||||
property VoiceCallManager manager: homescreen.manager
|
||||
|
||||
property string providerId: manager.providers.id(0)
|
||||
|
||||
function open() {
|
||||
visible = true;
|
||||
opacity = 0.8;
|
||||
}
|
||||
|
||||
function close() {
|
||||
opacity = 0;
|
||||
}
|
||||
|
||||
function addNumber(number) {
|
||||
status.text = status.text + number
|
||||
}
|
||||
|
||||
function call() {
|
||||
if (!calling) {
|
||||
console.log("Calling: " + status.text);
|
||||
dialer.calling = true;
|
||||
manager.dial(providerId, status.text);
|
||||
|
||||
} else {
|
||||
console.log("Hanging up: " + status.text);
|
||||
status.text = '';
|
||||
dialer.calling = false;
|
||||
var call = manager.activeVoiceCall;
|
||||
if (call) {
|
||||
call.hangup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fromContacts() {
|
||||
console.log("Should get from contacts!");
|
||||
status.text = "+41 76 555 5555"
|
||||
}
|
||||
|
||||
function secondsToTimeString(seconds) {
|
||||
seconds = Math.floor(seconds/1000)
|
||||
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;
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { properties: "opacity"; duration: 100 }
|
||||
}
|
||||
|
||||
onOpacityChanged: {
|
||||
visible = opacity > 0;
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
opacity = visible ? 0.9 : 0;
|
||||
}
|
||||
|
||||
onCallingChanged: {
|
||||
if (calling) {
|
||||
open();
|
||||
} else {
|
||||
opacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: dialPadArea
|
||||
visible: dialer.state == "disconnected"
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 20
|
||||
}
|
||||
Text {
|
||||
id: status
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Qt.AlignRight
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: one.font.pixelSize
|
||||
color: textColor
|
||||
}
|
||||
|
||||
Grid {
|
||||
id: pad
|
||||
columns: 3
|
||||
spacing: 0
|
||||
property int buttonHeight: height / 5
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
height: parent.height - status.height
|
||||
width: parent.width
|
||||
|
||||
DialerButton { id: one; text: "1" }
|
||||
DialerButton { text: "2" }
|
||||
DialerButton { text: "3" }
|
||||
|
||||
DialerButton { text: "4" }
|
||||
DialerButton { text: "5" }
|
||||
DialerButton { text: "6" }
|
||||
|
||||
DialerButton { text: "7" }
|
||||
DialerButton { text: "8" }
|
||||
DialerButton { text: "9" }
|
||||
|
||||
DialerButton { text: "*"; }
|
||||
DialerButton { text: "0"; sub: "+"; }
|
||||
DialerButton { text: "#" }
|
||||
|
||||
DialerIconButton {
|
||||
source: "im-user"
|
||||
callback: fromContacts
|
||||
}
|
||||
DialerIconButton {
|
||||
id: callButton
|
||||
source: dialer.calling ? "call-stop" : "call-start"
|
||||
callback: call
|
||||
}
|
||||
DialerIconButton {
|
||||
source: "edit-clear"
|
||||
callback: function() {
|
||||
if (status.text.length > 0) {
|
||||
status.text = status.text.substr(0, status.text.length - 1);
|
||||
} else {
|
||||
dialer.calling = true;
|
||||
dialer.calling = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: activeCallUi
|
||||
spacing: 10
|
||||
visible: dialer.state != "disconnected"
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 20
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: implicitHeight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: one.font.pixelSize
|
||||
color: textColor
|
||||
text: manager.activeVoiceCall ? manager.activeVoiceCall.lineId : ""
|
||||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumHeight: implicitHeight
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
font.pixelSize: theme.smallestFont.pixelSize
|
||||
color: textColor
|
||||
text: manager.activeVoiceCall ? secondsToTimeString(manager.activeVoiceCall.duration) : ''
|
||||
}
|
||||
RowLayout {
|
||||
height: parent.height / 3
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
DialerIconButton {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
source: dialer.state == "incoming" ? "call-start" : (manager.isMicrophoneMuted ? "audio-volume-muted" : "audio-volume-high")
|
||||
Rectangle {
|
||||
z: -1
|
||||
color: dialer.state == "incoming" ? "green" : "white"
|
||||
opacity: 0.5
|
||||
radius: 5
|
||||
anchors {
|
||||
fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
callback: function () {
|
||||
if (dialer.state == "incoming") {
|
||||
if (manager.activeVoiceCall) {
|
||||
manager.activeVoiceCall.answer();
|
||||
}
|
||||
} else {
|
||||
manager.isMicrophoneMuted = !manager.isMicrophoneMuted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DialerIconButton {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
source: "call-stop"
|
||||
Rectangle {
|
||||
z: -1
|
||||
color: "red"
|
||||
opacity: 0.5
|
||||
radius: 5
|
||||
anchors {
|
||||
fill: parent
|
||||
}
|
||||
}
|
||||
|
||||
callback: function () {
|
||||
if (manager.activeVoiceCall) {
|
||||
manager.activeVoiceCall.hangup();
|
||||
}
|
||||
dialer.opacity = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue