11#include "modellist_p.h"
16#include <komparediff2_logging.h>
18#include <KActionCollection>
20#include <KIO/FileCopyJob>
21#include <KIO/MkdirJob>
23#include <KIO/UDSEntry>
24#include <KLocalizedString>
25#include <KStandardAction>
30#include <QMimeDatabase>
40 , d_ptr(new ModelListPrivate(diffSettings, supportReadWrite))
44 qCDebug(KOMPAREDIFF2_LOG) <<
"Show me the arguments: " << diffSettings <<
", " << parent;
46 if (supportReadWrite) {
47 d->applyDifference = d->actionCollection->addAction(QStringLiteral(
"difference_apply"),
this, &ModelList::slotActionApplyDifference);
48 d->applyDifference->setIcon(
QIcon::fromTheme(QStringLiteral(
"arrow-right")));
49 d->applyDifference->setText(
i18nc(
"@action",
"&Apply Difference"));
51 d->unApplyDifference = d->actionCollection->addAction(QStringLiteral(
"difference_unapply"),
this, &ModelList::slotActionUnApplyDifference);
52 d->unApplyDifference->setIcon(
QIcon::fromTheme(QStringLiteral(
"arrow-left")));
53 d->unApplyDifference->setText(
i18nc(
"@action",
"Un&apply Difference"));
55 d->applyAll = d->actionCollection->addAction(QStringLiteral(
"difference_applyall"),
this, &ModelList::slotActionApplyAllDifferences);
56 d->applyAll->setIcon(
QIcon::fromTheme(QStringLiteral(
"arrow-right-double")));
57 d->applyAll->setText(
i18nc(
"@action",
"App&ly All"));
59 d->unapplyAll = d->actionCollection->addAction(QStringLiteral(
"difference_unapplyall"),
this, &ModelList::slotActionUnapplyAllDifferences);
60 d->unapplyAll->setIcon(
QIcon::fromTheme(QStringLiteral(
"arrow-left-double")));
61 d->unapplyAll->setText(
i18nc(
"@action",
"&Unapply All"));
64 d->applyDifference =
nullptr;
65 d->unApplyDifference =
nullptr;
66 d->applyAll =
nullptr;
67 d->unapplyAll =
nullptr;
69 d->previousFile = d->actionCollection->addAction(QStringLiteral(
"difference_previousfile"),
this, &ModelList::slotPreviousModel);
70 d->previousFile->setIcon(
QIcon::fromTheme(QStringLiteral(
"arrow-up-double")));
71 d->previousFile->setText(
i18nc(
"@action",
"P&revious File"));
73 d->nextFile = d->actionCollection->addAction(QStringLiteral(
"difference_nextfile"),
this, &ModelList::slotNextModel);
75 d->nextFile->setText(
i18nc(
"@action",
"N&ext File"));
77 d->previousDifference = d->actionCollection->addAction(QStringLiteral(
"difference_previous"),
this, &ModelList::slotPreviousDifference);
78 d->previousDifference->setIcon(
QIcon::fromTheme(QStringLiteral(
"arrow-up")));
79 d->previousDifference->setText(
i18nc(
"@action",
"&Previous Difference"));
81 d->nextDifference = d->actionCollection->addAction(QStringLiteral(
"difference_next"),
this, &ModelList::slotNextDifference);
83 d->nextDifference->setText(
i18nc(
"@action",
"&Next Difference"));
85 d->previousDifference->setEnabled(
false);
86 d->nextDifference->setEnabled(
false);
88 if (supportReadWrite) {
90 d->save->setEnabled(
false);
95 d->updateModelListActions();
98ModelList::~ModelList() =
default;
100bool ModelList::compare()
106 bool sourceIsDirectory = ModelListPrivate::isDirectory(d->info->localSource);
107 bool destinationIsDirectory = ModelListPrivate::isDirectory(d->info->localDestination);
109 if (sourceIsDirectory && destinationIsDirectory) {
111 result = compare(d->info->mode);
112 }
else if (!sourceIsDirectory && !destinationIsDirectory) {
113 QFile sourceFile(d->info->localSource);
118 qCDebug(KOMPAREDIFF2_LOG) <<
"Mimetype source : " << sourceMimeType;
120 QFile destinationFile(d->info->localDestination);
123 destinationFile.close();
124 qCDebug(KOMPAREDIFF2_LOG) <<
"Mimetype destination: " << destinationMimeType;
127 if (!ModelListPrivate::isDiff(sourceMimeType) && ModelListPrivate::isDiff(destinationMimeType)) {
128 qCDebug(KOMPAREDIFF2_LOG) <<
"Blending destination into source...";
130 result = openFileAndDiff();
131 }
else if (ModelListPrivate::isDiff(sourceMimeType) && !ModelListPrivate::isDiff(destinationMimeType)) {
132 qCDebug(KOMPAREDIFF2_LOG) <<
"Blending source into destination...";
135 d->info->swapSourceWithDestination();
138 result = openFileAndDiff();
140 qCDebug(KOMPAREDIFF2_LOG) <<
"Comparing source with destination";
142 result = compare(d->info->mode);
144 }
else if (sourceIsDirectory && !destinationIsDirectory) {
146 result = openDirAndDiff();
150 d->info->swapSourceWithDestination();
153 result = openDirAndDiff();
159bool ModelList::compare(
Mode mode)
165 d->diffProcess = std::make_unique<KompareProcess>(d->diffSettings, Custom, d->info->localSource, d->info->localDestination,
QString(), mode);
166 d->diffProcess->setEncoding(d->encoding);
168 connect(d->diffProcess.get(), &KompareProcess::diffHasFinished,
this, &ModelList::slotDiffProcessFinished);
171 d->diffProcess->start();
176bool ModelList::openFileAndDiff()
182 if (parseDiffOutput(d->readFile(d->info->localDestination)) != 0) {
183 Q_EMIT error(
i18n(
"<qt>No models or no differences, this file: <b>%1</b>, is not a valid diff file.</qt>", d->info->destination.url()));
187 d->setDepthAndApplied();
189 if (!blendOriginalIntoModelList(d->info->localSource)) {
190 qCDebug(KOMPAREDIFF2_LOG) <<
"Oops cant blend original file into modellist : " << d->info->localSource;
192 i18n(
"<qt>There were problems applying the diff <b>%1</b> to the file <b>%2</b>.</qt>", d->info->destination.url(), d->info->source.url()));
196 d->updateModelListActions();
202bool ModelList::openDirAndDiff()
208 if (parseDiffOutput(d->readFile(d->info->localDestination)) != 0) {
209 Q_EMIT error(
i18n(
"<qt>No models or no differences, this file: <b>%1</b>, is not a valid diff file.</qt>", d->info->destination.url()));
213 d->setDepthAndApplied();
216 if (!blendOriginalIntoModelList(d->info->localSource)) {
218 qCDebug(KOMPAREDIFF2_LOG) <<
"Oops cant blend original dir into modellist : " << d->info->localSource;
220 i18n(
"<qt>There were problems applying the diff <b>%1</b> to the folder <b>%2</b>.</qt>", d->info->destination.url(), d->info->source.url()));
224 d->updateModelListActions();
235 if (d->selectedModel) {
236 saveDestination(d->selectedModel);
238 d->save->setEnabled(
false);
243bool ModelList::saveDestination(
DiffModel *model)
247 qCDebug(KOMPAREDIFF2_LOG) <<
"ModelList::saveDestination: ";
250 if (!model->hasUnsavedChanges())
256 Q_EMIT error(
i18n(
"Could not open a temporary file."));
266 for (
const DiffHunk *hunk : *hunks) {
270 if (!diff->applied()) {
273 list.
append(diffString->string());
289 Q_EMIT error(
i18n(
"<qt>Could not write to the temporary file <b>%1</b>, deleting it.</qt>", temp.
fileName()));
296 Q_EMIT error(
i18n(
"<qt>Could not write to the temporary file <b>%1</b>, deleting it.</qt>", temp.
fileName()));
307 qCDebug(KOMPAREDIFF2_LOG) <<
"Tempfilename (save) : " << temp.
fileName();
308 qCDebug(KOMPAREDIFF2_LOG) <<
"Model->path+file : " << model->destinationPath() << model->destinationFile();
309 qCDebug(KOMPAREDIFF2_LOG) <<
"info->localdest : " << d->info->localDestination;
310 QString tmp = model->destinationPath();
311 if (tmp.
startsWith(d->info->localDestination))
312 tmp.
remove(0, d->info->localDestination.size());
313 qCDebug(KOMPAREDIFF2_LOG) <<
"DestinationURL : " << d->info->destination;
314 qCDebug(KOMPAREDIFF2_LOG) <<
"tmp : " << tmp;
316 QUrl fullDestinationPath = d->info->destination;
317 fullDestinationPath.
setPath(fullDestinationPath.
path() + tmp);
318 qCDebug(KOMPAREDIFF2_LOG) <<
"fullDestinationPath : " << fullDestinationPath;
320 if (!statJob->
exec()) {
323 if (!mkdirJob->
exec()) {
324 Q_EMIT error(
i18n(
"<qt>Could not create destination directory <b>%1</b>.\nThe file has not been saved.</qt>", fullDestinationPath.
path()));
328 fullDestinationPath.
setPath(fullDestinationPath.
path() + model->destinationFile());
330 result = copyJob->
exec();
332 qCDebug(KOMPAREDIFF2_LOG) <<
"Tempfilename : " << temp.
fileName();
333 qCDebug(KOMPAREDIFF2_LOG) <<
"DestinationURL : " << d->info->destination;
336 int permissions = -1;
338 result = statJob->
exec();
343 result = copyJob->
exec();
344 qCDebug(KOMPAREDIFF2_LOG) <<
"true or false?" << result;
350 i18n(
"<qt>Could not upload the temporary file to the destination location <b>%1</b>. The temporary file is still available under: <b>%2</b>. You "
351 "can manually copy it to the right place.</qt>",
352 d->info->destination.url(),
365 diff->setUnsaved(
false);
372bool ModelList::saveAll()
376 if (modelCount() == 0)
379 for (
DiffModel *model : std::as_const(*d->models)) {
380 if (!saveDestination(model))
387void ModelList::setEncoding(
const QString &encoding)
391 d->encoding = encoding;
395 qCDebug(KOMPAREDIFF2_LOG) <<
"Encoding : " << encoding;
397 qCDebug(KOMPAREDIFF2_LOG) <<
"TextCodec: " << d->textDecoder.name();
398 if (!d->textDecoder.isValid())
401 qCDebug(KOMPAREDIFF2_LOG) <<
"TextCodec: " << d->textDecoder.name();
404void ModelList::setReadWrite(
bool isReadWrite)
408 if (d->isReadWrite == isReadWrite)
411 d->isReadWrite = isReadWrite;
412 d->updateModelListActions();
415bool ModelList::isReadWrite()
const
419 return d->isReadWrite;
422void ModelList::slotDiffProcessFinished(
bool success)
428 if (parseDiffOutput(d->diffProcess->diffOutput()) != 0) {
429 Q_EMIT error(
i18n(
"Could not parse diff output."));
432 qCDebug(KOMPAREDIFF2_LOG) <<
"Blend this crap please and do not give me any conflicts...";
433 blendOriginalIntoModelList(d->info->localSource);
435 d->updateModelListActions();
439 }
else if (d->diffProcess->exitStatus() == 0) {
440 Q_EMIT error(
i18n(
"The files are identical."));
442 Q_EMIT error(d->diffProcess->stdErr());
446 d->diffProcess.release()->deleteLater();
449bool ModelList::openDiff(
const QString &diffFile)
453 qCDebug(KOMPAREDIFF2_LOG) <<
"Stupid :) Url = " << diffFile;
458 QString diff = d->readFile(diffFile);
464 if (parseDiffOutput(diff) != 0) {
465 Q_EMIT error(
i18n(
"Could not parse diff output."));
469 d->updateModelListActions();
477bool ModelList::parseAndOpenDiff(
const QString &diff)
485 if (parseDiffOutput(diff) != 0) {
486 Q_EMIT error(
i18n(
"Could not parse diff output."));
490 d->updateModelListActions();
497QString ModelList::recreateDiff()
const
503 for (
const DiffModel *model : *d->models) {
504 diff += model->recreateDiff();
514 qCDebug(KOMPAREDIFF2_LOG) <<
"ModelList::saveDiff: ";
516 d->diffTemp = std::make_unique<QTemporaryFile>();
517 d->diffURL =
QUrl(url);
519 if (!d->diffTemp->open()) {
520 Q_EMIT error(
i18n(
"Could not open a temporary file."));
521 d->diffTemp->remove();
526 d->diffProcess = std::make_unique<KompareProcess>(diffSettings, Custom, d->info->localSource, d->info->localDestination, directory);
527 d->diffProcess->setEncoding(d->encoding);
529 connect(d->diffProcess.get(), &KompareProcess::diffHasFinished,
this, &ModelList::slotWriteDiffOutput);
532 d->diffProcess->start();
536void ModelList::slotWriteDiffOutput(
bool success)
540 qCDebug(KOMPAREDIFF2_LOG) <<
"Success = " << success;
545 stream << d->diffProcess->diffOutput();
547 d->diffTemp->close();
550 Q_EMIT error(
i18n(
"Could not write to the temporary file."));
560 d->diffTemp->remove();
563 d->diffProcess.reset();
572 qCDebug(KOMPAREDIFF2_LOG) <<
"ModelList::slotSelectionChanged( " << model <<
", " << diff <<
" )";
576 d->selectedModel =
const_cast<DiffModel *
>(model);
577 d->modelIndex = d->models->indexOf(d->selectedModel);
578 qCDebug(KOMPAREDIFF2_LOG) <<
"d->modelIndex = " << d->modelIndex;
579 d->selectedDifference =
const_cast<Difference *
>(diff);
581 d->selectedModel->setSelectedDifference(d->selectedDifference);
585 if (!d->setSelectedModel(d->selectedModel)) {
587 d->selectedModel = d->firstModel();
588 d->selectedDifference = d->selectedModel->firstDifference();
589 }
else if (!d->selectedModel->setSelectedDifference(d->selectedDifference)) {
591 d->selectedDifference = d->selectedModel->firstDifference();
594 Q_EMIT setSelection(model, diff);
595 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
596 d->selectedModel->findDifference(d->selectedDifference),
599 d->selectedModel->appliedCount());
601 d->updateModelListActions();
610 qCDebug(KOMPAREDIFF2_LOG) <<
"ModelList::slotSelectionChanged( " << diff <<
" )";
613 d->selectedDifference =
const_cast<Difference *
>(diff);
615 if (!d->selectedModel->setSelectedDifference(d->selectedDifference)) {
617 d->selectedDifference = d->selectedModel->firstDifference();
620 Q_EMIT setSelection(diff);
621 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
622 d->selectedModel->findDifference(d->selectedDifference),
625 d->selectedModel->appliedCount());
627 d->updateModelListActions();
630void ModelList::slotPreviousModel()
634 if ((d->selectedModel = d->prevModel()) !=
nullptr) {
635 d->selectedDifference = d->selectedModel->firstDifference();
637 d->selectedModel = d->firstModel();
638 d->selectedDifference = d->selectedModel->firstDifference();
641 Q_EMIT setSelection(d->selectedModel, d->selectedDifference);
642 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
643 d->selectedModel->findDifference(d->selectedDifference),
646 d->selectedModel->appliedCount());
647 d->updateModelListActions();
650void ModelList::slotNextModel()
654 if ((d->selectedModel = d->nextModel()) !=
nullptr) {
655 d->selectedDifference = d->selectedModel->firstDifference();
657 d->selectedModel = d->lastModel();
658 d->selectedDifference = d->selectedModel->firstDifference();
661 Q_EMIT setSelection(d->selectedModel, d->selectedDifference);
662 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
663 d->selectedModel->findDifference(d->selectedDifference),
666 d->selectedModel->appliedCount());
667 d->updateModelListActions();
670Mode ModelList::mode()
const
674 return d->info->mode;
681 return d->models.get();
688 return d->actionCollection;
691void ModelList::slotPreviousDifference()
695 qCDebug(KOMPAREDIFF2_LOG) <<
"slotPreviousDifference called";
696 if ((d->selectedDifference = d->selectedModel->prevDifference()) !=
nullptr) {
697 Q_EMIT setSelection(d->selectedDifference);
698 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
699 d->selectedModel->findDifference(d->selectedDifference),
702 d->selectedModel->appliedCount());
703 d->updateModelListActions();
707 qCDebug(KOMPAREDIFF2_LOG) <<
"**** no previous difference... ok lets find the previous model...";
709 if ((d->selectedModel = d->prevModel()) !=
nullptr) {
710 d->selectedDifference = d->selectedModel->lastDifference();
712 Q_EMIT setSelection(d->selectedModel, d->selectedDifference);
713 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
714 d->selectedModel->findDifference(d->selectedDifference),
717 d->selectedModel->appliedCount());
718 d->updateModelListActions();
722 qCDebug(KOMPAREDIFF2_LOG) <<
"**** !!! No previous model, ok backup plan activated...";
725 d->selectedModel = d->firstModel();
726 d->selectedDifference = d->selectedModel->firstDifference();
728 Q_EMIT setSelection(d->selectedModel, d->selectedDifference);
729 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
730 d->selectedModel->findDifference(d->selectedDifference),
733 d->selectedModel->appliedCount());
734 d->updateModelListActions();
737void ModelList::slotNextDifference()
741 qCDebug(KOMPAREDIFF2_LOG) <<
"slotNextDifference called";
742 if ((d->selectedDifference = d->selectedModel->nextDifference()) !=
nullptr) {
743 Q_EMIT setSelection(d->selectedDifference);
744 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
745 d->selectedModel->findDifference(d->selectedDifference),
748 d->selectedModel->appliedCount());
749 d->updateModelListActions();
753 qCDebug(KOMPAREDIFF2_LOG) <<
"**** no next difference... ok lets find the next model...";
755 if ((d->selectedModel = d->nextModel()) !=
nullptr) {
756 d->selectedDifference = d->selectedModel->firstDifference();
758 Q_EMIT setSelection(d->selectedModel, d->selectedDifference);
759 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
760 d->selectedModel->findDifference(d->selectedDifference),
763 d->selectedModel->appliedCount());
764 d->updateModelListActions();
768 qCDebug(KOMPAREDIFF2_LOG) <<
"**** !!! No next model, ok backup plan activated...";
771 d->selectedModel = d->lastModel();
772 d->selectedDifference = d->selectedModel->lastDifference();
774 Q_EMIT setSelection(d->selectedModel, d->selectedDifference);
775 Q_EMIT setStatusBarModelInfo(findModel(d->selectedModel),
776 d->selectedModel->findDifference(d->selectedDifference),
779 d->selectedModel->appliedCount());
780 d->updateModelListActions();
783void ModelList::slotApplyDifference(
bool apply)
787 d->selectedModel->applyDifference(apply);
788 Q_EMIT applyDifference(apply);
791void ModelList::slotApplyAllDifferences(
bool apply)
795 d->selectedModel->applyAllDifferences(apply);
796 Q_EMIT applyAllDifferences(apply);
799int ModelList::parseDiffOutput(
const QString &diff)
803 qCDebug(KOMPAREDIFF2_LOG) <<
"ModelList::parseDiffOutput";
806 QStringList diffLines = ModelListPrivate::split(diff);
808 std::unique_ptr<Parser> parser = std::make_unique<Parser>(
this);
809 bool malformed =
false;
810 d->models.reset(parser->parse(diffLines, &malformed));
812 d->info->generator = parser->generator();
813 d->info->format = parser->format();
819 qCDebug(KOMPAREDIFF2_LOG) <<
"Malformed diff";
820 Q_EMIT error(
i18n(
"The diff is malformed. Some lines could not be parsed and will not be displayed in the diff view."));
823 d->selectedModel = d->firstModel();
824 qCDebug(KOMPAREDIFF2_LOG) <<
"Ok there are differences...";
825 d->selectedDifference = d->selectedModel->firstDifference();
826 Q_EMIT setStatusBarModelInfo(0, 0, modelCount(), differenceCount(), 0);
829 qCDebug(KOMPAREDIFF2_LOG) <<
"Now i'll be damned, there should be models here !!!";
836bool ModelList::blendOriginalIntoModelList(
const QString &localURL)
840 qCDebug(KOMPAREDIFF2_LOG) <<
"Hurrah we are blending...";
848 qCDebug(KOMPAREDIFF2_LOG) <<
"Blend Dir";
850 for (
DiffModel *model : std::as_const(*d->models)) {
851 qCDebug(KOMPAREDIFF2_LOG) <<
"Model : " << model;
852 QString filename = model->source();
857 qCDebug(KOMPAREDIFF2_LOG) <<
"Reading from: " << filename;
858 fileContents = d->readFile(filename);
859 result = d->blendFile(model, fileContents);
861 qCDebug(KOMPAREDIFF2_LOG) <<
"File " << filename <<
" does not exist !";
862 qCDebug(KOMPAREDIFF2_LOG) <<
"Assume empty file !";
864 result = d->blendFile(model, fileContents);
867 qCDebug(KOMPAREDIFF2_LOG) <<
"End of Blend Dir";
868 }
else if (fi.isFile()) {
869 qCDebug(KOMPAREDIFF2_LOG) <<
"Blend File";
870 qCDebug(KOMPAREDIFF2_LOG) <<
"Reading from: " << localURL;
871 fileContents = d->readFile(localURL);
873 result = d->blendFile((*d->models)[0], fileContents);
874 qCDebug(KOMPAREDIFF2_LOG) <<
"End of Blend File";
880void ModelList::show()
884 qCDebug(KOMPAREDIFF2_LOG) <<
"ModelList::Show Number of models = " << d->models->count();
885 Q_EMIT modelsChanged(d->models.get());
886 Q_EMIT setSelection(d->selectedModel, d->selectedDifference);
889const DiffModel *ModelList::modelAt(
int i)
const
893 return d->models->at(i);
900 return d->models->at(i);
903int ModelList::findModel(
DiffModel *model)
const
907 return d->models->indexOf(model);
910int ModelList::currentModel()
const
914 return d->models->indexOf(d->selectedModel);
917int ModelList::currentDifference()
const
921 return d->selectedModel ? d->selectedModel->findDifference(d->selectedDifference) : -1;
924const DiffModel *ModelList::selectedModel()
const
928 return d->selectedModel;
931const Difference *ModelList::selectedDifference()
const
935 return d->selectedDifference;
938void ModelList::clear()
945 Q_EMIT modelsChanged(d->models.get());
948void ModelList::refresh()
953 compare(d->info->mode);
956void ModelList::swap()
962 compare(d->info->mode);
964 compare(d->info->mode);
967bool ModelList::hasUnsavedChanges()
const
975 return std::any_of(d->models->constBegin(), d->models->constEnd(), [] (
const DiffModel *model) {
976 return model->hasUnsavedChanges();
980int ModelList::modelCount()
const
984 return d->models ? d->models->count() : 0;
987int ModelList::differenceCount()
const
991 return d->selectedModel ? d->selectedModel->differenceCount() : -1;
994int ModelList::appliedCount()
const
998 return d->selectedModel ? d->selectedModel->appliedCount() : -1;
1001void ModelList::slotKompareInfo(
Info *info)
1008void ModelList::slotActionApplyDifference()
1012 if (!d->selectedDifference->applied())
1013 slotApplyDifference(
true);
1014 slotNextDifference();
1015 d->updateModelListActions();
1018void ModelList::slotActionUnApplyDifference()
1022 if (d->selectedDifference->applied())
1023 slotApplyDifference(
false);
1024 slotPreviousDifference();
1025 d->updateModelListActions();
1028void ModelList::slotActionApplyAllDifferences()
1032 slotApplyAllDifferences(
true);
1033 d->updateModelListActions();
1036void ModelList::slotActionUnapplyAllDifferences()
1040 slotApplyAllDifferences(
false);
1041 d->updateModelListActions();
1044#include "moc_modellist.cpp"
const UDSEntry & statResult() const
long long numberValue(uint field, long long defaultValue=0) const
A model describing the differences between two files.
void slotSaveDestination()
Save the currently selected destination in a multi-file diff, or the single destination if a single f...
Q_SCRIPTABLE CaptureState status()
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
KIOCORE_EXPORT MkdirJob * mkdir(const QUrl &url, int permissions=-1)
KIOCORE_EXPORT StatJob * stat(const QUrl &url, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT FileCopyJob * file_copy(const QUrl &src, const QUrl &dest, int permissions=-1, JobFlags flags=DefaultFlags)
KIOCORE_EXPORT QStringList list(const QString &fileClass)
QAction * save(const QObject *recvr, const char *slot, QObject *parent)
@ ComparingFiles
compareFiles
@ ComparingDirs
compareDirs
@ BlendingFile
openFileAndDiff
@ BlendingDir
openDirAndDiff
const char * constData() const const
QString filePath(const QString &fileName) const const
virtual void close() override
FileError error() const const
QIcon fromTheme(const QString &name)
void append(QList< T > &&value)
qsizetype count() const const
QMimeType mimeTypeForData(QIODevice *device) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * sender() const const
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
bool isEmpty() const const
QString & remove(QChar ch, Qt::CaseSensitivity cs)
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
QByteArray toUtf8() const const
void truncate(qsizetype position)
QString join(QChar separator) const const
virtual QString fileName() const const override
void setAutoRemove(bool b)
QUrl fromLocalFile(const QString &localFile)
QString path(ComponentFormattingOptions options) const const
void setPath(const QString &path, ParsingMode mode)