Changeset 176289d


Ignore:
Timestamp:
Aug 16, 2013 6:18:59 AM (8 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
Children:
cb8f638
Parents:
1f40abc
Message:

Fix the mount tray message clicked functionality, it should now either mount the device and/or open up where the device is mounted in the file manager.

Location:
src-qt4/pc-mounttray
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-mounttray/menuItem.h

    r1620346 r176289d  
    3939        //Setters 
    4040        void updateItem(); 
    41          
     41        void mountItem(); //be careful calling this on it's own 
     42   
    4243        //Getters 
    4344        QString getDeviceName(); 
     
    5859        QCheckBox* checkAutomount; 
    5960 
    60         void mountItem(); 
     61        //void mountItem(); 
    6162        void unmountItem(); 
    6263        void updateSizes(); 
  • src-qt4/pc-mounttray/mountTray.cpp

    r03aedf0 r176289d  
    4242  // Tie the left-click signal to open the context menu 
    4343  connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayActivated(QSystemTrayIcon::ActivationReason)) ); 
    44    
     44  //Connect the message clicked slot 
     45  connect(trayIcon,SIGNAL(messageClicked()),this,SLOT(slotPopupClicked()) ); 
    4546  //Set the default Tray Icon (will change once tray menus are set) 
    4647  trayIcon->setIcon(QIcon(":icons/CDdevices-inactive.png")); 
     
    194195  QStringList nsd = DCheck->devChildren(""); 
    195196  //Remove all the currently managed devices 
    196   qDebug() << "Rescanning Device List:" << nsd; 
     197  qDebug() << "Rescanning Device List"; 
    197198  for(int i=0; i<deviceList.length(); i++){ 
    198199    QString dev = deviceList[i]->device.section("/",-1); 
     
    231232        QString title = tr("New Device"); 
    232233        QString message = QString( tr("%1 can now be accessed")).arg(dlabel); 
    233         slotDisplayPopup(title, message); 
     234        slotDisplayPopup(title, message, nsd[i]); 
    234235      } 
    235236    } 
     
    375376} 
    376377 
    377 void MountTray::slotDisplayPopup(QString title, QString msg){ 
     378void MountTray::slotDisplayPopup(QString title, QString msg, QString device){ 
     379  popupSave = device; //so we know what to do when it is clicked 
    378380  //Display a popup bubble with the given message for 3 seconds 
    379381  trayIcon->contextMenu()->hide(); //close the menu list 
    380   disconnect(trayIcon, SIGNAL(messageClicked()),0,0); //make sure only one signal/slot connection 
    381   connect(trayIcon,SIGNAL(messageClicked()),this,SLOT(slotOpenMediaDir()) ); 
    382382  trayIcon->showMessage(title, msg , QSystemTrayIcon::NoIcon,3000 ); 
    383383} 
    384384 
    385385void MountTray::slotDisplayWarning(QString title, QString msg){ 
     386  popupSave="FSCHECK"; 
    386387  //Display a popup bubble with the given message for 5 seconds 
    387388  trayIcon->contextMenu()->hide(); //close the menu list 
    388   disconnect(trayIcon, SIGNAL(messageClicked()),0,0); //make sure only one signal/slot connection 
    389   connect(trayIcon,SIGNAL(messageClicked()),this,SLOT(slotOpenFSDialog()) ); 
    390389  trayIcon->showMessage(title, msg , QSystemTrayIcon::Warning,5000 ); 
     390} 
     391 
     392void MountTray::slotPopupClicked(){ 
     393  //Check the saved variable for what to do with this popup 
     394  if(popupSave == "FSCHECK"){ 
     395    //Open up the filesystem disk space UI 
     396    slotOpenFSDialog(); 
     397  }else if(!popupSave.isEmpty()){ 
     398    //Check if it is a currently valid device 
     399    if(!popupSave.startsWith(DEVICEDIR)){ popupSave.prepend(DEVICEDIR); } 
     400    for(int i=0; i<deviceList.length(); i++){ 
     401      if( deviceList[i]->device == popupSave){ 
     402        //See if the device is mounted 
     403        if(deviceList[i]->isMounted()){ 
     404          //Open up the mountpoint directory 
     405          openMediaDir(deviceList[i]->mountpoint); 
     406        }else{ 
     407          //Mount the device 
     408          deviceList[i]->mountItem(); 
     409        } 
     410        break; 
     411      } 
     412    } 
     413  } 
     414 
    391415} 
    392416 
  • src-qt4/pc-mounttray/mountTray.h

    r03aedf0 r176289d  
    4848  void slotOpenMediaDir(); 
    4949  void openMediaDir(QString);  
    50   void slotDisplayPopup(QString,QString); 
     50  void slotDisplayPopup(QString,QString, QString device = ""); 
    5151  void slotDisplayWarning(QString,QString); 
     52  void slotPopupClicked(); 
    5253  void removeDevice(QString); 
    5354  void slotRescan(); 
     
    6566  QMenu *trayIconMenu, *sysMenu; 
    6667  QList<MenuItem*> deviceList; 
    67   QStringList oldsysdev; 
     68  //QStringList oldsysdev; 
    6869  FSWatcher *diskWatcher; 
    6970  FSDialog *diskDisplay; 
     
    7172  bool useDiskWatcher, useDiskTimerDevd; 
    7273  int diskTimerMaxMS; //milliseconds 
    73  
     74  QString popupSave; //for saving the device for the latest pop-up message 
    7475 
    7576  void updateMenu(); 
Note: See TracChangeset for help on using the changeset viewer.