mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 03:30:20 +00:00
Add standard AboutPage to Okular Mobile
This commit is contained in:
parent
f470c235ce
commit
5c3da77dcd
|
@ -1,6 +1,11 @@
|
|||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../
|
||||
)
|
||||
add_executable(okularkirigami main.cpp app.qrc)
|
||||
target_link_libraries(okularkirigami Qt5::Widgets Qt5::Qml KF5::I18n)
|
||||
target_link_libraries(okularkirigami Qt5::Widgets Qt5::Qml KF5::I18n KF5::CoreAddons)
|
||||
if (ANDROID)
|
||||
find_package(Qt5 COMPONENTS AndroidExtras)
|
||||
target_sources(okularkirigami PRIVATE android.cpp)
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <QStandardPaths>
|
||||
#include <QTimer>
|
||||
|
||||
#include "aboutdata.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "android.h"
|
||||
|
||||
|
@ -41,11 +43,14 @@ int main(int argc, char *argv[])
|
|||
QApplication app(argc, argv);
|
||||
app.setApplicationName(QStringLiteral("okularkirigami"));
|
||||
|
||||
KAboutData aboutData = okularAboutData();
|
||||
KAboutData::setApplicationData(aboutData);
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addVersionOption();
|
||||
parser.addHelpOption();
|
||||
// parser.setApplicationDescription(i18n("Okular mobile"));
|
||||
aboutData.setupCommandLine(&parser);
|
||||
parser.process(app);
|
||||
aboutData.processCommandLine(&parser);
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
#ifdef __ANDROID__
|
||||
|
@ -56,8 +61,10 @@ int main(int argc, char *argv[])
|
|||
qmlRegisterSingletonType<QObject>("org.kde.okular.app", 2, 0, "AndroidInstance", [](QQmlEngine *, QJSEngine *) -> QObject * { return new QObject; });
|
||||
const QString uri = parser.positionalArguments().count() == 1 ? QUrl::fromUserInput(parser.positionalArguments().constFirst(), {}, QUrl::AssumeLocalFile).toString() : QString();
|
||||
#endif
|
||||
// TODO move away from context property when possible
|
||||
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
|
||||
engine.rootContext()->setContextProperty(QStringLiteral("uri"), uri);
|
||||
engine.rootContext()->setContextProperty(QStringLiteral("about"), QVariant::fromValue(aboutData));
|
||||
QVariantMap paths;
|
||||
paths[QStringLiteral("desktop")] = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||
paths[QStringLiteral("documents")] = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Dialogs 1.3 as QQD
|
||||
import org.kde.okular 2.0 as Okular
|
||||
import org.kde.kirigami 2.0 as Kirigami
|
||||
import org.kde.kirigami 2.10 as Kirigami
|
||||
import org.kde.okular.app 2.0
|
||||
|
||||
Kirigami.ApplicationWindow {
|
||||
|
@ -48,6 +48,12 @@ Kirigami.ApplicationWindow {
|
|||
onTriggered: {
|
||||
fileDialog.open()
|
||||
}
|
||||
},
|
||||
Kirigami.Action {
|
||||
text: i18n("About")
|
||||
icon.name: "help-about-symbolic"
|
||||
onTriggered: fileBrowserRoot.pageStack.layers.push(aboutPage);
|
||||
enabled: fileBrowserRoot.pageStack.layers.depth === 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -64,6 +70,13 @@ Kirigami.ApplicationWindow {
|
|||
document: documentItem
|
||||
}
|
||||
|
||||
Component {
|
||||
id: aboutPage
|
||||
Kirigami.AboutPage {
|
||||
aboutData: about
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME: this is due to global vars being binded after the parse is done, do the 2 steps parsing
|
||||
Timer {
|
||||
interval: 100
|
||||
|
|
Loading…
Reference in a new issue