plasma: setup drag for recent entries in launcher applet

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-24 05:59:08 +03:00
parent 36381cb9ec
commit 5e7422c5c7

View file

@ -1438,11 +1438,12 @@ void LauncherRecent::slotUpdateLayout()
const QSizeF iconsize = kIconSize(); const QSizeF iconsize = kIconSize();
foreach (const QString &recent, KRecentDocument::recentDocuments()) { foreach (const QString &recent, KRecentDocument::recentDocuments()) {
KDesktopFile recentfile(recent); KDesktopFile recentfile(recent);
const QString recenturl = recentfile.readUrl();
LauncherWidget* launcherwidget = new LauncherWidget(this); LauncherWidget* launcherwidget = new LauncherWidget(this);
launcherwidget->setup( launcherwidget->setup(
iconsize, kRecentIcon(recentfile.readIcon()), recentfile.readName(), recentfile.readComment() iconsize, kRecentIcon(recentfile.readIcon()), recentfile.readName(), recentfile.readComment()
); );
launcherwidget->setData(recentfile.readUrl()); launcherwidget->setData(recenturl);
QAction* recenteaction = new QAction(launcherwidget); QAction* recenteaction = new QAction(launcherwidget);
recenteaction->setIcon(KIcon("edit-delete")); recenteaction->setIcon(KIcon("edit-delete"));
recenteaction->setToolTip(i18n("Remove")); recenteaction->setToolTip(i18n("Remove"));
@ -1453,6 +1454,7 @@ void LauncherRecent::slotUpdateLayout()
Qt::QueuedConnection Qt::QueuedConnection
); );
launcherwidget->addAction(recenteaction); launcherwidget->addAction(recenteaction);
launcherwidget->setMimeData(kMakeMimeData(recenturl));
b_launcherwidgets.append(launcherwidget); b_launcherwidgets.append(launcherwidget);
b_layout->addItem(launcherwidget); b_layout->addItem(launcherwidget);
connect( connect(