本文整理汇总了C++中kio::TransferJob::setUiDelegate方法的典型用法代码示例。如果您正苦于以下问题:C++ TransferJob::setUiDelegate方法的具体用法?C++ TransferJob::setUiDelegate怎么用?C++ TransferJob::setUiDelegate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kio::TransferJob
的用法示例。
在下文中一共展示了TransferJob::setUiDelegate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: putAndGet
void JobRemoteTest::putAndGet()
{
const QString filePath = remoteTmpDir() + "putAndGetFile";
KUrl u(filePath);
KIO::TransferJob* job = KIO::put( u, 0600, KIO::Overwrite | KIO::HideProgressInfo );
QDateTime mtime = QDateTime::currentDateTime().addSecs( -30 ); // 30 seconds ago
mtime.setTime_t(mtime.toTime_t()); // hack for losing the milliseconds
job->setModificationTime(mtime);
job->setUiDelegate( 0 );
connect( job, SIGNAL( result(KJob*) ),
this, SLOT( slotResult(KJob*) ) );
connect( job, SIGNAL(dataReq(KIO::Job*, QByteArray&)),
this, SLOT(slotDataReq(KIO::Job*, QByteArray&)) );
m_result = -1;
m_dataReqCount = 0;
enterLoop();
QVERIFY( m_result == 0 ); // no error
m_result = -1;
KIO::StoredTransferJob* getJob = KIO::storedGet( u, KIO::NoReload, KIO::HideProgressInfo );
getJob->setUiDelegate( 0 );
connect( getJob, SIGNAL( result( KJob* ) ),
this, SLOT( slotGetResult( KJob* ) ) );
enterLoop();
QCOMPARE( m_result, 0 ); // no error
QCOMPARE( m_data, QByteArray("This is a test for KIO::put()\n") );
//QCOMPARE( m_data.size(), 11 );
}
示例2: doIt
bool ClientApp::doIt()
{
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
const int argc = args->count();
checkArgumentCount(argc, 1, 0);
if ( !args->isSet( "ninteractive" ) ) {
s_interactive = false;
s_jobFlags = KIO::HideProgressInfo;
}
#if !defined(KIOCLIENT_AS_KDEOPEN)
if (args->isSet("overwrite")) {
s_jobFlags |= KIO::Overwrite;
}
#endif
kDebug() << "Creating ClientApp";
int fake_argc = 0;
char** fake_argv = 0;
ClientApp app( fake_argc, fake_argv );
KComponentData componentData("kioclient"); // needed by KIO's internal use of KConfig
app.setApplicationName(componentData.componentName());
KGlobal::ref();
KGlobal::setAllowQuit(true);
// KIO needs dbus (for uiserver communication)
extern void qDBusBindToApplication();
qDBusBindToApplication();
if (!QDBusConnection::sessionBus().isConnected())
kFatal(101) << "Session bus not found" ;
#ifdef KIOCLIENT_AS_KDEOPEN
return app.kde_open(args->url(0), QByteArray(), false);
#elif defined(KIOCLIENT_AS_KDECP)
checkArgumentCount(argc, 2, 0);
return app.doCopy(0);
#elif defined(KIOCLIENT_AS_KDEMV)
checkArgumentCount(argc, 2, 0);
return app.doMove(0);
#else
// Normal kioclient mode
const QByteArray command = args->arg(0).toLocal8Bit();
if ( command == "openProperties" )
{
checkArgumentCount(argc, 2, 2); // openProperties <url>
KPropertiesDialog * p = new KPropertiesDialog( args->url(1), 0 /*no parent*/ );
QObject::connect( p, SIGNAL( destroyed() ), &app, SLOT( quit() ));
QObject::connect( p, SIGNAL( canceled() ), &app, SLOT( slotDialogCanceled() ));
p->show();
app.exec();
return m_ok;
}
else if ( command == "cat" )
{
checkArgumentCount(argc, 2, 2); // cat <url>
KIO::TransferJob* job = KIO::get(args->url(1), KIO::NoReload, s_jobFlags);
if ( !s_interactive )
job->setUiDelegate( 0 );
connect(job, SIGNAL(data(KIO::Job*,QByteArray) ), &app, SLOT(slotPrintData(KIO::Job*,QByteArray)));
connect( job, SIGNAL( result( KJob * ) ), &app, SLOT( slotResult( KJob * ) ) );
app.exec();
return m_ok;
}