Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit e0b3709c authored by Camilo higuita's avatar Camilo higuita

push lastest changes

parent 28d57337
......@@ -8,15 +8,7 @@
#include <QFutureWatcher>
#include "fm.h"
AndroidIntents::AndroidIntents(QObject *parent) : QObject(parent)
{
}
void AndroidIntents::init()
{
this->mauia = new MAUIAndroid(this);
}
AndroidIntents::AndroidIntents(QObject *parent) : QObject(parent) {}
AndroidIntents *AndroidIntents::instance = nullptr;
......@@ -26,8 +18,6 @@ AndroidIntents *AndroidIntents::getInstance()
{
instance = new AndroidIntents();
qDebug() << "getInstance(AndroidIntents): First AndroidIntents instance\n";
instance->init();
return instance;
} else
{
......@@ -38,13 +28,13 @@ AndroidIntents *AndroidIntents::getInstance()
void AndroidIntents::call(const QString &tel) const
{
this->mauia->call(tel);
MAUIAndroid::call(tel);
}
void AndroidIntents::addContact(const FMH::MODEL &contact, const FMH::MODEL &account) const
{
qDebug() << "ADDING CONTACT TO ACCOUNT" << contact << account;
this->mauia->addContact(contact[FMH::MODEL_KEY::N],
MAUIAndroid::addContact(contact[FMH::MODEL_KEY::N],
contact[FMH::MODEL_KEY::TEL],
contact[FMH::MODEL_KEY::TEL_2],
contact[FMH::MODEL_KEY::TEL_3],
......@@ -89,16 +79,14 @@ void AndroidIntents::getCallLogs()
QVariantMap AndroidIntents::getContact(const QString &id) const
{
return this->mauia->getContact(id);
return MAUIAndroid::getContact(id);
}
void AndroidIntents::updateContact(const QString &id, const QString &field, const QString &value) const
{
this->mauia->updateContact(id, field, value);
MAUIAndroid::updateContact(id, field, value);
}
void AndroidIntents::fetchContacts()
{
QFutureWatcher<FMH::MODEL_LIST> *watcher = new QFutureWatcher<FMH::MODEL_LIST>;
......@@ -130,7 +118,7 @@ FMH::MODEL_LIST AndroidIntents::fetchAccounts()
{
FMH::MODEL_LIST data;
const auto array = this->mauia->getAccounts();
const auto array = MAUIAndroid::getAccounts();
QString xmlData(array);
QDomDocument doc;
......
......@@ -4,7 +4,6 @@
#include <QObject>
#include "fmh.h"
class MAUIAndroid;
class AndroidIntents : public QObject
{
Q_OBJECT
......@@ -18,8 +17,6 @@ public:
static AndroidIntents *getInstance();
void call(const QString &tel) const;
void addContact(const FMH::MODEL &contact, const FMH::MODEL &account) const;
FMH::MODEL_LIST getAccounts(const GET_TYPE &type = GET_TYPE::CACHED);
......@@ -32,11 +29,8 @@ public:
private:
explicit AndroidIntents(QObject *parent = nullptr);
void init();
static AndroidIntents *instance;
MAUIAndroid *mauia;
FMH::MODEL_LIST m_contacts;
FMH::MODEL_LIST m_accounts;
......
......@@ -186,6 +186,7 @@ Maui.ApplicationWindow
id: _searchField
height: toolBarHeightAlt
anchors.centerIn: parent
focusReason : Qt.PopupFocusReason
width: isWide ? _contacsView.width * 0.8 : _contacsView.width * 0.95
// height: rowHeight
placeholderText: qsTr("Search %1 contacts... ".arg(_contacsView.view.count))
......
#include "calllogs.h"
#include <QtConcurrent>
#include <QtConcurrent/QtConcurrentRun>
#include <QFuture>
#include <QFutureWatcher>
#ifdef STATIC_MAUIKIT
#include "mauiandroid.h"
#endif
......@@ -54,20 +59,34 @@ CallLogs::ORDER CallLogs::getOrder() const
void CallLogs::getList(const bool &cached)
{
emit this->preListChanged();
QFutureWatcher<FMH::MODEL_LIST> *watcher = new QFutureWatcher<FMH::MODEL_LIST>;
connect(watcher, &QFutureWatcher<FMH::MODEL_LIST>::finished, [=]()
{
emit this->preListChanged();
this->list = watcher->future().result();
this->sortList();
emit this->postListChanged();
watcher->deleteLater();
});
#ifdef STATIC_MAUIKIT
for(const auto &item : MAUIAndroid::getCallLogs())
const auto func = []() -> FMH::MODEL_LIST {
FMH::MODEL_LIST list;
#ifdef STATIC_MAUIKIT
for(const auto &item : MAUIAndroid::getCallLogs())
{
auto map = item.toMap();
map.insert(FMH::MODEL_NAME[FMH::MODEL_KEY::MODIFIED],
QDate(QDateTime::fromString(map.value(FMH::MODEL_NAME[FMH::MODEL_KEY::DATE]).toString(), "dd-MM-yyyy HH:mm").date()).toString(Qt::TextDate));
this->list << FM::toModel(map);
}
auto map = item.toMap();
map.insert(FMH::MODEL_NAME[FMH::MODEL_KEY::MODIFIED],
QDate(QDateTime::fromString(map.value(FMH::MODEL_NAME[FMH::MODEL_KEY::DATE]).toString(), "dd-MM-yyyy HH:mm").date()).toString(Qt::TextDate));
list << FM::toModel(map);
}
#endif
this->sortList();
emit this->postListChanged();
return list;
};
QFuture<FMH::MODEL_LIST> t1 = QtConcurrent::run(func);
watcher->setFuture(t1);
}
template<typename T>
......
......@@ -78,7 +78,7 @@ void ContactsModel::sortList()
return;
const auto key = static_cast<FMH::MODEL_KEY>(this->sort);
qSort(this->list.begin(), this->list.end(), [key](const FMH::MODEL &e1, const FMH::MODEL &e2) -> bool
std::sort(this->list.begin(), this->list.end(), [key](const FMH::MODEL &e1, const FMH::MODEL &e2) -> bool
{
auto role = key;
......@@ -240,7 +240,7 @@ void ContactsModel::filter()
{
for(auto item : this->listbk)
{
if(item[FMH::MODEL_NAME_KEY[q.first().trimmed()]] == q.last().trimmed())
if(item[FMH::MODEL_NAME_KEY[q.first().trimmed()]].replace(" ", "").contains(q.last().trimmed()))
res << item;
}
}
......@@ -250,10 +250,11 @@ void ContactsModel::filter()
{
for(auto data : item)
{
if(data.contains(this->query, Qt::CaseInsensitive) && !res.contains(item))
if(data.replace(" ", "").contains(this->query, Qt::CaseInsensitive) && !res.contains(item))
res << item;
}
}
}
}
......
......@@ -22,7 +22,7 @@ SwipeDelegate
property alias label3 : _label3
property alias label4 : _label4
swipe.enabled: showMenuIcon
background: Rectangle
{
color: hovered ? Qt.lighter(cardColor) : cardColor
......@@ -56,13 +56,13 @@ SwipeDelegate
color:
{
var c = Qt.rgba(Math.random(),Math.random(),Math.random(),1)
return Qt.hsla(c.hslHue, 0.7, c.hslLightness, c.a);
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: 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)
......@@ -270,7 +270,7 @@ SwipeDelegate
anchors.verticalCenter: parent.verticalCenter
onClicked:
{
control.favClicked(index)
control.favClicked(index)
swipe.close()
}
......
......@@ -55,6 +55,7 @@ Maui.Dialog
{
Layout.fillHeight: true
iconName: "send-email"
visible: contact.email
// text: qsTr("Message")
display: ToolButton.TextUnderIcon
onClicked:
......@@ -69,6 +70,8 @@ Maui.Dialog
{
Layout.fillHeight: true
iconName: "send-sms"
visible: contact.tel
// text: qsTr("Message")
display: ToolButton.TextUnderIcon
onClicked:
......
......@@ -336,7 +336,7 @@ Maui.Dialog
_img.source = ""
control.close()
}
}
Component.onCompleted:
{
......
......@@ -18,7 +18,8 @@ GridLayout
readonly property int buttonFontSize: fontSizes.huge * 1.5
property var model : ["1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#"]
Repeater {
Repeater
{
model: _grid.model
Item
......@@ -28,7 +29,7 @@ GridLayout
Maui.Button
{
height: Math.min(iconSizes.big * 3, parent.height)
height: buttonSize
width: height
anchors.centerIn: parent
bg.radius: Math.max(width, height)
......@@ -42,8 +43,5 @@ GridLayout
}
}
}
}
}
......@@ -10,10 +10,11 @@ Maui.Page
id: control
property alias dialString : _textField.text
property int buttonSize : Math.min( iconSizes.big * 2 , control.width * 0.25)
onDialStringChanged:
{
// Qt.inputMethod.hide();
_contacsView.list.query = dialString
_contacsView.list.query = "tel=" + dialString
}
colorScheme.backgroundColor: backgroundColor
headBar.visible: false
......@@ -31,6 +32,79 @@ Maui.Page
// footBarOverlap: true
// footBarAligment: Qt.AlignRight
footBar.drawBorder:false
footBar.implicitHeight: iconSizes.big * 3
footBar.middleContent: [
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
Maui.Button
{
icon.name: "send-sms"
icon.color: textColor
height: buttonSize
width: height
anchors.centerIn: parent
bg.radius: Math.max(width, height)
// colorScheme.backgroundColor: infoColor
onClicked:
{
_messageComposer.contact = ({tel : dialString})
_messageComposer.open()
}
}
},
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
Maui.Button
{
icon.name: "dialer-call"
icon.color: "white"
height: buttonSize
width: height
anchors.centerIn: parent
bg.radius: Math.max(width, height)
colorScheme.backgroundColor: suggestedColor
onClicked:
{
if(isAndroid)
Maui.Android.call(dialString)
}
}
},
Item
{
Layout.fillHeight: true
Layout.fillWidth: true
Maui.Button
{
icon.name: "edit-clear"
icon.color: textColor
height: iconSizes.big * 2
width: height
anchors.centerIn: parent
bg.radius: Math.max(width, height)
// colorScheme.backgroundColor: warningColor
onClicked:
{
dialString = dialString.slice(0, -1);
}
}
}
]
ColumnLayout
{
id: _layout
......@@ -44,75 +118,27 @@ Maui.Page
{
Layout.preferredHeight: toolBarHeight * 1.3
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop
color: cardColor
// border.color: borderColor
radius: radiusV * 2
RowLayout
Maui.TextField
{
anchors.fill : parent
spacing: 0
Item
{
Layout.fillWidth: true
Layout.fillHeight: true
// Layout.leftMargin: space.big * 2
Maui.TextField
{
id: _textField
anchors.fill: parent
inputMethodHints: Qt.ImhDialableCharactersOnly
placeholderText: qsTr("Number...")
readOnly: true
font.bold: true
font.weight: Font.Bold
font.pointSize: fontSizes.huge
font.letterSpacing: space.tiny
colorScheme.backgroundColor: "transparent"
colorScheme.borderColor: "transparent"
colorScheme.textColor: "#fff"
// enabled: false
}
}
Item
{
Layout.fillHeight: true
Layout.preferredWidth: parent.height
visible: dialString.length
Rectangle
{
height: parent.height
width: height
anchors.centerIn: parent
color: highlightColor
radius: radiusV * 2
Rectangle
{
height: parent.height
width: parent.radius
anchors.left: parent.left
color: parent.color
}
Maui.ToolButton
{
iconName: "phone"
anchors.centerIn: parent
onClicked:
{
if(isAndroid)
Maui.Android.call(dialString)
}
}
}
}
id: _textField
anchors.fill: parent
inputMethodHints: Qt.ImhDialableCharactersOnly
placeholderText: qsTr("Number...")
readOnly: true
font.bold: true
font.weight: Font.Bold
font.pointSize: fontSizes.huge
font.letterSpacing: space.tiny
colorScheme.backgroundColor: "transparent"
colorScheme.borderColor: "transparent"
colorScheme.textColor: textColor
// enabled: false
}
}
......@@ -136,20 +162,16 @@ Maui.Page
height: unit * 60
width: _layout.width
anchors.horizontalCenter: parent.horizontalCenter
// quickButtons: Maui.ToolButton
// {
// iconName: "phone"
// backgroundRec.radius: radiusV
// backgroundRec.color: highlightColor
// backgroundRec.opacity: 0.5
// iconColor: highlightColor
// onClicked:
// {
// if(isAndroid)
// Maui.Android.call(contact.tel)
// }
// }
quickButtons: Maui.ToolButton
{
iconName: "view-fullscreen"
onClicked:
{
_suggestionListView.currentIndex = index
control.dialString = _contacsView.list.get(_suggestionListView.currentIndex).tel
}
}
Connections
{
......@@ -172,7 +194,7 @@ Maui.Page
Layout.minimumHeight: unit*300
Layout.maximumHeight: unit*300
Layout.alignment: Qt.AlignCenter
Layout.alignment: Qt.AlignBottom
// visible: true
Dialer
......
......@@ -26,8 +26,36 @@ Maui.Page
id: _callLogsModel
}
ListView
Maui.Menu
{
id: _menu
Maui.MenuItem
{
text: qsTr("Call")
icon.name: "dialer-call"
onTriggered:
{
if(isAndroid)
Maui.Android.call(_callLogsModel.get(_listView.currentIndex).tel)
}
}
Maui.MenuItem
{
text: qsTr("Save as..")
icon.name: "list-add-user"
onTriggered:
{
_newContactDialog.contact = _callLogsModel.get(_listView.currentIndex)
_newContactDialog.open()
}
}
}
ListView
{
id: _listView
anchors.fill: parent
spacing: space.big
clip: true
......@@ -92,14 +120,8 @@ Maui.Page
target: _delegate
onClicked:
{
view.currentIndex = index
_contactDialog.show(list.get(index))
}
onFavClicked:
{
var item = _contactsList.get(index)
item["fav"] = item.fav == "1" ? "0" : "1"
_contactsList.update(item, index)
_listView.currentIndex = index
_menu.popup()
}
}
}
......
......@@ -78,6 +78,7 @@ Maui.Dialog
Maui.TextField
{
id: _subjectTextField
visible: _combobox.currentText === contact.email
Layout.fillWidth: true
Layout.preferredHeight: toolBarHeightAlt
placeholderText: qsTr("Subject")
......
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