Review Request: GlobalShortcuts Plugin for ActivityManager (kamd)

Lamarque Vieira Souza lamarque at kde.org
Tue Apr 3 11:39:04 BST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104428/#review12132
-----------------------------------------------------------



service/plugins/globalshortcuts/globalshortcuts.cpp
<http://git.reviewboard.kde.org/r/104428/#comment9562>

    You can replace the code from this line to line 81 using something like this:
    
    // m_activities is class member variable, not local.
    m_activities = activities;
    updateNextActivityName(0);
    // end of GlobalShortcutsPlugin::listActivitiesFinished
    
    
    void GlobalShortcutsPlugin::updateNextActivityName(QDBusPendingCallWatcher * watcher)
    {
        if (watcher) {
            QDBusPendingReply<QString> reply = *watcher;
    	if (reply.isValid()) {
                KAction * action = m_actionCollection->addAction(QString("switch-to-activity-%1").arg(watcher->property("activity").toString());
                action->setText(i18nc("@action", "Switch to activity \"%1\"", reply.value()));
                action->setGlobalShortcut(KShortcut());
                connect(action, SIGNAL(triggered()), m_signalMapper, SLOT(map()));
                m_signalMapper->setMapping(action, activity);	
    	}
        }
    
        if (m_activities.isEmpty()) {
            connect(m_signalMapper, SIGNAL(mapped(QString)), this, SLOT(setCurrentActivity(QString)));
            m_actionCollection->readSettings();
    	return;
        }
    
        QString activity = m_activities.takeFirst();
        QDBusPendingReply<QString> reply = m_dbusInterface->asyncCallWithArgumentList(
                                        QDBus::AutoDetect,
                                        "ActivityName",
                                        QList<QVariant>() << activity
                                    );
          
        QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(reply, this);
        watcher->setProperty("activity", activity)
        connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
                this, SLOT(updateNextActivityName(QDBusPendingCallWatcher*)));      
    }


- Lamarque Vieira Souza


On March 31, 2012, 7:48 p.m., makis marimpis wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104428/
> -----------------------------------------------------------
> 
> (Updated March 31, 2012, 7:48 p.m.)
> 
> 
> Review request for KDE Base Apps, KDE Runtime, Plasma, and Ivan Čukić.
> 
> 
> Description
> -------
> 
> (follows discarded review: 104391)
> 
> The plugin adds global keyboard shortcuts for changing the activity.
> Defaults start from Qt::MetaModifier + Qt::Key_F1.
> 
> Initially, this functionality was implemented (without correct results) using KActitivities::Controller.
> Using DBus seems fine, just that... it forces kamd to start with 3-4 seconds delay - so it really needs modification/and i would like more guidance related to dbus :D.
> Other than that, feedback is needed. 
> 
> 
> This addresses bugs 265069 and 273467.
>     http://bugs.kde.org/show_bug.cgi?id=265069
>     http://bugs.kde.org/show_bug.cgi?id=273467
> 
> 
> Diffs
> -----
> 
>   service/plugins/CMakeLists.txt 3e965c0a201a7eee2c9868fcf163cf55af636858 
>   service/plugins/globalshortcuts/CMakeLists.txt PRE-CREATION 
>   service/plugins/globalshortcuts/activitymanager-plugin-globalshortcuts.desktop PRE-CREATION 
>   service/plugins/globalshortcuts/globalshortcuts.h PRE-CREATION 
>   service/plugins/globalshortcuts/globalshortcuts.cpp PRE-CREATION 
> 
> Diff: http://git.reviewboard.kde.org/r/104428/diff/
> 
> 
> Testing
> -------
> 
> Logged in.
> Used the default shortcuts to switch activities.
> It works!
> 
> 
> Thanks,
> 
> makis marimpis
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120403/f27335dc/attachment.htm>


More information about the kde-core-devel mailing list