[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:40 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=61fcf3f
The following commit has been merged in the master branch:
commit 61fcf3f4ba03daf6efd7ce5a089c21bd5394b00a
Author: Aleix Pol <aleixpol at kde.org>
Date: Sat Jun 14 18:56:13 2014 +0200
Improve exposed actions
If there's no paired devices, show nothing.
If there's one, just one action to send directly from.
If there's more, then show the submenu
---
fileitemactionplugin/sendfileitemaction.cpp | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/fileitemactionplugin/sendfileitemaction.cpp b/fileitemactionplugin/sendfileitemaction.cpp
index e2b71e6..508f182 100644
--- a/fileitemactionplugin/sendfileitemaction.cpp
+++ b/fileitemactionplugin/sendfileitemaction.cpp
@@ -48,23 +48,33 @@ QList<QAction*> SendFileItemAction::actions(const KFileItemListProperties& fileI
{
DevicesModel m;
- QAction *menuAction = new QAction(QIcon::fromTheme("preferences-system-network"), i18n("Send via KDE Connect"), parentWidget);
- QMenu *menu = new QMenu();
+ QList<QAction*> actions;
for(int i = 0; i<m.rowCount(); ++i) {
QModelIndex idx = m.index(i);
DeviceDbusInterface* dev = m.getDevice(idx);
if(dev->isReachable() && dev->isPaired()) {
- QAction* action = menu->addAction(dev->name(), this, SLOT(sendFile()));
+ QAction* action = new QAction(dev->name(), parentWidget);
action->setProperty("id", idx.data(DevicesModel::IdModelRole));
action->setProperty("urls", QVariant::fromValue(fileItemInfos.urlList()));
action->setProperty("parentWidget", QVariant::fromValue(parentWidget));
+ actions += action;
}
}
- menuAction->setMenu(menu);
-
- return QList<QAction*>() << menuAction;
+ if (actions.count() > 1) {
+ QAction *menuAction = new QAction(QIcon::fromTheme("preferences-system-network"), i18n("Send via KDE Connect"), parentWidget);
+ QMenu *menu = new QMenu();
+ menu->addActions(actions);
+ menuAction->setMenu(menu);
+ return QList<QAction*>() << menuAction;
+ } else {
+ if(actions.count() == 1) {
+ actions.first()->setText(i18n("Send to '%1' via KDE Connect", actions.first()->text()));
+ actions.first()->setIcon(QIcon::fromTheme("preferences-system-network"));
+ }
+ return actions;
+ }
}
void SendFileItemAction::sendFile()
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list