LibEngsas
esqllogin.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2013 - 2015 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  MA 02110-1301 USA.
18 */
19 
20 #ifndef ESQLLOGIN_H
21 #define ESQLLOGIN_H
22 
23 #include "eobject.h"
24 #include "eglobal.h"
25 
26 class ESqlLoginDialog;
27 
28 // only as long, ESqlLogin::exec() is in use, to allow
29 // old code to compare exec() result against enum from QDialog
30 #include <QDialog>
31 
32 namespace KWallet {
33  class Wallet;
34 }
35 
65 {
66  Q_OBJECT
67  Q_ENUMS(Result)
68  public:
69  enum Result { Failed, LoggedIn, Canceled };
70 
71  Q_DECL_DEPRECATED ESqlLogin(QObject *parent = NULL);
72  ESqlLogin(bool enableGui, QObject *parent = NULL);
73  ESqlLogin (QString title, QString newConnName, bool enableGui = true, QObject *parent = NULL);
74 
75  QStringList data();
76  void reloadSettings();
80  bool loadAndCheckSettings(QString username = QString(),
81  QString host = QString(),
82  QString database = QString(),
83  QString driver = QString(),
84  QString password = QString());
88  static bool checkDBSettings();
92  Q_DECL_DEPRECATED static bool checkSettings() { return checkDBSettings(); }
93 
94  public slots:
101  ESqlLogin::Result login();
106  Q_DECL_DEPRECATED int exec();
107 
108  private slots:
109  void showSettingsDialog();
110 
111  private:
112  void init(bool enableGui, QString connectionName = QString());
113  ESqlLogin::Result doLogin();
114  ESqlLoginDialog *createDialog() const;
115  bool checkDBSettingsPrivate();
116 
117  QString host, driver, database;
118  QString connName, username, password;
119  QString dialogTitle;
120  bool gui, withoutDatabase, useSSL;
121  QPointer<KWallet::Wallet> wallet;
122 };
123 
124 #endif // ESQLLOGIN_H
Mostly the same as EWidget but for QObject as base class.
Definition: eobject.h:42
bool withoutDatabase
Definition: esqllogin.h:120
QString host
Definition: esqllogin.h:117
virtual void reloadSettings()
Used to reload the settings.
Definition: eobject.h:81
#define E_CORE_EXPORT
Definition: eglobal.h:107
QPointer< KWallet::Wallet > wallet
Definition: esqllogin.h:121
QString dialogTitle
Definition: esqllogin.h:119
QString username
Definition: esqllogin.h:118
Class to login into a database.If GUI is not disabled, it requests the login data with help of ESqlLo...
Definition: esqllogin.h:64
static Q_DECL_DEPRECATED bool checkSettings()
Marked for removel, use checkDBSettings() instead, which does exactly the same.
Definition: esqllogin.h:92
Result
Definition: esqllogin.h:69
Displays a login dialog for a database.
Definition: esqllogindialog.h:39