This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2goclient. from 081b6b1 x2gosettings.cpp: let centralSettings () return false on Windows. new faf5f02 Central settings for Linux, Mac and Windows. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 1 + src/onmainwindow.cpp | 14 +++++++++++- src/x2gosettings.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 64 insertions(+), 10 deletions(-) -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goclient. commit faf5f027de3ebb90c4769d474813f031a4a812eb Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Mon Dec 14 16:52:41 2015 +0100 Central settings for Linux, Mac and Windows. --- debian/changelog | 1 + src/onmainwindow.cpp | 14 +++++++++++- src/x2gosettings.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 64 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index e5d5338..33cf45d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -26,6 +26,7 @@ x2goclient (4.0.5.1-0x2go1) UNRELEASED; urgency=low - Reformat source onmainwindow.cpp. - Disable settings editing if a directory with central settings is exists. - Format long names on session buttons. + - Central settings for Linux, Mac and Windows. [ Mike Gabriel ] * New upstream release (4.0.5.1): diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 60b37c6..792e0af 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -228,7 +228,17 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) SLOT ( slotCheckAgentProcess() ) ); #ifdef CFGCLIENT - QStringList args=QCoreApplication::arguments(); + QStringList args; + if(!X2goSettings::centralSettings()) + args=QCoreApplication::arguments(); + else + { + X2goSettings st ( "settings" ); + QString cmdLine=st.setting()->value ( "commandline", "" ).toString(); +// x2goErrorf(100)<<"cmd line:"<<cmdLine; + args=cmdLine.split(";",QString::SkipEmptyParts); + args.push_front(QCoreApplication::arguments()[0]); + } for ( int i=1; i<args.size(); ++i ) { if ( !parseParameter ( args[i] ) ) @@ -2285,6 +2295,8 @@ void ONMainWindow::slotReadSessions() void ONMainWindow::slotNewSession() { + if(X2goSettings::centralSettings()) + return; QString id=QDateTime::currentDateTime(). toString ( "yyyyMMddhhmmsszzz" ); EditConnectionDialog dlg (true, id, this ); diff --git a/src/x2gosettings.cpp b/src/x2gosettings.cpp index d045ae8..4073462 100644 --- a/src/x2gosettings.cpp +++ b/src/x2gosettings.cpp @@ -21,6 +21,7 @@ #include "onmainwindow.h" #include <QTemporaryFile> #include <QDir> +#include <QProcessEnvironment> X2goSettings::X2goSettings(QString fileContent, QSettings::Format format) { @@ -44,14 +45,48 @@ X2goSettings::X2goSettings ( QString group ) return; } #ifndef Q_OS_WIN - set=new QSettings ( ONMainWindow::getHomeDirectory() + - "/.x2goclient/"+group, - QSettings::NativeFormat ); + if(!centralSettings()) + { + set=new QSettings ( ONMainWindow::getHomeDirectory() + + "/.x2goclient/"+group, + QSettings::NativeFormat ); + } + else + { + QString settingPath="/etc/x2goclient/config/"+qgetenv("USER")+"/"; + QDir d(settingPath); + if(!d.exists()) + { + settingPath="/etc/x2goclient/config/All Users/"; + } +// x2goErrorf(99)<<"CFG PATH:"<<settingPath; + set=new QSettings ( settingPath+group, + QSettings::NativeFormat ); + } #else if ( !ONMainWindow::getPortable() ) { - set=new QSettings ( "Obviously Nice","x2goclient" ); - set->beginGroup ( group ); + if(! centralSettings()) + { + set=new QSettings ( "Obviously Nice","x2goclient" ); + set->beginGroup ( group ); + } + else + { + QSettings setroot("HKEY_LOCAL_MACHINE\\SOFTWARE\\x2goclient\\config",QSettings::NativeFormat); + QString setPath="HKEY_LOCAL_MACHINE\\SOFTWARE\\x2goclient\\config\\All Users"; + QString uname=getenv("USERNAME"); + foreach(QString group, setroot.childGroups()) + { + if(group==uname) + { + setPath="HKEY_LOCAL_MACHINE\\SOFTWARE\\x2goclient\\config\\"+uname; + break; + } + } + set=new QSettings ( setPath, QSettings::NativeFormat); + set->beginGroup ( group ); + } } else { @@ -74,11 +109,17 @@ X2goSettings::~X2goSettings() bool X2goSettings::centralSettings() { #ifndef Q_OS_WIN - QDir d("/etc/x2goclient/settings"); - x2goDebug<<d.exists(); + QDir d("/etc/x2goclient/config"); return d.exists(); #else - return (false); + QSettings set("HKEY_LOCAL_MACHINE\\SOFTWARE\\x2goclient",QSettings::NativeFormat); + foreach(QString group,set.childGroups()) + { + if(group=="config") + { + return true; + } + } + return false; #endif } - -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git