Skip to content
Snippets Groups Projects
Commit 6d6fd2c9 authored by akiraohgaki's avatar akiraohgaki
Browse files

Use member method

parent 399889ce
No related branches found
No related tags found
No related merge requests found
......@@ -22,66 +22,34 @@ bool Package::process(const QString &program, const QStringList &arguments)
bool Package::installProgram(const QString &path, const QString &targetPath)
{
QProcess process;
QString program = "install";
QStringList arguments;
arguments << "-m" << "755" << "-p" << path << targetPath;
process.start(program, arguments);
if (process.waitForFinished()) {
return true;
}
return false;
return process(program, arguments);
}
bool Package::installFile(const QString &path, const QString &targetPath)
{
QProcess process;
QString program = "install";
QStringList arguments;
arguments << "-m" << "644" << "-p" << path << targetPath;
process.start(program, arguments);
if (process.waitForFinished()) {
return true;
}
return false;
return process(program, arguments);
}
bool Package::installPlasmapkg(const QString &path, const QString &type)
{
QProcess process;
QString program = "plasmapkg2"; // Use plasmapkg2 for now
QString program = "plasmapkg2";
QStringList arguments;
arguments << "-t" << type << "-i" << path;
process.start(program, arguments);
if (process.waitForFinished()) {
return true;
}
return false;
return process(program, arguments);
}
bool Package::uninstallPlasmapkg(const QString &path, const QString &type)
{
QProcess process;
QString program = "plasmapkg2"; // Use plasmapkg2 for now
QString program = "plasmapkg2";
QStringList arguments;
arguments << "-t" << type << "-r" << path;
process.start(program, arguments);
if (process.waitForFinished()) {
return true;
}
return false;
return process(program, arguments);
}
bool Package::uncompressArchive(const QString &path, const QString &targetDir)
......@@ -112,7 +80,6 @@ bool Package::uncompressArchive(const QString &path, const QString &targetDir)
if (archiveTypes.contains(mimeType)) {
QString archiveType = archiveTypes[mimeType].toString();
QProcess process;
QString program;
QStringList arguments;
......@@ -133,12 +100,7 @@ bool Package::uncompressArchive(const QString &path, const QString &targetDir)
arguments << "e" << path << targetDir;
}
process.start(program, arguments);
if (process.waitForFinished()) {
process.waitForReadyRead();
return true;
}
return process(program, arguments);
}
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment