get rid of KIO::NetAccess

parent 31c90cd8
......@@ -24,7 +24,6 @@
#include <QDebug>
#include <QFontDatabase>
#include <KFileItem>
#include <KIO/NetAccess>
#include <QTreeWidgetItem>
#include <QFile>
......@@ -109,8 +108,9 @@ void ManageCapturesDialog::slotDeleteCurrent()
m_view.treeWidget->takeTopLevelItem(i);
//qDebug() << "DELETING FILE: " << item->text(0);
//KIO::NetAccess::del(QUrl(item->text(0)), this);
QFile f(item->data(0, Qt::UserRole).toString());
f.remove();
if (!QFile::remove(item->data(0, Qt::UserRole).toString())) {
qDebug()<<"// ERRor removing file "<<item->data(0, Qt::UserRole).toString();
}
delete item;
item = NULL;
}
......
......@@ -22,7 +22,6 @@
#include "kdenlivesettings.h"
#include <QDebug>
#include <KIO/NetAccess>
#include <QVBoxLayout>
#include <QLineEdit>
......
......@@ -30,7 +30,6 @@
#include <QDebug>
#include <kde_file.h>
#include <KIO/NetAccess>
#include <kdeversion.h>
#include <KMessageBox>
#include <KLineEdit>
......
......@@ -24,7 +24,6 @@
#include <QDebug>
#include <KMessageBox>
#include <KIO/NetAccess>
#include <KGlobal>
#include <QDir>
......@@ -233,10 +232,12 @@ void ProfilesDialog::saveProfile(QString path)
void ProfilesDialog::slotDeleteProfile()
{
const QString path = m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString();
bool success = false;
if (path.contains('/')) {
KIO::NetAccess::del(QUrl(path), this);
success = QFile::remove(path);
fillList();
} else qDebug() << "//// Cannot delete profile " << path << ", does not seem to be custom one";
}
if (!success) qDebug()<< "//// Cannot delete profile " << path << ", does not seem to be custom one";
}
// static
......
......@@ -28,7 +28,6 @@
#include <QDebug>
#include <KMessageBox>
#include <KRun>
#include <KIO/NetAccess>
#include <KColorScheme>
#include <KNotification>
#include <KStandardDirs>
......@@ -2112,8 +2111,10 @@ void RenderWidget::slotDeleteScript()
QTreeWidgetItem *item = m_view.scripts_list->currentItem();
if (item) {
QString path = item->data(1, Qt::UserRole + 1).toString();
KIO::NetAccess::del(path + ".mlt", this);
KIO::NetAccess::del(path, this);
bool success = true;
success |= QFile::remove(path + ".mlt");
success |= QFile::remove(path);
if (!success) qDebug()<<"// Error removing script or playlist: "<<path<<", "<<path<<".mlt";
parseScriptFiles();
}
}
......
......@@ -29,7 +29,6 @@
#include "project/clipmanager.h"
#include "project/dialogs/slideshowclip.h"
#include <KIO/NetAccess>
#include <KApplication>
#include <QDebug>
......
......@@ -27,14 +27,13 @@
#include "kdenlivesettings.h"
#include <QDebug>
#include <QFileDialog>
#include <KIO/NetAccess>
#include <KApplication>
#include <KUrlRequesterDialog>
#include <KMessageBox>
#include <QFontDatabase>
#include <QTreeWidgetItem>
#include <QFile>
#include <QFileDialog>
#include <QCryptographicHash>
#include <QStandardPaths>
......@@ -454,7 +453,7 @@ void DocumentChecker::setProperty(QDomElement effect, const QString &name, const
void DocumentChecker::slotSearchClips()
{
QString newpath = QFileDialog::getExistingDirectory(kapp->activeWindow(), i18n("Clips folder"), "kfiledialog:///clipfolder");
QString newpath = QFileDialog::getExistingDirectory(qApp->activeWindow(), i18n("Clips folder"), "kfiledialog:///clipfolder");
if (newpath.isEmpty()) return;
int ix = 0;
bool fixed = false;
......
......@@ -39,7 +39,6 @@
#include <KMessageBox>
#include <KProgressDialog>
#include <KLocalizedString>
#include <KIO/NetAccess>
#include <KIO/CopyJob>
#include <KIO/JobUiDelegate>
#include <KApplication>
......@@ -142,7 +141,7 @@ KdenliveDoc::KdenliveDoc(const QUrl &url, const QUrl &projectFolder, QUndoGroup
QFile file(url.path());
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
// The file cannot be opened
if (KMessageBox::warningContinueCancel(parent, i18n("Cannot open the project file, error is:\n%1\nDo you want to open a backup file?", KIO::NetAccess::lastErrorString()), i18n("Error opening file"), KGuiItem(i18n("Open Backup"))) == KMessageBox::Continue) {
if (KMessageBox::warningContinueCancel(parent, i18n("Cannot open the project file,\nDo you want to open a backup file?"), i18n("Error opening file"), KGuiItem(i18n("Open Backup"))) == KMessageBox::Continue) {
*openBackup = true;
}
//KMessageBox::error(parent, KIO::NetAccess::lastErrorString());
......@@ -863,7 +862,7 @@ void KdenliveDoc::moveProjectData(const QUrl &url)
QUrl oldUrl = clip->fileURL();
QUrl newUrl = QUrl(url.path() + QDir::separator() + "titles/" + oldUrl.fileName());
KIO::Job *job = KIO::copy(oldUrl, newUrl);
if (KIO::NetAccess::synchronousRun(job, 0)) clip->setProperty("resource", newUrl.path());
if (job->exec()) clip->setProperty("resource", newUrl.path());
}
QString hash = clip->getClipHash();
QUrl oldVideoThumbUrl = QUrl(m_projectFolder.path() + QDir::separator() + "thumbs/" + hash + ".png");
......@@ -882,7 +881,7 @@ void KdenliveDoc::moveProjectData(const QUrl &url)
if (!cacheUrls.isEmpty()) {
KIO::Job *job = KIO::copy(cacheUrls, QUrl(url.path() + QDir::separator() + "thumbs/"));
KJobWidgets::setWindow(job, kapp->activeWindow());
KIO::NetAccess::synchronousRun(job, 0);
job->exec();
}
}
......@@ -1732,23 +1731,20 @@ void KdenliveDoc::backupLastSavedVersion(const QString &path)
// Ensure backup folder exists
if (path.isEmpty()) return;
QFile file(path);
QUrl backupFile = m_projectFolder;
backupFile = backupFile.adjusted(QUrl::StripTrailingSlash);
backupFile.setPath(backupFile.path() + '/' + ".backup/");
KIO::NetAccess::mkdir(backupFile, kapp->activeWindow());
QDir backupFolder(m_projectFolder.path());
backupFolder.mkdir(".backup");
QString fileName = QUrl(path).fileName().section('.', 0, -2);
QFileInfo info(file);
fileName.append('-' + m_documentProperties.value("documentid"));
fileName.append(info.lastModified().toString("-yyyy-MM-dd-hh-mm"));
fileName.append(".kdenlive");
backupFile = backupFile.adjusted(QUrl::StripTrailingSlash);
backupFile.setPath(backupFile.path() + '/' + fileName);
QString backupFile = backupFolder.absoluteFilePath(fileName);
if (file.exists()) {
// delete previous backup if it was done less than 60 seconds ago
QFile::remove(backupFile.path());
if (!QFile::copy(path, backupFile.path())) {
KMessageBox::information(kapp->activeWindow(), i18n("Cannot create backup copy:\n%1", backupFile.path()));
QFile::remove(backupFile);
if (!QFile::copy(path, backupFile)) {
KMessageBox::information(kapp->activeWindow(), i18n("Cannot create backup copy:\n%1", backupFile));
}
}
}
......
......@@ -28,7 +28,6 @@
#include <mlt++/Mlt.h>
#include <kio/netaccess.h>
#include <QDebug>
#include <klocale.h>
#include <kfileitem.h>
......
......@@ -29,7 +29,6 @@
#include <KLocalizedString>
#include <kmimetype.h>
#include <KIO/NetAccess>
#include <KMessageBox>
#include <QFile>
......@@ -475,8 +474,16 @@ void DvdWizard::processDvdauthor(const QString &menuMovieUrl, const QMap <QStrin
// create dvdauthor xml
QListWidgetItem *authitem = m_status.job_progress->item(3);
m_status.job_progress->setCurrentRow(3);
bool success = true;
authitem->setIcon(QIcon::fromTheme("system-run"));
KIO::NetAccess::mkdir(QUrl(m_status.tmp_folder->url().path() + QDir::separator() + "DVD"), this);
QDir dir(m_status.tmp_folder->url().path());
if (!dir.exists()) success = false;
else success = dir.mkdir("DVD");
if (!success) {
// We failed creating tmp DVD directory
KMessageBox::sorry(this, i18n("Cannot create temporary directory %1", m_status.tmp_folder->url().path() + "/DVD"));
return;
}
QDomDocument dvddoc;
QDomElement auth = dvddoc.createElement("dvdauthor");
......@@ -814,7 +821,7 @@ void DvdWizard::slotIsoFinished(int exitCode, QProcess::ExitStatus status)
QFile iso(m_status.iso_image->url().path());
if (!iso.exists() || iso.size() == 0) {
if (iso.exists()) {
KIO::NetAccess::del(m_status.iso_image->url(), this);
iso.remove();
}
errorMessage(i18n("DVD ISO is broken"));
m_status.error_log->append(m_creationLog + "<br /><a name=\"result\" /><strong>" + i18n("DVD ISO is broken") + "</strong>");
......@@ -845,7 +852,9 @@ void DvdWizard::slotIsoFinished(int exitCode, QProcess::ExitStatus status)
void DvdWizard::cleanup()
{
KIO::NetAccess::del(QUrl(m_status.tmp_folder->url().path() + QDir::separator() + "DVD"), this);
QDir dir(m_status.tmp_folder->url().path() + QDir::separator() + "DVD");
// Try to make sure we delete the correct directory
if (dir.exists() && dir.dirName() == "DVD") dir.removeRecursively();
}
......@@ -890,7 +899,7 @@ void DvdWizard::slotGenerate()
warnMessage.append(i18n("Image file %1 already exists. Overwrite?", m_status.iso_image->url().path()));
if (warnMessage.isEmpty() || KMessageBox::questionYesNo(this, warnMessage) == KMessageBox::Yes) {
KIO::NetAccess::del(QUrl(m_status.tmp_folder->url().path() + QDir::separator() + "DVD"), this);
cleanup();
QTimer::singleShot(300, this, SLOT(generateDvd()));
m_status.button_preview->setEnabled(false);
m_status.button_burn->setEnabled(false);
......
......@@ -70,7 +70,6 @@
#include <KShortcutsDialog>
#include <KMessageBox>
#include <QDebug>
#include <KIO/NetAccess>
#include <KConfigDialog>
#include <KXMLGUIFactory>
#include <KColorSchemeManager>
......
......@@ -33,7 +33,6 @@
#include <KLocalizedString>
#include <KComboBox>
#include <KIO/NetAccess>
#include <KFileItem>
#include <KMessageBox>
#include <KApplication>
......
......@@ -35,9 +35,8 @@
#include <QDebug>
#include <KMessageBox>
#include <KApplication>
#include <kio/netaccess.h>
#include <kio/jobuidelegate.h>
#include <KIO/JobUiDelegate>
#include <KIO/MkdirJob>
#include <solid/device.h>
#include <solid/storageaccess.h>
#include <solid/storagedrive.h>
......@@ -530,16 +529,21 @@ void ClipManager::slotAddClipList(const QList<QUrl> &urls, const QMap <QString,
foreach(const QUrl &file, urls) {
if (QFile::exists(file.path())) {
if (!data.contains("bypassDuplicate") && !getClipByResource(file.path()).empty()) {
if (KMessageBox::warningContinueCancel(kapp->activeWindow(), i18n("Clip <b>%1</b><br />already exists in project, what do you want to do?", file.path()), i18n("Clip already exists")) == KMessageBox::Cancel)
if (KMessageBox::warningContinueCancel(QApplication::activeWindow(), i18n("Clip <b>%1</b><br />already exists in project, what do you want to do?", file.path()), i18n("Clip already exists")) == KMessageBox::Cancel)
continue;
}
if (isOnRemovableDevice(file)) {
int answer = KMessageBox::warningYesNoCancel(kapp->activeWindow(), i18n("Clip <b>%1</b><br /> is on a removable device, will not be available when device is unplugged", file.path()), i18n("File on a Removable Device"), KGuiItem(i18n("Copy file to project folder")), KGuiItem(i18n("Continue")), KStandardGuiItem::cancel(), QString("copyFilesToProjectFolder"));
int answer = KMessageBox::warningYesNoCancel(QApplication::activeWindow(), i18n("Clip <b>%1</b><br /> is on a removable device, will not be available when device is unplugged", file.path()), i18n("File on a Removable Device"), KGuiItem(i18n("Copy file to project folder")), KGuiItem(i18n("Continue")), KStandardGuiItem::cancel(), QString("copyFilesToProjectFolder"));
if (answer == KMessageBox::Cancel) continue;
else if (answer == KMessageBox::Yes) {
// Copy files to project folder
QString sourcesFolder = m_doc->projectFolder().path() + QDir::separator() + "clips/";
KIO::NetAccess::mkdir(sourcesFolder, kapp->activeWindow());
KIO::MkdirJob *mkdirJob = KIO::mkdir(sourcesFolder);
KJobWidgets::setWindow(mkdirJob, QApplication::activeWindow());
if (!mkdirJob->exec()) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Cannot create directory %1", sourcesFolder));
continue;
}
//KIO::filesize_t m_requestedSize;
KIO::CopyJob *copyjob = KIO::copy (file, QUrl(sourcesFolder));
//TODO: for some reason, passing metadata does not work...
......
......@@ -24,7 +24,6 @@
#include <QDebug>
#include <QFontDatabase>
#include <KMessageBox>
#include <KFileDialog>
ClipTranscode::ClipTranscode(const QList <QUrl> &urls, const QString &params, const QStringList &postParams, const QString &description, bool automaticMode, QWidget * parent) :
......
......@@ -26,9 +26,10 @@
#include <KDiskFreeSpaceInfo>
#include <KMessageBox>
#include <KGuiItem>
#include <KIO/NetAccess>
#include <KTar>
#include <QDebug>
#include <KIO/MkdirJob>
#include <KJobWidgets>
#include <KApplication>
#include <kio/directorysizejob.h>
#if KDE_IS_VERSION(4,7,0)
......@@ -545,7 +546,13 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass)
if (parentItem->data(0, Qt::UserRole).toString() == "slideshows") {
QUrl slideFolder(archive_url->url().path() + QDir::separator() + "slideshows");
if (isArchive) m_foldersList.append("slideshows");
else KIO::NetAccess::mkdir(slideFolder, this);
else {
KIO::MkdirJob *job = KIO::mkdir(slideFolder);
KJobWidgets::setWindow(job, QApplication::activeWindow());
if (!job->exec()) {
KMessageBox::sorry(this, i18n("Cannot create directory %1", slideFolder.path()));
}
}
isSlideshow = true;
}
else isSlideshow = false;
......@@ -622,7 +629,11 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass)
slotStartArchiving(false);
}
else {
KIO::NetAccess::mkdir(destUrl, this);
KIO::MkdirJob *job = KIO::mkdir(destUrl);
KJobWidgets::setWindow(job, QApplication::activeWindow());
if (!job->exec()) {
KMessageBox::sorry(this, i18n("Cannot create directory %1", destUrl.path()));
}
m_copyJob = KIO::copy (files, destUrl, KIO::HideProgressInfo);
connect(m_copyJob, SIGNAL(result(KJob*)), this, SLOT(slotArchivingFinished(KJob*)));
connect(m_copyJob, SIGNAL(processedSize(KJob*,qulonglong)), this, SLOT(slotArchivingProgress(KJob*,qulonglong)));
......@@ -871,7 +882,11 @@ void ArchiveWidget::slotStartExtracting()
}
QFileInfo f(m_extractUrl.path());
m_requestedSize = f.size();
KIO::NetAccess::mkdir(archive_url->url().adjusted(QUrl::StripTrailingSlash).path(), this);
KIO::MkdirJob *job = KIO::mkdir(archive_url->url());
KJobWidgets::setWindow(job, QApplication::activeWindow());
if (!job->exec()) {
KMessageBox::sorry(this, i18n("Cannot create directory %1", archive_url->url().path()));
}
slotDisplayMessage("system-run", i18n("Extracting..."));
buttonBox->button(QDialogButtonBox::Apply)->setText(i18n("Abort"));
m_archiveThread = QtConcurrent::run(this, &ArchiveWidget::doExtracting);
......
......@@ -29,8 +29,8 @@
#include <KMessageBox>
#include <QDebug>
#include <kio/directorysizejob.h>
#include <KIO/NetAccess>
#include <KStandardDirs>
#include <KIO/FileCopyJob>
#include <QTemporaryFile>
#include <QDir>
......@@ -238,8 +238,14 @@ void ProjectSettings::slotDeleteUnused()
void ProjectSettings::slotClearCache()
{
buttonBox->setEnabled(false);
KIO::NetAccess::del(QUrl(project_folder->url().path() + QDir::separator() + "thumbs/"), this);
KStandardDirs::makeDir(project_folder->url().path() + QDir::separator() + "thumbs/");
// Delete and recteate the thumbs directory
QDir dir(project_folder->url().path() + QDir::separator() + "thumbs/");
// Try to make sure we delete the correct directory
if (dir.exists() && dir.dirName() == "thumbs") {
dir.removeRecursively();
dir.setPath(project_folder->url().path());
dir.mkdir("thumbs");
}
buttonBox->setEnabled(true);
slotUpdateFiles(true);
}
......@@ -250,8 +256,14 @@ void ProjectSettings::slotDeleteProxies()
buttonBox->setEnabled(false);
enable_proxy->setChecked(false);
emit disableProxies();
KIO::NetAccess::del(QUrl(project_folder->url().path() + QDir::separator() + "proxy/"), this);
KStandardDirs::makeDir(project_folder->url().path() + QDir::separator() + "proxy/");
// Delete and recteate the proxy directory
QDir dir(project_folder->url().path() + QDir::separator() + "proxy/");
// Try to make sure we delete the correct directory
if (dir.exists() && dir.dirName() == "proxy") {
dir.removeRecursively();
dir.setPath(project_folder->url().path());
dir.mkdir("proxy");
}
buttonBox->setEnabled(true);
slotUpdateFiles(true);
}
......@@ -598,7 +610,8 @@ void ProjectSettings::slotExportToText()
return;
}
xmlf.close();
KIO::NetAccess::upload(tmpfile.fileName(), savePath, 0);
KIO::FileCopyJob *copyjob = KIO::file_copy(tmpfile.fileName(), QUrl(savePath));
copyjob->exec();
}
void ProjectSettings::slotUpdateProxyParams()
......
......@@ -48,7 +48,6 @@
#include <QDebug>
#include <KLocalizedString>
#include <KMessageBox>
#include <KIO/NetAccess>
#include <KFileItem>
#include <KApplication>
#include <KDialog>
......@@ -666,7 +665,7 @@ void ProjectList::trashUnusedClips()
emit deleteProjectClips(ids, QMap <QString, QString>());
for (int i = 0; i < urls.count(); ++i)
KIO::NetAccess::del(QUrl(urls.at(i)), this);
QFile::remove(urls.at(i));
}
void ProjectList::slotReloadClip(const QString &id)
......@@ -1378,7 +1377,7 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
if (QFile::exists(cachedPixmap)) {
QPixmap pix(cachedPixmap);
if (pix.isNull())
KIO::NetAccess::del(QUrl(cachedPixmap), this);
QFile::remove(cachedPixmap);
sub->setData(0, Qt::DecorationRole, pix);
}
}
......@@ -1480,7 +1479,7 @@ void ProjectList::getCachedThumbnail(ProjectItem *item)
if (QFile::exists(cachedPixmap)) {
QPixmap pix(cachedPixmap);
if (pix.isNull()) {
KIO::NetAccess::del(QUrl(cachedPixmap), this);
QFile::remove(cachedPixmap);
requestClipThumbnail(item->clipId());
}
else {
......@@ -1534,7 +1533,7 @@ void ProjectList::getCachedThumbnail(SubProjectItem *item)
if (QFile::exists(cachedPixmap)) {
QPixmap pix(cachedPixmap);
if (pix.isNull()) {
KIO::NetAccess::del(QUrl(cachedPixmap), this);
QFile::remove(cachedPixmap);
requestClipThumbnail(parentItem->clipId() + '#' + QString::number(pos));
}
else item->setData(0, Qt::DecorationRole, pix);
......
......@@ -27,7 +27,6 @@ the Free Software Foundation, either version 3 of the License, or
#include <KActionCollection>
#include <QAction>
#include <KMessageBox>
#include <KIO/NetAccess>
#include <KProgressDialog>
#include <KMimeType>
......@@ -430,7 +429,7 @@ void ProjectManager::recoverFiles(const QList<KAutoSaveFile *> &staleFiles, cons
if (!stale->fileName().endsWith(".lock")) {
doOpenFile(originUrl, stale);
} else {
KIO::NetAccess::del(QUrl(stale->fileName()), pCore->window());
QFile::remove(stale->fileName());
}
}
}
......
......@@ -48,8 +48,6 @@
#include <KLocalizedString>
#include <KCursor>
#include <KMessageBox>
#include <KIO/NetAccess>
#include <KFileDialog>
#include <QUrl>
#include <QIcon>
......@@ -5453,11 +5451,13 @@ void CustomTrackView::slotSaveClipMarkers(const QString &id)
cbox->setItemData(i + 1, CommentedTime::markerColor(i), Qt::DecorationRole);
}
cbox->setCurrentIndex(0);
QPointer<KFileDialog> fd = new KFileDialog(QUrl("kfiledialog:///projectfolder"), "text/plain", this, cbox);
fd->setMode(KFile::File);
fd->setOperationMode(KFileDialog::Saving);
//TODO KF5 how to ass custom cbox to Qfiledialog
QPointer<QFileDialog> fd = new QFileDialog(this, i18n("Save Clip Markers"), "kfiledialog:///projectfolder", "text/plain");
fd->setFileMode(QFileDialog::AnyFile);
if (fd->exec() != QDialog::Accepted) return;
QString url = fd->selectedFile();
QStringList selection = fd->selectedFiles();
QString url;
if (!selection.isEmpty()) url = selection.first();
delete fd;
//QString url = KFileDialog::getSaveFileName(QUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Save markers"));
if (url.isEmpty()) return;
......@@ -5496,11 +5496,13 @@ void CustomTrackView::slotLoadClipMarkers(const QString &id)
cbox->setItemData(i, CommentedTime::markerColor(i), Qt::DecorationRole);
}
cbox->setCurrentIndex(KdenliveSettings::default_marker_type());
QPointer<KFileDialog> fd = new KFileDialog(QUrl("kfiledialog:///projectfolder"), "text/plain", this, cbox);
fd->setMode(KFile::File);
fd->setOperationMode(KFileDialog::Opening);
//TODO KF5 how to ass custom cbox to Qfiledialog
QPointer<QFileDialog> fd = new QFileDialog(this, i18n("Load Clip Markers"), "kfiledialog:///projectfolder", "text/plain");
fd->setFileMode(QFileDialog::ExistingFile);
if (fd->exec() != QDialog::Accepted) return;
QString url = fd->selectedFile();
QStringList selection = fd->selectedFiles();
QString url;
if (!selection.isEmpty()) url = selection.first();
delete fd;
//QUrl url = KFileDialog::getOpenUrl(QUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Load marker file"));
......@@ -6285,7 +6287,7 @@ void CustomTrackView::slotUpdateAllThumbs()
QString thumb = thumbBase + item->baseClip()->getClipHash() + "_0.png";
if (QFile::exists(thumb)) {
QPixmap pix(thumb);
if (pix.isNull()) KIO::NetAccess::del(QUrl(thumb), this);
if (pix.isNull()) QFile::remove(thumb);
item->slotSetStartThumb(pix);
}
} else {
......@@ -6295,12 +6297,12 @@ void CustomTrackView::slotUpdateAllThumbs()
endThumb.append(QString::number((int) (item->speedIndependantCropStart() + item->speedIndependantCropDuration()).frames(m_document->fps()) - 1) + ".png");
if (QFile::exists(startThumb)) {
QPixmap pix(startThumb);
if (pix.isNull()) KIO::NetAccess::del(QUrl(startThumb), this);
if (pix.isNull()) QFile::remove(startThumb);
item->slotSetStartThumb(pix);
}
if (QFile::exists(endThumb)) {
QPixmap pix(endThumb);
if (pix.isNull()) KIO::NetAccess::del(QUrl(endThumb), this);
if (pix.isNull()) QFile::remove(endThumb);
item->slotSetEndThumb(pix);
}
}
......
......@@ -34,10 +34,11 @@
#include "dialogs/profilesdialog.h"
#include <QDebug>
#include <QScrollBar>
#include <KMessageBox>
#include <KIO/NetAccess>
#include <KIO/FileCopyJob>
#include <QScrollBar>
TrackView::TrackView(KdenliveDoc *doc, const QList<QAction *> &actions, bool *ok, QWidget *parent) :
QWidget(parent),
......@@ -450,7 +451,9 @@ void TrackView::parseDocument(const QDomDocument &doc)
message = i18n("Your project file was upgraded to the latest Kdenlive document version.\nTo make sure you don't lose data, a backup copy called %1 was created.", backupFile);
else
message = i18n("Your project file was modified by Kdenlive.\nTo make sure you don't lose data, a backup copy called %1 was created.", backupFile);
if (KIO::NetAccess::file_copy(m_doc->url(), QUrl(backupFile), this))
KIO::FileCopyJob *copyjob = KIO::file_copy(m_doc->url().path(), QUrl(backupFile));
if (copyjob->exec())
KMessageBox::information(this, message);
else
KMessageBox::information(this, i18n("Your project file was upgraded to the latest Kdenlive document version, but it was not possible to create the backup copy %1.", backupFile));
......
......@@ -22,12 +22,12 @@
#include <QDebug>
#include <QTemporaryFile>
#include <kio/netaccess.h>
#include <KApplication>
#include <KLocalizedString>
#include <KMessageBox>
#include <KStandardDirs>
#include <KIO/FileCopyJob>
#include <QGraphicsScene>
#include <QDomElement>
......@@ -313,7 +313,8 @@ bool TitleDocument::saveDocument(const QUrl &url, QGraphicsRectItem* startv, QGr
return false;
}
xmlf.close();
return KIO::NetAccess::upload(tmpfile.fileName(), url, 0);
KIO::FileCopyJob *copyjob = KIO::file_copy(tmpfile.fileName(), url);
return copyjob->exec();
}
int TitleDocument::loadFromXml(const QDomDocument& doc, QGraphicsRectItem* startv, QGraphicsRectItem* endv, int *duration, const QString& projectpath)
......
......@@ -28,7 +28,6 @@
#include <KGlobal>
#include <KMessageBox>
#include <kio/netaccess.h>
#include <kdeversion.h>
#include <QDomDocument>
......@@ -1697,16 +1696,10 @@ void TitleWidget::loadTitle(QUrl url)
}
m_scene->clearTextSelection();
QDomDocument doc;
QString tmpfile;
if (KIO::NetAccess::download(url, tmpfile, 0)) {
QFile file(tmpfile);
if (file.open(QIODevice::ReadOnly)) {
doc.setContent(&file, false);
file.close();
} else return;
KIO::NetAccess::removeTempFile(tmpfile);
}
QFile file(url.path());
doc.setContent(&file, false);
file.close();
setXml(doc);
/*int out;
......