void KeyGenerator::slotStartKeyGeneration() { QString params = "<GnupgKeyParms format=\"internal\">\n"; for ( int i = 0 ; i < numKeyParams ; ++i ) if ( mLineEdits[i] && !mLineEdits[i]->text().trimmed().isEmpty() ) params += keyParams[i] + ( ": " + mLineEdits[i]->text().trimmed() ) + '\n'; params += "</GnupgKeyParms>\n"; const Kleo::CryptoBackend::Protocol * proto = 0; if(protocol) { proto = !strcmp( protocol, "openpgp" ) ? Kleo::CryptoBackendFactory::instance()->openpgp() : Kleo::CryptoBackendFactory::instance()->smime() ; } if ( !proto ) proto = Kleo::CryptoBackendFactory::instance()->smime(); assert( proto ); kDebug(5150) <<"Using protocol" << proto->name(); Kleo::KeyGenerationJob * job = proto->keyGenerationJob(); assert( job ); connect( job, SIGNAL(result(GpgME::KeyGenerationResult,QByteArray)), SLOT(slotResult(GpgME::KeyGenerationResult,QByteArray)) ); const GpgME::Error err = job->start( params ); if ( err ) showError( err ); #ifndef LIBKLEO_NO_PROGRESSDIALOG else (void)new Kleo::ProgressDialog( job, "Generating key", this ); #endif }
void FbTalker::logout() { if (m_job) { m_job->kill(); m_job = 0; } emit signalBusy(true); QMap<QString, QString> args; args["access_token"] = m_accessToken; QByteArray tmp(getCallString(args).toUtf8()); KIO::TransferJob* job = KIO::http_post(KUrl(m_apiURL,"auth.expireSession"), tmp, KIO::HideProgressInfo); job->addMetaData("UserAgent", m_userAgent); job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded"); connect(job, SIGNAL(data(KIO::Job*,QByteArray)), this, SLOT(data(KIO::Job*,QByteArray))); m_state = FB_LOGOUT; m_job = job; m_buffer.resize(0); // logout is synchronous call job->exec(); slotResult(job); }
void SmugTalker::logout() { if (m_job) { m_job->kill(); m_job = 0; } emit signalBusy(true); KUrl url(m_apiURL); url.addQueryItem("method", "smugmug.logout"); url.addQueryItem("SessionID", m_sessionID); QByteArray tmp; KIO::TransferJob* job = KIO::http_post(url, tmp, KIO::HideProgressInfo); job->addMetaData("UserAgent", m_userAgent); job->addMetaData("content-type", "Content-Type: application/x-www-form-urlencoded"); connect(job, SIGNAL(data(KIO::Job*,QByteArray)), this, SLOT(data(KIO::Job*,QByteArray))); m_state = SMUG_LOGOUT; m_job = job; m_buffer.resize(0); // logout is synchronous call job->exec(); slotResult(job); }
KIOExec::KIOExec(const QStringList &args, bool tempFiles, const QString &suggestedFileName) : mExited(false) , mTempFiles(tempFiles) , mSuggestedFileName(suggestedFileName) , expectedCounter(0) , command(args.first()) , jobCounter(0) { qDebug() << "command=" << command << "args=" << args; for ( int i = 1; i < args.count(); i++ ) { const QUrl urlArg = QUrl::fromUserInput(args.value(i)); if (!urlArg.isValid()) { KMessageBox::error( 0L, i18n("Invalid URL: %1", args.value(i)) ); exit(1); } KIO::StatJob* mostlocal = KIO::mostLocalUrl( urlArg ); bool b = mostlocal->exec(); if (!b) { KMessageBox::error( 0L, i18n("File not found: %1", urlArg.toDisplayString())); exit(1); } Q_ASSERT(b); const QUrl url = mostlocal->mostLocalUrl(); //kDebug() << "url=" << url.url() << " filename=" << url.fileName(); // A local file, not an URL ? // => It is not encoded and not shell escaped, too. if ( url.isLocalFile() ) { FileInfo file; file.path = url.toLocalFile(); file.url = url; fileList.append(file); } // It is an URL else { if ( !url.isValid() ) KMessageBox::error( 0L, i18n( "The URL %1\nis malformed" , url.url() ) ); else if ( mTempFiles ) KMessageBox::error( 0L, i18n( "Remote URL %1\nnot allowed with --tempfiles switch" , url.toDisplayString() ) ); else // We must fetch the file { QString fileName = KIO::encodeFileName( url.fileName() ); if ( !suggestedFileName.isEmpty() ) fileName = suggestedFileName; // Build the destination filename, in ~/.kde/cache-*/krun/ // Unlike KDE-1.1, we put the filename at the end so that the extension is kept // (Some programs rely on it) QString krun_writable = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/krun/"; QDir().mkpath(krun_writable); // error handling will be done by the job QString tmp = krun_writable + QStringLiteral("%1_%2_%3").arg(QCoreApplication::applicationPid()).arg(jobCounter++).arg(fileName); FileInfo file; file.path = tmp; file.url = url; fileList.append(file); expectedCounter++; const QUrl dest = QUrl::fromLocalFile(tmp); qDebug() << "Copying" << url << " to" << dest; KIO::Job *job = KIO::file_copy( url, dest ); jobList.append( job ); connect( job, SIGNAL( result( KJob * ) ), SLOT( slotResult( KJob * ) ) ); } } } if ( mTempFiles ) { slotRunApp(); return; } counter = 0; if ( counter == expectedCounter ) slotResult( 0L ); }