Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KMail
Commits
d05787b4
Commit
d05787b4
authored
Nov 15, 2021
by
Laurent Montel
😁
Browse files
Remove historyswitchfoldermanager
parent
399ee267
Pipeline
#97950
passed with stage
in 13 minutes and 57 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
d05787b4
...
...
@@ -173,7 +173,6 @@ target_sources(kmailprivate PRIVATE
manageshowcollectionproperties.cpp
kmmigrateapplication.cpp
kmail.qrc
historyswitchfolder/historyswitchfoldermanager.cpp
attributes/taskattribute.h
folderarchive/folderarchiveaccountinfo.h
...
...
@@ -304,7 +303,6 @@ target_sources(kmailprivate PRIVATE
kmlaunchexternalcomponent.h
manageshowcollectionproperties.h
kmmigrateapplication.h
historyswitchfolder/historyswitchfoldermanager.h
historyswitchfolder/collectionswitchertreeview.cpp
historyswitchfolder/collectionswitchertreeview.h
historyswitchfolder/collectionswitchertreeviewmanager.h
...
...
src/historyswitchfolder/collectionswitchermodel.cpp
View file @
d05787b4
...
...
@@ -43,6 +43,8 @@ QVariant CollectionSwitcherModel::data(const QModelIndex &index, int role) const
void
CollectionSwitcherModel
::
addHistory
(
const
Akonadi
::
Collection
&
currentCol
,
const
QString
&
fullPath
)
{
mCollectionsInfo
.
append
({
currentCol
,
fullPath
});
qDebug
()
<<
" void CollectionSwitcherModel::addHistory(const Akonadi::Collection ¤tCol, const QString &fullPath) "
<<
fullPath
;
qDebug
()
<<
" mCollectionsInfo "
<<
mCollectionsInfo
.
count
();
}
const
Akonadi
::
Collection
CollectionSwitcherModel
::
collection
(
int
index
)
...
...
src/historyswitchfolder/historyswitchfoldermanager.cpp
deleted
100644 → 0
View file @
399ee267
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include
"historyswitchfoldermanager.h"
#include
"kmail_debug.h"
HistorySwitchFolderManager
::
HistorySwitchFolderManager
(
QObject
*
parent
)
:
QObject
{
parent
}
,
mUndoStack
(
new
QUndoStack
(
this
))
{
// Not necessary to store to many info
mUndoStack
->
setUndoLimit
(
10
);
}
HistorySwitchFolderManager
::~
HistorySwitchFolderManager
()
{
}
void
HistorySwitchFolderManager
::
addHistory
(
const
Akonadi
::
Collection
&
currentCol
,
const
Akonadi
::
Collection
&
col
,
const
QString
&
fullPath
)
{
if
(
col
.
isValid
())
{
mUndoStack
->
push
(
new
HistorySwitchFolderCommand
(
this
,
currentCol
,
col
,
fullPath
));
}
}
void
HistorySwitchFolderManager
::
clear
()
{
mUndoStack
->
clear
();
}
void
HistorySwitchFolderManager
::
changeCollection
(
const
Akonadi
::
Collection
&
currentCol
)
{
if
(
currentCol
.
isValid
())
{
qCDebug
(
KMAIL_LOG
)
<<
"HistorySwitchFolderManager::changeCollection "
<<
currentCol
;
Q_EMIT
switchToFolder
(
currentCol
);
}
}
void
HistorySwitchFolderManager
::
undo
()
{
qCDebug
(
KMAIL_LOG
)
<<
" void HistorySwitchFolderManager::undo()"
<<
mUndoStack
->
canUndo
();
if
(
mUndoStack
->
canUndo
())
{
mUndoStack
->
undo
();
}
}
void
HistorySwitchFolderManager
::
redo
()
{
qCDebug
(
KMAIL_LOG
)
<<
" void HistorySwitchFolderManager::redo()"
<<
mUndoStack
->
canRedo
();
if
(
mUndoStack
->
canRedo
())
{
mUndoStack
->
redo
();
}
}
HistorySwitchFolderCommand
::
HistorySwitchFolderCommand
(
HistorySwitchFolderManager
*
manager
,
const
Akonadi
::
Collection
&
currentCol
,
const
Akonadi
::
Collection
&
col
,
const
QString
&
realPath
)
:
mCurrentCollection
(
currentCol
)
,
mNewCollection
(
col
)
,
mFullPath
(
realPath
)
,
mManager
(
manager
)
{
}
void
HistorySwitchFolderCommand
::
undo
()
{
mManager
->
changeCollection
(
mCurrentCollection
);
}
void
HistorySwitchFolderCommand
::
redo
()
{
mManager
->
changeCollection
(
mNewCollection
);
}
src/historyswitchfolder/historyswitchfoldermanager.h
deleted
100644 → 0
View file @
399ee267
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include
<Akonadi/Collection>
#include
<QObject>
#include
<QUndoStack>
class
QUndoStack
;
class
HistorySwitchFolderManager
:
public
QObject
{
Q_OBJECT
public:
explicit
HistorySwitchFolderManager
(
QObject
*
parent
=
nullptr
);
~
HistorySwitchFolderManager
()
override
;
// Add static method
void
clear
();
void
addHistory
(
const
Akonadi
::
Collection
&
currentCol
,
const
Akonadi
::
Collection
&
col
,
const
QString
&
fullPath
=
{});
void
changeCollection
(
const
Akonadi
::
Collection
&
currentCol
);
void
undo
();
void
redo
();
Q_SIGNALS:
void
switchToFolder
(
const
Akonadi
::
Collection
&
col
);
private:
QUndoStack
*
const
mUndoStack
;
};
class
HistorySwitchFolderCommand
:
public
QUndoCommand
{
public:
explicit
HistorySwitchFolderCommand
(
HistorySwitchFolderManager
*
manager
,
const
Akonadi
::
Collection
&
currentCol
,
const
Akonadi
::
Collection
&
col
,
const
QString
&
realPath
);
void
undo
()
override
;
void
redo
()
override
;
private:
const
Akonadi
::
Collection
mCurrentCollection
;
const
Akonadi
::
Collection
mNewCollection
;
QString
mFullPath
;
HistorySwitchFolderManager
*
const
mManager
;
};
src/kmmainwidget.cpp
View file @
d05787b4
...
...
@@ -134,7 +134,6 @@
#include
<PimCommon/LogActivitiesManager>
#include
"historyswitchfolder/historyswitchfoldermanager.h"
#include
"kmail_debug.h"
#include
<KAcceleratorManager>
...
...
@@ -202,7 +201,6 @@ KMMainWidget::KMMainWidget(QWidget *parent, KXMLGUIClient *aGUIClient, KActionCo
:
QWidget
(
parent
)
,
mLaunchExternalComponent
(
new
KMLaunchExternalComponent
(
this
,
this
))
,
mManageShowCollectionProperties
(
new
ManageShowCollectionProperties
(
this
,
this
))
,
mHistorySwitchFolderManager
(
new
HistorySwitchFolderManager
(
this
))
,
mCollectionSwitcherTreeViewManager
(
new
CollectionSwitcherTreeViewManager
(
this
))
{
// must be the first line of the constructor:
...
...
@@ -339,8 +337,8 @@ KMMainWidget::KMMainWidget(QWidget *parent, KXMLGUIClient *aGUIClient, KActionCo
connect
(
&
mCheckMailTimer
,
&
QTimer
::
timeout
,
this
,
&
KMMainWidget
::
slotUpdateActionsAfterMailChecking
);
setupUnifiedMailboxChecker
();
connect
(
mHistorySwitchFolderManager
,
&
HistorySwitchFolderManager
::
switchToFolder
,
this
,
&
KMMainWidget
::
slotHistorySwitchFolder
);
mCollectionSwitcherTreeViewManager
->
setParentWidget
(
this
);
connect
(
mCollectionSwitcherTreeViewManager
,
&
CollectionSwitcherTreeViewManager
::
switchToFolder
,
this
,
&
KMMainWidget
::
slotHistorySwitchFolder
);
}
QWidget
*
KMMainWidget
::
dkimWidgetInfo
()
const
...
...
@@ -487,8 +485,8 @@ void KMMainWidget::slotFolderChanged(const Akonadi::Collection &collection)
if
(
mCurrentCollection
==
collection
)
{
return
;
}
mHistorySwitchFolderManager
->
addHistory
(
mCurrentCollection
,
collection
,
MailCommon
::
Util
::
fullCollectionPath
(
collection
));
mCollectionSwitcherTreeViewManager
->
addHistory
(
collection
,
MailCommon
::
Util
::
fullCollectionPath
(
collection
));
slotHistorySwitchFolder
(
collection
);
}
void
KMMainWidget
::
slotHistorySwitchFolder
(
const
Akonadi
::
Collection
&
collection
)
...
...
@@ -3549,13 +3547,11 @@ void KMMainWidget::setupActions()
void
KMMainWidget
::
redoSwitchFolder
()
{
mHistorySwitchFolderManager
->
redo
();
mCollectionSwitcherTreeViewManager
->
selectBackward
();
}
void
KMMainWidget
::
undoSwitchFolder
()
{
mHistorySwitchFolderManager
->
undo
();
mCollectionSwitcherTreeViewManager
->
selectForward
();
}
...
...
src/kmmainwidget.h
View file @
d05787b4
...
...
@@ -91,7 +91,6 @@ class MailFilter;
}
class
QStatusBar
;
class
KMailPluginCheckBeforeDeletingManagerInterface
;
class
HistorySwitchFolderManager
;
class
CollectionSwitcherTreeViewManager
;
class
KMAIL_EXPORT
KMMainWidget
:
public
QWidget
{
...
...
@@ -656,7 +655,6 @@ private:
KUserFeedback
::
NotificationPopup
*
mUserFeedBackNotificationPopup
=
nullptr
;
#endif
KMailPluginCheckBeforeDeletingManagerInterface
*
mPluginCheckBeforeDeletingManagerInterface
=
nullptr
;
HistorySwitchFolderManager
*
const
mHistorySwitchFolderManager
;
CollectionSwitcherTreeViewManager
*
const
mCollectionSwitcherTreeViewManager
;
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment