File indexing completed on 2024-11-24 04:34:33

0001 /***************************************************************************
0002  *   SPDX-License-Identifier: GPL-2.0-or-later
0003  *                                                                         *
0004  *   SPDX-FileCopyrightText: 2004-2019 Thomas Fischer <fischer@unix-ag.uni-kl.de>
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  *                                                                         *
0011  *   This program is distributed in the hope that it will be useful,       *
0012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0014  *   GNU General Public License for more details.                          *
0015  *                                                                         *
0016  *   You should have received a copy of the GNU General Public License     *
0017  *   along with this program; if not, see <https://www.gnu.org/licenses/>. *
0018  ***************************************************************************/
0019 
0020 #ifndef KBIBTEX_NETWORKING_ZOTERO_COLLECTION_H
0021 #define KBIBTEX_NETWORKING_ZOTERO_COLLECTION_H
0022 
0023 #include <QObject>
0024 #include <QScopedPointer>
0025 #include <QSharedPointer>
0026 #include <QUrl>
0027 
0028 #ifdef HAVE_KF
0029 #include "kbibtexnetworking_export.h"
0030 #endif // HAVE_KF
0031 
0032 namespace Zotero
0033 {
0034 
0035 class API;
0036 
0037 /**
0038  * @author Thomas Fischer <fischer@unix-ag.uni-kl.de>
0039  */
0040 class KBIBTEXNETWORKING_EXPORT Collection : public QObject
0041 {
0042     Q_OBJECT
0043 public:
0044     Collection(QSharedPointer<Zotero::API> api, QObject *parent);
0045     ~Collection() override;
0046 
0047     bool initialized() const;
0048     bool busy() const;
0049 
0050     QString collectionLabel(const QString &collectionId) const;
0051     QString collectionParent(const QString &collectionId) const;
0052     QVector<QString> collectionChildren(const QString &collectionId) const;
0053     uint collectionNumericId(const QString &collectionId) const;
0054     QString collectionFromNumericId(quintptr numericId) const;
0055 
0056 Q_SIGNALS:
0057     void finishedLoading();
0058 
0059 private:
0060     class Private;
0061     Private *const d;
0062 
0063     void emitFinishedLoading();
0064 
0065 private Q_SLOTS:
0066     void finishedFetchingCollection();
0067 };
0068 
0069 } // end of namespace Zotero
0070 
0071 #endif // KBIBTEX_NETWORKING_ZOTERO_COLLECTION_H