[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:11:20 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=aeaf0bd

The following commit has been merged in the master branch:
commit aeaf0bd75229288739ee1210a54328de980f547c
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date:   Thu Jul 28 00:55:44 2011 +0200

    ADD contact list with grid and list view
    
    this is a mockup start, very dirty. Optimizations are coming next
---
 package/contents/ui/{main.qml => ContactList.qml}  | 79 ++++++++++++----------
 .../{ExternalLabel.qml => GridContactDelegate.qml} | 41 ++++-------
 .../{ExternalLabel.qml => ListContactDelegate.qml} | 53 ++++++++-------
 package/contents/ui/main.qml                       | 73 +++++++++-----------
 4 files changed, 121 insertions(+), 125 deletions(-)

diff --git a/package/contents/ui/main.qml b/package/contents/ui/ContactList.qml
similarity index 55%
copy from package/contents/ui/main.qml
copy to package/contents/ui/ContactList.qml
index 625ce50..f4b6ad1 100644
--- a/package/contents/ui/main.qml
+++ b/package/contents/ui/ContactList.qml
@@ -18,58 +18,69 @@
  ***************************************************************************/
 
 import Qt 4.7
+
 // import nepomuk models
 import org.kde.telepathy.declarativeplugins 0.1 as TelepathyDeclarative
 
+/// TODO
+// - button to switch views
+// - (after above) animation from list to grid
+// - add bar @ the bottom for gridview (hidden in list view)
+// - get contact list to load nepomuk:/bla/foo/bar images as contact avatars
+// - add side panel with common contact actions
+// - highlight contacts on click
+
 Item {
-    id: main;
-    width: 200;
-    height: 500;
     anchors.fill: parent;
 
-    // load an instance of the model
-    TelepathyDeclarative.wrapper {
-        id: contactModel;
-    }
-
-    // contact listview
     ListView {
         id: contactsList;
-        model: contactModel;
         anchors.fill: parent;
+        model: TelepathyDeclarative.ContactListModel{}
 
         delegate:
-            Text {
-                text: displayName;
+            ListContactDelegate {
+                delegateDisplayName: displayName;
             }
     }
 
-    // set Label on the left
-    ExternalLabel {
-        id: label;
-        width: 150;
-        height: 30;
+    GridView {
+        id: contactsGrid;
+        anchors.fill: parent;
+        model: TelepathyDeclarative.ContactListModel{}
 
-        Component.onCompleted: {
-            setLabelOrientation();
-        }
+        cellWidth: 48;
+        cellHeight: 48;
 
-        onOrientationChanged: {
-            setLabelOrientation();
-        }
+        delegate:
+            GridContactDelegate {
+                delegateDisplayName: displayName;
+                delegateAvatar: avatar;
+            }
     }
 
-    // set correct orientation for components according to the
-    // contactlist orientation
-    function setLabelOrientation()
-    {
-        switch (label.orientation) {
-            case "left": {
-                label.anchors.bottom = main.bottom;
-                label.anchors.left = main.left;
-                label.transformOrigin = Item.BottomLeft;
-                label.rotation = 270;
+    states: [
+        State {
+            name: "listView";
+            PropertyChanges {
+                target: contactsList;
+                opacity: 1;
+            }
+            PropertyChanges {
+                target: contactsGrid;
+                opacity: 0;
+            }
+        },
+        State {
+            name: "gridView";
+            PropertyChanges {
+                target: contactsList;
+                opacity: 0;
+            }
+            PropertyChanges {
+                target: contactsGrid;
+                opacity: 1;
             }
         }
-    }
+    ]
 }
diff --git a/package/contents/ui/ExternalLabel.qml b/package/contents/ui/GridContactDelegate.qml
similarity index 60%
copy from package/contents/ui/ExternalLabel.qml
copy to package/contents/ui/GridContactDelegate.qml
index 75dd58e..7d33925 100644
--- a/package/contents/ui/ExternalLabel.qml
+++ b/package/contents/ui/GridContactDelegate.qml
@@ -18,38 +18,25 @@
  ***************************************************************************/
 
 import Qt 4.7
-import org.kde.plasma.core 0.1 as PlasmaCore
 import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
 
+/// TODO
+// - add status border (colour like on the presence plasmoid)
+// - bottom status bar with displayName on hover
+// - rounded borders for image
+
 Item {
-    id: label;
+    id: gridDelegate;
 
-    // this property holds which side the label is to be viewed. Default is left
-    // and changes when user changes screen edge from settings ui.
-    property string orientation: "left";
-    signal orientationChanged();
-    property QtObject theme: PlasmaCore.Theme {}
+    property string delegateDisplayName;
+    property string delegateAvatar;
 
-    PlasmaWidgets.IconWidget {
-        id: labelIcon;
-        icon: QIcon("kde-telepathy");
-        drawBackground: false;
-        text: i18n("ContactList");
-        orientation: QtHorizontal;
-        textBackgroundColor: theme.backgroundColor;
-        anchors.fill: parent;
-    }
+    width: 40;
+    height: 40;
 
-    function setOrientation(newOrientation)
-    {
-        if (newOrientation == "left"
-                || newOrientation == "right"
-                || newOrientation == "bottom"
-                || newOrientation == "top") {
-            label.orientation = newOrientation;
-            label.orientationChanged();
-        } else {
-            console.log("CAN'T SET FAILED ORIENTATION!");
-        }
+    PlasmaWidgets.IconWidget {
+        id: contactIcon;
+        icon: QIcon("im-user");         // temp icon until it's sorted out
+        anchors.centerIn: gridDelegate;
     }
 }
diff --git a/package/contents/ui/ExternalLabel.qml b/package/contents/ui/ListContactDelegate.qml
similarity index 62%
copy from package/contents/ui/ExternalLabel.qml
copy to package/contents/ui/ListContactDelegate.qml
index 75dd58e..1fa5592 100644
--- a/package/contents/ui/ExternalLabel.qml
+++ b/package/contents/ui/ListContactDelegate.qml
@@ -18,38 +18,43 @@
  ***************************************************************************/
 
 import Qt 4.7
-import org.kde.plasma.core 0.1 as PlasmaCore
 import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
 
 Item {
-    id: label;
+    id: delegate;
 
-    // this property holds which side the label is to be viewed. Default is left
-    // and changes when user changes screen edge from settings ui.
-    property string orientation: "left";
-    signal orientationChanged();
-    property QtObject theme: PlasmaCore.Theme {}
+    height: 30;
+    width: parent.width;
 
-    PlasmaWidgets.IconWidget {
-        id: labelIcon;
-        icon: QIcon("kde-telepathy");
-        drawBackground: false;
-        text: i18n("ContactList");
-        orientation: QtHorizontal;
-        textBackgroundColor: theme.backgroundColor;
+    property string delegateDisplayName;
+    property string delegateAvatar;
+
+    Text {
+        text: delegateDisplayName + delegateAvatar;
+        anchors {
+            right: parent.right;
+        }
+    }
+
+    Rectangle {
+        color: "transparent";
+        border.color: "red";
         anchors.fill: parent;
     }
 
-    function setOrientation(newOrientation)
-    {
-        if (newOrientation == "left"
-                || newOrientation == "right"
-                || newOrientation == "bottom"
-                || newOrientation == "top") {
-            label.orientation = newOrientation;
-            label.orientationChanged();
-        } else {
-            console.log("CAN'T SET FAILED ORIENTATION!");
+    PlasmaWidgets.IconWidget {
+        width: 30;
+        height: parent.height;
+        icon: QIcon("im-user");
+
+        anchors {
+            left: parent.left;
+            top: parent.top;        // not needed
+            bottom: parent.bottom;  // not needed
+        }
+
+        Component.onCompleted: {
+            console.log("LOADED: " + delegate.delegateAvatar);
         }
     }
 }
diff --git a/package/contents/ui/main.qml b/package/contents/ui/main.qml
index 625ce50..4be3e01 100644
--- a/package/contents/ui/main.qml
+++ b/package/contents/ui/main.qml
@@ -18,58 +18,51 @@
  ***************************************************************************/
 
 import Qt 4.7
-// import nepomuk models
-import org.kde.telepathy.declarativeplugins 0.1 as TelepathyDeclarative
 
 Item {
     id: main;
     width: 200;
-    height: 500;
+    height: 400;
     anchors.fill: parent;
 
-    // load an instance of the model
-    TelepathyDeclarative.wrapper {
-        id: contactModel;
-    }
+    // TODO make plasmoid busy when loading contacts on startup to avoid the user
+    // complaining about sluggish plasmoid. The "slowness" is caused by nepomuk storing 1000000000000 contacts
 
     // contact listview
-    ListView {
-        id: contactsList;
-        model: contactModel;
+    ContactList {
+        id: contactList;
         anchors.fill: parent;
-
-        delegate:
-            Text {
-                text: displayName;
-            }
+        state: "listView";      // start with list view
     }
 
-    // set Label on the left
-    ExternalLabel {
-        id: label;
-        width: 150;
-        height: 30;
 
-        Component.onCompleted: {
-            setLabelOrientation();
-        }
+    // THIS WILL NOT BE NEEDED.
+//    // set Label on the left
+//    ExternalLabel {
+//        id: label;
+//        width: 150;
+//        height: 30;
 
-        onOrientationChanged: {
-            setLabelOrientation();
-        }
-    }
+//        Component.onCompleted: {
+//            setLabelOrientation();
+//        }
 
-    // set correct orientation for components according to the
-    // contactlist orientation
-    function setLabelOrientation()
-    {
-        switch (label.orientation) {
-            case "left": {
-                label.anchors.bottom = main.bottom;
-                label.anchors.left = main.left;
-                label.transformOrigin = Item.BottomLeft;
-                label.rotation = 270;
-            }
-        }
-    }
+//        onOrientationChanged: {
+//            setLabelOrientation();
+//        }
+//    }
+
+//    // set correct orientation for components according to the
+//    // contactlist orientation
+//    function setLabelOrientation()
+//    {
+//        switch (label.orientation) {
+//            case "left": {
+//                label.anchors.bottom = main.bottom;
+//                label.anchors.left = main.left;
+//                label.transformOrigin = Item.BottomLeft;
+//                label.rotation = 270;
+//            }
+//        }
+//    }
 }

-- 
ktp-contact-applet packaging



More information about the pkg-kde-commits mailing list