From 18e3729805b1629bea80433ad3b912949123b304 Mon Sep 17 00:00:00 2001 From: Francois Andriot Date: Thu, 9 May 2013 18:58:29 +0200 Subject: Kickoff menu: Adds 'kcontrol' and 'run command' in 'computer' tab --- kicker/kicker/ui/k_new_mnu.cpp | 26 +++++++++++++++++++++++--- kicker/kicker/ui/k_new_mnu.h | 1 + 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/kicker/kicker/ui/k_new_mnu.cpp b/kicker/kicker/ui/k_new_mnu.cpp index 4e61f8eca..1c9c0f9e2 100644 --- a/kicker/kicker/ui/k_new_mnu.cpp +++ b/kicker/kicker/ui/k_new_mnu.cpp @@ -1342,11 +1342,15 @@ void KMenu::insertStaticItems() m_systemView->insertSeparator( nId++, i18n("Applications"), index++); - KService::Ptr p = KService::serviceByStorageId("/usr/share/applications/YaST.desktop"); + KService::Ptr p = KService::serviceByStorageId("KControl.desktop"); m_systemView->insertMenuItem(p, nId++, index++); - m_systemView->insertItem( "info", i18n( "System Information" ), - "sysinfo:/", "sysinfo:/", nId++, index++ ); + // run command + if (kapp->authorize("run_command")) + { + m_systemView->insertItem( "run", i18n("Run Command..."), + "", "kicker:/runusercommand", nId++, index++ ); + } m_systemView->insertSeparator( nId++, i18n("System Folders"), index++ ); @@ -2600,6 +2604,10 @@ void KMenu::slotStartURL(const TQString& u) { runCommand(); } + else if ( u == "kicker:/runusercommand" ) + { + runUserCommand(); + } else if ( u == "kicker:/shutdown" ) { #ifdef KDELIBS_SUSE TQByteArray params; @@ -3796,4 +3804,16 @@ void KMenu::slotSuspend(int id) } +void KMenu::runUserCommand() +{ + TQByteArray data; + TQCString appname( "kdesktop" ); + if ( kicker_screen_number ) + appname.sprintf("kdesktop-screen-%d", kicker_screen_number); + + kapp->updateRemoteUserTimestamp( appname ); + kapp->dcopClient()->send( appname, "KDesktopIface", + "popupExecuteCommand()", data ); +} + // vim:cindent:sw=4: diff --git a/kicker/kicker/ui/k_new_mnu.h b/kicker/kicker/ui/k_new_mnu.h index 6dff75feb..6bd969f99 100644 --- a/kicker/kicker/ui/k_new_mnu.h +++ b/kicker/kicker/ui/k_new_mnu.h @@ -181,6 +181,7 @@ protected: // void raiseStackWidget(TQWidget *view); bool runCommand(); + void runUserCommand(); void setupUi(); -- cgit v1.2.1