Libksieve

parseuserscriptjob.h
1 /*
2  SPDX-FileCopyrightText: 2013-2021 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
7 #pragma once
8 
9 #include "ksieveui_private_export.h"
10 #include <QObject>
11 #include <QStringList>
12 #include <QUrl>
13 namespace KManageSieve
14 {
15 class SieveJob;
16 }
17 class QXmlStreamReader;
18 namespace KSieveUi
19 {
20 class KSIEVEUI_TESTS_EXPORT ParseUserScriptJob : public QObject
21 {
22  Q_OBJECT
23 
24  friend class ParseUserTest;
25 
26 public:
27  explicit ParseUserScriptJob(const QUrl &url, QObject *parent = nullptr);
28  ~ParseUserScriptJob() override;
29 
30  void start();
31  void setAutoDelete(bool deleteMe);
32 
33  Q_REQUIRED_RESULT QUrl scriptUrl() const;
34 
35  Q_REQUIRED_RESULT QStringList activeScriptList() const;
36  Q_REQUIRED_RESULT QString error() const;
37  void kill();
38  Q_REQUIRED_RESULT QStringList parsescript(const QString &script, bool &result);
39 
40 Q_SIGNALS:
41  void finished(KSieveUi::ParseUserScriptJob *job);
42 
43 private:
44  Q_DISABLE_COPY(ParseUserScriptJob)
45  void slotGetResult(KManageSieve::SieveJob *job, bool, const QString &, bool);
46  void emitSuccess(const QStringList &activeScriptList);
47  void emitError(const QString &msgError);
48  Q_REQUIRED_RESULT QString loadInclude();
49  Q_REQUIRED_RESULT QStringList extractActiveScript(const QString &doc);
50  const QUrl mCurrentUrl;
51  KManageSieve::SieveJob *mSieveJob = nullptr;
52  QXmlStreamReader *mStreamReader = nullptr;
53  QStringList mActiveScripts;
54  QString mError;
55  bool mAutoDelete = false;
56 };
57 }
58 
void error(QWidget *parent, const QString &text, const QString &caption=QString(), Options options=Notify)
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Apr 16 2021 23:09:33 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.