3 * $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $
5 * This file is part of the Nepomuk KDE project.
6 * Copyright (C) 2006-2007 Sebastian Trueg <trueg@kde.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 * See the file "COPYING" for the exact licensing terms.
15 #include "modelcopyjob.h"
17 #include <Soprano/Model>
18 #include <Soprano/Error/Error>
24 Nepomuk::ModelCopyJob::ModelCopyJob( Soprano::Model
* source
, Soprano::Model
* dest
, QObject
* parent
)
30 connect( &m_timer
, SIGNAL( timeout() ),
31 this, SLOT( slotCopy() ) );
35 Nepomuk::ModelCopyJob::~ModelCopyJob()
40 void Nepomuk::ModelCopyJob::start()
43 emit
description( this, i18n( "Converting Nepomuk database" ) );
45 m_size
= m_source
->statementCount();
50 setTotalAmount( KJob::Files
, m_size
);
53 m_iterator
= m_source
->listStatements();
59 void Nepomuk::ModelCopyJob::slotCopy()
61 if ( m_iterator
.next() ) {
64 if ( m_dest
->addStatement( *m_iterator
) != Soprano::Error::ErrorNone
) {
65 kDebug() << m_dest
->lastError();
66 emit
warning( this, m_dest
->lastError().message() );
70 setProcessedAmount( KJob::Files
, m_done
);
78 setErrorText( i18n( "Some data was lost in the conversion." ) );
85 #include "modelcopyjob.moc"