[Kde-pim] Review Request 109208: Work harder to ensure we have a trash folder
Wolfgang Rohdewald
wolfgang at rohdewald.de
Thu Feb 28 18:50:48 GMT 2013
> On Feb. 28, 2013, 3:54 p.m., Kevin Krammer wrote:
> > I am not sure this is fixing the problem at the right location. The question is why does SpecialCollections::hasDefaultCollection()return true if there is no valid collection for the queried type
>
> Wolfgang Rohdewald wrote:
> it has an invalid default collection (negative id, no remoteId), and the function is not "hasValidDefaultCollection". But I looked closer and the patch is now simpler. SpecialCollections::defaultCollection() always returns a collection - if there is none, it returns an invalid collection (with id -1). And all collections with negative id return false for isValid().
>
> Kevin Krammer wrote:
> Well, an invalid collection is not something one would consider as a collection if you explicitly call a check function.
> Or at least I don't see any use case of first checking if there is a collection and then not getting one.
invalid collection != no collection
I do not know enough about akonadi internals but I believe those invalid collections are sort of placeholders until the database actually gives out a unique id. Have a look at the Collection constructor - passing out negative ids (meaning invalid collection) seems to be a normal use case. Changing hasDefaultCollection() (and hasCollection() to be consistent) to return only true for a valid collection is something I would not want to do - there may be places depending on current behaviour. And the API doc does not say that only valid collections should be found.
Collection::Collection() :
Entity( new CollectionPrivate )
{
Q_D( Collection );
static int lastId = -1;
d->mId = lastId--;
}
grepping for 'Collection()' finds a lot of places where such invalid collections are generated.
- Wolfgang
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/109208/#review28269
-----------------------------------------------------------
On Feb. 28, 2013, 4:45 p.m., Wolfgang Rohdewald wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/109208/
> -----------------------------------------------------------
>
> (Updated Feb. 28, 2013, 4:45 p.m.)
>
>
> Review request for KDEPIM.
>
>
> Description
> -------
>
> collection.isValid() is not enough, collection might have a negative id and no remoteId
>
>
> This addresses bugs 285532, 303117 and 307016.
> http://bugs.kde.org/show_bug.cgi?id=285532
> http://bugs.kde.org/show_bug.cgi?id=303117
> http://bugs.kde.org/show_bug.cgi?id=307016
>
>
> Diffs
> -----
>
> akonadi/specialcollectionsrequestjob.cpp 29db72f0e3bc60b0f8b9c9434151176bea44b14f
>
> Diff: http://git.reviewboard.kde.org/r/109208/diff/
>
>
> Testing
> -------
>
> removed all .local/share/akonadi* and restarted kmail. Without patch, no trash. With patch, trash is generated.
>
>
> Thanks,
>
> Wolfgang Rohdewald
>
>
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/
More information about the kde-pim
mailing list