fix #807,download window for Latte Layouts

--adds a Download option in layouts editor in order
to download layouts from store.kde.org
pull/2/head
Michail Vourlakos 7 years ago
parent afcdd1b726
commit f7aac48599

@ -20,7 +20,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED NO_MODULE COMPONENTS DBus Gui Qml Quick)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Activities Archive CoreAddons Crash DBusAddons Declarative GlobalAccel I18n
IconThemes Notifications Plasma PlasmaQuick Wayland WindowSystem XmlGui)
IconThemes NewStuff Notifications Plasma PlasmaQuick Wayland WindowSystem XmlGui)
find_package(X11 REQUIRED)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"

@ -38,6 +38,7 @@ We recommend that you use at least **Plasma 5.9.0**
KF5IconThemes >= 5.29.0
KF5I18n >= 5.29.0
KF5Notifications >= 5.29.0
KF5NewStuff >= 5.29.0
KF5Archive >= 5.29.0
KF5GlobalAccel >= 5.29.0
KF5Crash >= 5.29.0

@ -52,6 +52,7 @@ target_link_libraries(latte-dock
KF5::PlasmaQuick
KF5::Activities
KF5::Notifications
KF5::NewStuff
KF5::QuickAddons
KF5::WaylandClient
)
@ -73,3 +74,4 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.latte-dock.desktop DESTINATION
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.latte-dock.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
install(FILES dbus/org.kde.LatteDock.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR})
install(FILES lattedock.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR})
install(FILES latte-layouts.knsrc DESTINATION ${CONFIG_INSTALL_DIR})

@ -0,0 +1,8 @@
[KNewStuff3]
Name=Latte Layouts
ProvidersUrl=https://download.kde.org/ocs/providers.xml
Categories=Latte Layouts
TargetDir=latte-layouts
Uncompress=archive

@ -41,7 +41,7 @@
#include <KArchive/KArchiveDirectory>
#include <KLocalizedString>
#include <KNotification>
#include <KNewStuff3/KNS3/DownloadDialog>
namespace Latte {
@ -109,6 +109,7 @@ LayoutConfigDialog::LayoutConfigDialog(QWidget *parent, LayoutManager *manager)
ui->switchButton->setText(i18nc("switch button", "Switch"));
ui->importButton->setText(i18nc("import button", "Import"));
ui->exportButton->setText(i18nc("export button", "Export"));
ui->downloadButton->setText(i18nc("download button", "Download"));
connect(m_model, &QStandardItemModel::itemChanged, this, &LayoutConfigDialog::itemChanged);
connect(ui->layoutsView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LayoutConfigDialog::currentRowChanged);
@ -194,6 +195,34 @@ void LayoutConfigDialog::on_copyButton_clicked()
ui->layoutsView->selectRow(row + 1);
}
void LayoutConfigDialog::on_downloadButton_clicked()
{
qDebug() << Q_FUNC_INFO;
KNS3::DownloadDialog dialog(QStringLiteral("latte-layouts.knsrc"), this);
dialog.exec();
bool layoutAdded{false};
if (!dialog.changedEntries().isEmpty() || !dialog.installedEntries().isEmpty()) {
foreach (auto entry, dialog.installedEntries()) {
foreach (auto entryFile, entry.installedFiles()) {
Importer::LatteFileVersion version = Importer::fileVersion(entryFile);
if (version == Importer::LayoutVersion2) {
layoutAdded = true;
addLayoutForFile(entryFile);
break;
}
}
}
}
if (layoutAdded) {
apply();
}
}
void LayoutConfigDialog::on_removeButton_clicked()
{
qDebug() << Q_FUNC_INFO;

@ -54,6 +54,7 @@ private slots:
// auto connections
void on_newButton_clicked();
void on_copyButton_clicked();
void on_downloadButton_clicked();
void on_removeButton_clicked();
void on_switchButton_clicked();
void on_importButton_clicked();

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>554</width>
<width>580</width>
<height>445</height>
</rect>
</property>
@ -56,7 +56,8 @@
<string>New</string>
</property>
<property name="icon">
<iconset theme="add"/>
<iconset theme="add">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
@ -181,6 +182,16 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="downloadButton">
<property name="text">
<string>Download</string>
</property>
<property name="icon">
<iconset theme="favorites"/>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

Loading…
Cancel
Save