Warning, /graphics/peruse/src/app/qml/Main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * Copyright (C) 2015 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 of the License, or (at your option) version 3, or any
0008  * later version accepted by the membership of KDE e.V. (or its
0009  * successor approved by the membership of KDE e.V.), which shall
0010  * act as a proxy defined in Section 6 of version 3 of the license.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General Public
0018  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0019  *
0020  */
0021 
0022 import QtQuick 2.12
0023 import QtQuick.Window 2.12
0024 import QtQuick.Dialogs 1.3
0025 import org.kde.kirigami 2.7 as Kirigami
0026 
0027 PeruseMain {
0028     id: root;
0029     width: Math.min(Screen.desktopAvailableWidth * 0.6, Kirigami.Units.gridUnit * 80);
0030     height: Math.min(Screen.desktopAvailableHeight * 0.7, Kirigami.Units.gridUnit * 60);
0031 
0032     function openOther() {
0033         openDlg.open();
0034     }
0035 
0036     FileDialog {
0037         id: openDlg;
0038         title: i18nc("@title:window standard file open dialog used to open a book not in the collection", "Please Choose a Comic to Open");
0039         folder: root.homeDir();
0040         property int splitPos: osIsWindows ? 8 : 7;
0041         onAccepted: {
0042             if(openDlg.fileUrl.toString().substring(0, 7) === "file://") {
0043                 root.showBook(openDlg.fileUrl.toString().substring(splitPos), 0);
0044             }
0045         }
0046         onRejected: {
0047             // Just do nothing, we don't really care...
0048         }
0049     }
0050 }