diff options
author | Ken Moore <ken@ixsystems.com> | 2017-11-20 10:40:16 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-11-20 10:40:16 -0500 |
commit | eddbc754bb2e3e744165e6be7a081ab614a6ed26 (patch) | |
tree | 15bac234f371f0092a1f3d3cfb6e4853390d9930 /src-qt5/desktop-utils/lumina-fm/widgets | |
parent | Change the styling of the presentation clock. (diff) | |
download | lumina-eddbc754bb2e3e744165e6be7a081ab614a6ed26.tar.gz lumina-eddbc754bb2e3e744165e6be7a081ab614a6ed26.tar.bz2 lumina-eddbc754bb2e3e744165e6be7a081ab614a6ed26.zip |
Add a context menu "action" for settings the selected image files as the current desktop wallpaper.
Caveats: This only is an option when the Lumina desktop is running, and the entire selection is valid image files.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-fm/widgets')
-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(); |