Commit b8d91936 authored by Camilo Higuita's avatar Camilo Higuita

update to using i18n and kaboutdata

parent 46880457
cmake_minimum_required(VERSION 3.1)
set(CONTACTS_VERSION 1.0.0)
project(contacts LANGUAGES CXX VERSION ${CONTACTS_VERSION})
set(COMMUNICATOR_VERSION 1.0.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
)
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)
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.kde.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 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)
......@@ -9,77 +9,97 @@
#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/KLocalizedContext>
#include <KF5/KI18n/KLocalizedString>
#else
#include <KI18n/KLocalizedContext>
#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(":/contacts.png"));
MauiApp::instance()->setHandleAccounts(false); //for now index can not handle cloud accounts
MauiApp::instance()->setIconName("qrc:/contacts.svg");
KLocalizedString::setApplicationDomain("communicator");
KAboutData about(QStringLiteral("communicator"), i18n("Communicator"), COMMUNICATOR_VERSION_STRING, i18n("Communicator keeps your contacts synced across devices and allows you to make calls, send messages and organize."),
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();
}
......@@ -15,8 +15,6 @@ Maui.ApplicationWindow
{
id: root
title: Maui.App.displayName
Maui.App.description: i18n("Contacts keeps your contacts synced across devices and allows you to make calls, send messages and organize")
Maui.App.iconName: "qrc:/contacts.svg"
readonly property var views : ({
favs: 0,
......@@ -65,7 +63,7 @@ Maui.ApplicationWindow
icon.name: "view-pim-contacts"
text: i18n("Contacts")
}
}
SwipeView
......
#ifndef UNION_H
#define UNION_H
#include <QString>
#ifndef STATIC_MAUIKIT
#include "contacts_version.h"
#endif
namespace UNI
{
const static inline QString appName = "contacts";
const static inline QString version = CONTACTS_VERSION_STRING;
const static inline QString comment = "Contacs manager and dialer";
const static inline QString displayName = "Contacts";
const static inline QString orgName = "Maui";
const static inline QString orgDomain = "org.maui.contacts";
};
#endif // UNION_H
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