Commit cbddcfc2 authored by camilo higuita's avatar camilo higuita

bringin up to date. one single edit contact page for creating and updating...

bringin up to date. one single edit contact page for creating and updating contacts and move from dialogs popups to pages
parent d80ba6a6
......@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
MauiApp::instance()->setIconName("qrc:/contacts.svg");
KLocalizedString::setApplicationDomain("communicator");
KAboutData about(QStringLiteral("communicator"), i18n("Communicator"), COMMUNICATOR_VERSION_STRING, i18n("Communicator keeps your contacts synced across devices and allows you to make calls, send messages and organize."),
KAboutData about(QStringLiteral("communicator"), i18n("Communicator"), COMMUNICATOR_VERSION_STRING, i18n("Communicator keeps your contacts synced and organized across devices."),
KAboutLicense::LGPL_V3, i18n("© 2019-2020 Nitrux Development Team"));
about.addAuthor(i18n("Camilo Higuita"), i18n("Developer"), QStringLiteral("milo.h@aol.com"));
about.setHomepage("https://mauikit.org");
......
......@@ -53,6 +53,7 @@ Maui.ApplicationWindow
Maui.AppView.iconName: "view-pim-contacts"
Maui.AppView.title: qsTr("Contacts")
list.query: ""
showNewButton: true
showAccountFilter: Maui.Handy.isAndroid
holder.emoji: "qrc:/list-add-user.svg"
holder.title: i18n("There's no contacts")
......
......@@ -4,7 +4,6 @@
<file>views/contacts/ContactsView.qml</file>
<file>views/contacts/ContactDelegate.qml</file>
<file>views/contacts/ContactPage.qml</file>
<file>views/contacts/EditContactDialog.qml</file>
<file>views/dialer/Dialer.qml</file>
<file>views/dialer/DialerView.qml</file>
<file>widgets/MessageComposer.qml</file>
......
......@@ -19,7 +19,7 @@ Maui.SwipeBrowserDelegate
signal favClicked(int index)
property int radius : Maui.Style.radiusV * 2
property int radius : Maui.Style.radiusV
iconSizeHint: Maui.Style.iconSizes.huge
label1.text: model.n
......@@ -52,23 +52,15 @@ iconVisible: control.width > Kirigami.Units.gridUnit * 15
Rectangle
{
height: parent.height * 0.7
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
Kirigami.Theme.inherit: false
height: parent.height * 0.8
width: height
anchors.centerIn: parent
radius: control.radius
color:
{
var c = Qt.rgba(Math.random(),Math.random(),Math.random(),1)
return Qt.hsla(c.hslHue, 0.7, c.hslLightness, c.a);
}
// color: Qt.hsl(Math.random(),Math.random(),Math.random(),1);
// color: "hsl(" + 360 * Math.random() + ',' +
// (25 + 70 * Math.random()) + '%,' +
// (85 + 10 * Math.random()) + '%)';
color: Kirigami.Theme.backgroundColor
border.color: Qt.darker(color, 1.5)
Loader
{
id: _contactPicLoader
......@@ -128,7 +120,7 @@ iconVisible: control.width > Kirigami.Units.gridUnit * 15
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
color: "white"
color: Kirigami.Theme.textColor
font.pointSize: Maui.Style.fontSizes.huge
font.bold: true
font.weight: Font.Bold
......@@ -141,23 +133,16 @@ iconVisible: control.width > Kirigami.Units.gridUnit * 15
quickActions: [
Action
{
icon.name: "draw-star"
onTriggered:
{
control.favClicked(index)
}
icon.color: model.fav == "1" ? "yellow" : Kirigami.Theme.textColor
},
// Action
// {
// icon.name: "draw-star"
// onTriggered:
// {
// control.favClicked(index)
// }
Action
{
icon.name: "document-share"
onTriggered: if(Maui.Handy.isAndroid) Maui.Android.shareContact(model.id)
icon.color: Kirigami.Theme.textColor
},
// icon.color: model.fav == "1" ? "yellow" : Kirigami.Theme.textColor
// },
Action
{
......@@ -173,6 +158,7 @@ iconVisible: control.width > Kirigami.Units.gridUnit * 15
Action
{
enabled: Kirigami.Settings.isMobile
icon.name: "call-start"
icon.color: Kirigami.Theme.textColor
......
This diff is collapsed.
......@@ -17,6 +17,7 @@ StackView
property alias viewType: _contactsPage.viewType
property bool showAccountFilter: false
property bool showNewButton: false
property var currentContact : ({})
......@@ -79,6 +80,7 @@ StackView
Maui.FloatingButton
{
visible: control.showNewButton
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: Maui.Style.space.big
......@@ -87,7 +89,7 @@ StackView
icon.name: "list-add-user"
onClicked:
{
control.push(_newContactPage)
control.openContact(({}))
}
}
......@@ -183,7 +185,7 @@ StackView
}
listDelegate:ContactDelegate
listDelegate: ContactDelegate
{
id: _delegate
......@@ -223,9 +225,10 @@ StackView
Component
{
id: _newContactPage
EditContactDialog
id: _contactPage
ContactPage
{
contact: control.currentContact
headBar.farLeftContent: ToolButton
{
icon.name: "go-previous"
......@@ -235,27 +238,18 @@ StackView
}
}
onNewContact:
onContactEdited:
{
_contacsView.list.insert(contact)
notify("list-add-user", i18n("New contact added"), contact.n)
}
}
}
Component
{
id: _contactPage
ContactPage
{
contact: control.currentContact
headBar.farLeftContent: ToolButton
{
icon.name: "go-previous"
onClicked:
console.log(contact.id)
if(contact.id)
{
_contactsList.update(contact, _contactsPage.currentIndex)
}else
{
control.pop()
_contactsList.insert(contact)
notify("list-add-user", i18n("New contact added"), contact.n)
}
}
}
}
......
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0
import org.kde.mauikit 1.2 as Maui
import org.kde.kirigami 2.7 as Kirigami
Maui.Page
{
id: control
property var contact : ({})
signal newContact(var contact)
// onAccepted:
// {
// var contact =({
// n: _nameField.text,
// tel: _telField.text,
// email: _emailField.text,
// org: _orgField.text,
// // adr: _adrField.text,
// photo: control.contact.photo,
// account: Maui.Handy.isAndroid ? _accountsCombobox.model[_accountsCombobox.currentIndex] :({})
// })
// if(contact.n.length && contact.tel.length)
// newContact(contact)
// control.clear()
// }
ColumnLayout
{
id: _layout
anchors.fill:parent
Item
{
id: _contactPic
Layout.fillWidth: true
Layout.preferredHeight: Maui.Style.iconSizes.huge
Rectangle
{
height: Math.min(parent.height, control.width)
width: height
anchors.centerIn: parent
radius: Maui.Style.radiusV* 2
color: Qt.rgba(Math.random(),Math.random(),Math.random(),1);
border.color: Qt.darker(color, 1.5)
MouseArea
{
anchors.fill: parent
onClicked:{
_dialogLoader.sourceComponent = _fileDialogComponent
dialog.show(function(paths)
{
console.log("selected image", paths)
contact.photo = paths[0]
_contactPicLoader.sourceComponent = _imgComponent
_contactPicLoader.item.source = contact.photo
})
}
}
Loader
{
id: _contactPicLoader
anchors.fill: parent
sourceComponent: contact.photo ? _imgComponent : _iconComponent
}
Component
{
id: _imgComponent
Image
{
id: _img
width: parent.width
height: width
anchors.centerIn: parent
sourceSize.width: parent.width
sourceSize.height: parent.height
fillMode: Image.PreserveAspectCrop
cache: true
antialiasing: true
smooth: true
asynchronous: true
source: "image://contact/"+ contact.id
layer.enabled: true
layer.effect: OpacityMask
{
maskSource: Item
{
width: _img.width
height: _img.height
Rectangle
{
anchors.centerIn: parent
width: _img.width
height: _img.height
radius: Maui.Style.radiusV* 2
}
}
}
}
}
Component
{
id: _iconComponent
// Maui.ToolButton
// {
// iconName: "view-media-artist"
// size: iconSizes.big
// iconColor: "white"
// }
Label
{
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
color: "white"
font.pointSize: Maui.Style.fontSizes.huge * 1.5
font.bold: true
font.weight: Font.Bold
text: "+"
}
}
}
}
Kirigami.ScrollablePage
{
Layout.fillWidth: true
Layout.fillHeight: true
Kirigami.Theme.backgroundColor: "transparent"
padding: 0
leftPadding: padding
rightPadding: padding
topPadding: padding
bottomPadding: padding
// ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ColumnLayout
{
id: _formLayout
width: _layout.width * 0.95
// implicitHeight: control.height
spacing: Maui.Style.space.large
Column
{
Layout.fillWidth: true
spacing: Maui.Style.space.small
visible: Maui.Handy.isAndroid
Label
{
text: i18n("Account")
font.pointSize: Maui.Style.fontSizes.default
font.bold: true
font.weight: Font.Bold
color: Kirigami.Theme.textColor
}
ComboBox
{
id: _accountsCombobox
textRole: "account"
popup.z: control.z +1
width: parent.width
}
}
Column
{
Layout.fillWidth: true
spacing: Maui.Style.space.small
Label
{
text: i18n("Name")
font.pointSize: Maui.Style.fontSizes.default
font.bold: true
font.weight: Font.Bold
color: Kirigami.Theme.textColor
}
Maui.TextField
{
id: _nameField
width: parent.width
text: contact.n
}
}
Column
{
Layout.fillWidth: true
spacing: Maui.Style.space.small
Label
{
text: i18n("Phone")
font.pointSize: Maui.Style.fontSizes.default
font.bold: true
font.weight: Font.Bold
color: Kirigami.Theme.textColor
}
Maui.TextField
{
id: _telField
width: parent.width
text: contact.tel
inputMethodHints: Qt.ImhDigitsOnly
}
}
Column
{
Layout.fillWidth: true
spacing: Maui.Style.space.small
Label
{
text: i18n("Email")
font.pointSize: Maui.Style.fontSizes.default
font.bold: true
font.weight: Font.Bold
color: Kirigami.Theme.textColor
}
Maui.TextField
{
id: _emailField
width: parent.width
text: contact.email
}
}
Column
{
Layout.fillWidth: true
spacing: Maui.Style.space.small
Label
{
text: i18n("Organization")
font.pointSize: Maui.Style.fontSizes.default
font.bold: true
font.weight: Font.Bold
color: Kirigami.Theme.textColor
}
Maui.TextField
{
id: _orgField
width: parent.width
text: contact.org
}
}
// Column
// {
// Layout.fillWidth: true
// spacing: space.small
// Label
// {
// text: i18n("Phone")
// font.pointSize: fontSizes.default
// font.bold: true
// font.weight: Font.Bold
// }
// Maui.TextField
// {
// width: parent.width
// text: contact.tel
// inputMethodHints: Qt.ImhDigitsOnly
// }
// }
// Column
// {
// Layout.fillWidth: true
// spacing: space.small
// Label
// {
// text: i18n("Address")
// font.pointSize: fontSizes.default
// font.bold: true
// font.weight: Font.Bold
// color: textColor
// }
// Maui.TextField
// {
// id: _adrField
// width: parent.width
// text: contact.adr
// }
// }
}
}
}
function clear()
{
_nameField.clear()
_telField.clear()
_emailField.clear()
_orgField.clear()
// _adrField.clear()
// _img.source = ""
_contactPicLoader.sourceComponent = _iconComponent
control.close()
}
Component.onCompleted:
{
var androidAccounts = _contacsView.list.getAccounts();
_accountsCombobox.model = androidAccounts;
}
}
......@@ -43,12 +43,10 @@ Maui.Dialog
rejectButton.visible: false
ComboBox
headBar.middleContent: ComboBox
{
id: _combobox
Layout.fillWidth: true
Layout.margins: Maui.Style.space.small
Layout.preferredHeight: Maui.Style.toolBarHeightAlt
// text: Maui.Handy.isAndroid ? contact.tel : contact.email
font.bold: true
......@@ -67,24 +65,22 @@ Maui.Dialog
popup.z: control.z + 1
}
Maui.TextField
{
id: _subjectTextField
visible: _combobox.currentText === contact.email
Layout.fillWidth: true
Layout.margins: Maui.Style.space.small
Layout.preferredHeight: Maui.Style.toolBarHeightAlt
placeholderText: i18n("Subject")
font.bold: true
font.weight: Font.Bold
font.pointSize: Maui.Style.fontSizes.big
}
Maui.Editor
{
id: _editor
Layout.fillHeight: true
Layout.fillWidth: true
headBar.middleContent: Maui.TextField
{
id: _subjectTextField
visible: _combobox.currentText === contact.email
Layout.fillWidth: true
placeholderText: i18n("Subject")
font.bold: true
font.weight: Font.Bold
font.pointSize: Maui.Style.fontSizes.big
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment