[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:19:39 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=463374e
The following commit has been merged in the master branch:
commit 463374e4bb6d53f47c879d74ceb1adf434dd1556
Author: Martin Klapetek <mklapetek at kde.org>
Date: Tue Feb 24 16:40:34 2015 +0100
[person] Improve the Person applet itself
Changes briefly:
* now it displays the avatar when in panel
* does not display the actions when in panel (or not big enough)
* does display only button without text if there's not enough room to
fit the whole text
* does switch the Flow from Left-to-Right for icons-only buttons to
Top-to-Bottom for buttons with text (the text is so long that it
cannot fit two buttons next to each other)
* starts 1st action on mouse click
* uses now expanded- and compactRepresentation thing --I'd like to
further add some presence indication that would be different in both
cases
REVIEW: 122641
---
person/contents/ui/{main.qml => Person.qml} | 54 ++++++++++++++++++++++-------
person/contents/ui/main.qml | 48 ++++---------------------
2 files changed, 49 insertions(+), 53 deletions(-)
diff --git a/person/contents/ui/main.qml b/person/contents/ui/Person.qml
similarity index 64%
copy from person/contents/ui/main.qml
copy to person/contents/ui/Person.qml
index 871c1c0..c045b62 100644
--- a/person/contents/ui/main.qml
+++ b/person/contents/ui/Person.qml
@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
-import QtQuick 2.1
+import QtQuick 2.4
import QtQuick.Layouts 1.1
import org.kde.people 1.0
@@ -26,43 +26,73 @@ import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.plasmoid 2.0
PlasmaCore.IconItem {
- source: p.person.photo
+ id: personPhoto
+ source: personData.person.photo
+
+ property int minActionWidth
+
+ function actionTriggered(id)
+ {
+ actions.triggerAction(id);
+ }
+
+ MouseArea {
+ anchors.fill: parent
+
+ onClicked: {
+ actionTriggered(0);
+ }
+ }
PersonData {
- id: p
+ id: personData
personUri: plasmoid.configuration.personUri
}
PlasmaCore.ToolTipArea {
anchors.fill: parent
- mainText: p.person.name
- icon: p.person.presenceIconName
+ mainText: personData.person.name
+ icon: personData.person.presenceIconName
}
- function actionTriggered(id)
- {
- actions.triggerAction(id);
+ FontMetrics {
+ id: fontMetrics
}
- GridLayout {
+ Flow {
+ id: actionsGrid
anchors {
left: parent.left
right: parent.right
- bottom: parent.bottom
+ bottom: flow == Flow.LeftToRight ? parent.bottom : undefined
+ top: flow == Flow.TopToBottom ? parent.bottom : undefined
+ }
+ visible: height < parent.height && plasmoid.expanded
+ flow: actionsRepeater.width > personPhoto.minActionWidth ? Flow.TopToBottom : Flow.LeftToRight
+
+ move: Transition {
+ NumberAnimation { properties: "x,y"; duration: 150 }
}
- visible: height<parent.height
Repeater {
+ id: actionsRepeater
+
model: PersonActions {
id: actions
personUri: plasmoid.configuration.personUri
}
delegate: PlasmaComponents.Button {
- text: display
+ // Text width + a bit for the icon
+ text: fontMetrics.advanceWidth(display) + units.gridUnit * 2 > actionsGrid.width ? "" : display
iconName: model.iconName
onClicked: model.action.trigger()
+ tooltip: text == "" ? display : ""
Component.onCompleted: {
+ var actionTextWidth = fontMetrics.advanceWidth(display);
+ if (personPhoto.minActionWidth < actionTextWidth) {
+ personPhoto.minActionWidth = actionTextWidth;
+ }
plasmoid.setAction(index, model.action.text, model.iconName)
}
}
diff --git a/person/contents/ui/main.qml b/person/contents/ui/main.qml
index 871c1c0..635f371 100644
--- a/person/contents/ui/main.qml
+++ b/person/contents/ui/main.qml
@@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
-import QtQuick 2.1
+import QtQuick 2.4
import QtQuick.Layouts 1.1
import org.kde.people 1.0
@@ -25,47 +25,13 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.plasmoid 2.0
-PlasmaCore.IconItem {
- source: p.person.photo
+Item {
+ id: main
- PersonData {
- id: p
- personUri: plasmoid.configuration.personUri
- }
+ Plasmoid.switchWidth: units.gridUnit * 4
+ Plasmoid.switchHeight: units.gridUnit * 4
- PlasmaCore.ToolTipArea {
- anchors.fill: parent
- mainText: p.person.name
- icon: p.person.presenceIconName
- }
+ Plasmoid.compactRepresentation: Person {}
+ Plasmoid.fullRepresentation: Person {}
- function actionTriggered(id)
- {
- actions.triggerAction(id);
- }
-
- GridLayout {
- anchors {
- left: parent.left
- right: parent.right
- bottom: parent.bottom
- }
- visible: height<parent.height
-
- Repeater {
- model: PersonActions {
- id: actions
- personUri: plasmoid.configuration.personUri
- }
- delegate: PlasmaComponents.Button {
- text: display
- iconName: model.iconName
- onClicked: model.action.trigger()
-
- Component.onCompleted: {
- plasmoid.setAction(index, model.action.text, model.iconName)
- }
- }
- }
- }
}
--
ktp-contact-applet packaging
More information about the pkg-kde-commits
mailing list