Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM MailCommon
Commits
83d036c2
Commit
83d036c2
authored
Jun 01, 2017
by
Laurent Montel
Browse files
Coding style
parent
57b30228
Changes
282
Hide whitespace changes
Inline
Side-by-side
src/collectionpage/attributeregistrar.cpp
View file @
83d036c2
...
...
@@ -22,9 +22,7 @@
#include
<AkonadiCore/attributefactory.h>
namespace
{
namespace
{
// Anonymous namespace; function is invisible outside this file.
bool
dummy
()
{
...
...
@@ -35,5 +33,4 @@ bool dummy()
// Called when this library is loaded.
const
bool
registered
=
dummy
();
}
// namespace
src/collectionpage/attributes/expirecollectionattribute.cpp
View file @
83d036c2
...
...
@@ -26,13 +26,13 @@
using
namespace
MailCommon
;
ExpireCollectionAttribute
::
ExpireCollectionAttribute
()
:
mExpireMessages
(
false
)
,
mUnreadExpireAge
(
28
)
,
mReadExpireAge
(
14
)
,
mUnreadExpireUnits
(
ExpireNever
)
,
mReadExpireUnits
(
ExpireNever
)
,
mExpireAction
(
ExpireDelete
)
,
mExpireToFolderId
(
-
1
)
:
mExpireMessages
(
false
)
,
mUnreadExpireAge
(
28
)
,
mReadExpireAge
(
14
)
,
mUnreadExpireUnits
(
ExpireNever
)
,
mReadExpireUnits
(
ExpireNever
)
,
mExpireAction
(
ExpireDelete
)
,
mExpireToFolderId
(
-
1
)
{
}
...
...
@@ -135,17 +135,16 @@ ExpireCollectionAttribute::ExpireUnits ExpireCollectionAttribute::readExpireUnit
bool
ExpireCollectionAttribute
::
operator
==
(
const
ExpireCollectionAttribute
&
other
)
const
{
return
(
mExpireMessages
==
other
.
isAutoExpire
())
&&
(
mUnreadExpireAge
==
other
.
unreadExpireAge
())
&&
(
mReadExpireAge
==
other
.
readExpireAge
())
&&
(
mUnreadExpireUnits
==
other
.
unreadExpireUnits
())
&&
(
mReadExpireUnits
==
other
.
readExpireUnits
())
&&
(
mExpireAction
==
other
.
expireAction
())
&&
(
mExpireToFolderId
==
other
.
expireToFolderId
());
return
(
mExpireMessages
==
other
.
isAutoExpire
())
&&
(
mUnreadExpireAge
==
other
.
unreadExpireAge
())
&&
(
mReadExpireAge
==
other
.
readExpireAge
())
&&
(
mUnreadExpireUnits
==
other
.
unreadExpireUnits
())
&&
(
mReadExpireUnits
==
other
.
readExpireUnits
())
&&
(
mExpireAction
==
other
.
expireAction
())
&&
(
mExpireToFolderId
==
other
.
expireToFolderId
());
}
int
ExpireCollectionAttribute
::
daysToExpire
(
int
number
,
ExpireCollectionAttribute
::
ExpireUnits
units
)
int
ExpireCollectionAttribute
::
daysToExpire
(
int
number
,
ExpireCollectionAttribute
::
ExpireUnits
units
)
{
switch
(
units
)
{
case
ExpireCollectionAttribute
::
ExpireDays
:
// Days
...
...
@@ -200,4 +199,3 @@ void ExpireCollectionAttribute::deserialize(const QByteArray &data)
s
>>
mUnreadExpireAge
;
s
>>
mExpireMessages
;
}
src/collectionpage/attributes/expirecollectionattribute.h
View file @
83d036c2
...
...
@@ -24,9 +24,7 @@
#include
<Attribute>
#include
<Collection>
namespace
MailCommon
{
namespace
MailCommon
{
class
MAILCOMMON_EXPORT
ExpireCollectionAttribute
:
public
Akonadi
::
Attribute
{
public:
...
...
@@ -135,12 +133,10 @@ private:
bool
mExpireMessages
;
// true if old messages are expired
int
mUnreadExpireAge
;
// Given in unreadExpireUnits
int
mReadExpireAge
;
// Given in readExpireUnits
ExpireCollectionAttribute
::
ExpireUnits
mUnreadExpireUnits
;
ExpireCollectionAttribute
::
ExpireUnits
mReadExpireUnits
;
ExpireCollectionAttribute
::
ExpireUnits
mUnreadExpireUnits
;
ExpireCollectionAttribute
::
ExpireUnits
mReadExpireUnits
;
ExpireCollectionAttribute
::
ExpireAction
mExpireAction
;
Akonadi
::
Collection
::
Id
mExpireToFolderId
;
};
}
#endif
/* EXPIRATIONCOLLECTIONATTRIBUTE_H */
src/collectionpage/autotests/expirecollectionattributetest.cpp
View file @
83d036c2
...
...
@@ -30,7 +30,6 @@ ExpireCollectionAttributeTest::ExpireCollectionAttributeTest(QObject *parent)
ExpireCollectionAttributeTest
::~
ExpireCollectionAttributeTest
()
{
}
void
ExpireCollectionAttributeTest
::
shouldHaveDefaultValue
()
...
...
@@ -55,11 +54,16 @@ void ExpireCollectionAttributeTest::shouldAssignValue_data()
QTest
::
addColumn
<
MailCommon
::
ExpireCollectionAttribute
::
ExpireAction
>
(
"expireaction"
);
QTest
::
addColumn
<
Akonadi
::
Collection
::
Id
>
(
"akonadiid"
);
QTest
::
newRow
(
"add autoexpire"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDelete
<<
qint64
(
5
);
QTest
::
newRow
(
"change action"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change age"
)
<<
true
<<
150
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units"
)
<<
true
<<
15
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units2"
)
<<
true
<<
150
<<
18
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMonths
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireWeeks
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
6
);
QTest
::
newRow
(
"add autoexpire"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDelete
<<
qint64
(
5
);
QTest
::
newRow
(
"change action"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change age"
)
<<
true
<<
150
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units"
)
<<
true
<<
15
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units2"
)
<<
true
<<
150
<<
18
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMonths
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireWeeks
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
6
);
}
void
ExpireCollectionAttributeTest
::
shouldAssignValue
()
...
...
@@ -87,7 +91,6 @@ void ExpireCollectionAttributeTest::shouldAssignValue()
QCOMPARE
(
attr
.
unreadExpireUnits
(),
unreadexpireunit
);
QCOMPARE
(
attr
.
readExpireUnits
(),
readexpireunit
);
QCOMPARE
(
attr
.
expireToFolderId
(),
akonadiid
);
}
void
ExpireCollectionAttributeTest
::
shouldCloneAttr_data
()
...
...
@@ -100,12 +103,16 @@ void ExpireCollectionAttributeTest::shouldCloneAttr_data()
QTest
::
addColumn
<
MailCommon
::
ExpireCollectionAttribute
::
ExpireAction
>
(
"expireaction"
);
QTest
::
addColumn
<
Akonadi
::
Collection
::
Id
>
(
"akonadiid"
);
QTest
::
newRow
(
"add autoexpire"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDelete
<<
qint64
(
5
);
QTest
::
newRow
(
"change action"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change age"
)
<<
true
<<
150
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units"
)
<<
true
<<
15
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units2"
)
<<
true
<<
150
<<
18
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMonths
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireWeeks
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
6
);
QTest
::
newRow
(
"add autoexpire"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDelete
<<
qint64
(
5
);
QTest
::
newRow
(
"change action"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change age"
)
<<
true
<<
150
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units"
)
<<
true
<<
15
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units2"
)
<<
true
<<
150
<<
18
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMonths
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireWeeks
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
6
);
}
void
ExpireCollectionAttributeTest
::
shouldCloneAttr
()
...
...
@@ -140,11 +147,16 @@ void ExpireCollectionAttributeTest::shouldSerializedValue_data()
QTest
::
addColumn
<
MailCommon
::
ExpireCollectionAttribute
::
ExpireAction
>
(
"expireaction"
);
QTest
::
addColumn
<
Akonadi
::
Collection
::
Id
>
(
"akonadiid"
);
QTest
::
newRow
(
"add autoexpire"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDelete
<<
qint64
(
5
);
QTest
::
newRow
(
"change action"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change age"
)
<<
true
<<
150
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units"
)
<<
true
<<
15
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units2"
)
<<
true
<<
150
<<
18
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMonths
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireWeeks
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
6
);
QTest
::
newRow
(
"add autoexpire"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDelete
<<
qint64
(
5
);
QTest
::
newRow
(
"change action"
)
<<
true
<<
28
<<
14
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change age"
)
<<
true
<<
150
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units"
)
<<
true
<<
15
<<
1
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
5
);
QTest
::
newRow
(
"change units2"
)
<<
true
<<
150
<<
18
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMonths
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireWeeks
<<
MailCommon
::
ExpireCollectionAttribute
::
ExpireMove
<<
qint64
(
6
);
}
void
ExpireCollectionAttributeTest
::
shouldSerializedValue
()
...
...
src/collectionpage/collectionexpirypage.cpp
View file @
83d036c2
...
...
@@ -54,7 +54,7 @@ CollectionExpiryPage::~CollectionExpiryPage()
bool
CollectionExpiryPage
::
canHandle
(
const
Akonadi
::
Collection
&
col
)
const
{
QSharedPointer
<
FolderSettings
>
fd
=
FolderSettings
::
forCollection
(
col
,
false
);
return
(
fd
->
canDeleteMessages
()
&&
!
fd
->
isStructural
()
)
;
return
fd
->
canDeleteMessages
()
&&
!
fd
->
isStructural
();
}
void
CollectionExpiryPage
::
init
()
...
...
@@ -140,14 +140,14 @@ void CollectionExpiryPage::load(const Akonadi::Collection &collection)
attr
->
daysToExpire
(
daysToExpireUnread
,
daysToExpireRead
);
if
(
expiryGloballyOn
&&
attr
->
readExpireUnits
()
!=
ExpireCollectionAttribute
::
ExpireNever
&&
daysToExpireRead
>=
0
)
{
&&
attr
->
readExpireUnits
()
!=
ExpireCollectionAttribute
::
ExpireNever
&&
daysToExpireRead
>=
0
)
{
expireReadMailCB
->
setChecked
(
true
);
expireReadMailSB
->
setValue
(
daysToExpireRead
);
}
if
(
expiryGloballyOn
&&
attr
->
unreadExpireUnits
()
!=
ExpireCollectionAttribute
::
ExpireNever
&&
daysToExpireUnread
>=
0
)
{
&&
attr
->
unreadExpireUnits
()
!=
ExpireCollectionAttribute
::
ExpireNever
&&
daysToExpireUnread
>=
0
)
{
expireUnreadMailCB
->
setChecked
(
true
);
expireUnreadMailSB
->
setValue
(
daysToExpireUnread
);
}
...
...
@@ -205,17 +205,17 @@ void CollectionExpiryPage::saveAndExpire(Akonadi::Collection &collection, bool s
}
}
if
(
!
attribute
)
{
attribute
=
collection
.
attribute
<
MailCommon
::
ExpireCollectionAttribute
>
(
Akonadi
::
Collection
::
AddIfMissing
);
attribute
=
collection
.
attribute
<
MailCommon
::
ExpireCollectionAttribute
>
(
Akonadi
::
Collection
::
AddIfMissing
);
}
attribute
->
setAutoExpire
(
enableGlobally
);
// we always write out days now
attribute
->
setReadExpireAge
(
expireReadMailSB
->
value
());
attribute
->
setUnreadExpireAge
(
expireUnreadMailSB
->
value
());
attribute
->
setReadExpireUnits
(
expireReadMailCB
->
isChecked
()
?
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
:
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
);
attribute
->
setUnreadExpireUnits
(
expireUnreadMailCB
->
isChecked
()
?
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
:
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
);
attribute
->
setReadExpireUnits
(
expireReadMailCB
->
isChecked
()
?
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
:
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
);
attribute
->
setUnreadExpireUnits
(
expireUnreadMailCB
->
isChecked
()
?
MailCommon
::
ExpireCollectionAttribute
::
ExpireDays
:
MailCommon
::
ExpireCollectionAttribute
::
ExpireNever
);
if
(
deletePermanentlyRB
->
isChecked
())
{
attribute
->
setExpireAction
(
ExpireCollectionAttribute
::
ExpireDelete
);
...
...
@@ -271,4 +271,3 @@ void CollectionExpiryPage::slotChanged()
{
mChanged
=
true
;
}
src/collectionpage/collectionexpirypage.h
View file @
83d036c2
...
...
@@ -31,9 +31,7 @@ class QCheckBox;
class
QPushButton
;
class
QRadioButton
;
namespace
MailCommon
{
namespace
MailCommon
{
class
FolderRequester
;
class
MAILCOMMON_EXPORT
CollectionExpiryPage
:
public
Akonadi
::
CollectionPropertiesPage
...
...
@@ -75,7 +73,6 @@ private:
};
AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY
(
CollectionExpiryPageFactory
,
CollectionExpiryPage
)
}
#endif
src/collectionpage/collectiongeneralpage.cpp
View file @
83d036c2
...
...
@@ -51,12 +51,12 @@ using namespace Akonadi;
using
namespace
MailCommon
;
CollectionGeneralPage
::
CollectionGeneralPage
(
QWidget
*
parent
)
:
CollectionPropertiesPage
(
parent
)
,
mContentsComboBox
(
nullptr
)
,
mIncidencesForComboBox
(
nullptr
)
,
mSharedSeenFlagsCheckBox
(
nullptr
)
,
mNameEdit
(
nullptr
)
,
mFolderCollection
(
nullptr
)
:
CollectionPropertiesPage
(
parent
)
,
mContentsComboBox
(
nullptr
)
,
mIncidencesForComboBox
(
nullptr
)
,
mSharedSeenFlagsCheckBox
(
nullptr
)
,
mNameEdit
(
nullptr
)
,
mFolderCollection
(
nullptr
)
{
setObjectName
(
QStringLiteral
(
"MailCommon::CollectionGeneralPage"
));
setPageTitle
(
i18nc
(
"@title:tab General settings for a folder."
,
"General"
));
...
...
@@ -78,8 +78,8 @@ void CollectionGeneralPage::addLine(QWidget *parent, QVBoxLayout *layout)
void
CollectionGeneralPage
::
init
(
const
Akonadi
::
Collection
&
collection
)
{
mIsLocalSystemFolder
=
CommonKernel
->
isSystemFolderCollection
(
collection
)
||
Kernel
::
folderIsInbox
(
collection
);
mIsLocalSystemFolder
=
CommonKernel
->
isSystemFolderCollection
(
collection
)
||
Kernel
::
folderIsInbox
(
collection
);
mIsResourceFolder
=
(
collection
.
parentCollection
()
==
Akonadi
::
Collection
::
root
());
QLabel
*
label
;
...
...
@@ -87,9 +87,8 @@ void CollectionGeneralPage::init(const Akonadi::Collection &collection)
QVBoxLayout
*
topLayout
=
new
QVBoxLayout
(
this
);
// Musn't be able to edit details for a non-resource, system folder.
if
((
!
mIsLocalSystemFolder
||
mIsResourceFolder
)
&&
!
mFolderCollection
->
isReadOnly
())
{
if
((
!
mIsLocalSystemFolder
||
mIsResourceFolder
)
&&
!
mFolderCollection
->
isReadOnly
())
{
QHBoxLayout
*
hl
=
new
QHBoxLayout
();
topLayout
->
addItem
(
hl
);
label
=
new
QLabel
(
i18nc
(
"@label:textbox Name of the folder."
,
"&Name:"
),
this
);
...
...
@@ -106,8 +105,8 @@ void CollectionGeneralPage::init(const Akonadi::Collection &collection)
// should new mail in this folder be ignored?
QHBoxLayout
*
hbl
=
new
QHBoxLayout
();
topLayout
->
addItem
(
hbl
);
mNotifyOnNewMailCheckBox
=
new
QCheckBox
(
i18n
(
"Act on new/unread mail in this folder"
),
this
);
mNotifyOnNewMailCheckBox
=
new
QCheckBox
(
i18n
(
"Act on new/unread mail in this folder"
),
this
);
mNotifyOnNewMailCheckBox
->
setWhatsThis
(
i18n
(
"<qt><p>If this option is enabled then you will be notified about "
"new/unread mail in this folder. Moreover, going to the "
...
...
@@ -122,8 +121,8 @@ void CollectionGeneralPage::init(const Akonadi::Collection &collection)
// should replies to mails in this folder be kept in this same folder?
hbl
=
new
QHBoxLayout
();
topLayout
->
addItem
(
hbl
);
mKeepRepliesInSameFolderCheckBox
=
new
QCheckBox
(
i18n
(
"Keep replies in this folder"
),
this
);
mKeepRepliesInSameFolderCheckBox
=
new
QCheckBox
(
i18n
(
"Keep replies in this folder"
),
this
);
mKeepRepliesInSameFolderCheckBox
->
setWhatsThis
(
i18n
(
"Check this option if you want replies you write "
"to mails in this folder to be put in this same folder "
...
...
@@ -133,8 +132,8 @@ void CollectionGeneralPage::init(const Akonadi::Collection &collection)
// should this folder be shown in the folder selection dialog?
hbl
=
new
QHBoxLayout
();
topLayout
->
addItem
(
hbl
);
mHideInSelectionDialogCheckBox
=
new
QCheckBox
(
i18n
(
"Hide this folder in the folder selection dialog"
),
this
);
mHideInSelectionDialogCheckBox
=
new
QCheckBox
(
i18n
(
"Hide this folder in the folder selection dialog"
),
this
);
mHideInSelectionDialogCheckBox
->
setWhatsThis
(
xi18nc
(
"@info:whatsthis"
,
"Check this option if you do not want this folder "
...
...
@@ -175,19 +174,19 @@ void CollectionGeneralPage::init(const Akonadi::Collection &collection)
if
(
CommonKernel
->
imapResourceManager
()
->
hasAnnotationSupport
(
collectionResource
))
{
PimCommon
::
CollectionTypeUtil
::
FolderContentsType
contentsType
=
PimCommon
::
CollectionTypeUtil
::
ContentsTypeMail
;
const
PimCommon
::
CollectionAnnotationsAttribute
*
annotationAttribute
=
collection
.
attribute
<
PimCommon
::
CollectionAnnotationsAttribute
>
();
const
PimCommon
::
CollectionAnnotationsAttribute
*
annotationAttribute
=
collection
.
attribute
<
PimCommon
::
CollectionAnnotationsAttribute
>
();
const
QMap
<
QByteArray
,
QByteArray
>
annotations
=
(
annotationAttribute
?
annotationAttribute
->
annotations
()
:
QMap
<
QByteArray
,
QByteArray
>
());
const
QMap
<
QByteArray
,
QByteArray
>
annotations
=
(
annotationAttribute
?
annotationAttribute
->
annotations
()
:
QMap
<
QByteArray
,
QByteArray
>
());
const
bool
sharedSeen
=
(
annotations
.
value
(
PimCommon
::
CollectionTypeUtil
::
kolabSharedSeen
())
==
"true"
);
PimCommon
::
CollectionTypeUtil
collectionUtil
;
const
PimCommon
::
CollectionTypeUtil
::
IncidencesFor
incidencesFor
=
collectionUtil
.
incidencesForFromString
(
QLatin1String
(
annotations
.
value
(
PimCommon
::
CollectionTypeUtil
::
kolabIncidencesFor
())));
const
PimCommon
::
CollectionTypeUtil
::
IncidencesFor
incidencesFor
=
collectionUtil
.
incidencesForFromString
(
QLatin1String
(
annotations
.
value
(
PimCommon
::
CollectionTypeUtil
::
kolabIncidencesFor
())));
const
PimCommon
::
CollectionTypeUtil
::
FolderContentsType
folderType
=
collectionUtil
.
typeFromKolabName
(
annotations
.
value
(
PimCommon
::
CollectionTypeUtil
::
kolabFolderType
()));
...
...
@@ -248,16 +247,16 @@ void CollectionGeneralPage::load(const Akonadi::Collection &collection)
// ignore new mail
mNotifyOnNewMailCheckBox
->
setChecked
(
!
Util
::
ignoreNewMailInFolder
(
collection
));
const
bool
keepInFolder
=
(
mFolderCollection
->
canCreateMessages
()
&&
mFolderCollection
->
putRepliesInSameFolder
());
const
bool
keepInFolder
=
(
mFolderCollection
->
canCreateMessages
()
&&
mFolderCollection
->
putRepliesInSameFolder
());
mKeepRepliesInSameFolderCheckBox
->
setChecked
(
keepInFolder
);
mKeepRepliesInSameFolderCheckBox
->
setEnabled
(
mFolderCollection
->
canCreateMessages
());
mHideInSelectionDialogCheckBox
->
setChecked
(
mFolderCollection
->
hideInSelectionDialog
());
if
(
mContentsComboBox
)
{
const
PimCommon
::
CollectionAnnotationsAttribute
*
annotationsAttribute
=
collection
.
attribute
<
PimCommon
::
CollectionAnnotationsAttribute
>
();
const
PimCommon
::
CollectionAnnotationsAttribute
*
annotationsAttribute
=
collection
.
attribute
<
PimCommon
::
CollectionAnnotationsAttribute
>
();
if
(
annotationsAttribute
)
{
const
QMap
<
QByteArray
,
QByteArray
>
annotations
=
annotationsAttribute
->
annotations
();
...
...
@@ -275,19 +274,19 @@ void CollectionGeneralPage::save(Collection &collection)
if
(
mNameEdit
)
{
if
(
!
mIsLocalSystemFolder
)
{
const
QString
nameFolder
(
mNameEdit
->
text
().
trimmed
());
bool
canRenameFolder
=
!
(
nameFolder
.
startsWith
(
QLatin1Char
(
'.'
))
||
nameFolder
.
endsWith
(
QLatin1Char
(
'.'
))
||
nameFolder
.
contains
(
QLatin1Char
(
'/'
))
||
nameFolder
.
isEmpty
());
bool
canRenameFolder
=
!
(
nameFolder
.
startsWith
(
QLatin1Char
(
'.'
))
||
nameFolder
.
endsWith
(
QLatin1Char
(
'.'
))
||
nameFolder
.
contains
(
QLatin1Char
(
'/'
))
||
nameFolder
.
isEmpty
());
if
(
mIsResourceFolder
&&
(
PimCommon
::
Util
::
isImapResource
(
collection
.
resource
())))
{
collection
.
setName
(
nameFolder
);
Akonadi
::
AgentInstance
instance
=
Akonadi
::
AgentManager
::
self
()
->
instance
(
collection
.
resource
());
Akonadi
::
AgentInstance
instance
=
Akonadi
::
AgentManager
::
self
()
->
instance
(
collection
.
resource
());
instance
.
setName
(
nameFolder
);
}
else
if
(
canRenameFolder
)
{
if
(
collection
.
hasAttribute
<
Akonadi
::
EntityDisplayAttribute
>
()
&&
!
collection
.
attribute
<
Akonadi
::
EntityDisplayAttribute
>
()
->
displayName
().
isEmpty
())
{
if
(
collection
.
hasAttribute
<
Akonadi
::
EntityDisplayAttribute
>
()
&&
!
collection
.
attribute
<
Akonadi
::
EntityDisplayAttribute
>
()
->
displayName
().
isEmpty
())
{
collection
.
attribute
<
Akonadi
::
EntityDisplayAttribute
>
()
->
setDisplayName
(
nameFolder
);
}
else
if
(
!
nameFolder
.
isEmpty
())
{
...
...
@@ -304,8 +303,8 @@ void CollectionGeneralPage::save(Collection &collection)
collection
.
removeAttribute
<
Akonadi
::
NewMailNotifierAttribute
>
();
}
PimCommon
::
CollectionAnnotationsAttribute
*
annotationsAttribute
=
collection
.
attribute
<
PimCommon
::
CollectionAnnotationsAttribute
>
(
Collection
::
AddIfMissing
);
PimCommon
::
CollectionAnnotationsAttribute
*
annotationsAttribute
=
collection
.
attribute
<
PimCommon
::
CollectionAnnotationsAttribute
>
(
Collection
::
AddIfMissing
);
QMap
<
QByteArray
,
QByteArray
>
annotations
=
annotationsAttribute
->
annotations
();
if
(
mSharedSeenFlagsCheckBox
&&
mSharedSeenFlagsCheckBox
->
isEnabled
())
{
...
...
@@ -314,20 +313,20 @@ void CollectionGeneralPage::save(Collection &collection)
PimCommon
::
CollectionTypeUtil
collectionUtil
;
if
(
mIncidencesForComboBox
&&
mIncidencesForComboBox
->
isEnabled
())
{
annotations
[
PimCommon
::
CollectionTypeUtil
::
kolabIncidencesFor
()
]
=
collectionUtil
.
incidencesForToString
(
static_cast
<
PimCommon
::
CollectionTypeUtil
::
IncidencesFor
>
(
mIncidencesForComboBox
->
currentIndex
())).
toLatin1
();
annotations
[
PimCommon
::
CollectionTypeUtil
::
kolabIncidencesFor
()
]
=
collectionUtil
.
incidencesForToString
(
static_cast
<
PimCommon
::
CollectionTypeUtil
::
IncidencesFor
>
(
mIncidencesForComboBox
->
currentIndex
())).
toLatin1
();
}
if
(
mContentsComboBox
)
{
const
PimCommon
::
CollectionTypeUtil
::
FolderContentsType
type
=
collectionUtil
.
contentsTypeFromString
(
mContentsComboBox
->
currentText
());
const
PimCommon
::
CollectionTypeUtil
::
FolderContentsType
type
=
collectionUtil
.
contentsTypeFromString
(
mContentsComboBox
->
currentText
());
const
QByteArray
kolabName
=
collectionUtil
.
kolabNameFromType
(
type
);
if
(
!
kolabName
.
isEmpty
())
{
const
QString
iconName
=
collectionUtil
.
iconNameFromContentsType
(
type
);
Akonadi
::
EntityDisplayAttribute
*
attribute
=
collection
.
attribute
<
Akonadi
::
EntityDisplayAttribute
>
(
Akonadi
::
Collection
::
AddIfMissing
);
Akonadi
::
EntityDisplayAttribute
*
attribute
=
collection
.
attribute
<
Akonadi
::
EntityDisplayAttribute
>
(
Akonadi
::
Collection
::
AddIfMissing
);
attribute
->
setIconName
(
iconName
);
new
Akonadi
::
CollectionModifyJob
(
collection
);
annotations
[
PimCommon
::
CollectionTypeUtil
::
kolabFolderType
()
]
=
kolabName
;
...
...
@@ -360,20 +359,20 @@ void CollectionGeneralPage::slotIdentityCheckboxChanged()
void
CollectionGeneralPage
::
slotFolderContentsSelectionChanged
(
int
)
{
PimCommon
::
CollectionTypeUtil
collectionUtil
;
const
PimCommon
::
CollectionTypeUtil
::
FolderContentsType
type
=
collectionUtil
.
contentsTypeFromString
(
mContentsComboBox
->
currentText
());
const
PimCommon
::
CollectionTypeUtil
::
FolderContentsType
type
=
collectionUtil
.
contentsTypeFromString
(
mContentsComboBox
->
currentText
());
if
(
type
!=
PimCommon
::
CollectionTypeUtil
::
ContentsTypeMail
)
{
const
QString
message
=
i18n
(
"You have configured this folder to contain groupware information. "
"That means that this folder will disappear once the configuration "
"dialog is closed."
);
const
QString
message
=
i18n
(
"You have configured this folder to contain groupware information. "
"That means that this folder will disappear once the configuration "
"dialog is closed."
);
KMessageBox
::
information
(
this
,
message
);
}
const
bool
enable
=
(
type
==
PimCommon
::
CollectionTypeUtil
::
ContentsTypeCalendar
||
type
==
PimCommon
::
CollectionTypeUtil
::
ContentsTypeTask
);
const
bool
enable
=
(
type
==
PimCommon
::
CollectionTypeUtil
::
ContentsTypeCalendar
||
type
==
PimCommon
::
CollectionTypeUtil
::
ContentsTypeTask
);
if
(
mIncidencesForComboBox
)
{
mIncidencesForComboBox
->
setEnabled
(
enable
);
...
...
@@ -384,10 +383,10 @@ void CollectionGeneralPage::slotNameChanged(const QString &name)
{
#ifndef QT_NO_STYLE_STYLESHEET
QString
styleSheet
;
if
(
name
.
startsWith
(
QLatin1Char
(
'.'
))
||
name
.
endsWith
(
QLatin1Char
(
'.'
))
||
name
.
contains
(
QLatin1Char
(
'/'
))
||
name
.
isEmpty
())
{
if
(
name
.
startsWith
(
QLatin1Char
(
'.'
))
||
name
.
endsWith
(
QLatin1Char
(
'.'
))
||
name
.
contains
(
QLatin1Char
(
'/'
))
||
name
.
isEmpty
())
{
if
(
mColorName
.
isEmpty
())
{
const
KColorScheme
::
BackgroundRole
bgColorScheme
(
KColorScheme
::
NegativeBackground
);
KStatefulBrush
bgBrush
(
KColorScheme
::
View
,
bgColorScheme
);
...
...
@@ -399,4 +398,3 @@ void CollectionGeneralPage::slotNameChanged(const QString &name)
setStyleSheet
(
styleSheet
);
#endif
}
src/collectionpage/collectiongeneralpage.h
View file @
83d036c2
...
...
@@ -26,20 +26,16 @@ class KLineEdit;
class
QCheckBox
;
template
<
typename
T
>
class
QSharedPointer
;
namespace
PimCommon
{
template
<
typename
T
>
class
QSharedPointer
;
namespace
PimCommon
{
class
IncidencesForWidget
;
class
ContentTypeWidget
;
}
namespace
KIdentityManagement
{
namespace
KIdentityManagement
{
class
IdentityCombo
;
}
class
QVBoxLayout
;
namespace
MailCommon
{
namespace
MailCommon
{
class
FolderSettings
;
class
MAILCOMMON_EXPORT
CollectionGeneralPage
:
public
Akonadi
::
CollectionPropertiesPage
{
...
...
@@ -66,11 +62,11 @@ private:
PimCommon
::
ContentTypeWidget
*
mContentsComboBox
;
PimCommon
::
IncidencesForWidget
*
mIncidencesForComboBox
;
QCheckBox
*
mSharedSeenFlagsCheckBox
;
QCheckBox
*
mNotifyOnNewMailCheckBox
;
QCheckBox
*
mKeepRepliesInSameFolderCheckBox
;
QCheckBox
*
mHideInSelectionDialogCheckBox
;
QCheckBox
*
mUseDefaultIdentityCheckBox
;
KLineEdit
*
mNameEdit
;
QCheckBox
*
mNotifyOnNewMailCheckBox
;
QCheckBox
*
mKeepRepliesInSameFolderCheckBox
;
QCheckBox
*
mHideInSelectionDialogCheckBox
;
QCheckBox
*
mUseDefaultIdentityCheckBox
;
KLineEdit
*
mNameEdit
;
KIdentityManagement
::
IdentityCombo
*
mIdentityComboBox
;
QSharedPointer
<
MailCommon
::
FolderSettings
>
mFolderCollection
;
bool
mIsLocalSystemFolder
;
...
...
@@ -78,7 +74,6 @@ private:
};
AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY
(
CollectionGeneralPageFactory
,
CollectionGeneralPage
)
}
#endif
src/filter/autotests/filteractionaddheadertest.cpp
View file @
83d036c2
...
...
@@ -27,12 +27,10 @@
FilterActionAddHeaderTest
::
FilterActionAddHeaderTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
FilterActionAddHeaderTest
::~
FilterActionAddHeaderTest
()
{
}
void
FilterActionAddHeaderTest
::
shouldCreateWidget
()
...
...
src/filter/autotests/filteractionaddtoaddressbooktest.cpp
View file @
83d036c2
...
...
@@ -28,12 +28,10 @@
FilterActionAddToAddressBookTest
::
FilterActionAddToAddressBookTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
FilterActionAddToAddressBookTest
::~
FilterActionAddToAddressBookTest
()
{
}
void
FilterActionAddToAddressBookTest
::
shouldHaveDefaultValue
()
...
...
src/filter/autotests/filteractioncopytest.cpp
View file @
83d036c2
...
...
@@ -22,12 +22,10 @@
FilterActionCopyTest
::
FilterActionCopyTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
FilterActionCopyTest
::~
FilterActionCopyTest
()
{
}