...
 
Commits (3)
...@@ -29,7 +29,7 @@ kde_enable_exceptions() ...@@ -29,7 +29,7 @@ kde_enable_exceptions()
################# Find dependencies ################# ################# Find dependencies #################
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2 Multimedia DBus) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2 Multimedia DBus)
find_package(KF5 REQUIRED COMPONENTS Kirigami2 Purpose I18n Contacts NetworkManagerQt) find_package(KF5 REQUIRED COMPONENTS Kirigami2 Purpose I18n Contacts CoreAddons)# NetworkManagerQt)
find_package(ZXing REQUIRED COMPONENTS Core) find_package(ZXing REQUIRED COMPONENTS Core)
################# Enable C++11 features for clang and gcc ################# ################# Enable C++11 features for clang and gcc #################
......
#!/usr/bin/env xdg-open
[Desktop Entry] [Desktop Entry]
Name=Qrca Name=Qrca
GenericName=Barcode Scanner GenericName=Barcode Scanner
......
...@@ -8,5 +8,5 @@ set(qrca_SRCS ...@@ -8,5 +8,5 @@ set(qrca_SRCS
qt5_add_resources(RESOURCES resources.qrc) qt5_add_resources(RESOURCES resources.qrc)
add_executable(qrca ${qrca_SRCS} ${RESOURCES}) add_executable(qrca ${qrca_SRCS} ${RESOURCES})
target_link_libraries(qrca Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Multimedia ZXing::Core KF5::I18n KF5::Contacts) target_link_libraries(qrca Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Multimedia ZXing::Core KF5::I18n KF5::Contacts KF5::CoreAddons)
install(TARGETS qrca ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS qrca ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
...@@ -28,7 +28,7 @@ bool Qrca::isUrl(const QString &text) { ...@@ -28,7 +28,7 @@ bool Qrca::isUrl(const QString &text) {
} }
bool Qrca::isVCard(const QString &text) { bool Qrca::isVCard(const QString &text) {
return (text.startsWith("BEGIN:VCARD") && text.endsWith("END:VCARD")); return (text.startsWith("BEGIN:VCARD") && text.trimmed().endsWith("END:VCARD"));
} }
void Qrca::saveVCard(const QString &text) { void Qrca::saveVCard(const QString &text) {
......
import QtQuick 2.6
import org.kde.kirigami 2.6 as Kirigami
Kirigami.AboutPage
{
aboutData: qrcaAboutData
}
...@@ -36,7 +36,15 @@ Kirigami.ApplicationWindow { ...@@ -36,7 +36,15 @@ Kirigami.ApplicationWindow {
if (pageStack.layers.depth < 2) if (pageStack.layers.depth < 2)
pageStack.layers.push(qrCodeEncoderPage) pageStack.layers.push(qrCodeEncoderPage)
} }
},
Kirigami.Action {
text: i18n("About")
icon.name: "help-feedback"
property string component: "qrc:/AboutPage.qml"
onTriggered: if (pageStack.layers.depth < 2)
pageStack.layers.push(component)
} }
] ]
} }
...@@ -44,6 +52,7 @@ Kirigami.ApplicationWindow { ...@@ -44,6 +52,7 @@ Kirigami.ApplicationWindow {
Component {id: qrCodeScannerPage; QrCodeScannerPage {}} Component {id: qrCodeScannerPage; QrCodeScannerPage {}}
Component {id: qrCodeEncoderPage; QrCodeEncoderPage {}} Component {id: qrCodeEncoderPage; QrCodeEncoderPage {}}
Component {id: aboutPage; AboutPage {}}
pageStack.initialPage: qrCodeScannerPage pageStack.initialPage: qrCodeScannerPage
} }
#include <QApplication> #include <QApplication>
#include <QIcon>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QtQml> #include <QtQml>
#include <QUrl> #include <QUrl>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <KAboutData>
#include <KLocalizedString>
#include "QrCodeScannerFilter.h" #include "QrCodeScannerFilter.h"
#include "Qrca.h" #include "Qrca.h"
...@@ -20,6 +24,27 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) ...@@ -20,6 +24,27 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
parser.addOption(QCommandLineOption("encode", "Text to encode into a QR-Code", "encode", "")); parser.addOption(QCommandLineOption("encode", "Text to encode into a QR-Code", "encode", ""));
parser.process(app); parser.process(app);
// setup translation string domain for the i18n calls
KLocalizedString::setApplicationDomain("qrca");
// create a KAboutData object to use for setting the application metadata
KAboutData aboutData("qrca", i18n("Qrca"), "0.1",
i18n("A simple QR scanner"),
KAboutLicense::GPL_V3,
i18n("Copyright 2016-2019 Qrca and Kaidan authors"), QString(),
"https://www.plasma-mobile.org");
// overwrite default-generated values of organizationDomain & desktopFileName
aboutData.addAuthor(i18n("Jonah Brüchert"), QString(), QStringLiteral("jbb@kaidan.im"), QStringLiteral("jbbgameich.github.io"));
aboutData.addAuthor(i18n("Simon Schmeißer"));
aboutData.setOrganizationDomain("kde.org");
aboutData.setDesktopFileName("org.kde.qrca");
// set the application metadata
KAboutData::setApplicationData(aboutData);
// in GUI apps set the window icon manually, not covered by KAboutData
// needed for environments where the icon name is not extracted from
// the information in the application's desktop file
QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("qrca")));
aboutData.setProgramLogo(app.windowIcon());
qmlRegisterType<QrCodeScannerFilter>("org.kde.qrca", 1, 0, "QrCodeScannerFilter"); qmlRegisterType<QrCodeScannerFilter>("org.kde.qrca", 1, 0, "QrCodeScannerFilter");
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
...@@ -27,6 +52,8 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) ...@@ -27,6 +52,8 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
auto *qrca = new Qrca(); auto *qrca = new Qrca();
engine.rootContext()->setContextProperty("encodeText", parser.value("encode")); engine.rootContext()->setContextProperty("encodeText", parser.value("encode"));
engine.rootContext()->setContextProperty("qrca", qrca); engine.rootContext()->setContextProperty("qrca", qrca);
engine.rootContext()->setContextProperty(QStringLiteral("qrcaAboutData"), QVariant::fromValue(KAboutData::applicationData()));
engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
......
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
<file alias="QrCodeScannerPage.qml">contents/ui/QrCodeScannerPage.qml</file> <file alias="QrCodeScannerPage.qml">contents/ui/QrCodeScannerPage.qml</file>
<file alias="QrCodeEncoderPage.qml">contents/ui/QrCodeEncoderPage.qml</file> <file alias="QrCodeEncoderPage.qml">contents/ui/QrCodeEncoderPage.qml</file>
<file alias="ShareSheet.qml">contents/ui/ShareSheet.qml</file> <file alias="ShareSheet.qml">contents/ui/ShareSheet.qml</file>
<file alias="AboutPage.qml">contents/ui/AboutPage.qml</file>
</qresource> </qresource>
</RCC> </RCC>