mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Enable OS X Auto-run at login
This commit is contained in:
parent
a05310e155
commit
df584531c8
|
@ -19,16 +19,38 @@
|
||||||
|
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
#include "src/platform/autorun.h"
|
#include "src/platform/autorun.h"
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
|
int state ;
|
||||||
|
|
||||||
bool Platform::setAutorun(bool on)
|
bool Platform::setAutorun(bool on)
|
||||||
{
|
{
|
||||||
return false;
|
QString qtoxPlist = QDir::cleanPath(QStandardPaths::writableLocation(QStandardPaths::HomeLocation) + QDir::separator() +
|
||||||
|
"Library" + QDir::separator() + "LaunchAgents" + QDir::separator() + "chat.tox.qtox.autorun.plist");
|
||||||
|
QString qtoxDir = QDir::cleanPath(QCoreApplication::applicationDirPath() + QDir::separator() + "qtox");
|
||||||
|
QSettings autoRun(qtoxPlist, QSettings::NativeFormat);
|
||||||
|
autoRun.setValue("Label","chat.tox.qtox.autorun");
|
||||||
|
autoRun.setValue("Program", qtoxDir);
|
||||||
|
|
||||||
|
if (on)
|
||||||
|
{
|
||||||
|
autoRun.setValue("RunAtLoad",true);
|
||||||
|
state = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
autoRun.setValue("RunAtLoad",false);
|
||||||
|
state = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Platform::getAutorun()
|
bool Platform::getAutorun()
|
||||||
{
|
{
|
||||||
return false;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(__APPLE__) && defined(__MACH__)
|
#endif // defined(__APPLE__) && defined(__MACH__)
|
||||||
|
|
|
@ -104,9 +104,6 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
|
|
||||||
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation()));
|
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation()));
|
||||||
bodyUI->cbAutorun->setChecked(Settings::getInstance().getAutorun());
|
bodyUI->cbAutorun->setChecked(Settings::getInstance().getAutorun());
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
|
||||||
bodyUI->cbAutorun->setEnabled(false);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool showSystemTray = Settings::getInstance().getShowSystemTray();
|
bool showSystemTray = Settings::getInstance().getShowSystemTray();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user