1
0
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:
Rowen Stipe 2016-01-20 05:17:03 -05:00
parent a05310e155
commit df584531c8
2 changed files with 24 additions and 5 deletions

View File

@ -19,16 +19,38 @@
#if defined(__APPLE__) && defined(__MACH__)
#include "src/platform/autorun.h"
#include <QSettings>
#include <QDir>
#include <QFile>
#include <QStandardPaths>
#include <QCoreApplication>
int state ;
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()
{
return false;
return state;
}
#endif // defined(__APPLE__) && defined(__MACH__)

View File

@ -104,9 +104,6 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation()));
bodyUI->cbAutorun->setChecked(Settings::getInstance().getAutorun());
#if defined(__APPLE__) && defined(__MACH__)
bodyUI->cbAutorun->setEnabled(false);
#endif
bool showSystemTray = Settings::getInstance().getShowSystemTray();