Commit d7a2cf22 authored by Camilo higuita's avatar Camilo higuita

add remove option and confirmation dialog

parent 4b47bea2
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="180px" height="180px" viewBox="0 0 180 180" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<!-- Generator: Sketch 3.3.1 (12005) - http://www.bohemiancoding.com/sketch -->
<title>Circuit</title>
<desc>Created with Sketch.</desc>
<defs>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-1">
<feOffset dx="-5" dy="-9" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-2">
<feOffset dx="-5" dy="-9" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-3">
<feOffset dx="-5" dy="-9" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-4">
<feOffset dx="-5" dy="-9" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-5">
<feOffset dx="-5" dy="-6" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-6">
<feOffset dx="-5" dy="-9" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-7">
<feOffset dx="-5" dy="-6" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-8">
<feOffset dx="-5" dy="-3" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-9">
<feOffset dx="-5" dy="-3" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-10">
<feOffset dx="-5" dy="-3" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
<filter x="-50%" y="-50%" width="200%" height="200%" filterUnits="objectBoundingBox" id="filter-11">
<feOffset dx="-5" dy="-3" in="SourceAlpha" result="shadowOffsetInner1"></feOffset>
<feGaussianBlur stdDeviation="0" in="shadowOffsetInner1" result="shadowBlurInner1"></feGaussianBlur>
<feComposite in="shadowBlurInner1" in2="SourceAlpha" operator="arithmetic" k2="-1" k3="1" result="shadowInnerInner1"></feComposite>
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.105 0" in="shadowInnerInner1" type="matrix" result="shadowMatrixInner1"></feColorMatrix>
<feMerge>
<feMergeNode in="SourceGraphic"></feMergeNode>
<feMergeNode in="shadowMatrixInner1"></feMergeNode>
</feMerge>
</filter>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Circuit" sketch:type="MSLayerGroup" transform="translate(16.000000, 13.000000)">
<circle id="Oval-373" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="28.8888889" cy="42.8163265" r="13.361867"></circle>
<ellipse id="Oval-373" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="123.296296" cy="60.9591837" rx="13.7037037" ry="13.6734694"></ellipse>
<ellipse id="Oval-373" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="124.296296" cy="97.244898" rx="13.7037037" ry="13.6734694"></ellipse>
<ellipse id="Oval-373" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="13.7037037" cy="85.5714286" rx="13.7037037" ry="13.6734694"></ellipse>
<circle id="Oval-80" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="50" cy="68" r="8"></circle>
<circle id="Oval-80" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="69" cy="26" r="8"></circle>
<circle id="Oval-80" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="94" cy="79" r="8"></circle>
<circle id="Oval-80" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="83" cy="149" r="6"></circle>
<circle id="Oval-80" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="70" cy="129" r="6"></circle>
<circle id="Oval-80" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="89" cy="6" r="6"></circle>
<circle id="Oval-80" fill="#FFFFFF" sketch:type="MSShapeGroup" cx="56" cy="149" r="6"></circle>
<circle id="Oval-381" fill="#D599FF" filter="url(#filter-1)" sketch:type="MSShapeGroup" cx="32.8888889" cy="46.8163265" r="13.361867"></circle>
<ellipse id="Oval-378" fill="#7EC9C4" filter="url(#filter-2)" sketch:type="MSShapeGroup" cx="127.296296" cy="64.9591837" rx="13.7037037" ry="13.6734694"></ellipse>
<ellipse id="Oval-379" fill="#D599FF" filter="url(#filter-3)" sketch:type="MSShapeGroup" cx="128.296296" cy="101.244898" rx="13.7037037" ry="13.6734694"></ellipse>
<ellipse id="Oval-380" fill="#7EC9C4" filter="url(#filter-4)" sketch:type="MSShapeGroup" cx="17.7037037" cy="89.5714286" rx="13.7037037" ry="13.6734694"></ellipse>
<circle id="Oval-88" fill="#D599FF" filter="url(#filter-5)" sketch:type="MSShapeGroup" cx="53" cy="71" r="8"></circle>
<circle id="Oval-89" fill="#7EC9C4" filter="url(#filter-6)" sketch:type="MSShapeGroup" cx="73" cy="30" r="8"></circle>
<circle id="Oval-90" fill="#5FDC76" filter="url(#filter-7)" sketch:type="MSShapeGroup" cx="97" cy="82" r="8"></circle>
<circle id="Oval-91" fill="#5FDC76" filter="url(#filter-8)" sketch:type="MSShapeGroup" cx="86" cy="151" r="6"></circle>
<circle id="Oval-92" fill="#5FDC76" filter="url(#filter-9)" sketch:type="MSShapeGroup" cx="73" cy="131" r="6"></circle>
<circle id="Oval-93" fill="#D599FF" filter="url(#filter-10)" sketch:type="MSShapeGroup" cx="92" cy="8" r="6"></circle>
<circle id="Oval-94" fill="#D599FF" filter="url(#filter-11)" sketch:type="MSShapeGroup" cx="59" cy="151" r="6"></circle>
<circle id="Oval-377" stroke="#535353" stroke-width="2" sketch:type="MSShapeGroup" cx="28.8888889" cy="42.8163265" r="13.361867"></circle>
<ellipse id="Oval-374" stroke="#535353" stroke-width="2" sketch:type="MSShapeGroup" cx="123.296296" cy="60.9591837" rx="13.7037037" ry="13.6734694"></ellipse>
<ellipse id="Oval-375" stroke="#535353" stroke-width="2" sketch:type="MSShapeGroup" cx="124.296296" cy="97.244898" rx="13.7037037" ry="13.6734694"></ellipse>
<ellipse id="Oval-376" stroke="#535353" stroke-width="2" sketch:type="MSShapeGroup" cx="13.7037037" cy="85.5714286" rx="13.7037037" ry="13.6734694"></ellipse>
<circle id="Oval-81" stroke="#535353" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" sketch:type="MSShapeGroup" cx="50" cy="68" r="8"></circle>
<circle id="Oval-82" stroke="#535353" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" sketch:type="MSShapeGroup" cx="69" cy="26" r="8"></circle>
<circle id="Oval-83" stroke="#535353" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" sketch:type="MSShapeGroup" cx="94" cy="79" r="8"></circle>
<circle id="Oval-84" stroke="#535353" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" sketch:type="MSShapeGroup" cx="83" cy="149" r="6"></circle>
<circle id="Oval-85" stroke="#535353" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" sketch:type="MSShapeGroup" cx="70" cy="129" r="6"></circle>
<circle id="Oval-86" stroke="#535353" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" sketch:type="MSShapeGroup" cx="89" cy="6" r="6"></circle>
<circle id="Oval-87" stroke="#535353" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" sketch:type="MSShapeGroup" cx="56" cy="149" r="6"></circle>
<path d="M42.5925926,43 L56.2962963,43 C63.8646429,43 70,49.1446297 70,56.7070137 L70,123" id="Rectangle-314" stroke="#535353" stroke-width="2" sketch:type="MSShapeGroup"></path>
<path d="M27.4074074,85 L41.7037037,85 C49.5993301,85 56,91.4007494 56,99.2998667 L56,143" id="Rectangle-314" stroke="#535353" stroke-width="2" sketch:type="MSShapeGroup"></path>
<path d="M83.1851852,98 L96.8888889,98 C104.457235,98 110.592593,104.139201 110.592593,111.700068 L110.592593,143" id="Rectangle-314" stroke="#535353" stroke-width="2" sketch:type="MSShapeGroup" transform="translate(96.888889, 120.500000) scale(-1, 1) translate(-96.888889, -120.500000) "></path>
<path d="M109.592593,62 L99.2962962,62 C93.6098088,62 88.9999999,57.420644 89,51.7305291 L89.0000005,11.4033207" id="Rectangle-314" stroke="#535353" stroke-width="2" sketch:type="MSShapeGroup"></path>
</g>
</g>
</svg>
\ No newline at end of file
<RCC>
<qresource prefix="/">
<file>smartphone.svg</file>
<file>Circuit.svg</file>
</qresource>
</RCC>
......@@ -23,6 +23,11 @@ bool Synchroniser::updateContact(const FMH::MODEL &contact)
return this->dba->updateContact(contact);
}
bool Synchroniser::removeContact(const FMH::MODEL &contact)
{
return this->dba->removeContact(contact[FMH::MODEL_KEY::ID]);
}
vCard Synchroniser::tovCard(const FMH::MODEL &contact)
{
Q_UNUSED(contact);
......
......@@ -21,6 +21,7 @@ public:
FMH::MODEL_LIST getContacts(const QString &query);
bool insertContact(const FMH::MODEL &contact);
bool updateContact(const FMH::MODEL &contact);
bool removeContact(const FMH::MODEL &contact);
private:
DBActions *dba;
......
......@@ -24,7 +24,7 @@ Maui.ApplicationWindow
/** UI PROPS**/
// altToolBars: true
// altToolBars: true
bgColor: viewBackgroundColor
highlightColor: "#ff6a83"
......@@ -100,6 +100,27 @@ Maui.ApplicationWindow
ContactDialog
{
id: _contactDialog
rejectButton.visible: true
rejectButton.text: "Remove"
Maui.Dialog
{
id: _removeDialog
title: qsTr("Remove contact...")
message: qsTr("Are you sure you want to remove this contact? This action can not be undone.")
onRejected: close()
onAccepted:
{
close()
_contactDialog.close()
_contacsView.list.remove(_contacsView.listView.currentIndex)
}
}
onRejected: _removeDialog.open()
}
EditContactDialog
......
......@@ -169,6 +169,22 @@ bool ContactsModel::update(const QVariantMap &map, const int &index)
return false;
}
bool ContactsModel::remove(const int &index)
{
if(index >= this->list.size() || index < 0)
return false;
if(this->syncer->removeContact(this->list[index]))
{
emit this->preItemRemoved(index);
this->list.removeAt(index);
emit this->postItemRemoved();
return true;
}
return false;
}
void ContactsModel::append(const QVariantMap &item)
{
if(item.isEmpty())
......
......@@ -59,6 +59,7 @@ public slots:
QVariantMap get(const int &index) const override;
bool insert(const QVariantMap &map) override;
bool update(const QVariantMap &map, const int &index) override;
bool remove(const int &index);
void append(const QVariantMap &item, const int &at);
void append(const QVariantMap &item);
......
......@@ -151,7 +151,7 @@ ItemDelegate
{
Layout.fillHeight: true
Layout.fillWidth: true
text: model.title
text: model.tel
font.pointSize: fontSizes.small
font.weight: Font.Light
wrapMode: Text.WrapAnywhere
......@@ -191,7 +191,7 @@ ItemDelegate
Layout.fillWidth: true
Layout.alignment: Qt.AlignRight
horizontalAlignment: Qt.AlignRight
text: model.tel
text: model.title
font.pointSize: fontSizes.small
font.weight: Font.Light
wrapMode: Text.WrapAnywhere
......
......@@ -68,7 +68,21 @@ Maui.Page
id: _contactsList
}
content: ListView
Maui.Holder
{
id: _holder
emoji: "qrc:/Circuit.svg"
isMask: false
title: qsTr("There's not contacts")
body: qsTr("Add new contacts")
emojiSize: iconSizes.huge
visible: !listView.count
onActionTriggered: _newContactDialog.open()
}
ListView
{
id: _listView
anchors.fill: parent
......
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