On Wednesday 13 June 2012 04:29:24 Alberto Villa wrote:
> Forget it, same problem as before, just five minutes later.

I've tried reverting some 4.8.2-4.8.3 differences, because 4.8.2 was working 
for me, and it looks like something has changed. There are still some aborted 
connections, but things appear to work anyway.

Can you try rebuilding deskutils/kdepimlibs4 with attached patch and remove 
net_read_timeout from configuration?
-- 
Alberto Villa, FreeBSD committer <avi...@freebsd.org>
http://people.FreeBSD.org/~avilla

Virtue is not left to stand alone.
He who practices it will have neighbors.
                -- Confucius
diff -ruN kdepimlibs-4.8.3/akonadi/collectionsync.cpp kdepimlibs-4.8.2/akonadi/collectionsync.cpp
--- ./akonadi/collectionsync.cpp	2012-04-29 22:37:44.487124000 +0200
+++ ./akonadi/collectionsync.cpp	2011-07-30 09:08:46.000000000 +0200
@@ -111,10 +111,12 @@
     /** Create a local node from the given local collection and integrate it into the local tree structure. */
     LocalNode* createLocalNode( const Collection &col )
     {
+      if ( col.remoteId().isEmpty() ) // no remote id here means it hasn't been added to the resource yet, so we exclude it from the sync
+        return 0;
       LocalNode *node = new LocalNode( col );
       Q_ASSERT( !localUidMap.contains( col.id() ) );
       localUidMap.insert( node->collection.id(), node );
-      if ( !hierarchicalRIDs && !col.remoteId().isEmpty() )
+      if ( !hierarchicalRIDs )
         localRidMap.insert( node->collection.remoteId(), node );
 
       // add already existing children
@@ -124,8 +126,7 @@
           Q_ASSERT( localUidMap.contains( childId ) );
           LocalNode *childNode = localUidMap.value( childId );
           node->childNodes.append( childNode );
-          if ( !childNode->collection.remoteId().isEmpty() )
-            node->childRidMap.insert( childNode->collection.remoteId(), childNode );
+          node->childRidMap.insert( childNode->collection.remoteId(), childNode );
         }
       }
 
@@ -133,8 +134,7 @@
       if ( localUidMap.contains( col.parentCollection().id() ) ) {
         LocalNode* parentNode = localUidMap.value( col.parentCollection().id() );
         parentNode->childNodes.append( node );
-        if ( !node->collection.remoteId().isEmpty() )
-          parentNode->childRidMap.insert( node->collection.remoteId(), node );
+        parentNode->childRidMap.insert( node->collection.remoteId(), node );
       } else {
         localPendingCollections[ col.parentCollection().id() ].append( col.id() );
       }
@@ -179,27 +179,6 @@
     }
 
     /**
-     * Find a child node with matching collection name.
-     * @note This is used as a fallback if the resource lost the RID update somehow.
-     * This can be used because the Akonadi server enforces unique child collection names inside the hierarchy
-     */
-    LocalNode* findLocalChildNodeByName( LocalNode *localParentNode, const QString &name )
-    {
-      if ( name.isEmpty() ) // shouldn't happen...
-        return 0;
-
-      if ( localParentNode == localRoot ) // possibly non-unique names on top-level
-        return 0;
-
-      foreach ( LocalNode *childNode, localParentNode->childNodes ) {
-        // the restriction on empty RIDs can possibly removed, but for now I only understand the implication for this case
-        if ( childNode->collection.name() == name && childNode->collection.remoteId().isEmpty() )
-          return childNode;
-      }
-      return 0;
-    }
-
-    /**
       Find the local node that matches the given remote collection, returns 0
       if that doesn't exist (yet).
     */
@@ -222,16 +201,8 @@
         else
           localParent = findMatchingLocalNode( collection.parentCollection() );
 
-        if ( localParent ) {
-          if ( localParent->childRidMap.contains( collection.remoteId() ) )
-            return localParent->childRidMap.value( collection.remoteId() );
-          // check if we have a local folder with a matching name and no RID, if so let's use that one
-          // we would get an error if we don't do this anyway, as we'd try to create two sibling nodes with the same name
-          if ( LocalNode *recoveredLocalNode = findLocalChildNodeByName( localParent, collection.name() ) ) {
-            kDebug() << "Recovering collection with lost RID:" << collection << recoveredLocalNode->collection;
-            return recoveredLocalNode;
-          }
-        }
+        if ( localParent && localParent->childRidMap.contains( collection.remoteId() ) )
+          return localParent->childRidMap.value( collection.remoteId() );
         return 0;
       }
     }
