Add change background option to Desktop Menu

This commit is contained in:
revenmartin 2021-05-25 19:56:55 +08:00
parent 13004d0793
commit 30c43607b0
4 changed files with 509 additions and 36 deletions

View file

@ -825,8 +825,8 @@ void FolderModel::openContextMenu(QQuickItem *visualParent, Qt::KeyboardModifier
const QModelIndexList indexes = m_selectionModel->selectedIndexes();
QMenu *menu = new QMenu;
if (indexes.isEmpty()) {
// Open folder menu.
if (indexes.isEmpty()) {
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()

View file

@ -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);

354
translations/en_US.ts Normal file
View file

@ -0,0 +1,354 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>CreateFolderDialog</name>
<message>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="29"/>
<source>New folder name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="57"/>
<source>New folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="72"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="78"/>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DateHelper</name>
<message>
<location filename="../helper/datehelper.cpp" line="15"/>
<source>Now</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="17"/>
<source>1 minute ago</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="19"/>
<source>%1 minutes ago</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="23"/>
<source>1 hour ago</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="25"/>
<source>%1 hours ago</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="29"/>
<source>1 day ago</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="31"/>
<source>%1 days ago</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DesktopView</name>
<message>
<location filename="../desktop/desktopview.cpp" line="44"/>
<source>Desktop</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EmptyTrashDialog</name>
<message>
<location filename="../qml/Dialogs/EmptyTrashDialog.qml" line="30"/>
<source>File Manager</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/EmptyTrashDialog.qml" line="60"/>
<source>Do you want to permanently delete all files from the Trash?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/EmptyTrashDialog.qml" line="69"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/EmptyTrashDialog.qml" line="75"/>
<source>Empty Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FolderModel</name>
<message>
<location filename="../model/foldermodel.cpp" line="166"/>
<source>%1 item</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="166"/>
<source>%1 items</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="830"/>
<source>Select All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1042"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1045"/>
<source>Cut</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1048"/>
<source>Copy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1051"/>
<source>Paste</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1054"/>
<source>New Folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1057"/>
<source>Move To Trash</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1060"/>
<source>Empty Trash</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1063"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1066"/>
<source>Rename</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1069"/>
<source>Open in Terminal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1072"/>
<source>Set as Wallpaper</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1075"/>
<source>Properties</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1078"/>
<source>Change background</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FolderPage</name>
<message>
<location filename="../qml/FolderPage.qml" line="54"/>
<source>Empty folder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="85"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="90"/>
<source>Properties</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="146"/>
<source>%1 item</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="147"/>
<source>%1 items</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="153"/>
<source>%1 selected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="164"/>
<source>Empty Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>OptionsMenu</name>
<message>
<location filename="../qml/OptionsMenu.qml" line="45"/>
<source>Icons</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/OptionsMenu.qml" line="79"/>
<source>List</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/OptionsMenu.qml" line="115"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/OptionsMenu.qml" line="149"/>
<source>Date</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/OptionsMenu.qml" line="183"/>
<source>Size</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PlacesModel</name>
<message>
<location filename="../model/placesmodel.cpp" line="39"/>
<source>Home</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/placesmodel.cpp" line="46"/>
<source>Desktop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/placesmodel.cpp" line="53"/>
<source>Documents</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/placesmodel.cpp" line="60"/>
<source>Downloads</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/placesmodel.cpp" line="67"/>
<source>Music</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/placesmodel.cpp" line="74"/>
<source>Pictures</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/placesmodel.cpp" line="81"/>
<source>Videos</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../model/placesmodel.cpp" line="86"/>
<source>Trash</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PropertiesDialog</name>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="28"/>
<source>Properties</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="103"/>
<source>Type:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="116"/>
<source>Location:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="127"/>
<source>Size:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="135"/>
<source>Calculating...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="140"/>
<source>Created:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="153"/>
<source>Modified:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="166"/>
<source>Accessed:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="188"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="197"/>
<source>OK</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../dialogs/propertiesdialog.cpp" line="209"/>
<source>%1 files</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../qml/main.qml" line="35"/>
<source>File Manager</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>

View file

@ -4,26 +4,64 @@
<context>
<name>CreateFolderDialog</name>
<message>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="10"/>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="29"/>
<source>New folder name</source>
<translation></translation>
</message>
<message>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="38"/>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="57"/>
<source>New folder</source>
<translation></translation>
</message>
<message>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="48"/>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="72"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="54"/>
<location filename="../qml/Dialogs/CreateFolderDialog.qml" line="78"/>
<source>OK</source>
<translation></translation>
</message>
</context>
<context>
<name>DateHelper</name>
<message>
<location filename="../helper/datehelper.cpp" line="15"/>
<source>Now</source>
<translation></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="17"/>
<source>1 minute ago</source>
<translation></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="19"/>
<source>%1 minutes ago</source>
<translation>%1</translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="23"/>
<source>1 hour ago</source>
<translation></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="25"/>
<source>%1 hours ago</source>
<translation>%1</translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="29"/>
<source>1 day ago</source>
<translation></translation>
</message>
<message>
<location filename="../helper/datehelper.cpp" line="31"/>
<source>%1 days ago</source>
<translation>%1</translation>
</message>
</context>
<context>
<name>DesktopView</name>
<message>
@ -32,112 +70,178 @@
<translation></translation>
</message>
</context>
<context>
<name>EmptyTrashDialog</name>
<message>
<location filename="../qml/Dialogs/EmptyTrashDialog.qml" line="30"/>
<source>File Manager</source>
<translation></translation>
</message>
<message>
<location filename="../qml/Dialogs/EmptyTrashDialog.qml" line="60"/>
<source>Do you want to permanently delete all files from the Trash?</source>
<translation></translation>
</message>
<message>
<location filename="../qml/Dialogs/EmptyTrashDialog.qml" line="69"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../qml/Dialogs/EmptyTrashDialog.qml" line="75"/>
<source>Empty Trash</source>
<translation></translation>
</message>
</context>
<context>
<name>FolderModel</name>
<message>
<location filename="../model/foldermodel.cpp" line="139"/>
<location filename="../model/foldermodel.cpp" line="166"/>
<source>%1 item</source>
<translation>%1 </translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="139"/>
<location filename="../model/foldermodel.cpp" line="166"/>
<source>%1 items</source>
<translation>%1 </translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="807"/>
<location filename="../model/foldermodel.cpp" line="830"/>
<source>Select All</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1009"/>
<location filename="../model/foldermodel.cpp" line="1042"/>
<source>Open</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1012"/>
<location filename="../model/foldermodel.cpp" line="1045"/>
<source>Cut</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1015"/>
<location filename="../model/foldermodel.cpp" line="1048"/>
<source>Copy</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1018"/>
<location filename="../model/foldermodel.cpp" line="1051"/>
<source>Paste</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1021"/>
<location filename="../model/foldermodel.cpp" line="1054"/>
<source>New Folder</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1024"/>
<location filename="../model/foldermodel.cpp" line="1057"/>
<source>Move To Trash</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1027"/>
<location filename="../model/foldermodel.cpp" line="1060"/>
<source>Empty Trash</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1030"/>
<location filename="../model/foldermodel.cpp" line="1063"/>
<source>Delete</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1033"/>
<location filename="../model/foldermodel.cpp" line="1066"/>
<source>Rename</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1036"/>
<location filename="../model/foldermodel.cpp" line="1069"/>
<source>Open in Terminal</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1039"/>
<location filename="../model/foldermodel.cpp" line="1072"/>
<source>Set as Wallpaper</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1042"/>
<location filename="../model/foldermodel.cpp" line="1075"/>
<source>Properties</source>
<translation></translation>
</message>
<message>
<location filename="../model/foldermodel.cpp" line="1078"/>
<source>Change background</source>
<translation></translation>
</message>
</context>
<context>
<name>FolderPage</name>
<message>
<location filename="../qml/FolderPage.qml" line="34"/>
<location filename="../qml/FolderPage.qml" line="54"/>
<source>Empty folder</source>
<translation></translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="106"/>
<location filename="../qml/FolderPage.qml" line="85"/>
<source>Open</source>
<translation></translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="90"/>
<source>Properties</source>
<translation></translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="146"/>
<source>%1 item</source>
<translation>%1 </translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="107"/>
<location filename="../qml/FolderPage.qml" line="147"/>
<source>%1 items</source>
<translation>%1 </translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="112"/>
<location filename="../qml/FolderPage.qml" line="153"/>
<source>%1 selected</source>
<translation> %1 </translation>
</message>
<message>
<location filename="../qml/FolderPage.qml" line="123"/>
<location filename="../qml/FolderPage.qml" line="164"/>
<source>Empty Trash</source>
<translation></translation>
</message>
</context>
<context>
<name>OptionsMenu</name>
<message>
<location filename="../qml/OptionsMenu.qml" line="45"/>
<source>Icons</source>
<translation></translation>
</message>
<message>
<location filename="../qml/OptionsMenu.qml" line="79"/>
<source>List</source>
<translation></translation>
</message>
<message>
<location filename="../qml/OptionsMenu.qml" line="115"/>
<source>Name</source>
<translation></translation>
</message>
<message>
<location filename="../qml/OptionsMenu.qml" line="149"/>
<source>Date</source>
<translation></translation>
</message>
<message>
<location filename="../qml/OptionsMenu.qml" line="183"/>
<source>Size</source>
<translation></translation>
</message>
</context>
<context>
<name>PlacesModel</name>
<message>
@ -184,52 +288,52 @@
<context>
<name>PropertiesDialog</name>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="9"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="28"/>
<source>Properties</source>
<translation></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="84"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="103"/>
<source>Type:</source>
<translation>:</translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="97"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="116"/>
<source>Location:</source>
<translation>:</translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="108"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="127"/>
<source>Size:</source>
<translation>:</translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="116"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="135"/>
<source>Calculating...</source>
<translation>...</translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="121"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="140"/>
<source>Created:</source>
<translation>:</translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="134"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="153"/>
<source>Modified:</source>
<translation>:</translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="147"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="166"/>
<source>Accessed:</source>
<translation>访:</translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="169"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="188"/>
<source>Cancel</source>
<translation></translation>
</message>
<message>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="178"/>
<location filename="../qml/Dialogs/PropertiesDialog.qml" line="197"/>
<source>OK</source>
<translation></translation>
</message>
@ -242,7 +346,7 @@
<context>
<name>main</name>
<message>
<location filename="../qml/main.qml" line="16"/>
<location filename="../qml/main.qml" line="35"/>
<source>File Manager</source>
<translation></translation>
</message>