[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:17:21 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=bc97732
The following commit has been merged in the master branch:
commit bc977321f1db59df76fd3b818279c1a4c5783618
Author: Aleix Pol <aleixpol at kde.org>
Date: Tue Jan 15 01:38:11 2013 +0100
Make it possible to start chats within the plasmoid
Adopt the PinnedContactModel for keeping a list of contacts that will be
displayed together with the open chats and will help us start chats with
our commonly interacted contacts.
REVIEW: 108402
---
chat/org.kde.ktp-chat/contents/config/main.xml | 11 +++
chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml | 23 +++++-
.../contents/ui/ConversationDelegate.qml | 85 +++++++++++++++------
...Delegate.qml => ConversationDelegateButton.qml} | 37 +++------
chat/org.kde.ktp-chat/contents/ui/main.qml | 87 ++++++++++++++++++++++
5 files changed, 191 insertions(+), 52 deletions(-)
diff --git a/chat/org.kde.ktp-chat/contents/config/main.xml b/chat/org.kde.ktp-chat/contents/config/main.xml
new file mode 100644
index 0000000..15f4b74
--- /dev/null
+++ b/chat/org.kde.ktp-chat/contents/config/main.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name=""/>
+
+ <group name="General">
+ <entry name="pinnedContacts" type="StringList" />
+ </group>
+</kcfg>
diff --git a/chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml b/chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml
index 818d93f..2d13dba 100644
--- a/chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml
+++ b/chat/org.kde.ktp-chat/contents/ui/ChatWidget.qml
@@ -27,8 +27,10 @@ import org.kde.plasma.components 0.1 as PlasmaComponents
Item {
id: chatWidget
property Conversation conv
+ property alias pinned: pinButton.checked
signal closeRequested
+ signal pinnedClicked
Item {
id: titleArea
@@ -57,7 +59,7 @@ Item {
id: contactName
anchors {
left: contactIcon.right
- right: minimizeButton.left
+ right: pinButton.left
top: parent.top
bottom: parent.bottom
leftMargin: 5
@@ -67,6 +69,20 @@ Item {
}
PlasmaComponents.ToolButton {
+ id: pinButton
+
+ anchors {
+ top: parent.top
+ right: minimizeButton.left
+ bottom: parent.bottom
+ }
+ checkable: true
+
+ iconSource: "rating"
+ onClicked: chatWidget.pinnedClicked()
+ }
+
+ PlasmaComponents.ToolButton {
id: minimizeButton
anchors {
@@ -107,7 +123,10 @@ Item {
iconSource: "dialog-close"
- onClicked: conv.requestClose()
+ onClicked: {
+ conv.requestClose()
+ closeRequested()
+ }
}
}
diff --git a/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml b/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml
index 8a8d851..09049a3 100644
--- a/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml
+++ b/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml
@@ -19,39 +19,76 @@
*/
import QtQuick 1.1
-import org.kde.plasma.components 0.1 as PlasmaComponents
-import org.kde.qtextracomponents 0.1 as ExtraComponents
import org.kde.plasma.core 0.1 as PlasmaCore
+import org.kde.telepathy 0.1
-PlasmaComponents.ToolButton {
- id: base
- width: height
+ConversationDelegateButton {
+ id: convButton
+ property alias isCurrentConversation: dialog.visible
- checked: ListView.isCurrentItem
+ avatar: model.conversation.target.avatar
+ nick: model.conversation.target.nick
+ presenceIconName: model.conversation.target.presenceIconName
+ onClicked: toggleVisibility()
- ExtraComponents.QIconItem {
- id: icon
- icon: model.conversation.target.avatar
- anchors {
- fill: parent
- margins: 5
- }
- }
+ function toggleVisibility() { setVisible(!isCurrentConversation) }
+ function setVisible(v) { base.currentIndex = v ? index : -1 }
+ function closeConversation() { base.currentIndex = -1 }
+ function openConversation() { base.currentIndex = index }
- PlasmaCore.ToolTip {
- target: icon
- mainText: model.conversation.target.nick
- image: model.conversation.target.presenceIconName
+ Component.onCompleted: setVisible(model.conversation.messages.shouldStartOpened)
+
+ ContactPin {
+ id: pin
+ model: pinnedModel
+ contact: conversation.target.contact
+ account: conversation.target.account
}
+ //FIXME: put in a loader to not slow down the model
+ PlasmaCore.Dialog {
+ id: dialog
+ windowFlags: Qt.WindowStaysOnTopHint
+ visible: base.currentIndex==index
+
+ mainItem: ChatWidget {
+ id: chatWidget
+ width: 250
+ height: 350
+ conv: model.conversation
+
+ onCloseRequested: closeConversation()
+ onPinnedClicked: pin.toggle()
+ pinned: pin.pinned
+ }
+
+ onVisibleChanged: {
+ if(visible) {
+ windowHide.hideWindowFromTaskbar(dialog.windowId)
+ var point = dialog.popupPosition(convButton, Qt.AlignBottom);
+ console.log("Showing dialog at (" + point.x + "," + point.y + ")");
- Rectangle {
- anchors {
- right: parent.right
- top: parent.top
+ dialog.x = point.x;
+ dialog.y = point.y;
+ dialog.activateWindow()
+ }
}
- width: parent.width / 3
- height: parent.height / 3
+ }
+
+ Connections {
+ target: model.conversation.messages
+ onPopoutRequested: closeConversation()
+ }
+
+ // needed to let MessageModel know when messages are visible
+ // so that it can acknowledge them properly
+ Binding {
+ target: model.conversation.messages
+ property: "visibleToUser"
+ value: dialog.visible
+ }
+
+ overlay: Rectangle {
color: "red"
radius: 3
diff --git a/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml b/chat/org.kde.ktp-chat/contents/ui/ConversationDelegateButton.qml
similarity index 69%
copy from chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml
copy to chat/org.kde.ktp-chat/contents/ui/ConversationDelegateButton.qml
index 8a8d851..e1067db 100644
--- a/chat/org.kde.ktp-chat/contents/ui/ConversationDelegate.qml
+++ b/chat/org.kde.ktp-chat/contents/ui/ConversationDelegateButton.qml
@@ -23,15 +23,17 @@ import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.qtextracomponents 0.1 as ExtraComponents
import org.kde.plasma.core 0.1 as PlasmaCore
-PlasmaComponents.ToolButton {
+PlasmaComponents.ToolButton
+{
id: base
- width: height
-
- checked: ListView.isCurrentItem
+ property alias avatar: icon.icon
+ property alias nick: tooltip.mainText
+ property alias presenceIconName: tooltip.image
+ property alias overlay: overlayLoader.sourceComponent
+ checked: base.currentIndex==index
ExtraComponents.QIconItem {
id: icon
- icon: model.conversation.target.avatar
anchors {
fill: parent
margins: 5
@@ -39,34 +41,17 @@ PlasmaComponents.ToolButton {
}
PlasmaCore.ToolTip {
+ id: tooltip
target: icon
- mainText: model.conversation.target.nick
- image: model.conversation.target.presenceIconName
}
-
-
- Rectangle {
+
+ Loader {
+ id: overlayLoader
anchors {
right: parent.right
top: parent.top
}
width: parent.width / 3
height: parent.height / 3
- color: "red"
- radius: 3
-
- Text {
- id: text
- anchors.fill: parent
-
- font.pixelSize: parent.height
- text: model.conversation.messages.unreadCount
- color: "white"
-
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
-
- visible: model.conversation.messages.unreadCount !== 0
}
}
diff --git a/chat/org.kde.ktp-chat/contents/ui/main.qml b/chat/org.kde.ktp-chat/contents/ui/main.qml
new file mode 100644
index 0000000..9234472
--- /dev/null
+++ b/chat/org.kde.ktp-chat/contents/ui/main.qml
@@ -0,0 +1,87 @@
+/*
+ Copyright (C) 2012 Lasath Fernando <kde at lasath.org>
+ Copyright (C) 2012 David Edmundson <kde at davidedmundson.co.uk>
+ Copyright (C) 2012 Aleix Pol <aleixpol at 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) 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
+ 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, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+import QtQuick 1.0
+import org.kde.telepathy 0.1
+import org.kde.plasma.components 0.1 as PlasmaComponents
+import org.kde.plasma.core 0.1 as PlasmaCore
+import org.kde.qtextracomponents 0.1 as ExtraComponents
+
+Grid {
+ id: base
+ property real minimumItemSize: 4
+ property real minimumHeight: 1+(flow===Flow.LeftToRight ? minimumItemSize : base.childrenRect.height)
+ property real minimumWidth: 1+(flow===Flow.LeftToRight ? base.childrenRect.width : minimumItemSize)
+ property real itemSize: Math.min(base.width, base.height)
+ property int currentIndex: -1
+
+ clip: true
+ spacing: 2
+ flow: (plasmoid.formFactor === Vertical || width<=height) ? Flow.TopToBottom : Flow.LeftToRight
+ rows: flow===Flow.LeftToRight ? 1 : -1
+ columns: flow===Flow.LeftToRight ? -1 : 1
+
+ TelepathyTextObserver { id: handler }
+ HideWindowComponent { id: windowHide }
+
+ Component.onCompleted: {
+ plasmoid.aspectRatioMode = plasmoid.IgnoreAspectRatio
+ }
+
+ Repeater {
+ delegate: ConversationDelegateButton {
+ width: base.itemSize
+ height: width
+ visible: available && !alreadyChatting
+ onClicked: handler.conversations.startChat(account, contact)
+ avatar: decoration
+ overlay: ExtraComponents.QIconItem {
+ anchors.fill: parent
+ anchors.margins: parent.width/3
+ icon: presenceIcon
+ }
+ }
+ model: PinnedContactsModel {
+ id: pinnedModel
+ conversations: handler.conversations
+ accountManager: handler.accountManager
+
+ Component.onCompleted: plasmoid.addEventListener('ConfigChanged',
+ function() {
+ var v = plasmoid.readConfig("pinnedContacts");
+ console.log("loading state", v)
+ if(v!="")
+ pinnedModel.state = v
+ });
+ onCountChanged: {
+ plasmoid.writeConfig("pinnedContacts", pinnedModel.state)
+ console.log("saving state", pinnedModel.state)
+ }
+ }
+ }
+
+ Repeater {
+ delegate: ConversationDelegate {
+ width: base.itemSize
+ height: width
+ }
+ model: handler.conversations
+ }
+}
--
ktp-contact-applet packaging
More information about the pkg-kde-commits
mailing list