From 615538200d811c69f321d3f958bf9abbeb125b7e Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Tue, 11 Nov 2014 18:49:55 +0100 Subject: [PATCH] Fixed #103. --- .../view-switch-layout-direction.png | Bin 0 -> 1030 bytes resources/text/CHANGELOG | 2 +- src/gui/messagesview.cpp | 45 +++++++----------- src/network-web/webbrowser.h | 4 +- 4 files changed, 21 insertions(+), 30 deletions(-) create mode 100644 resources/graphics/icons/mini-kfaenza/view-switch-layout-direction.png diff --git a/resources/graphics/icons/mini-kfaenza/view-switch-layout-direction.png b/resources/graphics/icons/mini-kfaenza/view-switch-layout-direction.png new file mode 100644 index 0000000000000000000000000000000000000000..bef0b3b3706773787b7ac7ccf8b55a3f13d6ea24 GIT binary patch literal 1030 zcmV+h1o``kP)|fByX}3;syL9p*z=feA5c~smRLMNP3_Q}LLW)O9iRgX+Lh>EI;`jOP-91tg zRpmZowryZtdig&@!~#QLK=*=+fd%lNs=BmM(kUb&p8;Q3YhQ@Sp{jnl9iQch$lt2^ zhjZ=?Fjdt#_!02``H{8uTUCAOoCD}uay&D}JhRsJoO8d6$Xiu)=``5^9;@nM9LL)< zxso`JQPo4>F^T7Fp7()Az>_U`Yr+!}uYI@+zyc4p<){S@NIYi&h(GQNncuE0m5nhK z@4HUswYTc560AQ$aQ;|FS4%#CkQ{h;b93`k$OrH4?*0s1t*NUb^V-Wb)J-7)%xpFb z@d3pJqK&TZ9D(Lj2)|1MaB*=_=o^hj8`ss547`i$duR_!5wAF>$>MF>*imD7zw56_!%x{w^B!HPrCLumxsTysetMdXhAA!PpzPthL?d@$`S3&6r zG_FREj*bddK92#qF=SIU?E5qT?IOk?0%k16v#K1dX97WNAh>Ui2c5VlQ zL0?3q*Xto7VyzWp4Axq)){2ObZ}aD5=cfGt&N)@p^i`d6_*aeNxX{1Urco53s=8P# zZs+rPKZ>Gvz}S1vHZmdk`tobw8{jLF&8JITkr@9I_zU<)RW<)p0|ShJrzGYF+wob+ zf+UCuaG|QnL(=7++lWYyWNLM7O^ty_Rik|4dn5|@c6!S}Pyhe`07*qoM6N<$f}+vj A$^ZZW literal 0 HcmV?d00001 diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG index 849274ee4..e0fedcc4c 100644 --- a/resources/text/CHANGELOG +++ b/resources/text/CHANGELOG @@ -3,7 +3,7 @@ Fixed:
    -
  • Fixed bug #105.
  • +
  • Fixed bug #105, #103.
Added: diff --git a/src/gui/messagesview.cpp b/src/gui/messagesview.cpp index 0d1e8366a..42a465274 100755 --- a/src/gui/messagesview.cpp +++ b/src/gui/messagesview.cpp @@ -86,23 +86,19 @@ void MessagesView::reloadSelections(int mark_current_index_read) { sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); selected_indexes = m_proxyModel->mapListFromSource(mapped_indexes, true); - current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(), - mapped_current_index.column())); + current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(), mapped_current_index.column())); if (current_index.isValid()) { if (mark_current_index_read == 0) { // User selected to mark some messages as unread, if one // of them will be marked as current, then it will be read again. m_batchUnreadSwitch = true; - setCurrentIndex(current_index); - m_batchUnreadSwitch = false; - } - else { - setCurrentIndex(current_index); } + setCurrentIndex(current_index); scrollTo(current_index); reselectIndexes(selected_indexes); + m_batchUnreadSwitch = false; } else { // Messages were probably removed from the model, nothing can @@ -199,33 +195,32 @@ void MessagesView::mousePressEvent(QMouseEvent *event) { } } -void MessagesView::currentChanged(const QModelIndex ¤t, - const QModelIndex &previous) { - QModelIndex mapped_current_index = m_proxyModel->mapToSource(current); +void MessagesView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) { + QTreeView::currentChanged(current, previous); +} + +void MessagesView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { + QModelIndexList selected_rows = selectionModel()->selectedRows(); + QModelIndex current_index = currentIndex(); + QModelIndex mapped_current_index = m_proxyModel->mapToSource(current_index); qDebug("Current row changed - row [%d,%d] source [%d, %d].", - current.row(), current.column(), + current_index.row(), current_index.column(), mapped_current_index.row(), mapped_current_index.column()); - if (mapped_current_index.isValid()) { + if (mapped_current_index.isValid() && !selected_rows.isEmpty()) { if (!m_batchUnreadSwitch) { // Set this message as read only if current item // wasn't changed by "mark selected messages unread" action. m_sourceModel->setMessageRead(mapped_current_index.row(), 1); } - emit currentMessagesChanged(QList() << - m_sourceModel->messageAt(mapped_current_index.row())); + emit currentMessagesChanged(QList() << m_sourceModel->messageAt(m_proxyModel->mapToSource(selected_rows.first()).row())); } else { emit currentMessagesRemoved(); } - QTreeView::currentChanged(current, previous); -} - -void MessagesView::selectionChanged(const QItemSelection &selected, - const QItemSelection &deselected) { if (qApp->settings()->value(GROUP(Messages), "keep_cursor_center", false).toBool()) { scrollTo(currentIndex(), QAbstractItemView::PositionAtCenter); } @@ -321,22 +316,18 @@ void MessagesView::setSelectedMessagesReadStatus(int read) { sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); selected_indexes = m_proxyModel->mapListFromSource(mapped_indexes, true); - current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(), - mapped_current_index.column())); + current_index = m_proxyModel->mapFromSource(m_sourceModel->index(mapped_current_index.row(), mapped_current_index.column())); if (read == 0) { // User selected to mark some messages as unread, if one // of them will be marked as current, then it will be read again. m_batchUnreadSwitch = true; - setCurrentIndex(current_index); - m_batchUnreadSwitch = false; - } - else { - setCurrentIndex(current_index); } + setCurrentIndex(current_index); scrollTo(current_index); reselectIndexes(selected_indexes); + m_batchUnreadSwitch = false; } void MessagesView::deleteSelectedMessages() { @@ -424,8 +415,6 @@ void MessagesView::switchSelectedMessagesImportance() { } void MessagesView::reselectIndexes(const QModelIndexList &indexes) { - selectionModel()->clearSelection(); - QItemSelection selection; foreach (const QModelIndex &index, indexes) { diff --git a/src/network-web/webbrowser.h b/src/network-web/webbrowser.h index e048b2ce8..518769a0b 100755 --- a/src/network-web/webbrowser.h +++ b/src/network-web/webbrowser.h @@ -96,7 +96,9 @@ class WebBrowser : public TabContent { // Clears contents. inline void clear() { - m_webView->load(QUrl()); + if (m_webView->url() != QUrl()) { + m_webView->setHtml("", QUrl()); + } } // Zoom manipulators.