File indexing completed on 2024-05-19 05:05:45

0001 /***************************************************************************
0002  *   SPDX-License-Identifier: GPL-2.0-or-later
0003  *                                                                         *
0004  *   SPDX-FileCopyrightText: 2004-2023 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 URLCHECKER_H
0021 #define URLCHECKER_H
0022 
0023 #include <QObject>
0024 
0025 #include <File>
0026 
0027 #ifdef HAVE_KF
0028 #include "kbibtexnetworking_export.h"
0029 #endif // HAVE_KF
0030 
0031 class KBIBTEXNETWORKING_EXPORT UrlChecker : public QObject
0032 {
0033     Q_OBJECT
0034 public:
0035     enum class Status {UrlValid = 0, UnexpectedFileType, Error40X, NetworkError, UnknownError};
0036 
0037     explicit UrlChecker(QObject *parent = nullptr);
0038     ~UrlChecker();
0039 
0040 public Q_SLOTS:
0041     void startChecking(const File &bibtexFile);
0042 
0043 Q_SIGNALS:
0044     void urlChecked(QUrl url, UrlChecker::Status status, QString msg);
0045     void finished();
0046 
0047 private:
0048     class Private;
0049     Private *const d;
0050 };
0051 
0052 #endif // URLCHECKER_H