本文整理汇总了C++中kio::CopyJob::setUiDelegate方法的典型用法代码示例。如果您正苦于以下问题:C++ CopyJob::setUiDelegate方法的具体用法?C++ CopyJob::setUiDelegate怎么用?C++ CopyJob::setUiDelegate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kio::CopyJob
的用法示例。
在下文中一共展示了CopyJob::setUiDelegate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testMoveFiles
void FileUndoManagerTest::testMoveFiles()
{
kDebug() ;
const QString destdir = destDir();
KUrl::List lst = sourceList();
const KUrl d( destdir );
KIO::CopyJob* job = KIO::move( lst, d, KIO::HideProgressInfo );
job->setUiDelegate( 0 );
FileUndoManager::self()->recordCopyJob(job);
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
QVERIFY( ok );
QVERIFY( !QFile::exists( srcFile() ) ); // the source moved
QVERIFY( QFile::exists( destFile() ) );
#ifndef Q_WS_WIN
QVERIFY( !QFileInfo( srcLink() ).isSymLink() );
// Don't use QFile::exists, it's a broken symlink...
QVERIFY( QFileInfo( destLink() ).isSymLink() );
#endif
doUndo();
QVERIFY( QFile::exists( srcFile() ) ); // the source is back
QVERIFY( !QFile::exists( destFile() ) );
#ifndef Q_WS_WIN
QVERIFY( QFileInfo( srcLink() ).isSymLink() );
QVERIFY( !QFileInfo( destLink() ).isSymLink() );
#endif
}
示例2: testModifyFileBeforeUndo
void FileUndoManagerTest::testModifyFileBeforeUndo()
{
// based on testCopyDirectory (so that we check that it works for files in subdirs too)
const QString destdir = destDir();
KUrl::List lst; lst << srcSubDir();
const KUrl d( destdir );
KIO::CopyJob* job = KIO::copy( lst, d, KIO::HideProgressInfo );
job->setUiDelegate( 0 );
FileUndoManager::self()->recordCopyJob(job);
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
QVERIFY( ok );
checkTestDirectory( srcSubDir() ); // src untouched
checkTestDirectory( destSubDir() );
const QString destFile = destSubDir() + "/fileindir";
setTimeStamp( destFile ); // simulate a modification of the file
doUndo();
// Check that TestUiInterface::copiedFileWasModified got called
QCOMPARE( m_uiInterface->dest().toLocalFile(), destFile );
checkTestDirectory( srcSubDir() );
QVERIFY( !QFile::exists( destSubDir() ) );
}
示例3: launchQuery
void DBPediaQuery::launchQuery(const QString &query, const QString &requestKey)
{
//Construct dbpedia url
QString dbPediaSPARQL = QString(QUrl::toPercentEncoding(query));
QString dbPediaUrlString= QString("http://dbpedia.org/sparql/?format=application/xml&query=%1").arg(dbPediaSPARQL);
KUrl dbPediaUrl = KUrl(dbPediaUrlString);
//Add query url to request collection
m_requests.insert(requestKey, dbPediaUrl);
//Prepare download target location
QString targetFileName = QString("bangarang/%1.tmp")
.arg(QDateTime::currentDateTime().toString("yyyyMMddhhmmsszzz"));
KUrl dbPediaDownloadUrl = KUrl(KStandardDirs::locateLocal("data", targetFileName, true));
QFile downloadTarget(dbPediaDownloadUrl.path());
downloadTarget.remove();
//Launch query
KIO::CopyJob *copyJob = KIO::copy(dbPediaUrl, dbPediaDownloadUrl, KIO::Overwrite | KIO::HideProgressInfo);
copyJob->setAutoDelete(true);
connect (copyJob,
SIGNAL(copyingDone(KIO::Job*,KUrl,KUrl,time_t,bool,bool)),
this,
SLOT(resultsReturned(KIO::Job*,KUrl,KUrl,time_t,bool,bool)));
copyJob->setUiDelegate(0);
}
示例4: copyFromTmpToDest
void KPrHtmlExport::copyFromTmpToDest()
{
KIO::CopyJob *job = KIO::moveAs(m_tmpDirPath, m_parameters.destination);
job->setWriteIntoExistingDirectories(true);
job->setUiDelegate(new KPrHtmlExportUiDelegate);
connect(job, SIGNAL(result(KJob*)), this, SLOT(moveResult(KJob*)));
job->exec();
}
示例5: testCopyFiles
void FileUndoManagerTest::testCopyFiles()
{
kDebug() ;
// Initially inspired from JobTest::copyFileToSamePartition()
const QString destdir = destDir();
KUrl::List lst = sourceList();
const KUrl d( destdir );
KIO::CopyJob* job = KIO::copy( lst, d, KIO::HideProgressInfo );
job->setUiDelegate( 0 );
FileUndoManager::self()->recordCopyJob(job);
QSignalSpy spyUndoAvailable( FileUndoManager::self(), SIGNAL(undoAvailable(bool)) );
QVERIFY( spyUndoAvailable.isValid() );
QSignalSpy spyTextChanged( FileUndoManager::self(), SIGNAL(undoTextChanged(QString)) );
QVERIFY( spyTextChanged.isValid() );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
QVERIFY( ok );
QVERIFY( QFile::exists( destFile() ) );
#ifndef Q_WS_WIN
// Don't use QFile::exists, it's a broken symlink...
QVERIFY( QFileInfo( destLink() ).isSymLink() );
#endif
// might have to wait for dbus signal here... but this is currently disabled.
//QTest::qWait( 20 );
QVERIFY( FileUndoManager::self()->undoAvailable() );
QCOMPARE( spyUndoAvailable.count(), 1 );
QCOMPARE( spyTextChanged.count(), 1 );
m_uiInterface->clear();
m_uiInterface->setNextReplyToConfirmDeletion( false ); // act like the user didn't confirm
FileUndoManager::self()->undo();
QCOMPARE( m_uiInterface->files().count(), 1 ); // confirmDeletion was called
QCOMPARE( m_uiInterface->files()[0].url(), KUrl(destFile()).url() );
QVERIFY( QFile::exists( destFile() ) ); // nothing happened yet
// OK, now do it
m_uiInterface->clear();
m_uiInterface->setNextReplyToConfirmDeletion( true );
doUndo();
QVERIFY( !FileUndoManager::self()->undoAvailable() );
QVERIFY( spyUndoAvailable.count() >= 2 ); // it's in fact 3, due to lock/unlock emitting it as well
QCOMPARE( spyTextChanged.count(), 2 );
QCOMPARE( m_uiInterface->files().count(), 1 ); // confirmDeletion was called
QCOMPARE( m_uiInterface->files()[0].url(), KUrl(destFile()).url() );
// Check that undo worked
QVERIFY( !QFile::exists( destFile() ) );
#ifndef Q_WS_WIN
QVERIFY( !QFile::exists( destLink() ) );
QVERIFY( !QFileInfo( destLink() ).isSymLink() );
#endif
}
示例6: download
void Downloader::download(const QUrl &from, const QUrl &to)
{
if (to.isLocalFile()) {
QFile fileTarget(to.path());
fileTarget.remove();
}
KIO::CopyJob *copyJob = KIO::copyAs(from, to, KIO::Overwrite | KIO::HideProgressInfo);
copyJob->setUiDelegate(0);
copyJob->setAutoDelete(true);
connect (copyJob,
SIGNAL(copyingDone(KIO::Job*,QUrl,QUrl,time_t,bool,bool)),
this,
SLOT(copyingDone(KIO::Job*,QUrl,QUrl,time_t,bool,bool)));
}
示例7: testMoveDirectory
void FileUndoManagerTest::testMoveDirectory()
{
const QString destdir = destDir();
KUrl::List lst; lst << srcSubDir();
const KUrl d( destdir );
KIO::CopyJob* job = KIO::move( lst, d, KIO::HideProgressInfo );
job->setUiDelegate( 0 );
FileUndoManager::self()->recordCopyJob(job);
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
QVERIFY( ok );
QVERIFY( !QFile::exists( srcSubDir() ) );
checkTestDirectory( destSubDir() );
doUndo();
checkTestDirectory( srcSubDir() );
QVERIFY( !QFile::exists( destSubDir() ) );
}