Add Documents shortcut detection

Summary:
This adds support for Documents detection when included as a default
as implemented in D16852. This is a work-in-progress and currently
does not succeed.

Assistance is welcome.

Test Plan: Run ctest within the dolphin build directory.

Reviewers: #dolphin

Subscribers: elvisangelaccio, kfm-devel, ngraham

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D16967
This commit is contained in:
Andrew Crouthamel 2019-05-20 16:20:28 -06:00 committed by Nate Graham
parent 2907a34bb5
commit 1b985d1ef4

View file

@ -88,6 +88,7 @@ private:
QMap<QString, QDBusInterface *> m_interfacesMap;
int m_expectedModelCount = 15;
bool m_hasDesktopFolder = false;
bool m_hasDocumentsFolder = false;
bool m_hasDownloadsFolder = false;
void setBalooEnabled(bool enabled);
@ -171,6 +172,10 @@ QStringList PlacesItemModelTest::initialUrls() const
urls << QDir::homePath() + QStringLiteral("/Desktop");
}
if (m_hasDocumentsFolder) {
urls << QDir::homePath() + QStringLiteral("/Documents");
}
if (m_hasDownloadsFolder) {
urls << QDir::homePath() + QStringLiteral("/Downloads");
}
@ -269,6 +274,11 @@ void PlacesItemModelTest::initTestCase()
m_expectedModelCount++;
}
if (QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).exists()) {
m_hasDocumentsFolder = true;
m_expectedModelCount++;
}
if (QDir(QStandardPaths::writableLocation(QStandardPaths::DownloadLocation)).exists()) {
m_hasDownloadsFolder = true;
m_expectedModelCount++;
@ -296,6 +306,9 @@ void PlacesItemModelTest::testGroups()
if (m_hasDesktopFolder) {
expectedRemoteIndex++;
}
if (m_hasDocumentsFolder) {
expectedRemoteIndex++;
}
if (m_hasDownloadsFolder) {
expectedRemoteIndex++;
}
@ -372,6 +385,9 @@ void PlacesItemModelTest::testDeletePlace()
if (m_hasDesktopFolder) {
tempDirIndex++;
}
if (m_hasDocumentsFolder) {
tempDirIndex++;
}
if (m_hasDownloadsFolder) {
tempDirIndex++;
}
@ -545,6 +561,9 @@ void PlacesItemModelTest::testSystemItems()
if (m_hasDesktopFolder) {
tempDirIndex++;
}
if (m_hasDocumentsFolder) {
tempDirIndex++;
}
if (m_hasDownloadsFolder) {
tempDirIndex++;
}
@ -593,6 +612,9 @@ void PlacesItemModelTest::testEditBookmark()
if (m_hasDesktopFolder) {
tempDirIndex++;
}
if (m_hasDocumentsFolder) {
tempDirIndex++;
}
if (m_hasDownloadsFolder) {
tempDirIndex++;
}
@ -631,6 +653,9 @@ void PlacesItemModelTest::testEditAfterCreation()
if (m_hasDesktopFolder) {
tempDirIndex++;
}
if (m_hasDocumentsFolder) {
tempDirIndex++;
}
if (m_hasDownloadsFolder) {
tempDirIndex++;
}
@ -668,6 +693,9 @@ void PlacesItemModelTest::testEditMetadata()
if (m_hasDesktopFolder) {
tempDirIndex++;
}
if (m_hasDocumentsFolder) {
tempDirIndex++;
}
if (m_hasDownloadsFolder) {
tempDirIndex++;
}
@ -707,6 +735,9 @@ void PlacesItemModelTest::testRefresh()
if (m_hasDesktopFolder) {
tempDirIndex++;
}
if (m_hasDocumentsFolder) {
tempDirIndex++;
}
if (m_hasDownloadsFolder) {
tempDirIndex++;
}
@ -778,6 +809,9 @@ void PlacesItemModelTest::testDragAndDrop()
if (m_hasDesktopFolder) {
lastIndex++;
}
if (m_hasDocumentsFolder) {
lastIndex++;
}
if (m_hasDownloadsFolder) {
lastIndex++;
}
@ -897,6 +931,9 @@ void PlacesItemModelTest::renameAfterCreation()
if (m_hasDesktopFolder) {
tempDirIndex++;
}
if (m_hasDocumentsFolder) {
tempDirIndex++;
}
if (m_hasDownloadsFolder) {
tempDirIndex++;
}