1 /*
2     SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
3 
4     SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "akonadiwidgets_export.h"
10 #include "ui_selftestdialog.h"
11 #include <QDialog>
12 
13 class QStandardItem;
14 class QStandardItemModel;
15 namespace Akonadi
16 {
17 /**
18  * @internal
19  *
20  * @short A dialog that checks the current status of the Akonadi system.
21  *
22  * This dialog checks the current status of the Akonadi system and
23  * displays a summary of the checks.
24  *
25  * @author Volker Krause <vkrause@kde.org>
26  */
27 class AKONADIWIDGETS_EXPORT SelfTestDialog : public QDialog
28 {
29     Q_OBJECT
30 public:
31     /**
32      * Creates a new self test dialog.
33      *
34      * @param parent The parent widget.
35      */
36     explicit SelfTestDialog(QWidget *parent = nullptr);
37 
38     /**
39      * Hides the label with the introduction message.
40      */
41     void hideIntroduction();
42 
43 private Q_SLOTS:
44     void selectionChanged(const QModelIndex &index);
45     void saveReport();
46     void copyReport();
47     void linkActivated(const QString &link);
48     void runTests();
49 
50 private:
51     enum ResultType {
52         Skip,
53         Success,
54         Warning,
55         Error,
56     };
57     QStandardItem *report(ResultType type, const KLocalizedString &summary, const KLocalizedString &details);
58     QVariant serverSetting(const QString &group, const char *key, const QVariant &def) const;
59     bool useStandaloneMysqlServer() const;
60     bool runProcess(const QString &app, const QStringList &args, QString &result) const;
61 
62     void testSQLDriver();
63     void testMySQLServer();
64     void testMySQLServerLog();
65     void testMySQLServerConfig();
66     void testPSQLServer();
67     void testAkonadiCtl();
68     void testServerStatus();
69     void testProtocolVersion();
70     void testResources();
71     void testServerLog();
72     void testControlLog();
73     void testRootUser();
74 
75     QString createReport();
76 
77     Ui::SelfTestDialog ui;
78     QStandardItemModel *mTestModel = nullptr;
79 };
80 }
81