Mercurial > projects > qtd
diff demos/browser/history.d @ 66:3b98e3fecd9b
more porting
author | mandel |
---|---|
date | Tue, 19 May 2009 19:47:40 +0000 |
parents | a62227112f5b |
children | b149ef2cb18b |
line wrap: on
line diff
--- 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<QAction> actions) -{ - m_initialActions = actions; - for (int i = 0; i < m_initialActions.count(); ++i) - addAction(m_initialActions.at(i)); -} + void setInitialActions(QList<QAction> actions) + { + m_initialActions = actions; + for (int i = 0; i < m_initialActions.count(); ++i) + addAction(m_initialActions.at(i)); + } protected: @@ -997,6 +998,7 @@ QList<QAction> 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<int>.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);