Changeset 6396629


Ignore:
Timestamp:
01/29/15 12:27:25 (4 months ago)
Author:
Ken Moore <ken@…>
Branches:
releng/10.1.1
Children:
c3f01b6
Parents:
29644d7
git-author:
Ken Moore <ken@…> (01/29/15 11:30:58)
git-committer:
Ken Moore <ken@…> (01/29/15 12:27:25)
Message:

Clean up how the mounttray operates when "Refreshing" the list from manual input(don't show notifications about new devices, and automatically re-open the menu).
Also ensure that the menu always opens in the middle of the tray icon (no longer using the mouse position).

Location:
src-qt5/pc-mounttray
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-qt5/pc-mounttray/mountTray.cpp

    r29644d7 r6396629  
    5050     
    5151  // Tie the left-click signal to open the context menu 
    52   connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayActivated(QSystemTrayIcon::ActivationReason)) ); 
     52  connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayActivated()) ); 
    5353  //Connect the message clicked slot 
    5454  connect(trayIcon,SIGNAL(messageClicked()),this,SLOT(slotPopupClicked()) ); 
     
    175175} 
    176176*/ 
    177 void MountTray::slotTrayActivated(QSystemTrayIcon::ActivationReason reason) { 
    178    //if(reason == QSystemTrayIcon::Trigger) { 
    179      //Make sure all the items are updated 
    180      /*for(int i=0; i<deviceList.length(); i++){ 
    181         deviceList[i]->updateItem(); 
    182      }*/ 
     177void MountTray::slotTrayActivated() { 
    183178     UpdateDeviceMenu(true); //do the quick version 
    184179     //qDebug() << "Show Menu"; 
    185      trayIcon->contextMenu()->popup( QCursor::pos() ); 
    186    //} 
     180     trayIcon->contextMenu()->popup( QPoint( trayIcon->geometry().x()+(trayIcon->geometry().width()/2), trayIcon->geometry().y() + (trayIcon->geometry().height()/2)  ) ); 
    187181} 
    188182 
     
    309303  slotDisplayPopup(tr("Please Wait"),tr("Rescanning devices attached to the system")); 
    310304  //Rescan the device list for new devices 
    311   UpdateDeviceMenu(); 
    312   /*scanInitialDevices(); 
    313   //Check that all the existing devices still exist 
    314   for(int i=0; i<deviceList.length(); i++){ 
    315     deviceList[i]->updateItem(); 
    316   }*/ 
     305  UpdateDeviceMenu(false, true); //flag this as a refresh (don't show notifications) 
    317306  //Run the disk check if appropriate 
    318307  if(useDiskWatcher){ diskWatcher->checkFS(); } 
     308  //Re-open the menu 
     309  slotTrayActivated(); 
    319310} 
    320311 
     
    375366  //Display a popup bubble with the given message for 2 seconds 
    376367  trayIcon->contextMenu()->hide(); //close the menu list 
    377   trayIcon->showMessage(title, msg , QSystemTrayIcon::NoIcon,2000 ); 
     368  trayIcon->showMessage(title, msg , QSystemTrayIcon::NoIcon,1000 ); 
    378369} 
    379370 
     
    526517}*/ 
    527518   
    528 void MountTray::UpdateDeviceMenu(bool fast){ 
     519void MountTray::UpdateDeviceMenu(bool fast, bool refresh){ 
    529520  QStringList avail, mounted; 
    530521  QStringList tmp = pcbsd::Utils::runShellCommand("pc-sysconfig list-remdev list-mounteddev"); 
     
    562553  } 
    563554  //Now show a popup message about any new devices 
    564   if(!avail.isEmpty() && !MTINIT && newitems){ 
     555  if(!avail.isEmpty() && !MTINIT && newitems && !refresh){ 
    565556    slotDisplayPopup(tr("Devices Available"), tr("New Devices are available for use")); 
    566557  } 
  • src-qt5/pc-mounttray/mountTray.h

    r9352a7e r6396629  
    5151  void newDevdMessage(); 
    5252  //void slotDevChanges(bool showPopup = true); 
    53   void slotTrayActivated(QSystemTrayIcon::ActivationReason); 
     53  void slotTrayActivated(); 
    5454  //void slotOpenMediaDir(); 
    5555  //void openMediaDir(QString);  
     
    6666 
    6767  //New Functions 
    68   void UpdateDeviceMenu(bool fast = false); 
     68  void UpdateDeviceMenu(bool fast = false, bool refresh=false); 
    6969   
    7070private: 
Note: See TracChangeset for help on using the changeset viewer.