diff --git a/applets/org.kde.active.connman/contents/ui/WifiExpandingBox.qml b/applets/org.kde.active.connman/contents/ui/WifiExpandingBox.qml index 579a1fd1..5ab9d44f 100644 --- a/applets/org.kde.active.connman/contents/ui/WifiExpandingBox.qml +++ b/applets/org.kde.active.connman/contents/ui/WifiExpandingBox.qml @@ -1,602 +1,602 @@ /* * Copyright 2011 Intel Corporation. * * This program is licensed under the terms and conditions of the * Apache License, version 2.0. The full text of the Apache License is at * http://www.apache.org/licenses/LICENSE-2.0 */ import Qt 4.7 import MeeGo.Labs.Components 0.1 as Labs import MeeGo.Settings 0.1 import MeeGo.Connman 0.1 import MeeGo.Components 0.1 as MeeGo import org.kde.plasma.components 0.1 as PlasmaComponents import "helper.js" as WifiHelper MeeGo.ExpandingBox { id: container property int containerHeight: 80 height: containerHeight //expandedHeight: detailsItem.height property NetworkListModel listModel: null property QtObject networkItem: null property Item page: null property int currentIndex property string ssid: "" property string status: "" property int statusint: 0 property string ipaddy: "" property string subnet: "" property string gateway: "" property string dns: "" property string hwaddy: "" property string security: "" property string method: "" property variant nameservers: [] /// TODO FIXME: this is bad but connman doesn't currently expose a property to indicate whether /// a service is the default route or not: property bool defaultRoute: false property bool finished: false property variant signalIndicatorIcons: ["wifi-signal-weak", "wifi-signal-good", "wifi-signal-strong", "wifi-signal-weak-connected", "wifi-signal-good-connected", "wifi-signal-strong-connected", "wifi-secure-signal-weak", "wifi-secure-signal-good", "wifi-secure-signal-strong", "wifi-secure-signal-weak-connected", "wifi-secure-signal-good-connected", "wifi-secure-signal-strong-connected"] property int signalIndicatorIconIndex: getSignalIndicatorIconIndex() function getSignalIndicatorIconIndex() { var index = 0; //Caclulates index offsets index += container.statusint < NetworkItemModel.StateReady ? 0:3 index += container.security == "" || container.security == "none" ? 0:6 index += container.networkItem.strength <= 0 ||container.networkItem.strength > 100 ? 0 : Math.ceil(container.networkItem.strength/100 * 3) - 1 if (index < signalIndicatorIcons.length) return index; else return 0; } MeeGo.Theme { id: meegoTheme } Component.onCompleted: { WifiHelper.connmanSecurityType["wpa"] = i18n("WPA"); WifiHelper.connmanSecurityType["rsn"] = i18n("WPA2"); WifiHelper.connmanSecurityType["wep"] = i18n("WEP"); WifiHelper.connmanSecurityType["ieee8021x"] = i18n("RADIUS"); WifiHelper.connmanSecurityType["psk"] = i18n("WPA2"); WifiHelper.connmanSecurityType["none"] = ""; WifiHelper.IPv4Type["dhcp"] = i18n("DHCP") WifiHelper.IPv4Type["static"] = i18n("Static") finished = true; } onSecurityChanged: { //securityText.text = container.connmanArray[container.security] } Row { id: headerArea spacing: 8 anchors.top: parent.top height: container.containerHeight anchors.left: parent.left anchors.leftMargin: 20 Image { id: checkbox anchors.verticalCenter: parent.verticalCenter source: "image://themedimage/images/btn_tickbox_dn" visible: container.defaultRoute } Rectangle { id: checkboxFiller width: checkbox.width height: checkbox.height //anchors.verticalCenter: parent.verticalCenter color: "transparent" visible: !checkbox.visible } Image { id: signalIndicator anchors.verticalCenter: parent.verticalCenter source: { if(networkItem.type == "wifi" || networkItem.type == "cellular") return "image://themedimage/icons/settings/" + signalIndicatorIcons[signalIndicatorIconIndex] else return "image://themedimage/icons/settings/wifi-signal-strong-connected" } } Column { id: textLabelColumn spacing: 5 anchors.verticalCenter: parent.verticalCenter width: parent.width Text { id: mainText text: status == "" ? ssid:(ssid + " - " + status) font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal width: container.width - 40 elide: Text.ElideRight } Text { id: securityText text: finished ? WifiHelper.connmanSecurityType[container.security] : "" font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal visible: text != "" width: parent.width elide: Text.ElideRight } } } onStatusintChanged: { if(statusint == NetworkItemModel.StateIdle) { status = "" } else if(statusint == NetworkItemModel.StateFailure) { status = i18n("Failed to Connect") } else if(statusint == NetworkItemModel.StateAssociation) { status = i18n("Associating") } else if(statusint == NetworkItemModel.StateConfiguration) { status = i18n("Configuring") } else if(statusint == NetworkItemModel.StateReady) { status = i18n("Connected") } else if(statusint == NetworkItemModel.StateOnline) { status = i18n("Connected") } else { console.log("state type: " + statusint + "==" + NetworkItemModel.StateIdle) } if(statusint == NetworkItemModel.StateIdle || statusint == NetworkItemModel.StateFailure ) { detailsComponent = passwordArea } else if(statusint == NetworkItemModel.StateReady || statusint == NetworkItemModel.StateOnline) { detailsComponent = detailsArea expanded = false } else if(statusint == NetworkItemModel.StateAssociation || statusint == NetworkItemModel.StateConfiguration){ detailsComponent = passwordArea } } /*onExpandedChanged: { if(expanded && security == "none" && statusint < NetworkItemModel.StateReady) { listModel.connectService(ssid, security, ""); } }*/ Component { id: removeConfirmAreaComponent Column { id: removeConfirmArea width: parent.width spacing: 10 Component.onCompleted: { console.log("height: !!!! " + height) } Text { text: i18n("Do you want to remove %1 ? This action will forget any passwords and you will no longer be automatically connected to %2").arg(networkItem.name).arg(networkItem.name); font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal wrapMode: Text.WordWrap width: parent.width } Row { anchors.horizontalCenter: parent.horizontalCenter height: childrenRect.height PlasmaComponents.Button { id: yesDelete text: i18n("Yes, Delete") width: removeConfirmArea.width / 2 - 20 height: 50 onClicked: { networkItem.passphrase="" networkItem.removeService(); container.expanded = false; container.detailsComponent = passwordArea } } PlasmaComponents.Button { id: noSave text: i18n("No, Save") width: removeConfirmArea.width / 2 - 20 height: 50 onClicked: { container.expanded = false; container.detailsComponent = detailsArea } } } } } Component { id: detailsArea Grid { id: settingsGrid spacing: 15 columns: 2 anchors.top: parent.top anchors.left: parent.left anchors.leftMargin: 20 anchors.right: parent.right anchors.rightMargin: 20 height: childrenRect.height property bool editable: container.networkItem.method != "dhcp" && container.networkItem.type != "cellular" PlasmaComponents.Button { id: disconnectButton text: i18n("Disconnect") height: 50 - width: parent.width + width: parent.width / 2 onClicked: { networkItem.disconnectService(); container.expanded = false; } } PlasmaComponents.Button { id: removeConnection text: i18n("Remove connection") height: 50 - width: parent.width + width: parent.width / 2 onClicked: { container.detailsComponent = removeConfirmAreaComponent } } Text { id: connectByLabel text: i18n("Connect by:") font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal - width: parent.width + width: parent.width / 2 wrapMode: Text.WrapAtWordBoundaryOrAnywhere } /*MeeGo.DropDown { id: dropdown - width: parent.width + width: parent.width / 2 property string method visible: container.networkItem.type != "cellular" model: finished ? [ WifiHelper.IPv4Type["dhcp"], WifiHelper.IPv4Type["static"] ]: [] payload: finished ? [ WifiHelper.IPv4Type["dhcp"], WifiHelper.IPv4Type["static"] ]: [] selectedIndex: finished && networkItem.method == "dhcp" ? 0:1 replaceDropDownTitle: true method: selectedIndex == 0 ? "dhcp":"static" Connections { target: networkItem onMethodChanged: { settingsGrid.editable = networkItem.method != "dhcp" && networkItem.type != "cellular" dropdown.selectedIndex = networkItem.method == "dhcp" ? 0:1 dropdown.method = dropdown.selectedIndex == 0 ? "dhcp":"static" } } }*/ Text { - width: parent.width + width: parent.width / 2 font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal text: finished ? WifiHelper.IPv4Type[networkItem.method] : "" } Text { id: ipaddyLabel font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal text: i18n("IP Address:") - width: parent.width + width: parent.width / 2 wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Text { font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal text: container.ipaddy visible: !editable - width: parent.width + width: parent.width / 2 } PlasmaComponents.TextField { id: ipaddyEdit - width: parent.width + width: parent.width / 2 text: container.ipaddy visible: editable //textInput.inputMask: "000.000.000.000;_" } Text { font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal id: subnetMaskLabel text: i18n("Subnet mask:") - width: parent.width + width: parent.width / 2 wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Text { font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal text: container.subnet visible: !editable - width: parent.width + width: parent.width / 2 } PlasmaComponents.TextField { id: subnetEdit - width: parent.width + width: parent.width / 2 text: container.subnet visible: editable //textInput.inputMask: "000.000.000.000;_" } Text { id: gatewayLabel text: i18n("Gateway") font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal - width: parent.width + width: parent.width / 2 wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Text { text: container.gateway font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal visible: !editable - width: parent.width + width: parent.width / 2 } PlasmaComponents.TextField { id: gatewayEdit - width: parent.width + width: parent.width / 2 text: container.gateway visible: editable //textInput.inputMask: "000.000.000.000;_" } Text { id: dnsLabel font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal text: i18n("DNS:") - width: parent.width + width: parent.width / 2 wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Grid { id: nameserverstextedit - width: parent.width + width: parent.width / 2 //height: 20 columns: 2 Repeater { model: container.nameservers delegate: Text { width: parent.width text: modelData font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal } } } Text { id: hwaddyLabel text: i18n("Hardware address:") font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal visible: container.networkItem.type != "cellular" - width: parent.width + width: parent.width / 2 wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Text { font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal - width: parent.width + width: parent.width / 2 text: container.hwaddy visible: container.networkItem.type != "cellular" } Labs.GConfItem { id: connectionsHacksGconf defaultValue: false key: "/meego/ux/settings/connectionshacks" } Text { id: securityLabel visible: connectionsHacksGconf.value font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal text: i18n("Security: ") - width: parent.width + width: parent.width / 2 wrapMode: Text.WrapAtWordBoundaryOrAnywhere } Text { visible: connectionsHacksGconf.value - width: parent.width + width: parent.width / 2 font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal text: WifiHelper.connmanSecurityType[container.security] } Text { id: strengthLabel font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal visible: connectionsHacksGconf.value - width: parent.width + width: parent.width / 2 wrapMode: Text.WrapAtWordBoundaryOrAnywhere text: i18n("Strength: ") } Text { font.pixelSize: meegoTheme.fontPixelSizeNormal color: meegoTheme.fontColorNormal visible: connectionsHacksGconf.value - width: parent.width + width: parent.width / 2 text: container.networkItem.strength } PlasmaComponents.Button { id: applyButton text: i18n("Apply") height: 50 - width: parent.width + width: parent.width / 2 onClicked: { networkItem.method = dropdown.method networkItem.ipaddress = ipaddyEdit.text networkItem.netmask = subnetEdit.text networkItem.gateway = gatewayEdit.text } } PlasmaComponents.Button { id: cancelButton text: i18n("Cancel") height: 50 - width: parent.width + width: parent.width / 2 onClicked: { container.expanded = false dropdown.selectedIndex = networkItem.method == "dhcp" ? 0:1 ipaddyEdit.text = networkItem.ipaddress subnetEdit.text = networkItem.netmask gatewayEdit.text = networkItem.gateway } } } } Component { id: passwordArea Item { id: passwordGrid anchors.right: parent.right anchors.left: parent.left anchors.margins: 20 height: childrenRect.height property bool passwordRequired: container.networkItem.type == "wifi" && container.security != "none" && container.security != "ieee8021x" Column { width: parent.width spacing: 10 Row { height: childrenRect.height spacing: 10 PlasmaComponents.TextField { id: passwordTextInput //textInput.echoMode: TextInput.Normal visible: passwordGrid.passwordRequired placeholderText: i18n("Type password here") width: passwordGrid.width / 2 text: container.networkItem.passphrase } PlasmaComponents.Button { id: setupButton height: 50 text: i18n("Setup") visible: container.networkItem.type == "cellular" onClicked: { addPage(cellularSettings) } } PlasmaComponents.Button { id: connectButtonOfAwesome height: 50 property bool shouldBeActive: container.statusint != NetworkItemModel.StateAssociation && container.statusint != NetworkItemModel.StateConfiguration enabled: shouldBeActive text: i18n("Connect") onClicked: { if(container.networkItem.type == "wifi") { container.networkItem.passphrase = passwordTextInput.text; container.listModel.connectService(container.ssid, container.security, passwordTextInput.text) } else { container.networkItem.connectService(); } } } } Row { height: childrenRect.height spacing: 10 PlasmaComponents.CheckBox { id: showPasswordCheckbox visible: passwordGrid.passwordRequired checked: true onCheckedChanged: { if(checked) passwordTextInput.textInput.echoMode = TextInput.Normal else passwordTextInput.textInput.echoMode = TextInput.Password } } Text { visible: passwordGrid.passwordRequired text: i18n("Show password") font.pixelSize: 14//theme_fontPixelSizeLarge width: 100 height: showPasswordCheckbox.height verticalAlignment: Text.AlignVCenter } } } } } Component { id: cellularSettings CellularSettings { networkItem: container.networkItem } } } diff --git a/applets/org.kde.active.connman/contents/ui/main.qml b/applets/org.kde.active.connman/contents/ui/main.qml old mode 100755 new mode 100644 index 0ac10e61..100099b6 --- a/applets/org.kde.active.connman/contents/ui/main.qml +++ b/applets/org.kde.active.connman/contents/ui/main.qml @@ -1,61 +1,77 @@ /* * Copyright 2011 Marco Martin. * * This program is licensed under the terms and conditions of the * Apache License, version 2.0. The full text of the Apache License is at * http://www.apache.org/licenses/LICENSE-2.0 */ import QtQuick 1.0 import MeeGo.Settings 0.1 import MeeGo.Labs.Components 0.1 as Labs import MeeGo.Components 0.1 import MeeGo.Connman 0.1 Item { id: main property int minimumWidth: 450 property int minimumHeight: 400 NetworkListModel { id: networkListModel Component.onCompleted: { networkListModel.requestScan(); } onStateChanged: { if (state == "online") { plasmoid.setPopupIconByName("network-wireless-100") } else { plasmoid.setPopupIconByName("network-wireless-0") } } } ListView { anchors.fill:parent model: networkListModel delegate: Component { id: availableNetworkItem WifiExpandingBox { listModel: networkListModel - page: container width: main.width ssid: name networkItem: model.networkitemmodel currentIndex: model.index statusint: model.state hwaddy: deviceAddress security: model.security gateway: model.gateway ipaddy: model.ipaddress subnet: model.netmask method: model.method nameservers: model.nameservers defaultRoute: model.defaultRoute + + // This signal is emmited before the expanded size + // has been updated. + onExpandedChanged: { + updateSizeTimer.running = true + } + + Timer { + id: updateSizeTimer + repeat: false + running: false + interval: 100 + + onTriggered: { + main.minimumHeight = height + } + } } } } } diff --git a/applets/windowstrip/windowstrip.cpp b/applets/windowstrip/windowstrip.cpp index e67acef1..9d108fc9 100644 --- a/applets/windowstrip/windowstrip.cpp +++ b/applets/windowstrip/windowstrip.cpp @@ -1,163 +1,173 @@ /*************************************************************************** * * * Copyright 2011 Sebastian Kügler * * * * 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 "windowstrip.h" #include #include #include #include #include #include #include #include #include #include #include #include #include WindowStrip::WindowStrip(QGraphicsWidget *parent) : Plasma::DeclarativeWidget(parent) { // Run the frameupdater once every 20 msec, // so KWin gets in the ideal case updated // rects for every frame m_frameUpdater.setInterval(20); // The frameController is used to stop updating the // frame after a timeout after the animation has stopped m_updateController.setSingleShot(true); m_updateController.setInterval(200); connect(&m_frameUpdater, SIGNAL(timeout()), SLOT(updateFrame())); connect(&m_updateController, SIGNAL(timeout()), &m_frameUpdater, SLOT(stop())); // allow the QML to know the name of the shell to compare against the window. if (QDeclarativeContext *context = engine()->rootContext()) { context->setContextProperty("shellName", KGlobal::mainComponent().aboutData()->appName()); } //setThumbnailRects("Tokamak 5"); setQmlPath(KStandardDirs::locate("data", "plasma/plasmoids/org.kde.windowstrip/WindowStrip.qml")); m_windowFlicker = rootObject()->findChild("windowFlicker"); - connect(m_windowFlicker, SIGNAL(childrenPositionsChanged()), - this, SLOT(scrollChanged())); - connect(m_windowFlicker, SIGNAL(contentXChanged()), - this, SLOT(scrollChanged())); + if (m_windowFlicker) { + connect(m_windowFlicker, SIGNAL(childrenPositionsChanged()), + this, SLOT(scrollChanged())); + connect(m_windowFlicker, SIGNAL(contentXChanged()), + this, SLOT(scrollChanged())); + } scrollChanged(); } WindowStrip::~WindowStrip() { hideThumbnails(); } void WindowStrip::init() { QList< WId > windows = KWindowSystem::windows(); // use this once the kdelibs branch export-mru-window-list is merged to master //QList< WId > windows = KWindowSystem::mostRecentlyUsedOrder(); } void WindowStrip::showThumbnails() { QList translatedWindows; foreach (QRect windowRect, m_windows.values()) { translatedWindows << windowRect.translated(m_windowsOffset); } Plasma::WindowEffects::showWindowThumbnails(m_desktop, m_windows.keys(), translatedWindows); //kDebug() << "/// all shown" << m_windows.keys() << translatedWindows; } void WindowStrip::hideThumbnails() { Plasma::WindowEffects::showWindowThumbnails(m_desktop); kDebug() << "/// all hidden "; } void WindowStrip::scrollChanged() { //kDebug() << "elapsed: " << m_time.elapsed(); if (m_time.elapsed() < 50) { //kDebug() << "skipping"; //return; } // the view has changed, update the windows, // start the updating timer, and start the controller // to kill the updater after a while updateFrame(); updateWindows(); m_updateController.start(); m_frameUpdater.start(); } void WindowStrip::updateWindows() { + if (!m_windowFlicker) { + return; + } + QVariant dataX = m_windowFlicker->property("contentX"); QVariant dataY = m_windowFlicker->property("contentY"); //kWarning()<<"new X"<(parentItem())->view(); if (view) { m_desktop = view->effectiveWinId(); } else { m_desktop = 0; } m_windowsOffset = -QPoint(dataX.value(), dataY.value()); showThumbnails(); //kDebug() << "duration: " << m_time.elapsed(); //m_timer.restart(); } void WindowStrip::updateFrame() { + if (!m_windowFlicker) { + return; + } + QVariant data = m_windowFlicker->property("childrenPositions"); QList thumbnailsInfo = data.value >(); //kDebug() << "window positions" << thumbnailsInfo; QPoint offset; QGraphicsView *v = static_cast(parentItem())->view(); if (v) { offset = v->mapFromScene(m_windowFlicker->mapToScene(0,0)); } m_windows.clear(); foreach (QVariant windowData, thumbnailsInfo) { const QVariantMap windowInfo = windowData.value(); WId winId = windowInfo["winId"].value().toInt(); m_windows[winId] = QRect(windowInfo["x"].value()+offset.x(), windowInfo["y"].value()+offset.y(), windowInfo["width"].value(), windowInfo["height"].value()); } update(); } #include "windowstrip.moc" diff --git a/applications/about/package/contents/data/authors.html b/applications/about/package/contents/data/authors.html index 00de783a..1feb1567 100644 --- a/applications/about/package/contents/data/authors.html +++ b/applications/about/package/contents/data/authors.html @@ -1,36 +1,42 @@

Plasma Active has been made possible thanks to the participation of the following individuals ... -

    -
  • Aaron Seigo
  • -
  • Eva Brucherseifer
  • -
  • Fania Bremmer
  • -
  • Ivan Čukić
  • -
  • Javier Llorente
  • -
  • Karlheinz Hohm
  • -
  • Marco Martin
  • -
  • Martin Gräßlin
  • -
  • Maurice de la Ferté
  • -
  • Sebastian Kügler
  • -
  • Stefan Werden
  • -
  • Stephan Binner
  • -
  • Thomas Pfeiffer
  • +

    Founding members: +

      +
    • Aaron Seigo, KDE
    • +
    • Eva Brucherseifer, basysKom
    • +
    • Marco Martin, basysKom
    • +
    • Sebastian Kügler, open-slx
    • +
    • Stefan Werden, open-slx
    • +
    +

    Contributors: +

      +
    • Carl Symons, KDE
    • +
    • Fania Bremmer, basysKom
    • +
    • Ivan Čukić, basysKom
    • +
    • Javier Llorente, basysKom
    • +
    • Karlheinz Hohm, basysKom
    • +
    • Lamarque V. Souza, basysKom
    • +
    • Martin Gräßlin, KDE
    • +
    • Maurice de la Ferté, basysKom
    • +
    • Stephan Binner, basysKom
    • +
    • Thomas Pfeiffer, KDE

    ... as well as the following organizations:

      -
    • basysKom GmbH: Initiating, supporting and maintaining Contour, an innovative usage paradigm for digital devices.
    • +
    • basysKom GmbH supports Plasma Active by contributing UX design, development and system integration. basysKom provides Mer and MeeGo images for easy installation.
    • OpenSLX: providing OS images and build service support.
    • KDE: 15+ years of countless individuals and companies working on various technologies that Plasma Active relies on.
    • Qt Dev Frameworks: for providing the best multi-platform toolkit available.

    diff --git a/applications/about/package/contents/ui/FlickableWebView.qml b/applications/about/package/contents/ui/FlickableWebView.qml index 4abc4cde..9919d2ab 100644 --- a/applications/about/package/contents/ui/FlickableWebView.qml +++ b/applications/about/package/contents/ui/FlickableWebView.qml @@ -1,244 +1,249 @@ /**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the Technology Preview License Agreement accompanying ** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** If you have questions regarding the use of this file, please contact ** Nokia at qt-info@nokia.com. ** ** ** ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ import QtQuick 1.0 import QtWebKit 1.0 import org.kde.plasma.components 0.1 as PlasmaComponents Item { property alias title: webView.title property alias icon: webView.icon property alias progress: webView.progress property alias url: webView.url property alias back: webView.back property alias stop: webView.stop property alias reload: webView.reload property alias forward: webView.forward Flickable { id: flickable anchors.fill: parent signal newWindowRequested(string url) width: parent.width contentWidth: Math.max(parent.width,webView.width) contentHeight: Math.max(parent.height,webView.height) interactive: (webView.height > height) || (webView.height > height) pressDelay: 200 onWidthChanged : { // Expand (but not above 1:1) if otherwise would be smaller that available width. if (width > webView.width*webView.contentsScale && webView.contentsScale < 1.0) webView.contentsScale = width / webView.width * webView.contentsScale; } WebView { id: webView objectName: "webViewImplementation" transformOrigin: Item.TopLeft settings.javascriptEnabled: true width: flickable.width javaScriptWindowObjects: QtObject { property string activeVersion: runtimeInfoActiveVersion property string kdeVersion: runtimeInfoKdeVersion property string osVersion: runtimeInfoOsVersion WebView.windowObjectName: "runtimeInfo" } settings.standardFontFamily: "Droid Sans Fallback" //FIXME: glorious hack just to obtain a signal of the url of the new requested page newWindowComponent: Component { Item { id: newPageComponent WebView { id: newWindow onUrlChanged: { if (url != "") { flickable.newWindowRequested(url) var newObject = Qt.createQmlObject('import QtQuick 1.0; Item {}', webView); newPageComponent.parent = newObject newObject.destroy() } } } } } newWindowParent: webView function fixUrl(url) { if (url == "") return url if (url[0] == "/") return "file://"+url if (url.indexOf(":")<0) { if (url.indexOf(".")<0 || url.indexOf(" ")>=0) { // Fall back to a search engine; hard-code Wikipedia return "http://en.wikipedia.org/w/index.php?search="+url } else { return "http://"+url } } return url } url: fixUrl(webBrowser.urlString) smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions focus: true onAlert: console.log(message) function doZoom(zoom,centerX,centerY) { if (centerX) { var sc = zoom*contentsScale; scaleAnim.to = sc; flickVX.from = flickable.contentX flickVX.to = Math.max(0,Math.min(centerX-flickable.width/2,webView.width*sc-flickable.width)) finalX.value = flickVX.to flickVY.from = flickable.contentY flickVY.to = Math.max(0,Math.min(centerY-flickable.height/2,webView.height*sc-flickable.height)) finalY.value = flickVY.to quickZoom.start() } } Keys.onLeftPressed: webView.contentsScale -= 0.1 Keys.onRightPressed: webView.contentsScale += 0.1 preferredWidth: flickable.width preferredHeight: flickable.height contentsScale: 1 onContentsSizeChanged: { // zoom out contentsScale = Math.min(1,flickable.width / contentsSize.width) } onUrlChanged: { // got to topleft flickable.contentX = 0 flickable.contentY = 0 + + if (String(url).substr(0, 6) != "file:/") { + Qt.openUrlExternally(url) + webView.back.trigger() + } } onDoubleClick: { preferredWidth = flickable.width - 50; if (!heuristicZoom(clickX,clickY,2.0)) { var zf = flickable.width / contentsSize.width if (zf >= contentsScale) zf = 2.0*contentsScale // zoom in (else zooming out) doZoom(zf,clickX*zf,clickY*zf) } } SequentialAnimation { id: quickZoom PropertyAction { target: webView property: "renderingEnabled" value: false } ParallelAnimation { NumberAnimation { id: scaleAnim target: webView property: "contentsScale" // the to property is set before calling easing.type: Easing.Linear duration: 200 } NumberAnimation { id: flickVX target: flickable property: "contentX" easing.type: Easing.Linear duration: 200 from: 0 // set before calling to: 0 // set before calling } NumberAnimation { id: flickVY target: flickable property: "contentY" easing.type: Easing.Linear duration: 200 from: 0 // set before calling to: 0 // set before calling } } // Have to set the contentXY, since the above 2 // size changes may have started a correction if // contentsScale < 1.0. PropertyAction { id: finalX target: flickable property: "contentX" value: 0 // set before calling } PropertyAction { id: finalY target: flickable property: "contentY" value: 0 // set before calling } PropertyAction { target: webView property: "renderingEnabled" value: true } } onZoomTo: doZoom(zoom,centerX,centerY) } } PlasmaComponents.ScrollBar { flickableItem: flickable orientation: Qt.Horizontal } PlasmaComponents.ScrollBar { flickableItem: flickable orientation: Qt.Vertical } } diff --git a/applications/about/src/main.cpp b/applications/about/src/main.cpp index e4198a1c..eb75e021 100644 --- a/applications/about/src/main.cpp +++ b/applications/about/src/main.cpp @@ -1,69 +1,69 @@ /*************************************************************************** * * * Copyright 2011 Sebastian Kügler * * Copyright 2011 Marco Martin * * * * 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 . * ***************************************************************************/ // KDE #include #include #include #include #include #include #include // Own #include "aboutapp.h" static const char description[] = I18N_NOOP("About Plasma Active"); -static const char version[] = "1.9"; +static const char version[] = "2.0"; int main(int argc, char **argv) { KAboutData about("active-aboutapp", 0, ki18n("About Plasma Active"), version, ki18n(description), KAboutData::License_GPL, ki18n("Copyright 2011 Marco Martin"), KLocalizedString(), 0, "mart@kde.org"); about.addAuthor( ki18n("Marco Martin"), KLocalizedString(), "mart@kde.org" ); about.setProgramIconName("active-about"); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; #ifndef QT_NO_OPENGL options.add("opengl", ki18n("use a QGLWidget for the viewport")); #endif KCmdLineArgs::addCmdLineOptions(options); KApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); bool useGL = args->isSet("opengl"); if (!useGL) { //use plasmarc to share this with plasma-windowed KConfigGroup cg(KSharedConfig::openConfig("plasmarc"), "General"); useGL = cg.readEntry("UseOpenGl", true); } AboutApp *mainWindow = new AboutApp(); mainWindow->setUseGL(useGL); mainWindow->show(); args->clear(); return app.exec(); } diff --git a/applications/about/src/view.cpp b/applications/about/src/view.cpp index 90411665..ca1eaff7 100644 --- a/applications/about/src/view.cpp +++ b/applications/about/src/view.cpp @@ -1,130 +1,130 @@ /*************************************************************************** * * * Copyright 2011 Sebastian Kügler * * Copyright 2011 Marco Martin * * * * 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 "view.h" #include #include #include #include #include #include #include #include #include #include #include AppView::AppView(QWidget *parent) : QDeclarativeView(parent), m_rootItem(0), m_useGL(false) { // avoid flicker on show setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); viewport()->setAttribute(Qt::WA_OpaquePaintEvent); viewport()->setAttribute(Qt::WA_NoSystemBackground); setResizeMode(QDeclarativeView::SizeRootObjectToView); KDeclarative kdeclarative; kdeclarative.setDeclarativeEngine(engine()); kdeclarative.initialize(); //binds things like kconfig and icons kdeclarative.setupBindings(); //FIXME: find a prettier way QString fn; if (QFile::exists("/etc/image-release")) { fn = "/etc/image-release"; } else { fn = "/etc/issue"; } QFile f(fn); f.open(QIODevice::ReadOnly); const QString osVersion = f.readLine(); - rootContext()->setContextProperty("runtimeInfoActiveVersion", "1.0"); + rootContext()->setContextProperty("runtimeInfoActiveVersion", "2.0"); rootContext()->setContextProperty("runtimeInfoKdeVersion", KDE::versionString()); rootContext()->setContextProperty("runtimeInfoOsVersion", osVersion); Plasma::PackageStructure::Ptr structure = Plasma::PackageStructure::load("Plasma/Generic"); m_package = new Plasma::Package(QString(), "org.kde.active.aboutapp", structure); //kDebug() << "Loading QML File:" << qmlFile; setSource(QUrl(m_package->filePath("mainscript"))); //kDebug() << "Plugin pathes:" << engine()->pluginPathList(); show(); onStatusChanged(status()); //connect(engine(), SIGNAL(signalHandlerException(QScriptValue)), this, SLOT(exception())); connect(this, SIGNAL(statusChanged(QDeclarativeView::Status)), this, SLOT(onStatusChanged(QDeclarativeView::Status))); } AppView::~AppView() { } void AppView::setUseGL(const bool on) { #ifndef QT_NO_OPENGL if (on) { QGLWidget *glWidget = new QGLWidget; glWidget->setAutoFillBackground(false); setViewport(glWidget); } #endif m_useGL = on; } bool AppView::useGL() const { return m_useGL; } void AppView::onStatusChanged(QDeclarativeView::Status status) { if (status == QDeclarativeView::Ready) { if (!m_rootItem) { // Note that "webView" is defined as objectName in the QML file m_rootItem = rootObject(); if (m_rootItem) { } else { kError() << "aboutapp component not found."; } } } else if (status == QDeclarativeView::Error) { foreach (const QDeclarativeError &e, errors()) { kWarning() << "error in QML: " << e.toString() << e.description(); } } else if (status == QDeclarativeView::Loading) { //kDebug() << "Loading."; } } #include "view.moc" diff --git a/applications/imageviewer/package/contents/ui/Browser.qml b/applications/imageviewer/package/contents/ui/Browser.qml index 1fd71fd5..6b6a5324 100644 --- a/applications/imageviewer/package/contents/ui/Browser.qml +++ b/applications/imageviewer/package/contents/ui/Browser.qml @@ -1,130 +1,130 @@ /* * Copyright 2011 Marco Martin * * 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 1.0 import org.kde.metadatamodels 0.1 as MetadataModels import org.kde.plasma.components 0.1 as PlasmaComponents import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.mobilecomponents 0.1 as MobileComponents import org.kde.plasma.slccomponents 0.1 as SlcComponents import org.kde.qtextracomponents 0.1 PlasmaComponents.Page { anchors { fill: parent topMargin: toolBar.height } tools: Item { width: parent.width height: childrenRect.height PlasmaCore.DataSource { id: hotplugSource engine: "hotplug" connectedSources: sources } PlasmaCore.DataSource { id: devicesSource engine: "soliddevice" connectedSources: hotplugSource.sources } PlasmaCore.DataModel { id: devicesModel dataSource: hotplugSource } Row { anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter spacing: 8 opacity: (imageViewer.state == "browsing") ? 1 : 0 MobileComponents.IconButton { icon: QIcon("drive-harddisk") opacity: resultsGrid.model == metadataModel ? 0.2 : 1 width: 48 height: 48 onClicked: { resultsGrid.model = metadataModel } } Repeater { model: devicesModel MobileComponents.IconButton { id: deviceButton icon: QIcon(model["icon"]) //FIXME: use the declarative branch in workspace that tells about removable visible: devicesSource.data[udi]["Removable"] == true opacity: (dirModel.url == devicesSource.data[udi]["File Path"] && resultsGrid.model == dirModel) ? 1 : 0.2 width: 48 height: 48 onClicked: { dirModel.url = devicesSource.data[udi]["File Path"] resultsGrid.model = dirModel } } } } MobileComponents.ViewSearch { id: searchBox anchors { left: parent.left right: parent.right verticalCenter: parent.verticalCenter } onSearchQueryChanged: { metadataModel.extraParameters["nfo:fileName"] = searchBox.searchQuery } } } MobileComponents.IconGrid { id: resultsGrid anchors.fill: parent model: metadataModel delegateWidth: 130 delegateHeight: 120 delegate: MobileComponents.ResourceDelegate { id: resourceDelegate className: model["className"]?model["className"]:"Image" width: 130 height: 120 infoLabelVisible: false property string label: model["label"]?model["label"]:model["display"] onPressAndHold: { resourceInstance.uri = model["url"]?model["url"]:model["resourceUri"] resourceInstance.title = model["label"] } onClicked: { if (mimeType == "inode/directory") { dirModel.url = model["url"] resultsGrid.model = dirModel - } else { + } else if (!mainStack.busy) { loadImage(model["url"]) } } } } } diff --git a/applications/imageviewer/package/contents/ui/imageviewer.qml b/applications/imageviewer/package/contents/ui/imageviewer.qml index d919edb3..b3c6269d 100644 --- a/applications/imageviewer/package/contents/ui/imageviewer.qml +++ b/applications/imageviewer/package/contents/ui/imageviewer.qml @@ -1,107 +1,106 @@ /* * Copyright 2011 Marco Martin * * 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 1.0 import org.kde.metadatamodels 0.1 as MetadataModels import org.kde.plasma.components 0.1 as PlasmaComponents import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.mobilecomponents 0.1 as MobileComponents import org.kde.plasma.slccomponents 0.1 as SlcComponents import org.kde.qtextracomponents 0.1 Image { id: imageViewer objectName: "imageViewer" source: "image://appbackgrounds/standard" fillMode: Image.Tile state: "browsing" width: 360 height: 360 signal zoomIn signal zoomOut MobileComponents.Package { id: viewerPackage name: "org.kde.active.imageviewer" } MobileComponents.ResourceInstance { id: resourceInstance } function loadImage(path) { if (path.length == 0) { return } var viewerItem = mainStack.push(Qt.createComponent("ViewerPage.qml")) viewerItem.loadImage(path) } Timer { id: firstRunTimer interval: 300 repeat: false onTriggered: { loadImage(startupArguments[0]) } } MetadataModels.MetadataUserTypes { id: userTypes } MetadataModels.MetadataModel { id: metadataModel resourceType: "nfo:Image" sortBy: [userTypes.sortFields[itemGroup.category]] sortOrder: Qt.AscendingOrder property bool starting: true onStatusChanged: { if (status == MetadataModels.MetadataModel.Idle && starting) { - loadImage(startupArguments[0]) firstRunTimer.running = true starting = false } } } PlasmaComponents.ToolBar { id: toolBar } PlasmaComponents.PageStack { id: mainStack clip: false toolBar: toolBar initialPage: Qt.createComponent("Browser.qml") anchors.fill: parent } SlcComponents.SlcMenu { id: contextMenu } } diff --git a/applications/settings/modules/time/timesettings.cpp b/applications/settings/modules/time/timesettings.cpp index 904b7386..e8b651c8 100644 --- a/applications/settings/modules/time/timesettings.cpp +++ b/applications/settings/modules/time/timesettings.cpp @@ -1,439 +1,441 @@ /* Copyright 2005 S.R.Haque . Copyright 2009 David Faure Copyright 2011 Sebastian Kügler This file is part of the KDE project This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License version 2, as published by the Free Software Foundation. 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "timesettings.h" #include "timezone.h" #include "timezonesmodel.h" #include #include #include #include #include #include #include #include #include #include #include #include #include +#include #include #include #include #include #include K_PLUGIN_FACTORY(TimeSettingsFactory, registerPlugin();) K_EXPORT_PLUGIN(TimeSettingsFactory("active_settings_time")) #define FORMAT24H "%H:%M:%S" #define FORMAT12H "%l:%M:%S %p" // static bool localeLessThan (const QString &a, const QString &b) // { // return QString::localeAwareCompare(a, b) < 0; // } class TimeSettingsPrivate { public: TimeSettings *q; QString timeFormat; QString timezone; QObject *timeZonesModel; QString timeZoneFilter; QString currentTimeText; QTime currentTime; QDate currentDate; QTimer *timer; QString ntpServer; void initSettings(); void initTimeZones(); QString displayName(const KTimeZone &zone); KSharedConfigPtr localeConfig; KConfigGroup localeSettings; KTimeZones *timeZones; QList timezones; }; TimeSettings::TimeSettings(QObject *parent, const QVariantList &list) : SettingsModule(parent, list) { qmlRegisterType(); qmlRegisterType(); qmlRegisterType("org.kde.active.settings", 0, 1, "TimeSettings"); } TimeSettings::TimeSettings() { d = new TimeSettingsPrivate; d->q = this; d->timeZones = 0; d->timeZonesModel = 0; setTimeZone(KSystemTimeZones::local().name()); d->initSettings(); //d->initTimeZones(); setModule("org.kde.active.settings.time"); init(); // Just for testing that data gets through d->timer = new QTimer(this); d->timer->setInterval(1000); connect(d->timer, SIGNAL(timeout()), SLOT(timeout())); d->timer->start(); kDebug() << "TimeSettings module loaded."; } TimeSettings::~TimeSettings() { kDebug() << "========================== time destroy"; delete d; } void TimeSettingsPrivate::initTimeZones() { // Collect zones by localized city names, so that they can be sorted properly. QStringList cities; QStringList tz; QHash zonesByCity; if (!timeZones) { timeZones = KSystemTimeZones::timeZones(); // add UTC to the defaults default KTimeZone utc = KTimeZone::utc(); cities.append(utc.name()); zonesByCity.insert(utc.name(), utc); } //kDebug() << " TZ: cities: " << cities; const KTimeZones::ZoneMap zones = timeZones->zones(); QList _zones; QStandardItemModel *_zonesModel = new TimeZonesModel(q); for ( KTimeZones::ZoneMap::ConstIterator it = zones.begin(); it != zones.end(); ++it ) { const KTimeZone zone = it.value(); if (timeZoneFilter.isEmpty() || zone.name().contains(timeZoneFilter, Qt::CaseInsensitive)) { TimeZone *_zone = new TimeZone(zone); _zones.append(_zone); QStandardItem *item = new QStandardItem(_zone->name()); item->setData(_zone->name().split("/").first(), Qt::UserRole+1); _zonesModel->appendRow(item); } } kDebug() << "Found: " << _zones.count() << " timezones."; //qSort( cities.begin(), cities.end(), localeLessThan ); q->setTimeZones(_zones); q->setTimeZonesModel(_zonesModel); } QString TimeSettingsPrivate::displayName( const KTimeZone &zone ) { return i18n( zone.name().toUtf8() ).replace( '_', ' ' ); } void TimeSettingsPrivate::initSettings() { localeConfig = KSharedConfig::openConfig("kdeglobals", KConfig::SimpleConfig); localeSettings = KConfigGroup(localeConfig, "Locale"); //setTimeFormat(d->localeSettings.readEntry("TimeFormat", QString(FORMAT24H))); //setTimeFormat(d->localeSettings.readEntry("TimeFormat", QString(FORMAT12H))); q->setTimeFormat( localeSettings.readEntry( "TimeFormat", QString() ) ); KConfig _config( "kcmclockrc", KConfig::NoGlobals ); KConfigGroup config(&_config, "NTP"); QStringList servers = config.readEntry("servers", QString()).split(',', QString::SkipEmptyParts); if (!servers.isEmpty()) { ntpServer = servers.first(); } //FIXME: why? if (ntpServer.length() < 3) { ntpServer = QString(); } } void TimeSettings::timeout() { setCurrentTime(QTime::currentTime()); setCurrentDate(QDate::currentDate()); } QString TimeSettings::currentTimeText() { return d->currentTimeText; } QTime TimeSettings::currentTime() const { return d->currentTime; } void TimeSettings::setCurrentTime(const QTime ¤tTime) { if (d->currentTime != currentTime) { d->currentTime = currentTime; d->currentTimeText = KGlobal::locale()->formatTime(QTime::currentTime(), true); emit currentTimeChanged(); } } QDate TimeSettings::currentDate() const { return d->currentDate; } void TimeSettings::setCurrentDate(const QDate ¤tDate) { if (d->currentDate != currentDate) { d->currentDate = currentDate; emit currentDateChanged(); } } QString TimeSettings::ntpServer() const { return d->ntpServer; } void TimeSettings::setNtpServer(const QString &server) { if (d->ntpServer != server) { d->ntpServer = server; emit ntpServerChanged(); } } QStringList TimeSettings::availableNtpServers() const { QStringList servers; servers << "pool.ntp.org" << "asia.pool.ntp.org" << "europe.pool.ntp.org" << "north-america.pool.ntp.org" << "oceania.pool.ntp.org"; return servers; } QString TimeSettings::findNtpUtility() { QByteArray envpath = qgetenv("PATH"); if (!envpath.isEmpty() && envpath[0] == ':') { envpath = envpath.mid(1); } QString path = "/sbin:/usr/sbin:"; if (!envpath.isEmpty()) { path += QString::fromLocal8Bit(envpath); } else { path += QLatin1String("/bin:/usr/bin"); } QString ntpUtility; foreach (const QString &possible_ntputility, QStringList() << "ntpdate" << "rdate" ) { if (!((ntpUtility = KStandardDirs::findExe(possible_ntputility, path)).isEmpty())) { kDebug() << "ntpUtility = " << ntpUtility; return ntpUtility; } } kDebug() << "ntpUtility not found!"; return QString(); } void TimeSettings::saveTime() { QVariantMap helperargs; //TODO: enable NTP // Save the order, but don't duplicate! QStringList list; list << d->ntpServer; helperargs["ntp"] = true; helperargs["ntpServers"] = list; helperargs["ntpEnabled"] = !d->ntpServer.isEmpty(); QString ntpUtility = findNtpUtility(); helperargs["ntpUtility"] = ntpUtility; if (!d->ntpServer.isEmpty() && !ntpUtility.isEmpty()) { // NTP Time setting - done in helper kDebug() << "Setting date from time server " << list; } else { // User time setting QDateTime dt(d->currentDate, d->currentTime); kDebug() << "Set date " << dt; helperargs["date"] = true; helperargs["newdate"] = QString::number(dt.toTime_t()); helperargs["olddate"] = QString::number(::time(0)); } /*TODO: enable timeZones QStringList selectedZones(tzonelist->selection()); if (selectedZones.count() > 0) { QString selectedzone(selectedZones[0]); helperargs["tz"] = true; helperargs["tzone"] = selectedzone; } else { helperargs["tzreset"] = true; // // make the helper reset the timezone }*/ KAuth::Action writeAction("org.kde.active.clockconfig.save"); writeAction.setHelperID("org.kde.active.clockconfig"); writeAction.setArguments(helperargs); KAuth::ActionReply reply = writeAction.execute(); if (reply.failed()) { kWarning()<< "KAuth returned an error code:" << reply.errorCode(); } } QString TimeSettings::timeFormat() { return d->timeFormat; } void TimeSettings::setTimeFormat(const QString &timeFormat) { if (d->timeFormat != timeFormat) { d->timeFormat = timeFormat; d->localeSettings.writeEntry("TimeFormat", timeFormat); d->localeConfig->sync(); KGlobal::locale()->setTimeFormat(d->timeFormat); + KGlobalSettings::self()->emitChange(KGlobalSettings::SettingsChanged); kDebug() << "TIME" << KGlobal::locale()->formatTime(QTime::currentTime(), false); emit timeFormatChanged(); timeout(); } } QString TimeSettings::timeZone() { return d->timezone; } void TimeSettings::setTimeZone(const QString &timezone) { if (d->timezone != timezone) { d->timezone = timezone; kDebug() << "booyah"; emit timeZoneChanged(); timeout(); } } QList TimeSettings::timeZones() { if (!d->timeZones) { d->initTimeZones(); } return d->timezones; } void TimeSettings::setTimeZones(QList timezones) { //if (d->timezones != timezones) { d->timezones = timezones; emit timeZonesChanged(); //} } QObject* TimeSettings::timeZonesModel() { if (!d->timeZones) { d->initTimeZones(); } return d->timeZonesModel; } void TimeSettings::setTimeZonesModel(QObject* timezones) { //if (d->timezones != timezones) { d->timeZonesModel = timezones; emit timeZonesModelChanged(); //} } void TimeSettings::timeZoneFilterChanged(const QString &filter) { kDebug() << "new filter: " << filter; d->timeZoneFilter = filter; d->timeZoneFilter.replace( ' ', '_' ); d->initTimeZones(); emit timeZonesChanged(); } void TimeSettings::saveTimeZone(const QString &newtimezone) { kDebug() << "Saving timezone to config: " << newtimezone; QVariantMap helperargs; helperargs["tz"] = true; helperargs["tzone"] = newtimezone; KAuth::Action writeAction("org.kde.active.clockconfig.save"); writeAction.setHelperID("org.kde.active.clockconfig"); writeAction.setArguments(helperargs); KAuth::ActionReply reply = writeAction.execute(); if (reply.failed()) { kWarning()<< "KAuth returned an error code:" << reply.errorCode(); } setTimeZone(newtimezone); emit timeZoneChanged(); } bool TimeSettings::twentyFour() { return timeFormat() == FORMAT24H; } void TimeSettings::setTwentyFour(bool t) { if (twentyFour() != t) { if (t) { setTimeFormat(FORMAT24H); } else { setTimeFormat(FORMAT12H); } kDebug() << "T24 toggled: " << t << d->timeFormat; emit twentyFourChanged(); emit currentTimeChanged(); timeout(); } } #include "timesettings.moc" diff --git a/artwork/desktoptheme/air-mobile/widgets/actionbutton.svgz b/artwork/desktoptheme/air-mobile/widgets/actionbutton.svgz index 17273766..d635a502 100644 Binary files a/artwork/desktoptheme/air-mobile/widgets/actionbutton.svgz and b/artwork/desktoptheme/air-mobile/widgets/actionbutton.svgz differ diff --git a/artwork/desktoptheme/air-mobile/widgets/button.svgz b/artwork/desktoptheme/air-mobile/widgets/button.svgz index d7a39ce6..1435b1df 100644 Binary files a/artwork/desktoptheme/air-mobile/widgets/button.svgz and b/artwork/desktoptheme/air-mobile/widgets/button.svgz differ diff --git a/artwork/desktoptheme/air-mobile/widgets/toolbar.svgz b/artwork/desktoptheme/air-mobile/widgets/toolbar.svgz index cb62f7dd..afa7c2fe 100644 Binary files a/artwork/desktoptheme/air-mobile/widgets/toolbar.svgz and b/artwork/desktoptheme/air-mobile/widgets/toolbar.svgz differ diff --git a/components/metadatamodel/metadatacloudmodel.cpp b/components/metadatamodel/metadatacloudmodel.cpp index cb42f780..52fa5a4b 100644 --- a/components/metadatamodel/metadatacloudmodel.cpp +++ b/components/metadatamodel/metadatacloudmodel.cpp @@ -1,360 +1,365 @@ /* Copyright 2011 Marco Martin This library 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 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "metadatacloudmodel.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kext.h" MetadataCloudModel::MetadataCloudModel(QObject *parent) : AbstractMetadataModel(parent), m_queryClient(0) { m_queryTimer = new QTimer(this); m_queryTimer->setSingleShot(true); connect(m_queryTimer, SIGNAL(timeout()), this, SLOT(doQuery())); QHash roleNames; roleNames[Label] = "label"; roleNames[Count] = "count"; setRoleNames(roleNames); } MetadataCloudModel::~MetadataCloudModel() { } void MetadataCloudModel::setCloudCategory(QString category) { if (m_cloudCategory == category) { return; } m_cloudCategory = category; m_queryTimer->start(0); emit cloudCategoryChanged(); } QString MetadataCloudModel::cloudCategory() const { return m_cloudCategory; } QVariantList MetadataCloudModel::categories() const { return m_categories; } void MetadataCloudModel::setAllowedCategories(const QVariantList &whitelist) { QSet set = variantToStringList(whitelist).toSet(); if (set == m_allowedCategories) { return; } m_allowedCategories = set; emit allowedCategoriesChanged(); } QVariantList MetadataCloudModel::allowedCategories() const { return stringToVariantList(m_allowedCategories.values()); } void MetadataCloudModel::doQuery() { QDeclarativePropertyMap *parameters = qobject_cast(extraParameters()); //check if really all properties to build the query are null if (m_cloudCategory.isEmpty()) { return; } setStatus(Waiting); QString query = "select distinct ?label count(*) as ?count where { "; if (m_cloudCategory == "kext:Activity") { query += " ?activity nao:isRelated ?r . ?activity rdf:type kext:Activity . ?activity kext:activityIdentifier ?label "; } else { query += " ?r " + m_cloudCategory + " ?label"; } if (!resourceType().isEmpty() && m_cloudCategory != "rdf:type") { QString type = resourceType(); bool negation = false; if (type.startsWith("!")) { type = type.remove(0, 1); negation = true; } if (negation) { query += " . FILTER(!bif:exists((select (1) where { ?r rdf:type " + type + " . }))) "; } else { query += " . ?r rdf:type " + type; } + + if (type != "nfo:Bookmark") { + //FIXME: remove bookmarks if not explicitly asked for + query += " . FILTER(!bif:exists((select (1) where { ?r a . }))) "; + } } if (!resourceType().isEmpty() && m_cloudCategory != "nie:mimeType") { QString type = mimeType(); bool negation = false; if (type.startsWith("!")) { type = type.remove(0, 1); negation = true; } if (negation) { query += " . FILTER(!bif:exists((select (1) where { ?r nie:mimeType ?mimeType . FILTER(bif:contains(?mimeType, \"'" + type + "'\")) . }))) "; } else { query += " . ?r nie:mimeType ?mimeType . FILTER(bif:contains(?mimeType, \"'" + type + "'\")) "; } } if (parameters && parameters->size() > 0) { foreach (const QString &key, parameters->keys()) { QString parameter = parameters->value(key).toString(); bool negation = false; if (parameter.startsWith("!")) { parameter = parameter.remove(0, 1); negation = true; } if (negation) { query += " . FILTER(!bif:exists((select (1) where { ?r " + key + " ?mimeType . FILTER(bif:contains(?mimeType, \"'" + parameter + "'\")) . }))) "; } else { query += " . ?r " + key + " ?mimeType . FILTER(bif:contains(?mimeType, \"'" + parameter + "'\")) "; } } } if (!activityId().isEmpty() && m_cloudCategory != "kext:Activity") { QString activity = activityId(); bool negation = false; if (activity.startsWith("!")) { activity = activity.remove(0, 1); negation = true; } Nepomuk::Resource acRes(activity, Nepomuk::Vocabulary::KEXT::Activity()); if (negation) { query += ". FILTER(!bif:exists((select (1) where { <" + acRes.resourceUri().toString() + "> ?r . }))) "; } else { query += " . <" + acRes.resourceUri().toString() + "> nao:isRelated ?r "; } } //this is an AND set of tags.. should be allowed OR as well? foreach (const QString &tag, tagStrings()) { QString individualTag = tag; bool negation = false; if (individualTag.startsWith("!")) { individualTag = individualTag.remove(0, 1); negation = true; } if (negation) { query += ". FILTER(!bif:exists((select (1) where { ?r nao:hasTag ?tagSet \ . ?tagSet ?tagLabel ?tag \ . ?tagLabel \ . FILTER(bif:contains(?tag, \"'"+individualTag+"'\"))}))) "; } else { query += ". ?r nao:hasTag ?tagSet \ . ?tagSet ?tagLabel ?tag \ . ?tagLabel \ . FILTER(bif:contains(?tag, \"'"+individualTag+"'\")) "; } } if (startDate().isValid() || endDate().isValid()) { if (startDate().isValid()) { query += " . { \ ?r ?v2 . FILTER(?v2>\"" + startDate().toString(Qt::ISODate) + "\"^^) . \ } UNION {\ ?r ?v3 . FILTER(?v3>\"" + startDate().toString(Qt::ISODate) + "\"^^) . \ } UNION {\ ?v4 ?r .\ ?v4 ?v5 .\ FILTER(?v5>\"" + startDate().toString(Qt::ISODate) + "\"^^) . \ }"; } if (endDate().isValid()) { query += " . { \ ?r ?v2 . FILTER(?v2<\"" + endDate().toString(Qt::ISODate) + "\"^^) . \ } UNION {\ ?r ?v3 . FILTER(?v3<\"" + endDate().toString(Qt::ISODate) + "\"^^) . \ } UNION {\ ?v4 ?r .\ ?v4 ?v5 .\ FILTER(?v5<\"" + endDate().toString(Qt::ISODate) + "\"^^) . \ }"; } } if (minimumRating() > 0) { query += " . ?r nao:numericRating ?rating filter (?rating >=" + QString::number(minimumRating()) + ") "; } if (maximumRating() > 0) { query += " . ?r nao:numericRating ?rating filter (?rating <=" + QString::number(maximumRating()) + ") "; } query += " . ?r ?v1 . FILTER(?v1>0) . } group by ?label order by ?label"; kDebug() << "Performing the Sparql query" << query; beginResetModel(); m_results.clear(); endResetModel(); emit countChanged(); delete m_queryClient; m_queryClient = new Nepomuk::Query::QueryServiceClient(this); connect(m_queryClient, SIGNAL(newEntries(const QList &)), this, SLOT(newEntries(const QList &))); connect(m_queryClient, SIGNAL(entriesRemoved(const QList &)), this, SLOT(entriesRemoved(const QList &))); connect(m_queryClient, SIGNAL(finishedListing()), this, SLOT(finishedListing())); m_queryClient->sparqlQuery(query); } void MetadataCloudModel::newEntries(const QList< Nepomuk::Query::Result > &entries) { setStatus(Running); QVector > results; QVariantList categories; foreach (Nepomuk::Query::Result res, entries) { QString label; int count = res.additionalBinding(QLatin1String("count")).variant().toInt(); QVariant rawLabel = res.additionalBinding(QLatin1String("label")).variant(); if (rawLabel.canConvert()) { label = rawLabel.value().className(); } else if (!rawLabel.value().scheme().isEmpty()) { const QUrl url = rawLabel.value(); if (url.scheme() == "nepomuk") { label = Nepomuk::Resource(url).genericLabel(); //TODO: it should convert from ontology url to short form nfo:Document } else { label = propertyShortName(url); } } else if (rawLabel.canConvert()) { label = rawLabel.toString(); } else if (rawLabel.canConvert()) { label = QString::number(rawLabel.toInt()); } else { continue; } if (label.isEmpty() || !(m_allowedCategories.isEmpty() || m_allowedCategories.contains(label))) { continue; } results << QPair(label, count); categories << label; } if (results.count() > 0) { beginInsertRows(QModelIndex(), m_results.count(), m_results.count()+results.count()); m_results << results; m_categories << categories; endInsertRows(); emit countChanged(); emit categoriesChanged(); } } void MetadataCloudModel::entriesRemoved(const QList &urls) { //FIXME: optimize kDebug()<= 0) { beginRemoveRows(QModelIndex(), index, index); m_results.remove(index); endRemoveRows(); } } emit countChanged(); } void MetadataCloudModel::finishedListing() { setStatus(Idle); } QVariant MetadataCloudModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.column() != 0 || index.row() < 0 || index.row() >= m_results.count()){ return QVariant(); } const QPair row = m_results[index.row()]; switch (role) { case Label: return row.first; case Count: return row.second; default: return QVariant(); } } #include "metadatacloudmodel.moc" diff --git a/components/metadatamodel/metadatamodel.cpp b/components/metadatamodel/metadatamodel.cpp index 6e182636..9632dda6 100644 --- a/components/metadatamodel/metadatamodel.cpp +++ b/components/metadatamodel/metadatamodel.cpp @@ -1,664 +1,672 @@ /* Copyright 2011 Marco Martin This library 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 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "metadatamodel.h" #include "resourcewatcher.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "kext.h" MetadataModel::MetadataModel(QObject *parent) : AbstractMetadataModel(parent), m_queryClient(0), m_screenshotSize(180, 120) { m_queryTimer = new QTimer(this); m_queryTimer->setSingleShot(true); connect(m_queryTimer, SIGNAL(timeout()), this, SLOT(doQuery())); m_newEntriesTimer = new QTimer(this); m_newEntriesTimer->setSingleShot(true); connect(m_newEntriesTimer, SIGNAL(timeout()), this, SLOT(newEntriesDelayed())); m_previewTimer = new QTimer(this); m_previewTimer->setSingleShot(true); connect(m_previewTimer, SIGNAL(timeout()), this, SLOT(delayedPreview())); //using the same cache of the engine, they index both by url m_imageCache = new KImageCache("plasma_engine_preview", 10485760); m_watcher = new Nepomuk::ResourceWatcher(this); m_watcher->addProperty(QUrl("http://www.semanticdesktop.org/ontologies/2007/08/15/nao#numericRating")); connect(m_watcher, SIGNAL(propertyAdded(Nepomuk::Resource, Nepomuk::Types::Property, QVariant)), this, SLOT(propertyChanged(Nepomuk::Resource, Nepomuk::Types::Property, QVariant))); QHash roleNames; roleNames[Label] = "label"; roleNames[Description] = "description"; roleNames[Types] = "types"; roleNames[ClassName] = "className"; roleNames[GenericClassName] = "genericClassName"; roleNames[HasSymbol] = "hasSymbol"; roleNames[Icon] = "icon"; roleNames[Thumbnail] = "thumbnail"; roleNames[IsFile] = "isFile"; roleNames[Exists] = "exists"; roleNames[Rating] = "rating"; roleNames[NumericRating] = "numericRating"; roleNames[Symbols] = "symbols"; roleNames[ResourceUri] = "resourceUri"; roleNames[ResourceType] = "resourceType"; roleNames[MimeType] = "mimeType"; roleNames[Url] = "url"; roleNames[Topics] = "topics"; roleNames[TopicsNames] = "topicsNames"; roleNames[Tags] = "tags"; roleNames[TagsNames] = "tagsNames"; setRoleNames(roleNames); } MetadataModel::~MetadataModel() { delete m_imageCache; } void MetadataModel::setQuery(const Nepomuk::Query::Query &query) { m_queryTimer->stop(); m_query = query; if (Nepomuk::Query::QueryServiceClient::serviceAvailable()) { doQuery(); } } Nepomuk::Query::Query MetadataModel::query() const { return m_query; } void MetadataModel::setQueryString(const QString &query) { if (query == m_queryString) { return; } m_queryString = query; m_queryTimer->start(0); emit queryStringChanged(); } QString MetadataModel::queryString() const { return m_queryString; } void MetadataModel::setSortBy(const QVariantList &sortBy) { QStringList stringList = variantToStringList(sortBy); if (m_sortBy == stringList) { return; } m_sortBy = stringList; m_queryTimer->start(0); emit sortByChanged(); } QVariantList MetadataModel::sortBy() const { return stringToVariantList(m_sortBy); } void MetadataModel::setSortOrder(Qt::SortOrder sortOrder) { if (m_sortOrder == sortOrder) { return; } m_sortOrder = sortOrder; m_queryTimer->start(0); emit sortOrderChanged(); } Qt::SortOrder MetadataModel::sortOrder() const { return m_sortOrder; } int MetadataModel::find(const QString &resourceUri) { int index = -1; int i = 0; Nepomuk::Resource resToFind(resourceUri); foreach (const Nepomuk::Resource &res, m_resources) { if (res == resToFind) { index = i; break; } ++i; } return index; } void MetadataModel::doQuery() { QDeclarativePropertyMap *parameters = qobject_cast(extraParameters()); //check if really all properties to build the query are null if (m_queryString.isEmpty() && resourceType().isEmpty() && mimeType().isEmpty() && activityId().isEmpty() && tagStrings().size() == 0 && !startDate().isValid() && !endDate().isValid() && minimumRating() <= 0 && maximumRating() <= 0 && parameters->size() == 0) { return; } setStatus(Waiting); m_query = Nepomuk::Query::Query(); m_query.setQueryFlags(Nepomuk::Query::Query::WithoutFullTextExcerpt); Nepomuk::Query::AndTerm rootTerm; if (!m_queryString.isEmpty()) { rootTerm.addSubTerm(Nepomuk::Query::QueryParser::parseQuery(m_queryString).term()); } if (!resourceType().isEmpty()) { //FIXME: more elegant QString type = resourceType(); bool negation = false; if (type.startsWith("!")) { type = type.remove(0, 1); negation = true; } if (negation) { rootTerm.addSubTerm(Nepomuk::Query::NegationTerm::negateTerm(Nepomuk::Query::ResourceTypeTerm(propertyUrl(type)))); } else { rootTerm.addSubTerm(Nepomuk::Query::ResourceTypeTerm(propertyUrl(type))); + if (type != "nfo:Bookmark") { + //FIXME: remove bookmarks if not explicitly asked for + rootTerm.addSubTerm(Nepomuk::Query::NegationTerm::negateTerm(Nepomuk::Query::ResourceTypeTerm(propertyUrl("nfo:Bookmark")))); + } } } if (!mimeType().isEmpty()) { QString type = mimeType(); bool negation = false; if (type.startsWith("!")) { type = type.remove(0, 1); negation = true; } Nepomuk::Query::ComparisonTerm term(Nepomuk::Vocabulary::NIE::mimeType(), Nepomuk::Query::LiteralTerm(type)); if (negation) { rootTerm.addSubTerm(Nepomuk::Query::NegationTerm::negateTerm(term)); } else { rootTerm.addSubTerm(term); } } if (parameters && parameters->size() > 0) { foreach (const QString &key, parameters->keys()) { QString parameter = parameters->value(key).toString(); bool negation = false; if (parameter.startsWith("!")) { parameter = parameter.remove(0, 1); negation = true; } //FIXME: Contains should work, but doesn't match for file names Nepomuk::Query::ComparisonTerm term(propertyUrl(key), Nepomuk::Query::LiteralTerm(parameter), Nepomuk::Query::ComparisonTerm::Regexp); if (negation) { rootTerm.addSubTerm(Nepomuk::Query::NegationTerm::negateTerm(term)); } else { rootTerm.addSubTerm(term); } } } if (!activityId().isEmpty()) { QString activity = activityId(); bool negation = false; if (activity.startsWith("!")) { activity = activity.remove(0, 1); negation = true; } kDebug() << "Asking for resources of activity" << activityId(); Nepomuk::Resource acRes(activity, Nepomuk::Vocabulary::KEXT::Activity()); Nepomuk::Query::ComparisonTerm term(Soprano::Vocabulary::NAO::isRelated(), Nepomuk::Query::ResourceTerm(acRes)); term.setInverted(true); if (negation) { rootTerm.addSubTerm(Nepomuk::Query::NegationTerm::negateTerm(term)); } else { rootTerm.addSubTerm(term); } } foreach (const QString &tag, tagStrings()) { QString individualTag = tag; bool negation = false; if (individualTag.startsWith("!")) { individualTag = individualTag.remove(0, 1); negation = true; } Nepomuk::Query::ComparisonTerm term( Soprano::Vocabulary::NAO::hasTag(), Nepomuk::Query::LiteralTerm(individualTag)); if (negation) { rootTerm.addSubTerm(Nepomuk::Query::NegationTerm::negateTerm(term)); } else { rootTerm.addSubTerm(term); } } if (startDate().isValid() || endDate().isValid()) { rootTerm.addSubTerm(Nepomuk::Query::dateRangeQuery(startDate(), endDate()).term()); } if (minimumRating() > 0) { const Nepomuk::Query::LiteralTerm ratingTerm(minimumRating()); Nepomuk::Query::ComparisonTerm term = Nepomuk::Types::Property(propertyUrl("nao:numericRating")) > ratingTerm; rootTerm.addSubTerm(term); } if (maximumRating() > 0) { const Nepomuk::Query::LiteralTerm ratingTerm(maximumRating()); Nepomuk::Query::ComparisonTerm term = Nepomuk::Types::Property(propertyUrl("nao:numericRating")) < ratingTerm; rootTerm.addSubTerm(term); } int weight = m_sortBy.length() + 1; foreach (const QString &sortProperty, m_sortBy) { Nepomuk::Query::ComparisonTerm sortTerm(propertyUrl(sortProperty), Nepomuk::Query::Term()); sortTerm.setSortWeight(weight, m_sortOrder); rootTerm.addSubTerm(sortTerm); --weight; } m_query.setTerm(rootTerm); kDebug()<<"Sparql query:"< &)), this, SLOT(newEntries(const QList &))); connect(m_queryClient, SIGNAL(entriesRemoved(const QList &)), this, SLOT(entriesRemoved(const QList &))); connect(m_queryClient, SIGNAL(finishedListing()), this, SLOT(finishedListing())); /*FIXME: safe without limit? if (limit > RESULT_LIMIT || limit <= 0) { m_query.setLimit(RESULT_LIMIT); } */ m_queryClient->query(m_query); } void MetadataModel::newEntries(const QList< Nepomuk::Query::Result > &entries) { setStatus(Running); foreach (Nepomuk::Query::Result res, entries) { //kDebug() << "Result!!!" << res.resource().genericLabel() << res.resource().type(); //kDebug() << "Result label:" << res.genericLabel(); m_resourcesToInsert << res.resource(); } if (!m_newEntriesTimer->isActive()) { m_newEntriesTimer->start(200); } } void MetadataModel::newEntriesDelayed() { beginInsertRows(QModelIndex(), m_resources.count(), m_resources.count()+m_resourcesToInsert.count()-1); m_watcher->stop(); foreach (Nepomuk::Resource res, m_resourcesToInsert) { //kDebug() << "Result!!!" << res.resource().genericLabel() << res.resource().type(); //kDebug() << "Result label:" << res.genericLabel(); m_uriToResourceIndex[res.resourceUri()] = m_resources.count(); m_resources << res; m_watcher->addResource(res); } m_watcher->start(); m_resourcesToInsert.clear(); endInsertRows(); emit countChanged(); } void MetadataModel::propertyChanged(Nepomuk::Resource res, Nepomuk::Types::Property prop, QVariant val) { Q_UNUSED(prop) Q_UNUSED(val) const int index = m_uriToResourceIndex.value(res.resourceUri()); if (index >= 0) { emit dataChanged(createIndex(index, 0, 0), createIndex(index, 0, 0)); } } void MetadataModel::entriesRemoved(const QList &urls) { int prevIndex = -100; //pack all the stuff to remove in groups, to emit the least possible signals //this assumes urls are in the same order they arrived ion the results //it's a map because we want to remove values from the vector in inverted order to keep indexes valid trough the remove loop QMap toRemove; foreach (const QUrl &url, urls) { const int index = m_uriToResourceIndex.value(url); if (index == prevIndex + 1) { toRemove[prevIndex]++; } else { toRemove[index] = 1; } prevIndex = index; } QMap::const_iterator i = toRemove.constEnd(); while (i != toRemove.constBegin()) { --i; beginRemoveRows(QModelIndex(), i.key(), i.key()+i.value()-1); m_resources.remove(i.key(), i.value()); endRemoveRows(); } //another loop, we don't depend to m_uriToResourceIndex in data(), but we take this doublesafety foreach (const QUrl &url, urls) { m_uriToResourceIndex.remove(url); } //FIXME: this loop makes all the optimizations useless, get rid either of it or the optimizations for (int i = 0; i < m_resources.count(); ++i) { m_uriToResourceIndex[m_resources[i].resourceUri()] = i; } emit countChanged(); } void MetadataModel::finishedListing() { setStatus(Idle); } QVariant MetadataModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.column() != 0 || index.row() < 0 || index.row() >= m_resources.count()){ return QVariant(); } const Nepomuk::Resource &resource = m_resources[index.row()]; switch (role) { case Qt::DisplayRole: case Label: return resource.genericLabel(); case Description: return resource.genericDescription(); case Types: { QStringList types; foreach (const QUrl &u, resource.types()) { types << u.toString(); } return types; } case ClassName: return resource.className(); case GenericClassName: { //FIXME: a more elegant way is needed QString genericClassName = resource.className(); + //FIXME: most bookmarks are Document too, so Bookmark wins + if (resource.types().contains(QUrl::fromEncoded("http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Bookmark"))) { + return "Bookmark"; + } Nepomuk::Types::Class resClass(resource.resourceType()); foreach (Nepomuk::Types::Class parentClass, resClass.parentClasses()) { if (parentClass.label() == "Document" || parentClass.label() == "Audio" || parentClass.label() == "Video" || parentClass.label() == "Image" || parentClass.label() == "Contact") { genericClassName = parentClass.label(); break; //two cases where the class is 2 levels behind the level of generalization we want } else if (parentClass.label() == "RasterImage") { genericClassName = "Image"; } else if (parentClass.label() == "TextDocument") { genericClassName = "Document"; } } return genericClassName; } case Qt::DecorationRole: { QString icon = resource.genericIcon(); if (icon.isEmpty() && resource.isFile()) { KUrl url = resource.toFile().url(); if (!url.isEmpty()) { icon = KMimeType::iconNameForUrl(url); } } if (icon.isEmpty()) { // use resource types to find a suitable icon. //TODO icon = retrieveIconName(QStringList(resource.className())); //kDebug() << "symbol" << icon; } if (icon.split(",").count() > 1) { kDebug() << "More than one icon!" << icon; icon = icon.split(",").last(); } return KIcon(icon); } case HasSymbol: case Icon: { QString icon = resource.genericIcon(); if (icon.isEmpty() && resource.isFile()) { KUrl url = resource.toFile().url(); if (!url.isEmpty()) { icon = KMimeType::iconNameForUrl(url); } } if (icon.isEmpty()) { // use resource types to find a suitable icon. //TODO icon = retrieveIconName(QStringList(resource.className())); //kDebug() << "symbol" << icon; } if (icon.split(",").count() > 1) { kDebug() << "More than one icon!" << icon; icon = icon.split(",").last(); } return icon; } case Thumbnail: if (resource.isFile() && resource.toFile().url().isLocalFile()) { KUrl file(resource.toFile().url()); QImage preview = QImage(m_screenshotSize, QImage::Format_ARGB32_Premultiplied); if (m_imageCache->findImage(file.prettyUrl(), &preview)) { return preview; } m_previewTimer->start(100); const_cast(this)->m_filesToPreview[file] = QPersistentModelIndex(index); } return QVariant(); case IsFile: return resource.isFile(); case Exists: return resource.exists(); case Rating: return resource.rating(); case NumericRating: return resource.property(QUrl("http://www.semanticdesktop.org/ontologies/2007/08/15/nao#numericRating")).toString(); case Symbols: return resource.symbols(); case ResourceUri: return resource.resourceUri(); case ResourceType: return resource.resourceType(); case MimeType: return resource.property(QUrl("http://www.semanticdesktop.org/ontologies/2007/01/19/nie#mimeType")).toString(); case Url: { if (resource.isFile() && resource.toFile().url().isLocalFile()) { return resource.toFile().url().prettyUrl(); } else { return resource.property(QUrl("http://www.semanticdesktop.org/ontologies/2007/01/19/nie#url")).toString(); } } case Topics: { QStringList topics; foreach (const Nepomuk::Resource &u, resource.topics()) { topics << u.resourceUri().toString(); } return topics; } case TopicsNames: { QStringList topicNames; foreach (const Nepomuk::Resource &u, resource.topics()) { topicNames << u.genericLabel(); } return topicNames; } case Tags: { QStringList tags; foreach (const Nepomuk::Tag &tag, resource.tags()) { tags << tag.resourceUri().toString(); } return tags; } case TagsNames: { QStringList tagNames; foreach (const Nepomuk::Tag &tag, resource.tags()) { tagNames << tag.genericLabel(); } return tagNames; } default: return QVariant(); } } void MetadataModel::delayedPreview() { QHash::const_iterator i = m_filesToPreview.constBegin(); KFileItemList list; while (i != m_filesToPreview.constEnd()) { KUrl file = i.key(); QPersistentModelIndex index = i.value(); if (!m_previewJobs.contains(file) && file.isValid()) { list.append(KFileItem(file, QString(), 0)); m_previewJobs.insert(file, QPersistentModelIndex(index)); } ++i; } if (list.size() > 0) { KIO::PreviewJob* job = KIO::filePreview(list, m_screenshotSize); job->setIgnoreMaximumSize(true); kDebug() << "Created job" << job; connect(job, SIGNAL(gotPreview(const KFileItem&, const QPixmap&)), this, SLOT(showPreview(const KFileItem&, const QPixmap&))); connect(job, SIGNAL(failed(const KFileItem&)), this, SLOT(previewFailed(const KFileItem&))); } m_filesToPreview.clear(); } void MetadataModel::showPreview(const KFileItem &item, const QPixmap &preview) { QPersistentModelIndex index = m_previewJobs.value(item.url()); m_previewJobs.remove(item.url()); if (!index.isValid()) { return; } m_imageCache->insertImage(item.url().prettyUrl(), preview.toImage()); //kDebug() << "preview size:" << preview.size(); emit dataChanged(index, index); } void MetadataModel::previewFailed(const KFileItem &item) { m_previewJobs.remove(item.url()); } #include "metadatamodel.moc" diff --git a/config/active-blacklistrc b/config/active-blacklistrc index 6d52e4fa..e7f64130 100644 --- a/config/active-blacklistrc +++ b/config/active-blacklistrc @@ -1,5 +1,5 @@ [blacklist] apps=kompare,kuiviewer,kpackagekit,gwenview,plasmate,kwalletmanager,draw,calc,knetattach,karbon,k3b,ktorrent,impress,writer,startcenter,amarok,kaffeine,words,ark,expoblending,wine-winefile,htop,ktimer,xterm,spotify,dolphinsu,package-manager,kopete,kppp,flow,kblackbox,hugin,korganizer,nepomukbackup,krandrtray,flashplayer,akregator,ggl-qt,kdevelop,wine-winehelp,yakuake,qt4config,granatier,konversation,kmousetool,kontact,kscd,xstroke,linux32,superkaramba,kfind,xvkbd,guvcview,gimp,kmix,xrefresh,klines,kinfocenter,kcalc,nokia-qtcreator,kpresenter,kate,kwikdisk,krdc,dngconverter,bluedevil-monolithic,ktron,kmail2,klickety,kruler,polka,kmines,planwork,kbreakout,xclipboard,kget,blogilo,help,kformula,dragonplayer,kcolorchooser,vlc,kollision,lskat,xmag,kspaceduel,wine-regedit,ggl-designer,umbrello,ktuberling,bovo,linguist4,ksirkskineditor,wine-notepad,kcachegrind,kapman,akonadiconsole,akonaditray,ksudoku,kapptemplate,nokia-sdkmaintenancetool,freoffice,kjots,xcalc,krita,okteta,ktimetracker,nepomukcontroller,krfb,kaddressbook,skanlite,ksirk,kfloppy,kalarm,firefox,tabletbrowser,showfoto,ptbatchergui,digikam,klipper,konquest,ksquares,kgoldrunner,kleopatra,systemsettings,ksame,konqbrowser,konsolesu,kmail,kiriki,smolt,groupwarewizard,camera,susegreeter,plan,yast,linphone,kdf,kamoso,knode,wine-winecfg,choqok,base,cervisia,katomic,kbattleship,rekonq,kolf,braindump,designer4,kjumpingcube,bomber,kgpg,policytool,kthesaurus,kblocks,xload,wine-winemine,mc,kdesnake,qtassistant,knetworkmanager,mplayer,wine-browsedrive,scangui,cups,tables,smplayer,kigo,ksysguard,kexi,knotes,xsane,kubrick,kbounce,kcharselect,xkill,nokia-sdkupdater,hplip,juk,kmag,wine-uninstaller,filelight,itweb-settings,assistant4,kipiplugin_acquireimages,wine-notepad,PTBatcherGUI,kmag,kvkbd,wine-uninstaller,filelight,itweb-settings,Xkill,Nokia-SDKUpdater,hplip,jpackage-java-1_6_0-sun-webstart,panoramagui,sweeper,synaptiks,calligramobile,stage,meego-ux-settings,meego-xterm,active-microblog -plasmoids=BbalL,activitybar,akonotes_list,akonotes_note,barapplet,battery,bookmarks,bubblemon,charselect,currentappcontrol,desktop,fileWatcher,floatpanel,incomingmsg,keyboard_applet,konqprofiles,life,magnifique,mcplayer,mediabrowser,mediacontroller,mediainfobar,mediaplayer,mediawelcome,newspaper,notifications,org.kde.active.activityscreen,org.kde.active.launcherpanel,org.kde.active.notifications,org.kde.active.powerbutton,org.kde.active.systemtray,org.kde.appletstrip,org.kde.appswitcher,org.kde.batterymonitor,dict,org.kde.mobileactivityswitcher,org.kde.mobilelauncherpanel,org.kde.mobilenetworkoperator,org.kde.mobilenetworkstatus,org.kde.mobilesystemtray,org.kde.quickdialer-qml,org.kde.sharelikeconnect,org.kde.showActivityManager,org.kde.webdashboard,org.kde.windowstrip,pager,paste,pastebin,sal,searchbox,showdashboard,showdesktop,simplelauncher,sm_hwinfo,sm_temperature,systemtray,tasks,timer,windowlist,folderview,org.kde.active.connman,org.kde.microblog-qml,system-monitor_applet +plasmoids=BbalL,activitybar,akonotes_list,akonotes_note,barapplet,battery,bookmarks,bubblemon,charselect,currentappcontrol,desktop,fileWatcher,floatpanel,incomingmsg,keyboard_applet,konqprofiles,life,magnifique,mcplayer,mediabrowser,mediacontroller,mediainfobar,mediaplayer,mediawelcome,newspaper,notifications,org.kde.active.activityscreen,org.kde.active.launcherpanel,org.kde.active.notifications,org.kde.active.powerbutton,org.kde.active.systemtray,org.kde.appletstrip,org.kde.appswitcher,org.kde.batterymonitor,dict,org.kde.mobileactivityswitcher,org.kde.mobilelauncherpanel,org.kde.mobilenetworkoperator,org.kde.mobilenetworkstatus,org.kde.mobilesystemtray,org.kde.quickdialer-qml,org.kde.sharelikeconnect,org.kde.showActivityManager,org.kde.webdashboard,org.kde.windowstrip,pager,paste,pastebin,sal,searchbox,showdashboard,showdesktop,simplelauncher,sm_hwinfo,sm_temperature,systemtray,tasks,timer,windowlist,folderview,org.kde.active.connman,org.kde.microblog-qml,system-monitor_applet,blackboard,clock,knowledgebase diff --git a/config/emaildefaults b/config/emaildefaults new file mode 100644 index 00000000..06e4449b --- /dev/null +++ b/config/emaildefaults @@ -0,0 +1,2 @@ +[Defaults] +EmailClient=kmail-mobile -t %t -s %s -c %c -b %b -B %B -A %A diff --git a/containments/activityscreen/contents/ui/ItemGroup.qml b/containments/activityscreen/contents/ui/ItemGroup.qml index 5d26214b..8b75844f 100644 --- a/containments/activityscreen/contents/ui/ItemGroup.qml +++ b/containments/activityscreen/contents/ui/ItemGroup.qml @@ -1,269 +1,268 @@ /* * Copyright 2011 Sebastian Kügler * Copyright 2011 Marco Martin * * 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 1.0 import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.mobilecomponents 0.1 as MobileComponents import "plasmapackage:/code/LayoutManager.js" as LayoutManager PlasmaCore.FrameSvgItem { id: itemGroup property string category property string title property bool canResizeHeight: false imagePath: "widgets/background" width: LayoutManager.cellSize.width*2 height: LayoutManager.cellSize.height z: 0 property bool animationsEnabled: false property int minimumWidth: LayoutManager.cellSize.width property int minimumHeight: LayoutManager.cellSize.height property int titleHeight: categoryTitle.height property Item contents: contentsItem Item { id: contentsItem anchors { left: parent.left top: parent.top right: parent.right bottom: parent.bottom topMargin: parent.margins.top+itemGroup.titleHeight leftMargin: parent.margins.left rightMargin: parent.margins.right bottomMargin: parent.margins.bottom } } MouseArea { anchors.fill: parent property int lastX property int lastY onPressed: { //FIXME: this shouldn't be necessary mainFlickable.interactive = false itemGroup.z = 999 animationsEnabled = false mouse.accepted = true var x = Math.round(parent.x/LayoutManager.cellSize.width)*LayoutManager.cellSize.width var y = Math.round(parent.y/LayoutManager.cellSize.height)*LayoutManager.cellSize.height LayoutManager.setSpaceAvailable(x, y, parent.width, parent.height, true) var globalMousePos = mapToItem(main, mouse.x, mouse.y) lastX = globalMousePos.x lastY = globalMousePos.y //debugFlow.refresh(); placeHolder.syncWithItem(parent) placeHolderPaint.opacity = 1 } onPositionChanged: { placeHolder.syncWithItem(parent) var globalPos = mapToItem(main, x, y) var globalMousePos = mapToItem(main, mouse.x, mouse.y) itemGroup.x += (globalMousePos.x - lastX) itemGroup.y += (globalMousePos.y - lastY) lastX = globalMousePos.x lastY = globalMousePos.y if (globalPos.y < 100) { scrollTimer.backwards = true scrollTimer.running = true scrollTimer.draggingItem = itemGroup } else if (globalPos.y > main.height-100) { scrollTimer.backwards = false scrollTimer.running = true scrollTimer.draggingItem = itemGroup } else if (scrollTimer.running) { scrollTimer.running = false } } onReleased: { scrollTimer.running = false repositionTimer.running = false placeHolderPaint.opacity = 0 animationsEnabled = true LayoutManager.positionItem(itemGroup) LayoutManager.save() //debugFlow.refresh() } } Behavior on scale { NumberAnimation { duration: 250 easing.type: Easing.InOutQuad } } Behavior on x { enabled: animationsEnabled NumberAnimation { duration: 250 easing.type: Easing.InOutQuad onRunningChanged: { if (!running) { itemGroup.z = 0 } } } } Behavior on y { enabled: animationsEnabled NumberAnimation { duration: 250 easing.type: Easing.InOutQuad onRunningChanged: { if (!running) { mainFlickable.interactive = contentItem.height>mainFlickable.height if (!mainFlickable.interactive) { contentScrollTo0Animation.running = true } } } } } Behavior on width { enabled: animationsEnabled NumberAnimation { id: widthAnimation duration: 250 easing.type: Easing.InOutQuad onRunningChanged: { if (!running) { itemGroup.z = 0 } } } } Behavior on height { enabled: animationsEnabled NumberAnimation { id: heightAnimation duration: 250 easing.type: Easing.InOutQuad onRunningChanged: { if (!running) { mainFlickable.interactive = contentItem.height>mainFlickable.height if (!mainFlickable.interactive) { contentScrollTo0Animation.running = true } } } } } PlasmaCore.SvgItem { svg: PlasmaCore.Svg { imagePath: plasmoid.file("images", "resize-handle.svgz") } width: 24 height: 24 anchors { right: parent.right bottom: parent.bottom rightMargin: itemGroup.margins.right bottomMargin: itemGroup.margins.bottom } } MouseArea { id: resizeHandle width: 48 height: 48 z: 9999 anchors { right: parent.right bottom: parent.bottom rightMargin: -16 } property int startX property int startY onPressed: { itemGroup.z = 999 mouse.accepted = true //FIXME: this shouldn't be necessary mainFlickable.interactive = false animationsEnabled = false startX = mouse.x startY = mouse.y LayoutManager.setSpaceAvailable(itemGroup.x, itemGroup.y, itemGroup.width, itemGroup.height, true) //debugFlow.refresh(); } onPositionChanged: { //TODO: height as well if it's going to become a grid view itemGroup.width = Math.max(itemGroup.minimumWidth, itemGroup.width + mouse.x-startX) if (itemGroup.canResizeHeight) { itemGroup.height = Math.max(itemGroup.minimumHeight, itemGroup.height + mouse.y-startY) } } onReleased: { animationsEnabled = true LayoutManager.positionItem(itemGroup) LayoutManager.save() LayoutManager.setSpaceAvailable(itemGroup.x, itemGroup.y, widthAnimation.to, heightAnimation.to, false) //debugFlow.refresh(); } } Component.onCompleted: { //width = Math.min(470, 32+itemsList.count*140) layoutTimer.running = true layoutTimer.restart() - enabled = false visible = false } PlasmaCore.FrameSvgItem { id: categoryTitle imagePath: "widgets/extender-dragger" prefix: "root" anchors { left: parent.left right: parent.right top: parent.top leftMargin: parent.margins.left rightMargin: parent.margins.right topMargin: parent.margins.top } height: categoryText.height + margins.top + margins.bottom Text { id: categoryText text: itemGroup.title horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight font.pointSize: theme.defaultFont.pointSize color: theme.textColor anchors { top: parent.top left: parent.left right: parent.right topMargin: parent.margins.top leftMargin: height + 2 rightMargin: height + 2 } } } } diff --git a/containments/activityscreen/contents/ui/ItemsListGroup.qml b/containments/activityscreen/contents/ui/ItemsListGroup.qml index 58af1484..b748c145 100644 --- a/containments/activityscreen/contents/ui/ItemsListGroup.qml +++ b/containments/activityscreen/contents/ui/ItemsListGroup.qml @@ -1,32 +1,36 @@ /* * Copyright 2011 Marco Martin * * 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 1.0 ItemGroup { id: itemGroup property alias categoryCount: itemsList.count title: i18n("%1 (%2)", userTypes.typeNames[itemGroup.category], itemsList.count) scale: itemsList.count>0?1:0 canResizeHeight: true + enabled: itemsList.count>0 + onEnabledChanged: { + layoutTimer.restart() + } ItemsList { id: itemsList } } diff --git a/containments/activityscreen/contents/ui/main.qml b/containments/activityscreen/contents/ui/main.qml index 93b354ae..bdcdafb0 100644 --- a/containments/activityscreen/contents/ui/main.qml +++ b/containments/activityscreen/contents/ui/main.qml @@ -1,393 +1,396 @@ // -*- coding: iso-8859-1 -*- /* * Copyright 2011 Sebastian Kügler * Copyright 2011 Marco Martin * * 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 1.0 import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.plasma.components 0.1 as PlasmaComponents import org.kde.plasma.mobilecomponents 0.1 as MobileComponents import org.kde.plasma.slccomponents 0.1 as SlcComponents import org.kde.metadatamodels 0.1 as MetadataModels import "plasmapackage:/code/LayoutManager.js" as LayoutManager Item { id: main width: 540 height: 540 property Item currentGroup property int currentIndex: -1 property Item addResource property variant availScreenRect: plasmoid.availableScreenRegion(plasmoid.screen)[0] Component.onCompleted: { plasmoid.containmentType = "CustomContainment" plasmoid.appletAdded.connect(addApplet) LayoutManager.restore() for (var i = 0; i < plasmoid.applets.length; ++i) { var applet = plasmoid.applets[i] addApplet(applet, 0) } } function addApplet(applet, pos) { var component = Qt.createComponent("PlasmoidGroup.qml") var plasmoidGroup = component.createObject(resultsFlow) plasmoidGroup.width = LayoutManager.cellSize.width*2 plasmoidGroup.height = LayoutManager.cellSize.height*2 plasmoidGroup.applet = applet plasmoidGroup.category = "Applet-"+applet.id LayoutManager.itemGroups[plasmoidGroup.category] = plasmoidGroup } PlasmaCore.Svg { id: iconsSvg imagePath: "widgets/configuration-icons" } MetadataModels.MetadataCloudModel { id: categoryListModel cloudCategory: "rdf:type" activityId: plasmoid.activityId allowedCategories: userTypes.userTypes onCategoriesChanged: { categoriesTimer.restart() } } MetadataModels.MetadataUserTypes { id: userTypes } MobileComponents.ResourceInstance { id: resourceInstance } PlasmaCore.Theme { id: theme } PlasmaCore.Svg { id: configIconsSvg imagePath: "widgets/configuration-icons" } Timer { id: scrollTimer running: false interval: 40 repeat: true property bool backwards property Item draggingItem onTriggered: { if (backwards) { if (mainFlickable.contentY > 0) { mainFlickable.contentY -= 10 draggingItem.y -= 10 } } else { mainFlickable.contentY += 10 draggingItem.y += 10 } } } PlasmaComponents.ScrollBar { flickableItem: mainFlickable orientation: Qt.Vertical anchors { right: parent.right top: parent.top bottom: parent.bottom } } Flickable { id: mainFlickable anchors.fill: main interactive: contentItem.height>mainFlickable.height PropertyAnimation { id: contentScrollTo0Animation target: mainFlickable properties: "contentY" to: 0 duration: 250 running: false } contentWidth: contentItem.width contentHeight: contentItem.height MouseArea { id: contentItem width: mainFlickable.width height: childrenRect.y+childrenRect.height+availScreenRect.y+20 onClicked: { resourceInstance.uri = "" main.currentIndex = -1 } Connections { target: plasmoid onActivityNameChanged: titleText.text = plasmoid.activityName } Row { id: toolBar spacing: 16 anchors { top: parent.top left: parent.left topMargin: availScreenRect.y+20 leftMargin: 72 } MobileComponents.ActionButton { svg: iconsSvg elementId: "add" action: plasmoid.action("add widgets") //FIXME: WHY? Component.onCompleted: { action.enabled = true } } MobileComponents.ActionButton { id: configureButton svg: iconsSvg elementId: "configure" action: plasmoid.action("configure") //FIXME: WHY? Component.onCompleted: { action.enabled = true } } MobileComponents.TextEffects { id: titleText text: (String(plasmoid.activityName).length <= 28) ? plasmoid.activityName:String(plasmoid.activityName).substr(0,28) + "..." color: "white" horizontalOffset: 1 verticalOffset: 1 bold: true pointSize: theme.defaultFont.pointSize * 1.1 anchors.verticalCenter: configureButton.verticalCenter } } Timer { id: categoriesTimer repeat: false running: false interval: 0 onTriggered: { var component = Qt.createComponent("ItemsListGroup.qml") var existingCategories = Array() //FIXME: find a more efficient way //destroy removed categories for (var category in LayoutManager.itemGroups) { if (category.indexOf("Applet-") != 0 && categoryListModel.categories.indexOf(category) == -1) { var item = LayoutManager.itemGroups[category] LayoutManager.setSpaceAvailable(item.x, item.y, item.width, item.height, true) item.destroy() delete LayoutManager.itemGroups[category] //debugFlow.refresh(); } } //add newly created categories for (var i = 0; i < categoryListModel.categories.length; ++i) { var category = categoryListModel.categories[i] if (!LayoutManager.itemGroups[category]) { var itemGroup = component.createObject(resultsFlow) itemGroup.category = category LayoutManager.itemGroups[category] = itemGroup } existingCategories[existingCategories.length] = category } } } //FIXME: debug purposes only, remove asap /*Flow { id: debugFlow anchors.fill: resultsFlow visible: true Repeater { model: 60 Rectangle { width: LayoutManager.cellSize.width height: LayoutManager.cellSize.height } } function refresh() { for (var i=0; i0?0.8:0.3 } } }*/ Item { id: resultsFlow //height: Math.min(300, childrenRect.height) width: Math.round((parent.width-64)/LayoutManager.cellSize.width)*LayoutManager.cellSize.width height: childrenRect.y+childrenRect.height z: 900 anchors { top: toolBar.bottom topMargin: 5 horizontalCenter: parent.horizontalCenter } //This is just for event compression when a lot of boxes are created one after the other Timer { id: layoutTimer repeat: false running: false interval: 100 onTriggered: { LayoutManager.resetPositions() for (var i=0; i * * 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 Qt 4.7 import org.kde.plasma.components 0.1 as PlasmaComponents import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.qtextracomponents 0.1 import org.kde.plasma.mobilecomponents 0.1 as MobileComponents MobileComponents.Sheet { id: main signal closeRequested - title: i18n("Activity configuration") + title: (configInterface.activityName == "") ? i18n("Create new activity") : i18n("Activity configuration") acceptButtonText: (configInterface.activityName == "") ? i18n("Create activity") : i18n("Save changes") rejectButtonText: i18n("Close") acceptButton.enabled: activityNameEdit.text != "" && !nameExists() Component.onCompleted: open() onStatusChanged: { if (status == PlasmaComponents.DialogStatus.Closed) { closeRequested() } } function saveConfiguration() { if (activityNameEdit.text == "" || nameExists()) { return } configInterface.activityName = activityNameEdit.text configInterface.wallpaperIndex = wallpapersList.currentIndex } onAccepted: { saveConfiguration() } //this is used to check the same name isn't given two times PlasmaCore.DataSource { id: activitySource property variant activityNames property string currentActivity engine: "org.kde.activities" onSourceAdded: { if (source != "Status") { connectSource(source) } } Component.onCompleted: { connectedSources = sources.filter(function(val) { return val != "Status"; }) } onDataChanged: { var names = new Array for (var i in data) { print("AAA"+configInterface.activityName) if (data[i]["Current"]) { currentActivity = data[i]["Name"] } // if (1||!data[i]["Current"]) { names.push(data[i]["Name"]) //} } activitySource.activityNames = names } } function nameExists() { /*empty configInterface activityname we are creating*/ if (configInterface.activityName != "" && (activitySource.currentActivity == activityNameEdit.text)) { return false } return activitySource.activityNames.indexOf(activityNameEdit.text) != -1 } content: [ Row { id: nameRow anchors { horizontalCenter: parent.horizontalCenter top: parent.topMargin } visible: configInterface.activityNameConfigurable Text { color: theme.textColor text: i18n("Activity name:") anchors.verticalCenter: activityNameEdit.verticalCenter } PlasmaComponents.TextField { id: activityNameEdit objectName: "activityNameEdit" Component.onCompleted: activityNameEdit.forceActiveFocus() Keys.onReturnPressed: { saveConfiguration() accept() } } }, PlasmaComponents.Label { anchors { left: nameRow.right verticalCenter: nameRow.verticalCenter } text: i18n("An activity with this name already exists") opacity: nameExists() ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 250 easing.type: Easing.InOutQuad } } }, MobileComponents.IconGrid { id: wallpapersList property int currentIndex: 0 onCurrentIndexChanged: { currentPage = Math.max(0, Math.floor(currentIndex/pageSize)) } property int delegateWidth: 148 property int delegateHeight: 130 anchors { top: nameRow.bottom left: parent.left bottom: parent.bottom right: parent.right topMargin: 6 bottomMargin: 12 } model: configInterface.wallpaperModel delegate: WallpaperDelegate {} } ] Connections { target: configInterface onModelChanged: { wallpapersList.model = configInterface.wallpaperModel } onWallpaperIndexChanged: { if (configInterface.activityName == "" || configInterface.wallpaperIndex < 0) { var newIndex = Math.random()*wallpapersList.count wallpapersList.positionViewAtIndex(newIndex) wallpapersList.currentIndex = newIndex } else { wallpapersList.positionViewAtIndex(configInterface.wallpaperIndex) wallpapersList.currentIndex = configInterface.wallpaperIndex } } onActivityNameChanged: { if (configInterface.activityName == "") { activityNameEdit.text = i18n("New Activity") } else { activityNameEdit.text = configInterface.activityName } } } } diff --git a/shell/firstrun/main.cpp b/shell/firstrun/main.cpp index 25f56d88..f68e1b24 100644 --- a/shell/firstrun/main.cpp +++ b/shell/firstrun/main.cpp @@ -1,39 +1,40 @@ /*************************************************************************** * Copyright 2011 Sebastian Kügler * * * * 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 #include #include #include #include #include #include "app.h" static const char description[] = I18N_NOOP( "Plasma Active first run to setup Activities and Resources" ); static const char version[] = "0.1"; int main(int argc, char **argv) { + return 0; kDebug() << "First run running ..."; App app(argc, argv); int rc = app.exec(); return rc; } diff --git a/shell/panelproxy.cpp b/shell/panelproxy.cpp index 950b5b45..49967c87 100644 --- a/shell/panelproxy.cpp +++ b/shell/panelproxy.cpp @@ -1,306 +1,305 @@ /*************************************************************************** * Copyright 2011 Marco Martin * * * * 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 "panelproxy.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "panelshadows.h" #include "plasmaapp.h" uint PanelProxy::s_numItems = 0; PanelProxy::PanelProxy(QObject *parent) : QObject(parent), m_acceptsFocus(false), m_activeWindow(false), m_windowStrip(false), m_windowSelected(false) { m_panel = new QGraphicsView(); m_panel->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_panel->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_panel->installEventFilter(this); m_panel->setAutoFillBackground(false); m_panel->viewport()->setAutoFillBackground(false); m_panel->setAttribute(Qt::WA_TranslucentBackground); m_panel->setAttribute(Qt::WA_OpaquePaintEvent); m_panel->setAttribute(Qt::WA_NoSystemBackground); m_panel->viewport()->setAttribute(Qt::WA_OpaquePaintEvent); m_panel->viewport()->setAttribute(Qt::WA_NoSystemBackground); m_panel->setWindowFlags(m_panel->windowFlags() | Qt::FramelessWindowHint | Qt::CustomizeWindowHint); m_panel->setFrameShape(QFrame::NoFrame); KWindowSystem::setOnAllDesktops(m_panel->winId(), true); unsigned long state = NET::Sticky | NET::StaysOnTop | NET::KeepAbove | NET::SkipTaskbar | NET::SkipPager; KWindowSystem::setState(m_panel->effectiveWinId(), state); KWindowSystem::setType(m_panel->effectiveWinId(), NET::Dock); PlasmaApp::self()->panelShadows()->addWindow(m_panel); QDBusServiceWatcher *kwinWatch = new QDBusServiceWatcher("org.kde.kwin", QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration, this); connect(kwinWatch, SIGNAL(serviceRegistered(QString)), this, SLOT(updateWindowListArea())); connect(this, SIGNAL(windowStripChanged()), SLOT(slotWindowStripChanged())); } PanelProxy::~PanelProxy() { delete m_panel; } QGraphicsObject *PanelProxy::mainItem() const { return m_mainItem.data(); } void PanelProxy::setMainItem(QGraphicsObject *mainItem) { if (m_mainItem.data() != mainItem) { if (m_mainItem) { m_mainItem.data()->setParent(mainItem->parent()); m_mainItem.data()->removeEventFilter(this); m_mainItem.data()->setY(0); } m_mainItem = mainItem; if (mainItem) { mainItem->setParentItem(0); mainItem->setParent(this); } mainItem->installEventFilter(this); //if this is called in Compenent.onCompleted we have to wait a loop the item is added to a scene QTimer::singleShot(0, this, SLOT(syncMainItem())); emit mainItemChanged(); } } void PanelProxy::syncMainItem() { if (!m_mainItem) { return; } //not have a scene? go up in the hyerarchy until we find something with a scene QGraphicsScene *scene = m_mainItem.data()->scene(); if (!scene) { QObject *parent = m_mainItem.data(); while ((parent = parent->parent())) { QGraphicsObject *qo = qobject_cast(parent); if (qo) { scene = qo->scene(); if (scene) { scene->addItem(m_mainItem.data()); ++s_numItems; //negative y positive x, in another direction compared to corona offscreen widgets m_mainItem.data()->setY(-10000*s_numItems); m_mainItem.data()->setY(10000*s_numItems); break; } } } } if (!scene) { return; } m_panel->setScene(scene); m_panel->setMinimumSize(QSize(m_mainItem.data()->boundingRect().width(), m_mainItem.data()->boundingRect().height())); m_panel->setMaximumSize(m_panel->minimumSize()); QRectF itemGeometry(QPointF(m_mainItem.data()->x(), m_mainItem.data()->y()), QSizeF(m_mainItem.data()->boundingRect().size())); m_panel->setSceneRect(itemGeometry); } bool PanelProxy::isVisible() const { return m_panel->isVisible(); } void PanelProxy::setVisible(const bool visible) { if (m_panel->isVisible() != visible) { m_panel->setVisible(visible); if (visible) { m_panel->setVisible(visible); m_panel->raise(); } emit visibleChanged(); } } int PanelProxy::x() const { return m_panel->pos().x(); } void PanelProxy::setX(int x) { m_panel->move(x, m_panel->pos().y()); } int PanelProxy::y() const { return m_panel->pos().y(); } void PanelProxy::setY(int y) { m_panel->move(m_panel->pos().x(), y); } bool PanelProxy::acceptsFocus() const { return m_acceptsFocus; } void PanelProxy::setAcceptsFocus(bool accepts) { if (accepts == m_acceptsFocus) { return; } m_acceptsFocus = accepts; if (accepts) { m_panel->setAttribute(Qt::WA_X11DoNotAcceptFocus, false); m_panel->activateWindow(); KWindowSystem::forceActiveWindow(m_panel->effectiveWinId()); } else { unsigned long state = NET::Sticky | NET::StaysOnTop | NET::KeepAbove; KWindowSystem::setState(m_panel->effectiveWinId(), state); m_panel->setAttribute(Qt::WA_X11DoNotAcceptFocus, true); } emit acceptsFocusChanged(); } bool PanelProxy::isActiveWindow() const { return m_activeWindow; } QRectF PanelProxy::windowListArea() const { return m_windowListArea; } void PanelProxy::setWindowListArea(const QRectF &rectf) { const QRect rect = rectf.toRect(); if (m_windowListArea != rect) { m_windowListArea = rect; - m_updateWindowListAreaTimer.start(); } } void PanelProxy::updateWindowListArea() { kDebug() << "updating with" << m_windowListArea; if (m_windowListArea.isEmpty()) { return; } } bool PanelProxy::eventFilter(QObject *watched, QEvent *event) { //Panel if (watched == m_panel && event->type() == QEvent::Move) { QMoveEvent *me = static_cast(event); if (me->oldPos().x() != me->pos().x()) { emit xChanged(); } if (me->oldPos().y() != me->pos().y()) { emit yChanged(); } } else if (watched == m_panel && event->type() == QEvent::WindowActivate) { m_activeWindow = true; emit activeWindowChanged(); } else if (watched == m_panel && event->type() == QEvent::WindowDeactivate) { m_activeWindow = false; emit activeWindowChanged(); } else if (watched == m_panel && event->type() == QEvent::Close) { event->ignore(); return true; //Main item } else if (watched == m_mainItem.data() && (event->type() == QEvent::Resize || event->type() == QEvent::Move)) { syncMainItem(); } return false; } bool PanelProxy::isWindowStripEnabled() const { return m_windowStrip; } void PanelProxy::setWindowStripEnabled(bool enable) { m_windowStrip = enable; emit windowStripChanged(); } void PanelProxy::slotWindowStripChanged() { if (m_windowStrip) { m_windowSelected = false; QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kwin", "/TabBox", "org.kde.kwin", "openEmbedded"); QList vars; vars.append(QVariant::fromValue(m_panel->winId())); vars.append(QVariant::fromValue(QPoint(0, 50))); vars.append(QVariant::fromValue(m_windowListArea.size())); vars.append(QVariant::fromValue(Qt::AlignLeft)); vars.append(QVariant::fromValue(Qt::AlignBottom)); msg.setArguments(vars); QDBusConnection::sessionBus().asyncCall(msg); QDBusConnection::sessionBus().connect("org.kde.kwin", "/TabBox", "org.kde.kwin", "itemSelected", this, SLOT(windowSelected())); } else { QDBusMessage msg = QDBusMessage::createMethodCall("org.kde.kwin", "/TabBox", "org.kde.kwin", m_windowSelected ? "accept" : "reject"); QDBusConnection::sessionBus().asyncCall(msg); QDBusConnection::sessionBus().disconnect("org.kde.kwin", "/TabBox", "org.kde.kwin", "itemSelected", this, SLOT(windowSelected())); } } void PanelProxy::windowSelected() { m_windowSelected = true; m_mainItem.data()->setProperty("state", "Hidden"); } #include "panelproxy.moc" diff --git a/shell/panelproxy.h b/shell/panelproxy.h index e8881d15..0ef178fe 100644 --- a/shell/panelproxy.h +++ b/shell/panelproxy.h @@ -1,108 +1,107 @@ /*************************************************************************** * Copyright 2011 Marco Martin * * * * 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 PANEL_PROXY_P #define PANEL_PROXY_P #include #include #include #include #include class QGraphicsObject; class QGraphicsView; class PanelProxy : public QObject { Q_OBJECT Q_PROPERTY(QGraphicsObject *mainItem READ mainItem WRITE setMainItem NOTIFY mainItemChanged) Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged) Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged) Q_PROPERTY(QRectF windowListArea READ windowListArea WRITE setWindowListArea); Q_PROPERTY(bool acceptsFocus READ acceptsFocus WRITE setAcceptsFocus NOTIFY acceptsFocusChanged) Q_PROPERTY(bool activeWindow READ isActiveWindow NOTIFY activeWindowChanged) Q_PROPERTY(bool windowStripEnabled READ isWindowStripEnabled WRITE setWindowStripEnabled NOTIFY windowStripChanged) public: enum WidgetAttribute { WA_X11NetWmWindowTypeDock = Qt::WA_X11NetWmWindowTypeDock }; PanelProxy(QObject *parent = 0); ~PanelProxy(); QGraphicsObject *mainItem() const; void setMainItem(QGraphicsObject *mainItem); bool isVisible() const; void setVisible(const bool visible); int x() const; void setX(int x); int y() const; void setY(int y); bool acceptsFocus() const; void setAcceptsFocus(bool accepts); bool isActiveWindow() const; QRectF windowListArea() const; void setWindowListArea(const QRectF &rect); bool isWindowStripEnabled() const; void setWindowStripEnabled(bool enable); Q_SIGNALS: void mainItemChanged(); void visibleChanged(); void xChanged(); void yChanged(); void acceptsFocusChanged(); void activeWindowChanged(); void windowListBeingShown(); void windowStripChanged(); protected Q_SLOTS: void syncMainItem(); void updateWindowListArea(); void slotWindowStripChanged(); void windowSelected(); protected: bool eventFilter(QObject *watched, QEvent *event); private: QGraphicsView *m_panel; QWeakPointer m_mainItem; QRect m_windowListArea; - QTimer m_updateWindowListAreaTimer; bool m_acceptsFocus; bool m_activeWindow; bool m_windowStrip; bool m_windowSelected; static uint s_numItems; }; #endif