ContainmentInt is now resposible for all Tasks

pull/15/head
Michail Vourlakos 5 years ago
parent 99db4d54f2
commit 2fae4a87ba

@ -62,6 +62,9 @@ ContainmentInterface::ContainmentInterface(Latte::View *parent)
m_appletsExpandedConnectionsTimer.start(); m_appletsExpandedConnectionsTimer.start();
} }
}); });
connect(m_latteTasksModel, &TasksModel::countChanged, this, &ContainmentInterface::onLatteTasksCountChanged);
connect(m_plasmaTasksModel, &TasksModel::countChanged, this, &ContainmentInterface::onPlasmaTasksCountChanged);
} }
ContainmentInterface::~ContainmentInterface() ContainmentInterface::~ContainmentInterface()
@ -441,6 +444,16 @@ bool ContainmentInterface::hasExpandedApplet() const
return m_expandedAppletIds.count() > 0; return m_expandedAppletIds.count() > 0;
} }
bool ContainmentInterface::hasLatteTasks() const
{
return (m_latteTasksModel->count() > 0);
}
bool ContainmentInterface::hasPlasmaTasks() const
{
return (m_plasmaTasksModel->count() > 0);
}
void ContainmentInterface::addExpandedApplet(const int &id) void ContainmentInterface::addExpandedApplet(const int &id)
{ {
if (m_expandedAppletIds.contains(id) && appletIsExpandable(id)) { if (m_expandedAppletIds.contains(id) && appletIsExpandable(id)) {
@ -498,6 +511,28 @@ void ContainmentInterface::on_appletExpandedChanged()
} }
} }
void ContainmentInterface::onLatteTasksCountChanged()
{
if ((m_hasLatteTasks && m_latteTasksModel->count()>0)
|| (!m_hasLatteTasks && m_latteTasksModel->count() == 0)) {
return;
}
m_hasLatteTasks = (m_latteTasksModel->count() > 0);
emit hasLatteTasksChanged();
}
void ContainmentInterface::onPlasmaTasksCountChanged()
{
if ((m_hasPlasmaTasks && m_plasmaTasksModel->count()>0)
|| (!m_hasPlasmaTasks && m_plasmaTasksModel->count() == 0)) {
return;
}
m_hasPlasmaTasks = (m_plasmaTasksModel->count() > 0);
emit hasPlasmaTasksChanged();
}
bool ContainmentInterface::appletIsExpanded(const int id) bool ContainmentInterface::appletIsExpanded(const int id)
{ {
return m_expandedAppletIds.contains(id); return m_expandedAppletIds.contains(id);

@ -50,6 +50,8 @@ class ContainmentInterface: public QObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool hasExpandedApplet READ hasExpandedApplet NOTIFY hasExpandedAppletChanged) Q_PROPERTY(bool hasExpandedApplet READ hasExpandedApplet NOTIFY hasExpandedAppletChanged)
Q_PROPERTY(bool hasLatteTasks READ hasLatteTasks NOTIFY hasLatteTasksChanged)
Q_PROPERTY(bool hasPlasmaTasks READ hasPlasmaTasks NOTIFY hasPlasmaTasksChanged)
Q_PROPERTY(QAbstractListModel *latteTasksModel READ latteTasksModel() NOTIFY latteTasksModelChanged) Q_PROPERTY(QAbstractListModel *latteTasksModel READ latteTasksModel() NOTIFY latteTasksModelChanged)
Q_PROPERTY(QAbstractListModel *plasmaTasksModel READ plasmaTasksModel() NOTIFY plasmaTasksModelChanged) Q_PROPERTY(QAbstractListModel *plasmaTasksModel READ plasmaTasksModel() NOTIFY plasmaTasksModelChanged)
@ -59,6 +61,8 @@ public:
virtual ~ContainmentInterface(); virtual ~ContainmentInterface();
bool hasExpandedApplet() const; bool hasExpandedApplet() const;
bool hasLatteTasks() const;
bool hasPlasmaTasks() const;
bool applicationLauncherInPopup() const; bool applicationLauncherInPopup() const;
bool applicationLauncherHasGlobalShortcut() const; bool applicationLauncherHasGlobalShortcut() const;
@ -92,8 +96,10 @@ public slots:
Q_INVOKABLE bool appletIsExpanded(const int id); Q_INVOKABLE bool appletIsExpanded(const int id);
signals: signals:
void hasExpandedAppletChanged();
void expandedAppletStateChanged(); void expandedAppletStateChanged();
void hasExpandedAppletChanged();
void hasLatteTasksChanged();
void hasPlasmaTasksChanged();
void latteTasksModelChanged(); void latteTasksModelChanged();
void plasmaTasksModelChanged(); void plasmaTasksModelChanged();
@ -104,6 +110,8 @@ private slots:
void updateAppletsTracking(); void updateAppletsTracking();
void on_appletAdded(Plasma::Applet *applet); void on_appletAdded(Plasma::Applet *applet);
void on_appletExpandedChanged(); void on_appletExpandedChanged();
void onLatteTasksCountChanged();
void onPlasmaTasksCountChanged();
private: private:
void addExpandedApplet(const int &id); void addExpandedApplet(const int &id);
@ -112,6 +120,9 @@ private:
bool appletIsExpandable(PlasmaQuick::AppletQuickItem *appletQuickItem); bool appletIsExpandable(PlasmaQuick::AppletQuickItem *appletQuickItem);
private: private:
bool m_hasLatteTasks{false};
bool m_hasPlasmaTasks{false};
QMetaMethod m_activateEntryMethod; QMetaMethod m_activateEntryMethod;
QMetaMethod m_appletIdForIndexMethod; QMetaMethod m_appletIdForIndexMethod;
QMetaMethod m_newInstanceMethod; QMetaMethod m_newInstanceMethod;

Loading…
Cancel
Save