mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
change entry added dbus interface
Change-Id: Ifc42fb7c4233cbb4e29900cbb19206710c14e3b4
This commit is contained in:
parent
20ad0443c6
commit
dcca4fcad4
@ -43,20 +43,24 @@ DockItemController::DockItemController(QObject *parent)
|
|||||||
connect(m_pluginsInter, &DockPluginsController::pluginsInserted, this, &DockItemController::pluginsItemAdded);
|
connect(m_pluginsInter, &DockPluginsController::pluginsInserted, this, &DockItemController::pluginsItemAdded);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockItemController::appItemAdded(const QDBusObjectPath &path)
|
void DockItemController::appItemAdded(const QDBusObjectPath &path, const int index)
|
||||||
{
|
{
|
||||||
for (int i(0); i != m_itemList.size(); ++i)
|
// the first index is launcher item
|
||||||
|
int insertIndex = 1;
|
||||||
|
|
||||||
|
// -1 for append to app list end
|
||||||
|
if (index != -1)
|
||||||
{
|
{
|
||||||
if (m_itemList[i]->itemType() != DockItem::Placeholder)
|
insertIndex += index;
|
||||||
continue;
|
} else {
|
||||||
|
for (auto item : m_itemList)
|
||||||
// insert to placeholder position
|
if (item->itemType() == DockItem::App)
|
||||||
AppItem *item = new AppItem(path);
|
++insertIndex;
|
||||||
m_itemList.insert(i, item);
|
|
||||||
emit itemInserted(i, item);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppItem *item = new AppItem(path);
|
||||||
|
m_itemList.insert(insertIndex, item);
|
||||||
|
emit itemInserted(insertIndex, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockItemController::appItemRemoved(const QString &appId)
|
void DockItemController::appItemRemoved(const QString &appId)
|
||||||
|
@ -24,7 +24,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
explicit DockItemController(QObject *parent = 0);
|
explicit DockItemController(QObject *parent = 0);
|
||||||
void appItemAdded(const QDBusObjectPath &path);
|
void appItemAdded(const QDBusObjectPath &path, const int index);
|
||||||
void appItemRemoved(const QString &appId);
|
void appItemRemoved(const QString &appId);
|
||||||
void pluginsItemAdded(PluginsItemInterface *interface);
|
void pluginsItemAdded(PluginsItemInterface *interface);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ public Q_SLOTS: // METHODS
|
|||||||
}
|
}
|
||||||
|
|
||||||
Q_SIGNALS: // SIGNALS
|
Q_SIGNALS: // SIGNALS
|
||||||
void EntryAdded(const QDBusObjectPath &entryPath);
|
void EntryAdded(const QDBusObjectPath &entryPath, const int index);
|
||||||
void EntryRemoved(const QString &entryId);
|
void EntryRemoved(const QString &entryId);
|
||||||
void ServiceRestarted();
|
void ServiceRestarted();
|
||||||
// begin property changed signals
|
// begin property changed signals
|
||||||
|
@ -6,10 +6,6 @@
|
|||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#define APP_ICON_KEY "icon"
|
|
||||||
#define APP_MENU_KEY "menu"
|
|
||||||
#define APP_XIDS_KEY "app-xids"
|
|
||||||
|
|
||||||
#define APP_DRAG_THRESHOLD 20
|
#define APP_DRAG_THRESHOLD 20
|
||||||
|
|
||||||
QPoint AppItem::MousePressPos;
|
QPoint AppItem::MousePressPos;
|
||||||
@ -41,7 +37,7 @@ void AppItem::paintEvent(QPaintEvent *e)
|
|||||||
{
|
{
|
||||||
DockItem::paintEvent(e);
|
DockItem::paintEvent(e);
|
||||||
|
|
||||||
if (m_draging)
|
if (m_draging || !m_itemEntry->isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QRect itemRect = rect();
|
const QRect itemRect = rect();
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
DockItem::DockItem(const ItemType type, QWidget *parent)
|
DockItem::DockItem(const ItemType type, QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
// m_side(DockSettings::Top),
|
m_side(DockSide::Top),
|
||||||
m_type(type),
|
m_type(type),
|
||||||
|
|
||||||
m_menuManagerInter(new DBusMenuManager(this))
|
m_menuManagerInter(new DBusMenuManager(this))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user