This file is indexed.

/usr/share/peruse/qml/PeruseMain.qml is in peruse-common 1.2+dfsg-2ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
/*
 * Copyright (C) 2015 Dan Leinir Turthra Jensen <admin@leinir.dk>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) version 3, or any
 * later version accepted by the membership of KDE e.V. (or its
 * successor approved by the membership of KDE e.V.), which shall
 * act as a proxy defined in Section 6 of version 3 of the license.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

import QtQuick 2.1
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4 as QtControls
import QtQuick.Window 2.2

import org.kde.kirigami 1.0 as Kirigami
import org.kde.peruse 0.1 as Peruse
import org.kde.contentlist 0.1

Kirigami.ApplicationWindow {
    id: mainWindow;
    title: "Comic Book Reader";
    property int animationDuration: 200;
    property bool isLoading: true;
    pageStack.initialPage: welcomePage;
    visible: true;
    // If the controls are not visible, being able to drag the pagestack feels really weird,
    // so we just turn that ability off :)
    pageStack.interactive: controlsVisible;
    /// Which type of device we're running on. 0 is desktop, 1 is phone
    property int deviceType: PLASMA_PLATFORM.substring(0, 5) === "phone" ? 1 : 0;
    property int deviceTypeDesktop: 0;
    property int deviceTypePhone: 1;

    function showBook(filename, currentPage) {
        if(mainWindow.pageStack.lastItem.objectName === "bookViewer") {
            mainWindow.pageStack.pop();
        }
        mainWindow.pageStack.push(bookViewer, { focus: true, file: filename, currentPage: currentPage })
        peruseConfig.bookOpened(filename);
    }

    Peruse.BookListModel {
        id: contentList;
        contentModel: ContentList {
            onSearchCompleted: {
                mainWindow.isLoading = false;
                mainWindow.globalDrawer.actions = globalDrawerActions;
            }
        }
    }

    Peruse.Config {
        id: peruseConfig;
    }
    function homeDir() {
        return peruseConfig.homeDir();
    }

    contextDrawer: PeruseContextDrawer {
        id: contextDrawer;
    }

    globalDrawer: Kirigami.GlobalDrawer {
        title: i18nc("application title for the sidebar", "Peruse");
        titleIcon: "peruse";
        opened: PLASMA_PLATFORM.substring(0, 5) === "phone" ? false : true;
        modal: PLASMA_PLATFORM.substring(0, 5) === "phone" ? true : false;
        actions: []
    }
    property list<QtObject> globalDrawerActions: [
            Kirigami.Action {
                text: "Welcome";
                iconName: "start-over";
                checked: mainWindow.currentCategory === "welcomePage";
                checkable: true;
                onTriggered: {
                    changeCategory(welcomePage);
                    pageStack.currentItem.updateRecent();
                }
            },
            Kirigami.Action {
            },
            Kirigami.Action {
                text: i18nc("Switch to the listing page showing the most recently discovered books", "Recently Added Books");
                iconName: "appointment-new";
                checked: mainWindow.currentCategory === "bookshelfAdded";
                checkable: true;
                onTriggered: changeCategory(bookshelfAdded);
            },
            Kirigami.Action {
                text: i18nc("Switch to the listing page showing items grouped by title", "Group by Title");
                iconName: "view-media-title";
                checked: mainWindow.currentCategory === "bookshelfTitle";
                checkable: true;
                onTriggered: changeCategory(bookshelfTitle);
            },
            Kirigami.Action {
                text: i18nc("Switch to the listing page showing items grouped by author", "Group by Author");
                iconName: "actor";
                checked: mainWindow.currentCategory === "bookshelfAuthor";
                checkable: true;
                onTriggered: changeCategory(bookshelfAuthor);
            },
            Kirigami.Action {
                text: i18nc("Switch to the listing page showing items grouped by series", "Group by Series");
                iconName: "edit-group";
                checked: currentCategory === "bookshelfSeries";
                checkable: true;
                onTriggered: changeCategory(bookshelfSeries);
            },
            Kirigami.Action {
                text: i18nc("Switch to the listing page showing items grouped by publisher", "Group by Publisher");
                iconName: "view-media-publisher";
                checked: mainWindow.currentCategory === "bookshelfPublisher";
                onTriggered: changeCategory(bookshelfPublisher);
            },
            Kirigami.Action {
                text: i18nc("Switch to the listing page showing items grouped by their filesystem folder", "Filter by Folder");
                iconName: "tag-folder";
                checked: mainWindow.currentCategory === "bookshelfFolder";
                checkable: true;
                onTriggered: changeCategory(bookshelfFolder);
            },
            Kirigami.Action {
            },
            Kirigami.Action {
                text: i18nc("Open a book from somewhere on disk (uses the open dialog, or a drilldown on touch devices)", "Open other...");
                iconName: "document-open";
                onTriggered: openOther();
            },
            Kirigami.Action {
                text: i18nc("Switch to the book store page", "Get Hot New Books");
                iconName: "get-hot-new-stuff";
                onTriggered: changeCategory(storePage);
            },
            Kirigami.Action {
            },
            Kirigami.Action {
                text: i18nc("Open the settings page", "Settings");
                iconName: "configure"
                checked: mainWindow.currentCategory === "settingsPage";
                checkable: true;
                onTriggered: changeCategory(settingsPage);
            }
        ]

    Component {
        id: welcomePage;
        WelcomePage {
            onBookSelected: mainWindow.showBook(filename, currentPage);
        }
    }

    Component {
        id: bookViewer;
        Book {
            id: viewerRoot;
            onCurrentPageChanged: {
                contentList.setBookData(viewerRoot.file, "currentPage", viewerRoot.currentPage);
            }
            onTotalPagesChanged: {
                contentList.setBookData(viewerRoot.file, "totalPages", viewerRoot.totalPages);
            }
        }
    }

    Component {
        id: bookshelfTitle;
        Bookshelf {
            model: contentList.titleCategoryModel;
            headerText: i18nc("Title of the page with books grouped by the title start letters", "Group by Title");
            onBookSelected: mainWindow.showBook(filename, currentPage);
            categoryName: "bookshelfTitle";
        }
    }

    Component {
        id: bookshelfAdded;
        Bookshelf {
            model: contentList.newlyAddedCategoryModel;
            headerText: i18nc("Title of the page with all books ordered by which was added most recently", "Recently Added Books");
            sectionRole: "created";
            sectionCriteria: ViewSection.FullString;
            onBookSelected: mainWindow.showBook(filename, currentPage);
            categoryName: "bookshelfAdded";
        }
    }

    Component {
        id: bookshelfSeries;
        Bookshelf {
            model: contentList.seriesCategoryModel;
            headerText: i18nc("Title of the page with books grouped by what series they are in", "Group by Series");
            onBookSelected: mainWindow.showBook(filename, currentPage);
            categoryName: "bookshelfSeries";
        }
    }

    Component {
        id: bookshelfAuthor;
        Bookshelf {
            model: contentList.authorCategoryModel;
            headerText: i18nc("Title of the page with books grouped by author", "Group by Author");
            onBookSelected: mainWindow.showBook(filename, currentPage);
            categoryName: "bookshelfAuthor";
        }
    }

    Component {
        id: bookshelfPublisher;
        Bookshelf {
            model: contentList;
            headerText: i18nc("Title of the page with books grouped by who published them", "Group by Publisher");
            onBookSelected: mainWindow.showBook(filename, currentPage);
            categoryName: "bookshelfPublisher";
        }
    }

    Component {
        id: bookshelfFolder;
        Bookshelf {
            model: contentList.folderCategoryModel;
            headerText: i18nc("Title of the page with books grouped by what folder they are in", "Filter by Folder");
            onBookSelected: mainWindow.showBook(filename, currentPage);
            categoryName: "bookshelfFolder";
        }
    }

    Component {
        id: bookshelf;
        Bookshelf {
            onBookSelected: mainWindow.showBook(filename, currentPage);
        }
    }

    Component {
        id: storePage;
        Store {
        }
    }

    Component {
        id: settingsPage;
        Settings {
        }
    }

    property string currentCategory: "welcomePage";
    function changeCategory(categoryItem) {
        // Clear all the way to the welcome page if we change the category...
        mainWindow.pageStack.clear();
        mainWindow.pageStack.push(categoryItem);
        currentCategory = mainWindow.pageStack.currentItem.categoryName;
        if (PLASMA_PLATFORM.substring(0, 5) === "phone") {
            globalDrawer.close();
        }
    }

    Component.onCompleted: {
        var bookLocations = peruseConfig.bookLocations;
        for(var i = 0; i < bookLocations.length; ++i) {
            contentList.contentModel.addLocation(bookLocations[i]);
        }
        contentList.contentModel.setSearchString("cbz OR cbr OR cb7 OR cbt OR cba OR chm OR djvu OR epub OR pdf");
        contentList.contentModel.addMimetype("application/x-cbz");
        contentList.contentModel.addMimetype("application/x-cbr");
        contentList.contentModel.addMimetype("application/x-cb7");
        contentList.contentModel.addMimetype("application/x-cbt");
        contentList.contentModel.addMimetype("application/x-cba");
        contentList.contentModel.addMimetype("application/vnd.comicbook+zip");
        contentList.contentModel.addMimetype("application/vnd.comicbook+rar");
        contentList.contentModel.addMimetype("application/vnd.ms-htmlhelp");
        contentList.contentModel.addMimetype("image/vnd.djvu");
        contentList.contentModel.addMimetype("image/x-djvu");
        contentList.contentModel.addMimetype("application/epub+zip");
        contentList.contentModel.addMimetype("application/pdf");
        contentList.contentModel.startSearch();
    }
}