void FileBrowserWindow::itemDoubleClicked(const QModelIndex &) { // Check what kind of item has been double clicked and if it is a file, then // let people know about it being double clicked QString fileName = mFileBrowserWidget->currentPath(); QFileInfo fileInfo = fileName; if (fileInfo.isFile()) { // We are dealing with a file (as opposed to a folder), so let's see // whether we can let people know about it having been double clicked if (fileInfo.isSymLink()) { // The file is actually a symbolic link, so retrieve its target and // check that it exists, and if it does then let people know about // it having been double clicked fileName = fileInfo.symLinkTarget(); if (QFileInfo(fileName).exists()) emit filesOpened(QStringList() << fileName); } else { // This is a 'normal' file, so just go ahead and let people know // about it having been double clicked emit filesOpened(QStringList() << fileName); } } }
void FileOrganiserWidget::keyPressEvent(QKeyEvent *pEvent) { // Default handling of the event TreeViewWidget::keyPressEvent(pEvent); // Let people know about a key having been pressed with the view of opening // one or several files QStringList crtSelectedFiles = selectedFiles(); if ( crtSelectedFiles.count() #if defined(Q_OS_WIN) || defined(Q_OS_LINUX) && ( (pEvent->key() == Qt::Key_Enter) || (pEvent->key() == Qt::Key_Return)) #elif defined(Q_OS_MAC) && ( (pEvent->modifiers() & Qt::ControlModifier) && (pEvent->key() == Qt::Key_Down)) #else #error Unsupported platform #endif ) // There are some files that are selected and we want to open them, so // let people know about it emit filesOpened(crtSelectedFiles); }
void FileOrganiserWindow::itemDoubleClicked(const QModelIndex &itemIndex) { // Check what kind of item has been double clicked and if it is a file, then // let people know about it being double clicked QString fileName = mFileOrganiserWidget->filePath(itemIndex); if (!fileName.isEmpty()) // We are dealing with a file (as opposed to a folder), so let people // know about it having been double clicked emit filesOpened(QStringList() << fileName); }