Commit fd4667f9 authored by camilo higuita's avatar camilo higuita

make it work again under android

parent 88805d01
<?xml version="1.0"?>
<manifest package="org.kde.communicator" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="communicator" android:icon="@drawable/icon">
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="communicator" android:screenOrientation="unspecified" android:launchMode="singleTop">
android:name=&quot;com.example.android.tools.NotificationClient&quot;
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Application arguments -->
<!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
<!-- Application arguments -->
<meta-data android:name="android.app.lib_name" android:value="communicator"/>
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<!-- Run with local libs -->
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<!-- Used to specify custom system library path to run with local system libs -->
<!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> -->
<!-- Messages maps -->
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<!-- Messages maps -->
<!-- Splash screen -->
<!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
<!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
<!-- Splash screen -->
<!-- Background running -->
<!-- Warning: changing this value to true may cause unexpected crashes if the
application still try to draw after
"applicationStateChanged(Qt::ApplicationSuspended)"
signal is sent! -->
<meta-data android:name="android.app.background_running" android:value="false"/>
<!-- Background running -->
<!-- auto screen scale factor -->
<meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
<!-- auto screen scale factor -->
<!-- extract android style -->
<!-- available android:values :
* full - useful QWidget & Quick Controls 1 apps
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
* none - useful for apps that don't use any of the above Qt modules
-->
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
<!-- extract android style -->
</activity>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
<service android:process=":qt" android:name=".MyService">
<!-- android:process=":qt" is needed to force the service to run on a separate process than the Activity -->
<!-- Application arguments -->
<meta-data android:name="android.app.arguments" android:value="-service"/>
<!-- Application arguments -->
<!-- If you are using the same application (.so file) for activity and also for service, then you
need to use *android.app.arguments* to pass some arguments to your service in order to know which
one is which.
-->
<!-- Application to launch -->
<meta-data android:name="android.app.lib_name" android:value="vvave"/>
<!-- Application to launch -->
<!-- Ministro -->
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
<!-- Ministro -->
<!-- Deploy Qt libs as part of package -->
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
<!-- Deploy Qt libs as part of package -->
<!-- Run with local libs -->
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
<!-- Run with local libs -->
<!-- Messages maps -->
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
<!-- Messages maps -->
<!-- Background running -->
<meta-data android:name="android.app.background_running" android:value="true"/>
<!-- Background running -->
</service>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.SEND_SMS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
</manifest>
QT += qml
QT += quick
QT += sql
QT += widgets
QT += quickcontrols2
QT += concurrent
CONFIG += ordered
CONFIG += c++17
QMAKE_LINK += -nostdlib++
TARGET = dialer
TEMPLATE = app
linux:unix:!android {
message(Building for Linux KDE)
QT += webengine
QT += KService KNotifications KNotifications KI18n KContacts
QT += KIOCore KIOFileWidgets KIOWidgets KNTLM
LIBS += -lMauiKit
# SOURCES += src/interfaces/kcontactsinterface.cpp
# HEADERS += src/interfaces/kcontactsinterface.h
} else:android {
message(Building helpers for Android)
QT += androidextras webview
include($$PWD/3rdparty/openssl/openssl.pri)
include($$PWD/3rdparty/mauikit/mauikit.pri)
include($$PWD/3rdparty/kirigami/kirigami.pri)
DEFINES += STATIC_KIRIGAMI
} else {
message("Unknown configuration")
}
DEPENDPATH += \
$$PWD/src/interfaces \
$$PWD/src/models \
$$PWD/src/models/contacts
INCLUDEPATH += \
$$PWD/src/interfaces \
$$PWD/src/models \
$$PWD/src/models/contacts
SOURCES += \
$$PWD/src/main.cpp \
$$PWD/src/interfaces/androidinterface.cpp \
$$PWD/src/interfaces/contactimage.cpp \
$$PWD/src/models/contacts/calllogs.cpp \
$$PWD/src/models/contacts/contactsmodel.cpp \
RESOURCES += \
$$PWD/src/qml.qrc \
$$PWD/assets/union_assets.qrc
HEADERS += \
$$PWD/src/union.h \
$$PWD/src/interfaces/androidinterface.h \
$$PWD/src/models/contacts/contactsmodel.h \
$$PWD/src/models/contacts/calllogs.h \
$$PWD/src/interfaces/abstractinterface.h \
$$PWD/src/interfaces/contactimage.h
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
ANDROID_PACKAGE_SOURCE_DIR = \
$$PWD/3rdparty/mauikit/src/android
}
#include "androidinterface.h"
#include "./mauikit/src/android/mauiandroid.h"
#include "mauiandroid.h"
#include <QDomDocument>
#include <QtConcurrent>
......@@ -71,6 +71,11 @@ void AndroidInterface::getContacts(const GET_TYPE &type)
this->fetchContacts();
}
void AndroidInterface::getContacts()
{
this->getContacts(GET_TYPE::FETCH);
}
void AndroidInterface::getCallLogs()
{
const auto logs = MAUIAndroid::getCallLogs();
......@@ -89,6 +94,11 @@ bool AndroidInterface::updateContact(const QString &id, const FMH::MODEL &contac
return true;
}
bool AndroidInterface::removeContact(const QString &id)
{
return false;
}
void AndroidInterface::fetchContacts()
{
QFutureWatcher<FMH::MODEL_LIST> *watcher = new QFutureWatcher<FMH::MODEL_LIST>;
......
......@@ -21,10 +21,13 @@ public:
FMH::MODEL_LIST getAccounts(const GET_TYPE &type = GET_TYPE::CACHED);
void getContacts(const GET_TYPE &type = GET_TYPE::CACHED);
void getContacts() override final;
void getCallLogs();
FMH::MODEL getContact(const QString &id) const override final;
bool updateContact(const QString &id, const FMH::MODEL &contact) const override final;
bool removeContact(const QString &id) override final;
private:
static AndroidInterface *instance;
......@@ -34,9 +37,6 @@ private:
void fetchContacts();
FMH::MODEL_LIST fetchAccounts();
signals:
void contactsReady(FMH::MODEL_LIST contacts) const;
public slots:
};
......
......@@ -14,16 +14,16 @@
#endif
#include "src/union.h"
#include "models/contacts/contactsmodel.h"
#include "models/contacts/calllogs.h"
#include "interfaces/contactimage.h"
#include "contactsmodel.h"
#include "calllogs.h"
#include "contactimage.h"
#ifdef STATIC_KIRIGAMI
#include "./3rdparty/kirigami/src/kirigamiplugin.h"
#endif
#ifdef STATIC_MAUIKIT
#include "./mauikit/src/mauikit.h"
#include "./3rdparty/mauikit/src/mauikit.h"
#include <QStyleHints>
#endif
......@@ -73,7 +73,6 @@ int main(int argc, char *argv[])
#ifdef STATIC_MAUIKIT
MauiKit::getInstance().registerTypes();
#endif
engine.addImageProvider("contact", new ContactImage(QQuickImageProvider::ImageType::Image));
......
......@@ -14,7 +14,7 @@
#endif
#ifdef Q_OS_ANDROID
ContactsModel::ContactsModel(QObject *parent) : BaseList(parent), syncer(new AndroidInterface(this))
ContactsModel::ContactsModel(QObject *parent) : MauiList(parent), syncer(AndroidInterface::getInstance())
#else
ContactsModel::ContactsModel(QObject *parent) : MauiList(parent), syncer(new LinuxInterface(this))
#endif
......@@ -149,7 +149,7 @@ QVariantMap ContactsModel::get(const int &index) const
#ifdef Q_OS_ANDROID
const auto id = this->list.at(index)[FMH::MODEL_KEY::ID];
res.unite(this->syncer->getContact(id));
res.unite(FMH::toMap(this->syncer->getContact(id)));
#endif
return res;
......
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