[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/runtime/resources/kolabproxy
From:       Sergio Luis Martins <iamsergio () gmail ! com>
Date:       2010-11-20 17:41:31
Message-ID: 20101120174131.62285AC8A0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1199119 by smartins:

Store the respective imap collection inside the handler so we can ignore conflict \
resolution if we don't have enough ACLs.

 M  +1 -1      addressbookhandler.cpp  
 M  +1 -1      addressbookhandler.h  
 M  +1 -1      calendarhandler.cpp  
 M  +1 -1      calendarhandler.h  
 M  +8 -8      incidencehandler.cpp  
 M  +1 -1      incidencehandler.h  
 M  +1 -1      journalhandler.cpp  
 M  +1 -1      journalhandler.h  
 M  +8 -8      kolabhandler.cpp  
 M  +4 -7      kolabhandler.h  
 M  +2 -1      kolabproxyresource.cpp  
 M  +1 -1      notehandler.cpp  
 M  +1 -1      notehandler.h  
 M  +1 -1      taskshandler.cpp  
 M  +1 -1      taskshandler.h  
 M  +2 -2      tests/kolabconvertertest.cpp  


--- trunk/KDE/kdepim/runtime/resources/kolabproxy/addressbookhandler.cpp \
#1199118:1199119 @@ -30,7 +30,7 @@
 #include <QBuffer>
 
 
-AddressBookHandler::AddressBookHandler(): KolabHandler()
+AddressBookHandler::AddressBookHandler( const Akonadi::Collection &imapCollection ) \
: KolabHandler( imapCollection )  {
   m_mimeType = "application/x-vnd.kolab.contact";
 }
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/addressbookhandler.h \
#1199118:1199119 @@ -39,7 +39,7 @@
 */
 class AddressBookHandler : public KolabHandler {
 public:
-    AddressBookHandler();
+    explicit AddressBookHandler( const Akonadi::Collection &imapCollection );
 
     virtual ~AddressBookHandler();
 
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/calendarhandler.cpp \
#1199118:1199119 @@ -32,7 +32,7 @@
 #include <QDomDocument>
 
 
-CalendarHandler::CalendarHandler()  : IncidenceHandler()
+CalendarHandler::CalendarHandler( const Akonadi::Collection &imapCollection ) : \
IncidenceHandler( imapCollection )  {
   m_mimeType = "application/x-vnd.kolab.event";
 }
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/calendarhandler.h #1199118:1199119
@@ -29,7 +29,7 @@
 class CalendarHandler : public IncidenceHandler {
   Q_OBJECT
 public:
-  CalendarHandler();
+  explicit CalendarHandler( const Akonadi::Collection &imapCollection );
   virtual ~CalendarHandler();
   virtual QStringList contentMimeTypes();
   virtual QString iconName() const;
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/incidencehandler.cpp \
#1199118:1199119 @@ -38,11 +38,11 @@
 #include <QDomDocument>
 
 
-IncidenceHandler::IncidenceHandler() : KolabHandler(), m_calendar( \
QString::fromLatin1("UTC") ) +IncidenceHandler::IncidenceHandler( const \
Akonadi::Collection &imapCollection ) +  : KolabHandler( imapCollection), m_calendar( \
QString::fromLatin1("UTC") )  {
 }
 
-
 IncidenceHandler::~IncidenceHandler()
 {
 }
@@ -69,21 +69,21 @@
                  << " for imap item id = " << item.id()
                  << " and the other imap item id is "
                  << storedItem.id << "; imap collection is "
-                 << item.parentCollection().name()
-                 << item.parentCollection().id()
+                 << m_imapCollection.name()
+                 << m_imapCollection.id()
                  << "; collection has rights "
-                 << item.parentCollection().rights();
+                 << m_imapCollection.rights();
 
         /*
         const Akonadi::Collection::Rights requiredRights = \
                Akonadi::Collection::CanDeleteItem |
                                                            \
Akonadi::Collection::CanCreateItem;  
-        if ( ( item.parentCollection().rights() & requiredRights ) != requiredRights \
) { +        if ( ( m_imapCollection.rights() & requiredRights ) != requiredRights ) \
                {
           kDebug() << "Skipping conflict resolution, no rights on collection " << \
item.parentCollection().name();  continue;
-        }
-        */
+        }*/
 
+
         ConflictResolution res = resolveConflict(incidencePtr);
         kDebug() << "ConflictResolution " << res;
         if (res == Local) {
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/incidencehandler.h #1199118:1199119
@@ -31,7 +31,7 @@
 class IncidenceHandler : public KolabHandler {
   Q_OBJECT
 public:
-    IncidenceHandler();
+    explicit IncidenceHandler( const Akonadi::Collection &imapCollection );
 
     virtual ~IncidenceHandler();
 
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/journalhandler.cpp #1199118:1199119
@@ -29,7 +29,7 @@
 #include <QBuffer>
 #include <QDomDocument>
 
-JournalHandler::JournalHandler() : IncidenceHandler()
+JournalHandler::JournalHandler( const Akonadi::Collection &imapCollection) : \
IncidenceHandler( imapCollection )  {
   m_mimeType = "application/x-vnd.kolab.journal";
 }
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/journalhandler.h #1199118:1199119
@@ -29,7 +29,7 @@
 */
 class JournalHandler : public IncidenceHandler {
 public:
-  JournalHandler();
+  JournalHandler( const Akonadi::Collection &imapCollection );
   virtual ~JournalHandler();
 
   virtual QStringList contentMimeTypes();
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/kolabhandler.cpp #1199118:1199119
@@ -27,26 +27,26 @@
 #include <KCalCore/Todo>
 #include <KCalCore/Journal>
 
-#include <akonadi/collection.h>
 #include <kabc/addressee.h>
 
 
-KolabHandler::KolabHandler()
+KolabHandler::KolabHandler( const Akonadi::Collection &imapCollection ) : \
m_imapCollection( imapCollection )  {
 }
 
-KolabHandler *KolabHandler::createHandler(const QByteArray& type)
+KolabHandler *KolabHandler::createHandler( const QByteArray& type,
+                                           const Akonadi::Collection &imapCollection \
)  {
   if (type ==  "contact.default" || type ==  "contact") {
-    return new AddressBookHandler();
+    return new AddressBookHandler( imapCollection );
   } else if (type ==  "event.default" || type ==  "event") {
-    return new CalendarHandler();
+    return new CalendarHandler( imapCollection );
   } else if (type ==  "task.default" || type ==  "task") {
-    return new TasksHandler();
+    return new TasksHandler( imapCollection );
   } else if (type ==  "journal.default" || type ==  "journal") {
-    return new JournalHandler();
+    return new JournalHandler( imapCollection );
   } else if (type ==  "note.default" || type ==  "note") {
-    return new NotesHandler();
+    return new NotesHandler( imapCollection );
   } else {
     return 0;
   }
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/kolabhandler.h #1199118:1199119
@@ -21,20 +21,16 @@
 #define KOLABHANDLER_H
 
 #include <akonadi/item.h>
+#include <akonadi/collection.h>
 #include <kmime/kmime_message.h>
 
-
-namespace Akonadi {
-  class Collection;
-}
-
 /**
 	@author Andras Mantia <amantia@kde.org>
 */
 class KolabHandler : public QObject{
   Q_OBJECT
 public:
-  static KolabHandler *createHandler(const QByteArray& type);
+  static KolabHandler *createHandler( const QByteArray& type, const \
Akonadi::Collection &imapCollection );  
   /**
     Returns the Kolab folder type for the given collection.
@@ -77,7 +73,7 @@
     void addItemToImap(const Akonadi::Item& item, Akonadi::Entity::Id collectionId);
 
 protected:
-  explicit KolabHandler();
+  explicit KolabHandler( const Akonadi::Collection &imapCollection );
   static KMime::Content *findContentByType(const KMime::Message::Ptr &data, const \
QByteArray &type);  static KMime::Content *findContentByName(const \
KMime::Message::Ptr &data, const QString &name, QByteArray &type);  
@@ -91,6 +87,7 @@
   static KMime::Content* createAttachmentPart( const QString &mimeType, const \
QString &fileName, const QByteArray &decodedContent );  
   QByteArray m_mimeType;
+  Akonadi::Collection m_imapCollection;
 };
 
 #endif
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/kolabproxyresource.cpp \
#1199118:1199119 @@ -148,6 +148,7 @@
   ItemFetchJob *job = new ItemFetchJob( kolabToImap( collection ) );
   job->fetchScope().fetchFullPayload();
   job->fetchScope().setAncestorRetrieval( ItemFetchScope::Parent );
+
   connect(job, SIGNAL(result(KJob*)), this, SLOT(retrieveItemFetchDone(KJob *)));
 }
 
@@ -716,7 +717,7 @@
   if ( annotationsAttribute ) {
     QMap<QByteArray, QByteArray> annotations = annotationsAttribute->annotations();
 
-    KolabHandler *handler = \
KolabHandler::createHandler(annotations["/vendor/kolab/folder-type"]); +    \
KolabHandler *handler = \
KolabHandler::createHandler(annotations["/vendor/kolab/folder-type"], imapCollection \
);  if ( handler ) {
       connect(handler, SIGNAL(deleteItemFromImap(const Akonadi::Item&)), this, \
                SLOT(deleteImapItem(const Akonadi::Item&)));
       connect(handler, SIGNAL(addItemToImap(const Akonadi::Item&, \
Akonadi::Entity::Id)), this, SLOT(addImapItem(const Akonadi::Item&, \
                Akonadi::Entity::Id)));
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/notehandler.cpp #1199118:1199119
@@ -23,7 +23,7 @@
 #include <akonadi/item.h>
 #include <QStringList>
 
-NotesHandler::NotesHandler() : JournalHandler()
+NotesHandler::NotesHandler( const Akonadi::Collection &imapCollection ) : \
JournalHandler( imapCollection )  {
   m_mimeType = "application/x-vnd.kolab.note";
 }
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/notehandler.h #1199118:1199119
@@ -25,7 +25,7 @@
 class NotesHandler : public JournalHandler
 {
   public:
-    NotesHandler();
+    explicit NotesHandler( const Akonadi::Collection &imapCollection );
 
     virtual Akonadi::Item::List translateItems(const Akonadi::Item::List & \
                kolabItems);
     virtual void toKolabFormat(const Akonadi::Item& item, Akonadi::Item &imapItem);
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/taskshandler.cpp #1199118:1199119
@@ -28,7 +28,7 @@
 #include <QDomDocument>
 
 
-TasksHandler::TasksHandler() : IncidenceHandler()
+TasksHandler::TasksHandler( const Akonadi::Collection &imapCollection ) : \
IncidenceHandler( imapCollection )  {
   m_mimeType = "application/x-vnd.kolab.task";
 }
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/taskshandler.h #1199118:1199119
@@ -29,7 +29,7 @@
 */
 class TasksHandler : public IncidenceHandler {
 public:
-  TasksHandler();
+  explicit TasksHandler( const Akonadi::Collection &imapCollection );
   virtual ~TasksHandler();
   virtual QStringList contentMimeTypes();
   virtual QString iconName() const;
--- trunk/KDE/kdepim/runtime/resources/kolabproxy/tests/kolabconvertertest.cpp \
#1199118:1199119 @@ -160,7 +160,7 @@
       QFETCH( QString, vcardFileName );
       QFETCH( QString, mimeFileName );
 
-      KolabHandler *handler = KolabHandler::createHandler( "contact" );
+      KolabHandler *handler = KolabHandler::createHandler( "contact", Collection() \
);  QVERIFY( handler );
 
       // mime -> vcard conversion
@@ -229,7 +229,7 @@
       QFETCH( QString, icalFileName );
       QFETCH( QString, mimeFileName );
 
-      KolabHandler *handler = KolabHandler::createHandler( type.toLatin1() );
+      KolabHandler *handler = KolabHandler::createHandler( type.toLatin1(), \
Collection() );  QVERIFY( handler );
 
       // mime -> vcard conversion


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic