Пример #1
0
void Sasl::respond(qpid::SaslServer::Status status, const std::string& chllnge)
{
    switch (status) {
      case qpid::SaslServer::OK:
        connection.setUserid(authenticator->getUserid());
        completed(true);
        //can't set authenticated & failed until we have actually sent the outcome
        state = SUCCESS_PENDING;
        securityLayer = authenticator->getSecurityLayer(65535);
        if (securityLayer.get()) {
            QPID_LOG_CAT(info, security, id << " Security layer installed");
            securityLayer->init(&connection);
            connection.setSaslSsf(securityLayer->getSsf());
        }
        QPID_LOG_CAT(info, security, id << " Authenticated as " << authenticator->getUserid());
        break;
      case qpid::SaslServer::FAIL:
        completed(false);
        state = FAILURE_PENDING;
        QPID_LOG_CAT(info, security, id << " Failed to authenticate");
        break;
      case qpid::SaslServer::CHALLENGE:
        challenge(&chllnge);
        QPID_LOG_CAT(info, security, id << " Challenge issued");
        break;
    }
    haveOutput = true;
    out.activateOutput();
}
Пример #2
0
void ImportWorker::run()
{
  if (!runCheck(1))
    emit completed(getStyledText(tr("Consistency error, "
                                    "import could not be performed with current import configuration"),
                                 "red",true));
  else
  {
    if (runImport(OGRGDALEXT_PRECHECK_STEPS+1))
    {
      emit completed(getStyledText(tr("Import sucessful"),
                                       "green",true));
    }
    else
    {
      emit completed(getStyledText(tr("Import error. "
                                       "Import may be uncompleted or inconsistent"),
                                       "red",true));
    }

    emit closeRequired();
  }

  emit finished();
}
    void ConnectionDiagnosticThread::run()
    {
        boost::scoped_ptr<mongo::DBClientConnection> connection;

        try {
            connection.reset(new mongo::DBClientConnection);
            connection->connect(_connection->info());
            emit connectionStatus("", true);
        }
        catch(const mongo::UserException &ex) {
            const char *what = ex.what();
            emit connectionStatus(QString(what), false);
            emit completed();
            return;
        }

        try {
            if (_connection->hasEnabledPrimaryCredential())
            {
                CredentialSettings *credential = _connection->primaryCredential();
                std::string database = credential->databaseName();
                std::string username = credential->userName();
                std::string password = credential->userPassword();

                std::string errmsg;
                bool ok = connection->auth(database, username, password, errmsg);
                emit authStatus("", ok);
            }
        } catch (const mongo::UserException &) {
            emit authStatus("", false);
        }

        emit completed();
    }
