Skip to content

Commit

Permalink
Fixed opt_application.cpp and src.pro after previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitozz committed Mar 25, 2017
1 parent 56b812d commit 71ea6d8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
20 changes: 12 additions & 8 deletions src/options/opt_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
static const QString regString = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run";
#endif
#ifdef HAVE_FREEDESKTOP
static const QString psiAutoStart("/.config/autostart/" APP_BIN_NAME ".desktop");
#define xstr(a) str(a)
#define str(a) #a
static const QString psiAutoStart("/autostart/" xstr(APP_BIN_NAME) ".desktop");
#endif

class OptApplicationUI : public QWidget, public Ui::OptApplication
Expand All @@ -41,6 +43,13 @@ OptionsTabApplication::OptionsTabApplication(QObject *parent)
: OptionsTab(parent, "application", "", tr("Application"), tr("General application options"), "psi/logo_16")
{
w = 0;
#ifdef HAVE_FREEDESKTOP
#ifndef HAVE_QT5
configPath_ = QString::fromLocal8Bit(getenv("XDG_CONFIG_HOME"));
#else
configPath_ = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
#endif
#endif
}

OptionsTabApplication::~OptionsTabApplication()
Expand Down Expand Up @@ -147,12 +156,7 @@ void OptionsTabApplication::applyOptions()
}
#endif
#ifdef HAVE_FREEDESKTOP
#ifndef HAVE_QT5
QDir home(QString::fromLocal8Bit(getenv("XDG_CONFIG_HOME")));
#else
QDir home(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation));
#endif

QDir home(configPath_);
if (!home.exists("autostart")) {
home.mkpath("autostart");
}
Expand Down Expand Up @@ -208,7 +212,7 @@ void OptionsTabApplication::restoreOptions()
d->ck_auto_load->setChecked( (path == QDir::toNativeSeparators(qApp->applicationFilePath())) );
#endif
#ifdef HAVE_FREEDESKTOP
QFile desktop(QDir::homePath() + psiAutoStart);
QFile desktop(configPath_ + psiAutoStart);
if (desktop.open(QIODevice::ReadOnly)
&& QString(desktop.readAll()).contains(QRegExp("\\bhidden\\s*=\\s*false", Qt::CaseInsensitive)))
{
Expand Down
1 change: 1 addition & 0 deletions src/options/opt_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ private slots:
private:
QWidget *w;
bool haveAutoUpdater_;
QString configPath_;

private slots:
void doEnableQuitOnClose(int);
Expand Down
2 changes: 1 addition & 1 deletion src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ include($$top_builddir/conf.pri)

unix {
DEFINES += APP_PREFIX=$$PREFIX
DEFINES += APP_BIN_NAME=$$target
DEFINES += APP_BIN_NAME=$$TARGET
# Target
target.path = $$BINDIR
INSTALLS += target
Expand Down

0 comments on commit 71ea6d8

Please sign in to comment.