1/*
2 * SPDX-FileCopyrightText: 2012 Reza Fatahilah Shah <rshah0385@kireihana.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7import QtQuick 2.1
8import org.kde.plasma.core 2.0 as PlasmaCore
9import org.kde.plasma.extras 2.0 as PlasmaExtras
10import org.kde.kquickcontrolsaddons 2.0
11import QtQuick.Layouts 1.1
12
13
14PlasmaCore.Dialog {
15    id: root
16
17    property alias image: comicPicture.image
18
19    flags: Qt.Popup
20    visible: false
21
22    function toggleVisibility()
23    {
24        root.visible = !root.visible;
25        if (root.visible) {
26            plasmoid.nativeInterface.positionFullView(root);
27            root.activateWindow;
28        }
29    }
30
31    function close() {
32        root.visible = false;
33    }
34
35    mainItem: PlasmaExtras.ScrollArea {
36        id: mainScrollArea
37
38        anchors.fill: parent
39
40        Layout.minimumWidth: comicPicture.nativeWidth
41        Layout.maximumWidth: Layout.minimumWidth
42        Layout.minimumHeight: comicPicture.nativeHeight
43        Layout.maximumHeight: Layout.minimumHeight
44
45        Flickable {
46            id: viewContainer
47
48            anchors.fill: parent
49
50            contentWidth: comicPicture.nativeWidth
51            contentHeight: comicPicture.nativeHeight
52
53            //clip: true
54
55            QImageItem {
56                id: comicPicture
57
58                anchors.fill: parent
59
60                smooth: true
61                fillMode: QImageItem.PreserveAspectFit
62
63                MouseArea {
64                    id: dialogMouseArea
65
66                    anchors.fill: comicPicture
67
68                    onClicked: {
69                        root.close();
70                    }
71                }
72            }
73        }
74    }
75}
76