Changeset 29587c6


Ignore:
Timestamp:
05/13/14 07:14:37 (7 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
ee5baaa7
Parents:
66e23d4
Message:

Make the desktop right-click menu configurable!
It now uses the default terminal application (modifiable), as well as allowing the user to change the items between the header and the logout menu (always required at the bottom).

Location:
lumina/lumina-desktop
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lumina/lumina-desktop/LDesktop.cpp

    r92c8291 r29587c6  
    5757} 
    5858 
     59void LDesktop::SystemTerminal(){  
     60  QString term = settings->value("default-terminal","xterm").toString(); 
     61  QProcess::startDetached(term);  
     62} 
     63 
    5964// ===================== 
    6065//     PRIVATE SLOTS  
     
    6873} 
    6974 
    70 void LDesktop::UpdateMenu(){ 
    71   qDebug() << " - Update Menu:" << desktopnumber; 
    72   deskMenu->clear(); 
     75void LDesktop::UpdateMenu(bool fast){ 
     76  //qDebug() << " - Update Menu:" << desktopnumber; 
    7377  //Put a label at the top  
    7478  int num = LX11::GetCurrentDesktop(); 
     
    7680  if(num < 0){ workspacelabel->setText( "<b>"+tr("Lumina Desktop")+"</b>"); } 
    7781  else{ workspacelabel->setText( "<b>"+QString(tr("Workspace %1")).arg(QString::number(num+1))+"</b>"); } 
     82  if(fast){ return; } //already done 
     83  deskMenu->clear(); //clear it for refresh 
    7884  deskMenu->addAction(wkspaceact); 
    7985  deskMenu->addSeparator(); 
    80   //Add in the system applications menu 
    81   deskMenu->addAction(LXDG::findIcon("utilities-terminal",""), tr("Terminal"), this, SLOT(SystemTerminal()) ); 
    82   deskMenu->addMenu( LSession::applicationMenu() ); 
    83   deskMenu->addSeparator(); 
    84   deskMenu->addMenu( LSession::settingsMenu() ); 
     86  //Now load the user's menu setup and fill the menu 
     87  QStringList items = settings->value("menu/itemlist", QStringList()<< "terminal" << "applications" << "line" << "settings" ).toStringList(); 
     88  for(int i=0; i<items.length(); i++){ 
     89    if(items[i]=="terminal"){ deskMenu->addAction(LXDG::findIcon("utilities-terminal",""), tr("Terminal"), this, SLOT(SystemTerminal()) ); } 
     90    else if(items[i]=="applications"){ deskMenu->addMenu( LSession::applicationMenu() ); } 
     91    else if(items[i]=="line"){ deskMenu->addSeparator(); } 
     92    else if(items[i]=="settings"){ deskMenu->addMenu( LSession::settingsMenu() ); } 
     93  } 
    8594  //Now add the system quit options 
    8695  deskMenu->addSeparator(); 
  • lumina/lumina-desktop/LDesktop.h

    r92c8291 r29587c6  
    3737public slots: 
    3838        void SystemLogout(){ LSession::systemWindow(); } 
    39         //void SystemRestart(){ SYSTEM::restart(); QCoreApplication::exit(0); } 
    40         //void SystemShutdown(){ SYSTEM::shutdown(); QCoreApplication::exit(0); } 
    41         void SystemTerminal(){ QProcess::startDetached("xterm"); } 
     39        void SystemTerminal(); 
    4240         
    4341private: 
     
    6159private slots: 
    6260        void SettingsChanged(); 
    63         void UpdateMenu(); 
     61        void UpdateMenu(bool fast = false); 
    6462        void ShowMenu(){ 
    65           UpdateMenu(); 
     63          UpdateMenu(true); //run the fast version 
    6664          deskMenu->popup(QCursor::pos()); 
    6765        } 
Note: See TracChangeset for help on using the changeset viewer.