Commit 5287d0b6 authored by Anupam Basak's avatar Anupam Basak

Merge branch 'development'

parents 30f791d8 e423063a
cmake_minimum_required(VERSION 3.1)
set(CONTACTS_VERSION 1.1.1)
project(contacts LANGUAGES CXX VERSION ${CONTACTS_VERSION})
set(COMMUNICATOR_VERSION 1.2.0)
project(communicator LANGUAGES CXX VERSION ${COMMUNICATOR_VERSION})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
......@@ -32,7 +32,7 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}/src/models/contacts
)
set(contacts_SRCS
set(communicator_SRCS
src/main.cpp
src/models/contacts/contactsmodel.cpp
src/models/contacts/calllogs.cpp
......@@ -40,8 +40,7 @@ set(contacts_SRCS
src/interfaces/contactimage.cpp
)
set(contacts_HDRS
src/union.h
set(communicator_HDRS
src/models/contacts/contactsmodel.h
src/models/contacts/calllogs.h
src/interfaces/abstractinterface.h
......@@ -49,20 +48,20 @@ set(contacts_HDRS
src/interfaces/contactimage.h
)
set(contacts_ASSETS
set(communicator_ASSETS
src/qml.qrc
assets/contacts_assets.qrc
assets/communicator_assets.qrc
)
add_executable(${PROJECT_NAME}
${contacts_SRCS}
${contacts_HDRS}
${contacts_ASSETS}
${communicator_SRCS}
${communicator_HDRS}
${communicator_ASSETS}
)
ecm_setup_version(${CONTACTS_VERSION}
VARIABLE_PREFIX CONTACTS
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/contacts_version.h"
ecm_setup_version(${COMMUNICATOR_VERSION}
VARIABLE_PREFIX COMMUNICATOR
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/communicator_version.h"
)
if (ANDROID)
......@@ -71,26 +70,25 @@ if (ANDROID)
target_link_libraries(${PROJECT_NAME} Qt5::AndroidExtras)
# kde_source_files_enable_exceptions(union src/pix.cpp)
elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
add_subdirectory(src/contacts/linux)
add_subdirectory(src/communicator/linux)
else()
find_package(KF5 ${KF5_VERSION} REQUIRED COMPONENTS I18n Notifications Config KIO Attica Contacts People SyntaxHighlighting)
find_package(Qt5 REQUIRED COMPONENTS WebEngine)
target_link_libraries(${PROJECT_NAME} KF5::ConfigCore KF5::Notifications KF5::KIOCore KF5::I18n KF5::Attica KF5::Contacts KF5::People KF5::SyntaxHighlighting)
target_link_libraries(${PROJECT_NAME} KF5::ConfigCore KF5::Notifications KF5::KIOCore KF5::I18n KF5::Attica KF5::Contacts KF5::People)
endif()
if (TARGET create-apk-contacts)
set_target_properties(create-apk-contacts PROPERTIES ANDROID_APK_DIR "${MAUIKIT_ANDROID_DIR}")
if (TARGET create-apk-communicator)
set_target_properties(create-apk-communicator PROPERTIES ANDROID_APK_DIR "${MAUIKIT_ANDROID_DIR}")
endif()
target_link_libraries(${PROJECT_NAME} MauiKit Qt5::Sql Qt5::Qml Qt5::Widgets Qt5::Svg Qt5::Concurrent Qt5::Quick)
install(TARGETS ${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES org.kde.contacts.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install(FILES org.maui.communicator.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
#TODO: port to ecm_install_icons()
install(FILES assets/contacts.svg DESTINATION ${KDE_INSTALL_ICONDIR}/hicolor/scalable/apps)
install(FILES org.maui.contacts.json DESTINATION /usr/share/maui-accounts/manifests)
install(FILES assets/communicator.svg DESTINATION ${KDE_INSTALL_ICONDIR}/hicolor/scalable/apps)
install(FILES org.maui.communicator.json DESTINATION /usr/share/maui-accounts/manifests)
#install(FILES org.kde.pix.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
<RCC>
<qresource prefix="/">
<file>portrait.jpg</file>
<file>contacts96.png</file>
<file>contacts72.png</file>
<file>contacts48.png</file>
<file>contacts.svg</file>
<file>view-contacts.svg</file>
<file>list-add-user.svg</file>
<file>amarok_artist.svg</file>
<file>star.svg</file>
<file>communicator.svg</file>
<file>communicator48.png</file>
<file>communicator64.png</file>
<file>communicator96.png</file>
</qresource>
</RCC>
logo.png

6.73 KB | W: | H:

logo.png

1.46 KB | W: | H:

logo.png
logo.png
logo.png
logo.png
  • 2-up
  • Swipe
  • Onion skin
[Desktop Entry]
Name=Contacts
Name[ast]=Contautos
Name[ca]=Contactes
Name[ca@valencia]=Contactes
Name[cs]=Kontakty
Name[en_GB]=Contacts
Name[es]=Contactos
Name[et]=Kontaktid
Name[fi]=Yhteystiedot
Name[fr]=Contacts
Name[it]=Contatti
Name[ko]=연락처
Name[lt]=Adresatai
Name[nl]=Contactpersonen
Name[nn]=Kontaktar
Name[pt]=Contactos
Name[pt_BR]=Contatos
Name[ro]=Contacte
Name[sl]=Stiki
Name[sv]=Kontakter
Name[uk]=Контакти
Name[x-test]=xxContactsxx
Name[zh_TW]=聯絡人
TryExec=contacts
Exec=contacts %U
Terminal=false
Type=Application
Categories=Qt;KDE;System;
GenericName=Contacts
GenericName[ast]=Contautos
GenericName[ca]=Contactes
GenericName[ca@valencia]=Contactes
GenericName[cs]=Kontakty
GenericName[en_GB]=Contacts
GenericName[es]=Contactos
GenericName[et]=Kontaktid
GenericName[fi]=Yhteystiedot
GenericName[fr]=Contacts
GenericName[it]=Contatti
GenericName[ko]=연락처
GenericName[lt]=Adresatai
GenericName[nl]=Contactpersonen
GenericName[nn]=Kontaktar
GenericName[pt]=Contactos
GenericName[pt_BR]=Contatos
GenericName[ro]=Contacte
GenericName[sk]=Kontakty
GenericName[sl]=maui-communicator._desktop_
GenericName[sv]=Kontakter
GenericName[uk]=Контакти
GenericName[x-test]=xxContactsxx
GenericName[zh_TW]=聯絡人
StartupNotify=true
Icon=maui-contacts
MimeType=application/x-communicator;
[Desktop Entry]
Name=Communicator
TryExec=communicator
Exec=communicator %U
Terminal=false
Type=Application
Categories=Qt;KDE;System;
GenericName=Contacts Manager
StartupNotify=true
Icon=maui-communicator
MimeType=application/x-communicator;
#include <QQmlApplicationEngine>
#include <QIcon>
#include <QCommandLineParser>
#include <QQmlContext>
#ifdef Q_OS_ANDROID
#include <QGuiApplication>
......@@ -9,77 +10,95 @@
#include <QApplication>
#endif
#include "src/union.h"
#ifdef STATIC_MAUIKIT
#include "3rdparty/mauikit/src/mauikit.h"
#include "mauiapp.h"
#else
#include <MauiKit/mauiapp.h>
#endif
#if defined Q_OS_MACOS || defined Q_OS_WIN
#include <KF5/KI18n/KLocalizedString>
#else
#include <KI18n/KLocalizedString>
#endif
#include "src/models/contacts/contactsmodel.h"
#include "src/models/contacts/calllogs.h"
#include "contactimage.h"
#ifdef STATIC_KIRIGAMI
#include "./3rdparty/kirigami/src/kirigamiplugin.h"
#endif
#ifdef STATIC_MAUIKIT
#include "./3rdparty/mauikit/src/mauikit.h"
#include <QStyleHints>
#endif
#ifndef STATIC_MAUIKIT
#include "communicator_version.h"
#endif
#define COMMUNICATOR_URI "org.maui.communicator"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true);
QCoreApplication::setAttribute(Qt::AA_DisableSessionManager, true);
#ifdef Q_OS_ANDROID
QGuiApplication app(argc, argv);
if (!MAUIAndroid::checkRunTimePermissions({"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.READ_CALL_LOG",
"android.permission.SEND_SMS",
"android.permission.CALL_PHONE",
"android.permission.MANAGE_ACCOUNTS",
"android.permission.GET_ACCOUNTS",
"android.permission.READ_CONTACTS"}))
return -1;
QGuiApplication app(argc, argv);
if (!MAUIAndroid::checkRunTimePermissions({"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.READ_CALL_LOG",
"android.permission.SEND_SMS",
"android.permission.CALL_PHONE",
"android.permission.MANAGE_ACCOUNTS",
"android.permission.GET_ACCOUNTS",
"android.permission.READ_CONTACTS"}))
return -1;
#else
QApplication app(argc, argv);
QApplication app(argc, argv);
#endif
app.setApplicationName(UNI::appName);
app.setApplicationVersion(UNI::version);
app.setApplicationDisplayName(UNI::displayName);
app.setOrganizationName(UNI::orgName);
app.setOrganizationDomain(UNI::orgDomain);
app.setWindowIcon(QIcon(":/contacts.svg"));
QCommandLineParser parser;
parser.addOptions({
// A boolean option with a single name (-p)
{"sync",
QCoreApplication::translate("main", "Show progress during copy")},
// A boolean option with multiple names (-f, --force)
{{"f", "force"},
QCoreApplication::translate("main", "Overwrite existing files.")},
// An option with a value
{{"t", "target-directory"},
QCoreApplication::translate("main", "Copy all source files into <directory>."),
QCoreApplication::translate("main", "directory")},
});
parser.process(app);
QQmlApplicationEngine engine;
app.setOrganizationName(QStringLiteral("Maui"));
app.setWindowIcon(QIcon("://communicator.svg"));
MauiApp::instance()->setHandleAccounts(false); //for now index can not handle cloud accounts
MauiApp::instance()->setIconName("qrc:/communicator.svg");
KLocalizedString::setApplicationDomain("communicator");
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");
about.setProductName("maui/communicator");
about.setBugAddress("https://invent.kde.org/maui/communicator/-/issues");
about.setOrganizationDomain(COMMUNICATOR_URI);
about.setProgramLogo(app.windowIcon());
KAboutData::setApplicationData(about);
QCommandLineParser parser;
parser.process(app);
about.setupCommandLine(&parser);
about.processCommandLine(&parser);
QQmlApplicationEngine engine;
#ifdef STATIC_KIRIGAMI
KirigamiPlugin::getInstance().registerTypes();
KirigamiPlugin::getInstance().registerTypes();
#endif
#ifdef STATIC_MAUIKIT
MauiKit::getInstance().registerTypes();
MauiKit::getInstance().registerTypes();
#endif
engine.addImageProvider("contact", new ContactImage(QQuickImageProvider::ImageType::Image));
qmlRegisterType<ContactsModel>("UnionModels", 1, 0, "ContactsList");
qmlRegisterType<CallLogs>("UnionModels", 1, 0, "CallLogs");
engine.addImageProvider("contact", new ContactImage(QQuickImageProvider::ImageType::Image));
qmlRegisterType<ContactsModel>(COMMUNICATOR_URI, 1, 0, "ContactsList");
qmlRegisterType<CallLogs>(COMMUNICATOR_URI, 1, 0, "CallLogs");
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
return app.exec();
}
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,30 +13,19 @@ import "widgets"
Maui.ApplicationWindow
{
id: root
title: Maui.App.displayName
Maui.App.description: qsTr("Contacts keeps your contacts synced across devices and allows you to make calls, send messages and organize")
Maui.App.iconName: "qrc:/contacts.svg"
altHeader: Kirigami.Settings.isMobile
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
}
// autoHideHeader: swipeView.currentItem.currentItem ? swipeView.currentItem.currentItem.editing : false
MauiLab.AppViews
Maui.AppViews
{
id: swipeView
anchors.fill : parent
......@@ -46,96 +34,75 @@ Maui.ApplicationWindow
{
if(currentIndex === views.contacts)
_contacsView.list.query = ""
else if(currentIndex === views.dialer)
_contacsView.list.query = _dialerView.dialString
}
ContactsView
{
id: _favsView
MauiLab.AppView.iconName: "draw-star"
MauiLab.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: qsTr("There's no favorite contacts")
holder.body: qsTr("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")
holder.title: i18n("There's no favorite contacts")
holder.body: i18n("You can mark as favorite your contacts to quickly access them")
}
ContactsView
{
id: _contacsView
MauiLab.AppView.iconName: "view-pim-contacts"
MauiLab.AppView.title: qsTr("Contacts")
Maui.AppView.iconName: "view-pim-contacts"
Maui.AppView.title: qsTr("Contacts")
list.query: ""
showAccountFilter: isAndroid
showNewButton: true
showAccountFilter: Maui.Handy.isAndroid
holder.emoji: "qrc:/list-add-user.svg"
holder.title: qsTr("There's no contacts")
holder.body: qsTr("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: qsTr("Search %1 contacts... ".arg(_contacsView.view.count))
onAccepted: _contacsView.listModel.filter = text
onCleared: _contacsView.listModel.filter = ""
}
holder.title: i18n("There's no contacts")
holder.body: i18n("You can add new contacts")
}
DialerView
LogsView
{
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", qsTr("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.view.count < 1)
if(_favsView.currentItem.currentView.count < 1)
_actionGroup.currentIndex = views.contacts
if(isAndroid)
if(Maui.Handy.isAndroid)
Maui.Android.statusbarColor(backgroundColor, true)
}
}
......@@ -24,15 +24,11 @@ ContactsModel::ContactsModel(QObject *parent) : MauiList(parent), syncer(new Lin
qDebug() << "CONATCTS READY AT MODEL 1" << contacts;
emit this->preListChanged();
this->list = contacts;
this->listbk = this->list;
qDebug() << "CONATCTS READY AT MODEL" << this->list;
this->filter();
this->sortList();
emit this->postListChanged();
});
this->getList(true);
this->getList();
}
FMH::MODEL_LIST ContactsModel::items() const
......@@ -42,119 +38,29 @@ FMH::MODEL_LIST ContactsModel::items() const
void ContactsModel::setQuery(const QString &query)
{
if(this->query == query)
if(this->m_query == query || query.isEmpty())
return;
this->query = query;
this->m_query = query;
emit this->preListChanged();
this->filter();
emit this->postListChanged();
emit this->queryChanged();
}
QString ContactsModel::getQuery() const
{
return this->query;
}
void ContactsModel::setSortBy(const SORTBY &sort)
{
if(this->sort == sort)
return;
this->sort = sort;
this->preListChanged();
this->sortList();
this->postListChanged();
emit this->sortByChanged();
}
ContactsModel::SORTBY ContactsModel::getSortBy() const
{
return this->sort;
}
void ContactsModel::sortList()
{
if(this->sort == ContactsModel::SORTBY::NONE)
return;
const auto key = static_cast<FMH::MODEL_KEY>(this->sort);
std::sort(this->list.begin(), this->list.end(), [&key](const FMH::MODEL &e1, const FMH::MODEL &e2) -> bool
{
switch(key)
{
case FMH::MODEL_KEY::FAV:
{
if(e1[key].toInt() > e2[key].toInt())
return true;
break;
}
case FMH::MODEL_KEY::ADDDATE:
case FMH::MODEL_KEY::MODIFIED:
{
auto currentTime = QDateTime::currentDateTime();
auto date1 = QDateTime::fromString(e1[key], Qt::TextDate);
auto date2 = QDateTime::fromString(e2[key], Qt::TextDate);
if(date1.secsTo(currentTime) < date2.secsTo(currentTime))
return true;
break;
}
case FMH::MODEL_KEY::TITLE:
case FMH::MODEL_KEY::N:
case FMH::MODEL_KEY::TEL:
case FMH::MODEL_KEY::ORG:
case FMH::MODEL_KEY::EMAIL:
case FMH::MODEL_KEY::GENDER:
case FMH::MODEL_KEY::ADR:
{
const auto str1 = QString(e1[key]).toLower();
const auto str2 = QString(e2[key]).toLower();
if(str1 < str2)
return true;
break;
}
default: