diff options
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp | 23 | ||||
-rw-r--r-- | src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp index b778b49c..46286ef3 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp @@ -557,6 +557,12 @@ void DirWidget::UpdateContextMenu(){ contextMenu->addAction(LXDG::findIcon("system-run",""), tr("Open"), this, SLOT(runFiles()) ); //contextMenu->addAction(LXDG::findIcon("system-run-with",""), tr("Open With..."), this, SLOT(runWithFiles()) ); contextMenu->addMenu(cOpenWithMenu); + bool ok = (QString(getenv("XDG_CURRENT_DESKTOP"))=="Lumina"); + static QStringList imageformats = LUtils::imageExtensions(); + for(int i=0; i<sel.length() && ok; i++){ + ok = imageformats.contains(sel[i].section(".",-1)); + } + if(ok){ contextMenu->addAction(LXDG::findIcon("preferences-desktop-wallpaper","preferences-desktop"), tr("Set as Wallpaper"), this, SLOT(setAsWallpaper()) ); } } contextMenu->addSection(LXDG::findIcon("unknown",""), tr("File Operations")); // contextMenu->addMenu(cFModMenu); @@ -901,6 +907,23 @@ void DirWidget::autoArchiveFiles(){ ExternalProcess::launch("lumina-archiver", QStringList() << "--aa" << archive << files); } +void DirWidget::setAsWallpaper(){ + QStringList files = currentBrowser()->currentSelection(); + //Get the screen for the wallpaper + QList<QScreen*> screens = QApplication::screens(); + QString screenID; + if(screens.length()>1){ + QStringList opts; + for(int i=0; i<screens.length(); i++){ opts << screens[i]->name(); } + screenID = QInputDialog::getItem(this, tr("Set Wallpaper on Screen"), tr("Screen"), opts, 0, false); + if(screenID.isEmpty()){ return; } + }else{ + screenID = screens[0]->name(); + } + //Now save this to the settings + QSettings deskset("lumina-desktop","desktopsettings"); + deskset.setValue("desktop-"+screenID+"/background/filelist" , files); +} //==================== // PROTECTED diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h index a99c64c7..65f4b971 100644 --- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h +++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h @@ -160,6 +160,7 @@ private slots: //void attachToNewEmail(); void autoExtractFiles(); void autoArchiveFiles(); + void setAsWallpaper(); // - Context-specific operations void openInSlideshow(); |