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/7779

Thank You,
John Brooks

[This message was auto-generated]

---

Request # 7779:

Messages from BOSS:

State: review at 2013-01-31T05:16:35 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:special:branches:CE:MW:Shared / libcommhistory -> CE:MW:Shared / 
libcommhistory
  
changes files:
--------------
--- libcommhistory.changes
+++ libcommhistory.changes
@@ -0,0 +1,4 @@
+* Wed Jan 30 2013 John Brooks <[email protected]> - 1.4.7
+- [declarative] Update GroupObject data on rowsMoved/layoutChanged
+- [declarative] Add weekdaySection role to GroupModel
+

old:
----
  libcommhistory-1.4.6.tar.gz

new:
----
  libcommhistory-1.4.7.tar.bz2

spec files:
-----------
--- libcommhistory.spec
+++ libcommhistory.spec
@@ -1,11 +1,11 @@
 Name:       libcommhistory
 Summary:    Communications event history database API
-Version:    1.4.6
+Version:    1.4.7
 Release:    1
 Group:      System/Libraries
 License:    LGPL
 URL:        https://github.com/nemomobile/libcommhistory
-Source0:    %{name}-%{version}.tar.gz
+Source0:    %{name}-%{version}.tar.bz2
 Patch0:     libcommhistory-1.3.12.6-fix-shared-static-lib-build-order.patch
 BuildRequires:  libqtcontacts-tracker-extensions-devel
 BuildRequires:  pkgconfig(QtCore) >= 4.7.0
@@ -58,7 +58,7 @@
 
 
 %prep
-%setup -q -n %{name}-%{version}
+%setup -q -n %{name}
 
 %patch0 -p1
 

other changes:
--------------

++++++ libcommhistory-1.4.6.tar.gz -> libcommhistory-1.4.7.tar.bz2
--- declarative/src/groupproxymodel.cpp
+++ declarative/src/groupproxymodel.cpp
@@ -59,12 +59,41 @@
 
     connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
             SLOT(sourceDataChanged(QModelIndex,QModelIndex)));
+    connect(model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+            SLOT(sourceRowsMoved()));
+    connect(model, SIGNAL(layoutChanged()), SLOT(sourceRowsMoved()));
     connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
             SLOT(sourceRowsRemoved(QModelIndex,int,int)));
 
+    QHash<int,QByteArray> roles = model->roleNames();
+    roles[WeekdaySectionRole] = "weekdaySection";
+    setRoleNames(roles);
+
     emit sourceModelChanged();
 }
 
+QVariant GroupProxyModel::data(const QModelIndex &idx, int role) const
+{
+    if (!idx.isValid())
+        return QVariant();
+
+    if (role == WeekdaySectionRole) {
+        Group g = model->group(mapToSource(idx));
+        QDateTime dateTime = g.endTime();
+
+        // Return the date for the past week, and group all older items 
together under an
+        // arbitrary older date
+        const int daysDiff = QDate::currentDate().toJulianDay() - 
dateTime.date().toJulianDay();
+        if (daysDiff < 7)
+            return dateTime.date();
+
+        // Arbitrary static date for older items..
+        return QDate(2000, 1, 1);
+    }
+
+    return QIdentityProxyModel::data(idx, role);
+}
+
 GroupObject *GroupProxyModel::group(int row)
 {
     if (!model) {
@@ -124,6 +153,11 @@
     }
 }
 
+void GroupProxyModel::sourceRowsMoved()
+{
+    sourceDataChanged(model->index(0, 0), model->index(model->rowCount()-1, 
model->columnCount()-1));
+}
+
 void GroupProxyModel::sourceRowsRemoved(const QModelIndex &parent, int start, 
int end)
 {
     Q_UNUSED(parent);
--- declarative/src/groupproxymodel.h
+++ declarative/src/groupproxymodel.h
@@ -45,6 +45,10 @@
     Q_OBJECT
 
 public:
+    enum {
+        WeekdaySectionRole = Qt::UserRole + 2000
+    };
+
     GroupProxyModel(QObject *parent = 0);
 
     Q_PROPERTY(QObject* sourceModel READ sourceModel WRITE setSourceModel 
NOTIFY sourceModelChanged)
@@ -59,12 +63,15 @@
     Q_INVOKABLE GroupObject *group(int row);
     Q_INVOKABLE GroupObject *groupById(int id);
 
+    virtual QVariant data(const QModelIndex &index, int role = 
Qt::DisplayRole) const;
+
 signals:
     void sourceModelChanged();
 
 private slots:
     void sourceDataChanged(const QModelIndex &topLeft, const QModelIndex 
&bottomRight);
     void sourceRowsRemoved(const QModelIndex &parent, int start, int end);
+    void sourceRowsMoved();
 
 private:
     CommHistory::GroupModel *model;



Reply via email to