MCPcopy Create free account
hub / github.com/KDE/kdevelop / extractTemplate

Method extractTemplate

kdevplatform/shell/settings/templatepage.cpp:86–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void TemplatePage::extractTemplate()
87{
88 QModelIndex index = ui->treeView->currentIndex();
89 QString archiveName= ui->treeView->model()->data(index, KDevelop::TemplatesModel::ArchiveFileRole).toString();
90
91 QFileInfo info(archiveName);
92 if (!info.exists())
93 {
94 ui->extractButton->setEnabled(false);
95 return;
96 }
97
98 QScopedPointer<KArchive> archive;
99 if (info.suffix() == QLatin1String("zip"))
100 {
101 archive.reset(new KZip(archiveName));
102 }
103 else
104 {
105 archive.reset(new KTar(archiveName));
106 }
107
108 archive->open(QIODevice::ReadOnly);
109
110 const QString destination = QFileDialog::getExistingDirectory() + QLatin1Char('/') + info.baseName();
111 archive->directory()->copyTo(destination);
112}
113
114#include "moc_templatepage.cpp"

Callers

nothing calls this directly

Calls 11

existsMethod · 0.80
baseNameMethod · 0.80
currentIndexMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
modelMethod · 0.45
setEnabledMethod · 0.45
resetMethod · 0.45
openMethod · 0.45
copyToMethod · 0.45
directoryMethod · 0.45

Tested by

no test coverage detected