diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp
index d052262..55ea42c 100644
--- a/model/foldermodel.cpp
+++ b/model/foldermodel.cpp
@@ -1296,8 +1296,14 @@ void FolderModel::openDeleteDialog()
view->show();
}
-void FolderModel::openInNewWindow()
+void FolderModel::openInNewWindow(const QString &url)
{
+ if (!url.isEmpty()) {
+ QProcess::startDetached("cutefish-filemanager", QStringList() << url);
+ return;
+ }
+
+ // url 为空则打开已选择的 items.
if (!m_selectionModel->hasSelection())
return;
@@ -1642,7 +1648,7 @@ void FolderModel::createActions()
});
QAction *openInNewWindow = new QAction(tr("Open in new window"), this);
- QObject::connect(openInNewWindow, &QAction::triggered, this, &FolderModel::openInNewWindow);
+ QObject::connect(openInNewWindow, &QAction::triggered, this, [=] { this->openInNewWindow(); });
m_actionCollection.addAction(QStringLiteral("open"), open);
m_actionCollection.addAction(QStringLiteral("openWith"), openWith);
diff --git a/model/foldermodel.h b/model/foldermodel.h
index 8b0f4f2..7877075 100644
--- a/model/foldermodel.h
+++ b/model/foldermodel.h
@@ -207,7 +207,7 @@ public:
Q_INVOKABLE void openInTerminal();
Q_INVOKABLE void openChangeWallpaperDialog();
Q_INVOKABLE void openDeleteDialog();
- Q_INVOKABLE void openInNewWindow();
+ Q_INVOKABLE void openInNewWindow(const QString &url = QString());
Q_INVOKABLE void updateSelectedItemsSize();
Q_INVOKABLE void keyboardSearch(const QString &text);
diff --git a/qml/SideBar.qml b/qml/SideBar.qml
index d47419b..4d566ba 100644
--- a/qml/SideBar.qml
+++ b/qml/SideBar.qml
@@ -29,6 +29,7 @@ ListView {
id: sideBar
signal clicked(string path)
+ signal openInNewWindow(string path)
FishUI.WheelHandler {
target: sideBar
@@ -91,13 +92,40 @@ ListView {
id: _mouseArea
anchors.fill: parent
hoverEnabled: true
- acceptedButtons: Qt.LeftButton
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
- if (model.isDevice && model.setupNeeded)
- placesModel.requestSetup(index)
+ if (mouse.button === Qt.LeftButton) {
+ if (model.isDevice && model.setupNeeded)
+ placesModel.requestSetup(index)
- // sideBar.currentIndex = index
- sideBar.clicked(model.path ? model.path : model.url)
+ // sideBar.currentIndex = index
+ sideBar.clicked(model.path ? model.path : model.url)
+ } else if (mouse.button === Qt.RightButton) {
+ _menu.popup()
+ }
+ }
+ }
+
+ FishUI.DesktopMenu {
+ id: _menu
+
+ MenuItem {
+ text: qsTr("Open")
+
+ onTriggered: {
+ if (model.isDevice && model.setupNeeded)
+ placesModel.requestSetup(index)
+
+ sideBar.clicked(model.path ? model.path : model.url)
+ }
+ }
+
+ MenuItem {
+ text: qsTr("Open in new window")
+
+ onTriggered: {
+ sideBar.openInNewWindow(model.path ? model.path : model.url)
+ }
}
}
diff --git a/qml/main.qml b/qml/main.qml
index 5d32252..37e2a77 100644
--- a/qml/main.qml
+++ b/qml/main.qml
@@ -112,6 +112,7 @@ FishUI.Window {
Layout.fillHeight: true
width: 180 + FishUI.Units.largeSpacing
onClicked: _folderPage.openUrl(path)
+ onOpenInNewWindow: _folderPage.model.openInNewWindow(path)
}
FolderPage {
diff --git a/translations/en_US.ts b/translations/en_US.ts
index 0d21481..9f29909 100644
--- a/translations/en_US.ts
+++ b/translations/en_US.ts
@@ -96,17 +96,17 @@
File Manager
-
+
Do you want to permanently delete all files from the Trash?
-
+
Cancel
-
+
Empty Trash
@@ -127,112 +127,112 @@
FolderModel
-
+
%1 item
-
+
%1 items
-
+
The file or folder %1 does not exist.
-
+
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
-
+
@@ -245,13 +245,13 @@
Empty folder
-
+
Open
-
+
Properties
@@ -316,22 +316,22 @@
-
+
%1 item
-
+
%1 items
-
+
%1 selected
-
+
Empty Trash
@@ -339,22 +339,22 @@
OpenWithDialog
-
+
No applications
-
+
Set as default
-
+
Cancel
-
+
Open
@@ -494,6 +494,19 @@
OK
+
+ SideBar
+
+
+
+ Open
+
+
+
+
+
+
+
main
diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts
index 986549c..2912b6e 100644
--- a/translations/zh_CN.ts
+++ b/translations/zh_CN.ts
@@ -96,17 +96,17 @@
文件管理器
-
+
是否要从回收站中永久删除所有文件?
-
+
取消
-
+
清空回收站
@@ -127,112 +127,112 @@
FolderModel
-
+
%1 项
-
+
%1 项
-
+
文件或文件夹 %1 不存在
-
+
全选
-
+
文件管理器
-
+
打开
-
+
打开方式
-
+
剪切
-
+
复制
-
+
粘贴
-
+
新建文件夹
-
+
移动到回收站
-
+
清空回收站
-
+
删除
-
+
重命名
-
+
在终端中打开
-
+
设置为壁纸
-
+
属性
-
+
更改桌面背景
-
+
恢复
-
+
显示隐藏文件
-
+
在新窗口中打开
@@ -245,13 +245,13 @@
空文件夹
-
+
打开
-
+
属性
@@ -316,22 +316,22 @@
专为 CutefishOS 打造的文件管理器
-
+
%1 项
-
+
%1 项
-
+
选中了 %1 项
-
+
清空回收站
@@ -339,22 +339,22 @@
OpenWithDialog
-
+
没有应用程序
-
+
设置为默认
-
+
取消
-
+
打开
@@ -502,6 +502,19 @@
%1 项
+
+ SideBar
+
+
+
+ 打开
+
+
+
+
+ 在新窗口中打开
+
+
main