Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Maui
Communicator
Commits
d80ba6a6
Commit
d80ba6a6
authored
Nov 03, 2020
by
Camilo Higuita
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bring up to date to latest mauikit and ditch the popups dialogs
parent
be1076cd
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
623 additions
and
575 deletions
+623
-575
src/main.qml
src/main.qml
+34
-67
src/qml.qrc
src/qml.qrc
+2
-1
src/views/contacts/ContactDelegate.qml
src/views/contacts/ContactDelegate.qml
+114
-263
src/views/contacts/ContactPage.qml
src/views/contacts/ContactPage.qml
+12
-16
src/views/contacts/ContactsBrowser.qml
src/views/contacts/ContactsBrowser.qml
+165
-0
src/views/contacts/ContactsView.qml
src/views/contacts/ContactsView.qml
+218
-133
src/views/contacts/EditContactDialog.qml
src/views/contacts/EditContactDialog.qml
+23
-32
src/views/dialer/DialerView.qml
src/views/dialer/DialerView.qml
+11
-11
src/views/logs/LogsView.qml
src/views/logs/LogsView.qml
+5
-10
src/widgets/MessageComposer.qml
src/widgets/MessageComposer.qml
+39
-42
No files found.
src/main.qml
View file @
d80ba6a6
import
QtQuick
2.9
import
QtQuick
.
Controls
2.3
import
org
.
kde
.
mauikit
1.0
as
Maui
import
org
.
kde
.
mauikit
1.1
as
MauiLab
import
org
.
kde
.
mauikit
1.2
as
Maui
import
org
.
kde
.
kirigami
2.8
as
Kirigami
import
QtQuick
.
Layouts
1.3
...
...
@@ -14,27 +13,17 @@ import "widgets"
Maui.ApplicationWindow
{
id
:
root
title
:
Maui
.
App
.
displayName
//
title: Maui.App.displayName
readonly
property
var
views
:
({
favs
:
0
,
log
:
1
,
contacts
:
2
,
dialer
:
3
,
contacts
:
1
,
log
:
2
})
/** UI PROPS**/
property
color
cardColor
:
Qt
.
darker
(
Maui
.
Style
.
buttonBackgroundColor
,
1.05
)
readonly
property
alias
dialog
:
_dialogLoader
.
item
headBar.rightContent
:
ToolButton
{
id
:
_dialerButton
icon.name
:
"
dialer-call
"
checked
:
swipeView
.
currentIndex
===
views
.
dialer
onClicked
:
swipeView
.
currentIndex
=
views
.
dialer
}
MauiLab.AppViews
Maui.AppViews
{
id
:
swipeView
anchors.fill
:
parent
...
...
@@ -43,96 +32,74 @@ Maui.ApplicationWindow
{
if
(
currentIndex
===
views
.
contacts
)
_contacsView
.
list
.
query
=
""
else
if
(
currentIndex
===
views
.
dialer
)
_contacsView
.
list
.
query
=
_dialerView
.
dialString
}
ContactsView
{
id
:
_favsView
Maui
Lab
.AppView.iconName
:
"
draw-star
"
Maui
Lab
.AppView.title
:
qsTr
(
"
Favorites
"
)
Maui.AppView.iconName
:
"
draw-star
"
Maui.AppView.title
:
qsTr
(
"
Favorites
"
)
list.query
:
"
fav=1
"
headBar.visible
:
false
gridView
:
true
viewType
:
Maui
.
AltBrowser
.
ViewType
.
Grid
holder.emoji
:
"
qrc:/star.svg
"
holder.title
:
i18n
(
"
There's no favorite contacts
"
)
holder.body
:
i18n
(
"
You can mark as favorite your contacts to quickly access them
"
)
}
LogsView
{
id
:
_logView
MauiLab.AppView.iconName
:
"
view-media-recent
"
MauiLab.AppView.title
:
qsTr
(
"
Recent
"
)
}
ContactsView
{
id
:
_contacsView
Maui
Lab
.AppView.iconName
:
"
view-pim-contacts
"
Maui
Lab
.AppView.title
:
qsTr
(
"
Contacts
"
)
Maui.AppView.iconName
:
"
view-pim-contacts
"
Maui.AppView.title
:
qsTr
(
"
Contacts
"
)
list.query
:
""
showAccountFilter
:
isAndroid
showAccountFilter
:
Maui
.
Handy
.
isAndroid
holder.emoji
:
"
qrc:/list-add-user.svg
"
holder.title
:
i18n
(
"
There's no contacts
"
)
holder.body
:
i18n
(
"
You can add new contacts
"
)
Maui.FloatingButton
{
anchors.right
:
parent
.
right
anchors.bottom
:
parent
.
bottom
anchors.margins
:
height
height
:
Maui
.
Style
.
toolBarHeight
width
:
height
icon.name
:
"
list-add-user
"
onClicked
:
_newContactDialog
.
open
()
}
headBar.middleContent
:
Maui.TextField
{
id
:
_searchField
Layout.preferredWidth
:
isWide
?
_contacsView
.
width
*
0.8
:
_contacsView
.
view
.
width
focusReason
:
Qt
.
PopupFocusReason
placeholderText
:
i18n
(
"
Search %1 contacts...
"
.
arg
(
_contacsView
.
view
.
count
))
onAccepted
:
_contacsView
.
listModel
.
filter
=
text
onCleared
:
_contacsView
.
listModel
.
filter
=
""
}
}
Dialer
View
Logs
View
{
id
:
_dialerView
id
:
_logView
Maui.AppView.iconName
:
"
view-media-recent
"
Maui.AppView.title
:
qsTr
(
"
Recent
"
)
}
}
/** DIALOGS **/
EditContactDialog
Component
{
id
:
_newContactDialog
onNewContact
:
id
:
_messageComposerComponent
MessageComposer
{
_contacsView
.
list
.
insert
(
contact
)
notify
(
"
list-add-user
"
,
i18n
(
"
New contact added
"
),
contact
.
n
)
}
}
MessageComposer
Component
{
id
:
_messageComposer
id
:
_fileDialogComponent
Maui.FileDialog
{
mode
:
modes
.
OPEN
settings.filterType
:
Maui
.
FMList
.
IMAGE
singleSelection
:
true
}
}
Maui.FileDialog
Loader
{
id
:
_
fileDialog
id
:
_
dialogLoader
}
Component.onCompleted
:
{
if
(
_favsView
.
v
iew
.
count
<
1
)
if
(
_favsView
.
currentItem
.
currentV
iew
.
count
<
1
)
_actionGroup
.
currentIndex
=
views
.
contacts
if
(
isAndroid
)
if
(
Maui
.
Handy
.
isAndroid
)
Maui
.
Android
.
statusbarColor
(
backgroundColor
,
true
)
}
}
src/qml.qrc
View file @
d80ba6a6
...
...
@@ -3,7 +3,7 @@
<file>main.qml</file>
<file>views/contacts/ContactsView.qml</file>
<file>views/contacts/ContactDelegate.qml</file>
<file>views/contacts/Contact
Dialog
.qml</file>
<file>views/contacts/Contact
Page
.qml</file>
<file>views/contacts/EditContactDialog.qml</file>
<file>views/dialer/Dialer.qml</file>
<file>views/dialer/DialerView.qml</file>
...
...
@@ -11,5 +11,6 @@
<file>views/contacts/GridContactDelegate.qml</file>
<file>views/logs/LogsView.qml</file>
<file>views/dialer/DialerButton.qml</file>
<file>views/contacts/ContactsBrowser.qml</file>
</qresource>
</RCC>
src/views/contacts/ContactDelegate.qml
View file @
d80ba6a6
import
QtQuick
2.
9
import
QtQuick
.
Controls
2.
3
import
QtQuick
2.
14
import
QtQuick
.
Controls
2.
14
import
QtQuick
.
Layouts
1.3
import
QtGraphicalEffects
1.0
import
org
.
kde
.
mauikit
1.
0
as
Maui
import
org
.
kde
.
kirigami
2.
2
as
Kirigami
import
org
.
kde
.
mauikit
1.
2
as
Maui
import
org
.
kde
.
kirigami
2.
9
as
Kirigami
SwipeDelegate
Maui.SwipeBrowserDelegate
{
id
:
control
hoverEnabled
:
true
clip
:
true
Kirigami.Theme.colorSet
:
Kirigami
.
Theme
.
Button
Kirigami.Theme.inherit
:
false
//
Kirigami.Theme.inherit: false
property
alias
quickButtons
:
_buttonsRow
.
data
property
bool
showMenuIcon
:
false
draggable
:
true
//
property
alias
showMenuIcon:
showQuickActions
signal
favClicked
(
int
index
)
property
alias
label1
:
_label1
property
alias
label2
:
_label2
property
alias
label3
:
_label3
property
alias
label4
:
_label4
property
int
radius
:
Maui
.
Style
.
radiusV
*
2
swipe.enabled
:
showMenuIcon
Rectangle
iconSizeHint
:
Maui
.
Style
.
iconSizes
.
huge
label1.text
:
model
.
n
label1.font.pointSize
:
Maui
.
Style
.
fontSizes
.
big
label1.font.bold
:
true
label1.font.weight
:
Font
.
Bold
label1.elide
:
Text
.
ElideMiddle
label2.text
:
model
.
tel
label2.font.pointSize
:
Maui
.
Style
.
fontSizes
.
small
label2.font.weight
:
Font
.
Light
label2.wrapMode
:
Text
.
WrapAnywhere
label2.elide
:
Text
.
ElideMiddle
label3.text
:
model
.
email
label3.font.pointSize
:
Maui
.
Style
.
fontSizes
.
small
label3.font.weight
:
Font
.
Light
label3.wrapMode
:
Text
.
WrapAnywhere
label3.elide
:
Text
.
ElideMiddle
label4.text
:
model
.
title
label4.font.pointSize
:
Maui
.
Style
.
fontSizes
.
small
label4.font.weight
:
Font
.
Light
label4.wrapMode
:
Text
.
WrapAnywhere
label4.elide
:
Text
.
ElideMiddle
iconVisible
:
control
.
width
>
Kirigami
.
Units
.
gridUnit
*
15
template.iconComponent
:
Item
{
id
:
_bg
visible
:
swipe
.
position
<
0
Kirigami.Theme.colorSet
:
Kirigami
.
Theme
.
Complementary
Kirigami.Theme.inherit
:
false
anchors.fill
:
parent
color
:
Kirigami
.
Theme
.
backgroundColor
radius
:
control
.
radius
z
:
background
.
z
-
1
}
DropShadow
{
visible
:
_bg
.
visible
anchors.fill
:
background
horizontalOffset
:
5
verticalOffset
:
0
radius
:
8.0
samples
:
17
color
:
Qt
.
darker
(
_bg
.
color
,
5
)
source
:
background
}
background
:
Rectangle
{
color
:
hovered
?
Kirigami
.
Theme
.
hoverColor
:
Kirigami
.
Theme
.
backgroundColor
// border.color: Qt.rgba(_bg.color.r, _bg.color.g, _bg.color.b, swipe.position < 0)
radius
:
control
.
radius
id
:
_contactPic
R
owLayout
R
ectangle
{
id
:
_layout
height
:
parent
.
height
*
0.7
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
);
}
anchors.fill
:
parent
anchors.margins
:
Maui
.
Style
.
space
.
small
// color: Qt.hsl(Math.random(),Math.random(),Math.random(),1);
// color: "hsl(" + 360 * Math.random() + ',' +
// (25 + 70 * Math.random()) + '%,' +
// (85 + 10 * Math.random()) + '%)';
border.color
:
Qt
.
darker
(
color
,
1.5
)
Item
Loader
{
id
:
_contactPic
visible
:
control
.
width
>
Kirigami
.
Units
.
gridUnit
*
15
id
:
_contactPicLoader
anchors.fill
:
parent
sourceComponent
:
model
.
photo
?
_imgComponent
:
_iconComponent
}
Layout.fillHeight
:
true
Layout.preferredWidth
:
Maui
.
Style
.
iconSizes
.
huge
clip
:
true
Component
{
id
:
_imgComponent
Rectangl
e
Imag
e
{
height
:
parent
.
height
*
0.7
width
:
height
id
:
_img
width
:
parent
.
width
height
:
width
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()) + '%)';
border.color
:
Qt
.
darker
(
color
,
1.5
)
sourceSize.width
:
parent
.
width
sourceSize.height
:
parent
.
height
fillMode
:
Image
.
PreserveAspectCrop
cache
:
true
antialiasing
:
true
smooth
:
true
asynchronous
:
true
Loader
{
id
:
_contactPicLoader
anchors.fill
:
parent
sourceComponent
:
model
.
photo
?
_imgComponent
:
_iconComponent
}
source
:
"
image://contact/
"
+
model
.
id
Component
layer.enabled
:
true
layer.effect
:
OpacityMask
{
id
:
_imgComponent
Image
maskSource
:
Item
{
id
:
_img
width
:
parent
.
width
height
:
width
anchors.centerIn
:
parent
sourceSize.width
:
parent
.
width
sourceSize.height
:
parent
.
height
width
:
_img
.
width
height
:
_img
.
height
fillMode
:
Image
.
PreserveAspectCrop
cache
:
true
antialiasing
:
true
smooth
:
true
asynchronous
:
true
source
:
"
image://contact/
"
+
model
.
id
layer.enabled
:
true
layer.effect
:
OpacityMask
Rectangle
{
maskSource
:
Item
{
width
:
_img
.
width
height
:
_img
.
height
Rectangle
{
anchors.centerIn
:
parent
width
:
_img
.
width
height
:
_img
.
height
radius
:
control
.
radius
}
}
anchors.centerIn
:
parent
width
:
_img
.
width
height
:
_img
.
height
radius
:
control
.
radius
}
}
}
Component
{
id
:
_iconComponent
Label
{
anchors.fill
:
parent
horizontalAlignment
:
Qt
.
AlignHCenter
verticalAlignment
:
Qt
.
AlignVCenter
color
:
"
white
"
font.pointSize
:
Maui
.
Style
.
fontSizes
.
huge
font.bold
:
true
font.weight
:
Font
.
Bold
text
:
model
.
n
[
0
].
toUpperCase
()
}
}
}
}
Item
Component
{
id
:
_contactInfo
Layout.fillHeight
:
true
Layout.fillWidth
:
true
clip
:
true
id
:
_iconComponent
ColumnLayout
Label
{
anchors.fill
:
parent
Label
{
id
:
_label1
visible
:
text
.
length
Layout.fillHeight
:
visible
Layout.fillWidth
:
visible
text
:
model
.
n
font.pointSize
:
Maui
.
Style
.
fontSizes
.
big
font.bold
:
true
font.weight
:
Font
.
Bold
elide
:
Text
.
ElideMiddle
color
:
Kirigami
.
Theme
.
textColor
}
Label
{
id
:
_label2
visible
:
text
.
length
Layout.fillHeight
:
visible
Layout.fillWidth
:
visible
text
:
model
.
tel
font.pointSize
:
Maui
.
Style
.
fontSizes
.
small
font.weight
:
Font
.
Light
wrapMode
:
Text
.
WrapAnywhere
elide
:
Text
.
ElideMiddle
color
:
Kirigami
.
Theme
.
textColor
}
}
}
Item
{
visible
:
control
.
width
>
Kirigami
.
Units
.
gridUnit
*
30
Layout.fillHeight
:
visible
Layout.fillWidth
:
visible
ColumnLayout
{
anchors.fill
:
parent
Label
{
id
:
_label3
visible
:
text
.
length
Layout.fillHeight
:
visible
Layout.fillWidth
:
visible
Layout.alignment
:
Qt
.
AlignRight
horizontalAlignment
:
Qt
.
AlignRight
text
:
model
.
email
font.pointSize
:
Maui
.
Style
.
fontSizes
.
small
font.weight
:
Font
.
Light
wrapMode
:
Text
.
WrapAnywhere
elide
:
Text
.
ElideMiddle
color
:
Kirigami
.
Theme
.
textColor
}
Label
{
id
:
_label4
visible
:
text
.
length
Layout.fillHeight
:
visible
Layout.fillWidth
:
visible
Layout.alignment
:
Qt
.
AlignRight
horizontalAlignment
:
Qt
.
AlignRight
text
:
model
.
title
font.pointSize
:
Maui
.
Style
.
fontSizes
.
small
font.weight
:
Font
.
Light
wrapMode
:
Text
.
WrapAnywhere
elide
:
Text
.
ElideMiddle
color
:
Kirigami
.
Theme
.
textColor
}
horizontalAlignment
:
Qt
.
AlignHCenter
verticalAlignment
:
Qt
.
AlignVCenter
color
:
"
white
"
font.pointSize
:
Maui
.
Style
.
fontSizes
.
huge
font.bold
:
true
font.weight
:
Font
.
Bold
text
:
model
.
n
[
0
].
toUpperCase
()
}
}
Item
{
Layout.fillHeight
:
true
Layout.preferredWidth
:
Maui
.
Style
.
iconSizes
.
big
Layout.alignment
:
Qt
.
AlignRight
Layout.margins
:
Maui
.
Style
.
space
.
big
Row
{
id
:
_buttonsRow
anchors.centerIn
:
parent
ToolButton
{
visible
:
showMenuIcon
icon.name
:
"
overflow-menu
"
onClicked
:
swipe
.
position
<
0
?
swipe
.
close
()
:
swipe
.
open
(
SwipeDelegate
.
Right
)
}
}
}
}
}
swipe.right
:
Row
{
id
:
_rowActions
anchors.right
:
parent
.
right
anchors.verticalCenter
:
parent
.
verticalCenter
spacing
:
Maui
.
Style
.
space
.
big
padding
:
Maui
.
Style
.
space
.
medium
ToolButton
quickActions
:
[
Action
{
icon.name
:
"
draw-star
"
anchors.verticalCenter
:
parent
.
verticalCenter
onClicked
:
onTriggered
:
{
control
.
favClicked
(
index
)
swipe
.
close
()
}
icon.color
:
model
.
fav
==
"
1
"
?
"
yellow
"
:
_bg
.
Kirigami
.
Theme
.
textColor
}
icon.color
:
model
.
fav
==
"
1
"
?
"
yellow
"
:
Kirigami
.
Theme
.
textColor
}
,
ToolButt
on
Acti
on
{
icon.name
:
"
document-share
"
anchors.verticalCenter
:
parent
.
verticalCenter
onClicked
:
if
(
isAndroid
)
Maui
.
Android
.
shareContact
(
model
.
id
)
icon.color
:
_bg
.
Kirigami
.
Theme
.
textColor
}
onTriggered
:
if
(
Maui
.
Handy
.
isAndroid
)
Maui
.
Android
.
shareContact
(
model
.
id
)
icon.color
:
Kirigami
.
Theme
.
textColor
},
ToolButt
on
Acti
on
{
icon.name
:
"
message-new
"
anchors.verticalCenter
:
parent
.
verticalCenter
icon.color
:
_bg
.
Kirigami
.
Theme
.
textColor
onClicked
:
icon.color
:
Kirigami
.
Theme
.
textColor
onTriggered
:
{
_
messageComposer
.
contact
=
list
.
get
(
index
)
_messageComposer
.
open
(
)
swipe
.
close
()
_
dialogLoader
.
sourceComponent
=
_messageComposerComponent
dialog
.
contact
=
list
.
get
(
index
)
dialog
.
open
()
}
}
}
,
ToolButt
on
Acti
on
{
icon.name
:
"
call-start
"
anchors.verticalCenter
:
parent
.
verticalCenter