//----------------------------------------------- void KFileDnDDetailView::useAutoOpenTimer( bool use ){ m_useAutoOpenTimer = use; if( use ) connect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) ); else { disconnect( &m_autoOpenTimer, SIGNAL( timeout() ),this, SLOT( slotOpenFolder() ) ); m_dropItem = 0L; m_autoOpenTimer.stop(); } }
void ArchiveMailWidget::customContextMenuRequested(const QPoint&) { const QList<QTreeWidgetItem *> listItems = mWidget->treeWidget->selectedItems(); KMenu menu; menu.addAction(i18n("Add..."),this,SLOT(slotAddItem())); if( !listItems.isEmpty() ) { if( listItems.count() == 1) { menu.addAction(i18n("Open Containing Folder..."),this,SLOT(slotOpenFolder())); } menu.addSeparator(); menu.addAction(i18n("Delete"),this,SLOT(slotRemoveItem())); } menu.exec(QCursor::pos()); }
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 ) ; } }