void zoomWindow::openSaveDir(bool fav) { QSettings settings(savePath("settings.ini"), QSettings::IniFormat); QString path = settings.value("Save/path"+QString(fav ? "_favorites" : "")).toString().replace("\\", "/"), fn = settings.value("Save/filename"+QString(fav ? "_favorites" : "")).toString(); if (path.right(1) == "/") { path = path.left(path.length()-1); } path = QDir::toNativeSeparators(path); QStringList files = m_image->path(fn, path); QString file = files.empty() ? "" : files.at(0); QString pth = file.section(QDir::toNativeSeparators("/"), 0, -2); QString url = path+QDir::toNativeSeparators("/")+pth; QDir dir(url); if (dir.exists()) { showInGraphicalShell(url); } else { int reply = QMessageBox::question(this, tr("Dossier inexistant"), tr("Le dossier de sauvegarde n'existe pas encore. Le creer ?"), QMessageBox::Yes | QMessageBox::No); if (reply == QMessageBox::Yes) { QDir dir(path); if (!dir.mkpath(pth)) { error(this, tr("Erreur lors de la création du dossier.\r\n%1").arg(url)); } showInGraphicalShell(url); } } }
void SeafileTrayIcon::onMessageClicked() { if (repo_id_.isEmpty()) return; LocalRepo repo; if (seafApplet->rpcClient()->getLocalRepo(repo_id_, &repo) != 0 || !repo.isValid() || repo.worktree_invalid) return; showInGraphicalShell(repo.worktree); }
void FolderNavigationWidget::contextMenuEvent(QContextMenuEvent *ev) { QMenu menu; // Open current item const QModelIndex current = currentItem(); const bool hasCurrentItem = current.isValid(); QAction *actionOpen = menu.addAction(actionOpenText(m_fileSystemModel, current)); actionOpen->setEnabled(hasCurrentItem); // Explorer & teminal QAction *actionExplorer = menu.addAction(msgGraphicalShellAction()); actionExplorer->setEnabled(hasCurrentItem); QAction *actionTerminal = menu.addAction(msgTerminalAction()); actionTerminal->setEnabled(hasCurrentItem); // open with... if (!m_fileSystemModel->isDir(current)) { QMenu *openWith = menu.addMenu(tr("Open with")); ProjectExplorerPlugin::populateOpenWithMenu(openWith, m_fileSystemModel->filePath(current)); } // Open file dialog to choose a path starting from current QAction *actionChooseFolder = menu.addAction(tr("Choose folder...")); QAction *action = menu.exec(ev->globalPos()); if (!action) return; ev->accept(); if (action == actionOpen) { // Handle open file. openItem(current); return; } if (action == actionChooseFolder) { // Open file dialog const QString newPath = QFileDialog::getExistingDirectory(this, tr("Choose folder"), currentDirectory()); if (!newPath.isEmpty()) setCurrentDirectory(newPath); return; } if (action == actionTerminal) { openTerminal(m_fileSystemModel->filePath(current)); return; } if (action == actionExplorer) { showInGraphicalShell(this, m_fileSystemModel->filePath(current)); return; } ProjectExplorerPlugin::openEditorFromAction(action, m_fileSystemModel->filePath(current)); }