Turn okularkirigami into an executable

Summary:
Makes for straightforward Android testing and will work on normal
installations as well.

Reviewers: #kirigami, #okular, mart

Reviewed By: #kirigami, mart

Subscribers: plasma-devel

Tags: #kirigami, #okular

Differential Revision: https://phabricator.kde.org/D12176
This commit is contained in:
Aleix Pol 2018-04-13 18:07:38 +02:00
parent 4d19b4a8d7
commit 5f8f84d53c
4 changed files with 64 additions and 12 deletions

View file

@ -1,14 +1,7 @@
set(CMAKE_AUTORCC ON)
add_executable(okularkirigami main.cpp app.qrc)
target_link_libraries(okularkirigami Qt5::Widgets Qt5::Qml KF5::I18n)
install(TARGETS okularkirigami ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
include_directories( ${QT_INCLUDES} )
#add_subdirectory(src)
# QML-only thing
#install(DIRECTORY package/ DESTINATION ${KDE_INSTALL_DATADIR}/plasma/packages/org.kde.active.documentviewer)
install(DIRECTORY package/ DESTINATION ${KDE_INSTALL_DATADIR}/kpackage/genericqml/org.kde.mobile.okular)
install(FILES package/metadata.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} RENAME org.kde.mobile.okular.desktop)
#install(FILES active-documentviewer.desktop DESTINATION ${KDE_INSTALL_APPDIR})

13
mobile/app/app.qrc Normal file
View file

@ -0,0 +1,13 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>package/contents/ui/Bookmarks.qml</file>
<file>package/contents/ui/Documents.qml</file>
<file>package/contents/ui/main.qml</file>
<file>package/contents/ui/MainView.qml</file>
<file>package/contents/ui/OkularDrawer.qml</file>
<file>package/contents/ui/TableOfContents.qml</file>
<file>package/contents/ui/Thumbnails.qml</file>
<file>package/contents/ui/ThumbnailsBase.qml</file>
<file>package/contents/ui/TreeDelegate.qml</file>
</qresource>
</RCC>

46
mobile/app/main.cpp Normal file
View file

@ -0,0 +1,46 @@
/*************************************************************************************
* Copyright (C) 2010 by Aleix Pol <aleixpol@kde.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
*************************************************************************************/
#include <QApplication>
#include <KLocalizedContext>
#include <QDebug>
#include <QFileInfo>
#include <QDir>
#include <QStandardPaths>
#include <QQmlEngine>
#include <QQmlContext>
#include <QQmlApplicationEngine>
#include <QIcon>
Q_DECL_EXPORT int main(int argc, char *argv[])
{
#ifdef __ANDROID__
qputenv("QT_QUICK_CONTROLS_STYLE", "material");
#endif
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
app.setApplicationName(QStringLiteral("okularmobile"));
QQmlApplicationEngine engine;
engine.rootContext()->setContextObject(new KLocalizedContext(&engine));
engine.setBaseUrl(QUrl("qrc:/package/contents/ui/"));
engine.load(QUrl("qrc:/package/contents/ui/main.qml"));
return app.exec();
}

View file

@ -109,7 +109,7 @@ GenericName[x-test]=xxDocument viewerxx
GenericName[zh_CN]=
GenericName[zh_TW]=
Type=Application
Exec=kpackagelauncherqml -a org.kde.mobile.okular %u
Exec=okularkirigami
Icon=okular
NoDisplay=true
X-KDE-ParentApp=