Ask / Submit

Revision history [back]

click to hide/show revision 1
initial version

posted 2014-04-02 21:16:37 +0200

Full version of my CallLogItem.qml file... for anyone who is going to try this:

import QtQuick 2.0
import Sailfish.Silica 1.0
import org.nemomobile.commhistory 1.0
import org.nemomobile.contacts 1.0

ListItem {
id: root
property date time: new Date()
property int eventCount
property bool missedCall
property var remoteUid
property alias connection: connectionText.text
property alias dateColumnVisible: dateColumn.visible
property alias iconSource: icon.source
property color primaryColor: Theme.primaryColor
property color secondaryColor: Theme.secondaryColor
property Person person
property bool privateNumber: remoteUid === ""
// less than 24 hours old (24*60*60*1000)
property bool occuredToday: missedCall ? new Date() - 86400000 < time.getTime() : false

width: parent ? parent.width : 0

Connections {
    target: Qt.application
    // less than 24 hours old (24*60*60*1000)
    onActiveChanged: if (Qt.application.active && missedCall) root.occuredToday = new Date() - 86400000 < time.getTime()
}

Row {
    anchors {
        left: parent.left; right: dateColumn.left
        verticalCenter: parent.verticalCenter
        leftMargin: callLogIcon.width
        rightMargin: Theme.paddingSmall
    }

    spacing: Theme.paddingSmall

    Label {
        id: firstNameText
        opacity: privateNumber ? 0.5 : 1.0
        text: people.populated || remoteUid !== undefined
                  ? (!person || (person.primaryName.length === 0 && person.secondaryName.length === 0)
                         ? main.formatNumber(remoteUid)
                         : person.primaryName)
                  : ""

        color: highlighted ? Theme.highlightColor : primaryColor
        truncationMode: TruncationMode.Fade
        width: Math.min(implicitWidth, parent.width)
    }
    Label {
        id: secondaryNameText
        text: people.populated && person ? person.secondaryName : ""
        color: highlighted ? Theme.secondaryHighlightColor : secondaryColor
        truncationMode: TruncationMode.Fade
        width: Math.min(implicitWidth, parent.width - firstNameText.width)
        visible: width > 0
    }

    Label {
        text: people.populated && person ? "("+main.formatNumber(remoteUid)+")": ""
        color: highlighted ? Theme.highlightColor : primaryColor
        font.pixelSize: Theme.fontSizeExtraSmall
        truncationMode: TruncationMode.Fade
        width: Math.min(implicitWidth, parent.width - firstNameText.width - secondaryNameText.width)
        visible: width > 0
    }


}

Column {
    id: dateColumn
    anchors {
        rightMargin: Theme.paddingLarge
        right: parent.right
        verticalCenter: parent.verticalCenter
    }
    Label {
        text: Format.formatDate(time, Formatter.TimepointRelativeCurrentDay)
        font.pixelSize: Theme.fontSizeExtraSmall
        anchors.right: parent.right
        color: highlighted ? Theme.highlightColor : primaryColor
    }
    Label {
        id: connectionText
        font.pixelSize: Theme.fontSizeExtraSmall
        anchors.right: parent.right
        color: highlighted ? Theme.secondaryHighlightColor : secondaryColor
        visible: connection !== "Mobile"
    }
}

Image {
    id: icon
    anchors.verticalCenter: parent.verticalCenter

    Loader {
        anchors {
            bottom: parent.top
            bottomMargin: -Theme.paddingMedium - Theme.paddingSmall
            horizontalCenter: parent.horizontalCenter
            horizontalCenterOffset: Theme.paddingSmall
        }
        source: missedCall && eventCount > 1 ? "../../common/MissedCallLabel.qml" : ""
        }
    }
}

Full version of my CallLogItem.qml file... for anyone who is going Right, I've replaced the full file with a diff that can be used to try this:patch the original file. I've also incorporated a fix to have the number appear below the name. The diff follows:

import QtQuick 2.0
import Sailfish.Silica 1.0
import org.nemomobile.commhistory 1.0
import org.nemomobile.contacts 1.0

