diff --git a/src/applicationmodel.cpp b/src/applicationmodel.cpp index cc8ac6d..0f563ef 100644 --- a/src/applicationmodel.cpp +++ b/src/applicationmodel.cpp @@ -129,6 +129,11 @@ void ApplicationModel::removeItem(const QString &desktopFile) } } +bool ApplicationModel::desktopContains(const QString &desktopFile) +{ + return findItemByDesktop(desktopFile) != nullptr; +} + void ApplicationModel::clicked(const QString &id) { ApplicationItem *item = findItemById(id); diff --git a/src/applicationmodel.h b/src/applicationmodel.h index 9c9bfe6..0a64056 100644 --- a/src/applicationmodel.h +++ b/src/applicationmodel.h @@ -49,6 +49,7 @@ public: void addItem(const QString &desktopFile); void removeItem(const QString &desktopFile); + bool desktopContains(const QString &desktopFile); Q_INVOKABLE void save() { savePinAndUnPinList(); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 92f6e8e..ac46468 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -104,6 +104,14 @@ void MainWindow::remove(const QString &desktop) m_appModel->removeItem(desktop); } +bool MainWindow::contains(const QString &desktop) +{ + if (desktop.isEmpty()) + return false; + + return m_appModel->desktopContains(desktop); +} + void MainWindow::updateSize() { resizeWindow(); diff --git a/src/mainwindow.h b/src/mainwindow.h index eabfaf3..8f1dbf9 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -37,8 +37,10 @@ public: explicit MainWindow(QQuickView *parent = nullptr); ~MainWindow(); + // DBus interface void add(const QString &desktop); void remove(const QString &desktop); + bool contains(const QString &desktop); Q_INVOKABLE void updateSize(); diff --git a/src/org.Cutefish.Dock.xml b/src/org.Cutefish.Dock.xml index e937e91..f445cbf 100644 --- a/src/org.Cutefish.Dock.xml +++ b/src/org.Cutefish.Dock.xml @@ -3,5 +3,9 @@ + + + +