Support for opening and displaying desktop files
This commit is contained in:
parent
6ace2da599
commit
94ecc56617
2 changed files with 12 additions and 4 deletions
|
@ -246,8 +246,10 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
|
|||
case UrlRole:
|
||||
return item.url();
|
||||
case DisplayNameRole: {
|
||||
if (item.isDesktopFile())
|
||||
return "";
|
||||
if (item.isDesktopFile()) {
|
||||
KDesktopFile dfile(item.localPath());
|
||||
return dfile.readName();
|
||||
}
|
||||
|
||||
return item.url().fileName();
|
||||
}
|
||||
|
@ -938,6 +940,12 @@ void FolderModel::openSelected()
|
|||
KFileItem item(url);
|
||||
QString mimeType = item.mimetype();
|
||||
|
||||
// Desktop file.
|
||||
if (mimeType == "application/x-desktop") {
|
||||
FileLauncher::self()->launchApp(url.toLocalFile(), "");
|
||||
continue;
|
||||
}
|
||||
|
||||
// runnable
|
||||
if (mimeType == "application/x-executable" ||
|
||||
mimeType == "application/x-sharedlib" ||
|
||||
|
|
|
@ -39,7 +39,7 @@ Item {
|
|||
property bool hovered: GridView.view.hoveredItem === control
|
||||
property bool selected: model.selected
|
||||
property bool blank: model.blank
|
||||
property var fileName: model.fileName
|
||||
property var fileName: model.displayName
|
||||
|
||||
// For desktop
|
||||
visible: GridView.view.isDesktopView ? !blank : true
|
||||
|
@ -207,7 +207,7 @@ Item {
|
|||
textFormat: Text.PlainText
|
||||
elide: Qt.ElideRight
|
||||
wrapMode: Text.Wrap
|
||||
text: model.fileName
|
||||
text: control.fileName
|
||||
color: control.GridView.view.isDesktopView ? "white"
|
||||
: selected ? FishUI.Theme.highlightedTextColor
|
||||
: FishUI.Theme.textColor
|
||||
|
|
Loading…
Reference in a new issue