Commit 0828700d authored by Bhushan Shah's avatar Bhushan Shah 📱 Committed by Bhushan Shah

dialer: use QRC instead of the kpackage

And tidy up the code as well
parent 7ff227a1
kpackage_install_package(package org.kde.phone.dialer genericqml)
install(FILES package/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.phone.dialer.desktop)
install(FILES metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.phone.dialer.desktop)
include_directories(${TELEPATHY_QT5_INCLUDE_DIR})
#
add_subdirectory(src)
......@@ -45,17 +45,6 @@ Name[zh_CN]=手机
Name[zh_TW]=電話
Type=Application
Icon=call-start
X-KDE-ParentApp=
X-KDE-PluginInfo-Author=Marco Martin
X-KDE-PluginInfo-Category=Communications
X-KDE-PluginInfo-Email=mart@kde.org
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-Name=org.kde.phone.dialer
X-KDE-PluginInfo-Version=
X-KDE-PluginInfo-Website=
X-KDE-ServiceTypes=KPackage/Generic
Exec=plasmaphonedialer %u
X-Plasma-MainScript=ui/main.qml
X-Plasma-RemoteLocation=
MimeType=x-scheme-handler/call
......@@ -4,11 +4,10 @@ set(plasmaphonedialer_SRCS
call-handler.cpp
call-manager.cpp
)
add_executable(plasmaphonedialer ${plasmaphonedialer_SRCS})
qt5_add_resources(RESOURCES resources.qrc)
add_executable(plasmaphonedialer ${plasmaphonedialer_SRCS} ${RESOURCES})
target_compile_definitions(plasmaphonedialer PRIVATE -DPROJECT_VERSION="${PROJECT_VERSION}")
#find_package(ActiveApp REQUIRED)
find_package(PhoneNumber COMPONENTS PhoneNumber REQUIRED)
target_link_libraries(plasmaphonedialer
......@@ -18,7 +17,6 @@ target_link_libraries(plasmaphonedialer
Qt5::Widgets
KF5::Declarative
KF5::I18n
KF5::Package
KF5::QuickAddons
KF5::DBusAddons
KF5::Notifications
......
......@@ -33,15 +33,10 @@
#include <klocalizedstring.h>
#include <qcommandlineparser.h>
#include <qcommandlineoption.h>
#include <QQuickItem>
#include <QtQml>
#include <kpackage/package.h>
#include <kpackage/packageloader.h>
#include <QQmlContext>
#include <QQmlEngine>
#include <QQmlExpression>
#include <QQmlProperty>
#include <QQuickWindow>
#include <kdeclarative/qmlobject.h>
#include <KAboutData>
......@@ -152,7 +147,7 @@ int main(int argc, char **argv)
auto *obj = new KDeclarative::QmlObject();
obj->setTranslationDomain(packagePath);
obj->setInitializationDelayed(true);
obj->loadPackage(packagePath);
obj->setSource(QUrl("qrc:///main.qml"));
obj->engine()->rootContext()->setContextProperty("commandlineArguments", parser.positionalArguments());
auto *dialerUtils = new DialerUtils(simAccount);
......@@ -160,20 +155,13 @@ int main(int argc, char **argv)
obj->completeInitialization();
if (!obj->package().metadata().isValid()) {
return -1;
}
Tp::SharedPtr<CallHandler> callHandler(new CallHandler(dialerUtils));
registrar->registerClient(Tp::AbstractClientPtr::dynamicCast(callHandler), "Plasma.Dialer");
KPluginMetaData data = obj->package().metadata();
// About data
KAboutData aboutData(data.pluginId(), data.name(), data.version(), data.description(), KAboutLicense::byKeyword(data.license()).key());
for (auto author : data.authors()) {
aboutData.addAuthor(author.name(), author.task(), author.emailAddress(), author.webAddress(), author.ocsUsername());
}
KAboutData aboutData("dialer", i18n("Dialer"), "0.9", i18n("Plasma phone dialer"), KAboutLicense::GPL);
aboutData.setDesktopFileName("org.kde.phone.dialer");
KAboutData::setApplicationData(aboutData);
//The root is not a window?
//have to use a normal QQuickWindow since the root item is already created
......
<RCC>
<qresource prefix="/">
<file alias="main.qml">contents/ui/main.qml</file>
<file alias="Call/AnswerSwipe.qml">contents/ui/Call/AnswerSwipe.qml</file>
<file alias="Call/CallPage.qml">contents/ui/Call/CallPage.qml</file>
<file alias="Call/Avatar.qml">contents/ui/Call/Avatar.qml</file>
<file alias="Dialer/Dialer.qml">contents/ui/Dialer/Dialer.qml</file>
<file alias="Dialer/ContactsList.qml">contents/ui/Dialer/ContactsList.qml</file>
<file alias="Dialer/DialPage.qml">contents/ui/Dialer/DialPage.qml</file>
<file alias="Dialer/private/SectionScroller.js">contents/ui/Dialer/private/SectionScroller.js</file>
<file alias="Dialer/RoundImage.qml">contents/ui/Dialer/RoundImage.qml</file>
<file alias="Dialer/History.qml">contents/ui/Dialer/History.qml</file>
<file alias="Dialer/CustomSectionScroller.qml">contents/ui/Dialer/CustomSectionScroller.qml</file>
<file alias="Dialer/HistoryDelegate.qml">contents/ui/Dialer/HistoryDelegate.qml</file>
<file alias="Dialpad/Dialpad.qml">contents/ui/Dialpad/Dialpad.qml</file>
<file alias="Dialpad/PhoneNumberInput.qml">contents/ui/Dialpad/PhoneNumberInput.qml</file>
<file alias="Dialpad/DialerButton.qml">contents/ui/Dialpad/DialerButton.qml</file>
<file alias="Dialpad/DialerIconButton.qml">contents/ui/Dialpad/DialerIconButton.qml</file>
</qresource>
</RCC>
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