[Kde-pim] Review Request: Akonadi: helper class for common MIME type checks

Kevin Krammer kevin.krammer at gmx.at
Sun Feb 15 11:51:35 GMT 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/78/
-----------------------------------------------------------

(Updated 2009-02-15 03:51:35.650611)


Review request for KDE PIM.


Changes
-------

During deploying the class in kdepim I found that there is a very common use case for checking against one single MIME type, sometimes in addition to checking for a list, e.g. filtering to Addressee and ContactGroup, then special casing ContactGroup.

Therefore I add two additional convenience methods:
static bool isWantedItem( const Item &item, const QString &wantedMimeType );

static bool isWantedCollection( const Collection &collection, const QString &wantedMimeType );

Also added them to the unit test


Summary
-------

MIME types can have aliases and be inherited from a parent MIME type thus checking for string equality will not always give the correct result.

Correct checking is provided by KMimeType, however instead of requiring that every client implements its own "is this my type of collection" check, this new helper class provides convenience methods for the common check Akonadi clients will face.


Diffs (updated)
-----

  /trunk/KDE/kdepimlibs/akonadi/CMakeLists.txt 926410 
  /trunk/KDE/kdepimlibs/akonadi/collectionfilterproxymodel.cpp 926410 
  /trunk/KDE/kdepimlibs/akonadi/mimetypechecker.h PRE-CREATION 
  /trunk/KDE/kdepimlibs/akonadi/mimetypechecker.cpp PRE-CREATION 
  /trunk/KDE/kdepimlibs/akonadi/mimetypechecker_p.h PRE-CREATION 
  /trunk/KDE/kdepimlibs/akonadi/tests/CMakeLists.txt 926410 
  /trunk/KDE/kdepimlibs/akonadi/tests/mimetypecheckertest.h PRE-CREATION 
  /trunk/KDE/kdepimlibs/akonadi/tests/mimetypecheckertest.cpp PRE-CREATION 

Diff: http://reviewboard.kde.org/r/78/diff


Testing
-------

Unit tested. Included in patch


Thanks,

Kevin

_______________________________________________
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