ListItem {
id: root
property date time: new Date()
property int eventCount
property bool missedCall
property var remoteUid
property alias connection: connectionText.text
property alias dateColumnVisible: dateColumn.visible
property alias iconSource: icon.source
property color primaryColor: Theme.primaryColor
property color secondaryColor: Theme.secondaryColor
property Person person
property bool privateNumber: remoteUid === ""
// less than 24 hours old (24*60*60*1000)
property bool occuredToday: missedCall ? new Date() - 86400000 < time.getTime() : false

width: parent ? parent.width : 0

Connections {
    target: Qt.application
    // less than 24 hours old (24*60*60*1000)
    onActiveChanged: if (Qt.application.active && missedCall) root.occuredToday = new Date() - 86400000 < time.getTime()
--- CallLogItem.qml 2014-04-11 10:06:47.668188992 +0100
+++ CallLogItem-ro.qml      2014-04-11 11:43:22.981023867 +0100
@@ -38,27 +38,55 @@
         }

Row {
    anchors {
        left: parent.left; right: dateColumn.left
        verticalCenter: parent.verticalCenter
        leftMargin: callLogIcon.width
        rightMargin: Theme.paddingSmall
    }

     spacing: Theme.paddingSmall
 -
-        Label {
-            id: firstNameText
-            opacity: privateNumber ? 0.5 : 1.0
-            text: people.populated || remoteUid !== undefined
+        Item {
+            id: nameItem
+            width: parent.width
+
+            Label {
+                id: firstNameText
+                anchors {
+                    left: parent.left;
+                    verticalCenter: parent.verticalCenter
+                }
+                opacity: privateNumber ? 0.5 : 1.0
+                text: people.populated || remoteUid !== undefined
                       ? (!person || (person.primaryName.length === 0 && person.secondaryName.length === 0)
                          ? main.formatNumber(remoteUid)
-                             : person.primaryName)
+                             : person.primaryName+" ")
                       : ""
 +                color: highlighted ? Theme.highlightColor : primaryColor
+                truncationMode: TruncationMode.Fade
+                width: Math.min(implicitWidth, parent.width)
+            }
+            Label {
+                id: secondaryNameText
+                anchors {
+                    left: firstNameText.right;
+                    verticalCenter: parent.verticalCenter;
+                } 
+                text: people.populated && person ? person.secondaryName : ""
+                color: highlighted ? Theme.secondaryHighlightColor : secondaryColor
+                truncationMode: TruncationMode.Fade
+                width: Math.min(implicitWidth, parent.width - firstNameText.width)
+                visible: width > 0
+            }
 +            
+            Label {
+                text: people.populated && person ? "("+main.formatNumber(remoteUid)+")": main.formatNumber(remoteUid): ""
+                anchors {
+                    left: parent.left;
+                    top: firstNameText.bottom;
+                    verticalCenter: parent.verticalCenter;
+                }
+                color: highlighted ? Theme.highlightColor : primaryColor
+                font.pixelSize: Theme.fontSizeExtraSmall
+                truncationMode: TruncationMode.Fade
+                width: Math.min(implicitWidth, parent.width - firstNameText.width - secondaryNameText.width)
parent.width)
+                visible: width > 0
+            }


}

Column {
    id: dateColumn
    anchors {
        rightMargin: Theme.paddingLarge
        right: parent.right
        verticalCenter: parent.verticalCenter
    }
    Label {
        text: Format.formatDate(time, Formatter.TimepointRelativeCurrentDay)
        font.pixelSize: Theme.fontSizeExtraSmall
        anchors.right: parent.right
-            color: highlighted ? Theme.highlightColor : primaryColor
-            truncationMode: TruncationMode.Fade
-            width: Math.min(implicitWidth, parent.width)
-        }
-        Label {
        id: connectionText
        font.pixelSize: Theme.fontSizeExtraSmall
        anchors.right: parent.right
-            text: people.populated && person ? person.secondaryName : ""
-            color: highlighted ? Theme.secondaryHighlightColor : secondaryColor
-            truncationMode: TruncationMode.Fade
-            width: Math.min(implicitWidth, parent.width - firstNameText.width)
-            visible: connection !== "Mobile"
width > 0
         }
+
     }

Image      Column {
    id: icon
    anchors.verticalCenter: parent.verticalCenter

    Loader {
        anchors {
            bottom: parent.top
            bottomMargin: -Theme.paddingMedium - Theme.paddingSmall
            horizontalCenter: parent.horizontalCenter
            horizontalCenterOffset: Theme.paddingSmall
        }
        source: missedCall && eventCount > 1 ? "../../common/MissedCallLabel.qml" : ""
        }
    }
}

To incorporate this fix, you can copy the content of the patch above, and save it to /usr/share/voicecall-ui-jolla/qml/pages/calllog/CallLogItem.patch

Backup your original CallLogItem.qml file. I just copied it to CallLogItem.qml.orig:

cp CallLogItem.qml CallLogItem.qml.orig

Make sure you have 'patch' installed:

pkcon install patch

In /usr/share/voicecall-ui-jolla/qml/pages/calllog/ run:

patch < CallLogItem.patch

To see the change without having to reboot your phone, run the following as the nemo user:

systemctl --user restart voicecall-ui-prestart.service

Reopen your calllog and check that everything looks okay. If not... revert to the original Jolla CallLogItem.qml file.