mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +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);
|
||||
}
|
||||
|
||||
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)
|
||||
continue;
|
||||
|
||||
// insert to placeholder position
|
||||
AppItem *item = new AppItem(path);
|
||||
m_itemList.insert(i, item);
|
||||
emit itemInserted(i, item);
|
||||
|
||||
break;
|
||||
insertIndex += index;
|
||||
} else {
|
||||
for (auto item : m_itemList)
|
||||
if (item->itemType() == DockItem::App)
|
||||
++insertIndex;
|
||||
}
|
||||
|
||||
AppItem *item = new AppItem(path);
|
||||
m_itemList.insert(insertIndex, item);
|
||||
emit itemInserted(insertIndex, item);
|
||||
}
|
||||
|
||||
void DockItemController::appItemRemoved(const QString &appId)
|
||||
|
@ -24,7 +24,7 @@ signals:
|
||||
|
||||
private:
|
||||
explicit DockItemController(QObject *parent = 0);
|
||||
void appItemAdded(const QDBusObjectPath &path);
|
||||
void appItemAdded(const QDBusObjectPath &path, const int index);
|
||||
void appItemRemoved(const QString &appId);
|
||||
void pluginsItemAdded(PluginsItemInterface *interface);
|
||||
|
||||
|
@ -121,7 +121,7 @@ public Q_SLOTS: // METHODS
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void EntryAdded(const QDBusObjectPath &entryPath);
|
||||
void EntryAdded(const QDBusObjectPath &entryPath, const int index);
|
||||
void EntryRemoved(const QString &entryId);
|
||||
void ServiceRestarted();
|
||||
// begin property changed signals
|
||||
|
@ -6,10 +6,6 @@
|
||||
#include <QDrag>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#define APP_ICON_KEY "icon"
|
||||
#define APP_MENU_KEY "menu"
|
||||
#define APP_XIDS_KEY "app-xids"
|
||||
|
||||
#define APP_DRAG_THRESHOLD 20
|
||||
|
||||
QPoint AppItem::MousePressPos;
|
||||
@ -41,7 +37,7 @@ void AppItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
DockItem::paintEvent(e);
|
||||
|
||||
if (m_draging)
|
||||
if (m_draging || !m_itemEntry->isValid())
|
||||
return;
|
||||
|
||||
const QRect itemRect = rect();
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
DockItem::DockItem(const ItemType type, QWidget *parent)
|
||||
: QWidget(parent),
|
||||
// m_side(DockSettings::Top),
|
||||
m_side(DockSide::Top),
|
||||
m_type(type),
|
||||
|
||||
m_menuManagerInter(new DBusMenuManager(this))
|
||||
|
Loading…
x
Reference in New Issue
Block a user