</method>
<method name="toggleActivityManager">
</method>
- <method name="addRemotePlasmoid">
- <arg name="location" type="s" direction="in"/>
- </method>
<method name="supportInformation">
<arg type="s" direction="out"/>
</method>
#include <Plasma/AbstractToolBox>
#include <Plasma/AccessAppletJob>
-#include <Plasma/AccessManager>
#include <Plasma/AuthorizationManager>
#include <Plasma/Containment>
#include <Plasma/Context>
KGlobal::setAllowQuit(true);
KGlobal::ref();
- connect(m_mapper, SIGNAL(mapped(QString)),
- this, SLOT(addRemotePlasmoid(QString)));
- connect(Plasma::AccessManager::self(),
- SIGNAL(finished(Plasma::AccessAppletJob*)),
- this, SLOT(plasmoidAccessFinished(Plasma::AccessAppletJob*)));
- connect(Plasma::AccessManager::self(),
- SIGNAL(remoteAppletAnnounced(Plasma::PackageMetadata)),
- this, SLOT(remotePlasmoidAdded(Plasma::PackageMetadata)));
-
- Plasma::AuthorizationManager::self()->setAuthorizationPolicy(Plasma::AuthorizationManager::PinPairing);
-
QTimer::singleShot(0, this, SLOT(setupDesktop()));
kDebug() << "!!{} STARTUP TIME" << QTime().msecsTo(QTime::currentTime()) << "plasma app ctor end" << "(line:" << __LINE__ << ")";
}
m_panels.removeAll((PanelView *)panel);
}
-void PlasmaApp::remotePlasmoidAdded(Plasma::PackageMetadata metadata)
-{
- //kDebug();
- if (m_desktops.isEmpty()) {
- return;
- }
-
- if (m_corona->immutability() == Plasma::SystemImmutable) {
- kDebug() << "Corona is system locked";
- return;
- }
-
- // the notification ptr is automatically delete when the notification is closed
- KNotification *notification = new KNotification("newplasmoid", m_desktops.at(0));
- notification->setText(i18n("A new widget has become available on the network:<br><b>%1</b> - <i>%2</i>",
- metadata.name(), metadata.description()));
-
- // setup widget icon
- if (!metadata.icon().isEmpty()) {
- notification->setPixmap(KIcon(metadata.icon()).pixmap(IconSize(KIconLoader::Desktop)));
- }
-
- // locked, but the user is able to unlock
- if (m_corona->immutability() == Plasma::UserImmutable) {
- m_unlockCorona = true;
- notification->setActions(QStringList(i18n("Unlock and add to current activity")));
- } else {
- // immutability == Plasma::Mutable
- notification->setActions(QStringList(i18n("Add to current activity")));
- }
-
- m_mapper->setMapping(notification, metadata.remoteLocation().prettyUrl());
- connect(notification, SIGNAL(action1Activated()), m_mapper, SLOT(map()));
-
- kDebug() << "firing notification";
- notification->sendEvent();
-}
-
-void PlasmaApp::addRemotePlasmoid(const QString &location)
-{
- if (m_unlockCorona) {
- m_unlockCorona = false;
- m_corona->setImmutability(Plasma::Mutable);
- }
-
- Plasma::AccessManager::self()->accessRemoteApplet(KUrl(location));
-}
QString PlasmaApp::supportInformation() const
{
return SupportInformation::generateSupportInformation(m_corona);
}
-void PlasmaApp::plasmoidAccessFinished(Plasma::AccessAppletJob *job)
-{
- if (m_desktops.isEmpty()) {
- return;
- }
-
- Plasma::Containment *c = m_desktops.at(0)->containment();
- if (c) {
- kDebug() << "adding applet";
- c->addApplet(job->applet(), QPointF(-1, -1), false);
- }
-}
void PlasmaApp::createActivity(const QString &plugin)
{
void toggleActivityManager();
- void addRemotePlasmoid(const QString &location);
-
QString supportInformation() const;
protected:
void configureContainment(Plasma::Containment*);
void checkVirtualDesktopViews(int numDesktops);
void setWmClass(WId id);
- void remotePlasmoidAdded(Plasma::PackageMetadata metadata);
- void plasmoidAccessFinished(Plasma::AccessAppletJob *job);
void wallpaperCheckedIn();
void wallpaperCheckInTimeout();
void dashboardClosed();
add_subdirectory(plasmapkg)
-add_subdirectory(plasma-remote-helper)
+++ /dev/null
-set(plasma_remote_helper_SRCS
- main.cpp
-)
-
-kde4_add_executable(plasma-remote-helper ${plasma_remote_helper_SRCS})
-
-target_link_libraries(plasma-remote-helper ${KDE4_KDEUI_LIBS})
-
-install(TARGETS plasma-remote-helper ${INSTALL_TARGETS_DEFAULT_ARGS})
-
+++ /dev/null
-#!/bin/bash
-$XGETTEXT *.cpp -o $podir/plasma-remote-helper.pot
+++ /dev/null
-/* Copyright 2011 Kevin Ottens <ervin@kde.org>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2,
- or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details
-
- You should have received a copy of the GNU Library General Public
- License along with this program; if not, write to the
- Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-#include <iostream>
-
-#include <QtDBus/QDBusInterface>
-#include <QtDBus/QDBusReply>
-
-#include <KDE/KApplication>
-#include <KDE/KAboutData>
-#include <KDE/KCmdLineArgs>
-
-static const char description[] = I18N_NOOP("Trigger the installation of a remote Plasma Widget");
-static const char version[] = "0.1";
-
-int addRemotePlasmoidToShell(const QString &shellName, const QString &url)
-{
- QString serviceName = "org.kde." + shellName;
- QDBusInterface iface(serviceName, "/App");
-
- if (!iface.isValid()) {
- std::cerr << "Error: Couldn't contact "
- << shellName.toLocal8Bit().constData() << std::endl;
- return 1;
- } else {
- QDBusReply<void> reply = iface.call("addRemotePlasmoid", url);
- if (!reply.isValid()) {
- std::cerr << "Error: Couldn't call addRemotePlasmoid on "
- << shellName.toLocal8Bit().constData() << std::endl;
- return 1;
- }
- }
-
- return 0;
-}
-
-int main(int argc, char **argv)
-{
- KAboutData aboutData("plasma-remote-helper", 0, ki18n("Plasma Remote Widget Helper"),
- version, ki18n(description), KAboutData::License_GPL,
- ki18n("(C) 2011 Kevin Ottens"));
- aboutData.addAuthor( ki18n("Kevin Ottens"),
- ki18n("Original author"),
- "ervin@kde.org" );
-
- KComponentData componentData(aboutData);
-
- KCmdLineArgs::init( argc, argv, &aboutData );
-
- KCmdLineOptions options;
- options.add("+<url>", ki18n("URL to the Plasma Remote Widget."));
- KCmdLineArgs::addCmdLineOptions( options );
-
- KApplication app;
-
- KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
- if (args->count()<1) {
- KCmdLineArgs::usageError(i18n("Syntax Error: Not enough arguments"));
- } else if (args->count()>1) {
- KCmdLineArgs::usageError(i18n("Syntax Error: Too many arguments"));
- }
-
- QString url = args->arg(0);
- return addRemotePlasmoidToShell("plasma-desktop", url);
-}
-