shift-shell/shell/contents/views/Desktop.qml

171 lines
4.8 KiB
QML
Raw Normal View History

2014-09-29 14:40:58 +00:00
/*
* Copyright 2014 Aaron Seigo <aseigo@kde.org>
* Copyright 2012 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.0
2014-09-29 19:38:56 +00:00
import QtGraphicalEffects 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
2014-09-29 11:32:55 +00:00
import org.kde.plasma.shell 2.0 as Shell
import org.kde.satellite.components 0.1 as SatelliteComponents
import org.kde.plasma.components 2.0 as PlasmaComponents
2014-11-09 12:50:03 +00:00
import org.kde.plasma.workspace.components 2.0 as PlasmaWorkspace
import org.nemomobile.voicecall 1.0
import org.kde.kquickcontrolsaddons 2.0
2014-10-30 14:29:14 +00:00
import MeeGo.QOfono 0.2
import "../components"
2015-02-24 15:49:06 +00:00
Item {
2014-09-14 15:52:19 +00:00
id: homescreen
2014-09-29 11:32:55 +00:00
width: 1080
height: 1920
property Item containment;
property Item wallpaper;
2014-09-29 14:40:58 +00:00
property var pendingRemovals: [];
property int notificationId: 0;
2015-02-24 15:26:17 +00:00
property int buttonHeight: width/4
2014-09-29 14:40:58 +00:00
2015-03-13 14:31:13 +00:00
onContainmentChanged: {
containment.parent = homescreen;
2014-09-29 14:40:58 +00:00
2015-03-13 14:31:13 +00:00
if (containment != null) {
containment.visible = true;
2014-09-29 14:40:58 +00:00
}
2015-03-13 14:31:13 +00:00
if (containment != null) {
containment.anchors.left = homescreen.left;
containment.anchors.top = homescreen.top;
containment.anchors.right = homescreen.right;
containment.anchors.bottom = homescreen.bottom;
2014-09-29 14:40:58 +00:00
}
2015-03-13 14:31:13 +00:00
}
2014-09-29 14:40:58 +00:00
2014-10-30 14:29:14 +00:00
OfonoManager {
id: ofonoManager
onAvailableChanged: {
console.log("Ofono is " + available)
}
onModemAdded: {
console.log("modem added " + modem)
}
onModemRemoved: console.log("modem removed")
}
OfonoConnMan {
id: ofono1
Component.onCompleted: {
console.log(ofonoManager.modems)
}
2014-11-03 20:17:02 +00:00
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
}
OfonoModem {
id: modem1
2014-11-03 20:17:02 +00:00
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
}
OfonoContextConnection {
id: context1
2014-11-03 20:17:02 +00:00
contextPath : ofono1.contexts.length > 0 ? ofono1.contexts[0] : ""
Component.onCompleted: {
print("Context Active: " + context1.active)
}
onActiveChanged: {
print("Context Active: " + context1.active)
}
2014-10-30 14:29:14 +00:00
}
property OfonoSimManager simManager: ofonoSimManager
OfonoSimManager {
id: ofonoSimManager
2014-11-13 15:20:06 +00:00
modemPath: ofonoManager.modems.length > 0 ? ofonoManager.modems[0] : ""
2014-10-30 14:29:14 +00:00
}
OfonoNetworkOperator {
id: netop
2014-10-30 14:29:14 +00:00
}
property VoiceCallManager manager: VoiceCallManager {
id: manager
onActiveVoiceCallChanged: {
if (activeVoiceCall) {
dialerOverlay.open();
//main.activeVoiceCallPerson = people.personByPhoneNumber(activeVoiceCall.lineId);
dialerOverlay.item.numberEntryText = activeVoiceCall.lineId;
} else {
dialerOverlay.close();
dialerOverlay.item.numberEntryText = '';
//main.activeVoiceCallPerson = null;
}
}
onError: {
console.log('*** QML *** VCM ERROR: ' + message);
}
}
2014-09-29 19:38:56 +00:00
//pass the focus to the containment, so it can react to homescreen activate/inactivate
Connections {
target: desktop
onActiveChanged: {
containment.focus = desktop.active;
}
}
Loader {
id: dialerOverlay
function open() {
source = Qt.resolvedUrl("Dialer.qml")
dialerOverlay.item.open();
}
function close() {
dialerOverlay.item.close();
}
2014-10-30 14:29:14 +00:00
anchors {
left: parent.left
top: statusPanel.bottom
right: parent.right
bottom: parent.bottom
}
z: 20
}
Loader {
id: pinOverlay
2014-09-29 19:38:56 +00:00
anchors {
left: parent.left
top: statusPanel.bottom
right: parent.right
bottom: parent.bottom
}
z: 21
source: simManager.pinRequired != OfonoSimManager.NoPin ? Qt.resolvedUrl("Pin.qml") : ""
2014-09-29 19:38:56 +00:00
}
2014-09-29 11:32:55 +00:00
Component.onCompleted: {
//configure the view behavior
2014-09-29 14:49:24 +00:00
if (desktop) {
desktop.width = width;
desktop.height = height;
}
2014-09-29 11:32:55 +00:00
}
}