本文整理汇总了C++中kio::CopyJob::errorText方法的典型用法代码示例。如果您正苦于以下问题:C++ CopyJob::errorText方法的具体用法?C++ CopyJob::errorText怎么用?C++ CopyJob::errorText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kio::CopyJob
的用法示例。
在下文中一共展示了CopyJob::errorText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotRunApp
void KIOExec::slotRunApp()
{
if ( fileList.isEmpty() ) {
qDebug() << "No files downloaded -> exiting";
mExited = true;
QApplication::exit(1);
return;
}
KService service(QStringLiteral("dummy"), command, QString());
QList<QUrl> list;
// Store modification times
QList<FileInfo>::Iterator it = fileList.begin();
for ( ; it != fileList.end() ; ++it )
{
QFileInfo info(QFile::encodeName(it->path));
it->time = info.lastModified();
QUrl url = QUrl::fromLocalFile(it->path);
list << url;
}
KIO::DesktopExecParser execParser(service, list);
QStringList params = execParser.resultingArguments();
qDebug() << "EXEC " << params.join(QStringLiteral(" "));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
// propagate the startup identification to the started process
KStartupInfoId id;
QByteArray startupId;
#if HAVE_X11
if (QX11Info::isPlatformX11()) {
startupId = QX11Info::nextStartupId();
}
#endif
id.initId(startupId);
id.setupStartupEnv();
#endif
QString exe( params.takeFirst() );
const int exit_code = QProcess::execute( exe, params );
#if (QT_VERSION >= QT_VERSION_CHECK(5, 4, 0))
KStartupInfo::resetStartupEnv();
#endif
qDebug() << "EXEC done";
// Test whether one of the files changed
for(it = fileList.begin(); it != fileList.end(); ++it )
{
QString src = it->path;
const QUrl dest = it->url;
QFileInfo info(src);
if ( info.exists() && (it->time != info.lastModified()) )
{
if ( mTempFiles )
{
if ( KMessageBox::questionYesNo( 0L,
i18n( "The supposedly temporary file\n%1\nhas been modified.\nDo you still want to delete it?", dest.toDisplayString(QUrl::PreferLocalFile)),
i18n( "File Changed" ), KStandardGuiItem::del(), KGuiItem(i18n("Do Not Delete")) ) != KMessageBox::Yes )
continue; // don't delete the temp file
}
else if ( ! dest.isLocalFile() ) // no upload when it's already a local file
{
if ( KMessageBox::questionYesNo( 0L,
i18n( "The file\n%1\nhas been modified.\nDo you want to upload the changes?" , dest.toDisplayString()),
i18n( "File Changed" ), KGuiItem(i18n("Upload")), KGuiItem(i18n("Do Not Upload")) ) == KMessageBox::Yes )
{
qDebug() << "src='" << src << "' dest='" << dest << "'";
// Do it the synchronous way.
KIO::CopyJob* job = KIO::copy(QUrl::fromLocalFile(src), dest);
if ( !job->exec() )
{
KMessageBox::error( 0L, job->errorText() );
continue; // don't delete the temp file
}
}
}
}
if ((!dest.isLocalFile() || mTempFiles) && exit_code == 0) {
// Wait for a reasonable time so that even if the application forks on startup (like OOo or amarok)
// it will have time to start up and read the file before it gets deleted. #130709.
qDebug() << "sleeping...";
QThread::currentThread()->sleep(180); // 3 mn
qDebug() << "about to delete " << src;
QFile( QFile::encodeName(src) ).remove();
}
}
mExited = true;
QApplication::exit(exit_code);
}