Classified ads
trusttreemodel.h
Go to the documentation of this file.
1 /* -*-C++-*- -*-coding: utf-8-unix;-*-
2  Classified Ads is Copyright (c) Antti Jarvinen 2013.
3 
4  This file is part of Classified Ads.
5 
6  Classified Ads is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  Classified Ads is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with Classified Ads; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 
21 #ifndef CLASSIFIED_TRUSTTREEMODEL_H
22 #define CLASSIFIED_TRUSTTREEMODEL_H
23 #include "../mcontroller.h" // because enum from there is needed
24 #include "datamodelbase.h"
25 #include "../net/protocol.h" // for ProtocolItemType
26 
27 class Hash ;
29 class Profile ;
30 
55 class TrustTreeModel : public QObject {
56  Q_OBJECT
57 
58 public:
59  TrustTreeModel(MController *aMController,
60  const MModelProtocolInterface &aModel) ;
61  ~TrustTreeModel() ;
62 
77  void offerTrustList(const Hash& aTrustListOwnerProfile,
78  const QString& aOwnerProfileDisplayName,
79  const QList<Hash>& aList) ;
80 
95  bool isProfileTrusted(const Hash& aProfile,
96  QString *aDisplayNameOfTrustingProfile,
97  Hash* aFpOfTrustingProfile ) const ;
98 
105  void initModel(const QVariant& aPreviousSettings) ;
106 
110  QVariant trustTreeSettings() const ;
114  void clear(void) ;
115 public slots:
117  void contentReceived(const Hash& aHashOfContent,
118  const ProtocolItemType aTypeOfReceivdContent) ;
119 private: // methods
124  void recalculateTrust() ;
128  void setProfileTrustedInList(const Hash& aTrustedProfile,
129  const Hash& aTrustingProfile,
130  int aLevel) ;
131 signals:
133  const QString& aExplanation) ;
134 
135 private: // member variables:
141  typedef struct TrustTreeItemStruct {
143  QString iOperatorName ;
144  QList<Hash> iTrustList ;
145  signed char iLevel ;
146  bool iNeedsUpdate ;
147  } TrustTreeItem ;
148  QMap<Hash, TrustTreeItem>* iTrustTree ;
149  unsigned iLastUpdateTime ;
150 } ;
151 #endif
TrustTreeModel(MController *aMController, const MModelProtocolInterface &aModel)
MController & iController
Definition: trusttreemodel.h:136
unsigned iLastUpdateTime
Definition: trusttreemodel.h:149
Hash iTrustingOperator
Definition: trusttreemodel.h:142
Definition: trusttreemodel.h:141
signed char iLevel
Definition: trusttreemodel.h:145
bool isProfileTrusted(const Hash &aProfile, QString *aDisplayNameOfTrustingProfile, Hash *aFpOfTrustingProfile) const
struct TrustTreeModel::TrustTreeItemStruct TrustTreeItem
void initModel(const QVariant &aPreviousSettings)
Hash is class that carries 160-bit digest.
Definition: hash.h:38
CAErrorSituation
Definition: mcontroller.h:57
void contentReceived(const Hash &aHashOfContent, const ProtocolItemType aTypeOfReceivdContent)
ProtocolItemType
Definition: protocol.h:157
void offerTrustList(const Hash &aTrustListOwnerProfile, const QString &aOwnerProfileDisplayName, const QList< Hash > &aList)
QList< Hash > iTrustList
Definition: trusttreemodel.h:144
QString iOperatorName
Definition: trusttreemodel.h:143
Pure-virtual interface of datamodel for message parser to use.
Definition: mmodelprotocolinterface.h:46
QMap< Hash, TrustTreeItem > * iTrustTree
Definition: trusttreemodel.h:148
Pure-virtual interface class for controller. This is spammed across parties needing access to applica...
Definition: mcontroller.h:48
void clear(void)
const MModelProtocolInterface & iModel
Definition: trusttreemodel.h:137
void recalculateTrust()
void error(MController::CAErrorSituation aError, const QString &aExplanation)
bool iNeedsUpdate
Definition: trusttreemodel.h:146
QVariant trustTreeSettings() const
Carrier-class for user-profile data.
Definition: profile.h:37
This is is part of datamodel for trust tree related operation.
Definition: trusttreemodel.h:55
void setProfileTrustedInList(const Hash &aTrustedProfile, const Hash &aTrustingProfile, int aLevel)