refs #649, refs #656, move swift DB classes to own namespace/directory

This commit is contained in:
Klaus Basan
2016-05-24 00:01:00 +02:00
parent f7659e9021
commit 7767e53652
24 changed files with 1926 additions and 1881 deletions

View File

@@ -0,0 +1,70 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKCORE_DATABASE_CDATABASEUATHENTICATIONSERVICE_H
#define BLACKCORE_DATABASE_CDATABASEUATHENTICATIONSERVICE_H
#include "blackcore/blackcoreexport.h"
#include "blackcore/data/authenticateduser.h"
#include "blackmisc/datacache.h"
#include "blackmisc/statusmessagelist.h"
#include <QObject>
#include <QString>
class QNetworkReply;
namespace BlackMisc { namespace Network { class CAuthenticatedUser; } }
namespace BlackCore
{
namespace Db
{
//! Databse user used with swift DB. Features role and cookie handling.
class BLACKCORE_EXPORT CDatabaseAuthenticationService: public QObject
{
Q_OBJECT
public:
//! Constructor
CDatabaseAuthenticationService(QObject *parent = nullptr);
//! Shutdown
void gracefulShutdown();
public slots:
//! Try to login to authentication web service
BlackMisc::CStatusMessageList login(const QString &id, const QString &password);
//! Logoff
void logoff();
signals:
//! User authenticated
void userAuthenticationFinished(const BlackMisc::Network::CAuthenticatedUser &user, const BlackMisc::CStatusMessageList &loginStatus);
//! Logoff completed
void logoffFinished();
private slots:
//! Parse login answer
void ps_parseServerResponse(QNetworkReply *nwReplyPtr);
//! User object changed
void ps_userChanged();
private:
BlackMisc::CData<BlackCore::Data::AuthenticatedDbUser> m_swiftDbUser {this, &CDatabaseAuthenticationService::ps_userChanged};
bool m_shutdown = false;
};
} // ns
} // ns
#endif // guard