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:
|
case UrlRole:
|
||||||
return item.url();
|
return item.url();
|
||||||
case DisplayNameRole: {
|
case DisplayNameRole: {
|
||||||
if (item.isDesktopFile())
|
if (item.isDesktopFile()) {
|
||||||
return "";
|
KDesktopFile dfile(item.localPath());
|
||||||
|
return dfile.readName();
|
||||||
|
}
|
||||||
|
|
||||||
return item.url().fileName();
|
return item.url().fileName();
|
||||||
}
|
}
|
||||||
|
@ -938,6 +940,12 @@ void FolderModel::openSelected()
|
||||||
KFileItem item(url);
|
KFileItem item(url);
|
||||||
QString mimeType = item.mimetype();
|
QString mimeType = item.mimetype();
|
||||||
|
|
||||||
|
// Desktop file.
|
||||||
|
if (mimeType == "application/x-desktop") {
|
||||||
|
FileLauncher::self()->launchApp(url.toLocalFile(), "");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// runnable
|
// runnable
|
||||||
if (mimeType == "application/x-executable" ||
|
if (mimeType == "application/x-executable" ||
|
||||||
mimeType == "application/x-sharedlib" ||
|
mimeType == "application/x-sharedlib" ||
|
||||||
|
|
|
@ -39,7 +39,7 @@ Item {
|
||||||
property bool hovered: GridView.view.hoveredItem === control
|
property bool hovered: GridView.view.hoveredItem === control
|
||||||
property bool selected: model.selected
|
property bool selected: model.selected
|
||||||
property bool blank: model.blank
|
property bool blank: model.blank
|
||||||
property var fileName: model.fileName
|
property var fileName: model.displayName
|
||||||
|
|
||||||
// For desktop
|
// For desktop
|
||||||
visible: GridView.view.isDesktopView ? !blank : true
|
visible: GridView.view.isDesktopView ? !blank : true
|
||||||
|
@ -207,7 +207,7 @@ Item {
|
||||||
textFormat: Text.PlainText
|
textFormat: Text.PlainText
|
||||||
elide: Qt.ElideRight
|
elide: Qt.ElideRight
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
text: model.fileName
|
text: control.fileName
|
||||||
color: control.GridView.view.isDesktopView ? "white"
|
color: control.GridView.view.isDesktopView ? "white"
|
||||||
: selected ? FishUI.Theme.highlightedTextColor
|
: selected ? FishUI.Theme.highlightedTextColor
|
||||||
: FishUI.Theme.textColor
|
: FishUI.Theme.textColor
|
||||||
|
|
Loading…
Reference in a new issue