shared: Retire Common::findInPath() for builtin Qt function
This commit is contained in:
parent
43a0f08579
commit
bf1265fe3a
@ -36,32 +36,14 @@ bool Common::initSqliteDatabase(QString path)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Common::findInPath(QString needle)
|
|
||||||
{
|
|
||||||
QStringList results;
|
|
||||||
QString pathVar = QProcessEnvironment::systemEnvironment().value("PATH", "/usr/bin/:/bin/:");
|
|
||||||
QStringList paths = pathVar.split(":");
|
|
||||||
for(const QString &path : paths)
|
|
||||||
{
|
|
||||||
// TODO: can pass ../ but so be it for now.
|
|
||||||
|
|
||||||
QFileInfo info{path + "/" + needle};
|
|
||||||
if(info.exists())
|
|
||||||
{
|
|
||||||
return info.absoluteFilePath();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
void Common::setPdfViewer()
|
void Common::setPdfViewer()
|
||||||
{
|
{
|
||||||
QString value;
|
QString value;
|
||||||
|
|
||||||
/* TODO: well, we should query this probably from xdg*/
|
/* TODO: well, we should query this probably from xdg*/
|
||||||
QString okularPath = findInPath("okular");
|
QString okularPath = QStandardPaths::findExecutable("okular");
|
||||||
QString evincePath = findInPath("evince");
|
QString evincePath = QStandardPaths::findExecutable("evince");
|
||||||
QString qpdfviewPath = findInPath("qpdfview");
|
QString qpdfviewPath = QStandardPaths::findExecutable("qpdfview");
|
||||||
|
|
||||||
if(okularPath != "")
|
if(okularPath != "")
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,6 @@ void setupAppInfo();
|
|||||||
QString databasePath();
|
QString databasePath();
|
||||||
QString ipcSocketPath();
|
QString ipcSocketPath();
|
||||||
void setPdfViewer();
|
void setPdfViewer();
|
||||||
QString findInPath(QString needle);
|
|
||||||
bool initSqliteDatabase(QString path);
|
bool initSqliteDatabase(QString path);
|
||||||
void ensureConfigured();
|
void ensureConfigured();
|
||||||
QStringList excludedPaths();
|
QStringList excludedPaths();
|
||||||
|
Loading…
Reference in New Issue
Block a user