本文整理汇总了C++中kio::Job::setUiDelegate方法的典型用法代码示例。如果您正苦于以下问题:C++ Job::setUiDelegate方法的具体用法?C++ Job::setUiDelegate怎么用?C++ Job::setUiDelegate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kio::Job
的用法示例。
在下文中一共展示了Job::setUiDelegate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doList
bool ClientApp::doList( int firstArg )
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KUrl dir = args->url(firstArg);
KIO::Job * job = KIO::listDir(dir, KIO::HideProgressInfo);
if ( !s_interactive )
job->setUiDelegate(0);
connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)),
SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList)));
connect(job, SIGNAL(result(KJob *)), this, SLOT(slotResult(KJob *)));
this->exec();
return m_ok;
}
示例2: doRemove
bool ClientApp::doRemove( int firstArg )
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
int argc = args->count();
KUrl::List srcLst;
for ( int i = firstArg; i < argc; i++ )
srcLst.append( args->url(i) );
KIO::Job * job = KIO::del( srcLst, s_jobFlags );
if ( !s_interactive )
job->setUiDelegate( 0 );
connect( job, SIGNAL( result( KJob * ) ), this, SLOT( slotResult( KJob * ) ) );
this->exec();
return m_ok;
}
示例3: testPasteJob
void KIOPasteTest::testPasteJob()
{
QFETCH(QList<QUrl>, urls);
QFETCH(bool, data);
QFETCH(bool, cut);
QFETCH(QString, expectedFileName);
QMimeData mimeData;
bool isDir = false;
bool isFile = false;
if (!urls.isEmpty()) {
mimeData.setUrls(urls);
QFileInfo fileInfo(urls.first().toLocalFile());
isDir = fileInfo.isDir();
isFile = fileInfo.isFile();
}
if (data) {
mimeData.setText(QStringLiteral("Hello world"));
}
KIO::setClipboardDataCut(&mimeData, cut);
QTemporaryDir destTempDir;
QVERIFY(destTempDir.isValid());
const QString destDir = destTempDir.path();
KIO::Job *job = KIO::paste(&mimeData, QUrl::fromLocalFile(destDir), KIO::HideProgressInfo);
QSignalSpy spy(job, SIGNAL(itemCreated(QUrl)));
QVERIFY(spy.isValid());
job->setUiDelegate(0);
const bool expectedSuccess = !expectedFileName.isEmpty();
QCOMPARE(job->exec(), expectedSuccess);
if (expectedSuccess) {
const QString destFile = destDir + '/' + expectedFileName;
QVERIFY2(QFile::exists(destFile), qPrintable(expectedFileName));
if (isDir) {
QVERIFY(QFileInfo(destFile).isDir());
} else {
QVERIFY(QFileInfo(destFile).isFile());
QFile file(destFile);
QVERIFY(file.open(QIODevice::ReadOnly));
QCOMPARE(QString(file.readAll()), QString("Hello world"));
}
if (cut) {
QVERIFY(!QFile::exists(urls.first().toLocalFile()));
} else {
QVERIFY(QFile::exists(urls.first().toLocalFile()));
}
QCOMPARE(spy.count(), isFile || cut ? 1 : 2);
QCOMPARE(spy.at(0).at(0).value<QUrl>().toLocalFile(), destFile);
}
}
示例4: pasteFileToOtherPartition
void pasteFileToOtherPartition()
{
const QString filePath = homeTmpDir() + "fileFromHome";
const QString dest = otherTmpDir() + "fileFromHome_copied";
QFile::remove(dest);
createTestFile( filePath );
QMimeData* mimeData = new QMimeData;
KUrl fileUrl(filePath);
fileUrl.populateMimeData(mimeData);
QApplication::clipboard()->setMimeData(mimeData);
KIO::Job* job = KIO::pasteClipboard(otherTmpDir(), static_cast<QWidget*>(0));
job->setUiDelegate(0);
bool ok = KIO::NetAccess::synchronousRun(job, 0);
QVERIFY( ok );
QVERIFY( QFile::exists( dest ) );
QVERIFY( QFile::exists( filePath ) ); // still there
}
示例5: testRenameDir
void FileUndoManagerTest::testRenameDir()
{
const KUrl oldUrl( srcSubDir() );
const KUrl newUrl( srcSubDir() + ".new" );
KUrl::List lst;
lst.append(oldUrl);
KIO::Job* job = KIO::moveAs( oldUrl, newUrl, KIO::HideProgressInfo );
job->setUiDelegate( 0 );
FileUndoManager::self()->recordJob( FileUndoManager::Rename, lst, newUrl, job );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
QVERIFY( ok );
QVERIFY( !QFile::exists( srcSubDir() ) );
QVERIFY( QFileInfo( newUrl.toLocalFile() ).isDir() );
doUndo();
QVERIFY( QFile::exists( srcSubDir() ) );
QVERIFY( !QFileInfo( newUrl.toLocalFile() ).isDir() );
}
示例6: testTrashFiles
void FileUndoManagerTest::testTrashFiles()
{
if ( !KProtocolInfo::isKnownProtocol( "trash" ) )
QSKIP( "kio_trash not installed", SkipAll );
// Trash it all at once: the file, the symlink, the subdir.
KUrl::List lst = sourceList();
lst.append( srcSubDir() );
KIO::Job* job = KIO::trash( lst, KIO::HideProgressInfo );
job->setUiDelegate( 0 );
FileUndoManager::self()->recordJob( FileUndoManager::Trash, lst, KUrl("trash:/"), job );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
QVERIFY( ok );
// Check that things got removed
QVERIFY( !QFile::exists( srcFile() ) );
#ifndef Q_WS_WIN
QVERIFY( !QFileInfo( srcLink() ).isSymLink() );
#endif
QVERIFY( !QFile::exists( srcSubDir() ) );
// check trash?
// Let's just check that it's not empty. kio_trash has its own unit tests anyway.
KConfig cfg( "trashrc", KConfig::SimpleConfig );
QVERIFY( cfg.hasGroup( "Status" ) );
QCOMPARE( cfg.group("Status").readEntry( "Empty", true ), false );
doUndo();
QVERIFY( QFile::exists( srcFile() ) );
#ifndef Q_WS_WIN
QVERIFY( QFileInfo( srcLink() ).isSymLink() );
#endif
QVERIFY( QFile::exists( srcSubDir() ) );
// We can't check that the trash is empty; other partitions might have their own trash
}
示例7: testRenameFile
void FileUndoManagerTest::testRenameFile()
{
const KUrl oldUrl( srcFile() );
const KUrl newUrl( srcFile() + ".new" );
KUrl::List lst;
lst.append(oldUrl);
QSignalSpy spyUndoAvailable( FileUndoManager::self(), SIGNAL(undoAvailable(bool)) );
QVERIFY( spyUndoAvailable.isValid() );
KIO::Job* job = KIO::moveAs( oldUrl, newUrl, KIO::HideProgressInfo );
job->setUiDelegate( 0 );
FileUndoManager::self()->recordJob( FileUndoManager::Rename, lst, newUrl, job );
bool ok = KIO::NetAccess::synchronousRun( job, 0 );
QVERIFY( ok );
QVERIFY( !QFile::exists( srcFile() ) );
QVERIFY( QFileInfo( newUrl.toLocalFile() ).isFile() );
QCOMPARE(spyUndoAvailable.count(), 1);
doUndo();
QVERIFY( QFile::exists( srcFile() ) );
QVERIFY( !QFileInfo( newUrl.toLocalFile() ).isFile() );
}
示例8: myMkdir
static bool myMkdir(const QString& pathOrUrl) {
KUrl url(pathOrUrl);
KIO::Job* job = KIO::mkdir(url, -1);
job->setUiDelegate(0);
return KIO::NetAccess::synchronousRun(job, 0);
}
示例9: myExists
static bool myExists(const QString& pathOrUrl) {
KUrl url(pathOrUrl);
KIO::Job* job = KIO::stat(url, KIO::StatJob::DestinationSide, 0, KIO::HideProgressInfo);
job->setUiDelegate(0);
return KIO::NetAccess::synchronousRun(job, 0);
}
示例10: delDir
static void delDir(const QString& pathOrUrl) {
KIO::Job* job = KIO::del(KUrl(pathOrUrl), KIO::HideProgressInfo);
job->setUiDelegate(0);
KIO::NetAccess::synchronousRun(job, 0);
}