digiKam
dbengineguierrorhandler.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of digiKam project
4  * https://www.digikam.org
5  *
6  * Date : 2009-09-27
7  * Description : Database engine gui error handler
8  *
9  * Copyright (C) 2009-2010 by Holger Foerster <Hamsi2k at freenet dot de>
10  * Copyright (C) 2010-2022 by Gilles Caulier <caulier dot gilles at gmail dot com>
11  *
12  * This program is free software; you can redistribute it
13  * and/or modify it under the terms of the GNU General
14  * Public License as published by the Free Software Foundation;
15  * either version 2, or (at your option)
16  * any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * ============================================================ */
24 
25 #ifndef DIGIKAM_DB_ENGINE_GUI_ERROR_HANDLER_H
26 #define DIGIKAM_DB_ENGINE_GUI_ERROR_HANDLER_H
27 
28 // Qt includes
29 
30 #include <QThread>
31 
32 // Local includes
33 
34 #include "dbenginebackend.h"
35 #include "dbengineerrorhandler.h"
36 #include "digikam_export.h"
37 
38 namespace Digikam
39 {
40 
41 class DIGIKAM_EXPORT DbEngineConnectionChecker : public QThread
42 {
43  Q_OBJECT
44 
45 public:
46 
47  explicit DbEngineConnectionChecker(const DbEngineParameters& parameters);
48  ~DbEngineConnectionChecker() override;
49 
50  bool checkSuccessful() const;
51 
52 public Q_SLOTS:
53 
54  void stopChecking();
55 
56 protected:
57 
58  void run() override;
59 
60 Q_SIGNALS:
61 
62  void failedAttempt();
63  void done();
64 
65 private:
66 
67  // Disable
68  DbEngineConnectionChecker(QObject*) = delete;
69 
70  class Private;
71  Private* const d;
72 };
73 
74 // --------------------------------------------------------------
75 
76 class DIGIKAM_EXPORT DbEngineGuiErrorHandler : public DbEngineErrorHandler
77 {
78  Q_OBJECT
79 
80 public:
81 
82  explicit DbEngineGuiErrorHandler(const DbEngineParameters& parameters);
83  ~DbEngineGuiErrorHandler() override;
84 
85  bool checkDatabaseConnection();
86 
87 public Q_SLOTS:
88 
89  void connectionError(DbEngineErrorAnswer* answer, const QSqlError& error, const QString& query) override;
90  void consultUserForError(DbEngineErrorAnswer* answer, const QSqlError& error, const QString& query) override;
91 
92 private Q_SLOTS:
93 
94  void showProgressDialog();
95 
96 private:
97 
98  // Disabled
99  DbEngineGuiErrorHandler(QObject*) = delete;
100 
101  class Private;
102  Private* const d;
103 };
104 
105 } // namespace Digikam
106 
107 #endif // DIGIKAM_DB_ENGINE_GUI_ERROR_HANDLER_H
Definition: dbengineguierrorhandler.h:42
Definition: dbengineerrorhandler.h:42
Definition: dbengineerrorhandler.h:60
Definition: dbengineguierrorhandler.h:77
Definition: dbengineparameters.h:49
Definition: datefolderview.cpp:43