forked from mirrors/nixpkgs
Merge pull request #61366 from romildo/upd.deepin.dde-file-manager
deepin.dde-file-manager: init at 4.8.6.2
This commit is contained in:
commit
814c4c1b9d
|
@ -35,6 +35,7 @@
|
|||
pkgs.deepin.dde-calendar
|
||||
pkgs.deepin.dde-daemon
|
||||
pkgs.deepin.dde-dock
|
||||
pkgs.deepin.dde-file-manager
|
||||
pkgs.deepin.dde-session-ui
|
||||
pkgs.deepin.deepin-anything
|
||||
pkgs.deepin.deepin-image-viewer
|
||||
|
@ -46,6 +47,7 @@
|
|||
pkgs.deepin.dde-calendar
|
||||
pkgs.deepin.dde-daemon
|
||||
pkgs.deepin.dde-dock
|
||||
pkgs.deepin.dde-file-manager
|
||||
pkgs.deepin.dde-session-ui
|
||||
pkgs.deepin.deepin-anything
|
||||
pkgs.deepin.deepin-image-viewer
|
||||
|
@ -55,6 +57,7 @@
|
|||
systemd.packages = [
|
||||
pkgs.deepin.dde-api
|
||||
pkgs.deepin.dde-daemon
|
||||
pkgs.deepin.dde-file-manager
|
||||
pkgs.deepin.deepin-anything
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,323 @@
|
|||
From 29f4ad88e2294ae70b10180e7361d135c4e5c896 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= <malaquias@gmail.com>
|
||||
Date: Mon, 13 May 2019 00:09:42 -0300
|
||||
Subject: [PATCH 2/2] Use XDG to look for mime cache
|
||||
|
||||
---
|
||||
.../shutil/mimesappsmanager.cpp | 230 ++++++++++--------
|
||||
.../shutil/mimesappsmanager.h | 6 +-
|
||||
2 files changed, 125 insertions(+), 111 deletions(-)
|
||||
|
||||
diff --git a/dde-file-manager-lib/shutil/mimesappsmanager.cpp b/dde-file-manager-lib/shutil/mimesappsmanager.cpp
|
||||
index c9e53630..7a21df51 100644
|
||||
--- a/dde-file-manager-lib/shutil/mimesappsmanager.cpp
|
||||
+++ b/dde-file-manager-lib/shutil/mimesappsmanager.cpp
|
||||
@@ -552,14 +552,20 @@ QString MimesAppsManager::getMimeAppsCacheFile()
|
||||
return QString("%1/%2").arg(DFMStandardPaths::location(DFMStandardPaths::CachePath), "MimeApps.json");
|
||||
}
|
||||
|
||||
-QString MimesAppsManager::getMimeInfoCacheFilePath()
|
||||
+QStringList MimesAppsManager::getMimeInfoCacheFilePath()
|
||||
{
|
||||
- return "/usr/share/applications/mimeinfo.cache";
|
||||
+ QStringList paths;
|
||||
+ for (const QString dir : getMimeInfoCacheFileRootPath() )
|
||||
+ paths.append(dir + QDir::separator() + "mimeinfo.cache");
|
||||
+ qDebug() << "getMimeInfoCacheFilePath: " << paths;
|
||||
+ return paths;
|
||||
}
|
||||
|
||||
-QString MimesAppsManager::getMimeInfoCacheFileRootPath()
|
||||
+QStringList MimesAppsManager::getMimeInfoCacheFileRootPath()
|
||||
{
|
||||
- return "/usr/share/applications";
|
||||
+ QStringList paths = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
|
||||
+ qDebug() << "getMimeInfoCacheFileRootPath: " << paths;
|
||||
+ return paths;
|
||||
}
|
||||
|
||||
QString MimesAppsManager::getDesktopFilesCacheFile()
|
||||
@@ -574,23 +580,27 @@ QString MimesAppsManager::getDesktopIconsCacheFile()
|
||||
|
||||
QStringList MimesAppsManager::getDesktopFiles()
|
||||
{
|
||||
- QStringList desktopFiles;
|
||||
+ QStringList desktopFiles;
|
||||
|
||||
- foreach (QString desktopFolder, getApplicationsFolders()) {
|
||||
- QDirIterator it(desktopFolder, QStringList("*.desktop"),
|
||||
- QDir::Files | QDir::NoDotAndDotDot,
|
||||
- QDirIterator::Subdirectories);
|
||||
- while (it.hasNext()) {
|
||||
- it.next();
|
||||
- desktopFiles.append(it.filePath());
|
||||
- }
|
||||
- }
|
||||
- return desktopFiles;
|
||||
+ foreach (QString desktopFolder, getApplicationsFolders()) {
|
||||
+ QDirIterator it(desktopFolder, QStringList("*.desktop"),
|
||||
+ QDir::Files | QDir::NoDotAndDotDot,
|
||||
+ QDirIterator::Subdirectories);
|
||||
+ while (it.hasNext()) {
|
||||
+ it.next();
|
||||
+ desktopFiles.append(it.filePath());
|
||||
+ }
|
||||
+ }
|
||||
+ return desktopFiles;
|
||||
}
|
||||
|
||||
-QString MimesAppsManager::getDDEMimeTypeFile()
|
||||
+QStringList MimesAppsManager::getDDEMimeTypeFile()
|
||||
{
|
||||
- return QString("%1/%2/%3").arg(getMimeInfoCacheFileRootPath(), "deepin", "dde-mimetype.list");
|
||||
+ QStringList paths;
|
||||
+ for (const QString path : getMimeInfoCacheFileRootPath())
|
||||
+ paths.append(QString("%1/%2/%3").arg(path, "deepin", "dde-mimetype.list"));
|
||||
+ qDebug() << "getDDEMimeTypeFile: " << paths;
|
||||
+ return paths;
|
||||
}
|
||||
|
||||
QMap<QString, DesktopFile> MimesAppsManager::getDesktopObjs()
|
||||
@@ -663,124 +673,128 @@ void MimesAppsManager::initMimeTypeApps()
|
||||
MimeApps.insert(key, orderApps);
|
||||
}
|
||||
|
||||
- //check mime apps from cache
|
||||
- QFile f(getMimeInfoCacheFilePath());
|
||||
- if(!f.open(QIODevice::ReadOnly)){
|
||||
- qDebug () << "failed to read mime info cache file:" << f.errorString();
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
QStringList audioDesktopList;
|
||||
QStringList imageDeksopList;
|
||||
QStringList textDekstopList;
|
||||
QStringList videoDesktopList;
|
||||
|
||||
- while (!f.atEnd()) {
|
||||
- QString data = f.readLine();
|
||||
- QString _desktops = data.split("=").last();
|
||||
- QString mimeType = data.split("=").first();
|
||||
- QStringList desktops = _desktops.split(";");
|
||||
-
|
||||
- foreach (const QString desktop, desktops) {
|
||||
- if(desktop.isEmpty() || audioDesktopList.contains(desktop))
|
||||
- continue;
|
||||
+ //check mime apps from cache
|
||||
+ for (const QString path : getMimeInfoCacheFilePath()) {
|
||||
+ QFile f(path);
|
||||
+ if(!f.open(QIODevice::ReadOnly)){
|
||||
+ qDebug () << "failed to read mime info cache file:" << f.errorString();
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
- if(mimeType.startsWith("audio")){
|
||||
- if(!audioDesktopList.contains(desktop))
|
||||
- audioDesktopList << desktop;
|
||||
- } else if(mimeType.startsWith("image")){
|
||||
- if(!imageDeksopList.contains(desktop))
|
||||
- imageDeksopList << desktop;
|
||||
- } else if(mimeType.startsWith("text")){
|
||||
- if(!textDekstopList.contains(desktop))
|
||||
- textDekstopList << desktop;
|
||||
- } else if(mimeType.startsWith("video")){
|
||||
- if(!videoDesktopList.contains(desktop))
|
||||
- videoDesktopList << desktop;
|
||||
+ while (!f.atEnd()) {
|
||||
+ QString data = f.readLine();
|
||||
+ QString _desktops = data.split("=").last();
|
||||
+ QString mimeType = data.split("=").first();
|
||||
+ QStringList desktops = _desktops.split(";");
|
||||
+
|
||||
+ foreach (const QString desktop, desktops) {
|
||||
+ if(desktop.isEmpty() || audioDesktopList.contains(desktop))
|
||||
+ continue;
|
||||
+
|
||||
+ if(mimeType.startsWith("audio")){
|
||||
+ if(!audioDesktopList.contains(desktop))
|
||||
+ audioDesktopList << desktop;
|
||||
+ } else if(mimeType.startsWith("image")){
|
||||
+ if(!imageDeksopList.contains(desktop))
|
||||
+ imageDeksopList << desktop;
|
||||
+ } else if(mimeType.startsWith("text")){
|
||||
+ if(!textDekstopList.contains(desktop))
|
||||
+ textDekstopList << desktop;
|
||||
+ } else if(mimeType.startsWith("video")){
|
||||
+ if(!videoDesktopList.contains(desktop))
|
||||
+ videoDesktopList << desktop;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+ f.close();
|
||||
}
|
||||
- f.close();
|
||||
|
||||
- const QString mimeInfoCacheRootPath = getMimeInfoCacheFileRootPath();
|
||||
- foreach (QString desktop, audioDesktopList) {
|
||||
- const QString path = QString("%1/%2").arg(mimeInfoCacheRootPath,desktop);
|
||||
- if(!QFile::exists(path))
|
||||
- continue;
|
||||
- DesktopFile df(path);
|
||||
- AudioMimeApps.insert(path, df);
|
||||
- }
|
||||
+ for (const QString mimeInfoCacheRootPath : getMimeInfoCacheFileRootPath()) {
|
||||
+ foreach (QString desktop, audioDesktopList) {
|
||||
+ const QString path = QString("%1/%2").arg(mimeInfoCacheRootPath,desktop);
|
||||
+ if(!QFile::exists(path))
|
||||
+ continue;
|
||||
+ DesktopFile df(path);
|
||||
+ AudioMimeApps.insert(path, df);
|
||||
+ }
|
||||
|
||||
- foreach (QString desktop, imageDeksopList) {
|
||||
- const QString path = QString("%1/%2").arg(mimeInfoCacheRootPath,desktop);
|
||||
- if(!QFile::exists(path))
|
||||
- continue;
|
||||
- DesktopFile df(path);
|
||||
- ImageMimeApps.insert(path, df);
|
||||
- }
|
||||
+ foreach (QString desktop, imageDeksopList) {
|
||||
+ const QString path = QString("%1/%2").arg(mimeInfoCacheRootPath,desktop);
|
||||
+ if(!QFile::exists(path))
|
||||
+ continue;
|
||||
+ DesktopFile df(path);
|
||||
+ ImageMimeApps.insert(path, df);
|
||||
+ }
|
||||
|
||||
- foreach (QString desktop, textDekstopList) {
|
||||
- const QString path = QString("%1/%2").arg(mimeInfoCacheRootPath,desktop);
|
||||
- if(!QFile::exists(path))
|
||||
- continue;
|
||||
- DesktopFile df(path);
|
||||
- TextMimeApps.insert(path, df);
|
||||
- }
|
||||
+ foreach (QString desktop, textDekstopList) {
|
||||
+ const QString path = QString("%1/%2").arg(mimeInfoCacheRootPath,desktop);
|
||||
+ if(!QFile::exists(path))
|
||||
+ continue;
|
||||
+ DesktopFile df(path);
|
||||
+ TextMimeApps.insert(path, df);
|
||||
+ }
|
||||
|
||||
- foreach (QString desktop, videoDesktopList) {
|
||||
- const QString path = QString("%1/%2").arg(mimeInfoCacheRootPath,desktop);
|
||||
- if(!QFile::exists(path))
|
||||
- continue;
|
||||
- DesktopFile df(path);
|
||||
- VideoMimeApps.insert(path, df);
|
||||
+ foreach (QString desktop, videoDesktopList) {
|
||||
+ const QString path = QString("%1/%2").arg(mimeInfoCacheRootPath,desktop);
|
||||
+ if(!QFile::exists(path))
|
||||
+ continue;
|
||||
+ DesktopFile df(path);
|
||||
+ VideoMimeApps.insert(path, df);
|
||||
+ }
|
||||
}
|
||||
-
|
||||
return;
|
||||
}
|
||||
|
||||
void MimesAppsManager::loadDDEMimeTypes()
|
||||
{
|
||||
- QSettings settings(getDDEMimeTypeFile(), QSettings::IniFormat);
|
||||
- qDebug() << settings.childGroups();
|
||||
+ for (const QString path : getDDEMimeTypeFile()) {
|
||||
+ QSettings settings(path, QSettings::IniFormat);
|
||||
+ qDebug() << settings.childGroups();
|
||||
|
||||
- QFile file(getDDEMimeTypeFile());
|
||||
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
- return;
|
||||
- }
|
||||
+ QFile file(path);
|
||||
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ // Read propeties
|
||||
+ QTextStream in(&file);
|
||||
+ QString desktopKey;
|
||||
+ while (!in.atEnd()) {
|
||||
|
||||
- // Read propeties
|
||||
- QTextStream in(&file);
|
||||
- QString desktopKey;
|
||||
- while (!in.atEnd()) {
|
||||
+ // Read new line
|
||||
+ QString line = in.readLine();
|
||||
|
||||
- // Read new line
|
||||
- QString line = in.readLine();
|
||||
+ // Skip empty line or line with invalid format
|
||||
+ if (line.trimmed().isEmpty()) {
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- // Skip empty line or line with invalid format
|
||||
- if (line.trimmed().isEmpty()) {
|
||||
- continue;
|
||||
- }
|
||||
+ // Read group
|
||||
+ // NOTE: symbols '[' and ']' can be found not only in group names, but
|
||||
+ // only group can start with '['
|
||||
|
||||
- // Read group
|
||||
- // NOTE: symbols '[' and ']' can be found not only in group names, but
|
||||
- // only group can start with '['
|
||||
+ if (line.trimmed().startsWith("[") && line.trimmed().endsWith("]")) {
|
||||
+ QString tmp = line.trimmed().replace("[", "").replace("]", "");
|
||||
+ desktopKey = tmp;
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- if (line.trimmed().startsWith("[") && line.trimmed().endsWith("]")) {
|
||||
- QString tmp = line.trimmed().replace("[", "").replace("]", "");
|
||||
- desktopKey = tmp;
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- // If we are in correct group and line contains assignment then read data
|
||||
- int first_equal = line.indexOf('=');
|
||||
- if (!desktopKey.isEmpty() && first_equal >= 0) {
|
||||
- QString value = line.mid(first_equal + 1);
|
||||
- QStringList mimetypes = value.split(";");
|
||||
- DDE_MimeTypes.insert(desktopKey, mimetypes);
|
||||
- desktopKey.clear();
|
||||
+ // If we are in correct group and line contains assignment then read data
|
||||
+ int first_equal = line.indexOf('=');
|
||||
+ if (!desktopKey.isEmpty() && first_equal >= 0) {
|
||||
+ QString value = line.mid(first_equal + 1);
|
||||
+ QStringList mimetypes = value.split(";");
|
||||
+ DDE_MimeTypes.insert(desktopKey, mimetypes);
|
||||
+ desktopKey.clear();
|
||||
+ }
|
||||
}
|
||||
+ file.close();
|
||||
}
|
||||
- file.close();
|
||||
}
|
||||
|
||||
bool MimesAppsManager::lessByDateTime(const QFileInfo &f1, const QFileInfo &f2)
|
||||
diff --git a/dde-file-manager-lib/shutil/mimesappsmanager.h b/dde-file-manager-lib/shutil/mimesappsmanager.h
|
||||
index 223c80aa..00a61302 100644
|
||||
--- a/dde-file-manager-lib/shutil/mimesappsmanager.h
|
||||
+++ b/dde-file-manager-lib/shutil/mimesappsmanager.h
|
||||
@@ -101,12 +101,12 @@ public:
|
||||
|
||||
static QStringList getApplicationsFolders();
|
||||
static QString getMimeAppsCacheFile();
|
||||
- static QString getMimeInfoCacheFilePath();
|
||||
- static QString getMimeInfoCacheFileRootPath();
|
||||
+ static QStringList getMimeInfoCacheFilePath();
|
||||
+ static QStringList getMimeInfoCacheFileRootPath();
|
||||
static QString getDesktopFilesCacheFile();
|
||||
static QString getDesktopIconsCacheFile();
|
||||
static QStringList getDesktopFiles();
|
||||
- static QString getDDEMimeTypeFile();
|
||||
+ static QStringList getDDEMimeTypeFile();
|
||||
static QMap<QString, DesktopFile> getDesktopObjs();
|
||||
static void initMimeTypeApps();
|
||||
static void loadDDEMimeTypes();
|
||||
--
|
||||
2.21.0
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
From e68d983a6befd223087916cb3fe31baee77decc4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= <malaquias@gmail.com>
|
||||
Date: Sun, 12 May 2019 08:50:07 -0300
|
||||
Subject: [PATCH 1/2] Use qt library to determine where to look for application
|
||||
files
|
||||
|
||||
---
|
||||
dde-file-manager-lib/shutil/fileutils.cpp | 34 ++++++++++++-------
|
||||
.../shutil/mimesappsmanager.cpp | 11 ++----
|
||||
2 files changed, 25 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/dde-file-manager-lib/shutil/fileutils.cpp b/dde-file-manager-lib/shutil/fileutils.cpp
|
||||
index ae8120d3..d6a0573a 100644
|
||||
--- a/dde-file-manager-lib/shutil/fileutils.cpp
|
||||
+++ b/dde-file-manager-lib/shutil/fileutils.cpp
|
||||
@@ -242,13 +242,19 @@ bool FileUtils::isArchive(const QString &path)
|
||||
*/
|
||||
QStringList FileUtils::getApplicationNames() {
|
||||
QStringList appNames;
|
||||
- QDirIterator it("/usr/share/applications", QStringList("*.desktop"),
|
||||
- QDir::Files | QDir::NoDotAndDotDot,
|
||||
- QDirIterator::Subdirectories);
|
||||
- while (it.hasNext()) {
|
||||
- it.next();
|
||||
- appNames.append(it.fileName());
|
||||
+
|
||||
+ const QStringList desktopDirs = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
|
||||
+ qDebug() << "dde-file-manager getApplicationNames desktopDirs:" << desktopDirs;
|
||||
+ for (const QString &dir : desktopDirs) {
|
||||
+ QDirIterator it(dir, QStringList("*.desktop"),
|
||||
+ QDir::Files | QDir::NoDotAndDotDot,
|
||||
+ QDirIterator::Subdirectories);
|
||||
+ while (it.hasNext()) {
|
||||
+ it.next();
|
||||
+ appNames.append(it.fileName());
|
||||
+ }
|
||||
}
|
||||
+
|
||||
return appNames;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -259,12 +265,16 @@ QStringList FileUtils::getApplicationNames() {
|
||||
*/
|
||||
QList<DesktopFile> FileUtils::getApplications() {
|
||||
QList<DesktopFile> apps;
|
||||
- QDirIterator it("/usr/share/applications", QStringList("*.desktop"),
|
||||
- QDir::Files | QDir::NoDotAndDotDot,
|
||||
- QDirIterator::Subdirectories);
|
||||
- while (it.hasNext()) {
|
||||
- it.next();
|
||||
- apps.append(DesktopFile(it.filePath()));
|
||||
+ const QStringList desktopDirs = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
|
||||
+ qDebug() << "dde-file-manager getApplications desktopDirs:" << desktopDirs;
|
||||
+ for (const QString &dir : desktopDirs) {
|
||||
+ QDirIterator it(dir, QStringList("*.desktop"),
|
||||
+ QDir::Files | QDir::NoDotAndDotDot,
|
||||
+ QDirIterator::Subdirectories);
|
||||
+ while (it.hasNext()) {
|
||||
+ it.next();
|
||||
+ apps.append(DesktopFile(it.filePath()));
|
||||
+ }
|
||||
}
|
||||
return apps;
|
||||
}
|
||||
diff --git a/dde-file-manager-lib/shutil/mimesappsmanager.cpp b/dde-file-manager-lib/shutil/mimesappsmanager.cpp
|
||||
index c6149702..c9e53630 100644
|
||||
--- a/dde-file-manager-lib/shutil/mimesappsmanager.cpp
|
||||
+++ b/dde-file-manager-lib/shutil/mimesappsmanager.cpp
|
||||
@@ -542,14 +542,9 @@ QStringList MimesAppsManager::getrecommendedAppsFromMimeWhiteList(const DUrl &ur
|
||||
|
||||
QStringList MimesAppsManager::getApplicationsFolders()
|
||||
{
|
||||
- QStringList desktopFolders;
|
||||
- desktopFolders << QString("/usr/share/applications/")
|
||||
- << QString("/usr/local/share/applications/")
|
||||
- << QString("/usr/share/gnome/applications/")
|
||||
- << QString("/var/lib/flatpak/exports/share/applications")
|
||||
- << QDir::homePath() + QString("/.local/share/flatpak/exports/share/applications")
|
||||
- << QDir::homePath() + QString( "/.local/share/applications" );
|
||||
- return desktopFolders;
|
||||
+ QStringList paths = QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation);
|
||||
+ qDebug() << "dde-file-manager getApplicationsFolders:" << paths;
|
||||
+ return paths;
|
||||
}
|
||||
|
||||
QString MimesAppsManager::getMimeAppsCacheFile()
|
||||
--
|
||||
2.21.0
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
From 084c3cfcf4995c109ca2e96f042fe341f925b0b4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Jos=C3=A9=20Romildo=20Malaquias?= <malaquias@gmail.com>
|
||||
Date: Thu, 16 May 2019 19:00:52 -0300
|
||||
Subject: [PATCH 4/4] Use xdg to look for pixmap icons
|
||||
|
||||
---
|
||||
dde-file-manager-lib/shutil/fileutils.cpp | 15 ++++++++++-----
|
||||
1 file changed, 10 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dde-file-manager-lib/shutil/fileutils.cpp b/dde-file-manager-lib/shutil/fileutils.cpp
|
||||
index d6a0573a..e912e7c2 100644
|
||||
--- a/dde-file-manager-lib/shutil/fileutils.cpp
|
||||
+++ b/dde-file-manager-lib/shutil/fileutils.cpp
|
||||
@@ -362,11 +362,16 @@ QIcon FileUtils::searchAppIcon(const DesktopFile &app,
|
||||
}
|
||||
|
||||
// Last chance
|
||||
- QDir appIcons("/usr/share/pixmaps","", 0, QDir::Files | QDir::NoDotAndDotDot);
|
||||
- QStringList iconFiles = appIcons.entryList();
|
||||
- QStringList searchIcons = iconFiles.filter(name);
|
||||
- if (searchIcons.count() > 0) {
|
||||
- return QIcon("/usr/share/pixmaps/" + searchIcons.at(0));
|
||||
+ const QStringList dirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
|
||||
+ qDebug() << "searchAppIcon: last chance: look for pixmaps at: " << dirs;
|
||||
+ for (const QString &dir : dirs) {
|
||||
+ const QString path = dir + QDir::separator() + "pixmaps";
|
||||
+ QDir appIcons(path,"", 0, QDir::Files | QDir::NoDotAndDotDot);
|
||||
+ QStringList iconFiles = appIcons.entryList();
|
||||
+ QStringList searchIcons = iconFiles.filter(name);
|
||||
+ if (searchIcons.count() > 0) {
|
||||
+ return QIcon(path + QDir::separator() + searchIcons.at(0));
|
||||
+ }
|
||||
}
|
||||
|
||||
// Default icon
|
||||
--
|
||||
2.21.0
|
||||
|
251
pkgs/desktops/deepin/dde-file-manager/default.nix
Normal file
251
pkgs/desktops/deepin/dde-file-manager/default.nix
Normal file
|
@ -0,0 +1,251 @@
|
|||
{ stdenv, fetchFromGitHub, pkgconfig, avfs, dde-daemon, dde-dock,
|
||||
dde-polkit-agent, dde-qt-dbus-factory, deepin, deepin-anything,
|
||||
deepin-desktop-schemas, deepin-gettext-tools, deepin-movie-reborn,
|
||||
deepin-shortcut-viewer, deepin-terminal, dtkcore, dtkwidget,
|
||||
ffmpegthumbnailer, file, glib, gnugrep, gsettings-qt, gvfs,
|
||||
jemalloc, kcodecs, libX11, libsecret, polkit, polkit-qt, poppler,
|
||||
procps, qmake, qt5integration, qtmultimedia, qtsvg, qttools,
|
||||
qtx11extras, runtimeShell, samba, shadow, taglib, udisks2-qt5,
|
||||
xdg-user-dirs, xorg, zlib, wrapGAppsHook }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "${pname}-${version}";
|
||||
pname = "dde-file-manager";
|
||||
version = "4.8.6.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "linuxdeepin";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "1qw9slssvy6c4j9czyqrhlr3pq6hzxybb86darja2vka84zmvwip";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
deepin.setupHook
|
||||
qmake
|
||||
qttools
|
||||
pkgconfig
|
||||
deepin-gettext-tools
|
||||
wrapGAppsHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
avfs
|
||||
dde-daemon
|
||||
dde-dock
|
||||
dde-polkit-agent
|
||||
dde-qt-dbus-factory
|
||||
deepin-anything
|
||||
deepin-desktop-schemas
|
||||
deepin-movie-reborn.dev
|
||||
deepin-shortcut-viewer
|
||||
deepin-terminal
|
||||
dtkcore
|
||||
dtkwidget
|
||||
ffmpegthumbnailer
|
||||
file
|
||||
glib.bin
|
||||
glib.dev
|
||||
gnugrep
|
||||
gsettings-qt
|
||||
gvfs
|
||||
jemalloc
|
||||
kcodecs
|
||||
libsecret
|
||||
polkit
|
||||
polkit-qt
|
||||
poppler
|
||||
procps
|
||||
qt5integration
|
||||
qtmultimedia
|
||||
qtsvg
|
||||
qtx11extras
|
||||
samba
|
||||
taglib
|
||||
udisks2-qt5
|
||||
xdg-user-dirs
|
||||
xorg.libX11
|
||||
xorg.libxcb
|
||||
xorg.xcbutil
|
||||
xorg.xcbutilwm
|
||||
xorg.xorgproto
|
||||
zlib
|
||||
];
|
||||
|
||||
patches = [
|
||||
./dde-file-manager.fix-paths.patch
|
||||
./dde-file-manager.fix-mime-cache-paths.patch
|
||||
./dde-file-manager.pixmaps-paths.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
searchHardCodedPaths
|
||||
|
||||
patchShebangs dde-desktop/translate_generation.sh
|
||||
patchShebangs dde-desktop/translate_ts2desktop.sh
|
||||
patchShebangs dde-file-manager-lib/generate_translations.sh
|
||||
patchShebangs dde-file-manager/generate_translations.sh
|
||||
patchShebangs dde-file-manager/translate_ts2desktop.sh
|
||||
patchShebangs usb-device-formatter/generate_translations.sh
|
||||
patchShebangs usb-device-formatter/translate_ts2desktop.sh
|
||||
|
||||
# x-terminal-emulator is a virtual package in Debian systems. The
|
||||
# terminal emulator is configured by Debian's alternative system.
|
||||
# It is not available on NixOS. Use deepin-terminal instead
|
||||
sed -i -e "s,x-terminal-emulator,deepin-terminal," \
|
||||
dde-file-manager-lib/shutil/fileutils.cpp
|
||||
|
||||
sed -i -e "s,\$\$\\[QT_INSTALL_LIBS\\],$out/lib," \
|
||||
dde-file-manager-lib/dde-file-manager-lib.pro \
|
||||
dde-file-thumbnail-tool/common.pri \
|
||||
common/common.pri
|
||||
|
||||
sed -i '/^QMAKE_PKGCONFIG_DESTDIR/i QMAKE_PKGCONFIG_PREFIX = $$PREFIX' \
|
||||
dde-file-manager-lib/dde-file-manager-lib.pro
|
||||
|
||||
fixPath ${dde-dock} /usr/include/dde-dock \
|
||||
dde-dock-plugins/disk-mount/disk-mount.pro
|
||||
|
||||
# treefrog is not available in NixOS, and I am not sure if it is really needed
|
||||
#fixPath $ {treefrog-framework} /usr/include/treefrog \
|
||||
# dde-sharefiles/appbase.pri
|
||||
|
||||
fixPath ${deepin-anything} /usr/share/dbus-1/interfaces \
|
||||
dde-file-manager-lib/dbusinterface/dbusinterface.pri
|
||||
|
||||
sed -i -e "s,\$\$system(\$\$PKG_CONFIG --variable libdir deepin-anything-server-lib),$out/lib," \
|
||||
deepin-anything-server-plugins/dde-anythingmonitor/dde-anythingmonitor.pro
|
||||
|
||||
fixPath ${dde-daemon} /usr/lib/deepin-daemon/desktop-toggle \
|
||||
dde-zone/mainwindow.h
|
||||
|
||||
fixPath ${deepin-gettext-tools} /usr/bin/deepin-desktop-ts-convert \
|
||||
dde-desktop/translate_desktop2ts.sh \
|
||||
dde-desktop/translate_ts2desktop.sh \
|
||||
dde-file-manager/translate_desktop2ts.sh \
|
||||
dde-file-manager/translate_ts2desktop.sh \
|
||||
usb-device-formatter/translate_desktop2ts.sh \
|
||||
usb-device-formatter/translate_ts2desktop.sh
|
||||
|
||||
fixPath ${avfs} /usr/bin/mountavfs dde-file-manager-lib/shutil/fileutils.cpp
|
||||
fixPath ${avfs} /usr/bin/umountavfs dde-file-manager-lib/shutil/fileutils.cpp
|
||||
|
||||
fixPath ${deepin-terminal} /usr/bin/deepin-terminal \
|
||||
dde-file-manager-lib/shutil/fileutils.cpp
|
||||
|
||||
fixPath $out /usr/share/dde-file-manager \
|
||||
dde-sharefiles/appbase.pri \
|
||||
dde-sharefiles/dde-sharefiles.pro
|
||||
|
||||
fixPath $out /usr/share/usb-device-formatter \
|
||||
usb-device-formatter/main.cpp
|
||||
|
||||
fixPath $out /usr/share/applications \
|
||||
dde-file-manager/mips/dde-file-manager-autostart.desktop \
|
||||
dde-desktop/development.pri
|
||||
|
||||
fixPath $out /usr/bin \
|
||||
dbusservices/com.deepin.dde.desktop.service \
|
||||
dde-desktop/data/com.deepin.dde.desktop.service \
|
||||
dde-desktop/dbus/filedialog/com.deepin.filemanager.filedialog.service \
|
||||
dde-desktop/dbus/filemanager1/org.freedesktop.FileManager.service \
|
||||
dde-file-manager-daemon/dbusservice/com.deepin.filemanager.daemon.service \
|
||||
dde-file-manager-daemon/dbusservice/dde-filemanager-daemon.service \
|
||||
dde-file-manager-daemon/dde-file-manager-daemon.pro \
|
||||
dde-file-manager-lib/dde-file-manager-lib.pro \
|
||||
dde-file-manager-lib/pkexec/com.deepin.pkexec.dde-file-manager.policy \
|
||||
dde-file-manager/dde-file-manager-xdg-autostart.desktop \
|
||||
dde-file-manager/dde-file-manager.desktop \
|
||||
dde-file-manager/dde-file-manager.pro \
|
||||
dde-file-manager/mips/dde-file-manager-autostart.desktop \
|
||||
dde-file-manager/mips/dde-file-manager.desktop \
|
||||
dde-file-manager/pkexec/com.deepin.pkexec.dde-file-manager.policy \
|
||||
usb-device-formatter/pkexec/com.deepin.pkexec.usb-device-formatter.policy \
|
||||
usb-device-formatter/usb-device-formatter.desktop \
|
||||
usb-device-formatter/usb-device-formatter.pro
|
||||
fixPath $out /etc \
|
||||
dde-file-manager/dde-file-manager.pro \
|
||||
dde-file-manager-daemon/dde-file-manager-daemon.pro
|
||||
|
||||
fixPath $out /usr \
|
||||
common/common.pri \
|
||||
dde-desktop/dbus/filedialog/filedialog.pri \
|
||||
dde-desktop/dbus/filemanager1/filemanager1.pri \
|
||||
dde-desktop/development.pri \
|
||||
dde-dock-plugins/disk-mount/disk-mount.pro \
|
||||
dde-file-manager-daemon/dde-file-manager-daemon.pro \
|
||||
usb-device-formatter/usb-device-formatter.pro
|
||||
|
||||
sed -i -e "s,xdg-user-dir,${xdg-user-dirs}/bin/xdg-user-dir," \
|
||||
dde-file-manager/dde-xdg-user-dirs-update
|
||||
|
||||
sed -i -e "s,Exec=dde-file-manager,Exec=$out/bin/dde-file-manager," \
|
||||
dde-file-manager/dde-file-manager.desktop
|
||||
|
||||
sed -i -e "s,Exec=gio,Exec=${glib.bin}/bin/gio," \
|
||||
dde-desktop/data/applications/dde-trash.desktop \
|
||||
dde-desktop/data/applications/dde-computer.desktop
|
||||
|
||||
sed -i -e "s,/usr/lib/gvfs/gvfsd,${gvfs}/libexec/gvfsd," \
|
||||
dde-file-manager-lib/gvfs/networkmanager.cpp
|
||||
|
||||
sed -i -e "s,/usr/sbin/smbd,${samba}/bin/smbd," \
|
||||
-e "s,/usr/sbin/groupadd,${shadow}/bin/groupadd," \
|
||||
-e "s,/usr/sbin/adduser,${shadow}/bin/adduser," \
|
||||
dde-file-manager-daemon/usershare/usersharemanager.cpp
|
||||
|
||||
sed -i -e 's,startDetached("deepin-shortcut-viewer",startDetached("${deepin-shortcut-viewer}/bin/deepin-shortcut-viewer",' \
|
||||
dde-file-manager-lib/controllers/appcontroller.cpp
|
||||
|
||||
sed -i -e 's,/bin/bash,${runtimeShell},' \
|
||||
-e 's,\<ps\>,${procps}/bin/ps,' \
|
||||
-e 's,\<grep\>,${gnugrep}/bin/grep,' \
|
||||
utils/utils.cpp \
|
||||
dde-file-manager-lib/controllers/fileeventprocessor.cpp
|
||||
|
||||
# The hard coded path in `QString("/etc/xdg/%1/%2")` in
|
||||
# dde-file-manager-lib/interfaces/dfmsettings.cpp
|
||||
# does not needed a fix because all the standard locations
|
||||
# are tried before faling back to /etc/xdg.
|
||||
|
||||
# I do not know yet how to deal with:
|
||||
# dde-file-manager-lib/sw_label/llsdeepinlabellibrary.h: return "/usr/lib/sw_64-linux-gnu/dde-file-manager/libllsdeeplabel.so";
|
||||
# dde-file-manager-lib/sw_label/filemanagerlibrary.h: return "/usr/lib/sw_64-linux-gnu/dde-file-manager/libfilemanager.so";
|
||||
# dde-file-manager-lib/sw_label/libinstall.sh:mkdir /usr/lib/sw_64-linux-gnu/dde-file-manager
|
||||
# dde-file-manager-lib/sw_label/libinstall.sh:cp libfilemanager.so libllsdeeplabel.so /usr/lib/sw_64-linux-gnu/dde-file-manager
|
||||
# They are not present on my installations of Deepin Linux, Arch Linux and Ubuntu. Can they be ignored?
|
||||
|
||||
# Notes:
|
||||
# - As file-roller is looked in the path using QStandardPaths::findExecutable, it is not been added as a dependency.
|
||||
# - deepin-qt5config is a dependency exclusive to the Deepin Linux distribution. No other distribution has it, according to repology.
|
||||
'';
|
||||
|
||||
qmakeFlags = [
|
||||
"QMAKE_CFLAGS_ISYSTEM="
|
||||
|
||||
# Disable ffmpeg
|
||||
"CONFIG+=DISABLE_FFMPEG"
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${zlib}/lib";
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${libX11}/lib";
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
# debuging
|
||||
unset LD_LIBRARY_PATH
|
||||
searchForUnresolvedDLL $out
|
||||
searchHardCodedPaths $out
|
||||
'';
|
||||
|
||||
passthru.updateScript = deepin.updateScript { inherit name; };
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "File manager and desktop module for Deepin Desktop Environment";
|
||||
homepage = https://github.com/linuxdeepin/dde-file-manager;
|
||||
license = licenses.gpl3;
|
||||
platforms = platforms.linux;
|
||||
maintainers = with maintainers; [ romildo ];
|
||||
};
|
||||
}
|
|
@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
|
|||
sha256 = "1qh079j4c2n33z0ykv87af9vfkmdxxrv6dy54wdqdpr7vrhn89gb";
|
||||
};
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkgconfig
|
||||
|
|
|
@ -11,6 +11,7 @@ let
|
|||
dde-calendar = callPackage ./dde-calendar { };
|
||||
dde-daemon = callPackage ./dde-daemon { };
|
||||
dde-dock = callPackage ./dde-dock { };
|
||||
dde-file-manager = callPackage ./dde-file-manager { };
|
||||
dde-network-utils = callPackage ./dde-network-utils { };
|
||||
dde-polkit-agent = callPackage ./dde-polkit-agent { };
|
||||
dde-qt-dbus-factory = callPackage ./dde-qt-dbus-factory { };
|
||||
|
|
Loading…
Reference in a new issue