aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/libLumina/DesktopSettings.cpp18
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.h24
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.cpp10
-rw-r--r--src-qt5/core/lumina-desktop-unified/LSession.h3
-rw-r--r--src-qt5/core/lumina-desktop-unified/defaults/desktop/desktop.conf0
-rw-r--r--src-qt5/core/lumina-desktop-unified/defaults/desktop/environment.conf0
-rw-r--r--src-qt5/core/lumina-desktop-unified/defaults/desktop/favorites.conf0
-rw-r--r--src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf8
-rw-r--r--src-qt5/core/lumina-desktop-unified/defaults/desktop/session.conf0
-rw-r--r--src-qt5/core/lumina-desktop-unified/defaults/desktop/theme.conf0
-rw-r--r--src-qt5/core/lumina-desktop-unified/lumina-desktop.pro6
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h4
-rw-r--r--src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp94
-rw-r--r--src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h2
14 files changed, 112 insertions, 57 deletions
diff --git a/src-qt5/core/libLumina/DesktopSettings.cpp b/src-qt5/core/libLumina/DesktopSettings.cpp
index bd0325ec..47dc29de 100644
--- a/src-qt5/core/libLumina/DesktopSettings.cpp
+++ b/src-qt5/core/libLumina/DesktopSettings.cpp
@@ -121,7 +121,7 @@ void DesktopSettings::parseSystemSettings(){
//Now determine the runmode for this user
struct passwd *pw = getpwuid(getuid());
- if(pw!=0){
+ if(pw!=0){
QString cuser = QString(pw->pw_name);
free(pw); //done with this structure
if( settings[path]->value("fulluser_users", QStringList()).toStringList().contains(cuser) ){ runmode = DesktopSettings::UserFull; }
@@ -133,10 +133,10 @@ void DesktopSettings::parseSystemSettings(){
gid_t grpList[100];
int grpSize = 100;
if( getgrouplist(cuser.toLocal8Bit(), getgid(), grpList, &grpSize) > 0 ){
- QStringList groups;
- for(int i=0; i<grpSize; i++){
+ QStringList groups;
+ for(int i=0; i<grpSize; i++){
struct group *g = getgrgid(grpList[i]);
- if(g!=0){
+ if(g!=0){
groups << QString(g->gr_name);
free(g);
}
@@ -146,18 +146,18 @@ void DesktopSettings::parseSystemSettings(){
if( (fromfile+groups).removeDuplicates() > 0 ){ runmode = DesktopSettings::UserFull; }
else{
fromfile = settings[path]->value("fullsystem_groups", QStringList()).toStringList();
- fromfile.removeDuplicates();
+ fromfile.removeDuplicates();
if((fromfile+groups).removeDuplicates() > 0 ){ runmode = DesktopSettings::SystemFull; }
else{
fromfile = settings[path]->value("staticinterface_groups", QStringList()).toStringList();
- fromfile.removeDuplicates();
+ fromfile.removeDuplicates();
if((fromfile+groups).removeDuplicates() > 0 ){ runmode = DesktopSettings::SystemInterface; }
}
}
- } //end group list read
+ } //end group list read
}
}else{
- runmode = DesktopSettings::SystemFull; //could not read user name - assume system files only
+ runmode = DesktopSettings::SystemFull; //could not read user name - assume system files only
}
break; //found this file - go ahead and stop now (no hierarchy for this special file)
@@ -256,7 +256,7 @@ void DesktopSettings::fileChanged(QString file){
QList< DesktopSettings::File > types = files.keys();
for(int i=0; i<types.length(); i++){
if(files[types[i]].contains(file)){
- emit FileModified(types[i]);
+ emit FileModified(types[i]);
break;
}
}
diff --git a/src-qt5/core/libLumina/LuminaXDG.h b/src-qt5/core/libLumina/LuminaXDG.h
index d159ef43..cc250c7e 100644
--- a/src-qt5/core/libLumina/LuminaXDG.h
+++ b/src-qt5/core/libLumina/LuminaXDG.h
@@ -12,8 +12,6 @@
// *.desktop Exec Compliance Updated: 9/9/2014
// Mime Application Version Compliance: 1.0.1 (11/14/14) (Skips random *.desktop parsing: ~80% compliant)
//===========================================
-
-
#ifndef _LUMINA_LIBRARY_XDG_H
#define _LUMINA_LIBRARY_XDG_H
@@ -83,7 +81,7 @@ public:
bool saveDesktopFile(bool merge = true); //This will use the "filePath" variable for where to save the file
- bool setAutoStarted(bool autostart = true);
+ bool setAutoStarted(bool autostart = true);
};
// ========================
@@ -127,29 +125,29 @@ private:
XDGDesktop *desk;
void loadExtraInfo();
-
+
public:
//Couple overloaded contructors
LFileInfo();
LFileInfo(QString filepath);
LFileInfo(QFileInfo info);
- ~LFileInfo(){
- desk->deleteLater();
+ ~LFileInfo(){
+ desk->deleteLater();
}
-
+
//Functions for accessing the extra information
// -- Return the mimetype for the file
QString mimetype();
-
+
// -- Return the icon file to use for this file
QString iconfile(); //Note: This string is auto-formatted for use in the LXDG::findIcon() routine.
-
+
// -- Check if this is an XDG desktop file
bool isDesktopFile();
-
+
// -- Allow access to the internal XDG desktop data structure
XDGDesktop* XDG();
-
+
//Other file type identification routines
bool isImage(); //Is a readable image file (for thumbnail support)
bool isAVFile(); //Is an audio/video file
@@ -165,7 +163,7 @@ public:
//static XDGDesktop* loadDesktopFile(QString filepath, bool&ok, QObject *parent = 0);
//static bool saveDesktopFile(XDGDesktop *dFile, bool merge = true);
//Check a *.desktop file for validity (showAll skips the DE-exclusivity checks)
- //static bool checkValidity(XDGDesktop *dFile, bool showAll = true);
+ //static bool checkValidity(XDGDesktop *dFile, bool showAll = true);
//Check for a valid executable
static bool checkExec(QString exec);
//Get a list of all the directories where *.desktop files exist
@@ -210,7 +208,7 @@ public:
static QStringList findAVFileExtensions();
//Load all the "globs2" mime database files
static QStringList loadMimeFileGlobs2();
-
+
//Find all the autostart *.desktop files
static QList<XDGDesktop*> findAutoStartFiles(bool includeInvalid = false);
//static bool setAutoStarted(bool autostart, XDGDesktop *app);
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.cpp b/src-qt5/core/lumina-desktop-unified/LSession.cpp
index 8ab1b303..df70b22e 100644
--- a/src-qt5/core/lumina-desktop-unified/LSession.cpp
+++ b/src-qt5/core/lumina-desktop-unified/LSession.cpp
@@ -223,6 +223,8 @@ void LSession::setupGlobalConnections(){
connect(Lumina::SHORTCUTS, SIGNAL(StartLogout()), this, SLOT(StartLogout()) );
connect(Lumina::SHORTCUTS, SIGNAL(StartReboot()), this, SLOT(StartReboot()) );
connect(Lumina::SHORTCUTS, SIGNAL(StartShutdown()), this, SLOT(StartShutdown()) );
+ connect(Lumina::SHORTCUTS, SIGNAL(LaunchApplication(QString), this, SLOT(LaunchApplication(QString)) );
+ connect(Lumina::SHORTCUTS, SIGNAL(LaunchStandardApplication(QString)), this, SLOT(LaunchStandardApplication(QString)) );
connect(Lumina::SHORTCUTS, SIGNAL(LockSession()), Lumina::SS, SLOT(LockScreenNow()) );
//Root window connections
@@ -383,6 +385,14 @@ void LSession::StartReboot(bool skipupdates){
QCoreApplication::exit(0);
}
+void LSession::LaunchApplication(QString app){
+
+}
+
+void LSession::LaunchStandardApplication(QString app){
+
+}
+
void LSession::reloadIconTheme(){
//Wait a moment for things to settle before sending out the signal to the interfaces
QApplication::processEvents();
diff --git a/src-qt5/core/lumina-desktop-unified/LSession.h b/src-qt5/core/lumina-desktop-unified/LSession.h
index dd32d22a..0d666bfa 100644
--- a/src-qt5/core/lumina-desktop-unified/LSession.h
+++ b/src-qt5/core/lumina-desktop-unified/LSession.h
@@ -28,9 +28,12 @@ private:
public slots:
void setupSession(); //called during startup only
+ //Slots for public access/usage
void StartLogout();
void StartShutdown(bool skipupdates = false);
void StartReboot(bool skipupdates = false);
+ void LaunchApplication(QString app);
+ void LaunchStandardApplication(QString app);
void reloadIconTheme(); //will emit the IconThemeChanged signal when ready
void switchLocale(QString localeCode); //will emit the LocaleChanged signal when ready
diff --git a/src-qt5/core/lumina-desktop-unified/defaults/desktop/desktop.conf b/src-qt5/core/lumina-desktop-unified/defaults/desktop/desktop.conf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/defaults/desktop/desktop.conf
diff --git a/src-qt5/core/lumina-desktop-unified/defaults/desktop/environment.conf b/src-qt5/core/lumina-desktop-unified/defaults/desktop/environment.conf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/defaults/desktop/environment.conf
diff --git a/src-qt5/core/lumina-desktop-unified/defaults/desktop/favorites.conf b/src-qt5/core/lumina-desktop-unified/defaults/desktop/favorites.conf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/defaults/desktop/favorites.conf
diff --git a/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf b/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf
new file mode 100644
index 00000000..c1417b85
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/defaults/desktop/keys.conf
@@ -0,0 +1,8 @@
+[strict]
+Ctrl+Alt+Backspace=Logout
+Pause=Lockscreen
+Alt+L=Lockscreen
+
+[desktop]
+Alt+F1=Launch: terminal
+Print=Launch: screenshot
diff --git a/src-qt5/core/lumina-desktop-unified/defaults/desktop/session.conf b/src-qt5/core/lumina-desktop-unified/defaults/desktop/session.conf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/defaults/desktop/session.conf
diff --git a/src-qt5/core/lumina-desktop-unified/defaults/desktop/theme.conf b/src-qt5/core/lumina-desktop-unified/defaults/desktop/theme.conf
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src-qt5/core/lumina-desktop-unified/defaults/desktop/theme.conf
diff --git a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro
index a4e9867b..defa66f4 100644
--- a/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro
+++ b/src-qt5/core/lumina-desktop-unified/lumina-desktop.pro
@@ -44,10 +44,12 @@ FORMS += BootSplash.ui
#include(panel-plugins/panel-plugins.pri)
#include(desktop-plugins/desktop-plugins.pri)
-
+# Install all the various files for the desktop itself
desktop.path = $${L_SESSDIR}
desktop.files = lumina-desktop.desktop
+defaults.path = $${L_SHAREDIR}/lumina-desktop
+defaults.files = defaults/*
TRANSLATIONS = i18n/lumina-desktop_af.ts \
i18n/lumina-desktop_ar.ts \
@@ -115,7 +117,7 @@ TRANSLATIONS = i18n/lumina-desktop_af.ts \
dotrans.path=$${L_SHAREDIR}/lumina-desktop/i18n/
dotrans.extra=cd i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/i18n/
-INSTALLS += target desktop
+INSTALLS += target desktop defaults
WITH_I18N{
INSTALLS += dotrans
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h
index 8798577f..b1324e78 100644
--- a/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h
+++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/animations/BaseAnimGroup.h
@@ -26,13 +26,13 @@ public:
canvas->setCursor( QCursor(Qt::BlankCursor) );
}
~BaseAnimGroup(){}
-
+
//==============================
// PLUGIN LOADING/LISTING (Change in the .cpp file)
//==============================
static BaseAnimGroup* NewAnimation(QString type, QWidget *parent, QSettings *set);
static QStringList KnownAnimations();
-
+
};
#endif
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp
index 7214dba9..3790d145 100644
--- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp
+++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.cpp
@@ -295,35 +295,15 @@ void DirWidget::createMenus(){
*/
//---------------------------------------------------//
- /*
- if(cOpenWithMenu==0){ cOpenWithMenu = new QMenu(this); }
- else{ cOpenWithMenu->clear(); }
- cOpenWithMenu->setTitle(tr("Open with..."));
- cOpenWithMenu->setIcon( LXDG::findIcon("run-build-configure","") );
- XDGDesktopList applist;
- applist.updateList();
- PREFAPPS = getPreferredApplications();
- //qDebug() << "Preferred Apps:" << PREFAPPS;
- cOpenWithMenu->clear();
- //Now get the application mimetype for the file extension (if available)
- QStringList mimetypes = LXDG::findAppMimeForFile(filePath, true).split("::::"); //use all mimetypes
- //Now add all the detected applications
- QHash< QString, QList<XDGDesktop*> > hash = LXDG::sortDesktopCats( applist.apps(false,true) );
- QStringList cat = hash.keys();
- cat.sort(); //sort alphabetically
- for(int c=0; c<cat.length(); c++){
- QList<XDGDesktop*> app = hash[cat[c]];
- if(app.length()<1){ cOpenWithMenu =0; continue; }
- for(int a=0; a<app.length(); a++){
- QString program = app[a]->filePath;
- QStringList arguments;
- arguments << "%u";
- QProcess *p = new QProcess();
- p->start(program, arguments);
-
- cOpenWithMenu->addAction(LXDG::findIcon(app[a]->icon), (app[a]->name), this, SLOT(p->start(program, arguments)) );}}
- cOpenWithMenu->addAction(LXDG::findIcon("run-build-configure",""), tr("Other..."), this, SLOT(runWithFiles()) );
-*/
+
+ if(cOpenWithMenu==0){
+ cOpenWithMenu = new QMenu(this);
+ connect(cOpenWithMenu, SIGNAL(triggered(QAction*)), this, SLOT(OpenWithApp(QAction*)) );
+ }
+ else{ cOpenWithMenu->clear(); }
+ cOpenWithMenu->setTitle(tr("Open with..."));
+ cOpenWithMenu->setIcon( LXDG::findIcon("system-run-with","") );
+
//---------------------------------------------------//
if(cFViewMenu==0){ cFViewMenu = new QMenu(this); }
else{ cFViewMenu->clear(); }
@@ -560,7 +540,8 @@ void DirWidget::UpdateContextMenu(){
if(!sel.isEmpty()){
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->addAction(LXDG::findIcon("system-run-with",""), tr("Open With..."), this, SLOT(runWithFiles()) );
+ contextMenu->addMenu(cOpenWithMenu);
}
contextMenu->addSection(LXDG::findIcon("unknown",""), tr("File Operations"));
// contextMenu->addMenu(cFModMenu);
@@ -589,6 +570,50 @@ void DirWidget::UpdateContextMenu(){
contextMenu->addMenu(cNewMenu);
}
contextMenu->addMenu(cOpenMenu);
+ //=====================
+ //PREFAPPS = getPreferredApplications();
+ //qDebug() << "Preferred Apps:" << PREFAPPS;
+ cOpenWithMenu->clear();
+ //Now get the application mimetype for the file extension (if available)
+ QStringList mimetypes;
+ for(int i=0; i<sel.length(); i++){
+ QStringList mimes = LXDG::findAppMimeForFile(sel[i], true).split("::::"); //use all mimetypes
+ if(mimetypes.isEmpty()){ mimetypes << mimes; }
+ else{
+ //need to verify that the mimetypes are the same before adding them.
+ QStringList test; test << mimetypes << mimes;
+ if(test.removeDuplicates()>0){ mimetypes = test; }
+ else{
+ //Bad match - incompatible file types are selected - disable the recommendations
+ mimetypes.clear();
+ break;
+ }
+ }
+ }
+ //Now add all the detected applications
+ if(!mimetypes.isEmpty()){
+ static XDGDesktopList applist;
+ applist.updateList();
+ QList<XDGDesktop*> apps = applist.apps(false,true);
+ QList<XDGDesktop*> found;
+ for(int a=0; a<apps.length(); a++){
+ if(apps[a]->mimeList.isEmpty()){ continue; } //no corresponding mime types for this app
+ QStringList test; test << mimetypes << apps[a]->mimeList;
+ if(test.removeDuplicates()>0){ found << apps[a]; }
+ }
+ if(!found.isEmpty()){
+ //sort the apps by name
+ found = LXDG::sortDesktopNames(found);
+ //add apps to the menu
+ for(int i=0; i<found.length(); i++){
+ QAction *act = cOpenWithMenu->addAction( LXDG::findIcon(found[i]->icon, ""), found[i]->name );
+ act->setToolTip(found[i]->comment);
+ act->setWhatsThis(found[i]->filePath);
+ }
+ cOpenWithMenu->addSeparator();
+ }
+ }
+ cOpenWithMenu->addAction(LXDG::findIcon("system-run-with",""), tr("Other..."), this, SLOT(runWithFiles()) );
}
void DirWidget::currentDirectoryChanged(bool widgetonly){
@@ -844,6 +869,15 @@ void DirWidget::openMultimedia(){
if(!list.isEmpty()){ emit PlayFiles(list); }
}
+void DirWidget::OpenWithApp(QAction* act){
+ if(act->whatsThis().isEmpty()){ return; }
+ QStringList sel = currentBrowser()->currentSelection();
+ //Now we need to open the app file, and create the process
+ XDGDesktop desk(act->whatsThis());
+ QString exec = desk.generateExec(sel);
+ ExternalProcess::launch(exec);
+}
+
void DirWidget::autoExtractFiles(){
QStringList files = currentBrowser()->currentSelection();
qDebug() << "Starting auto-extract:" << files;
diff --git a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h
index 284bf337..e1dafaa8 100644
--- a/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h
+++ b/src-qt5/desktop-utils/lumina-fm/widgets/DirWidget2.h
@@ -162,7 +162,7 @@ private slots:
// - Context-specific operations
void openInSlideshow();
void openMultimedia();
-
+ void OpenWithApp(QAction*);
signals:
//Directory loading/finding signals
bgstack15