Пример #4
0
void regionEditDialog::refresh(void)
{
	disconnect(link, SIGNAL(completed()), 0, 0);
	connect(link, SIGNAL(completed()), this, SLOT(getLock()));
	if (regionIndex < link->regionListCount())
		link->tx("region[" + link->getRegionIdAt(regionIndex) + "].refresh?\n");
}
Пример #5
0
bool KHTMLReader::filter(const KUrl& url)
{
    kDebug(30503) << "KHTMLReader::filter";
    QObject::connect(_html, SIGNAL(completed()), this, SLOT(completed()));

    _state.clear();
    _list_depth = 0;

    _html->view()->resize(600, 530);
    _html->setAutoloadImages(false);
    _html->setJScriptEnabled(false);
    _html->setPluginsEnabled(false);
    _html->setJavaEnabled(false);
    _html->setMetaRefreshEnabled(false);
    if (_html->openUrl(url) == false) {
        kWarning(30503) << "openUrl returned false";
        return false;
    }

#ifdef __GNUC__
#warning "kde4: port it"
#endif
#if 0
    //FIXME use synchronous IO instead of this hack if possible.
    QWidget dummy(0);//,0,WType_Dialog | WShowModal);
    qt_enter_modal(&dummy);
    qApp->enter_loop();
    qt_leave_modal(&dummy);
#endif
    return _it_worked;
}
Пример #6
0
void
MoonInstallerService::UpdaterCompleted ()
{
	char *content, *path, *tmp;
	char *xap;
	int err = 0;
	gsize size;
	gsize xap_len;
	FILE *fp;
	
	path = g_build_filename (GetBaseInstallDir (), app->uid, "Application.xap", NULL);
	
	// check that the xap has changed...
	if (g_file_get_contents (path, &content, &size, NULL)) {
		if (g_file_get_contents (request->GetFilename (), &xap, &xap_len, NULL)) {
			if (xap_len == size && !memcmp (xap, content, size)) {
				// no change to the xap
				completed (false, NULL, user_data);
				CloseDownloader (false);
				g_free (content);
				g_free (xap);
				g_free (path);
				return;
			}
			g_free (xap);
		}
		g_free (content);
	}
	
	tmp = g_strdup_printf ("%s.tmp", path);
	
	if ((fp = fopen (tmp, "wb"))) {
		// write to the temporary file
		if (CopyFileTo (request->GetFilename (), fileno (fp)))
			err = ferror (fp);
		fclose (fp);
		
		if (err == 0) {
			// rename the temp file to the actual file
			if (g_rename (tmp, path) == -1)
				err = errno;
		}
	} else {
		err = errno;
	}
	
	g_free (path);
	g_free (tmp);
	
	if (err == 0) {
		// update the app's mtime
		// FIXME: get the Last-Modified: header from the downloader?
		app->mtime = time (NULL);
		db->SyncAppRecord (app);
	}
	
	completed (err == 0, err ? g_strerror (err) : NULL, user_data);
	
	CloseDownloader (false);
}
Пример #7
0
void Link::rx(void)
{
	qint32	i;

	rxStream+= server.readAll();
	QStringList cmds = rxStream.split(QRegExp("[\r\n]"));
	for (i=0; i<cmds.size()-1; i++)
	{
		if (cmds[i] == "ok") {
			succeeded = 1;
			emit completed();
			emit success();
		}
		else if (cmds[i].contains("error")) {
			succeeded = 0;
			emit completed();
			if (cmds[i].section('=', 1).size())
				emit error(cmds[i].section('=', 1));
			emit error();
		}
		else
			parseCmd(this, cmds[i]);

	}

	if (cmds.size() > 1)
	{
		rxStream.clear();
		if (cmds.at(i).size())		// if string size != 0, there is a partial command leftover
			rxStream+= cmds.at(i);
	}
}
void HasherThread::run()
{
#if DEBUG_TEST_BUFFER_MODE == 1
    qint64 size;
    qint64 iReadCount=0;
    int iProgress=0;
    char buffer[pagesize*BEST_BUFFER_SIZE];
    int count;
#endif
    m_stop = false;
    QFile f( fullFileName );
    if ( !f.open(QIODevice::ReadOnly) ) {
        emit error(treeitem,  QString("Unable to open file %1").arg(fullFileName) );
        return;
    }
#if DEBUG_TEST_BUFFER_MODE == 1
    size = f.size();
#endif
    hasher->reset();

#if DEBUG_TEST_TIME == 1
    QDateTime sT =  QDateTime::currentDateTime();
    emit msg(treeitem,  "Start: " + sT.toString("yyyy-MM-dd_HH:mm:ss zzz"));
#endif
#if DEBUG_TEST_BUFFER_MODE == 1
    do {
        count = f.read( buffer, sizeof(buffer) );
        if ( count == -1 ) {
            emit error(treeitem,  QString("Read error") );
            break;
        }
        //add hash data by read position
        hasher->addData( buffer, count );
        iReadCount = iReadCount + count;
        //signal how many byte read
        iProgress = ((iReadCount *100) / size);
        emit fileReadPos(treeitem, iProgress);
    } while( !f.atEnd()  &&  (!m_stop));
    if (!m_stop) {
        emit completed(treeitem, hasher->result().toHex().toUpper() );
    }
#else
    //add by filename
        //connect(&f,SIGNAL(f.),this,filehashPos() );
        if (hasher->addData(&f)) {
                emit completed(treeitem, hasher->result().toHex().toUpper() );
        }
#endif
#if DEBUG_TEST_TIME == 1
    QDateTime eT =  QDateTime::currentDateTime();
    emit msg(treeitem,  "Finish: " + eT.toString("yyyy-MM-dd_HH:mm:ss zzz"));
#endif
//*/
    f.close();
}
Пример #9
0
/*
 * implementation for context_switch
 */
