I have made the following changes intended for : CE:MW:Shared / libcommhistory
Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below. https://build.pub.meego.com//request/show/7069 Thank You, tswindell [This message was auto-generated] --- Request # 7069: Messages from BOSS: State: review at 2012-10-17T17:07:45 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:tswindell:CE:Apps / libcommhistory -> CE:MW:Shared / libcommhistory changes files: -------------- --- libcommhistory.changes +++ libcommhistory.changes @@ -0,0 +1,3 @@ +* Wed Oct 17 2012 Tom Swindell <[email protected]> - 1.4.2 +- Added support for call event model + old: ---- libcommhistory-1.4.1.tar.bz2 new: ---- libcommhistory-1.4.2.tar.gz spec files: ----------- --- libcommhistory.spec +++ libcommhistory.spec @@ -1,11 +1,11 @@ Name: libcommhistory Summary: Communications event history database API -Version: 1.4.1 +Version: 1.4.2 Release: 1 Group: System/Libraries License: LGPL URL: https://github.com/nemomobile/libcommhistory -Source0: %{name}-%{version}.tar.bz2 +Source0: %{name}-%{version}.tar.gz Patch0: libcommhistory-1.3.12.6-fix-shared-static-lib-build-order.patch Patch1: libcommhistory-1.4.0-build-against-tracker-0-14.patch BuildRequires: libqtcontacts-tracker-extensions-devel @@ -59,7 +59,7 @@ %prep -%setup -q -n %{name} +%setup -q -n %{name}-%{version} %patch0 -p1 %patch1 -p1 other changes: -------------- ++++++ libcommhistory-1.4.1.tar.bz2 -> libcommhistory-1.4.2.tar.gz --- declarative/declarative.pro +++ declarative/declarative.pro @@ -9,9 +9,11 @@ ../src/libcommhistory.so INCLUDEPATH += ../src -SOURCES += src/plugin.cpp +SOURCES += src/plugin.cpp \ + src/callproxymodel.cpp -HEADERS += src/constants.h +HEADERS += src/constants.h \ + src/callproxymodel.h # do not edit below here, move this to a shared .pri? TEMPLATE = lib --- declarative/src/callproxymodel.cpp +++ declarative/src/callproxymodel.cpp @@ -0,0 +1,30 @@ +#include "callproxymodel.h" + +CallProxyModel::CallProxyModel(QObject *parent) : + QSortFilterProxyModel(parent), + m_source(new CommHistory::CallModel(CommHistory::CallModel::SortByTime, this)) +{ + m_source->setQueryMode(CommHistory::EventModel::AsyncQuery); + + this->setSourceModel(m_source); + this->setDynamicSortFilter(true); + + this->setRoleNames(m_source->roleNames()); + + if(!m_source->getEvents()) + { + qWarning() << "getEvents() failed on CommHistory::CallModel"; + return; + } +} + +void CallProxyModel::setSortRole(int role) +{ + QSortFilterProxyModel::setSortRole(role); +} + +void CallProxyModel::setFilterRole(int role) +{ + QSortFilterProxyModel::setFilterKeyColumn(role - CommHistory::EventModel::BaseRole); + QSortFilterProxyModel::setFilterRole(role); +} --- declarative/src/callproxymodel.h +++ declarative/src/callproxymodel.h @@ -0,0 +1,120 @@ +/* Copyright (C) 2012 Tom Swindell <[email protected]> + * + * You may use this file under the terms of the BSD license as follows: + * + * "Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Nemo Mobile nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + */ +#ifndef CALLPROXYMODEL_H +#define CALLPROXYMODEL_H + +#include <QSortFilterProxyModel> + +#include "callmodel.h" + +class CallProxyModel : public QSortFilterProxyModel +{ + Q_OBJECT + + Q_ENUMS(EventRole) + Q_ENUMS(EventType) + Q_ENUMS(EventDirection) + Q_ENUMS(EventStatus) + Q_ENUMS(EventReadStatus) + +public: + enum EventRole { + EventIdRole = CommHistory::EventModel::BaseRole, + EventTypeRole, + StartTimeRole, + EndTimeRole, + DirectionRole, + IsDraftRole, + IsReadRole, + IsMissedCallRole, + StatusRole, + BytesReceivedRole, + LocalUidRole, + RemoteUidRole, + ContactsRole, + FreeTextRole, + GroupIdRole, + MessageTokenRole, + LastModifiedRole, + EventCountRole, + FromVCardFileNameRole, + FromVCardLabelRole, + EncodingRole, + CharsetRole, + LanguageRole, + IsDeletedRole + }; + + enum EventType { + UnknownType = 0, + IMEvent, + SMSEvent, + CallEvent, + VoicemailEvent, + StatusMessageEvent, + MMSEvent, + ClassZeroSMSEvent + }; + + enum EventDirection { + UnknownDirection = 0, + Inbound, + Outbound + }; + + enum EventStatus { + UnknownStatus = 0, + SendingStatus, + SentStatus, + DeliveredStatus, + FailedStatus, + TemporarilyFailedStatus = FailedStatus, + PermanentlyFailedStatus, + TemporarilyFailedOfflineStatus + }; + + enum EventReadStatus { + UnknownReadStatus = 0, + ReadStatusRead, + ReadStatusDeleted + }; + + explicit CallProxyModel(QObject *parent = 0); + +public Q_SLOTS: + void getEvents(); + void setSortRole(int role); + void setFilterRole(int role); + +private: + CommHistory::CallModel *m_source; +}; + +#endif // CALLPROXYMODEL_H --- declarative/src/plugin.cpp +++ declarative/src/plugin.cpp @@ -35,6 +35,7 @@ #include "constants.h" #include "eventmodel.h" #include "groupmodel.h" +#include "callproxymodel.h" #include "conversationmodel.h" class Q_DECL_EXPORT CommHistoryPlugin : public QDeclarativeExtensionPlugin @@ -56,6 +57,7 @@ qmlRegisterUncreatableType<CommHistoryConstants>(uri, 1, 0, "CommHistory", "Constants-only type"); qmlRegisterType<CommHistory::EventModel>(uri, 1, 0, "CommEventModel"); qmlRegisterType<CommHistory::GroupModel>(uri, 1, 0, "CommGroupModel"); + qmlRegisterType<CallProxyModel>(uri, 1, 0, "CommCallModel"); qmlRegisterType<CommHistory::ConversationModel>(uri, 1, 0, "CommConversationModel"); } };
