/usr/share/kde4/apps/plasma/plasmoids/org.kde.homerun/contents/ui/TabContent.qml is in plasma-widget-homerun 1.2.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | /*
Copyright 2012 Aurélien Gâteau <agateau@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 1.1
import org.kde.homerun.components 0.1 as HomerunComponents
import org.kde.plasma.core 0.1 as PlasmaCore
import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.qtextracomponents 0.1 as QtExtra
import "TabContentInternal.js" as TabContentInternal
Item {
id: main
//- Public ----------------------------------------------------
// Defined by outside world
property Item rootItem
property QtObject sourceRegistry
property QtObject tabSourceModel
property string tabIconSource
property string tabText
property string searchCriteria
property bool configureMode: false
property bool showActionListOverlay: false
// Exposed by ourself
property bool canGoBack: false
property bool canGoForward: false
property Item currentPage
signal closeRequested
signal updateTabOrderRequested
signal setSearchFieldRequested(string text)
//- Private ---------------------------------------------------
Component {
id: pageComponent
Page {
anchors.fill: parent
rootItem: main.rootItem
configureMode: main.configureMode
showActionListOverlay: main.showActionListOverlay
onCloseRequested: {
main.closeRequested();
}
onOpenSourceRequested: {
main.openSource(sourceId, sourceArguments);
}
onShowMessageRequested: {
messageItem.show(icon, text);
}
}
}
// Ui
SlidingContainer {
id: editTabRow
anchors {
top: parent.top
left: parent.left
right: parent.right
}
show: configureMode
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: 12
PlasmaComponents.Label {
text: i18n("Tab Icon:")
}
PlasmaComponents.ToolButton {
flat: false
iconSource: main.tabIconSource
onClicked: {
var name = iconDialog.getIcon();
if (name != "") {
main.tabIconSource = name;
}
}
HomerunComponents.IconDialog {
id: iconDialog
}
}
PlasmaComponents.Label {
text: i18n("Tab Label:")
}
PlasmaComponents.TextField {
text: main.tabText
onTextChanged: main.tabText = text
}
}
}
SlidingContainer {
// navRow = back|forward + breadcrumbs
id: navRow
property int maxHeight: 32
show: canGoBack
anchors {
top: editTabRow.bottom
left: parent.left
right: parent.right
}
PlasmaComponents.ToolButton {
id: backButton
width: height
height: navRow.maxHeight
flat: false
iconSource: "go-previous"
onClicked: goBack()
}
PlasmaComponents.ToolButton {
id: forwardButton
anchors {
left: backButton.right
}
width: height
height: navRow.maxHeight
enabled: canGoForward
flat: false
iconSource: "go-next"
onClicked: goForward()
}
PlasmaComponents.ButtonRow {
id: breadcrumbRow
anchors {
left: forwardButton.right
leftMargin: 12
}
spacing: 0
height: navRow.maxHeight
PlasmaComponents.ToolButton {
height: breadcrumbRow.height
flat: false
iconSource: tabIconSource
text: tabText
onClicked: TabContentInternal.goTo(0);
}
Repeater {
id: breadcrumbRepeater
model: currentPage.pathModel
delegate: PlasmaComponents.ToolButton {
height: breadcrumbRow.height
flat: false
checked: model.index == breadcrumbRepeater.count - 1
text: "› " + model.display
onClicked: {
// Do not use 'checked' here because by the time
// clicked() is emitted, 'checked' has already been set
// to true
if (model.index != breadcrumbRepeater.count - 1) {
openSource(model.sourceId, model.sourceArguments);
}
}
}
}
}
}
PlasmaCore.SvgItem {
id: hline
anchors {
left: parent.left
right: parent.right
bottom: navRow.bottom
bottomMargin: -12
}
height: naturalSize.height
z: 1000
svg: PlasmaCore.Svg {
imagePath: "widgets/scrollwidget"
}
elementId: "border-top"
}
Item {
id: pageContainer
anchors {
left: parent.left
leftMargin: 12
top: hline.top
right: parent.right
bottom: parent.bottom
}
}
MessageItem {
id: messageItem
anchors {
top: navRow.show ? navRow.top : hline.bottom
topMargin: navRow.show ? 0 : 6
horizontalCenter: parent.horizontalCenter
}
}
// Scripting
Component.onCompleted: {
var page = createPage(tabSourceModel);
TabContentInternal.addPage(page);
TabContentInternal.goToLastPage();
}
onActiveFocusChanged: {
if (activeFocus) {
currentPage.forceActiveFocus();
}
}
onSearchCriteriaChanged: {
currentPage.searchCriteria = searchCriteria;
}
onCurrentPageChanged: {
setSearchFieldRequested(currentPage.searchCriteria);
}
function goBack() {
TabContentInternal.goBack();
}
function goForward() {
TabContentInternal.goForward();
}
function goUp() {
var model = currentPage.pathModel;
if (model.count >= 2) {
// count - 1 is the breadcrumb for the current content
// count - 2 is the breadcrumb for the content up
var item = model.get(model.count - 2);
openSource(item.sourceId, item.sourceArguments);
} else {
// "root" item is not in the path model, so we use a different way
// to get to it
TabContentInternal.goTo(0);
}
}
Component {
id: dynamicTabSourceModelComponent
ListModel {
}
}
function openSource(sourceId, sourceArguments) {
// This tabSourceModel should look-like the C++ SourceModel used when
// tab content is loaded from the config file.
var tabSourceModel = dynamicTabSourceModelComponent.createObject(main);
var page = createPage(tabSourceModel, { "showHeader": false });
// Create the model for sourceId after creating the page so that the page
// can be used as its parent, avoiding memory leaks.
// See https://bugs.kde.org/show_bug.cgi?id=310217
tabSourceModel.append({
sourceId: sourceId,
model: sourceRegistry.createModelFromArguments(sourceId, sourceArguments, page),
configGroup: null
})
TabContentInternal.addPage(page);
TabContentInternal.goToLastPage();
page.forceActiveFocus();
}
function createPage(sourceModel, viewExtraArgs /*= {}*/) {
var args = {
sourceRegistry: sourceRegistry,
tabSourceModel: sourceModel,
};
if (viewExtraArgs !== undefined) {
for (var key in viewExtraArgs) {
args[key] = viewExtraArgs[key];
}
}
return pageComponent.createObject(pageContainer, args);
}
function triggerFirstItem() {
currentPage.triggerFirstItem();
}
function reset() {
TabContentInternal.goTo(0);
TabContentInternal.clearHistoryAfterCurrentPage();
searchCriteria = "";
}
}
|