...
 
Commits (3)
......@@ -29,7 +29,7 @@ kde_enable_exceptions()
################# Find dependencies #################
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)
################# Enable C++11 features for clang and gcc #################
......
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Qrca
GenericName=Barcode Scanner
......
......@@ -8,5 +8,5 @@ set(qrca_SRCS
qt5_add_resources(RESOURCES resources.qrc)
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})
......@@ -28,7 +28,7 @@ bool Qrca::isUrl(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) {
......
import QtQuick 2.6
import org.kde.kirigami 2.6 as Kirigami
Kirigami.AboutPage
{
aboutData: qrcaAboutData
}
......@@ -36,7 +36,15 @@ Kirigami.ApplicationWindow {
if (pageStack.layers.depth < 2)
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 {
Component {id: qrCodeScannerPage; QrCodeScannerPage {}}
Component {id: qrCodeEncoderPage; QrCodeEncoderPage {}}
Component {id: aboutPage; AboutPage {}}
pageStack.initialPage: qrCodeScannerPage
}
#include <QApplication>
#include <QIcon>
#include <QQmlApplicationEngine>
#include <QtQml>
#include <QUrl>
#include <QCommandLineParser>
#include <KAboutData>
#include <KLocalizedString>
#include "QrCodeScannerFilter.h"
#include "Qrca.h"
......@@ -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.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");
QQmlApplicationEngine engine;
......@@ -27,6 +52,8 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
auto *qrca = new Qrca();
engine.rootContext()->setContextProperty("encodeText", parser.value("encode"));
engine.rootContext()->setContextProperty("qrca", qrca);
engine.rootContext()->setContextProperty(QStringLiteral("qrcaAboutData"), QVariant::fromValue(KAboutData::applicationData()));
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
......
......@@ -4,5 +4,6 @@
<file alias="QrCodeScannerPage.qml">contents/ui/QrCodeScannerPage.qml</file>
<file alias="QrCodeEncoderPage.qml">contents/ui/QrCodeEncoderPage.qml</file>
<file alias="ShareSheet.qml">contents/ui/ShareSheet.qml</file>
<file alias="AboutPage.qml">contents/ui/AboutPage.qml</file>
</qresource>
</RCC>