File indexing completed on 2024-05-12 05:22:09

0001 /*
0002     SPDX-FileCopyrightText: 2019 David Barchiesi <david@barchie.si>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ui_mainwindow.h"
0010 #include <QMainWindow>
0011 
0012 #include "core/types.h"
0013 #include "drive/permission.h"
0014 
0015 class MainWindow : public QMainWindow
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     explicit MainWindow(QWidget *parent = nullptr);
0021 
0022 private Q_SLOTS:
0023     /**
0024      * Retrieves tokens from Google that we will use to authenticate
0025      * further requests
0026      */
0027     void authenticate();
0028 
0029     /**
0030      * Retrieves list of all permissions for file id
0031      */
0032     void slotFetchPermissions();
0033 
0034     /**
0035      * A specific permission in permissions list has been selected. Sends a request
0036      * to Google to retrieve the permission details
0037      */
0038     void permissionSelected();
0039 
0040 private:
0041     Ui::MainWindow ui;
0042 
0043     KGAPI2::AccountPtr m_account;
0044 
0045     static QString roleToName(KGAPI2::Drive::Permission::Role role);
0046     static QString typeToName(KGAPI2::Drive::Permission::Type type);
0047     static QString permissionTypeToName(KGAPI2::Drive::Permission::PermissionDetails::PermissionType permissionType);
0048 };