Commit 50f61885 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement historyswitchfolder

parent 510deb42
Pipeline #88530 passed with stage
in 30 minutes and 26 seconds
......@@ -22,7 +22,7 @@ HistorySwitchFolderManager::~HistorySwitchFolderManager()
void HistorySwitchFolderManager::addHistory(const Akonadi::Collection &currentCol, const Akonadi::Collection &col)
{
if (currentCol.isValid() && col.isValid()) {
if (col.isValid()) {
mUndoStack->push(new HistorySwitchFolderCommand(this, currentCol, col));
}
}
......@@ -34,20 +34,26 @@ void HistorySwitchFolderManager::clear()
void HistorySwitchFolderManager::changeCollection(const Akonadi::Collection &currentCol)
{
qDebug() << "HistorySwitchFolderManager::changeCollection " << currentCol;
Q_EMIT switchToFolder(currentCol);
if (currentCol.isValid()) {
qDebug() << "HistorySwitchFolderManager::changeCollection " << currentCol;
Q_EMIT switchToFolder(currentCol);
}
}
void HistorySwitchFolderManager::undo()
{
qDebug() << " void HistorySwitchFolderManager::undo()";
mUndoStack->undo();
if (mUndoStack->canUndo()) {
mUndoStack->undo();
}
}
void HistorySwitchFolderManager::redo()
{
qDebug() << " void HistorySwitchFolderManager::redo()";
mUndoStack->redo();
if (mUndoStack->canRedo()) {
mUndoStack->redo();
}
}
HistorySwitchFolderCommand::HistorySwitchFolderCommand(HistorySwitchFolderManager *manager,
......
......@@ -335,7 +335,7 @@ KMMainWidget::KMMainWidget(QWidget *parent, KXMLGUIClient *aGUIClient, KActionCo
connect(&mCheckMailTimer, &QTimer::timeout, this, &KMMainWidget::slotUpdateActionsAfterMailChecking);
setupUnifiedMailboxChecker();
connect(mHistorySwitchFolderManager, &HistorySwitchFolderManager::switchToFolder, this, &KMMainWidget::slotSelectCollectionFolder);
connect(mHistorySwitchFolderManager, &HistorySwitchFolderManager::switchToFolder, this, &KMMainWidget::slotHistorySwitchFolder);
}
QWidget *KMMainWidget::dkimWidgetInfo() const
......@@ -480,8 +480,15 @@ void KMMainWidget::slotFolderChanged(const Akonadi::Collection &collection)
if (mCurrentCollection == collection) {
return;
}
mHistorySwitchFolderManager->addHistory(mCurrentCollection, collection);
}
void KMMainWidget::slotHistorySwitchFolder(const Akonadi::Collection &collection)
{
if (mFolderTreeWidget) {
mFolderTreeWidget->selectCollectionFolder(collection);
}
// Store previous collection
// FIXME mHistorySwitchFolderManager->addHistory(mCurrentCollection, collection);
if (mGoToFirstUnreadMessageInSelectedFolder) {
// the default action has been overridden from outside
mPreSelectionMode = MessageList::Core::PreSelectFirstUnreadCentered;
......
......@@ -529,6 +529,7 @@ private:
void slotRestartAccount();
void slotAccountSettings();
void updateDisplayFormatMessage();
void slotHistorySwitchFolder(const Akonadi::Collection &collection);
// Message actions
QAction *mDeleteAction = nullptr;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment