[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/declarative-applets/replacements/microblog
From: Marco Martin <notmart () gmail ! com>
Date: 2011-01-25 14:02:13
Message-ID: 20110125140213.E3E96AC8BA () svn ! kde ! org
[Download RAW message or body]
SVN commit 1217044 by mart:
favorites support
A contents/code (directory)
A contents/code/logic.js
M +16 -4 contents/ui/MessageWidget.qml
M +24 -21 contents/ui/PostingWidget.qml
M +1 -1 contents/ui/main.qml
M +1 -1 metadata.desktop
--- trunk/playground/base/plasma/declarative-applets/replacements/microblog/contents/ui/MessageWidget.qml \
#1217043:1217044 @@ -43,10 +43,22 @@
anchors.top: padding.top
text: i18n("%1 from %2", model["User"], model["Source"])
}
+ Row {
+ id: toolBoxRow
+ anchors.right: parent.right
+ anchors.rightMargin: 5
PlasmaComponents.ToolButton {
+ id: favoriteButton
+ text: "♥"
+ width: 24
+ height: 24
+ down: model["IsFavorite"]
+ onClicked: {
+ main.favoriteAsked(model["Id"], model["IsFavorite"] != "true");
+ }
+ }
+ PlasmaComponents.ToolButton {
id: replyButton
- anchors.right: repeatButton.left
- anchors.rightMargin: 5
text: "@"
width: 24
height: 24
@@ -56,7 +68,6 @@
}
PlasmaComponents.ToolButton {
id: repeatButton
- anchors.right: parent.right
text: "♻"
width: 24
height: 24
@@ -64,11 +75,12 @@
main.retweetAsked(model["Id"]);
}
}
+ }
Text {
anchors.leftMargin: 5
anchors.left: userIcon.right
anchors.right: padding.right
- anchors.top: repeatButton.bottom
+ anchors.top: toolBoxRow.bottom
anchors.bottomMargin: 5
text: model['Status']
wrapMode: Text.WordWrap
--- trunk/playground/base/plasma/declarative-applets/replacements/microblog/contents/ui/PostingWidget.qml \
#1217043:1217044 @@ -22,9 +22,24 @@
import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.qtextracomponents 0.1 as QtExtraComponents
+import "plasmapackage:/code/logic.js" as Logic
+
Item {
width: entryList.width
height: postWidget.height + 5
+
+ Component.onCompleted: {
+ Logic.messagesDataSource = messagesDataSource
+ }
+
+ function refresh()
+ {
+ postTextEdit.text = ""
+ postTextEdit.inReplyToStatusId = ""
+ Logic.refresh()
+ plasmoid.busy = true
+ }
+
PlasmaComponents.Frame {
id: postWidget
anchors.left: parent.left
@@ -60,17 +75,8 @@
onTextChanged: {
//yes, TextEdit doesn't have returnPressed sadly
if (text[text.length-1] == "\n") {
- var service = \
messagesDataSource.serviceForSource(messagesDataSource.connectedSources[0])
- var operation = service.operationDescription("update");
- operation.status = text;
- operation.in_reply_to_status_id = inReplyToStatusId
- service.startOperationCall(operation);
- text = ""
- inReplyToStatusId = ""
-
- operation = service.operationDescription("refresh");
- service.startOperationCall(operation);
- plasmoid.busy = true
+ Logic.update(text, inReplyToStatusId);
+ refresh()
} else if (text.length == 0) {
inReplyToStatusId = ""
}
@@ -82,17 +88,14 @@
postTextEdit.text = message
}
onRetweetAsked: {
- var service = \
messagesDataSource.serviceForSource(messagesDataSource.connectedSources[0])
- var operation = \
service.operationDescription("statuses/retweet");
- operation.id = id;
+ Logic.retweet(id)
+ refresh()
+ }
+ onFavoriteAsked: {
print(id)
- service.startOperationCall(operation);
- text = ""
- inReplyToStatusId = ""
-
- operation = service.operationDescription("refresh")
- service.startOperationCall(operation)
- plasmoid.busy = true
+ print(isFavorite)
+ Logic.setFavorite(id, isFavorite)
+ refresh()
}
}
}
--- trunk/playground/base/plasma/declarative-applets/replacements/microblog/contents/ui/main.qml \
#1217043:1217044 @@ -33,6 +33,7 @@
signal replyAsked(string id, string message)
signal retweetAsked(string id)
+ signal favoriteAsked(string id, bool isFavorite)
Component.onCompleted: {
plasmoid.addEventListener('ConfigChanged', configChanged);
@@ -55,7 +56,6 @@
plasmoid.busy = true
}
-
PlasmaCore.DataSource {
id: messagesDataSource
engine: "microblog"
--- trunk/playground/base/plasma/declarative-applets/replacements/microblog/metadata.desktop \
#1217043:1217044 @@ -17,7 +17,7 @@
X-KDE-PluginInfo-Name=org.kde.microblog
X-KDE-PluginInfo-Version=
X-KDE-PluginInfo-Website=
-X-KDE-ServiceTypes=Plasma/Applet
+X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet
X-Plasma-API=declarativeappletscript
X-Plasma-DefaultSize=200,100
X-Plasma-MainScript=ui/main.qml
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic