feat(short): support undo
This commit is contained in:
parent
1eb918beb0
commit
7592e048ce
6 changed files with 17 additions and 0 deletions
|
@ -73,6 +73,8 @@ bool ShortCut::eventFilter(QObject *obj, QEvent *e)
|
|||
emit refresh();
|
||||
} else if (keyEvent->key() == Qt::Key_H && keyEvent->modifiers() & Qt::ControlModifier) {
|
||||
emit showHidden();
|
||||
} else if (keyEvent->key() == Qt::Key_Z && keyEvent->modifiers() & Qt::ControlModifier) {
|
||||
emit undo();
|
||||
} else if (keyEvent->key() >= Qt::Key_A && keyEvent->key() <= Qt::Key_Z) {
|
||||
// Handle select
|
||||
// KeyboardSearchManager::self()->addKeys(keyEvent->text());
|
||||
|
|
|
@ -47,6 +47,7 @@ signals:
|
|||
void showHidden();
|
||||
void keyPressed(const QString &text);
|
||||
void close();
|
||||
void undo();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *e) override;
|
||||
|
|
|
@ -729,6 +729,13 @@ void FolderModel::refresh()
|
|||
m_dirModel->dirLister()->updateDirectory(m_dirModel->dirLister()->url());
|
||||
}
|
||||
|
||||
void FolderModel::undo()
|
||||
{
|
||||
if (KIO::FileUndoManager::self()->undoAvailable()) {
|
||||
KIO::FileUndoManager::self()->undo();
|
||||
}
|
||||
}
|
||||
|
||||
bool FolderModel::supportSetAsWallpaper(const QString &mimeType)
|
||||
{
|
||||
if (mimeType == "image/jpeg" || mimeType == "image/png")
|
||||
|
|
|
@ -166,6 +166,7 @@ public:
|
|||
Q_INVOKABLE void goBack();
|
||||
Q_INVOKABLE void goForward();
|
||||
Q_INVOKABLE void refresh();
|
||||
Q_INVOKABLE void undo();
|
||||
|
||||
Q_INVOKABLE bool supportSetAsWallpaper(const QString &mimeType);
|
||||
Q_INVOKABLE int fileExtensionBoundary(int row);
|
||||
|
|
|
@ -141,6 +141,9 @@ Item {
|
|||
onShowHidden: {
|
||||
dirModel.showHiddenFiles = !dirModel.showHiddenFiles
|
||||
}
|
||||
onUndo: {
|
||||
dirModel.undo()
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
|
|
|
@ -431,6 +431,9 @@ Item {
|
|||
onClose: {
|
||||
root.close()
|
||||
}
|
||||
onUndo: {
|
||||
dirModel.undo()
|
||||
}
|
||||
}
|
||||
|
||||
function openUrl(url) {
|
||||
|
|
Loading…
Reference in a new issue