Add contains interface
This commit is contained in:
parent
a528b3c538
commit
357e4dd3ab
5 changed files with 20 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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(); }
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -3,5 +3,9 @@
|
|||
<interface name="org.cutefish.Dock">
|
||||
<method name="add"><arg name="desktopFile" type="s" direction="in"/></method>
|
||||
<method name="remove"><arg name="desktopFile" type="s" direction="in"/></method>
|
||||
<method name="contains">
|
||||
<arg name="desktopFile" type="s" direction="in"/>
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
||||
</node>
|
||||
|
|
Loading…
Reference in a new issue