Changeset View
Changeset View
Standalone View
Standalone View
src/kmmainwidget.cpp
Show First 20 Lines • Show All 449 Lines • ▼ Show 20 Line(s) | |||||
450 | QString KMMainWidget::fullCollectionPath() const | 450 | QString KMMainWidget::fullCollectionPath() const | ||
451 | { | 451 | { | ||
452 | if (mCurrentCollection.isValid()) { | 452 | if (mCurrentCollection.isValid()) { | ||
453 | return MailCommon::Util::fullCollectionPath(mCurrentCollection); | 453 | return MailCommon::Util::fullCollectionPath(mCurrentCollection); | ||
454 | } | 454 | } | ||
455 | return {}; | 455 | return {}; | ||
456 | } | 456 | } | ||
457 | 457 | | |||
458 | // Connected to the currentChanged signals from the folderTreeView and favorites view. | ||||
458 | void KMMainWidget::slotFolderChanged(const Akonadi::Collection &collection) | 459 | void KMMainWidget::slotFolderChanged(const Akonadi::Collection &collection) | ||
459 | { | 460 | { | ||
461 | if (mCurrentCollection == collection) | ||||
462 | return; | ||||
460 | folderSelected(collection); | 463 | folderSelected(collection); | ||
461 | if (collection.cachePolicy().syncOnDemand()) { | 464 | if (collection.cachePolicy().syncOnDemand()) { | ||
462 | AgentManager::self()->synchronizeCollection(collection, false); | 465 | AgentManager::self()->synchronizeCollection(collection, false); | ||
463 | } | 466 | } | ||
464 | mMsgActions->setCurrentMessage(Akonadi::Item()); | 467 | mMsgActions->setCurrentMessage(Akonadi::Item()); | ||
465 | Q_EMIT captionChangeRequest(MailCommon::Util::fullCollectionPath(collection)); | 468 | Q_EMIT captionChangeRequest(MailCommon::Util::fullCollectionPath(collection)); | ||
466 | } | 469 | } | ||
467 | 470 | | |||
471 | // Called by slotFolderChanged (no particular reason for this method to be split out) | ||||
468 | void KMMainWidget::folderSelected(const Akonadi::Collection &col) | 472 | void KMMainWidget::folderSelected(const Akonadi::Collection &col) | ||
469 | { | 473 | { | ||
470 | // This is connected to the MainFolderView signal triggering when a folder is selected | | |||
471 | | ||||
472 | if (mGoToFirstUnreadMessageInSelectedFolder) { | 474 | if (mGoToFirstUnreadMessageInSelectedFolder) { | ||
473 | // the default action has been overridden from outside | 475 | // the default action has been overridden from outside | ||
474 | mPreSelectionMode = MessageList::Core::PreSelectFirstUnreadCentered; | 476 | mPreSelectionMode = MessageList::Core::PreSelectFirstUnreadCentered; | ||
475 | } else { | 477 | } else { | ||
476 | // use the default action | 478 | // use the default action | ||
477 | switch (KMailSettings::self()->actionEnterFolder()) { | 479 | switch (KMailSettings::self()->actionEnterFolder()) { | ||
478 | case KMailSettings::EnumActionEnterFolder::SelectFirstUnread: | 480 | case KMailSettings::EnumActionEnterFolder::SelectFirstUnread: | ||
479 | mPreSelectionMode = MessageList::Core::PreSelectFirstUnreadCentered; | 481 | mPreSelectionMode = MessageList::Core::PreSelectFirstUnreadCentered; | ||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 501 | #endif | |||
532 | // settings. At this point the selection model hasn't been updated yet to the user's new choice, so it would load | 534 | // settings. At this point the selection model hasn't been updated yet to the user's new choice, so it would load | ||
533 | // the old folder settings instead. | 535 | // the old folder settings instead. | ||
534 | QTimer::singleShot(0, this, &KMMainWidget::slotShowSelectedFolderInPane); | 536 | QTimer::singleShot(0, this, &KMMainWidget::slotShowSelectedFolderInPane); | ||
535 | } | 537 | } | ||
536 | 538 | | |||
537 | void KMMainWidget::slotShowSelectedFolderInPane() | 539 | void KMMainWidget::slotShowSelectedFolderInPane() | ||
538 | { | 540 | { | ||
539 | if (mCurrentCollection.isValid()) { | 541 | if (mCurrentCollection.isValid()) { | ||
540 | mMessagePane->setCurrentFolder(mCurrentCollection, false, mPreSelectionMode); | 542 | QModelIndex idx = Akonadi::EntityTreeModel::modelIndexForCollection(KMKernel::self()->entityTreeModel(), mCurrentCollection); | ||
543 | mMessagePane->setCurrentFolder(mCurrentCollection, idx, false, mPreSelectionMode); | ||||
541 | } | 544 | } | ||
542 | updateMessageActions(); | 545 | updateMessageActions(); | ||
543 | updateFolderMenu(); | 546 | updateFolderMenu(); | ||
544 | } | 547 | } | ||
545 | 548 | | |||
546 | void KMMainWidget::clearViewer() | 549 | void KMMainWidget::clearViewer() | ||
547 | { | 550 | { | ||
548 | if (mMsgView) { | 551 | if (mMsgView) { | ||
▲ Show 20 Lines • Show All 1593 Lines • ▼ Show 20 Line(s) | 2141 | if (dialog->exec() && dialog) { | |||
2142 | } | 2145 | } | ||
2143 | } | 2146 | } | ||
2144 | } | 2147 | } | ||
2145 | 2148 | | |||
2146 | void KMMainWidget::slotSelectCollectionFolder(const Akonadi::Collection &col) | 2149 | void KMMainWidget::slotSelectCollectionFolder(const Akonadi::Collection &col) | ||
2147 | { | 2150 | { | ||
2148 | if (mFolderTreeWidget) { | 2151 | if (mFolderTreeWidget) { | ||
2149 | mFolderTreeWidget->selectCollectionFolder(col); | 2152 | mFolderTreeWidget->selectCollectionFolder(col); | ||
2150 | slotFolderChanged(col); | 2153 | slotFolderChanged(col); // call it explicitly in case the collection is filtered out in the foldertreeview | ||
2151 | } | 2154 | } | ||
2152 | } | 2155 | } | ||
2153 | 2156 | | |||
2154 | void KMMainWidget::slotApplyFilters() | 2157 | void KMMainWidget::slotApplyFilters() | ||
2155 | { | 2158 | { | ||
2156 | const Akonadi::Item::List selectedMessages = mMessagePane->selectionAsMessageItemList(); | 2159 | const Akonadi::Item::List selectedMessages = mMessagePane->selectionAsMessageItemList(); | ||
2157 | if (selectedMessages.isEmpty()) { | 2160 | if (selectedMessages.isEmpty()) { | ||
2158 | return; | 2161 | return; | ||
▲ Show 20 Lines • Show All 2541 Lines • Show Last 20 Lines |