void MountTray::slotPopupClicked(){ //Check the saved variable for what to do with this popup if(popupSave == "FSCHECK"){ //Open up the filesystem disk space UI slotOpenFSDialog(); }else{ slotTrayActivated(); //Open up the menu } }
void MountTray::slotPopupClicked(){ //Check the saved variable for what to do with this popup if(popupSave == "FSCHECK"){ //Open up the filesystem disk space UI slotOpenFSDialog(); }else if(!popupSave.isEmpty()){ //Check if it is a currently valid device if(!popupSave.startsWith(DEVICEDIR)){ popupSave.prepend(DEVICEDIR); } for(int i=0; i<deviceList.length(); i++){ if( deviceList[i]->device == popupSave){ //See if the device is mounted if(deviceList[i]->isMounted()){ //Open up the mountpoint directory openMediaDir(deviceList[i]->mountpoint); }else{ //Mount the device deviceList[i]->mountItem(); } break; } } } }
void MountTray::programInit() { DCheck = new DevCheck(); //initialize class for checking devices qDebug() << "pc-mounttray: starting up"; MTINIT=true; //set the flag that the mount tray is initializing; //getInitialUsername(); //try to detect the non-root user who is running the program with root permissions getFileManager(); loadSavedSettings(); trayIcon = new QSystemTrayIcon(this); trayIconMenu = new QMenu(); //Generate the system menu options (these don't change) sysMenu = new QMenu( tr("More Options") ); sysMenu->setIcon( QIcon(":icons/config.png") ); //Add the additional options sysMenu->addAction( QIcon(":icons/folder.png"), tr("Open Media Directory"), this, SLOT(slotOpenMediaDir()) ); sysMenu->addAction( QIcon(":icons/harddrive.png"), tr("View Disk Usage"),this,SLOT(slotOpenFSDialog()) ); sysMenu->addAction( QIcon(":icons/refresh.png"),tr("Rescan Devices"), this, SLOT(slotRescan()) ); //Add the setting dialog option seperately sysMenu->addSeparator(); sysMenu->addAction( QIcon(":icons/dvd.png"), tr("Load ISO File"), this, SLOT(slotOpenISO()) ); sysMenu->addAction( QIcon(":icons/config.png"), tr("Change Settings"), this, SLOT(slotOpenSettings()) ); //Add the Close button seperately sysMenu->addSeparator(); sysMenu->addAction( QIcon(":icons/application-exit.png"), tr("Close Tray"), this, SLOT(closeTray()) ); // Tie the left-click signal to open the context menu connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(slotTrayActivated(QSystemTrayIcon::ActivationReason)) ); //Connect the message clicked slot connect(trayIcon,SIGNAL(messageClicked()),this,SLOT(slotPopupClicked()) ); //Set the default Tray Icon (will change once tray menus are set) trayIcon->setIcon(QIcon(":icons/CDdevices-inactive.png")); trayIcon->show(); //Do an initial scan of the devices with dmesg qDebug() << "-Performing initial device scan"; scanInitialDevices(); //Startup the devd watching process qDebug() << "-Starting up the DEVD watcher"; devdTimer = new QTimer(); devdTimer->setSingleShot(TRUE); connect(devdTimer,SIGNAL(timeout()),this,SLOT(slotDevChanges())); startupDevdProc(); //Start up the filesystem watcher diskWatcher = new FSWatcher(); connect(diskWatcher,SIGNAL(FSWarning(QString,QString)),this,SLOT(slotDisplayWarning(QString,QString))); if(useDiskWatcher){ qDebug() << "-Starting up the disk space alert system"; diskWatcher->start(diskTimerMaxMS); } //Update the tray menu and icons updateMenu(); qDebug() << "-Program now ready for use"; QTimer::singleShot(500, this, SLOT(slotDoneWithInit()) ); //give it 1/2 a second to settle }