# HG changeset patch # User mandel # Date 1242762460 0 # Node ID 3b98e3fecd9bb995f8d3d7c69c0db015120d0928 # Parent a62227112f5bb1f7792d744cd1109ac1974c3f1c more porting diff -r a62227112f5b -r 3b98e3fecd9b demos/browser/history.d --- a/demos/browser/history.d Tue May 19 17:58:33 2009 +0000 +++ b/demos/browser/history.d Tue May 19 19:47:40 2009 +0000 @@ -282,6 +282,7 @@ } } } + if (first == m_history.count() - 1) saveAll = true; @@ -482,7 +483,6 @@ { super(parent); m_history = history; - assert(m_history); m_history.historyReset.connect(&this.historyReset); @@ -573,8 +573,10 @@ HistoryManager m_history; } + const uint MOVEDROWS = 15; + /*! Proxy model that will remove any duplicate entries. Both m_sourceRow and m_historyHash store their offsets not from @@ -931,17 +933,16 @@ { super(parent); m_history = 0; - connect(this, SIGNAL(activated(QModelIndex )), - this, SLOT(activated(QModelIndex ))); + activated.connect(&this.activated); setHoverRole(HistoryModel.UrlStringRole); } -void setInitialActions(QList actions) -{ - m_initialActions = actions; - for (int i = 0; i < m_initialActions.count(); ++i) - addAction(m_initialActions.at(i)); -} + void setInitialActions(QList actions) + { + m_initialActions = actions; + for (int i = 0; i < m_initialActions.count(); ++i) + addAction(m_initialActions.at(i)); + } protected: @@ -997,6 +998,7 @@ QList m_initialActions; } + // proxy model for the history model that // exposes each url http://www.foo.com and it url starting at the host www.foo.com class HistoryCompletionModel : public QAbstractProxyModel @@ -1138,7 +1140,6 @@ return sourceModel().columnCount(mapToSource(parent)); } - int rowCount(QModelIndex parent = QModelIndex()) { if ( parent.internalId() != 0 || parent.column() > 0 || !sourceModel()) @@ -1177,12 +1178,12 @@ return QModelIndex(); if (m_sourceRowCache.isEmpty()) - rowCount(QModelIndex()); + rowCount(QModelIndex()); QList.iterator it; it = qLowerBound(m_sourceRowCache.begin(), m_sourceRowCache.end(), sourceIndex.row()); if (*it != sourceIndex.row()) - --it; + --it; int dateRow = qMax(0, it - m_sourceRowCache.begin()); int row = sourceIndex.row() - m_sourceRowCache.at(dateRow); return createIndex(row, sourceIndex.column(), dateRow + 1);