[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/krunner
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2010-07-28 18:19:49
Message-ID: 20100728181949.9BB34AC779 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1156228 by aseigo:
move the switch user logic out of krunner dialog and into krunnerapp, use runner \
manager's single mode runner support for it
M +26 -8 krunnerapp.cpp
M +0 -30 krunnerdialog.cpp
M +0 -2 krunnerdialog.h
--- trunk/KDE/kdebase/workspace/krunner/krunnerapp.cpp #1156227:1156228
@@ -43,6 +43,8 @@
#include <Plasma/RunnerManager>
#include <Plasma/AbstractRunner>
+#include "kworkspace/kdisplaymanager.h"
+
#include "appadaptor.h"
#include "kworkspace.h"
#include "ksystemactivitydialog.h"
@@ -138,13 +140,6 @@
a->setGlobalShortcut(KShortcut(Qt::CTRL+Qt::Key_Escape));
connect(a, SIGNAL(triggered(bool)), SLOT(showTaskManager()));
-/*
- * TODO: doesn't this belong in the window manager?
- a = m_actionCollection->addAction("Show Window List");
- a->setText(i18n("Show Window List"));
- a->setGlobalShortcut(KShortcut(Qt::ALT+Qt::Key_F5));
- connect( a, SIGNAL(triggered(bool)), SLOT(slotShowWindowList()));
-*/
if (KAuthorized::authorize("switch_user")) {
a = m_actionCollection->addAction("Switch User");
a->setText(i18n("Switch User"));
@@ -190,6 +185,7 @@
m_actionCollection->readSettings();
if (KAuthorized::authorize("run_command")) {
+ //m_runnerManager->setAllowedRunners(QStringList() << "shell");
m_runnerManager->reloadConfiguration(); // pre-load the runners
// Single runner mode actions shortcuts
@@ -333,8 +329,30 @@
void KRunnerApp::switchUser()
{
- m_interface->switchUser();
+ const KService::Ptr service = \
KService::serviceByStorageId("plasma-runner-sessions.desktop"); + KPluginInfo \
info(service); +
+ if (info.isValid()) {
+ SessList sessions;
+ KDisplayManager dm;
+ dm.localSessions(sessions);
+
+ if (sessions.isEmpty()) {
+ // no sessions to switch between, let's just start up another session \
directly + Plasma::AbstractRunner *sessionRunner = \
m_runnerManager->runner(info.pluginName()); + if (sessionRunner) {
+ Plasma::QueryMatch switcher(sessionRunner);
+ sessionRunner->run(*m_runnerManager->searchContext(), switcher);
}
+ } else {
+ m_runnerManager->setSingleModeRunnerId(info.pluginName());
+ m_runnerManager->setSingleMode(true);
+ m_interface->display();
+ //TODO: ugh, magic strings. See sessions/sessionrunner.cpp
+ m_runnerManager->launchQuery("SESSIONS", info.pluginName());
+ }
+ }
+}
void KRunnerApp::clearHistory()
{
--- trunk/KDE/kdebase/workspace/krunner/krunnerdialog.cpp #1156227:1156228
@@ -264,36 +264,6 @@
Q_UNUSED(staticQuery)
}
-void KRunnerDialog::switchUser()
-{
- const KService::Ptr service = \
KService::serviceByStorageId("plasma-runner-sessions.desktop");
- KPluginInfo info(service);
-
- if (info.isValid()) {
- SessList sessions;
- KDisplayManager dm;
- dm.localSessions(sessions);
-
- if (sessions.isEmpty()) {
- // no sessions to switch between, let's just start up another session \
directly
- Plasma::AbstractRunner *sessionRunner = \
m_runnerManager->runner(info.pluginName());
- if (sessionRunner) {
- Plasma::QueryMatch switcher(sessionRunner);
- sessionRunner->run(*m_runnerManager->searchContext(), switcher);
- }
- } else {
- display(QString());
- //TODO: create a "single runner" mode
- //m_header->setText(i18n("Switch users"));
- //m_header->setPixmap("system-switch-user");
-
- //TODO: ugh, magic strings. See sessions/sessionrunner.cpp
- setStaticQueryMode(true);
- m_runnerManager->launchQuery("SESSIONS", info.pluginName());
- }
- }
-}
-
void KRunnerDialog::toggleConfigDialog()
{
if (m_configWidget) {
--- trunk/KDE/kdebase/workspace/krunner/krunnerdialog.h #1156227:1156228
@@ -51,8 +51,6 @@
virtual void display(const QString &term = QString()) = 0;
virtual void clearHistory() = 0;
- void switchUser();
-
protected:
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic