kdeplasma-addons: filter non-images from the POTD save dialog

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-01 05:15:13 +03:00
parent 3b3e2f9985
commit 03a2da9323
2 changed files with 7 additions and 2 deletions

View file

@ -6,7 +6,7 @@ set(potd_SRCS
)
kde4_add_plugin(plasma_wallpaper_potd ${potd_SRCS})
target_link_libraries(plasma_wallpaper_potd ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS})
target_link_libraries(plasma_wallpaper_potd ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
install(TARGETS plasma_wallpaper_potd DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
install(FILES plasma-wallpaper-potd.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})

View file

@ -26,6 +26,7 @@
#include <KAction>
#include <KFileDialog>
#include <KStandardAction>
#include <KImageIO>
static const QString DEFAULT_PROVIDER("apod");
@ -124,7 +125,11 @@ void PoTD::getSaveFileLocation()
return;
}
KFileDialog *fd = new KFileDialog(KUrl("kfiledialog:///frameplasmoid"), QString(), 0);
KFileDialog *fd = new KFileDialog(
KUrl("kfiledialog:///frameplasmoid"),
KImageIO::pattern(KImageIO::Writing),
0
);
fd->setOperationMode(KFileDialog::Saving);
fd->setMode(KFile::LocalOnly);
fd->setAttribute(Qt::WA_DeleteOnClose, true);