feat: sync setting terminal
This commit is contained in:
parent
0426b57b8d
commit
908cfca920
3 changed files with 24 additions and 1 deletions
|
@ -448,7 +448,23 @@ void MimeAppManager::launchTerminal(const QString &path)
|
||||||
if (m_terminalApps.isEmpty())
|
if (m_terminalApps.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString command = m_terminalApps.first().value("Exec").toString();
|
QSettings settings("cutefishos", "defaultApps");
|
||||||
|
QString defaultTerminal = settings.value("terminal").toString();
|
||||||
|
QString command;
|
||||||
|
|
||||||
|
if (!defaultTerminal.isEmpty()) {
|
||||||
|
for (const XdgDesktopFile &f : m_terminalApps) {
|
||||||
|
if (f.fileName().contains(defaultTerminal)) {
|
||||||
|
command = f.value("Exec").toString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command.isEmpty()) {
|
||||||
|
command = m_terminalApps.first().value("Exec").toString();
|
||||||
|
}
|
||||||
|
|
||||||
FileLauncher::startDetached(command, path, QStringList());
|
FileLauncher::startDetached(command, path, QStringList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,11 @@ QString XdgDesktopFile::prefix() const
|
||||||
return QLatin1String("Desktop Entry");
|
return QLatin1String("Desktop Entry");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString XdgDesktopFile::fileName() const
|
||||||
|
{
|
||||||
|
return m_fileName;
|
||||||
|
}
|
||||||
|
|
||||||
bool XdgDesktopFile::read(const QString &prefix)
|
bool XdgDesktopFile::read(const QString &prefix)
|
||||||
{
|
{
|
||||||
QFile file(m_fileName);
|
QFile file(m_fileName);
|
||||||
|
|
|
@ -42,6 +42,8 @@ public:
|
||||||
QString localeName() const;
|
QString localeName() const;
|
||||||
QString prefix() const;
|
QString prefix() const;
|
||||||
|
|
||||||
|
QString fileName() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool read(const QString &prefix);
|
bool read(const QString &prefix);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue