diff --git a/shell/widgetsexplorer/package/contents/ui/MenuTabBar.qml b/shell/widgetsexplorer/package/contents/ui/MenuTabBar.qml index bd969f7f..f2508179 100644 --- a/shell/widgetsexplorer/package/contents/ui/MenuTabBar.qml +++ b/shell/widgetsexplorer/package/contents/ui/MenuTabBar.qml @@ -1,226 +1,226 @@ /* * Copyright 2010 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.components 0.1 as PlasmaComponents import org.kde.plasma.core 0.1 as PlasmaCore import org.kde.metadatamodels 0.1 as MetadataModels import org.kde.runnermodel 0.1 as RunnerModels PlasmaComponents.TabBar { id: tabBar property Component startComponent: topComponent anchors { top: searchField.bottom topMargin: 8 horizontalCenter: parent.horizontalCenter } width: Math.min(implicitWidth, parent.width - 100) CategoryTab { id: topTab text: i18n("Top") component: topComponent resourceType: "_top" Timer { id: switchPageTimer interval: 100 onTriggered: { topTab.visible = (topPageExistenceModel.count >= 1) if (!topTab.visible) { tabBar.currentTab = appsTab stack.replace(appsComponent) } } } MetadataModels.MetadataModel { id: topPageExistenceModel activityId: "!"+activitySource.data["Status"]["Current"] scoreResources: true limit: 1 onStatusChanged: { if (status == MetadataModels.MetadataModel.Running) { switchPageTimer.running = true } } onCountChanged: switchPageTimer.running = true } } CategoryTab { id: appsTab text: i18n("Apps") component: appsComponent resourceType: "_Apps" } CategoryTab { text: i18n("Bookmarks") resourceType: "nfo:Bookmark" component: bookmarksComponent } CategoryTab { text: i18n("Contacts") resourceType: "nfo:Contact" component: contactsComponent } CategoryTab { text: i18n("Documents") resourceType: "nfo:Document" component: documentsComponent } CategoryTab { text: i18n("Images") resourceType: "nfo:Image" component: imagesComponent } CategoryTab { text: i18n("Music") resourceType: "nfo:Audio" component: musicComponent } CategoryTab { text: i18n("Videos") resourceType: "nfo:Video" component: videoComponent } CategoryTab { text: i18n("Widgets") component: widgetsComponent resourceType: "_Widgets" } Component { id: topComponent ResourceBrowser { model: MetadataModels.MetadataModel { sortOrder: Qt.DescendingOrder activityId: "!"+activitySource.data["Status"]["Current"] scoreResources: true - queryString: searchField.searchQuery + queryString: "*" + searchField.searchQuery + "*" } } } Component { id: appsComponent ResourceBrowser { defaultClassName: "FileDataObject" model: PlasmaCore.SortFilterModel { id: appsModel sourceModel: PlasmaCore.DataModel { keyRoleFilter: ".*" dataSource: PlasmaCore.DataSource { id: appsSource engine: "org.kde.active.apps" connectedSources: ["Apps"] interval: 0 } } sortRole: "name" filterRole: "name" filterRegExp: ".*"+searchField.searchQuery+".*" } } } Component { id: bookmarksComponent ResourceBrowser { model: MetadataModels.MetadataModel { sortOrder: Qt.AscendingOrder activityId: "!"+activitySource.data["Status"]["Current"] sortBy: ["nie:url"] resourceType: "nfo:Bookmark" } } } Component { id: contactsComponent ResourceBrowser { model: MetadataModels.MetadataModel { sortOrder: Qt.AscendingOrder activityId: "!"+activitySource.data["Status"]["Current"] sortBy: ["nco:fullname"] resourceType: "nco:Contact" - queryString: searchField.searchQuery + queryString: "*" + searchField.searchQuery + "*" } } } Component { id: documentsComponent ResourceBrowser { model: MetadataModels.MetadataModel { sortBy: ["nfo:fileName"] activityId: "!"+activitySource.data["Status"]["Current"] sortOrder: Qt.AscendingOrder resourceType: "nfo:Document" - queryString: searchField.searchQuery + queryString: "*" + searchField.searchQuery + "*" } } } Component { id: imagesComponent ResourceBrowser { model: MetadataModels.MetadataModel { sortBy: ["nfo:fileName"] activityId: "!"+activitySource.data["Status"]["Current"] sortOrder: Qt.AscendingOrder resourceType: "nfo:Image" - queryString: searchField.searchQuery + queryString: "*" + searchField.searchQuery + "*" } } } Component { id: musicComponent ResourceBrowser { model: MetadataModels.MetadataModel { sortBy: ["nie:title"] activityId: "!"+activitySource.data["Status"]["Current"] sortOrder: Qt.AscendingOrder resourceType: "nfo:Audio" - queryString: searchField.searchQuery + queryString: "*" + searchField.searchQuery + "*" } } } Component { id: videoComponent ResourceBrowser { model: MetadataModels.MetadataModel { sortBy: ["nfo:fileName"] activityId: "!"+activitySource.data["Status"]["Current"] sortOrder: Qt.AscendingOrder resourceType: "nfo:Video" - queryString: searchField.searchQuery + queryString: "*" + searchField.searchQuery + "*" } } } Component { id: widgetsComponent WidgetExplorer {} } } diff --git a/shell/widgetsexplorer/package/contents/ui/view.qml b/shell/widgetsexplorer/package/contents/ui/view.qml index 41bfa634..f08bf5a9 100644 --- a/shell/widgetsexplorer/package/contents/ui/view.qml +++ b/shell/widgetsexplorer/package/contents/ui/view.qml @@ -1,170 +1,170 @@ /* * Copyright 2010 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.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.metadatamodels 0.1 as MetadataModels import org.kde.runnermodel 0.1 as RunnerModels PlasmaComponents.Sheet { id: widgetsExplorer objectName: "widgetsExplorer" title: i18n("Add Items") acceptButtonText: i18n("Add Items") rejectButtonText: i18n("Cancel") signal addAppletRequested(string plugin) signal closeRequested function addItems() { var service = metadataSource.serviceForSource("") var operation = service.operationDescription("connectToActivity") operation["ActivityUrl"] = activitySource.data["Status"]["Current"] for (var i = 0; i < selectedModel.count; ++i) { var item = selectedModel.get(i) if (item.resourceUri) { operation["ResourceUrl"] = item.resourceUri service.startOperationCall(operation) } else if (item.pluginName) { widgetsExplorer.addAppletRequested(item.pluginName) } } } //used only toexplicitly close the keyboard TextInput { id: inputPanelController; width:0; height:0} PlasmaCore.DataSource { id: metadataSource engine: "org.kde.active.metadata" } Binding { target: acceptButton property: "enabled" value: selectedModel.count > 0 } onAccepted: { widgetsExplorer.addItems() } onStatusChanged: { if (status == PlasmaComponents.DialogStatus.Closed) { closeRequested() } } ListModel { id: selectedModel } MetadataModels.MetadataUserTypes { id: userTypes } MetadataModels.MetadataCloudModel { id: cloudModel cloudCategory: "rdf:type" allowedCategories: userTypes.userTypes } PlasmaCore.DataSource { id: activitySource engine: "org.kde.activities" connectedSources: ["Status"] interval: 0 } Timer { running: true interval: 100 onTriggered: open() } content: [ MobileComponents.ViewSearch { id: searchField MobileComponents.IconButton { icon: QIcon("go-previous") width: 32 height: 32 onClicked: { searchField.searchQuery = "" stack.pop() } opacity: stack.depth > 1 ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 250 easing.type: Easing.InOutQuad } } } anchors { left: parent.left right: parent.right top: parent.top } onSearchQueryChanged: { if (stack.depth == 1 && searchQuery.length > 3) { stack.push(globalSearchComponent) busy = true } else { busy = false } } }, MenuTabBar { id: tabBar }, PlasmaComponents.PageStack { id: stack clip: true anchors { left: parent.left right: parent.right top: tabBar.bottom bottom: parent.bottom } initialPage: tabBar.startComponent } ] Component { id: globalSearchComponent ResourceBrowser { model: MetadataModels.MetadataModel { id: runnerModel - queryString: searchField.searchQuery.length > 3 ? searchField.searchQuery : "" + queryString: searchField.searchQuery.length > 3 ? "*" + searchField.searchQuery + "*" : "" onQueryStringChanged: { if (searchField.searchQuery.length <= 3) { stack.pop() } } onCountChanged: { searchField.restartBusyTimer() } } } } }