void context_switch(sc_context *  pContext) {
 
  assert(pContext != NULL);

  if (pContext->pFiber != NULL && !completed(pContext)) {
    if (current_context != NULL) if (!completed(current_context)) current_context->state = FS_DELAYED;
    current_context = pContext;
    SwitchToFiber(pContext->pFiber);
  }
  return;
}
Пример #10
0
Item::Item( QListViewItem *parent, const KURL &url )
    : QCheckListItem( parent, url.fileName(), QCheckListItem::CheckBox  )
    , m_lister( true )
    , m_url( url )
    , m_listed( false )
{
    m_lister.setDirOnlyMode( true );
    setExpandable( true );
    connect( &m_lister, SIGNAL(newItems( const KFileItemList& )), SLOT(newItems( const KFileItemList& )) );
    connect( &m_lister, SIGNAL(completed()), SLOT(completed()) );
    connect( &m_lister, SIGNAL(canceled()), SLOT(completed()) );
}
Пример #11
0
void regionEditDialog::changeRegion(int i)
{
	if (uploadChanges()) {
		// need to wait for the ok / error signal from uploadChanges() before doing a refresh or get lock
		nextRegionIndex = i - 1;
		disconnect(link, SIGNAL(completed()), 0, 0);
		connect(link, SIGNAL(completed()), this, SLOT(doRegionChange()));
	}
	else {
		nextRegionIndex = i - 1;
		doRegionChange();
	}
}
Пример #12
0
void regionEditDialog::getLock(void)
{
	GeoRegion *region;

	disconnect(link, SIGNAL(completed()), 0, 0);
	if (link->lastSucceeded()) {
		connect(link, SIGNAL(completed()), this, SLOT(updateYears()));
		region = link->getRegionAt(regionIndex);
		if (!region)
			return;
		link->tx("region[" + link->getRegionIdAt(regionIndex) + "].lock=" + QString::number(region->getVersion()) + "\n");
	}
}
Пример #13
0
/*
 * implementation for context_recall
 */
