Sunday 3 July 2011

keyUserManager.h

#ifndef KEY_DATA_MANAGER_H
#define KEY_DATA_MANAGER_H
#include "alkuser.h"
#include <QDBusVariant>
#include <QObject>
#include <QString>
#include <QSqlQuery>
#include <QSqlError>

class KeyUserManager : public QObject
{
    Q_Object
public:
    KeyUserManager(QObject *parent);
    ~KeyUserManager();
  
    void registerDBus();
  
public slots:


  /**
    * This is a public DBus function for retrieving a User's info for the requested keys.
    *
    * @param[in] user The user to get data for.  May be we can define a seperate id
    * @param[in] keys The list of keys to return values for.
    * @return The values in the returned QStringList will always match the order of requested keys.
    */
  Q_SCRIPTABLE QDBusVariant getUserInfo(const QString& user);



signals:

protected:

  /**
    * db_insertUser gets called by db_updateUser() if a user doesn't yet exist in the database.
    *
    * @param[in] user The user to add to the database.
    * @return Whether or not the insert worked.
    */
  void insertUserInfo(const QString& user);

  /**
    * Call db_updateUser to write newly downloaded results to the database.
    *
    * @param user The user whose results these represent.
    * @param keys The keys which were requested to be downloaded. Their order is relative to results.
    * @param values The downloaded values for every key. Position is relative to the keys list.
    * @return Whether or not the update worked.
    */
  void updateUserData(const QString& user, const AlkUser& userInfo, const AlkQuoteItem& quoteItem);

 
private:

  StorageManager *m_storageManager;
  KeyPluginsManager *m_keyPluginsManager;
  QStringList m_usersBeingInitialized;

  // database stuff
  QString m_userInfoTable; // the name of the database table to use for storing info about the user
  QString m_userValueTable; // the name of the database table to use for storing value data

};

#endif

No comments:

Post a Comment