improvements in installing standalone indicators

pull/5/head
Michail Vourlakos 6 years ago
parent ba08038bc0
commit 83ab266cd8

@ -25,6 +25,8 @@
// Qt
#include <QDebug>
#include <QDir>
#include <QDirIterator>
#include <QProcess>
#include <QTemporaryDir>
// KDE
@ -187,7 +189,24 @@ Latte::Types::ImportExportState Factory::importIndicatorFile(QString compressedF
archive->directory()->copyTo(archiveTempDir.path());
//metadata file
QString packagePath = archiveTempDir.path();
QString metadataFile = archiveTempDir.path() + "/metadata.desktop";
if (!QFileInfo(metadataFile).exists()){
QDirIterator iter(archiveTempDir.path(), QDir::Dirs | QDir::NoDotAndDotDot);
while(iter.hasNext() ) {
QString currentPath = iter.next();
QString tempMetadata = currentPath + "/metadata.desktop";
if (QFileInfo(tempMetadata).exists()) {
metadataFile = tempMetadata;
packagePath = currentPath;
}
}
}
KPluginMetaData metadata = KPluginMetaData::fromDesktopFile(metadataFile);
if (metadataAreValid(metadata)) {
@ -196,9 +215,17 @@ Latte::Types::ImportExportState Factory::importIndicatorFile(QString compressedF
bool updated{QDir(installPath).exists()};
archive->directory()->copyTo(installPath);
showNotificationSucceed(metadata.name(), updated);
if (QDir(installPath).exists()) {
QDir(installPath).removeRecursively();
}
//! Identify Plasma Desktop version
QProcess process;
process.start(QString("mv " +packagePath + " " + installPath));
process.waitForFinished();
QString output(process.readAllStandardOutput());
showNotificationSucceed(metadata.name(), updated);
return Latte::Types::Installed;
}

@ -56,6 +56,18 @@ LatteComponents.ComboBoxButton{
}
}
Connections{
target: custom.button
onClicked: {
if (custom.type === "download:") {
latteView.indicator.downloadIndicator();
} else {
latteView.indicator.type = custom.type;
}
}
}
Connections{
target: custom.comboBox
@ -76,6 +88,7 @@ LatteComponents.ComboBoxButton{
function updateButtonInformation() {
if (latteView.indicator.customPluginsCount === 0) {
custom.buttonText = i18n("Download");
custom.type = "download:";
custom.checkable = false;
} else {
custom.checkable = true;

Loading…
Cancel
Save