mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
[RSS] Show for akregator/liferea in PATH instead of just in /usr/bin
This commit is contained in:
parent
1059936d57
commit
bf75704cac
|
@ -24,13 +24,14 @@
|
||||||
#include "rssmanager.h"
|
#include "rssmanager.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "webview.h"
|
#include "webview.h"
|
||||||
|
#include "qztools.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
bool startExternalProcess(const QString &program, const QStringList &arguments)
|
static bool startExternalProcess(const QString &program, const QStringList &arguments)
|
||||||
{
|
{
|
||||||
if (!QProcess::startDetached(program, arguments)) {
|
if (!QProcess::startDetached(program, arguments)) {
|
||||||
QString info = "<ul><li><b>" + RSSNotification::tr("Executable: ") + "</b>" + program + "</li><li><b>" + RSSNotification::tr("Arguments: ") + "</b>" + arguments.join(" ") + "</li></ul>";
|
QString info = "<ul><li><b>" + RSSNotification::tr("Executable: ") + "</b>" + program + "</li><li><b>" + RSSNotification::tr("Arguments: ") + "</b>" + arguments.join(" ") + "</li></ul>";
|
||||||
|
@ -62,14 +63,16 @@ RSSNotification::RSSNotification(const QString &title, const QUrl &url, WebView*
|
||||||
<< RssApp("Yahoo!", "http://add.my.yahoo.com/rss?url=", QIcon(":/icons/sites/yahoo.png"));
|
<< RssApp("Yahoo!", "http://add.my.yahoo.com/rss?url=", QIcon(":/icons/sites/yahoo.png"));
|
||||||
|
|
||||||
#ifdef QZ_WS_X11
|
#ifdef QZ_WS_X11
|
||||||
// TODO: Not really clever solution.
|
const QString &akregatorBin = QzTools::resolveFromPath("akregator");
|
||||||
// It should look in PATH
|
const QString &lifereaBin = QzTools::resolveFromPath("liferea");
|
||||||
if (QFile("/usr/bin/akregator").exists()) {
|
const QString &lifereaAddFeedBin = QzTools::resolveFromPath("liferea-add-feed");
|
||||||
m_rssApps << RssApp("Akregator", "/usr/bin/akregator -a ", QIcon(":/icons/sites/akregator.png"), DesktopApplication);
|
|
||||||
|
if (!akregatorBin.isEmpty()) {
|
||||||
|
m_rssApps << RssApp("Akregator", akregatorBin + " -a ", QIcon(":/icons/sites/akregator.png"), DesktopApplication);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QFile("/usr/bin/liferea").exists() && QFile("/usr/bin/liferea-add-feed").exists()) {
|
if (!lifereaBin.isEmpty() && !lifereaAddFeedBin.isEmpty()) {
|
||||||
m_rssApps << RssApp("Liferea", "/usr/bin/liferea-add-feed ", QIcon(":/icons/sites/liferea.png"), DesktopApplication);
|
m_rssApps << RssApp("Liferea", lifereaAddFeedBin + " ", QIcon(":/icons/sites/liferea.png"), DesktopApplication);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -362,6 +362,26 @@ QIcon QzTools::iconFromFileName(const QString &fileName)
|
||||||
return icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QT_QUPZILLA_EXPORT QzTools::resolveFromPath(const QString &name)
|
||||||
|
{
|
||||||
|
const QString &path = qgetenv("PATH").trimmed();
|
||||||
|
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList dirs = path.split(QLatin1Char(':'), QString::SkipEmptyParts);
|
||||||
|
|
||||||
|
foreach(const QString & dir, dirs) {
|
||||||
|
QDir d(dir);
|
||||||
|
if (d.exists(name)) {
|
||||||
|
return d.absoluteFilePath(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
// Qt5 migration help functions
|
// Qt5 migration help functions
|
||||||
bool QzTools::isCertificateValid(const QSslCertificate &cert)
|
bool QzTools::isCertificateValid(const QSslCertificate &cert)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,8 @@ QString QT_QUPZILLA_EXPORT fileSizeToString(qint64 size);
|
||||||
QPixmap QT_QUPZILLA_EXPORT createPixmapForSite(const QIcon &icon, const QString &title, const QString &url);
|
QPixmap QT_QUPZILLA_EXPORT createPixmapForSite(const QIcon &icon, const QString &title, const QString &url);
|
||||||
QString QT_QUPZILLA_EXPORT applyDirectionToPage(QString &pageContents);
|
QString QT_QUPZILLA_EXPORT applyDirectionToPage(QString &pageContents);
|
||||||
|
|
||||||
|
QString QT_QUPZILLA_EXPORT resolveFromPath(const QString &name);
|
||||||
|
|
||||||
QIcon QT_QUPZILLA_EXPORT iconFromFileName(const QString &fileName);
|
QIcon QT_QUPZILLA_EXPORT iconFromFileName(const QString &fileName);
|
||||||
|
|
||||||
QString QT_QUPZILLA_EXPORT buildSystem();
|
QString QT_QUPZILLA_EXPORT buildSystem();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user