-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
143 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "UndoCommand.h" | ||
#include <QLoggingCategory> | ||
|
||
static Q_LOGGING_CATEGORY(log, "RabbitCommon.Browser.File.Undo") | ||
CNewFolder::CNewFolder(QString szPath) | ||
: QUndoCommand() | ||
, m_szPath(szPath) | ||
{} | ||
|
||
void CNewFolder::undo() | ||
{ | ||
bool bRet = false; | ||
QDir d(m_szPath); | ||
if(d.exists()) | ||
bRet = d.rmdir(m_szPath); | ||
qDebug(log) << "CNewFolder::undo()" << bRet << m_szPath; | ||
} | ||
|
||
void CNewFolder::redo() | ||
{ | ||
bool bRet = false; | ||
QDir d(m_szPath); | ||
if(!d.exists()) | ||
bRet = d.mkdir(m_szPath); | ||
setObsolete(!bRet); | ||
qDebug(log) << "CNewFolder::redo()" << bRet << m_szPath; | ||
} | ||
|
||
CDeleteFolder::CDeleteFolder(QString szPath) | ||
: QUndoCommand() | ||
, m_szPath(szPath) | ||
{} | ||
|
||
void CDeleteFolder::undo() | ||
{ | ||
bool bRet = false; | ||
QDir d(m_szPath); | ||
if(!d.exists()) | ||
bRet = d.mkdir(m_szPath); | ||
setObsolete(!bRet); | ||
qDebug(log) << "CDeleteFolder::undo()" << bRet << m_szPath; | ||
} | ||
|
||
void CDeleteFolder::redo() | ||
{ | ||
bool bRet = false; | ||
QDir d(m_szPath); | ||
if(d.exists()) | ||
bRet = d.rmdir(m_szPath); | ||
setObsolete(!bRet); | ||
qDebug(log) << "CDeleteFolder::redo()" << bRet << m_szPath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#ifndef UNDOCOMMAND_H | ||
#define UNDOCOMMAND_H | ||
|
||
#include <QUndoCommand> | ||
#include <QFileSystemModel> | ||
|
||
class CNewFolder : public QUndoCommand | ||
{ | ||
public: | ||
CNewFolder(QString szPath); | ||
public: | ||
virtual void undo() override; | ||
virtual void redo() override; | ||
private: | ||
QString m_szPath; | ||
}; | ||
|
||
class CDeleteFolder : public QUndoCommand | ||
{ | ||
public: | ||
CDeleteFolder(QString szPath); | ||
public: | ||
virtual void undo() override; | ||
virtual void redo() override; | ||
private: | ||
QString m_szPath; | ||
}; | ||
|
||
#endif // UNDOCOMMAND_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters