diff --git a/images/dark/add.svg b/images/dark/add.svg new file mode 100644 index 0000000..3bcd12d --- /dev/null +++ b/images/dark/add.svg @@ -0,0 +1,66 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/images/light/add.svg b/images/light/add.svg new file mode 100644 index 0000000..def3824 --- /dev/null +++ b/images/light/add.svg @@ -0,0 +1,66 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp index 3b05de1..217c653 100644 --- a/model/foldermodel.cpp +++ b/model/foldermodel.cpp @@ -1060,7 +1060,10 @@ void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifier menu->addAction(m_actionCollection.action("restore")); menu->addAction(m_actionCollection.action("open")); + menu->addAction(m_actionCollection.action("openInNewWindow")); + menu->addAction(m_actionCollection.action("openWith")); + menu->addSeparator(); menu->addAction(m_actionCollection.action("cut")); menu->addAction(m_actionCollection.action("copy")); menu->addAction(m_actionCollection.action("trash")); @@ -1156,6 +1159,19 @@ void FolderModel::openDeleteDialog() view->show(); } +void FolderModel::openInNewWindow() +{ + if (!m_selectionModel->hasSelection()) + return; + + for (const QModelIndex &index : m_selectionModel->selectedIndexes()) { + KFileItem item = itemForIndex(index); + if (item.isDir()) { + QProcess::startDetached("cutefish-filemanager", QStringList() << item.url().toLocalFile()); + } + } +} + void FolderModel::updateSelectedItemsSize() { } @@ -1483,6 +1499,9 @@ void FolderModel::createActions() setShowHiddenFiles(!m_showHiddenFiles); }); + QAction *openInNewWindow = new QAction(tr("Open in new window"), this); + QObject::connect(openInNewWindow, &QAction::triggered, this, &FolderModel::openInNewWindow); + m_actionCollection.addAction(QStringLiteral("open"), open); m_actionCollection.addAction(QStringLiteral("openWith"), openWith); m_actionCollection.addAction(QStringLiteral("cut"), cut); @@ -1499,6 +1518,7 @@ void FolderModel::createActions() m_actionCollection.addAction(QStringLiteral("changeBackground"), changeBackground); m_actionCollection.addAction(QStringLiteral("restore"), restore); m_actionCollection.addAction(QStringLiteral("showHidden"), showHidden); + m_actionCollection.addAction(QStringLiteral("openInNewWindow"), openInNewWindow); } void FolderModel::updateActions() @@ -1509,6 +1529,7 @@ void FolderModel::updateActions() QList urls; bool hasRemoteFiles = false; bool isTrashLink = false; + bool hasDir = false; const bool isTrash = (resolvedUrl().scheme() == QLatin1String("trash")); if (indexes.isEmpty()) { @@ -1523,6 +1544,9 @@ void FolderModel::updateActions() items.append(item); urls.append(item.url()); } + + if (item.isDir()) + hasDir = true; } } @@ -1609,6 +1633,10 @@ void FolderModel::updateActions() showHidden->setCheckable(true); showHidden->setChecked(m_showHiddenFiles); } + + if (QAction *openInNewWindow = m_actionCollection.action("openInNewWindow")) { + openInNewWindow->setVisible(hasDir); + } } void FolderModel::addDragImage(QDrag *drag, int x, int y) diff --git a/model/foldermodel.h b/model/foldermodel.h index 2584c47..9750c3e 100644 --- a/model/foldermodel.h +++ b/model/foldermodel.h @@ -204,6 +204,7 @@ public: Q_INVOKABLE void openInTerminal(); Q_INVOKABLE void openChangeWallpaperDialog(); Q_INVOKABLE void openDeleteDialog(); + Q_INVOKABLE void openInNewWindow(); Q_INVOKABLE void updateSelectedItemsSize(); Q_INVOKABLE void keyboardSearch(const QString &text); diff --git a/translations/en_US.ts b/translations/en_US.ts index e4043f8..18bdda1 100644 --- a/translations/en_US.ts +++ b/translations/en_US.ts @@ -83,7 +83,7 @@ DesktopView - + Desktop Desktop @@ -114,12 +114,12 @@ FilePropertiesDialog - + Properties Properties - + %1 files %1 files @@ -137,100 +137,105 @@ %1 items - + The file or folder %1 does not exist. The file or folder %1 does not exist. - + Select All Select All - + File Manager File Manager - + Open Open - + Open with Open with - + Cut Cut - + Copy Copy - + Paste Paste - + New Folder New Folder - + Move To Trash Move To Trash - + Empty Trash Empty Trash - + Delete Delete - + Rename Rename - + Open in Terminal Open in Terminal - + Set as Wallpaper Set as Wallpaper - + Properties Properties - + Change background Change background - + Restore Restore - + Show hidden files Show hidden files + + + Open in new window + + FolderPage @@ -434,47 +439,47 @@ PropertiesDialog - + Type: Type: - + Location: Location: - + Size: Size: - + Calculating... Calculating... - + Created: Created: - + Modified: Modified: - + Accessed: Accessed: - + Cancel Cancel - + OK OK diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 80e6a22..443259e 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -83,7 +83,7 @@ DesktopView - + Desktop 桌面 @@ -114,12 +114,12 @@ FilePropertiesDialog - + Properties 属性 - + %1 files %1 项 @@ -137,100 +137,105 @@ %1 项 - + The file or folder %1 does not exist. 文件或文件夹 %1 不存在 - + Select All 全选 - + File Manager 文件管理器 - + Open 打开 - + Open with 打开方式 - + Cut 剪切 - + Copy 复制 - + Paste 粘贴 - + New Folder 新建文件夹 - + Move To Trash 移动到回收站 - + Empty Trash 清空回收站 - + Delete 删除 - + Rename 重命名 - + Open in Terminal 在终端中打开 - + Set as Wallpaper 设置为壁纸 - + Properties 属性 - + Change background 更改桌面背景 - + Restore 恢复 - + Show hidden files 显示隐藏文件 + + + Open in new window + 在新窗口中打开 + FolderPage @@ -438,47 +443,47 @@ 属性 - + Type: 类型: - + Location: 位置: - + Size: 大小: - + Calculating... 计算中... - + Created: 创建时间: - + Modified: 修改时间: - + Accessed: 访问时间: - + Cancel 取消 - + OK 确定