Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KDE PIM Runtime
Commits
3afd8162
Commit
3afd8162
authored
Jan 07, 2015
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finally util.* file is not useful. Not necessary to make it static
parent
3a609ac1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
91 deletions
+23
-91
agents/newmailnotifier/CMakeLists.txt
agents/newmailnotifier/CMakeLists.txt
+0
-1
agents/newmailnotifier/newmailnotifieragent.cpp
agents/newmailnotifier/newmailnotifieragent.cpp
+22
-4
agents/newmailnotifier/newmailnotifieragent.h
agents/newmailnotifier/newmailnotifieragent.h
+1
-0
agents/newmailnotifier/specialnotifierjob.cpp
agents/newmailnotifier/specialnotifierjob.cpp
+0
-1
agents/newmailnotifier/util.cpp
agents/newmailnotifier/util.cpp
+0
-52
agents/newmailnotifier/util.h
agents/newmailnotifier/util.h
+0
-33
No files found.
agents/newmailnotifier/CMakeLists.txt
View file @
3afd8162
...
...
@@ -16,7 +16,6 @@ set(newmailnotifieragent_SRCS
specialnotifierjob.cpp
newmailnotifierselectcollectionwidget.cpp
newmailnotifiershowmessagejob.cpp
util.cpp
)
kde4_add_kcfg_files
(
newmailnotifieragent_SRCS
...
...
agents/newmailnotifier/newmailnotifieragent.cpp
View file @
3afd8162
...
...
@@ -21,8 +21,6 @@
#include "newmailnotifieragent.h"
#include "util.h"
#include "newmailnotifierattribute.h"
#include "specialnotifierjob.h"
#include "newmailnotifieradaptor.h"
...
...
@@ -494,7 +492,12 @@ void NewMailNotifierAgent::slotShowNotifications()
void
NewMailNotifierAgent
::
slotDisplayNotification
(
const
QPixmap
&
pixmap
,
const
QString
&
message
)
{
Util
::
showNotification
(
pixmap
,
message
);
KNotification
::
event
(
QLatin1String
(
"new-email"
),
message
,
pixmap
,
0
,
KNotification
::
CloseOnTimeout
,
KGlobal
::
mainComponent
());
if
(
NewMailNotifierAgentSettings
::
beepOnNewMails
()
)
{
KNotification
::
beep
();
...
...
@@ -530,7 +533,7 @@ void NewMailNotifierAgent::slotInstanceStatusChanged(const Akonadi::AgentInstanc
}
case
Akonadi
::
AgentInstance
::
Running
:
{
if
(
!
Util
::
excludeAgentType
(
instance
))
{
if
(
!
excludeAgentType
(
instance
))
{
if
(
!
mInstanceNameInProgress
.
contains
(
identifier
))
{
mInstanceNameInProgress
.
append
(
identifier
);
}
...
...
@@ -543,6 +546,21 @@ void NewMailNotifierAgent::slotInstanceStatusChanged(const Akonadi::AgentInstanc
}
}
bool
NewMailNotifierAgent
::
excludeAgentType
(
const
Akonadi
::
AgentInstance
&
instance
)
{
if
(
instance
.
type
().
mimeTypes
().
contains
(
KMime
::
Message
::
mimeType
()
)
)
{
const
QStringList
capabilities
(
instance
.
type
().
capabilities
()
);
if
(
capabilities
.
contains
(
QLatin1String
(
"Resource"
)
)
&&
!
capabilities
.
contains
(
QLatin1String
(
"Virtual"
)
)
&&
!
capabilities
.
contains
(
QLatin1String
(
"MailTransport"
)
)
)
{
return
false
;
}
else
{
return
true
;
}
}
return
true
;
}
void
NewMailNotifierAgent
::
slotInstanceRemoved
(
const
Akonadi
::
AgentInstance
&
instance
)
{
if
(
!
isActive
())
...
...
agents/newmailnotifier/newmailnotifieragent.h
View file @
3afd8162
...
...
@@ -98,6 +98,7 @@ private slots:
void
slotInstanceNameChanged
(
const
Akonadi
::
AgentInstance
&
instance
);
private:
bool
excludeAgentType
(
const
Akonadi
::
AgentInstance
&
instance
);
bool
ignoreStatusMail
(
const
Akonadi
::
Item
&
item
);
bool
isActive
()
const
;
void
clearAll
();
...
...
agents/newmailnotifier/specialnotifierjob.cpp
View file @
3afd8162
...
...
@@ -17,7 +17,6 @@
#include "newmailnotifiershowmessagejob.h"
#include "specialnotifierjob.h"
#include "util.h"
#include "newmailnotifieragentsettings.h"
#include <Akonadi/Contact/ContactSearchJob>
...
...
agents/newmailnotifier/util.cpp
deleted
100644 → 0
View file @
3a609ac1
/*
Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "util.h"
#include <KNotification>
#include <KLocalizedString>
#include <KGlobal>
#include <Akonadi/AgentInstance>
#include <Akonadi/AgentType>
#include <KMime/Message>
void
Util
::
showNotification
(
const
QPixmap
&
pixmap
,
const
QString
&
message
)
{
KNotification
::
event
(
QLatin1String
(
"new-email"
),
message
,
pixmap
,
0
,
KNotification
::
CloseOnTimeout
,
KGlobal
::
mainComponent
());
}
bool
Util
::
excludeAgentType
(
const
Akonadi
::
AgentInstance
&
instance
)
{
if
(
instance
.
type
().
mimeTypes
().
contains
(
KMime
::
Message
::
mimeType
()
)
)
{
const
QStringList
capabilities
(
instance
.
type
().
capabilities
()
);
if
(
capabilities
.
contains
(
QLatin1String
(
"Resource"
)
)
&&
!
capabilities
.
contains
(
QLatin1String
(
"Virtual"
)
)
&&
!
capabilities
.
contains
(
QLatin1String
(
"MailTransport"
)
)
)
{
return
false
;
}
else
{
return
true
;
}
}
return
true
;
}
agents/newmailnotifier/util.h
deleted
100644 → 0
View file @
3a609ac1
/*
Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef UTIL_H
#define UTIL_H
#include <QPixmap>
#include <QString>
namespace
Akonadi
{
class
AgentInstance
;
}
namespace
Util
{
void
showNotification
(
const
QPixmap
&
pixmap
,
const
QString
&
message
);
bool
excludeAgentType
(
const
Akonadi
::
AgentInstance
&
instance
);
}
#endif // UTIL_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