mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-03 17:39:49 +00:00
utils: fix desktopNotify
This commit is contained in:
parent
afbbeee44f
commit
6b065acdae
1 changed files with 23 additions and 22 deletions
|
@ -494,29 +494,30 @@ void externalLinkWarning(QWidget *parent, const QString &url){
|
||||||
}
|
}
|
||||||
|
|
||||||
void desktopNotify(const QString &title, const QString &message, int duration) {
|
void desktopNotify(const QString &title, const QString &message, int duration) {
|
||||||
if (!Config::hideNotifications)
|
if (config()->get(Config::hideNotifications).toBool()) {
|
||||||
{
|
return;
|
||||||
QStringList notify_send = QStringList() << title << message << "-t" << QString::number(duration);
|
|
||||||
QStringList kdialog = QStringList() << title << message;
|
|
||||||
QStringList macos = QStringList() << "-e" << QString(R"(display notification "%1" with title "%2")").arg(message).arg(title);
|
|
||||||
#if defined(Q_OS_LINUX)
|
|
||||||
QProcess process;
|
|
||||||
if (fileExists("/usr/bin/kdialog"))
|
|
||||||
process.start("/usr/bin/kdialog", kdialog);
|
|
||||||
else if (fileExists("/usr/bin/notify-send"))
|
|
||||||
process.start("/usr/bin/notify-send", notify_send);
|
|
||||||
process.waitForFinished(-1);
|
|
||||||
QString stdout = process.readAllStandardOutput();
|
|
||||||
QString stderr = process.readAllStandardError();
|
|
||||||
#elif defined(Q_OS_MACOS)
|
|
||||||
QProcess process;
|
|
||||||
// @TODO: need to escape special chars with "\"
|
|
||||||
process.start("osascript", macos);
|
|
||||||
process.waitForFinished(-1);
|
|
||||||
QString stdout = process.readAllStandardOutput();
|
|
||||||
QString stderr = process.readAllStandardError();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList notify_send = QStringList() << title << message << "-t" << QString::number(duration);
|
||||||
|
QStringList kdialog = QStringList() << title << message;
|
||||||
|
QStringList macos = QStringList() << "-e" << QString(R"(display notification "%1" with title "%2")").arg(message).arg(title);
|
||||||
|
#if defined(Q_OS_LINUX)
|
||||||
|
QProcess process;
|
||||||
|
if (fileExists("/usr/bin/kdialog"))
|
||||||
|
process.start("/usr/bin/kdialog", kdialog);
|
||||||
|
else if (fileExists("/usr/bin/notify-send"))
|
||||||
|
process.start("/usr/bin/notify-send", notify_send);
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
QString stdout = process.readAllStandardOutput();
|
||||||
|
QString stderr = process.readAllStandardError();
|
||||||
|
#elif defined(Q_OS_MACOS)
|
||||||
|
QProcess process;
|
||||||
|
// @TODO: need to escape special chars with "\"
|
||||||
|
process.start("osascript", macos);
|
||||||
|
process.waitForFinished(-1);
|
||||||
|
QString stdout = process.readAllStandardOutput();
|
||||||
|
QString stderr = process.readAllStandardError();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString displayAddress(const QString& address, int sections, const QString& sep) {
|
QString displayAddress(const QString& address, int sections, const QString& sep) {
|
||||||
|
|
Loading…
Reference in a new issue