Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Fix a bug with the mounttray popup notification happening more often …
Browse files Browse the repository at this point in the history
…than necessary
  • Loading branch information
Ken Moore committed Aug 5, 2013
1 parent 92c27ca commit fd5dfb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src-qt4/pc-mounttray/mountTray.cpp
Expand Up @@ -119,13 +119,13 @@ int MountTray::findDeviceInList(QString newDev){
return -1;
}

void MountTray::addDevice(QString dev, QString label, QString type, QString filesys){
bool MountTray::addDevice(QString dev, QString label, QString type, QString filesys){
if(!dev.startsWith(DEVICEDIR)){ dev.prepend(DEVICEDIR); }

//Check if the device is already in the list
int tot=0;
for(int i=0; i<deviceList.length(); i++){
if( deviceList[i]->device == dev ){ return; } //already exists, do nothing
if( deviceList[i]->device == dev ){ return false; } //already exists, do nothing
if( deviceList[i]->getDeviceName().startsWith(label) ){ tot++; }
}
//See if the label is unique as well, otherwise add a number to the end to make it unique
Expand All @@ -141,6 +141,7 @@ void MountTray::addDevice(QString dev, QString label, QString type, QString file
deviceList << tmp;
//Update the menu
updateMenu();
return true;
}

void MountTray::removeDevice(QString dev){
Expand Down Expand Up @@ -219,9 +220,9 @@ void MountTray::slotDevChanges(bool showPopup){
bool good = DCheck->devInfo(nsd[i],&dtype,&dlabel,&dfs,&dsize);
if(good){
//Now create a new entry for this device
addDevice(nsd[i],dlabel,dtype,dfs);
bool added = addDevice(nsd[i],dlabel,dtype,dfs);
//Show a message bubble
if(showPopup){
if(showPopup && added){ //make sure this is not shown for previously added devices
QString title = tr("New Device");
QString message = QString( tr("%1 can now be accessed")).arg(dlabel);
slotDisplayPopup(title, message);
Expand Down
2 changes: 1 addition & 1 deletion src-qt4/pc-mounttray/mountTray.h
Expand Up @@ -73,7 +73,7 @@ private slots:
void updateMenu();
void scanInitialDevices();
int findDeviceInList(QString);
void addDevice(QString,QString,QString,QString);
bool addDevice(QString,QString,QString,QString);
void startupDevdProc();
void getInitialUsername();
void getDefaultFileManager();
Expand Down

0 comments on commit fd5dfb8

Please sign in to comment.