Client::Client(const QString &strHost, int port, QWidget *parent) : QWidget(parent), nextBlockSize(0) { mySocket = new QTcpSocket(); mySocket->connectToHost(strHost, port); connect(mySocket, SIGNAL(connected()), this, SLOT(slotConnected())); connect(mySocket, SIGNAL(readyRead()), this, SLOT(slotReadyRead())); connect(mySocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotError(QAbstractSocket::SocketError))); txtInfo = new QTextEdit(); txtInput = new QLineEdit(); txtInfo->setReadOnly(true); QPushButton *send = new QPushButton("&Send"); connect(send, SIGNAL(clicked()), this, SLOT(slotSendToServer())); connect(txtInput, SIGNAL(returnPressed()), this, SLOT(slotSendToServer())); QVBoxLayout *form = new QVBoxLayout(this); form->addWidget(new QLabel("<H1>Client</H1>")); form->addWidget(txtInfo); form->addWidget(txtInput); form->addWidget(send); }
void PresentationAudioWidget::slotTimeUpdaterTimeout() { if (d->mediaObject->error() != QMediaPlayer::NoError) { slotError(); return; } qint64 current = d->mediaObject->position(); int hours = (int)(current / (qint64)(60 * 60 * 1000)); int mins = (int)((current / (qint64)(60 * 1000)) - (qint64)(hours * 60)); int secs = (int)((current / (qint64)1000) - (qint64)(hours * 60 + mins * 60)); QTime elapsedTime(hours, mins, secs); if (d->isZeroTime && d->mediaObject->duration() > 0) { d->isZeroTime = false; qint64 total = d->mediaObject->duration(); hours = (int)(total / (qint64)(60 * 60 * 1000)); mins = (int)((total / (qint64)(60 * 1000)) - (qint64)(hours * 60)); secs = (int)((total / (qint64)1000) - (qint64)(hours * 60 + mins * 60)); QTime totalTime(hours, mins, secs); m_totalTimeLabel->setText(totalTime.toString(QString::fromLatin1("H:mm:ss"))); } m_elapsedTimeLabel->setText(elapsedTime.toString(QString::fromLatin1("H:mm:ss"))); }
void QFileTrans::slotPresenceReceived(const QXmppPresence &presence) { bool check; Q_UNUSED(check); // if we don't have a recipient, or if the presence is not from the recipient, // do nothing if (m_recipient.isEmpty() || QXmppUtils::jidToBareJid(presence.from()) != m_recipient || presence.type() != QXmppPresence::Available) return; // send the file and connect to the job's signals QXmppTransferJob *job = transferManager->sendFile(presence.from(), ":/example_3_transferHandling.cpp", "example source code"); check = connect(job, SIGNAL(error(QXmppTransferJob::Error)), this, SLOT(slotError(QXmppTransferJob::Error))); Q_ASSERT(check); check = connect(job, SIGNAL(finished()), this, SLOT(slotFinished())); Q_ASSERT(check); check = connect(job, SIGNAL(progress(qint64,qint64)), this, SLOT(slotProgress(qint64,qint64))); Q_ASSERT(check); }
void PlaybackWidget::slotTimeUpdaterTimeout() { if ( m_mediaObject->state() == Phonon::ErrorState ) { slotError(); return; } long int current = m_mediaObject->currentTime(); int hours = (int)(current / (long int)( 60 * 60 * 1000 )); int mins = (int)((current / (long int)( 60 * 1000 )) - (long int)(hours * 60)); int secs = (int)((current / (long int)1000) - (long int)(hours * 60 + mins * 60)); QTime elapsedTime(hours, mins, secs); if ( m_isZeroTime ) { m_isZeroTime = false; long int total = m_mediaObject->totalTime(); hours = (int)(total / (long int)( 60 * 60 * 1000 )); mins = (int)((total / (long int)( 60 * 1000 )) - (long int)(hours * 60)); secs = (int)((total / (long int)1000) - (long int)(hours * 60 + mins * 60)); QTime totalTime(hours, mins, secs); m_totalTimeLabel->setText(totalTime.toString("H:mm:ss")); } m_elapsedTimeLabel->setText(elapsedTime.toString("H:mm:ss")); }
void JamendoBrowser::GetList(QString comefrom, QString text) { if(proxy->hasVariable("proxyEnabled") && proxy->getVariable("proxyEnabled") == "true") { manager.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy, proxy->getVariable("proxyHost"), proxy->getVariable("proxyPort").toInt(), proxy->getVariable("proxyUser"), proxy->getVariable("proxyPassword"))); } if(!comefrom.size()) comefrom = "http://api.jamendo.com/get2/id+name+rating+url+weight/tag/plain/?order=rating_desc"; comefrom += "&n=50"; reply = manager.get(QNetworkRequest(QUrl(comefrom))); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError))); if (text.size()) switch(listType) { case LIST_GENRE: _tag.tag0.genre = text; break; case LIST_ARTIST: _tag.tag0.artist = text; break; case LIST_ALBUM: _tag.tag0.album = text; break; case LIST_NONE: default: ; } }
void CloudControl::UploadRecipe(Recipe *recipe, QWidget *parent) { // Pushes this Recipe to the remote output QUrl url(getBaseURL()+"/recipes/"); QString xml = recipe->toXML(""); networkManager = new QNetworkAccessManager(parent); QNetworkRequest request; request.setUrl(url); request.setRawHeader("User-agent", "StrangewbrewQT"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/octet-stream"); QByteArray data (xml.toUtf8()); qDebug() << xml.toUtf8(); qDebug() << "Data length: " << data.size(); uploadProgress = new QProgressDialog("Uploading recipe...", "Abort Upload", 0, data.size(), parent); uploadProgress->show(); QNetworkReply *reply = networkManager->post(request, data); connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(uploadComplete(QNetworkReply*))); connect(reply, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(uploadingData(qint64, qint64))); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError))); connect(uploadProgress, SIGNAL(canceled()), this, SLOT(uploadCancelled())); }
void PiwigoWindow::connectSignals() { connect(d->albumView, SIGNAL(itemSelectionChanged()), this, SLOT(slotAlbumSelected())); connect(d->confButton, SIGNAL(clicked()), this, SLOT(slotSettings())); connect(d->resizeCheckBox, SIGNAL(stateChanged(int)), this, SLOT(slotEnableSpinBox(int))); connect(d->progressDlg, SIGNAL(canceled()), this, SLOT(slotAddPhotoCancel())); connect(d->talker, SIGNAL(signalProgressInfo(QString)), this, SLOT(slotProgressInfo(QString))); connect(d->talker, SIGNAL(signalError(QString)), this, SLOT(slotError(QString))); connect(d->talker, SIGNAL(signalBusy(bool)), this, SLOT(slotBusy(bool))); connect(d->talker, SIGNAL(signalLoginFailed(QString)), this, SLOT(slotLoginFailed(QString))); connect(d->talker, SIGNAL(signalAlbums(QList<PiwigoAlbum>)), this, SLOT(slotAlbums(QList<PiwigoAlbum>))); connect(d->talker, SIGNAL(signalAddPhotoSucceeded()), this, SLOT(slotAddPhotoSucceeded())); connect(d->talker, SIGNAL(signalAddPhotoFailed(QString)), this, SLOT(slotAddPhotoFailed(QString))); }
QNetworkReply* ownCloudInfo::getDirectoryListing( const QString& dir ) { QNetworkRequest req; req.setUrl( QUrl( webdavUrl(_connection) + dir ) ); req.setRawHeader("Depth", "1"); QByteArray xml("<?xml version=\"1.0\" ?>\n" "<d:propfind xmlns:d=\"DAV:\">\n" " <d:prop>\n" " <d:resourcetype/>\n" " </d:prop>\n" "</d:propfind>\n"); QBuffer *buf = new QBuffer; buf->setData(xml); buf->open(QIODevice::ReadOnly); QNetworkReply *reply = davRequest("PROPFIND", req, buf); buf->setParent(reply); if( reply->error() != QNetworkReply::NoError ) { qDebug() << "getting quota: request network error: " << reply->errorString(); } connect( reply, SIGNAL( finished()), SLOT(slotGetDirectoryListingFinished()) ); connect( reply, SIGNAL( error(QNetworkReply::NetworkError)), this, SLOT( slotError(QNetworkReply::NetworkError))); return reply; }
Client::Client(const QString &host, int port, QWidget *parent) : QWidget(parent), blockSize(0) { socket = new QTcpSocket(this); socket->connectToHost(host, port); connect(socket, SIGNAL(connected()), SLOT(slotConnected())); connect(socket, SIGNAL(readyRead()), SLOT(slotReadyRead())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(slotError(QAbstractSocket::SocketError))); info = new QTextEdit; input = new QLineEdit; info->setReadOnly(true); QPushButton* button = new QPushButton("&Send"); connect(button, SIGNAL(clicked()), SLOT(slotSendToServer())); connect(input, SIGNAL(returnPressed()), SLOT(slotSendToServer())); QVBoxLayout* layout = new QVBoxLayout; layout->addWidget(new QLabel("<h1>Client</h1>")); layout->addWidget(info); layout->addWidget(input); layout->addWidget(button); setLayout(layout); }
Process::Process (QStringList args, QString exec, QString dir, QString info, QString caption, bool showErr, QStringList env, QWidget * parent, Qt::WFlags f) { setupUi(this); this->showErr=showErr; myProcess.reset(new QProcess(parent)); myProcess->setEnvironment(env); connect(myProcess.get(), SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotFinished(int, QProcess::ExitStatus))); connect(myProcess.get(), SIGNAL(error(QProcess::ProcessError)), this, SLOT(slotError(QProcess::ProcessError))); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_clicked())); lblInfo->setText(info); setWindowTitle(caption); myProcess->setWorkingDirectory (dir); myProcess->start(exec, args); #ifdef DEBUG qDebug()<<"[ii] Process args: "<<exec<<args; #endif return; }
MyClient::MyClient(const QString & hoststr, int port, QWidget * pwgt) : QWidget(pwgt), nextBlockSize(0) { tcpSocket = new QTcpSocket(this); // установить связь с сервером tcpSocket->connectToHost(hoststr, port); // сокет отправляет сигнал connected() как только будет создано соединение connect(tcpSocket, SIGNAL(connected()), SLOT(slotConnected())); // сокет отправляет сигнал readyRead() при готовности предоставить данные для чтения connect(tcpSocket, SIGNAL(readyRead()), SLOT(slotReadyRead())); // в случае возникновения ошибки сокет отправляет сигнал error connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotError(QAbstractSocket::SocketError))); textInfo = new QTextEdit; textInput = new QLineEdit; textInfo->setReadOnly(true); QPushButton * cmd = new QPushButton("&Send"); connect(cmd, SIGNAL(clicked()), SLOT(slotSendToServer())); connect(textInput, SIGNAL(returnPressed()), this, SLOT(slotSendToServer())); QVBoxLayout * mainLayout = new QVBoxLayout; mainLayout->addWidget(new QLabel("<H1>Client</H1>")); mainLayout->addWidget(textInfo); mainLayout->addWidget(textInput); mainLayout->addWidget(cmd); setLayout(mainLayout); }
int Downloader::download(bool wait) { if (!isStarted) { isStarted = true; downloadError = 0; if (!dlFile->open(QIODevice::WriteOnly)) { errorStr += "can not open file " + dest + "\n"; return 1; } if (reply == NULL) reply = network->get(request); QObject::connect(reply, SIGNAL(readyRead()), this, SLOT(downloadedFileWrite())); QObject::connect(reply, SIGNAL(finished ()), this, SLOT(handleDownload())); QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError))); //QObject::connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>))); if (wait) { QEventLoop loop; QObject::connect(this, SIGNAL(finished(int)), &loop, SLOT(quit())); loop.exec(); } return downloadError; }
void BlFile::sync() { BL_FUNC_DEBUG // if (!exists() { QFileInfo fileInfo(m_file); QString filename(fileInfo.fileName()); QString user = g_confpr->value(CONF_LOGIN_USER); QString dbname = g_confpr->value(CONF_DBNAME); #ifdef Q_OS_WIN32 QString platform = "MS_WIN"; #else QString platform = "LINUX"; #endif QString url = "http://www.bulmages.com/bulmaincloud/"+platform+"/"+user+"/"+dbname+"/"+filename; fprintf(stderr, "Iniciando descarga %s\n", url.toLatin1().constData()); manager = new QNetworkAccessManager(this); QNetworkRequest request; request.setUrl(QUrl(url)); request.setRawHeader("User-Agent", "BgBrowser 1.0"); QNetworkReply *reply = manager->get(request); connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead())); connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64))); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError))); connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>))); connect(manager, SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*))); while (reply->isRunning()) { QApplication::processEvents(); } // end while // }// end if url = "http://www.bulmages.com/bulmaincloud/ALL/"+user+"/"+dbname+"/"+filename; fprintf(stderr, "Iniciando descarga %s\n", url.toLatin1().constData()); request.setUrl(QUrl(url)); reply = manager->get(request); while (reply->isRunning()) { QApplication::processEvents(); } // end while if (reply->error() == QNetworkReply::NoError) { return; } // end if url = "http://www.bulmages.com/bulmaincloud/ALL/ALL/"+filename; fprintf(stderr, "Iniciando descarga %s\n", url.toLatin1().constData()); request.setUrl(QUrl(url)); reply = manager->get(request); while (reply->isRunning()) { QApplication::processEvents(); } // end while }
XmlRpcResponse *XmlRpcClient::execute(XmlRpcRequest *request, bool async) { QNetworkAccessManager *network_manager = new QNetworkAccessManager(); QNetworkRequest network_request; network_request.setUrl(QUrl(this->address)); network_request.setRawHeader("User-Agent", "XMLRPC browser"); network_request.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); //connect(network_manager, SIGNAL(finished(QNetworkReply*)), // this, SLOT(slotReplyFinished(QNetworkReply*))); //qDebug() << "XMLRPC Request: " + request->toString().toLatin1(); QNetworkReply *reply = network_manager->post(network_request, request->toString().toLatin1()); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError))); //connect(reply, SIGNAL(sslErrors(QList<QSslError>)), // this, SLOT(slotSslErrors(QList<QSslError>))); if(async) return NULL; // wait for complete signal QEventLoop loop; connect(reply, SIGNAL(readyRead()), &loop, SLOT(quit())); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), &loop, SLOT(quit())); connect(reply, SIGNAL(sslErrors(QList<QSslError>)), &loop, SLOT(quit())); loop.exec(); //qDebug() << "XMLRPC response: " + reply->readAll(); return XmlRpcResponse::fromString(reply->readAll()); }
void ArchiveJob::execute() { if(mInfo) { MailCommon::BackupJob *backupJob = new MailCommon::BackupJob(); Akonadi::Collection collection(mInfo->saveCollectionId()); backupJob->setRootFolder( MailCommon::Util::updatedCollection(collection) ); const QString realPath = MailCommon::Util::fullCollectionPath(collection); backupJob->setSaveLocation( mInfo->realUrl(realPath) ); backupJob->setArchiveType( mInfo->archiveType() ); backupJob->setDeleteFoldersAfterCompletion( false ); backupJob->setRecursive( mInfo->saveSubCollection() ); backupJob->setDisplayMessageBox(false); const QString summary = i18n("Start to archive %1",realPath ); const QPixmap pixmap = KIcon( "kmail" ).pixmap( KIconLoader::SizeSmall, KIconLoader::SizeSmall ); KNotification::event( QLatin1String("archivemailstarted"), summary, pixmap, 0, KNotification::CloseOnTimeout, KGlobal::mainComponent()); connect(backupJob,SIGNAL(backupDone(QString)),this,SLOT(slotBackupDone(QString))); connect(backupJob,SIGNAL(error(QString)),this,SLOT(slotError(QString))); backupJob->start(); } }
void xmppClient::slotPresenceReceived(const QXmppPresence &presence) { const QLatin1String recipient("*****@*****.**"); // if we are the recipient, or if the presence is not from the recipient, // do nothing if (jidToBareJid(configuration().jid()) == recipient || jidToBareJid(presence.from()) != recipient || presence.type() != QXmppPresence::Available) return; // send the file and connect to the job's signals QXmppTransferJob *job = transferManager->sendFile(presence.from(), "xmppClient.cpp"); bool check = connect( job, SIGNAL(error(QXmppTransferJob::Error)), this, SLOT(slotError(QXmppTransferJob::Error)) ); Q_ASSERT(check); check = connect( job, SIGNAL(finished()), this, SLOT(slotFinished()) ); Q_ASSERT(check); check = connect( job, SIGNAL(progress(qint64,qint64)), this, SLOT(slotProgress(qint64,qint64)) ); Q_ASSERT(check); }
/*! \~russian * \brief Метод предназначен для соединения внутренних сигналов и слотов класса. */ void TcpClient::connectSignalsAndSlots() { connect(&_socket, SIGNAL(connected()), SLOT(slotConnected())); connect(&_socket, SIGNAL(readyRead()), SLOT(slotReadyRead())); connect(&_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotError(QAbstractSocket::SocketError)) ); }
void PresentationAudioWidget::slotPlayerError(QMediaPlayer::Error err) { if (err != QMediaPlayer::NoError) { qCDebug(DIGIKAM_GENERAL_LOG) << "An error as occured while playing (" << err << ")"; slotError(); } }
IrcClient::IrcClient(const QString &host, int port, const QString &channel, const QString &nick) : m_host(host), m_port(port), m_channel(channel), m_nick(nick) { connect(this, SIGNAL(connected()), this, SLOT(slotLogin())); connect(this, SIGNAL(readyRead()), this, SLOT(slotHandleOutput())); connect(this, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotError(QAbstractSocket::SocketError))); connectToHost(m_host, m_port); }
void TcpClient::disconnectHost() { m_pTcpSocket->disconnectFromHost(); disconnect(m_pTcpSocket, SIGNAL(connected()), this, SLOT(slotConnected())); disconnect(m_pTcpSocket, SIGNAL(readyRead()), this, SLOT(slotReadyRead())); disconnect(m_pTcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotError(QAbstractSocket::SocketError))); emit connected(m_connectionState = -1); }
ProcessEx::ProcessEx(QObject *parent) : QProcess(parent), m_suppressFinish(false) { connect(this,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(slotStateChanged(QProcess::ProcessState))); connect(this,SIGNAL(readyReadStandardOutput()),this,SLOT(slotReadOutput())); connect(this,SIGNAL(readyReadStandardError()),this,SLOT(slotReadError())); connect(this,SIGNAL(error(QProcess::ProcessError)),this,SLOT(slotError(QProcess::ProcessError))); connect(this,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(slotFinished(int,QProcess::ExitStatus))); }
ProcessCheckoutJob::ProcessCheckoutJob(QObject *parent) : AbstractCheckoutJob(parent), d(new Internal::ProcessCheckoutJobPrivate) { connect(d->process.data(), SIGNAL(error(QProcess::ProcessError)), this, SLOT(slotError(QProcess::ProcessError))); connect(d->process.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotFinished(int,QProcess::ExitStatus))); connect(d->process.data(), SIGNAL(readyReadStandardOutput()), this, SLOT(slotOutput())); d->process->setProcessChannelMode(QProcess::MergedChannels); d->process->closeWriteChannel(); }
/// private function void CServerManager::connectToServer(const std::string& serverIP, const unsigned int m_serverPort) { m_tcpSocket = new QTcpSocket(this); m_tcpSocket->connectToHost(QString(serverIP.c_str()), m_serverPort); connect(m_tcpSocket, SIGNAL(connected()), this, SLOT(slotConnected())); connect(m_tcpSocket, SIGNAL(readyRead()), this, SLOT(slotReadyRead())); connect(m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this,SLOT(slotError(QAbstractSocket::SocketError))); }
client::client(QString host) { m_pTcpSocket = new QTcpSocket(this); m_pTcpSocket->connectToHost(host, nPort); connect(m_pTcpSocket, SIGNAL(connected()), SLOT(slotConnected())); connect(m_pTcpSocket, SIGNAL(readyRead()), this, SLOT(slotReadyRead())); connect(m_pTcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotError())); game = NULL; }
void TupWebHunter::start() { QNetworkAccessManager *manager = new QNetworkAccessManager(this); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(closeRequest(QNetworkReply*))); QNetworkRequest request; request.setUrl(QUrl(k->url)); request.setRawHeader("User-Agent", BROWSER_FINGERPRINT.toAscii()); QNetworkReply *reply = manager->get(request); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError))); }
//链接请求 void ReqUtil::startRequest(QUrl url) { reply = manager->get(QNetworkRequest(url)); connect(reply,SIGNAL(finished()),this,SLOT(httpFinished())); //下载完成后 connect(reply,SIGNAL(readyRead()),this,SLOT(httpReadyRead())); //有可用数据时 // 判断异常 connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),this, SLOT(slotError(QNetworkReply::NetworkError))); connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(slotSslErrors(QList<QSslError>))); connect(reply,SIGNAL(finished()),loop,SLOT(quit())); // 退出循环 loop->exec(); }
void GameClient::connectToServer(const QString &server) { serverAddr = server; int socketNumber = 2327; tcpSocket = new QTcpSocket(this); tcpSocket->connectToHost(serverAddr, socketNumber); connect(tcpSocket, SIGNAL(connected()), SLOT(slotConnected())); connect(tcpSocket, SIGNAL(readyRead()), SLOT(slotReadyRead())); connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(slotError(QAbstractSocket::SocketError))); }
void PostEntry::submitPost( int blogId, const BilboPost &postData ) { kDebug(); setCurrentPostFromEditor(); if ( d->mCurrentPost.content().isEmpty() || d->mCurrentPost.title().isEmpty() ) { if ( KMessageBox::warningContinueCancel( this, i18n( "Your post title or body is empty.\nAre you sure you want to submit this post?" ) ) == KMessageBox::Cancel ) return; } bool isNew = false; if(d->mCurrentPost.status() == BilboPost::New) isNew = true; QPointer<SendToBlogDialog> dia = new SendToBlogDialog( isNew, d->mCurrentPost.isPrivate(), this); dia->setAttribute(Qt::WA_DeleteOnClose, false); if( dia->exec() == KDialog::Accepted ) { this->setCursor( Qt::BusyCursor ); d->mCurrentPost.setProperties( postData ); d->mCurrentPostBlogId = blogId; QString msgType; if(dia->isPrivate()) { msgType = i18nc("Post status, e.g Draft or Published Post", "draft"); d->mCurrentPost.setPrivate(true); } else { msgType = i18nc("Post status, e.g Draft or Published Post", "post"); d->mCurrentPost.setPrivate(false); } QString statusMsg; if(dia->isNew()) { statusMsg = i18n("Submitting new %1...", msgType); d->isNewPost = true; } else { statusMsg = i18n("Modifying %1...", msgType); d->isNewPost = false; } emit showStatusMessage(statusMsg, true); Backend *b = new Backend(d->mCurrentPostBlogId, this); connect( b, SIGNAL(sigError(QString)), this, SLOT(slotError(QString)) ); if ( uploadMediaFiles(b) ) { kDebug()<<"Uploading"; showProgressBar(); connect( b, SIGNAL(sigPostPublished(int,BilboPost*)), this, SLOT(slotPostPublished(int,BilboPost*)) ); if(d->isNewPost) b->publishPost( &d->mCurrentPost ); else b->modifyPost( &d->mCurrentPost ); } else {
void Verifier::setFile(const QString &filename) { // Create the verifier m_verifier = new KFTPCore::ChecksumVerifier(filename); ui.currentFile->setText(KUrl(filename).fileName()); connect(m_verifier, SIGNAL(fileList(QList<QPair<QString, QString> >)), this, SLOT(slotHaveFileList(QList<QPair<QString, QString> >))); connect(m_verifier, SIGNAL(fileDone(const QString&, KFTPCore::ChecksumVerifier::Result)), this, SLOT(slotFileDone(const QString&, KFTPCore::ChecksumVerifier::Result))); connect(m_verifier, SIGNAL(progress(int)), this, SLOT(slotProgress(int))); connect(m_verifier, SIGNAL(error()), this, SLOT(slotError())); // Start the verification m_verifier->verify(); }
IpProcess::IpProcess(QObject *parent) : QProcess(parent) { errStr = ""; QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); // Add an environment variable //env.insert("TMPDIR", "C:\\MyApp\\temp"); // Append a value to an environment variable //env.insert("PATH", env.value("Path") + ";C:\\Bin"); setProcessEnvironment(env); connect(this, SIGNAL(error(QProcess::ProcessError)), this, SLOT(slotError(QProcess::ProcessError)) ); }