diff --git a/session/application.cpp b/session/application.cpp
index 3625282..89908d1 100644
--- a/session/application.cpp
+++ b/session/application.cpp
@@ -125,6 +125,9 @@ Application::Application(int &argc, char **argv)
qunsetenv("XCURSOR_THEME");
qunsetenv("XCURSOR_SIZE");
+ qunsetenv("SESSION_MANAGER");
+
+ m_networkProxyManager->update();
QTimer::singleShot(100, m_processManager, &ProcessManager::start);
}
@@ -134,6 +137,15 @@ bool Application::wayland() const
return m_wayland;
}
+void Application::launch(const QString &exec, const QStringList &args)
+{
+ QProcess process;
+ process.setProgram(exec);
+ process.setProcessEnvironment(QProcessEnvironment::systemEnvironment());
+ process.setArguments(args);
+ process.startDetached();
+}
+
void Application::initEnvironments()
{
// Set defaults
diff --git a/session/application.h b/session/application.h
index 0cb7f05..fcdccc5 100644
--- a/session/application.h
+++ b/session/application.h
@@ -62,6 +62,8 @@ public slots:
m_networkProxyManager->update();
}
+ void launch(const QString &exec, const QStringList &args);
+
private:
void initEnvironments();
void initLanguage();
diff --git a/session/com.cutefish.Session.xml b/session/com.cutefish.Session.xml
index 2ad37ba..9fd6aba 100644
--- a/session/com.cutefish.Session.xml
+++ b/session/com.cutefish.Session.xml
@@ -19,5 +19,9 @@
+
+
+
+
diff --git a/session/networkproxymanager.cpp b/session/networkproxymanager.cpp
index 0769f9f..e648ac2 100644
--- a/session/networkproxymanager.cpp
+++ b/session/networkproxymanager.cpp
@@ -17,22 +17,26 @@
* along with this program. If not, see .
*/
+
#include "networkproxymanager.h"
#include
#include
+#include
#include
NetworkProxyManager::NetworkProxyManager(QObject *parent)
: QObject(parent)
- , m_settings("cutefishos", "network")
+ , m_settings(QSettings::UserScope, "cutefishos", "network")
{
- update();
}
void NetworkProxyManager::update()
{
qunsetenv("HTTP_PROXY");
+ qunsetenv("HTTPS_PROXY");
qunsetenv("FTP_PROXY");
+ qunsetenv("ALL_PROXY");
+ qunsetenv("NO_PROXY");
m_settings.sync();
@@ -47,6 +51,7 @@ void NetworkProxyManager::update()
m_socksProxyPort = m_settings.value("SocksProxyPort", "").toString();
QMap dbusActivationEnv;
+ QStringList systemdUpdates;
if (m_flag == 0) {
// No proxy
@@ -56,34 +61,25 @@ void NetworkProxyManager::update()
// Use manually specified proxy configuration
QString httpProxy = QString("http://%1:%2/").arg(m_httpProxy).arg(m_httpProxyPort);
+ QString ftpProxy = QString("http://%1:%2/").arg(m_ftpProxy).arg(m_ftpProxyPort);
+
+ if (m_useSameProxy) {
+ ftpProxy = httpProxy;
+ }
if (!m_httpProxy.isEmpty() && !m_httpProxyPort.isEmpty()) {
qputenv("HTTP_PROXY", httpProxy.toLatin1());
- dbusActivationEnv.insert("HTTP_PROXY", httpProxy);
+ qputenv("HTTPS_PROXY", httpProxy.toLatin1());
}
- if (m_useSameProxy) {
- if (!m_ftpProxy.isEmpty() && !m_ftpProxyPort.isEmpty()) {
- qputenv("FTP_PROXY", httpProxy.toLatin1());
- dbusActivationEnv.insert("FTP_PROXY", httpProxy);
- }
- } else {
- if (!m_ftpProxy.isEmpty() && !m_ftpProxyPort.isEmpty()) {
- qputenv("FTP_PROXY", QString("http://%1:%2/").arg(m_ftpProxy).arg(m_ftpProxyPort).toLatin1());
- dbusActivationEnv.insert("FTP_PROXY", QString("http://%1:%2/").arg(m_ftpProxy).arg(m_ftpProxyPort).toLatin1());
- }
+ if (!m_ftpProxy.isEmpty() && !m_ftpProxyPort.isEmpty()) {
+ qputenv("FTP_PROXY", ftpProxy.toLatin1());
}
- // if (!m_socksProxy.isEmpty() && !m_socksProxyPort.isEmpty()) {
- // qputenv("ALL_PROXY", QString("socks://%1:%2/").arg(m_socksProxy).arg(m_socksProxyPort).toLatin1());
- // }
- }
+ qputenv("NO_PROXY", "localhost,127.0.0.0/8,::1");
- QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.freedesktop.DBus"),
- QStringLiteral("/org/freedesktop/DBus"),
- QStringLiteral("org.freedesktop.DBus"),
- QStringLiteral("UpdateActivationEnvironment"));
- msg.setArguments({QVariant::fromValue(dbusActivationEnv)});
- QDBusPendingCall reply = QDBusConnection::sessionBus().asyncCall(msg);
- reply.waitForFinished();
+ if (!m_socksProxy.isEmpty() && !m_socksProxyPort.isEmpty()) {
+ qputenv("ALL_PROXY", QString("socks://%1:%2/").arg(m_socksProxy).arg(m_socksProxyPort).toLatin1());
+ }
+ }
}