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
1a9b3917
Commit
1a9b3917
authored
Sep 15, 2020
by
Laurent Montel
😁
Browse files
Add tagmonitormanager.cpp
parent
e7ac6ce8
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
1a9b3917
...
...
@@ -155,6 +155,7 @@ set(kmailprivate_widgets_LIB_SRCS
set
(
kmailprivate_tag_LIB_SRCS
tag/tagactionmanager.cpp
tag/tagselectdialog.cpp
tag/tagmonitormanager.cpp
)
...
...
src/tag/tagactionmanager.cpp
View file @
1a9b3917
...
...
@@ -5,6 +5,7 @@
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "tagactionmanager.h"
#include "tagmonitormanager.h"
#include "messageactions.h"
...
...
@@ -37,16 +38,13 @@ TagActionManager::TagActionManager(QObject *parent, KActionCollection *actionCol
,
mActionCollection
(
actionCollection
)
,
mMessageActions
(
messageActions
)
,
mGUIClient
(
guiClient
)
,
mMonitor
(
new
Akonadi
::
Monitor
(
this
))
{
mMessageActions
->
messageStatusMenu
()
->
menu
()
->
addSeparator
();
mMonitor
->
setObjectName
(
QStringLiteral
(
"TagActionManagerMonitor"
));
mMonitor
->
setTypeMonitored
(
Akonadi
::
Monitor
::
Tags
);
mMonitor
->
tagFetchScope
().
fetchAttribute
<
Akonadi
::
TagAttribute
>
();
connect
(
mMonitor
,
&
Akonadi
::
Monitor
::
tagAdded
,
this
,
&
TagActionManager
::
onTagAdded
);
connect
(
mMonitor
,
&
Akonadi
::
Monitor
::
tagRemoved
,
this
,
&
TagActionManager
::
onTagRemoved
);
connect
(
mMonitor
,
&
Akonadi
::
Monitor
::
tagChanged
,
this
,
&
TagActionManager
::
onTagChanged
);
TagMonitorManager
*
tagMonitorManager
=
TagMonitorManager
::
self
();
connect
(
tagMonitorManager
,
&
TagMonitorManager
::
tagAdded
,
this
,
&
TagActionManager
::
onTagAdded
);
connect
(
tagMonitorManager
,
&
TagMonitorManager
::
tagRemoved
,
this
,
&
TagActionManager
::
onTagRemoved
);
connect
(
tagMonitorManager
,
&
TagMonitorManager
::
tagChanged
,
this
,
&
TagActionManager
::
onTagChanged
);
}
TagActionManager
::~
TagActionManager
()
...
...
src/tag/tagactionmanager.h
View file @
1a9b3917
...
...
@@ -137,7 +137,6 @@ private:
// Uri of a newly created tag
qint64
mNewTagId
=
-
1
;
bool
mTagFetchInProgress
=
false
;
Akonadi
::
Monitor
*
const
mMonitor
;
};
}
...
...
src/tag/tagmonitormanager.cpp
0 → 100644
View file @
1a9b3917
/*
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "tagmonitormanager.h"
#include <AkonadiCore/Monitor>
#include <AkonadiCore/TagFetchJob>
#include <AkonadiCore/TagFetchScope>
#include <AkonadiCore/TagAttribute>
TagMonitorManager
::
TagMonitorManager
(
QObject
*
parent
)
:
QObject
(
parent
)
,
mMonitor
(
new
Akonadi
::
Monitor
(
this
))
{
mMonitor
->
setObjectName
(
QStringLiteral
(
"TagActionManagerMonitor"
));
mMonitor
->
setTypeMonitored
(
Akonadi
::
Monitor
::
Tags
);
mMonitor
->
tagFetchScope
().
fetchAttribute
<
Akonadi
::
TagAttribute
>
();
connect
(
mMonitor
,
&
Akonadi
::
Monitor
::
tagAdded
,
this
,
&
TagMonitorManager
::
tagAdded
);
connect
(
mMonitor
,
&
Akonadi
::
Monitor
::
tagRemoved
,
this
,
&
TagMonitorManager
::
tagRemoved
);
connect
(
mMonitor
,
&
Akonadi
::
Monitor
::
tagChanged
,
this
,
&
TagMonitorManager
::
tagChanged
);
}
TagMonitorManager
::~
TagMonitorManager
()
{
}
TagMonitorManager
*
TagMonitorManager
::
self
()
{
static
TagMonitorManager
s_self
;
return
&
s_self
;
}
src/tag/tagmonitormanager.h
0 → 100644
View file @
1a9b3917
/*
SPDX-FileCopyrightText: 2020 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#ifndef TAGMONITORMANAGER_H
#define TAGMONITORMANAGER_H
#include <QObject>
#include <AkonadiCore/Tag>
namespace
Akonadi
{
class
Monitor
;
}
class
TagMonitorManager
:
public
QObject
{
Q_OBJECT
public:
explicit
TagMonitorManager
(
QObject
*
parent
=
nullptr
);
~
TagMonitorManager
();
static
TagMonitorManager
*
self
();
Q_SIGNALS:
void
tagAdded
(
const
Akonadi
::
Tag
&
tag
);
void
tagChanged
(
const
Akonadi
::
Tag
&
tag
);
void
tagRemoved
(
const
Akonadi
::
Tag
&
tag
);
private:
Akonadi
::
Monitor
*
const
mMonitor
;
};
#endif // TAGMONITORMANAGER_H
Write
Preview
Markdown
is supported
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