diff --git a/applets/taskmanager/package/contents/config/main.xml b/applets/taskmanager/package/contents/config/main.xml --- a/applets/taskmanager/package/contents/config/main.xml +++ b/applets/taskmanager/package/contents/config/main.xml @@ -70,6 +70,9 @@ true + + false + diff --git a/applets/taskmanager/package/contents/ui/CppTextLabel.qml b/applets/taskmanager/package/contents/ui/CppTextLabel.qml new file mode 100644 --- /dev/null +++ b/applets/taskmanager/package/contents/ui/CppTextLabel.qml @@ -0,0 +1,30 @@ +/*************************************************************************** + * Copyright (C) 2016 by Eike Hein * + * * + * 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 . * + ***************************************************************************/ + +import QtQuick 2.0 + +import org.kde.plasma.private.taskmanager 0.1 as TaskManagerApplet + +TaskManagerApplet.TextLabel { + anchors.fill: parent + + text: model.display + color: theme.textColor + elide: !inPopup +} diff --git a/applets/taskmanager/package/contents/ui/QmlTextLabel.qml b/applets/taskmanager/package/contents/ui/QmlTextLabel.qml new file mode 100644 --- /dev/null +++ b/applets/taskmanager/package/contents/ui/QmlTextLabel.qml @@ -0,0 +1,32 @@ +/*************************************************************************** + * Copyright (C) 2016 by Eike Hein * + * * + * 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 . * + ***************************************************************************/ + +import QtQuick 2.0 + +import org.kde.plasma.components 2.0 as PlasmaComponents + +PlasmaComponents.Label { + anchors.fill: parent + + text: model.display + wrapMode: Text.Wrap + elide: Text.ElideRight + textFormat: Text.PlainText + verticalAlignment: Text.AlignVCenter +} diff --git a/applets/taskmanager/package/contents/ui/Task.qml b/applets/taskmanager/package/contents/ui/Task.qml --- a/applets/taskmanager/package/contents/ui/Task.qml +++ b/applets/taskmanager/package/contents/ui/Task.qml @@ -44,7 +44,7 @@ property int itemIndex: index property bool inPopup: false property bool initialGeometryExported: false - property int textWidth: label.implicitWidth + property alias textWidth: label.implicitTextWidth property bool pressed: false property int pressX: -1 property int pressY: -1 @@ -365,9 +365,11 @@ } } - TaskManagerApplet.TextLabel { + Loader { id: label + property int implicitTextWidth: label.item ? label.item.implicitWidth : 0 + anchors { fill: parent leftMargin: taskFrame.margins.left + iconBox.width + units.smallSpacing @@ -379,11 +381,10 @@ visible: (inPopup || !iconsOnly && model.IsLauncher !== true && (parent.width - iconBox.height - units.smallSpacing) >= (theme.mSize(theme.defaultFont).width * 7)) - enabled: true + active: inPopup || !iconsOnly + asynchronous: true - text: (!inPopup && iconsOnly) ? "" : model.display - color: theme.textColor - elide: !inPopup + source: plasmoid.configuration.experimentalQmlTextLabel ? "QmlTextLabel.qml" : "CppTextLabel.qml" } states: [