Warning, /graphics/peruse/src/creator/qml/AddPageSheet.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.Controls 2.12 as QtControls
0024 import QtQuick.Dialogs 1.3
0025 
0026 import org.kde.kirigami 2.7 as Kirigami
0027 /**
0028  * @brief overlay with options for adding a page.
0029  * 
0030  * It is accessed from Book
0031  */
0032 Kirigami.OverlaySheet {
0033     id: root;
0034     property int addPageAfter: 0;
0035     property QtObject model;
0036     Column {
0037         height: childrenRect.height;
0038         spacing: Kirigami.Units.smallSpacing;
0039         Kirigami.Heading {
0040             width: parent.width;
0041             height: paintedHeight;
0042             text: i18nc("title text for the add page sheet", "Add a Page?");
0043         }
0044         QtControls.Label {
0045             width: parent.width;
0046             height: paintedHeight;
0047             text: i18nc("help text for the add page sheet", "Please select the method you want to add the new page. No changes will be made outside of the project by performing these actions.");
0048             wrapMode: Text.WrapAtWordBoundaryOrAnywhere;
0049         }
0050         Item {
0051             width: parent.width;
0052             height: Kirigami.Units.largeSpacing;
0053         }
0054         QtControls.Button {
0055             anchors.horizontalCenter: parent.horizontalCenter;
0056 //             iconName: "document-open";
0057             text: i18nc("@action:button add a page by finding an image on the filesystem and copying it into the book", "Copy Image from Device");
0058             onClicked: openDlg.open();
0059             FileDialog {
0060                 id: openDlg;
0061                 title: i18nc("@title:window standard file open dialog used to find a page to add to the book", "Please Choose an Image to Add");
0062                 folder: mainWindow.homeDir();
0063                 property int splitPos: osIsWindows ? 8 : 7;
0064                 onAccepted: {
0065                     if(openDlg.fileUrl.toString().substring(0, 7) === "file://") {
0066                         root.model.addPageFromFile(openDlg.fileUrl.toString().substring(splitPos));
0067                         root.close();
0068                     }
0069                 }
0070                 onRejected: {
0071                     // Just do nothing, we don't really care...
0072                 }
0073             }
0074         }
0075         QtControls.Button {
0076             anchors.horizontalCenter: parent.horizontalCenter;
0077 //             iconName: "document-new";
0078             text: i18nc("@action:button add a page by creating a new image using an image editor", "Create a New Image Using an Image Editor");
0079         }
0080         QtControls.Button {
0081             anchors.horizontalCenter: parent.horizontalCenter;
0082 //             iconName: "camera";
0083             text: i18nc("@action:button add a page by taking a photo with a camera", "Take a Photo and Add That");
0084         }
0085     }
0086 }