File indexing completed on 2024-12-22 04:45:58

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolawidgets_private_export.h"
0010 #include <QThread>
0011 
0012 class KZip;
0013 class KArchiveDirectory;
0014 class LIBRUQOLAWIDGETS_TESTS_EXPORT ImportAccountJob : public QThread
0015 {
0016     Q_OBJECT
0017 public:
0018     explicit ImportAccountJob(const QString &fileName, QObject *parent = nullptr);
0019     ~ImportAccountJob() override;
0020 
0021 protected:
0022     void run() override;
0023 
0024 Q_SIGNALS:
0025     void importFailed(const QString &str);
0026     void importDone();
0027     void importInfo(const QString &msg);
0028 
0029 private:
0030     LIBRUQOLAWIDGETS_NO_EXPORT void copyToDirectory(const KArchiveDirectory *subfolderDir, const QString &dest);
0031     LIBRUQOLAWIDGETS_NO_EXPORT void importAccount(QString accountName);
0032     LIBRUQOLAWIDGETS_NO_EXPORT void finishImportAccounts();
0033     LIBRUQOLAWIDGETS_NO_EXPORT void importAccounts();
0034     [[nodiscard]] LIBRUQOLAWIDGETS_NO_EXPORT QString verifyExistingAccount(QString accountName) const;
0035     QStringList mAccountInfos;
0036     KZip *const mArchive;
0037     int mAccountIndex = 0;
0038 };