56 |
56 |
57 // ----------------------------------------------------------------------------- |
57 // ----------------------------------------------------------------------------- |
58 // |
58 // |
59 // ----------------------------------------------------------------------------- |
59 // ----------------------------------------------------------------------------- |
60 // |
60 // |
|
61 LogsContact* LogsAbstractModel::createContact(const QString& number) |
|
62 { |
|
63 LogsContact* contact = new LogsContact(number, *mDbConnector); |
|
64 connect( contact, SIGNAL(saveCompleted(bool)), this, SLOT(contactSavingCompleted(bool)) ); |
|
65 return contact; |
|
66 } |
|
67 |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 int LogsAbstractModel::predictiveSearchStatus() |
|
73 { |
|
74 if ( !mDbConnector ){ |
|
75 return -1; |
|
76 } |
|
77 return mDbConnector->predictiveSearchStatus(); |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 // ----------------------------------------------------------------------------- |
|
83 // |
|
84 int LogsAbstractModel::setPredictiveSearch(bool enabled) |
|
85 { |
|
86 return doSetPredictiveSearch(enabled); |
|
87 } |
|
88 |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 bool LogsAbstractModel::isCommunicationPossible(const LogsEvent& event) const |
|
95 { |
|
96 return ( !event.isRemotePartyPrivate() && !event.isRemotePartyUnknown() ); |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void LogsAbstractModel::contactSavingCompleted(bool modified) |
|
104 { |
|
105 Q_UNUSED(modified); |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
61 QVariant LogsAbstractModel::doGetData(int role, const LogsModelItemContainer& item) const |
112 QVariant LogsAbstractModel::doGetData(int role, const LogsModelItemContainer& item) const |
62 { |
113 { |
63 if ( role == RoleFullEvent ) { |
114 if ( role == RoleFullEvent ) { |
64 QVariant var = qVariantFromValue(item.event()); |
115 QVariant var = qVariantFromValue(item.event()); |
65 return var; |
116 return var; |
124 if ( !event ){ |
175 if ( !event ){ |
125 return QVariant(); |
176 return QVariant(); |
126 } |
177 } |
127 Q_ASSERT(mDbConnector); |
178 Q_ASSERT(mDbConnector); |
128 LogsContact* logsContact = new LogsContact(*event, *mDbConnector); |
179 LogsContact* logsContact = new LogsContact(*event, *mDbConnector); |
129 if ( !logsContact->isContactRequestAllowed() ) { |
180 if ( !logsContact->isContactRequestAllowed() || !isCommunicationPossible(*event) ) { |
130 delete logsContact; |
181 delete logsContact; |
131 logsContact = 0; |
182 logsContact = 0; |
132 } |
183 } |
133 QVariant var = qVariantFromValue(logsContact); |
184 QVariant var = qVariantFromValue(logsContact); |
134 return var; |
185 return var; |
|
186 } |
|
187 |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 // ----------------------------------------------------------------------------- |
|
191 // |
|
192 int LogsAbstractModel::doSetPredictiveSearch(bool enabled){ |
|
193 if ( !mDbConnector ){ |
|
194 return -1; |
|
195 } |
|
196 return mDbConnector->setPredictiveSearch(enabled); |
135 } |
197 } |
136 |
198 |
137 // ----------------------------------------------------------------------------- |
199 // ----------------------------------------------------------------------------- |
138 // |
200 // |
139 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |