[KimDaBa] Problem with the import function

Jean-Michel FAYARD jmfayard at gmail.com
Thu Oct 14 17:03:50 BST 2004


Jesper, if I´m not mistaken, it is currently impossible to do this
with KimDaBa : UserA take the picture, share its .kim file, UserB
improve it ( he volunteers to enter persons, locations, keywords,
....) and give it back to User A


User A : 
  - launch kimdaba, import the pictures with the "Digital Camera" plugin
  - does not want / does not have the time to set Persons, Locations, Keywords
  - select those pictures
  - export as .kim file
  - How to handle images : include in .kim file
  - send the .kim file to userB

User B :
   - launch kimdaba, import the .kim file
   - set Persons, Keywords, Locations, ...
   - export as .kim file
   - How to handle images : manual copy next to .kim file
   - he DOES NOT copy the pictures, since he wants to send them to
user A which has the pictures already. It would be a waste of bandwith
   - send the .kim file without the pictures to UserA

User A : OK, thanks, now I have the improvment over my old .kim file
   - launch kimdaba, import the .kim file
   - next > next > next
   - the import function try to copy the files that are not here. The
application is blocked because the progress bar never gets updated and
ends.


WISH : when the pictures are not present, the import function should
just merge the information in the database.  Maybe the pictures are
already in the database, a scan of the disk will find them thanks to
the md5sum, maybe the user will copy them after, let them be images
not on disk.



The problem is im import.cpp : 

void Import::copyNextFromExternal()
{
    ImageInfo* info = _pendingCopies.at(0);
    _pendingCopies.remove((uint)0);
    QString fileName = info->fileName( true );
    KURL src1 = _kimFile;
    KURL src2 = _baseUrl + QString::fromLatin1( "/" );
    for ( int i = 0; i < 2; ++i ) {
        KURL src = src1;
        if ( i == 1 )
            src = src2;

        src.setFileName( fileName );
        if ( KIO::NetAccess::exists( src, true, MainView::theMainView() ) ) {
            KURL dest;
            dest.setPath( Options::instance()->imageDirectory() +
_nameMap[fileName] );
            _job = KIO::file_copy( src, dest, -1, false, false, false );
            connect( _job, SIGNAL( result( KIO::Job* ) ), this, SLOT(
aCopyJobCompleted( KIO::Job* ) ) );
            break;
        }
         // HERE, it lacks something, the progress bar is not updated,
deleted, ...
    }
}


void Import::aCopyJobCompleted( KIO::Job* job )
{
    // TODO: we never enter here if the pictures are not present
    if ( job->error() ) {
        job->showErrorDialog( 0 );
        deleteLater();
        delete _progress;
    }
    else if ( _pendingCopies.count() == 0 ) {
        updateDB();
        deleteLater();
        delete _progress;
    }
    else if ( _progress->wasCanceled() ) {
        deleteLater();
        delete _progress;
    }
    else {
        _progress->setProgress( ++_totalCopied ); // TODO :
setProgress ( _totalCopied + _totalMergedInDatabase
        copyNextFromExternal();
    }
}



More information about the Kphotoalbum mailing list