diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp index 5e47e4c..b0d8373 100644 --- a/model/foldermodel.cpp +++ b/model/foldermodel.cpp @@ -825,8 +825,8 @@ void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifier const QModelIndexList indexes = m_selectionModel->selectedIndexes(); QMenu *menu = new QMenu; + // Open folder menu. if (indexes.isEmpty()) { - // Open folder menu. QAction *selectAll = new QAction(tr("Select All"), this); connect(selectAll, &QAction::triggered, this, &FolderModel::selectAll); @@ -838,6 +838,11 @@ void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifier menu->addSeparator(); menu->addAction(m_actionCollection.action("terminal")); } + + if (m_isDesktop) { + menu->addAction(m_actionCollection.action("changeBackground")); + } + menu->addSeparator(); menu->addAction(m_actionCollection.action("emptyTrash")); menu->addAction(m_actionCollection.action("properties")); @@ -912,6 +917,11 @@ void FolderModel::openInTerminal() KToolInvocation::invokeTerminal(QString(), url); } +void FolderModel::openChangeWallpaperDialog() +{ + QProcess::startDetached("cutefish-settings", QStringList() << "-m" << "background"); +} + void FolderModel::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { QModelIndexList indices = selected.indexes(); @@ -1065,6 +1075,9 @@ void FolderModel::createActions() QAction *properties = new QAction(tr("Properties"), this); QObject::connect(properties, &QAction::triggered, this, &FolderModel::openPropertiesDialog); + QAction *changeBackground = new QAction(tr("Change background"), this); + QObject::connect(changeBackground, &QAction::triggered, this, &FolderModel::openChangeWallpaperDialog); + m_actionCollection.addAction(QStringLiteral("open"), open); m_actionCollection.addAction(QStringLiteral("cut"), cut); m_actionCollection.addAction(QStringLiteral("copy"), copy); @@ -1077,6 +1090,7 @@ void FolderModel::createActions() m_actionCollection.addAction(QStringLiteral("terminal"), terminal); m_actionCollection.addAction(QStringLiteral("wallpaper"), wallpaper); m_actionCollection.addAction(QStringLiteral("properties"), properties); + m_actionCollection.addAction(QStringLiteral("changeBackground"), changeBackground); } void FolderModel::updateActions() diff --git a/model/foldermodel.h b/model/foldermodel.h index 9de7766..b479c9e 100644 --- a/model/foldermodel.h +++ b/model/foldermodel.h @@ -177,6 +177,7 @@ public: Q_INVOKABLE void openContextMenu(QQuickItem *visualParent = nullptr, Qt::KeyboardModifiers modifiers = Qt::NoModifier); Q_INVOKABLE void openPropertiesDialog(); Q_INVOKABLE void openInTerminal(); + Q_INVOKABLE void openChangeWallpaperDialog(); bool isDesktop() const; void setIsDesktop(bool isDesktop); diff --git a/translations/en_US.ts b/translations/en_US.ts new file mode 100644 index 0000000..6c6666c --- /dev/null +++ b/translations/en_US.ts @@ -0,0 +1,354 @@ + + + + + CreateFolderDialog + + + New folder name + + + + + New folder + + + + + Cancel + + + + + OK + + + + + DateHelper + + + Now + + + + + 1 minute ago + + + + + %1 minutes ago + + + + + 1 hour ago + + + + + %1 hours ago + + + + + 1 day ago + + + + + %1 days ago + + + + + DesktopView + + + Desktop + + + + + EmptyTrashDialog + + + File Manager + + + + + Do you want to permanently delete all files from the Trash? + + + + + Cancel + + + + + Empty Trash + + + + + FolderModel + + + %1 item + + + + + %1 items + + + + + Select All + + + + + Open + + + + + Cut + + + + + Copy + + + + + Paste + + + + + New Folder + + + + + Move To Trash + + + + + Empty Trash + + + + + Delete + + + + + Rename + + + + + Open in Terminal + + + + + Set as Wallpaper + + + + + Properties + + + + + Change background + + + + + FolderPage + + + Empty folder + + + + + Open + + + + + Properties + + + + + %1 item + + + + + %1 items + + + + + %1 selected + + + + + Empty Trash + + + + + OptionsMenu + + + Icons + + + + + List + + + + + Name + + + + + Date + + + + + Size + + + + + PlacesModel + + + Home + + + + + Desktop + + + + + Documents + + + + + Downloads + + + + + Music + + + + + Pictures + + + + + Videos + + + + + Trash + + + + + PropertiesDialog + + + Properties + + + + + Type: + + + + + Location: + + + + + Size: + + + + + Calculating... + + + + + Created: + + + + + Modified: + + + + + Accessed: + + + + + Cancel + + + + + OK + + + + + %1 files + + + + + main + + + File Manager + + + + diff --git a/translations/zh_CN.ts b/translations/zh_CN.ts index 64a6e97..da4a191 100644 --- a/translations/zh_CN.ts +++ b/translations/zh_CN.ts @@ -4,26 +4,64 @@ CreateFolderDialog - + New folder name 新文件夹名 - + New folder 新文件夹 - + Cancel 取消 - + OK 确定 + + DateHelper + + + Now + 现在 + + + + 1 minute ago + 一分钟前 + + + + %1 minutes ago + %1分钟前 + + + + 1 hour ago + 一小时前 + + + + %1 hours ago + %1小时前 + + + + 1 day ago + 一天前 + + + + %1 days ago + %1天前 + + DesktopView @@ -32,112 +70,178 @@ 桌面 + + EmptyTrashDialog + + + File Manager + 文件管理器 + + + + Do you want to permanently delete all files from the Trash? + 是否要从回收站中永久删除所有文件? + + + + Cancel + 取消 + + + + Empty Trash + 清空回收站 + + FolderModel - + %1 item %1 项 - + %1 items %1 项 - + Select All 全选 - + Open 打开 - + Cut 剪切 - + Copy 复制 - + Paste 粘贴 - + New Folder 新建文件夹 - + Move To Trash 移动到回收站 - + Empty Trash 清空回收站 - + Delete 删除 - + Rename 重命名 - + Open in Terminal 在终端中打开 - + Set as Wallpaper 设置为壁纸 - + Properties 属性 + + + Change background + 更改桌面背景 + FolderPage - + Empty folder 空文件夹 - + + Open + 打开 + + + + Properties + 属性 + + + %1 item %1 项 - + %1 items %1 项 - + %1 selected 选中了 %1 项 - + Empty Trash 清空回收站 + + OptionsMenu + + + Icons + 图标视图 + + + + List + 列表视图 + + + + Name + 名称 + + + + Date + 日期 + + + + Size + 大小 + + PlacesModel @@ -184,52 +288,52 @@ PropertiesDialog - + Properties 属性 - + Type: 类型: - + Location: 位置: - + Size: 大小: - + Calculating... 计算中... - + Created: 创建时间: - + Modified: 修改时间: - + Accessed: 访问时间: - + Cancel 取消 - + OK 确定 @@ -242,7 +346,7 @@ main - + File Manager 文件管理器