void *  context_recall(sc_context *  pContext) {
  void *  r;

  assert(pContext != NULL);

  if (top_context == current_context) /*especially for PM realization*/
    context_switch(pContext);
  r = (pContext->pFiber != NULL)? 
    completed(pContext)? *(pContext->pParameter): NULL:
    NULL;
  if (completed(pContext)) context_complete(pContext);
  return r;
}
Пример #14
0
void QDeclarativeTimeLine::updateCurrentTime(int v)
{
    if (d->syncAdj == -1)
        d->syncAdj = v;
    v -= d->syncAdj;

    int timeChanged = v - d->prevTime;
#if 0
    if (!timeChanged)
        return;
#endif
    d->prevTime = v;
    d->advance(timeChanged);
    emit updated();

    // Do we need to stop the clock?
    if (d->ops.isEmpty()) {
        stop();
        d->prevTime = 0;
        d->clockRunning = false;
        emit completed();
    } /*else if (pauseTime > 0) {
        GfxClock::cancelClock();
        d->prevTime = 0;
        GfxClock::pauseFor(pauseTime);
        d->syncAdj = 0;
        d->clockRunning = false;
    }*/ else if (/*!GfxClock::isActive()*/ state() != Running) {
        stop();
        d->prevTime = 0;
        d->clockRunning = true;
        d->syncAdj = 0;
        start();
    }
}
void OGRGDALImportExtension::proceedToImport()
{

  if (mp_PrecheckImportDlg != NULL)
    delete mp_PrecheckImportDlg;

  mp_PrecheckImportDlg = new PrecheckImportDialog(OGRGDALEXT_PRECHECK_STEPS+m_SourcesInfos.size()+2,this);

  mp_PrecheckImportDlg->open();


  QThread* WThread = new QThread;
  ImportWorker* Worker = new ImportWorker(m_SourcesInfos,mp_AdvancedDesc,m_InputDir);
  Worker->moveToThread(WThread);

  connect(Worker, SIGNAL(stepEntered(QString)), mp_PrecheckImportDlg, SLOT(handleStepEntered(QString)));
  connect(Worker, SIGNAL(stepCompleted(int,QString)), mp_PrecheckImportDlg, SLOT(handleStepCompleted(int,QString)));
  connect(Worker, SIGNAL(completed(QString)), mp_PrecheckImportDlg, SLOT(handleCompleted(QString)));
  connect(Worker, SIGNAL(finished()), mp_PrecheckImportDlg, SLOT(handleFinished()));

  // for automatic closing on successful import
  connect(Worker, SIGNAL(closeRequired()), mp_PrecheckImportDlg, SLOT(handleCloseRequired()));
  connect(mp_PrecheckImportDlg, SIGNAL(closeRequired()), this, SLOT(handleCloseRequired()));

  connect(WThread, SIGNAL(started()), Worker, SLOT(run()));
  connect(Worker, SIGNAL(finished()), WThread, SLOT(quit()));
  connect(Worker, SIGNAL(finished()), Worker, SLOT(deleteLater()));
  connect(WThread, SIGNAL(finished()), WThread, SLOT(deleteLater()));

  WThread->start();
}
Пример #16
0
MenuMedia::MenuMedia()
    : KPanelMenu( QString::null, 0, "Media" ),
    mMenuId(0)
{
	disableAutoClear();
	setCaption(i18n("Media Menu"));

	m_DirLister = new KDirLister();
	connect( m_DirLister, SIGNAL( clear() ), this, SLOT( slotClear() ) );
	connect( m_DirLister, SIGNAL( started(const KURL&) ),
	         this, SLOT( slotStarted(const KURL&) ) );
	connect( m_DirLister, SIGNAL( completed() ),
	         this, SLOT( slotCompleted() ) );
	connect( m_DirLister, SIGNAL( newItems( const KFileItemList & ) ),
	         this, SLOT( slotNewItems( const KFileItemList & ) ) );
	connect( m_DirLister, SIGNAL( deleteItem( KFileItem * ) ),
	         this, SLOT( slotDeleteItem( KFileItem * ) ) );
	connect( m_DirLister, SIGNAL( refreshItems( const KFileItemList & ) ),
	         this, SLOT( slotRefreshItems( const KFileItemList & ) ) );

	m_ExcludedTypesList.clear();
	m_ExcludedTypesList << "media/hdd_mounted";
	m_ExcludedTypesList << "media/hdd_unmounted";
	m_ExcludedTypesList << "media/nfs_mounted";
	m_ExcludedTypesList << "media/nfs_unmounted";
	m_ExcludedTypesList << "media/smb_mounted";
	m_ExcludedTypesList << "media/smb_unmounted";
}
Пример #17
0
TupExportWizardPage *TupExportWizard::addPage(TupExportWizardPage *newPage)
{
    QString tag = newPage->getTag();
    newPage->setParent(k->history);
    newPage->show();

    k->history->addWidget(newPage);

    if (k->history->count() == 1) { // First Page
        newPage->setFocus();
        k->backButton->setEnabled(false);
        k->nextButton->setDefault(true);
    } 

    // k->nextButton->setEnabled(newPage->isComplete());

    connect(newPage, SIGNAL(completed()), this, SLOT(pageCompleted()));
    connect(newPage, SIGNAL(emptyField()), this, SLOT(disableButton()));

    if (tag.compare("PLUGIN") == 0) {
        // connect(newPage, SIGNAL(formatSelected(int, const QString &)), this, SLOT(setFormat(int, const QString &)));
        connect(newPage, SIGNAL(animatedImageFormatSelected(int, const QString &)), this, SLOT(setFormat(int, const QString &)));
        connect(newPage, SIGNAL(imagesArrayFormatSelected(int, const QString &)), this, SLOT(setFormat(int, const QString &)));
        connect(newPage, SIGNAL(animationFormatSelected(int, const QString &)), this, SLOT(setFormat(int, const QString &)));
    }
Пример #18
0
void spi_dw_isr(void *arg)
{
	struct device *dev = (struct device *)arg;
	const struct spi_dw_config *info = dev->config->config_info;
	u32_t error = 0;
	u32_t int_status;

	int_status = read_isr(info->regs);

	SYS_LOG_DBG("SPI int_status 0x%x - (tx: %d, rx: %d)",
		    int_status, read_txflr(info->regs), read_rxflr(info->regs));

	if (int_status & DW_SPI_ISR_ERRORS_MASK) {
		error = 1;
		goto out;
	}

	if (int_status & DW_SPI_ISR_RXFIS) {
		pull_data(dev);
	}

	if (int_status & DW_SPI_ISR_TXEIS) {
		push_data(dev);
	}

out:
	clear_interrupts(info->regs);
	completed(dev, error);
}
Пример #19
0
// This can happen after openUrl returns, or directly from m_image->ref()
void KHTMLImage::notifyFinished( khtml::CachedObject *o )
{
    if ( !m_image || o != m_image )
        return;

    //const QPixmap &pix = m_image->pixmap();
    QString caption;

    KMimeType::Ptr mimeType;
    if ( !m_mimeType.isEmpty() )
        mimeType = KMimeType::mimeType(m_mimeType, KMimeType::ResolveAliases);

    if ( mimeType ) {
        if ( !m_image->suggestedTitle().isEmpty() ) {
            caption = i18n( "%1 (%2 - %3x%4 Pixels)", m_image->suggestedTitle(), mimeType->comment(), m_image->pixmap_size().width(), m_image->pixmap_size().height() );
        } else {
            caption = i18n( "%1 - %2x%3 Pixels" ,  mimeType->comment() ,
                  m_image->pixmap_size().width() ,  m_image->pixmap_size().height() );
        }
    } else {
        if ( !m_image->suggestedTitle().isEmpty() ) {
            caption = i18n( "%1 (%2x%3 Pixels)" , m_image->suggestedTitle(),  m_image->pixmap_size().width() ,  m_image->pixmap_size().height() );
        } else {
            caption = i18n( "Image - %1x%2 Pixels" ,  m_image->pixmap_size().width() ,  m_image->pixmap_size().height() );
        }
    }

    emit setWindowCaption( caption );
    emit completed();
    emit setStatusBarText(i18n("Done."));
}
Пример #20
0
void HasherThread::run()
{
    QFile f( filename );
    if ( !f.open(QIODevice::ReadOnly) ) 
    {
        emit error( QString("Unable to open file %1").arg(filename) );
        return;
    }

    hasher->reset();

    char buffer[16*1024];
    qint64 count;
    qint64 summator = 0;
    int _progress = 0;
    do {
        count = f.read( buffer, sizeof(buffer) );
        summator += count;
        _progress = (int)((float(summator)/f.size()) * 1000);
        //qDebug() << "HasherThread::run " << count;
        // qDebug() << "HasherThread::run " << f.size() << " - " << summator << " - " << float(summator)/f.size();
        // qDebug() << "HasherThread::progress " << _progress;
        emit  progress(_progress);

        if ( count == -1 ) 
        {
            emit error( QString("Read error") );
            break;
        }
        hasher->addData( buffer, count );

    } while( !f.atEnd() );

    emit completed( hasher->result().toHex() );
}
Пример #21
0
void POSTRequestGenerator::onResponseReceived(SimulatorResult result,
        SimulatorResourceModelSP repModel)
{
    OC_LOG_V(INFO, TAG, "Response recieved result:%d", result);
    m_responseCnt++;
    completed();
}
void OGRGDALImportExtension::runPrecheck()
{
  if (mp_PrecheckImportDlg != NULL)
    delete mp_PrecheckImportDlg;

  mp_PrecheckImportDlg = new PrecheckImportDialog(OGRGDALEXT_PRECHECK_STEPS,this);

  mp_PrecheckImportDlg->open();


  QThread* WThread = new QThread;
  PrecheckWorker* Worker = new PrecheckWorker(m_SourcesInfos,mp_AdvancedDesc);
  Worker->moveToThread(WThread);


  connect(Worker, SIGNAL(stepEntered(QString)), mp_PrecheckImportDlg, SLOT(handleStepEntered(QString)));
  connect(Worker, SIGNAL(stepCompleted(int,QString)), mp_PrecheckImportDlg, SLOT(handleStepCompleted(int,QString)));
  connect(Worker, SIGNAL(completed(QString)), mp_PrecheckImportDlg, SLOT(handleCompleted(QString)));
  connect(Worker, SIGNAL(finished()), mp_PrecheckImportDlg, SLOT(handleFinished()));

  connect(WThread, SIGNAL(started()), Worker, SLOT(run()));
  connect(Worker, SIGNAL(finished()), WThread, SLOT(quit()));
  connect(Worker, SIGNAL(finished()), Worker, SLOT(deleteLater()));
  connect(WThread, SIGNAL(finished()), WThread, SLOT(deleteLater()));

  WThread->start();
}
Пример #23
0
void QgsTask::start()
{
  mStartCount++;
  Q_ASSERT( mStartCount == 1 );

  if ( mStatus != Queued )
    return;

  mStatus = Running;
  mOverallStatus = Running;
  emit statusChanged( Running );
  emit begun();

  // force initial emission of progressChanged, but respect if task has had initial progress manually set
  setProgress( mProgress );

  if ( run() )
  {
    completed();
  }
  else
  {
    terminated();
  }
}
Пример #24
0
void regionEditDialog::doRegionChange(void)
{

	if (nextRegionIndex < 0) {
		regionEntry.setEnabled(1);
		addRegionButton.setEnabled(1);
		yearEntry.setEnabled(0);
		addYearButton.setEnabled(0);
	}
	else {
		regionEntry.setEnabled(0);
		addRegionButton.setEnabled(0);
		yearEntry.setEnabled(1);
		addYearButton.setEnabled(1);
	}
	if (nextRegionIndex != regionIndex) {
		yearSelector.clear();
		yearEntry.clear();
		stats.clear();
		if (regionIndex >= 0) {
			if (nextRegionIndex >= 0)
				connect(link, SIGNAL(completed()), this, SLOT(refresh()));		// valid -> valid
			if (regionIndex < link->regionListCount())
				link->tx("region[" + link->getRegionIdAt(regionIndex) + "].unlock\n");
			regionIndex = nextRegionIndex;
		}
		else if (nextRegionIndex >= 0) {	// (-1) -> valid
			regionIndex = nextRegionIndex;
			refresh();
		}
	}
}
void FullMessageCombiner::slotDataChanged(const QModelIndex &left, const QModelIndex &right)
{
    Q_UNUSED(left);
    Q_UNUSED(right);

    if (!indexesValid()) {
        emit failed(tr("Message is gone"));
        return;
    }

    if (m_headerPartIndex.data(Imap::Mailbox::RoleIsFetched).toBool() && m_bodyPartIndex.data(Imap::Mailbox::RoleIsFetched).toBool()) {
        emit completed();
        disconnect(m_dataChanged);
    }

    bool headerOffline = m_headerPartIndex.data(Imap::Mailbox::RoleIsUnavailable).toBool();
    bool bodyOffline = m_bodyPartIndex.data(Imap::Mailbox::RoleIsUnavailable).toBool();
    if (headerOffline && bodyOffline) {
        emit failed(tr("Offline mode: uncached message data not available"));
    } else if (headerOffline) {
        emit failed(tr("Offline mode: uncached header data not available"));
    } else if (bodyOffline) {
        emit failed(tr("Offline mode: uncached body data not available"));
    }
}
Пример #26
0
FileStoreUploadDialog::FileStoreUploadDialog(QWidget *parent, FileStore *store, RideItem *item) : QDialog(parent), store(store), item(item)
{
    // get a compressed version
    store->compressRide(item->ride(), data, QFileInfo(item->fileName).baseName() + ".json");

    // setup the gui!
    QVBoxLayout *layout = new QVBoxLayout(this);
    info = new QLabel(QString(tr("Uploading %1 bytes...")).arg(data.size()));
    layout->addWidget(info);

    progress = new QProgressBar(this);
    progress->setMaximum(0);
    progress->setValue(0);
    layout->addWidget(progress);

    okcancel = new QPushButton(tr("Cancel"));
    QHBoxLayout *buttons = new QHBoxLayout;
    buttons->addStretch();
    buttons->addWidget(okcancel);
    layout->addLayout(buttons);

    // get notification when done
    connect(store, SIGNAL(writeComplete(QString,QString)), this, SLOT(completed(QString,QString)));

    // ok, so now we can kickoff the upload
    store->writeFile(data, QFileInfo(item->fileName).baseName() + ".json.zip");
}
Пример #27
0
NetworkResult NetworkFactory::performNetworkOperation(const QString &url, int timeout, const QByteArray &input_data,
                                         const QString &input_content_type, QByteArray &output,
                                         QNetworkAccessManager::Operation operation, bool protected_contents,
                                         const QString &username, const QString &password, bool set_basic_header) {
  Downloader downloader;
  QEventLoop loop;
  NetworkResult result;

  QString str(input_data);

  downloader.appendRawHeader("Content-Type", input_content_type.toLocal8Bit());

  if (set_basic_header) {
    QString basic_value = username + ":" + password;
    QString header_value = QString("Basic ") + QString(basic_value.toUtf8().toBase64());

    downloader.appendRawHeader("Authorization", header_value.toLocal8Bit());
  }

  // We need to quit event loop when the download finishes.
  QObject::connect(&downloader, SIGNAL(completed(QNetworkReply::NetworkError)), &loop, SLOT(quit()));

  downloader.manipulateData(url, operation, input_data, timeout, protected_contents, username, password);
  loop.exec();
  output = downloader.lastOutputData();
  result.first = downloader.lastOutputError();
  result.second = downloader.lastContentType();

  return result;
}
Пример #28
0
GenericMediaDevice::GenericMediaDevice()
    : MediaDevice()
    , m_kBSize( 0 )
    , m_kBAvail( 0 )
    , m_connected( false )
{
    DEBUG_BLOCK
    m_name = i18n("Generic Audio Player");
    m_dirLister = new KDirLister();
    m_dirLister->setNameFilter( "*.mp3 *.wav *.asf *.flac *.wma *.ogg *.aac *.m4a *.mp4 *.mp2 *.ac3" );
    m_dirLister->setAutoUpdate( false );

    m_spacesToUnderscores = false;
    m_ignoreThePrefix     = false;
    m_asciiTextOnly       = false;

    m_songLocation = QString::null;
    m_podcastLocation = QString::null;

    m_supportedFileTypes.clear();

    m_configDialog = 0;

    connect( m_dirLister, SIGNAL( newItems(const KFileItemList &) ), this, SLOT( newItems(const KFileItemList &) ) );
    connect( m_dirLister, SIGNAL( completed() ), this, SLOT( dirListerCompleted() ) );
    connect( m_dirLister, SIGNAL( clear() ), this, SLOT( dirListerClear() ) );
    connect( m_dirLister, SIGNAL( clear(const KURL &) ), this, SLOT( dirListerClear(const KURL &) ) );
    connect( m_dirLister, SIGNAL( deleteItem(KFileItem *) ), this, SLOT( dirListerDeleteItem(KFileItem *) ) );
}
DirFilterPlugin::DirFilterPlugin (QObject* parent, const QVariantList &)
    :KParts::Plugin (parent)
{
  m_part = qobject_cast<KParts::ReadOnlyPart*>(parent);
  if (m_part) {
      connect(m_part, SIGNAL(aboutToOpenURL()), this, SLOT(slotOpenURL()));
      connect(m_part, SIGNAL(completed()), this, SLOT(slotOpenURLCompleted()));
      connect(m_part, SIGNAL(completed(bool)), this, SLOT(slotOpenURLCompleted()));
  }

  KParts::ListingNotificationExtension* notifyExt = KParts::ListingNotificationExtension::childObject(m_part);
  if (notifyExt && notifyExt->supportedNotificationEventTypes() != KParts::ListingNotificationExtension::None) {
      m_listingExt = KParts::ListingFilterExtension::childObject(m_part);
      connect(notifyExt, SIGNAL(listingEvent(KParts::ListingNotificationExtension::NotificationEventType,KFileItemList)),
              this, SLOT(slotListingEvent(KParts::ListingNotificationExtension::NotificationEventType,KFileItemList)));

      m_pFilterMenu = new KActionMenu (KIcon("view-filter"), i18n("View F&ilter"), actionCollection());
      actionCollection()->addAction("filterdir", m_pFilterMenu);
      m_pFilterMenu->setDelayed(false);
      m_pFilterMenu->setDisabled(true);
      m_pFilterMenu->setWhatsThis(i18n("Allow to filter the currently displayed items by filetype."));
      connect(m_pFilterMenu->menu(), SIGNAL(aboutToShow()),
              this, SLOT(slotShowPopup()));
      connect(m_pFilterMenu->menu(), SIGNAL(triggered(QAction*)),
              this, SLOT(slotItemSelected(QAction*)));
  }
Пример #30
0
void
MoonInstallerService::UpdaterFailed (const char *msg)
{
	completed (false, msg, user_data);
	
	CloseDownloader (false);
}