@@ -316,7 +287,6 @@
     void updateLocalCollection( LocalNode *localNode, RemoteNode *remoteNode )
     {
       Collection upd( remoteNode->collection );
-      Q_ASSERT( !upd.remoteId().isEmpty() );
       upd.setId( localNode->collection.id() );
       {
         // ### HACK to work around the implicit move attempts of CollectionModifyJob
@@ -364,7 +334,6 @@
       foreach ( RemoteNode *remoteNode, remoteNodes ) {
         ++pendingJobs;
         Collection col( remoteNode->collection );
-        Q_ASSERT( !col.remoteId().isEmpty() );
         col.setParentCollection( localParent->collection );
         CollectionCreateJob *create = new CollectionCreateJob( col, q );
         create->setProperty( LOCAL_NODE, QVariant::fromValue( localParent ) );
@@ -417,21 +386,15 @@
     Collection::List findUnprocessedLocalCollections( LocalNode *localNode ) const
     {
       Collection::List rv;
+      if ( !localNode->processed && hasProcessedChildren( localNode ) ) {
+        kWarning() << "Found unprocessed local node with processed children, excluding from deletion";
+        kWarning() << localNode->collection;
+        return rv;
+      }
       if ( !localNode->processed ) {
-        if ( hasProcessedChildren( localNode ) ) {
-          kWarning() << "Found unprocessed local node with processed children, excluding from deletion";
-          kWarning() << localNode->collection;
-          return rv;
-        }
-        if ( localNode->collection.remoteId().isEmpty() ) {
-          kWarning() << "Found unprocessed local node without remoteId, excluding from deletion";
-          kWarning() << localNode->collection;
-          return rv;
-        }
         rv.append( localNode->collection );
         return rv;
       }
-
       foreach ( LocalNode *child, localNode->childNodes )
         rv.append( findUnprocessedLocalCollections( child ) );
       return rv;
@@ -456,8 +419,6 @@
     {
       q->setTotalAmount( KJob::Bytes, q->totalAmount( KJob::Bytes ) + cols.size() );
       foreach ( const Collection &col, cols ) {
-        Q_ASSERT( !col.remoteId().isEmpty() ); // empty RID -> stuff we haven't even written to the remote side yet
-
         ++pendingJobs;
         CollectionDeleteJob *job = new CollectionDeleteJob( col, q );
         connect( job, SIGNAL(result(KJob*)), q, SLOT(deleteLocalCollectionsResult(KJob*)) );
diff -ruN kdepimlibs-4.8.3/akonadi/standardactionmanager.cpp kdepimlibs-4.8.2/akonadi/standardactionmanager.cpp
--- ./akonadi/standardactionmanager.cpp	2012-04-29 22:37:44.487124000 +0200
+++ ./akonadi/standardactionmanager.cpp	2012-02-29 23:56:04.000000000 +0100
@@ -159,29 +159,6 @@
   return group.readEntry( "WorkOffline", false );
 }
 
-static QModelIndexList safeSelectedRows( QItemSelectionModel *selectionModel )
-{
-  QModelIndexList selectedRows = selectionModel->selectedRows();
-  if (!selectedRows.isEmpty())
-    return selectedRows;
-
-  // try harder for selected rows that don't span the full row for some reason (e.g. due to buggy column adding proxy models etc)
-  foreach ( const QItemSelectionRange &range, selectionModel->selection() ) {
-    if ( !range.isValid() || range.isEmpty() )
-      continue;
-    const QModelIndex parent = range.parent();
-    for ( int row = range.top(); row <= range.bottom(); ++row ) {
-      const QModelIndex index = range.model()->index( row, range.left(), parent );
-      const Qt::ItemFlags flags = range.model()->flags( index );
-      if ( (flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled) )
-        selectedRows.push_back( index );
-    }
-  }
-
-  return selectedRows;
-}
-
-
 /**
  * @internal
  */
@@ -437,17 +414,17 @@
     void encodeToClipboard( QItemSelectionModel* selectionModel, bool cut = false )
     {
       Q_ASSERT( selectionModel );
-      if ( safeSelectedRows( selectionModel ).count() <= 0 )
+      if ( selectionModel->selectedRows().count() <= 0 )
         return;
 
 #ifndef QT_NO_CLIPBOARD
-      QMimeData *mimeData = selectionModel->model()->mimeData( safeSelectedRows( selectionModel ) );
+      QMimeData *mimeData = selectionModel->model()->mimeData( selectionModel->selectedRows() );
       markCutAction( mimeData, cut );
       QApplication::clipboard()->setMimeData( mimeData );
 
       QAbstractItemModel *model = const_cast<QAbstractItemModel *>( selectionModel->model() );
 
-      foreach ( const QModelIndex &index, safeSelectedRows( selectionModel ) )
+      foreach ( const QModelIndex &index, selectionModel->selectedRows() )
         model->setData( index, true, EntityTreeModel::PendingCutRole );
 #endif
     }
@@ -457,7 +434,7 @@
       // collect all selected collections
       Collection::List selectedCollectionsList;
       if ( collectionSelectionModel ) {
-        const QModelIndexList rows = safeSelectedRows( collectionSelectionModel );
+        const QModelIndexList rows = collectionSelectionModel->selectedRows();
         foreach ( const QModelIndex &index, rows ) {
           Collection collection = index.data( EntityTreeModel::CollectionRole ).value<Collection>();
           if ( !collection.isValid() )
@@ -473,7 +450,7 @@
       // collect all selected items
       Item::List selectedItems;
       if ( itemSelectionModel ) {
-        const QModelIndexList rows = safeSelectedRows( itemSelectionModel );
+        const QModelIndexList rows = itemSelectionModel->selectedRows();
         foreach ( const QModelIndex &index, rows ) {
           Item item = index.data( EntityTreeModel::ItemRole ).value<Item>();
           if ( !item.isValid() )
@@ -610,7 +587,7 @@
 
       Q_ASSERT( collectionSelectionModel );
 
-      foreach ( const QModelIndex &index, safeSelectedRows( collectionSelectionModel ) ) {
+      foreach ( const QModelIndex &index, collectionSelectionModel->selectedRows() ) {
         Q_ASSERT( index.isValid() );
         const Collection collection = index.data( CollectionModel::CollectionRole ).value<Collection>();
         Q_ASSERT( collection.isValid() );
@@ -673,7 +650,7 @@
 
       Q_ASSERT( itemSelectionModel );
 
-      foreach ( const QModelIndex &index, safeSelectedRows( itemSelectionModel ) ) {
+      foreach ( const QModelIndex &index, itemSelectionModel->selectedRows() ) {
         Q_ASSERT( index.isValid() );
         const Item item = index.data( ItemModel::ItemRole ).value<Item>();
         Q_ASSERT( item.isValid() );
@@ -749,7 +726,7 @@
     void slotSynchronizeCollection()
     {
       Q_ASSERT( collectionSelectionModel );
-      const QModelIndexList list = safeSelectedRows( collectionSelectionModel );
+      const QModelIndexList list = collectionSelectionModel->selectedRows();
       if ( list.isEmpty() )
         return;
 
@@ -765,7 +742,7 @@
     void slotSynchronizeCollectionRecursive()
     {
       Q_ASSERT( collectionSelectionModel );
-      const QModelIndexList list = safeSelectedRows( collectionSelectionModel );
+      const QModelIndexList list = collectionSelectionModel->selectedRows();
       if ( list.isEmpty() )
         return;
 
@@ -780,7 +757,7 @@
 
     void slotCollectionProperties()
     {
-      const QModelIndexList list = safeSelectedRows( collectionSelectionModel );
+      const QModelIndexList list = collectionSelectionModel->selectedRows();
       if ( list.isEmpty() )
         return;
 
@@ -812,7 +789,7 @@
     {
       Q_ASSERT( collectionSelectionModel );
 
-      const QModelIndexList list = safeSelectedRows( collectionSelectionModel );
+      const QModelIndexList list = collectionSelectionModel->selectedRows();
       if ( list.isEmpty() )
         return;
 
@@ -834,7 +811,7 @@
       Q_ASSERT( itemSelectionModel );
 
       Item::List items;
-      foreach ( const QModelIndex &index, safeSelectedRows( itemSelectionModel ) ) {
+      foreach ( const QModelIndex &index, itemSelectionModel->selectedRows() ) {
         bool ok;
         const qlonglong id = index.data( ItemModel::IdRole ).toLongLong( &ok );
         Q_ASSERT( ok );
@@ -874,7 +851,7 @@
     {
       Q_ASSERT( collectionSelectionModel );
       Q_ASSERT( favoritesModel );
-      const QModelIndexList list = safeSelectedRows( collectionSelectionModel );
+      const QModelIndexList list = collectionSelectionModel->selectedRows();
       if ( list.isEmpty() )
         return;
 
@@ -893,7 +870,7 @@
     {
       Q_ASSERT( collectionSelectionModel );
       Q_ASSERT( favoritesModel );
-      const QModelIndexList list = safeSelectedRows( collectionSelectionModel );
+      const QModelIndexList list = collectionSelectionModel->selectedRows();
       if ( list.isEmpty() )
         return;
 
@@ -912,7 +889,7 @@
     {
       Q_ASSERT( collectionSelectionModel );
       Q_ASSERT( favoritesModel );
-      const QModelIndexList list = safeSelectedRows( collectionSelectionModel );
+      const QModelIndexList list = collectionSelectionModel->selectedRows();
       if ( list.isEmpty() )
         return;
       const QModelIndex index = list.first();
@@ -1100,7 +1077,7 @@
         if ( !index.isValid() )
           return;
 
-        const QMimeData *mimeData = selectionModel->model()->mimeData( safeSelectedRows( selectionModel ) );
+        const QMimeData *mimeData = selectionModel->model()->mimeData( selectionModel->selectedRows() );
 
         QAbstractItemModel *model = const_cast<QAbstractItemModel *>( index.model() );
         model->dropMimeData( mimeData, dropAction, -1, -1, index );
@@ -1112,7 +1089,7 @@
       Q_ASSERT( selectionModel );
       Q_ASSERT( action );
 
-      if ( safeSelectedRows( selectionModel ).count() <= 0 )
+      if ( selectionModel->selectedRows().count() <= 0 )
         return;
 
       const QMimeData *mimeData = selectionModel->model()->mimeData( selectionModel->selectedRows() );
@@ -1212,13 +1189,13 @@
       const bool isCollectionAction = ( type == CopyCollectionToMenu || type == MoveCollectionToMenu );
 
       if ( isItemAction ) {
-        list = safeSelectedRows( itemSelectionModel );
+        list = itemSelectionModel->selectedRows();
         foreach ( const QModelIndex &index, list )
           mimeTypes << index.data( EntityTreeModel::MimeTypeRole ).toString();
       }
 
       if ( isCollectionAction ) {
-        list = safeSelectedRows( collectionSelectionModel );
+        list = collectionSelectionModel->selectedRows();
         foreach ( const QModelIndex &index, list ) {
           const Collection collection = index.data( EntityTreeModel::CollectionRole ).value<Collection>();
 
@@ -1590,7 +1567,7 @@
   if ( !d->collectionSelectionModel )
     return collections;
 
-  foreach ( const QModelIndex &index, safeSelectedRows( d->collectionSelectionModel ) ) {
+  foreach ( const QModelIndex &index, d->collectionSelectionModel->selectedRows() ) {
     const Collection collection = index.data( EntityTreeModel::CollectionRole ).value<Collection>();
     if ( collection.isValid() )
       collections << collection;
@@ -1606,7 +1583,7 @@
   if ( !d->itemSelectionModel )
     return items;
 
-  foreach ( const QModelIndex &index, safeSelectedRows( d->itemSelectionModel ) ) {
+  foreach ( const QModelIndex &index, d->itemSelectionModel->selectedRows() ) {
     const Item item = index.data( EntityTreeModel::ItemRole ).value<Item>();
     if ( item.isValid() )
       items << item;

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
kde-freebsd mailing list
kde-freebsd@kde.org
https://mail.kde.org/mailman/listinfo/kde-freebsd
See also http://freebsd.kde.org/ for latest information

Reply via email to