void MainWindow::volumeProperties() { this->disableAll() ; Task * t = new Task() ; t->setDevice( m_ui->tableWidget->item( m_ui->tableWidget->currentRow(),0 )->text() ) ; connect( t,SIGNAL( signalProperties( QString ) ),this,SLOT( volumeProperties( QString ) ) ) ; t->start( Task::VolumeProperties ) ; }
void MainWindow::showContextMenu( QTableWidgetItem * item,bool itemClicked ) { QMenu m ; m.setFont( this->font() ) ; int row = item->row() ; QString mt = m_ui->tableWidget->item( row,1 )->text() ; QString device = m_ui->tableWidget->item( row,0 )->text() ; if( mt == "Nil" ){ connect( m.addAction( tr( "Mount" ) ),SIGNAL( triggered() ),this,SLOT( slotMount() ) ) ; }else{ QString mp = QString( "/run/media/private/%1/" ).arg( utility::userName() ) ; QString mp_1 = QString( "/home/%1/" ).arg( utility::userName() ) ; if( mt.startsWith( mp ) || mt.startsWith( mp_1 ) ){ connect( m.addAction( tr( "Unmount" ) ),SIGNAL( triggered() ),this,SLOT( pbUmount() ) ) ; m.addSeparator() ; QString fs = m_ui->tableWidget->item( row,2 )->text() ; if( fs != "encfs" ){ connect( m.addAction( tr( "Properties" ) ),SIGNAL( triggered() ),this,SLOT( volumeProperties() ) ) ; m.addSeparator() ; } m_sharedFolderPath = utility::sharedMountPointPath( mt ) ; if( m_sharedFolderPath.isEmpty() ){ connect( m.addAction( tr( "Open Folder" ) ),SIGNAL( triggered() ), this,SLOT( slotOpenFolder() ) ) ; }else{ connect( m.addAction( tr( "Open Private Folder" ) ),SIGNAL( triggered() ), this,SLOT( slotOpenFolder() ) ) ; connect( m.addAction( tr( "Open Shared Folder" ) ),SIGNAL( triggered() ), this,SLOT( slotOpenSharedFolder() ) ) ; } }else{ m_sharedFolderPath = utility::sharedMountPointPath( mt ) ; if( m_sharedFolderPath.isEmpty() ){ if( utility::pathIsReadable( mt ) ){ connect( m.addAction( tr( "Properties" ) ),SIGNAL( triggered() ),this,SLOT( volumeProperties() ) ) ; m.addSeparator() ; connect( m.addAction( tr( "Open Folder" ) ),SIGNAL( triggered() ), this,SLOT( slotOpenFolder() ) ) ; }else{ connect( m.addAction( tr( "Properties" ) ),SIGNAL( triggered() ),this,SLOT( volumeProperties() ) ) ; } }else{ connect( m.addAction( tr( "Properties" ) ),SIGNAL( triggered() ),this,SLOT( volumeProperties() ) ) ; m.addSeparator() ; connect( m.addAction( tr( "Open Shared Folder" ) ),SIGNAL( triggered() ), this,SLOT( slotOpenSharedFolder() ) ) ; } } } m.addSeparator() ; m.addAction( tr( "Close Menu" ) ) ; if( itemClicked ){ m.exec( QCursor::pos() ) ; }else{ QPoint p = this->pos() ; int x = p.x() + 100 + m_ui->tableWidget->columnWidth( 0 ) ; int y = p.y() + 50 + m_ui->tableWidget->rowHeight( 0 ) * item->row() ; p.setX( x ) ; p.setY( y ) ; m.exec( p ) ; } }