accountsitemmodel.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef ACCOUNTSITEMMODEL_H
  2. #define ACCOUNTSITEMMODEL_H
  3. #include "listmodel.h"
  4. class AccountsItemModel : public ListItem
  5. {
  6. Q_OBJECT
  7. public:
  8. enum Roles {
  9. accJid = Qt::UserRole+1,
  10. accPasswd,
  11. accIcon,
  12. accDefault,
  13. accType,
  14. accResource,
  15. accHost,
  16. accPort,
  17. accManualHostPort
  18. };
  19. public:
  20. AccountsItemModel(QObject *parent = 0): ListItem(parent) {}
  21. explicit AccountsItemModel( const QString &_accountJid,
  22. const QString &_accountPasswd,
  23. const QString &_accountIcon,
  24. const QString &_accountType,
  25. const QString &_accountResource,
  26. const QString &_accountHost,
  27. const int _accountPort,
  28. const bool _accountDefault,
  29. const bool _manuallyHostPort,
  30. QObject *parent = 0 );
  31. virtual QVariant data(int role) const;
  32. virtual QHash<int, QByteArray> roleNames() const;
  33. virtual QString id() const { return m_jid; }
  34. void setJid( QString &_accountJid );
  35. void setPasswd( QString &_accountPasswd );
  36. void setIcon( QString &_accountIcon );
  37. void setDefault( bool &_accountDefault );
  38. void setType( QString &_accountType );
  39. void setResource( QString &_accountResource );
  40. void setHost( QString &_accountHost );
  41. void setPort( int _accountPort );
  42. void setManuallyHostPort( bool _manuallyHostPort );
  43. inline QString jid() const { return m_jid; }
  44. inline QString passwd() const { return m_passwd; }
  45. inline QString icon() const { return m_icon; }
  46. inline bool isDefault() const { return m_default; }
  47. inline QString type() const { return m_type; }
  48. inline QString resource() const { return m_resource; }
  49. inline QString host() const { return m_host; }
  50. inline int port() const { return m_port; }
  51. inline bool isManuallyHostPort() const { return m_manual_host_port; }
  52. private:
  53. QString m_jid;
  54. QString m_passwd;
  55. QString m_icon;
  56. QString m_type;
  57. QString m_resource;
  58. QString m_host;
  59. int m_port;
  60. bool m_default;
  61. bool m_manual_host_port;
  62. };
  63. #endif // ACCOUNTSITEMMODEL_H