Commit aa6d1ef5 authored by Sergey Popov's avatar Sergey Popov
Browse files

Fix almost all the remaining Clazy warnings

I fixed almost all the remaining warnings in KDevPlatform but there are some warnings, which are still not fixed. "Missing Q_OBJECT macro" in some files, generated while building, for example.
REVIEW:126782
parent 9b16e0b7
......@@ -126,7 +126,7 @@ void BreakpointDetails::setItem(Breakpoint *b)
}
if (b->hitCount() == -1)
m_hits->setText("");
m_hits->clear();
else if (b->hitCount())
m_hits->setText(i18np("Hit %1 time", "Hit %1 times", b->hitCount()));
else
......@@ -140,7 +140,7 @@ void BreakpointDetails::setItem(Breakpoint *b)
void BreakpointDetails::showExplanation(const QString& link)
{
QPoint pos = m_status->mapToGlobal(m_status->geometry().topLeft());
if (link == "pending")
if (link == QLatin1String("pending"))
{
QWhatsThis::showText(pos,
i18n("<b>Breakpoint is pending</b>"
......@@ -153,7 +153,7 @@ void BreakpointDetails::showExplanation(const QString& link)
"breakpoint only when the library is loaded.</p>"),
m_status);
}
else if (link == "dirty")
else if (link == QLatin1String("dirty"))
{
QWhatsThis::showText(pos,
i18n("<b>Breakpoint is dirty</b>"
......
......@@ -276,7 +276,7 @@ void BreakpointWidget::breakpointError(int row, const QString& msg)
pop->setPopupStyle(KPassivePopup::Boxed);
pop->setAutoDelete(true);
// FIXME: the icon, too.
pop->setView("", msg);
pop->setView(QString(), msg);
pop->setTimeout(-1);
pop->show(p);
}
......
......@@ -186,6 +186,7 @@ int TreeItem::row() const
class EllipsisItem : public TreeItem
{
Q_OBJECT
public:
EllipsisItem(TreeModel *model, TreeItem *parent)
: TreeItem(model, parent)
......@@ -261,3 +262,4 @@ void KDevelop::TreeItem::setExpanded(bool b)
}
}
#include "treeitem.moc"
......@@ -170,10 +170,10 @@ void Variable::resetChanged()
Variable::format_t Variable::str2format(const QString& str)
{
if(str=="Binary" || str=="binary") return Binary;
if(str=="Octal" || str=="octal") return Octal;
if(str=="Decimal" || str=="decimal") return Decimal;
if(str=="Hexadecimal" || str=="hexadecimal")return Hexadecimal;
if(str==QLatin1String("Binary") || str==QLatin1String("binary")) return Binary;
if(str==QLatin1String("Octal") || str==QLatin1String("octal")) return Octal;
if(str==QLatin1String("Decimal") || str==QLatin1String("decimal")) return Decimal;
if(str==QLatin1String("Hexadecimal") || str==QLatin1String("hexadecimal"))return Hexadecimal;
return Natural; // maybe most reasonable default
}
......@@ -181,12 +181,12 @@ Variable::format_t Variable::str2format(const QString& str)
QString Variable::format2str(format_t format)
{
switch(format) {
case Natural: return "natural";
case Binary: return "binary";
case Octal: return "octal";
case Decimal: return "decimal";
case Hexadecimal: return "hexadecimal";
default: return "";
case Natural: return QStringLiteral("natural");
case Binary: return QStringLiteral("binary");
case Octal: return QStringLiteral("octal");
case Decimal: return QStringLiteral("decimal");
case Hexadecimal: return QStringLiteral("hexadecimal");
default: return QString();
}
}
......@@ -504,7 +504,7 @@ QString VariableProvider::textHint(KTextEditor::View* view, const KTextEditor::C
if (!hasStartedSession())
return QString();
if (ICore::self()->uiController()->activeArea()->objectName() != "debug")
if (ICore::self()->uiController()->activeArea()->objectName() != QLatin1String("debug"))
return QString();
//TODO: These keyboardModifiers should also hide already opened tooltip, and show another one for code area.
......
......@@ -124,6 +124,7 @@ private:
class KDEVPLATFORMDEBUGGER_EXPORT TooltipRoot : public TreeItem
{
Q_OBJECT
public:
explicit TooltipRoot(TreeModel* model)
: TreeItem(model)
......@@ -139,6 +140,7 @@ public:
class KDEVPLATFORMDEBUGGER_EXPORT Watches : public TreeItem
{
Q_OBJECT
friend class GDBDebugger::GdbTest;
public:
Watches(TreeModel* model, TreeItem* parent);
......@@ -164,6 +166,7 @@ private:
class KDEVPLATFORMDEBUGGER_EXPORT Locals : public TreeItem
{
Q_OBJECT
public:
Locals(TreeModel* model, TreeItem* parent, const QString &name);
QList<Variable*> updateLocals(QStringList locals);
......@@ -181,11 +184,12 @@ private:
class KDEVPLATFORMDEBUGGER_EXPORT VariablesRoot : public TreeItem
{
Q_OBJECT
public:
explicit VariablesRoot(TreeModel* model);
Watches *watches() const { return watches_; }
Locals *locals(const QString &name = QLatin1String("Locals"));
Locals *locals(const QString &name = QStringLiteral("Locals"));
QHash<QString, Locals*> allLocals() const;
void fetchMoreChildren() override {}
......
......@@ -51,6 +51,7 @@ namespace KDevelop {
class SizeGrip : public QWidget
{
Q_OBJECT
public:
SizeGrip(QWidget* parent) : QWidget(parent) {
m_parent = parent;
......@@ -190,9 +191,9 @@ void VariableToolTip::slotLinkActivated(const QString& link)
IDebugSession *session = ICore::self()->debugController()->currentSession();
if (session && session->state() != IDebugSession::NotStartedState && session->state() != IDebugSession::EndedState) {
if (link == "add_watch") {
if (link == QLatin1String("add_watch")) {
session->variableController()->addWatch(v);
} else if (link == "add_watchpoint") {
} else if (link == QLatin1String("add_watchpoint")) {
session->variableController()->addWatchpoint(v);
}
}
......@@ -216,3 +217,4 @@ void VariableToolTip::slotRangeChanged(int min, int max)
}
#include "variabletooltip.moc"
......@@ -30,17 +30,17 @@
namespace KDevelop
{
const QString ContextMenuExtension::FileGroup = "FileGroup";
const QString ContextMenuExtension::RefactorGroup = "RefactorGroup";
const QString ContextMenuExtension::BuildGroup = "BuildGroup";
const QString ContextMenuExtension::RunGroup = "RunGroup";
const QString ContextMenuExtension::DebugGroup = "DebugGroup";
const QString ContextMenuExtension::EditGroup = "EditGroup";
const QString ContextMenuExtension::VcsGroup = "VcsGroup";
const QString ContextMenuExtension::ProjectGroup = "ProjectGroup";
const QString ContextMenuExtension::OpenEmbeddedGroup = "OpenEmbeddedGroup";
const QString ContextMenuExtension::OpenExternalGroup = "OpenExternalGroup";
const QString ContextMenuExtension::ExtensionGroup = "ExtensionGroup";
const QString ContextMenuExtension::FileGroup = QStringLiteral("FileGroup");
const QString ContextMenuExtension::RefactorGroup = QStringLiteral("RefactorGroup");
const QString ContextMenuExtension::BuildGroup = QStringLiteral("BuildGroup");
const QString ContextMenuExtension::RunGroup = QStringLiteral("RunGroup");
const QString ContextMenuExtension::DebugGroup = QStringLiteral("DebugGroup");
const QString ContextMenuExtension::EditGroup = QStringLiteral("EditGroup");
const QString ContextMenuExtension::VcsGroup = QStringLiteral("VcsGroup");
const QString ContextMenuExtension::ProjectGroup = QStringLiteral("ProjectGroup");
const QString ContextMenuExtension::OpenEmbeddedGroup = QStringLiteral("OpenEmbeddedGroup");
const QString ContextMenuExtension::OpenExternalGroup = QStringLiteral("OpenExternalGroup");
const QString ContextMenuExtension::ExtensionGroup = QStringLiteral("ExtensionGroup");
class ContextMenuExtensionPrivate
......
......@@ -38,8 +38,8 @@ KPluginFactory* IPartController::findPartFactory ( const QString& mimetype, cons
{
// parttype may be a interface type not derived from KParts/ReadOnlyPart
const KService::List offers = KMimeTypeTrader::self()->query( mimetype,
QString::fromLatin1( "KParts/ReadOnlyPart" ),
QString::fromLatin1( "'%1' in ServiceTypes" ).arg( parttype ) );
QStringLiteral( "KParts/ReadOnlyPart" ),
QStringLiteral( "'%1' in ServiceTypes" ).arg( parttype ) );
if ( ! offers.isEmpty() )
{
KService::Ptr ptr;
......
......@@ -72,7 +72,7 @@ public:
if (! projectCount)
reverse = IPlugin::StateReverse;
q->stateChanged(QLatin1String("has_project"), reverse);
q->stateChanged(QStringLiteral("has_project"), reverse);
}
IPlugin *q;
......
......@@ -100,7 +100,7 @@ void SourceFormatterStyle::setMimeTypes(const SourceFormatterStyle::MimeList& ty
void SourceFormatterStyle::setMimeTypes(const QStringList& types)
{
for ( auto t: types ) {
foreach ( auto& t, types ) {
auto items = t.split('|');
if ( items.size() != 2 ) {
continue;
......@@ -145,7 +145,7 @@ bool SourceFormatterStyle::supportsLanguage(const QString &language) const
QString SourceFormatterStyle::modeForMimetype(const QMimeType& mime) const
{
for (const auto& item : mimeTypes()) {
foreach (const auto& item, mimeTypes()) {
if (mime.inherits(item.mimeType)) {
return item.highlightMode;
}
......
......@@ -91,7 +91,7 @@ void RenameAction::execute()
DocumentChangeSet changes;
foreach(const RevisionedFileRanges& ranges, d->m_oldDeclarationUses) {
foreach (const RangeInRevision &range, ranges.ranges) {
foreach (const RangeInRevision range, ranges.ranges) {
KTextEditor::Range currentRange;
if (ranges.revision && ranges.revision->valid()) {
currentRange = ranges.revision->transformToCurrentRevision(range);
......
......@@ -166,7 +166,7 @@ void RenameAssistant::textChanged(KTextEditor::View* view, const KTextEditor::Ra
for(QMap< IndexedString, QList< RangeInRevision > >::const_iterator it = declUses.constBegin();
it != declUses.constEnd(); ++it)
{
foreach(const RangeInRevision& range, it.value()) {
foreach(const RangeInRevision range, it.value()) {
KTextEditor::Range currentRange = declAtCursor->transformFromLocalRevision(range);
if(currentRange.isEmpty() || view->document()->text(currentRange) != declAtCursor->identifier().identifier().str()) {
return; // One of the uses is invalid. Maybe the replacement has already been performed.
......
......@@ -69,7 +69,7 @@ const bool separateThreadForHighPriority = true;
static QString elidedPathLeft(const QString& path, int width)
{
static const QChar separator = QDir::separator();
static const QString placeholder = "...";
static const QString placeholder = QStringLiteral("...");
if (path.size() <= width) {
return path;
......@@ -244,7 +244,7 @@ public:
// Ok, enqueueing is fine because m_parseJobs contains all of the jobs now
foreach (ThreadWeaver::JobPointer job, jobs)
foreach (const ThreadWeaver::JobPointer& job, jobs)
m_weaver.enqueue(job);
m_parser->updateProgressBar();
......@@ -262,7 +262,7 @@ public:
///FIXME: use IndexedString in the other APIs as well! Esp. for createParseJob!
QUrl qUrl = url.toUrl();
auto languages = m_languageController->languagesForUrl(qUrl);
foreach (const auto& language, languages) {
foreach (const auto language, languages) {
if(!language) {
qCWarning(LANGUAGE) << "got zero language for" << qUrl;
continue;
......
......@@ -70,7 +70,7 @@ DocumentChangeTracker::DocumentChangeTracker( KTextEditor::Document* document )
// Check whether a language plugin is tracking the document which belongs to a
// whitespace-sensitive language (e.g. python)
foreach (const auto& lang, ICore::self()->languageController()->languagesForUrl(document->url())) {
foreach (const auto lang, ICore::self()->languageController()->languagesForUrl(document->url())) {
if (!lang) {
continue;
}
......@@ -141,7 +141,7 @@ bool DocumentChangeTracker::checkMergeTokens(const KTextEditor::Range& range)
///@todo Improve this so that it really checks whether some merge-able tokens have been moved together
if(m_document->documentRange().contains(range))
{
if(range.start().column() == 0 || m_document->text(KTextEditor::Range(range.start().line(), range.start().column()-1, range.start().line(), range.start().column()))[0].isSpace())
if(range.start().column() == 0 || m_document->text(KTextEditor::Range(range.start().line(), range.start().column()-1, range.start().line(), range.start().column())).at(0).isSpace())
return true;
if(range.end().column() >= m_document->lineLength(range.end().line()) || m_document->text(KTextEditor::Range(range.end().line(), range.end().column(), range.end().line(), range.end().column()+1))[0].isSpace())
return true;
......
......@@ -166,7 +166,7 @@ void ParseJob::setMinimumFeatures(TopDUContext::Features features)
bool ParseJob::hasStaticMinimumFeatures()
{
QMutexLocker lock(&minimumFeaturesMutex);
return ::staticMinimumFeatures.size();
return !::staticMinimumFeatures.isEmpty();
}
TopDUContext::Features ParseJob::staticMinimumFeatures(const IndexedString& url)
......@@ -175,7 +175,7 @@ TopDUContext::Features ParseJob::staticMinimumFeatures(const IndexedString& url)
TopDUContext::Features features = (TopDUContext::Features)0;
if(::staticMinimumFeatures.contains(url))
foreach(const TopDUContext::Features &f, ::staticMinimumFeatures[url])
foreach(const TopDUContext::Features f, ::staticMinimumFeatures[url])
features = (TopDUContext::Features)(features | f);
return features;
......
......@@ -59,7 +59,7 @@ ParseProjectJob::ParseProjectJob(IProject* project, bool forceUpdate)
if (!ICore::self()->projectController()->parseAllProjectSources()) {
// In case we don't want to parse the whole project, still add all currently open files that belong to the project to the background-parser
for (auto document: ICore::self()->documentController()->openDocuments()) {
foreach (auto document, ICore::self()->documentController()->openDocuments()) {
const auto path = IndexedString(document->url());
if (project->fileSet().contains(path)) {
m_filesToParse.insert(path);
......@@ -124,7 +124,7 @@ void ParseProjectJob::start() {
}
// Add all currently open files that belong to the project to the background-parser, so that they'll be parsed first of all
for (auto document: ICore::self()->documentController()->openDocuments()) {
foreach (auto document, ICore::self()->documentController()->openDocuments()) {
const auto path = IndexedString(document->url());
if (m_filesToParse.contains(path)) {
ICore::self()->languageController()->backgroundParser()->addDocument(path, TopDUContext::AllDeclarationsContextsAndUses, 10, this );
......
......@@ -166,9 +166,9 @@ void TestBackgroundparser::initTestCase()
TestLanguageSupport* testLang = new TestLanguageSupport();
connect(testLang, &TestLanguageSupport::parseJobCreated,
&m_jobPlan, &JobPlan::parseJobCreated);
langController->addTestLanguage(testLang, QStringList() << "text/plain");
langController->addTestLanguage(testLang, QStringList() << QStringLiteral("text/plain"));
const auto languages = langController->languagesForUrl(QUrl::fromLocalFile("/foo.txt"));
const auto languages = langController->languagesForUrl(QUrl::fromLocalFile(QStringLiteral("/foo.txt")));
QCOMPARE(languages.size(), 1);
QCOMPARE(languages.first(), testLang);
}
......@@ -190,7 +190,7 @@ void TestBackgroundparser::testParseOrdering_foregroundThread()
// foreground thread (active document being edited, ...) running all the time.
// the long-running high-prio job
m_jobPlan.addJob(JobPrototype(QUrl::fromLocalFile("/test_fgt_hp.txt"), -500, ParseJob::IgnoresSequentialProcessing, 630));
m_jobPlan.addJob(JobPrototype(QUrl::fromLocalFile(QStringLiteral("/test_fgt_hp.txt")), -500, ParseJob::IgnoresSequentialProcessing, 630));
// several small background jobs
for ( int i = 0; i < 10; i++ ) {
......@@ -223,7 +223,7 @@ void TestBackgroundparser::testParseOrdering_lockup()
m_jobPlan.addJob(JobPrototype(QUrl::fromLocalFile("/test" + QString::number(i) + ".txt"), i, ParseJob::IgnoresSequentialProcessing, 200));
}
// add one job which requires sequential processing with high priority
m_jobPlan.addJob(JobPrototype(QUrl::fromLocalFile("/test_hp.txt"), -200, ParseJob::FullSequentialProcessing, 200));
m_jobPlan.addJob(JobPrototype(QUrl::fromLocalFile(QStringLiteral("/test_hp.txt")), -200, ParseJob::FullSequentialProcessing, 200));
// verify that the low-priority nonsequential jobs are run simultaneously with the other one.
QVERIFY(m_jobPlan.runJobs(700));
}
......@@ -283,14 +283,14 @@ void TestBackgroundparser::benchmarkDocumentChanges()
DocumentChangeTracker tracker(doc);
doc->setText("hello world");
doc->setText(QStringLiteral("hello world"));
// required for proper benchmark results
doc->createView(0);
QBENCHMARK {
for ( int i = 0; i < 5000; i++ ) {
{
KTextEditor::Document::EditingTransaction t(doc);
doc->insertText(KTextEditor::Cursor(0, 0), "This is a test line.\n");
doc->insertText(KTextEditor::Cursor(0, 0), QStringLiteral("This is a test line.\n"));
}
QApplication::processEvents();
}
......
......@@ -37,6 +37,6 @@ ParseJob* TestLanguageSupport::createParseJob(const IndexedString& url)
QString TestLanguageSupport::name() const
{
return "TestLanguageSupport";
return QStringLiteral("TestLanguageSupport");
}
......@@ -49,7 +49,7 @@ ClassModel::ClassModel()
NodesModelInterface::BaseAndDerivedClasses |
NodesModelInterface::ClassInternals)
{
m_topNode = new FolderNode("Top Node", this);
m_topNode = new FolderNode(QStringLiteral("Top Node"), this);
if ( features().testFlag(NodesModelInterface::AllProjectsClasses) )
{
......
......@@ -77,7 +77,7 @@ EnumNode::EnumNode(KDevelop::Declaration* a_decl, NodesModelInterface* a_model)
{
// Set display name for anonymous enums
if ( m_displayName.isEmpty() )
m_displayName = "*Anonymous*";
m_displayName = QStringLiteral("*Anonymous*");
}
bool EnumNode::getIcon(QIcon& a_resultIcon)
......@@ -87,24 +87,24 @@ bool EnumNode::getIcon(QIcon& a_resultIcon)
ClassMemberDeclaration* decl = dynamic_cast<ClassMemberDeclaration*>(getDeclaration());
if ( decl == 0 )
{
static QIcon Icon = QIcon::fromTheme("enum");
static QIcon Icon = QIcon::fromTheme(QStringLiteral("enum"));
a_resultIcon = Icon;
}
else
{
if ( decl->accessPolicy() == Declaration::Protected )
{
static QIcon Icon = QIcon::fromTheme("protected_enum");
static QIcon Icon = QIcon::fromTheme(QStringLiteral("protected_enum"));
a_resultIcon = Icon;
}
else if ( decl->accessPolicy() == Declaration::Private )
{
static QIcon Icon = QIcon::fromTheme("private_enum");
static QIcon Icon = QIcon::fromTheme(QStringLiteral("private_enum"));
a_resultIcon = Icon;
}
else
{
static QIcon Icon = QIcon::fromTheme("enum");
static QIcon Icon = QIcon::fromTheme(QStringLiteral("enum"));
a_resultIcon = Icon;
}
}
......@@ -327,22 +327,22 @@ bool ClassMemberNode::getIcon(QIcon& a_resultIcon)
if ( decl->isTypeAlias() )
{
static QIcon Icon = QIcon::fromTheme("typedef");
static QIcon Icon = QIcon::fromTheme(QStringLiteral("typedef"));
a_resultIcon = Icon;
}
else if ( decl->accessPolicy() == Declaration::Protected )
{
static QIcon Icon = QIcon::fromTheme("protected_field");
static QIcon Icon = QIcon::fromTheme(QStringLiteral("protected_field"));
a_resultIcon = Icon;
}
else if ( decl->accessPolicy() == Declaration::Private )
{
static QIcon Icon = QIcon::fromTheme("private_field");
static QIcon Icon = QIcon::fromTheme(QStringLiteral("private_field"));
a_resultIcon = Icon;
}
else
{
static QIcon Icon = QIcon::fromTheme("field");
static QIcon Icon = QIcon::fromTheme(QStringLiteral("field"));
a_resultIcon = Icon;
}
......@@ -359,7 +359,7 @@ DynamicFolderNode::DynamicFolderNode(const QString& a_displayName, NodesModelInt
bool DynamicFolderNode::getIcon(QIcon& a_resultIcon)
{
static QIcon folderIcon = QIcon::fromTheme("folder");
static QIcon folderIcon = QIcon::fromTheme(QStringLiteral("folder"));
a_resultIcon = folderIcon;
return true;
}
......@@ -374,7 +374,7 @@ FolderNode::FolderNode(const QString& a_displayName, NodesModelInterface* a_mode
bool FolderNode::getIcon(QIcon& a_resultIcon)
{
static QIcon folderIcon = QIcon::fromTheme("folder");
static QIcon folderIcon = QIcon::fromTheme(QStringLiteral("folder"));
a_resultIcon = folderIcon;
return true;
}
......
......@@ -65,7 +65,7 @@ StaticNamespaceFolderNode::StaticNamespaceFolderNode(const KDevelop::QualifiedId
bool StaticNamespaceFolderNode::getIcon(QIcon& a_resultIcon)
{
static QIcon folderIcon = QIcon::fromTheme("namespace");
static QIcon folderIcon = QIcon::fromTheme(QStringLiteral("namespace"));
a_resultIcon = folderIcon;
return true;
}
......@@ -359,7 +359,7 @@ bool DocumentClassesFolder::updateDocument(const KDevelop::IndexedString& a_file
removeEmptyNamespace(id);
// Clear erased classes.
foreach( const FileIterator& item, removedClasses )
foreach( const FileIterator item, removedClasses )
{
if ( item->nodeItem )
removeClassNode(item->nodeItem);
......
......@@ -33,7 +33,7 @@ ProjectFolder::ProjectFolder( NodesModelInterface* a_model, IProject* project )
}
ProjectFolder::ProjectFolder( NodesModelInterface* a_model )
: DocumentClassesFolder( "", a_model )
: DocumentClassesFolder( QLatin1String(""), a_model )
, m_project( 0 )
{
}
......
......@@ -114,7 +114,7 @@ void CodeCompletion::checkDocument(Document* textDocument)
auto langs = ICore::self()->languageController()->languagesForUrl( textDocument->url() );
bool found = false;
foreach(const auto& lang, langs) {
foreach(const auto lang, langs) {
if(m_language==lang->name()) {
found=true;
break;
......
......@@ -59,7 +59,7 @@ void insertFunctionParenText(KTextEditor::View* view, const KTextEditor::Cursor&
//We need to insert an opening paren
QString openingParen;
if( spaceBeforeParen )
openingParen = " (";
openingParen = QStringLiteral(" (");
else
openingParen = '(';
......@@ -68,7 +68,7 @@ void insertFunctionParenText(KTextEditor::View* view, const KTextEditor::Cursor&
QString closingParen;
if( spaceBetweenParens && (haveArguments) ) {
closingParen = " )";
closingParen = QStringLiteral(" )");
} else
closingParen = ')';
......
......@@ -65,6 +65,7 @@ namespace KDevelop {
class CompletionWorkerThread : public QThread
{
Q_OBJECT
public:
CompletionWorkerThread(CodeCompletionModel* model)
......@@ -450,3 +451,4 @@ QString CodeCompletionModel::filterString(KTextEditor::View* view, const KTextEd
}
#include "moc_codecompletionmodel.cpp"
#include "codecompletionmodel.moc"
......@@ -71,7 +71,7 @@ QString NormalDeclarationCompletionItem::declarationName() const
{
QString ret = m_declaration->identifier().toString();
if (ret.isEmpty())
return "<unknown>";
return QStringLiteral("<unknown>");
else
return ret;
}
......
......@@ -181,7 +181,7 @@ void ApplyChangesWidgetPrivate::createEditPart(const IndexedString & file)
CodeRepresentation::Ptr repr = createCodeRepresentation(file);
if(!repr->fileExists())
{
const auto templateName = QDir::tempPath() + QLatin1Char('/') + url.fileName().split('.').last();
const QString templateName = QDir::tempPath() + QLatin1Char('/') + url.fileName().split('.').last();
QTemporaryFile * temp(new QTemporaryFile(templateName));
temp->open();
temp->write