Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Akonadi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
Akonadi
Commits
8a2c1f7e
Commit
8a2c1f7e
authored
Aug 05, 2012
by
Guy Maurel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more spaces, some less spaces, some more blocks, part 2 from akonadi
parent
1faa214a
Changes
39
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
935 additions
and
630 deletions
+935
-630
collectionfilterproxymodel.cpp
collectionfilterproxymodel.cpp
+2
-1
conflicthandling/conflicthandler.cpp
conflicthandling/conflicthandler.cpp
+1
-1
contact/standardcontactactionmanager.cpp
contact/standardcontactactionmanager.cpp
+1
-1
entity.cpp
entity.cpp
+10
-7
entity.h
entity.h
+3
-3
entity_p.h
entity_p.h
+5
-3
entitycache_p.h
entitycache_p.h
+45
-30
entitydeletedattribute.cpp
entitydeletedattribute.cpp
+4
-2
entitydisplayattribute.cpp
entitydisplayattribute.cpp
+8
-10
entitylistview.cpp
entitylistview.cpp
+29
-19
entitylistview.h
entitylistview.h
+1
-1
entitymimetypefiltermodel.cpp
entitymimetypefiltermodel.cpp
+57
-42
entityorderproxymodel.cpp
entityorderproxymodel.cpp
+50
-39
entityrightsfiltermodel.cpp
entityrightsfiltermodel.cpp
+16
-12
entitytreemodel.cpp
entitytreemodel.cpp
+177
-102
entitytreemodel_p.cpp
entitytreemodel_p.cpp
+257
-159
entitytreeview.cpp
entitytreeview.cpp
+10
-9
entitytreeview.h
entitytreeview.h
+3
-3
erroroverlay.cpp
erroroverlay.cpp
+4
-4
etmviewstatesaver.cpp
etmviewstatesaver.cpp
+22
-20
exception.cpp
exception.cpp
+1
-1
favoritecollectionsmodel.cpp
favoritecollectionsmodel.cpp
+44
-32
firstrun.cpp
firstrun.cpp
+9
-6
item.cpp
item.cpp
+49
-31
kjobprivatebase_p.h
kjobprivatebase_p.h
+1
-1
mimetypechecker.cpp
mimetypechecker.cpp
+1
-1
objectnotificationmessage.cpp
objectnotificationmessage.cpp
+19
-17
pastehelper.cpp
pastehelper.cpp
+33
-17
protocolhelper.cpp
protocolhelper.cpp
+1
-1
protocolhelper_p.h
protocolhelper_p.h
+1
-1
recentcollectionaction_p.h
recentcollectionaction_p.h
+2
-2
recursivecollectionfilterproxymodel.h
recursivecollectionfilterproxymodel.h
+1
-1
renamefavoritedialog.h
renamefavoritedialog.h
+1
-1
resourcescheduler.cpp
resourcescheduler.cpp
+1
-1
servermanager.cpp
servermanager.cpp
+61
-45
sharedvaluepool_p.h
sharedvaluepool_p.h
+1
-1
specialcollections.cpp
specialcollections.cpp
+2
-1
specialcollectionshelperjobs_p.h
specialcollectionshelperjobs_p.h
+1
-1
standardactionmanager.h
standardactionmanager.h
+1
-1
No files found.
collectionfilterproxymodel.cpp
View file @
8a2c1f7e
...
...
@@ -70,8 +70,9 @@ bool CollectionFilterProxyModel::Private::collectionAccepted( const QModelIndex
// find the resource
QModelIndex
resource
=
index
;
while
(
resource
.
parent
().
isValid
()
)
while
(
resource
.
parent
().
isValid
()
)
{
resource
=
resource
.
parent
();
}
// See if that resource is visible, if not, invalidate the filter.
if
(
resource
!=
index
&&
!
acceptedResources
.
contains
(
resource
)
)
{
...
...
conflicthandling/conflicthandler.cpp
View file @
8a2c1f7e
...
...
@@ -80,7 +80,7 @@ void ConflictHandler::resolve()
dlg
.
exec
();
const
ResolveStrategy
strategy
=
dlg
.
resolveStrategy
();
switch
(
strategy
)
{
switch
(
strategy
)
{
case
UseLocalItem
:
useLocalItem
();
break
;
...
...
contact/standardcontactactionmanager.cpp
View file @
8a2c1f7e
...
...
@@ -342,7 +342,7 @@ class StandardContactActionManager::Private
return
Collection
();
}
return
index
.
data
(
EntityTreeModel
::
CollectionRole
).
value
<
Collection
>
();
return
index
.
data
(
EntityTreeModel
::
CollectionRole
).
value
<
Collection
>
();
}
void
slotCreateContact
()
...
...
entity.cpp
View file @
8a2c1f7e
...
...
@@ -165,8 +165,9 @@ void Akonadi::Entity::clearAttributes()
Attribute
*
Entity
::
attribute
(
const
QByteArray
&
type
)
const
{
if
(
d_ptr
->
mAttributes
.
contains
(
type
)
)
if
(
d_ptr
->
mAttributes
.
contains
(
type
)
)
{
return
d_ptr
->
mAttributes
.
value
(
type
);
}
return
0
;
}
...
...
@@ -177,17 +178,19 @@ uint qHash( const Akonadi::Entity &entity )
Collection
&
Entity
::
parentCollection
()
{
if
(
!
d_ptr
->
mParent
)
if
(
!
d_ptr
->
mParent
)
{
d_ptr
->
mParent
=
new
Collection
();
return
*
(
d_ptr
->
mParent
);
}
return
*
(
d_ptr
->
mParent
);
}
Collection
Entity
::
parentCollection
()
const
{
if
(
!
d_ptr
->
mParent
)
return
*
(
s_defaultParentCollection
);
else
return
*
(
d_ptr
->
mParent
);
if
(
!
d_ptr
->
mParent
)
{
return
*
(
s_defaultParentCollection
);
}
else
{
return
*
(
d_ptr
->
mParent
);
}
}
void
Entity
::
setParentCollection
(
const
Collection
&
parent
)
...
...
entity.h
View file @
8a2c1f7e
...
...
@@ -199,8 +199,7 @@ class AKONADI_EXPORT Entity
/**
* Describes the options that can be passed to access attributes.
*/
enum
CreateOption
{
enum
CreateOption
{
AddIfMissing
///< Creates the attribute if it is missing
};
...
...
@@ -218,8 +217,9 @@ class AKONADI_EXPORT Entity
const
T
dummy
;
if
(
hasAttribute
(
dummy
.
type
()
)
)
{
T
*
attr
=
dynamic_cast
<
T
*>
(
attribute
(
dummy
.
type
()
)
);
if
(
attr
)
if
(
attr
)
{
return
attr
;
}
kWarning
(
5250
)
<<
"Found attribute of unknown type"
<<
dummy
.
type
()
<<
". Did you forget to call AttributeFactory::registerAttribute()?"
;
}
...
...
entity_p.h
View file @
8a2c1f7e
...
...
@@ -58,11 +58,13 @@ class EntityPrivate : public QSharedData
mId
=
other
.
mId
;
mRemoteId
=
other
.
mRemoteId
;
mRemoteRevision
=
other
.
mRemoteRevision
;
foreach
(
Attribute
*
attr
,
other
.
mAttributes
)
foreach
(
Attribute
*
attr
,
other
.
mAttributes
)
{
mAttributes
.
insert
(
attr
->
type
(),
attr
->
clone
()
);
}
mDeletedAttributes
=
other
.
mDeletedAttributes
;
if
(
other
.
mParent
)
mParent
=
new
Collection
(
*
(
other
.
mParent
)
);
if
(
other
.
mParent
)
{
mParent
=
new
Collection
(
*
(
other
.
mParent
)
);
}
}
virtual
void
resetChangeLog
()
...
...
entitycache_p.h
View file @
8a2c1f7e
...
...
@@ -107,8 +107,9 @@ class EntityCache : public EntityCacheBase
virtual
T
retrieve
(
typename
T
::
Id
id
)
const
{
EntityCacheNode
<
T
>*
node
=
cacheNodeForId
(
id
);
if
(
node
&&
!
node
->
pending
&&
!
node
->
invalid
)
if
(
node
&&
!
node
->
pending
&&
!
node
->
invalid
)
{
return
node
->
entity
;
}
return
T
();
}
...
...
@@ -116,8 +117,9 @@ class EntityCache : public EntityCacheBase
void
invalidate
(
typename
T
::
Id
id
)
{
EntityCacheNode
<
T
>*
node
=
cacheNodeForId
(
id
);
if
(
node
)
if
(
node
)
{
node
->
invalid
=
true
;
}
}
/** Triggers a re-fetching of a cache entry, use if it has changed on the server. */
...
...
@@ -126,8 +128,9 @@ class EntityCache : public EntityCacheBase
EntityCacheNode
<
T
>*
node
=
cacheNodeForId
(
id
);
if
(
node
)
{
mCache
.
removeAll
(
node
);
if
(
node
->
pending
)
if
(
node
->
pending
)
{
request
(
id
,
scope
);
}
delete
node
;
}
}
...
...
@@ -164,10 +167,10 @@ class EntityCache : public EntityCacheBase
EntityCacheNode
<
T
>*
cacheNodeForId
(
typename
T
::
Id
id
)
const
{
for
(
typename
QQueue
<
EntityCacheNode
<
T
>*>::
const_iterator
it
=
mCache
.
constBegin
(),
endIt
=
mCache
.
constEnd
();
it
!=
endIt
;
++
it
)
{
if
(
(
*
it
)
->
entity
.
id
()
==
id
)
it
!=
endIt
;
++
it
)
{
if
(
(
*
it
)
->
entity
.
id
()
==
id
)
{
return
*
it
;
}
}
return
0
;
}
...
...
@@ -177,8 +180,9 @@ class EntityCache : public EntityCacheBase
// Error handling?
typename
T
::
Id
id
=
job
->
property
(
"EntityCacheNode"
).
template
value
<
typename
T
::
Id
>();
EntityCacheNode
<
T
>
*
node
=
cacheNodeForId
(
id
);
if
(
!
node
)
if
(
!
node
)
{
return
;
// got replaced in the meantime
}
node
->
pending
=
false
;
extractResult
(
node
,
job
);
...
...
@@ -202,8 +206,9 @@ class EntityCache : public EntityCacheBase
/** Tries to reduce the cache size until at least one more object fits in. */
void
shrinkCache
()
{
while
(
mCache
.
size
()
>=
mCapacity
&&
!
mCache
.
first
()
->
pending
)
while
(
mCache
.
size
()
>=
mCapacity
&&
!
mCache
.
first
()
->
pending
)
{
delete
mCache
.
dequeue
();
}
}
private:
...
...
@@ -215,20 +220,22 @@ template<> inline void EntityCache<Collection, CollectionFetchJob, CollectionFet
{
CollectionFetchJob
*
fetch
=
qobject_cast
<
CollectionFetchJob
*>
(
job
);
Q_ASSERT
(
fetch
);
if
(
fetch
->
collections
().
isEmpty
()
)
if
(
fetch
->
collections
().
isEmpty
()
)
{
node
->
entity
=
Collection
();
else
}
else
{
node
->
entity
=
fetch
->
collections
().
first
();
}
}
template
<
>
inline
void
EntityCache
<
Item
,
ItemFetchJob
,
ItemFetchScope
>::
extractResult
(
EntityCacheNode
<
Item
>*
node
,
KJob
*
job
)
const
{
ItemFetchJob
*
fetch
=
qobject_cast
<
ItemFetchJob
*>
(
job
);
Q_ASSERT
(
fetch
);
if
(
fetch
->
items
().
isEmpty
()
)
if
(
fetch
->
items
().
isEmpty
()
)
{
node
->
entity
=
Item
();
else
}
else
{
node
->
entity
=
fetch
->
items
().
first
();
}
}
template
<
>
inline
CollectionFetchJob
*
EntityCache
<
Collection
,
CollectionFetchJob
,
CollectionFetchScope
>::
createFetchJob
(
Collection
::
Id
id
)
...
...
@@ -248,28 +255,29 @@ public:
{
bool
val
=
true
;
if
(
lhs_
.
size
()
!=
rhs_
.
size
())
if
(
lhs_
.
size
()
!=
rhs_
.
size
()
)
{
return
false
;
}
typename
T
::
List
lhs
=
lhs_
;
QList
<
typename
T
::
Id
>
rhs
=
rhs_
;
qSort
(
lhs
);
qSort
(
rhs
);
qSort
(
lhs
);
qSort
(
rhs
);
return
lhs
==
rhs
;
}
static
bool
compare
(
const
QList
<
typename
T
::
Id
>
&
l1
,
const
typename
T
::
List
&
l2
)
{
return
compare
(
l2
,
l1
);
return
compare
(
l2
,
l1
);
}
static
bool
compare
(
const
typename
T
::
List
&
l1
,
const
typename
T
::
List
&
l2
)
{
typename
T
::
List
l1_
=
l1
;
typename
T
::
List
l2_
=
l2
;
qSort
(
l1_
);
qSort
(
l2_
);
qSort
(
l1_
);
qSort
(
l2_
);
return
l1_
==
l2_
;
}
};
...
...
@@ -280,8 +288,9 @@ struct EntityListCacheNode
{
EntityListCacheNode
(
const
typename
T
::
List
&
list
)
:
entityList
(
list
),
pending
(
false
),
invalid
(
false
)
{}
EntityListCacheNode
(
const
QList
<
typename
T
::
Id
>
&
list
)
:
pending
(
false
),
invalid
(
false
)
{
foreach
(
typename
T
::
Id
id
,
list
)
entityList
.
append
(
T
(
id
));
foreach
(
typename
T
::
Id
id
,
list
)
{
entityList
.
append
(
T
(
id
)
);
}
}
typename
T
::
List
entityList
;
bool
pending
;
...
...
@@ -309,8 +318,9 @@ public:
typename
T
::
List
retrieve
(
const
QList
<
TArg
>
&
id
)
const
{
EntityListCacheNode
<
T
>*
node
=
cacheNodeForId
(
id
);
if
(
node
&&
!
node
->
pending
&&
!
node
->
invalid
)
if
(
node
&&
!
node
->
pending
&&
!
node
->
invalid
)
{
return
node
->
entityList
;
}
return
typename
T
::
List
();
}
...
...
@@ -331,8 +341,9 @@ public:
void
invalidate
(
const
QList
<
TArg
>
&
id
)
{
EntityListCacheNode
<
T
>*
node
=
cacheNodeForId
(
id
);
if
(
node
)
if
(
node
)
{
node
->
invalid
=
true
;
}
}
/** Triggers a re-fetching of a cache entry, use if it has changed on the server. */
...
...
@@ -342,8 +353,9 @@ public:
EntityListCacheNode
<
T
>*
node
=
cacheNodeForId
(
id
);
if
(
node
)
{
mCache
.
removeAll
(
node
);
if
(
node
->
pending
)
if
(
node
->
pending
)
{
request
(
id
,
scope
);
}
delete
node
;
}
}
...
...
@@ -362,8 +374,9 @@ private:
typename
T
::
List
getTList
(
const
QList
<
typename
T
::
Id
>
&
id
)
{
typename
T
::
List
ids
;
foreach
(
typename
T
::
Id
id_
,
id
)
ids
.
append
(
T
(
id_
));
foreach
(
typename
T
::
Id
id_
,
id
)
{
ids
.
append
(
T
(
id_
)
);
}
return
ids
;
}
...
...
@@ -393,8 +406,9 @@ private:
/** Tries to reduce the cache size until at least one more object fits in. */
void
shrinkCache
()
{
while
(
mCache
.
size
()
>=
mCapacity
&&
!
mCache
.
first
()
->
pending
)
while
(
mCache
.
size
()
>=
mCapacity
&&
!
mCache
.
first
()
->
pending
)
{
delete
mCache
.
dequeue
();
}
}
/** Object has been requested but is not yet loaded into the cache or is already available. */
...
...
@@ -408,10 +422,10 @@ private:
EntityListCacheNode
<
T
>*
cacheNodeForId
(
const
QList
<
TArg
>
&
id
)
const
{
for
(
typename
QQueue
<
EntityListCacheNode
<
T
>*>::
const_iterator
it
=
mCache
.
constBegin
(),
endIt
=
mCache
.
constEnd
();
it
!=
endIt
;
++
it
)
{
if
(
Comparator
<
T
>::
compare
(
(
*
it
)
->
entityList
,
id
)
)
it
!=
endIt
;
++
it
)
{
if
(
Comparator
<
T
>::
compare
(
(
*
it
)
->
entityList
,
id
)
)
{
return
*
it
;
}
}
return
0
;
}
...
...
@@ -427,8 +441,9 @@ private:
typename
T
::
List
ids
=
job
->
property
(
"EntityListCacheNode"
).
template
value
<
typename
T
::
List
>();
EntityListCacheNode
<
T
>
*
node
=
cacheNodeForId
(
ids
);
if
(
!
node
)
if
(
!
node
)
{
return
;
// got replaced in the meantime
}
node
->
pending
=
false
;
extractResult
(
node
,
job
);
...
...
entitydeletedattribute.cpp
View file @
8a2c1f7e
...
...
@@ -117,14 +117,16 @@ void EntityDeletedAttribute::deserialize( const QByteArray &data )
if
(
!
l
[
1
].
isEmpty
()
)
{
QList
<
QByteArray
>
componentData
;
ImapParser
::
parseParenthesizedList
(
l
[
1
],
componentData
);
if
(
componentData
.
size
()
!=
1
)
if
(
componentData
.
size
()
!=
1
)
{
return
;
}
QList
<
int
>
components
;
bool
ok
;
for
(
int
i
=
0
;
i
<
1
;
++
i
)
{
components
<<
componentData
.
at
(
i
).
toInt
(
&
ok
);
if
(
!
ok
)
if
(
!
ok
)
{
return
;
}
}
d
->
restoreCollection
=
Collection
(
components
.
at
(
0
)
);
}
...
...
entitydisplayattribute.cpp
View file @
8a2c1f7e
...
...
@@ -93,8 +93,7 @@ QByteArray EntityDisplayAttribute::serialized() const
l
<<
ImapParser
::
quote
(
d
->
icon
.
toUtf8
()
);
l
<<
ImapParser
::
quote
(
d
->
activeIcon
.
toUtf8
()
);
QList
<
QByteArray
>
components
;
if
(
d
->
backgroundColor
.
isValid
()
)
{
if
(
d
->
backgroundColor
.
isValid
()
)
{
components
=
QList
<
QByteArray
>
()
<<
QByteArray
::
number
(
d
->
backgroundColor
.
red
()
)
<<
QByteArray
::
number
(
d
->
backgroundColor
.
green
()
)
<<
QByteArray
::
number
(
d
->
backgroundColor
.
blue
()
)
...
...
@@ -115,22 +114,21 @@ void EntityDisplayAttribute::deserialize(const QByteArray &data)
if
(
size
>=
3
)
{
d
->
activeIcon
=
QString
::
fromUtf8
(
l
[
2
]
);
}
if
(
size
>=
4
)
{
if
(
!
l
[
3
].
isEmpty
()
)
{
if
(
size
>=
4
)
{
if
(
!
l
[
3
].
isEmpty
()
)
{
QList
<
QByteArray
>
componentData
;
ImapParser
::
parseParenthesizedList
(
l
[
3
],
componentData
);
if
(
componentData
.
size
()
!=
4
)
if
(
componentData
.
size
()
!=
4
)
{
return
;
}
QList
<
int
>
components
;
bool
ok
;
for
(
int
i
=
0
;
i
<=
3
;
++
i
)
{
for
(
int
i
=
0
;
i
<=
3
;
++
i
)
{
components
<<
componentData
.
at
(
i
).
toInt
(
&
ok
);
if
(
!
ok
)
if
(
!
ok
)
{
return
;
}
}
d
->
backgroundColor
=
QColor
(
components
.
at
(
0
),
components
.
at
(
1
),
components
.
at
(
2
),
components
.
at
(
3
)
);
}
...
...
entitylistview.cpp
View file @
8a2c1f7e
...
...
@@ -59,7 +59,7 @@ public:
:
mParent
(
parent
)
#ifndef QT_NO_DRAGANDDROP
,
mDragDropManager
(
new
DragDropManager
(
mParent
)
)
#endif
#endif
,
mXmlGuiClient
(
0
)
{
}
...
...
@@ -88,55 +88,61 @@ void EntityListView::Private::init()
mParent
->
connect
(
mParent
,
SIGNAL
(
doubleClicked
(
QModelIndex
)),
mParent
,
SLOT
(
itemDoubleClicked
(
QModelIndex
))
);
DelegateAnimator
*
animator
=
new
DelegateAnimator
(
mParent
);
ProgressSpinnerDelegate
*
customDelegate
=
new
ProgressSpinnerDelegate
(
animator
,
mParent
);
mParent
->
setItemDelegate
(
customDelegate
);
DelegateAnimator
*
animator
=
new
DelegateAnimator
(
mParent
);
ProgressSpinnerDelegate
*
customDelegate
=
new
ProgressSpinnerDelegate
(
animator
,
mParent
);
mParent
->
setItemDelegate
(
customDelegate
);
Control
::
widgetNeedsAkonadi
(
mParent
);
}
void
EntityListView
::
Private
::
itemClicked
(
const
QModelIndex
&
index
)
{
if
(
!
index
.
isValid
()
)
if
(
!
index
.
isValid
()
)
{
return
;
}
const
Collection
collection
=
index
.
model
()
->
data
(
index
,
EntityTreeModel
::
CollectionRole
).
value
<
Collection
>
();
if
(
collection
.
isValid
()
)
{
emit
mParent
->
clicked
(
collection
);
}
else
{
const
Item
item
=
index
.
model
()
->
data
(
index
,
EntityTreeModel
::
ItemRole
).
value
<
Item
>
();
if
(
item
.
isValid
()
)
if
(
item
.
isValid
()
)
{
emit
mParent
->
clicked
(
item
);
}
}
}
void
EntityListView
::
Private
::
itemDoubleClicked
(
const
QModelIndex
&
index
)
{
if
(
!
index
.
isValid
()
)
if
(
!
index
.
isValid
()
)
{
return
;
}
const
Collection
collection
=
index
.
model
()
->
data
(
index
,
EntityTreeModel
::
CollectionRole
).
value
<
Collection
>
();
if
(
collection
.
isValid
()
)
{
emit
mParent
->
doubleClicked
(
collection
);
}
else
{
const
Item
item
=
index
.
model
()
->
data
(
index
,
EntityTreeModel
::
ItemRole
).
value
<
Item
>
();
if
(
item
.
isValid
()
)
if
(
item
.
isValid
()
)
{
emit
mParent
->
doubleClicked
(
item
);
}
}
}
void
EntityListView
::
Private
::
itemCurrentChanged
(
const
QModelIndex
&
index
)
{
if
(
!
index
.
isValid
()
)
if
(
!
index
.
isValid
()
)
{
return
;
}
const
Collection
collection
=
index
.
model
()
->
data
(
index
,
EntityTreeModel
::
CollectionRole
).
value
<
Collection
>
();
if
(
collection
.
isValid
()
)
{
emit
mParent
->
currentChanged
(
collection
);
}
else
{
const
Item
item
=
index
.
model
()
->
data
(
index
,
EntityTreeModel
::
ItemRole
).
value
<
Item
>
();
if
(
item
.
isValid
()
)
if
(
item
.
isValid
()
)
{
emit
mParent
->
currentChanged
(
item
);
}
}
}
...
...
@@ -178,7 +184,8 @@ void EntityListView::setModel( QAbstractItemModel * model )
#ifndef QT_NO_DRAGANDDROP
void
EntityListView
::
dragMoveEvent
(
QDragMoveEvent
*
event
)
{
if
(
d
->
mDragDropManager
->
dropAllowed
(
event
)
||
qobject_cast
<
Akonadi
::
FavoriteCollectionsModel
*>
(
model
()
)
)
{
if
(
d
->
mDragDropManager
->
dropAllowed
(
event
)
||
qobject_cast
<
Akonadi
::
FavoriteCollectionsModel
*>
(
model
()
)
)
{
// All urls are supported. process the event.
QListView
::
dragMoveEvent
(
event
);
return
;
...
...
@@ -190,13 +197,14 @@ void EntityListView::dragMoveEvent( QDragMoveEvent * event )
void
EntityListView
::
dropEvent
(
QDropEvent
*
event
)
{
bool
menuCanceled
=
false
;
if
(
d
->
mDragDropManager
->
processDropEvent
(
event
,
menuCanceled
)
&&
!
menuCanceled
)
{
if
(
menuCanceled
)
if
(
d
->
mDragDropManager
->
processDropEvent
(
event
,
menuCanceled
)
&&
!
menuCanceled
)
{
if
(
menuCanceled
)
{
return
;
}
QListView
::
dropEvent
(
event
);
}
else
if
(
qobject_cast
<
Akonadi
::
FavoriteCollectionsModel
*>
(
model
()
)
&&!
menuCanceled
)
{
}
else
if
(
qobject_cast
<
Akonadi
::
FavoriteCollectionsModel
*>
(
model
()
)
&&
!
menuCanceled
)
{
QListView
::
dropEvent
(
event
);
}
}
...
...
@@ -205,8 +213,9 @@ void EntityListView::dropEvent( QDropEvent * event )
#ifndef QT_NO_CONTEXTMENU
void
EntityListView
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
{
if
(
!
d
->
mXmlGuiClient
)
if
(
!
d
->
mXmlGuiClient
)
{
return
;
}
const
QModelIndex
index
=
indexAt
(
event
->
pos
()
);
...
...
@@ -219,11 +228,12 @@ void EntityListView::contextMenuEvent( QContextMenuEvent * event )
QLatin1String
(
"akonadi_favoriteview_contextmenu"
),
d
->
mXmlGuiClient
)
);
}
else
{
popup
=
static_cast
<
QMenu
*>
(
d
->
mXmlGuiClient
->
factory
()
->
container
(
QLatin1String
(
"akonadi_favoriteview_emptyselection_contextmenu"
),
d
->
mXmlGuiClient
)
);
QLatin1String
(
"akonadi_favoriteview_emptyselection_contextmenu"
),
d
->
mXmlGuiClient
)
);
}
if
(
popup
)
if
(
popup
)
{
popup
->
exec
(
event
->
globalPos
()
);
}
}
#endif
...
...
entitylistview.h
View file @
8a2c1f7e
...
...
@@ -189,7 +189,7 @@ class AKONADI_EXPORT EntityListView : public QListView
#ifndef QT_NO_CONTEXTMENU
virtual
void
contextMenuEvent
(
QContextMenuEvent
*
event
);
#endif
private:
//@cond PRIVATE
class
Private
;
...
...
entitymimetypefiltermodel.cpp
View file @
8a2c1f7e
...
...
@@ -45,7 +45,7 @@ class EntityMimeTypeFilterModelPrivate
{
}
Q_DECLARE_PUBLIC
(
EntityMimeTypeFilterModel
)
Q_DECLARE_PUBLIC
(
EntityMimeTypeFilterModel
)
EntityMimeTypeFilterModel
*
q_ptr
;
QStringList
includedMimeTypes
;
...
...
@@ -71,43 +71,44 @@ EntityMimeTypeFilterModel::~EntityMimeTypeFilterModel()
void
EntityMimeTypeFilterModel
::
addMimeTypeInclusionFilters
(
const
QStringList
&
typeList
)
{
Q_D
(
EntityMimeTypeFilterModel
);
Q_D
(
EntityMimeTypeFilterModel
);
d
->
includedMimeTypes
<<
typeList
;
invalidateFilter
();
}
void
EntityMimeTypeFilterModel
::
addMimeTypeExclusionFilters
(
const
QStringList
&
typeList
)
{
Q_D
(
EntityMimeTypeFilterModel
);
Q_D
(
EntityMimeTypeFilterModel
);
d
->
excludedMimeTypes
<<
typeList
;
invalidateFilter
();
}
void
EntityMimeTypeFilterModel
::
addMimeTypeInclusionFilter
(
const
QString
&
type
)
{
Q_D
(
EntityMimeTypeFilterModel
);
Q_D
(
EntityMimeTypeFilterModel
);
d
->
includedMimeTypes
<<
type
;
invalidateFilter
();
}
void
EntityMimeTypeFilterModel
::
addMimeTypeExclusionFilter
(
const
QString
&
type
)
{
Q_D
(
EntityMimeTypeFilterModel
);
Q_D
(
EntityMimeTypeFilterModel
);
d
->
excludedMimeTypes
<<
type
;
invalidateFilter
();
}
bool
EntityMimeTypeFilterModel
::
filterAcceptsColumn
(
int
sourceColumn
,
const
QModelIndex
&
sourceParent
)
const
{
if
(
sourceColumn
>=
columnCount
(
mapFromSource
(
sourceParent
)))
if
(
sourceColumn
>=
columnCount
(
mapFromSource
(
sourceParent
)
)
)
{
return
false
;
}
return
QSortFilterProxyModel
::
filterAcceptsColumn
(
sourceColumn
,
sourceParent
);
}
bool
EntityMimeTypeFilterModel
::
filterAcceptsRow
(
int
sourceRow
,
const
QModelIndex
&
sourceParent
)
const
{
Q_D
(
const
EntityMimeTypeFilterModel
);
const
QModelIndex
idx
=
sourceModel
()
->
index
(
sourceRow
,
0
,
sourceParent
);
Q_D
(
const
EntityMimeTypeFilterModel
);
const
QModelIndex
idx
=
sourceModel
()
->
index
(
sourceRow
,
0
,
sourceParent
);
const
Akonadi
::
Item
item
=
idx
.
data
(
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
...
...
@@ -118,29 +119,32 @@ bool EntityMimeTypeFilterModel::filterAcceptsRow( int sourceRow, const QModelInd
const
QString
rowMimetype
=
idx
.
data
(
EntityTreeModel
::
MimeTypeRole
).
toString
();
if
(
d
->
excludedMimeTypes
.
contains
(
rowMimetype
)
)
if
(
d
->
excludedMimeTypes
.
contains
(
rowMimetype
)
)
{
return
false
;
if
(
d
->
includedMimeTypes
.
isEmpty
()
||
d
->
includedMimeTypes
.
contains
(
rowMimetype
)
)
}
if
(
d
->
includedMimeTypes
.
isEmpty
()
||
d
->
includedMimeTypes
.
contains
(
rowMimetype
)
)
{
return
true
;
}
return
false
;
}