// TODO: add possibility of network file transfers;
//  call mInfo->url() not file()
KUrl Kopete::Transfer::sourceURL()
{
	if( d->info.direction() == Kopete::FileTransferInfo::Incoming )
		return displayURL( d->info.contact(), d->info.file() );
	else
	{
		KUrl url; url.setPath( d->info.file() );
		return url;
	}
}
Kopete::Transfer::Transfer( const Kopete::FileTransferInfo &kfti, bool showProgressInfo)
	: KIO::Job(), d( new Private(kfti) )
{
	connect( kfti.contact(), SIGNAL(destroyed(QObject*)), this, SLOT(slotContactDestroyed()) );
	this->setUiDelegate(new KIO::JobUiDelegate());
	if(showProgressInfo)
		KIO::getJobTracker()->registerJob(this);

	// TODO: use mInfo.url().fileName() after move to protocol-aware filetransfers
	KUrl targ; targ.setPath( d->info.file() );
	init( displayURL( d->info.contact(), targ.fileName() ), showProgressInfo );
}
void Kopete::Transfer::slotNextFile( const QString &sourceFile, const QString &destinationFile )
{
	KUrl src;
	KUrl dest;

	kDebug() << "source: " << sourceFile << " destination: " << destinationFile;
	if( d->info.direction() == Kopete::FileTransferInfo::Incoming )
	{
		KUrl url( sourceFile );
		src = displayURL( d->info.contact(), url.fileName() );
		dest.setPath( destinationFile );
	}
	else
	{
		src.setPath( sourceFile );
		KUrl url( destinationFile );
		dest = displayURL( d->info.contact(), url.fileName() );
	}

	setProcessedAmount( KJob::Files, processedAmount(KJob::Files) + 1 );
	emit description(this, i18n("Copying"),
	                 qMakePair(i18n("Source"), src.prettyUrl()),
	                 qMakePair(i18n("Destination"), dest.prettyUrl()));
}
Example #4
0
void HTMLPreview::manualRefresh()
{
	Editor *current = mParent->getCurrentEditor();

	BaseFile *file = NULL;
	if(current)
		file = current->getFile();

	switch(ui->refreshFrom->currentIndex())
	{
		case 0:
			if(file)
				displayHTML(file->getTextDocument()->toPlainText());
			break;
		case 1:
			displayURL();
			break;
	}

}
Example #5
0
void HTMLPreview::fileSaved()
{
	if(ui->refreshWhen->currentIndex() != 1)
		return;

	BaseFile *file = dynamic_cast<BaseFile*>(sender());

	if(file->hasUnsavedChanges())
		return;

	switch(ui->refreshFrom->currentIndex())
	{
		case 0:
			displayHTML(file->getTextDocument()->toPlainText());
			break;
		case 1:
			displayURL();
			break;
	}
}