mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
refactor VDirInfoDialog and VNewDirDialog
This commit is contained in:
parent
59d0e82e66
commit
3daa463a6d
@ -1,16 +1,23 @@
|
|||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include "vdirinfodialog.h"
|
#include "vdirinfodialog.h"
|
||||||
|
#include "vdirectory.h"
|
||||||
|
#include "vconfigmanager.h"
|
||||||
|
|
||||||
VDirInfoDialog::VDirInfoDialog(const QString &title, const QString &info,
|
extern VConfigManager *g_config;
|
||||||
const QString &defaultName,
|
|
||||||
|
VDirInfoDialog::VDirInfoDialog(const QString &title,
|
||||||
|
const QString &info,
|
||||||
|
const VDirectory *directory,
|
||||||
|
VDirectory *parentDirectory,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: QDialog(parent), infoLabel(NULL), title(title), info(info), defaultName(defaultName)
|
: QDialog(parent), infoLabel(NULL), title(title), info(info),
|
||||||
|
m_directory(directory), m_parentDirectory(parentDirectory)
|
||||||
{
|
{
|
||||||
setupUI();
|
setupUI();
|
||||||
|
|
||||||
connect(nameEdit, &QLineEdit::textChanged, this, &VDirInfoDialog::enableOkButton);
|
connect(nameEdit, &QLineEdit::textChanged, this, &VDirInfoDialog::handleInputChanged);
|
||||||
|
|
||||||
enableOkButton();
|
handleInputChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDirInfoDialog::setupUI()
|
void VDirInfoDialog::setupUI()
|
||||||
@ -19,10 +26,14 @@ void VDirInfoDialog::setupUI()
|
|||||||
infoLabel = new QLabel(info);
|
infoLabel = new QLabel(info);
|
||||||
}
|
}
|
||||||
nameLabel = new QLabel(tr("Folder &name:"));
|
nameLabel = new QLabel(tr("Folder &name:"));
|
||||||
nameEdit = new QLineEdit(defaultName);
|
nameEdit = new QLineEdit(m_directory->getName());
|
||||||
nameEdit->selectAll();
|
nameEdit->selectAll();
|
||||||
nameLabel->setBuddy(nameEdit);
|
nameLabel->setBuddy(nameEdit);
|
||||||
|
|
||||||
|
m_warnLabel = new QLabel();
|
||||||
|
m_warnLabel->setWordWrap(true);
|
||||||
|
m_warnLabel->hide();
|
||||||
|
|
||||||
// Ok is the default button.
|
// Ok is the default button.
|
||||||
m_btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
m_btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
connect(m_btnBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
connect(m_btnBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
@ -40,6 +51,7 @@ void VDirInfoDialog::setupUI()
|
|||||||
mainLayout->addWidget(infoLabel);
|
mainLayout->addWidget(infoLabel);
|
||||||
}
|
}
|
||||||
mainLayout->addLayout(topLayout);
|
mainLayout->addLayout(topLayout);
|
||||||
|
mainLayout->addWidget(m_warnLabel);
|
||||||
mainLayout->addWidget(m_btnBox);
|
mainLayout->addWidget(m_btnBox);
|
||||||
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
|
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
@ -47,10 +59,28 @@ void VDirInfoDialog::setupUI()
|
|||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDirInfoDialog::enableOkButton()
|
void VDirInfoDialog::handleInputChanged()
|
||||||
{
|
{
|
||||||
|
bool showWarnLabel = false;
|
||||||
|
QString name = nameEdit->text();
|
||||||
|
bool nameOk = !name.isEmpty();
|
||||||
|
if (nameOk && name != m_directory->getName()) {
|
||||||
|
// Check if the name conflicts with existing directory name.
|
||||||
|
// Case-insensitive when creating note.
|
||||||
|
if (m_parentDirectory->findSubDirectory(name, false)) {
|
||||||
|
nameOk = false;
|
||||||
|
showWarnLabel = true;
|
||||||
|
QString nameConflictText = tr("<span style=\"%1\">WARNING</span>: Name (case-insensitive) already exists. "
|
||||||
|
"Please choose another name.")
|
||||||
|
.arg(g_config->c_warningTextStyle);
|
||||||
|
m_warnLabel->setText(nameConflictText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_warnLabel->setVisible(showWarnLabel);
|
||||||
|
|
||||||
QPushButton *okBtn = m_btnBox->button(QDialogButtonBox::Ok);
|
QPushButton *okBtn = m_btnBox->button(QDialogButtonBox::Ok);
|
||||||
okBtn->setEnabled(!nameEdit->text().isEmpty());
|
okBtn->setEnabled(nameOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VDirInfoDialog::getNameInput() const
|
QString VDirInfoDialog::getNameInput() const
|
||||||
|
@ -7,17 +7,22 @@ class QLabel;
|
|||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QDialogButtonBox;
|
class QDialogButtonBox;
|
||||||
class QString;
|
class QString;
|
||||||
|
class VDirectory;
|
||||||
|
|
||||||
class VDirInfoDialog : public QDialog
|
class VDirInfoDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VDirInfoDialog(const QString &title, const QString &info, const QString &defaultName,
|
VDirInfoDialog(const QString &title,
|
||||||
|
const QString &info,
|
||||||
|
const VDirectory *directory,
|
||||||
|
VDirectory *parentDirectory,
|
||||||
QWidget *parent = 0);
|
QWidget *parent = 0);
|
||||||
|
|
||||||
QString getNameInput() const;
|
QString getNameInput() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void enableOkButton();
|
void handleInputChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupUI();
|
void setupUI();
|
||||||
@ -25,10 +30,13 @@ private:
|
|||||||
QLabel *infoLabel;
|
QLabel *infoLabel;
|
||||||
QLabel *nameLabel;
|
QLabel *nameLabel;
|
||||||
QLineEdit *nameEdit;
|
QLineEdit *nameEdit;
|
||||||
|
QLabel *m_warnLabel;
|
||||||
QDialogButtonBox *m_btnBox;
|
QDialogButtonBox *m_btnBox;
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
QString info;
|
QString info;
|
||||||
QString defaultName;
|
|
||||||
|
VDirectory *m_parentDirectory;
|
||||||
|
const VDirectory *m_directory;
|
||||||
};
|
};
|
||||||
#endif // VDIRINFODIALOG_H
|
#endif // VDIRINFODIALOG_H
|
||||||
|
@ -65,7 +65,7 @@ void VFileInfoDialog::handleInputChanged()
|
|||||||
QString name = nameEdit->text();
|
QString name = nameEdit->text();
|
||||||
bool nameOk = !name.isEmpty();
|
bool nameOk = !name.isEmpty();
|
||||||
if (nameOk && name != m_file->getName()) {
|
if (nameOk && name != m_file->getName()) {
|
||||||
// Check if the name conflicts with existing notebook name.
|
// Check if the name conflicts with existing note name.
|
||||||
// Case-insensitive when creating note.
|
// Case-insensitive when creating note.
|
||||||
if (m_directory->findFile(name, false)) {
|
if (m_directory->findFile(name, false)) {
|
||||||
nameOk = false;
|
nameOk = false;
|
||||||
|
@ -1,13 +1,23 @@
|
|||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
#include "vnewdirdialog.h"
|
#include "vnewdirdialog.h"
|
||||||
|
#include "vdirectory.h"
|
||||||
|
#include "vconfigmanager.h"
|
||||||
|
|
||||||
VNewDirDialog::VNewDirDialog(const QString &title, const QString &info, const QString &name, const QString &defaultName,
|
extern VConfigManager *g_config;
|
||||||
|
|
||||||
|
VNewDirDialog::VNewDirDialog(const QString &title,
|
||||||
|
const QString &info,
|
||||||
|
const QString &defaultName,
|
||||||
|
VDirectory *directory,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: QDialog(parent), title(title), info(info), name(name), defaultName(defaultName)
|
: QDialog(parent), title(title), info(info), defaultName(defaultName),
|
||||||
|
m_directory(directory)
|
||||||
{
|
{
|
||||||
setupUI();
|
setupUI();
|
||||||
|
|
||||||
connect(nameEdit, &QLineEdit::textChanged, this, &VNewDirDialog::enableOkButton);
|
connect(nameEdit, &QLineEdit::textChanged, this, &VNewDirDialog::handleInputChanged);
|
||||||
|
|
||||||
|
handleInputChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNewDirDialog::setupUI()
|
void VNewDirDialog::setupUI()
|
||||||
@ -18,11 +28,15 @@ void VNewDirDialog::setupUI()
|
|||||||
infoLabel->setWordWrap(true);
|
infoLabel->setWordWrap(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
nameLabel = new QLabel(name);
|
QLabel *nameLabel = new QLabel("Folder &name:");
|
||||||
nameEdit = new QLineEdit(defaultName);
|
nameEdit = new QLineEdit(defaultName);
|
||||||
nameEdit->selectAll();
|
nameEdit->selectAll();
|
||||||
nameLabel->setBuddy(nameEdit);
|
nameLabel->setBuddy(nameEdit);
|
||||||
|
|
||||||
|
m_warnLabel = new QLabel();
|
||||||
|
m_warnLabel->setWordWrap(true);
|
||||||
|
m_warnLabel->hide();
|
||||||
|
|
||||||
// Ok is the default button.
|
// Ok is the default button.
|
||||||
m_btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
m_btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
connect(m_btnBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
connect(m_btnBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
@ -40,16 +54,35 @@ void VNewDirDialog::setupUI()
|
|||||||
mainLayout->addWidget(infoLabel);
|
mainLayout->addWidget(infoLabel);
|
||||||
}
|
}
|
||||||
mainLayout->addLayout(topLayout);
|
mainLayout->addLayout(topLayout);
|
||||||
|
mainLayout->addWidget(m_warnLabel);
|
||||||
mainLayout->addWidget(m_btnBox);
|
mainLayout->addWidget(m_btnBox);
|
||||||
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
|
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNewDirDialog::enableOkButton(const QString &editText)
|
void VNewDirDialog::handleInputChanged()
|
||||||
{
|
{
|
||||||
|
bool showWarnLabel = false;
|
||||||
|
QString name = nameEdit->text();
|
||||||
|
bool nameOk = !name.isEmpty();
|
||||||
|
if (nameOk) {
|
||||||
|
// Check if the name conflicts with existing directory name.
|
||||||
|
// Case-insensitive when creating folder.
|
||||||
|
if (m_directory->findSubDirectory(name, false)) {
|
||||||
|
nameOk = false;
|
||||||
|
showWarnLabel = true;
|
||||||
|
QString nameConflictText = tr("<span style=\"%1\">WARNING</span>: Name (case-insensitive) already exists. "
|
||||||
|
"Please choose another name.")
|
||||||
|
.arg(g_config->c_warningTextStyle);
|
||||||
|
m_warnLabel->setText(nameConflictText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_warnLabel->setVisible(showWarnLabel);
|
||||||
|
|
||||||
QPushButton *okBtn = m_btnBox->button(QDialogButtonBox::Ok);
|
QPushButton *okBtn = m_btnBox->button(QDialogButtonBox::Ok);
|
||||||
okBtn->setEnabled(!editText.isEmpty());
|
okBtn->setEnabled(nameOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VNewDirDialog::getNameInput() const
|
QString VNewDirDialog::getNameInput() const
|
||||||
|
@ -7,29 +7,36 @@ class QLabel;
|
|||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QDialogButtonBox;
|
class QDialogButtonBox;
|
||||||
class QString;
|
class QString;
|
||||||
|
class VDirectory;
|
||||||
|
|
||||||
class VNewDirDialog : public QDialog
|
class VNewDirDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VNewDirDialog(const QString &title, const QString &info, const QString &name,
|
VNewDirDialog(const QString &title,
|
||||||
const QString &defaultName, QWidget *parent = 0);
|
const QString &info,
|
||||||
|
const QString &defaultName,
|
||||||
|
VDirectory *directory,
|
||||||
|
QWidget *parent = 0);
|
||||||
|
|
||||||
QString getNameInput() const;
|
QString getNameInput() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void enableOkButton(const QString &editText);
|
void handleInputChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupUI();
|
void setupUI();
|
||||||
|
|
||||||
QLabel *nameLabel;
|
|
||||||
QLineEdit *nameEdit;
|
QLineEdit *nameEdit;
|
||||||
QDialogButtonBox *m_btnBox;
|
QDialogButtonBox *m_btnBox;
|
||||||
|
|
||||||
|
QLabel *m_warnLabel;
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
QString info;
|
QString info;
|
||||||
QString name;
|
|
||||||
QString defaultName;
|
QString defaultName;
|
||||||
|
|
||||||
|
VDirectory *m_directory;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VNEWDIRDIALOG_H
|
#endif // VNEWDIRDIALOG_H
|
||||||
|
@ -77,7 +77,7 @@ void VNewFileDialog::handleInputChanged()
|
|||||||
QString name = nameEdit->text();
|
QString name = nameEdit->text();
|
||||||
bool nameOk = !name.isEmpty();
|
bool nameOk = !name.isEmpty();
|
||||||
if (nameOk) {
|
if (nameOk) {
|
||||||
// Check if the name conflicts with existing notebook name.
|
// Check if the name conflicts with existing note name.
|
||||||
// Case-insensitive when creating note.
|
// Case-insensitive when creating note.
|
||||||
if (m_directory->findFile(name, false)) {
|
if (m_directory->findFile(name, false)) {
|
||||||
nameOk = false;
|
nameOk = false;
|
||||||
|
@ -388,35 +388,24 @@ void VDirectoryTree::newSubDirectory()
|
|||||||
|
|
||||||
QString info = tr("Create a subfolder in <span style=\"%1\">%2</span>.")
|
QString info = tr("Create a subfolder in <span style=\"%1\">%2</span>.")
|
||||||
.arg(g_config->c_dataTextStyle).arg(curDir->getName());
|
.arg(g_config->c_dataTextStyle).arg(curDir->getName());
|
||||||
QString text(tr("Folder &name:"));
|
QString defaultName("new_folder");
|
||||||
QString defaultText("new_folder");
|
defaultName = VUtils::getFileNameWithSequence(curDir->fetchPath(), defaultName);
|
||||||
|
VNewDirDialog dialog(tr("Create Folder"), info, defaultName, curDir, this);
|
||||||
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
|
QString name = dialog.getNameInput();
|
||||||
|
|
||||||
do {
|
VDirectory *subDir = curDir->createSubDirectory(name);
|
||||||
VNewDirDialog dialog(tr("Create Folder"), info, text, defaultText, this);
|
if (!subDir) {
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
|
||||||
QString name = dialog.getNameInput();
|
tr("Fail to create folder <span style=\"%1\">%2</span>.")
|
||||||
// Case-insensitive.
|
.arg(g_config->c_dataTextStyle).arg(name), "",
|
||||||
if (curDir->findSubDirectory(name, false)) {
|
QMessageBox::Ok, QMessageBox::Ok, this);
|
||||||
info = tr("Name (case-insensitive) already exists in "
|
return;
|
||||||
"<span style=\"%1\">%2</span>. Please choose another name.")
|
|
||||||
.arg(g_config->c_dataTextStyle).arg(curDir->getName());
|
|
||||||
defaultText = name;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
VDirectory *subDir = curDir->createSubDirectory(name);
|
|
||||||
if (!subDir) {
|
|
||||||
VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
|
|
||||||
tr("Fail to create folder <span style=\"%1\">%2</span>.")
|
|
||||||
.arg(g_config->c_dataTextStyle).arg(name), "",
|
|
||||||
QMessageBox::Ok, QMessageBox::Ok, this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
updateItemChildren(curItem);
|
|
||||||
locateDirectory(subDir);
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
} while (true);
|
updateItemChildren(curItem);
|
||||||
|
locateDirectory(subDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDirectoryTree::newRootDirectory()
|
void VDirectoryTree::newRootDirectory()
|
||||||
@ -426,33 +415,25 @@ void VDirectoryTree::newRootDirectory()
|
|||||||
}
|
}
|
||||||
QString info = tr("Create a root folder in notebook <span style=\"%1\">%2</span>.")
|
QString info = tr("Create a root folder in notebook <span style=\"%1\">%2</span>.")
|
||||||
.arg(g_config->c_dataTextStyle).arg(m_notebook->getName());
|
.arg(g_config->c_dataTextStyle).arg(m_notebook->getName());
|
||||||
QString text(tr("Folder &name:"));
|
|
||||||
QString defaultText("new_folder");
|
|
||||||
VDirectory *rootDir = m_notebook->getRootDir();
|
VDirectory *rootDir = m_notebook->getRootDir();
|
||||||
do {
|
QString defaultName("new_folder");
|
||||||
VNewDirDialog dialog(tr("Create Root Folder"), info, text, defaultText, this);
|
defaultName = VUtils::getFileNameWithSequence(rootDir->fetchPath(), defaultName);
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
VNewDirDialog dialog(tr("Create Root Folder"), info, defaultName, rootDir, this);
|
||||||
QString name = dialog.getNameInput();
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
if (rootDir->findSubDirectory(name, false)) {
|
QString name = dialog.getNameInput();
|
||||||
info = tr("Name (case-insensitive) already exists in "
|
|
||||||
"notebook <span style=\"%1\">%2</span>. Please choose another name.")
|
VDirectory *subDir = rootDir->createSubDirectory(name);
|
||||||
.arg(g_config->c_dataTextStyle).arg(m_notebook->getName());
|
if (!subDir) {
|
||||||
defaultText = name;
|
VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
|
||||||
continue;
|
tr("Fail to create folder <span style=\"%1\">%2</span>.")
|
||||||
}
|
.arg(g_config->c_dataTextStyle).arg(name), "",
|
||||||
VDirectory *subDir = rootDir->createSubDirectory(name);
|
QMessageBox::Ok, QMessageBox::Ok, this);
|
||||||
if (!subDir) {
|
return;
|
||||||
VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
|
|
||||||
tr("Fail to create folder <span style=\"%1\">%2</span>.")
|
|
||||||
.arg(g_config->c_dataTextStyle).arg(name), "",
|
|
||||||
QMessageBox::Ok, QMessageBox::Ok, this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
updateItemChildren(NULL);
|
|
||||||
locateDirectory(subDir);
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
} while (true);
|
updateItemChildren(NULL);
|
||||||
|
locateDirectory(subDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDirectoryTree::deleteDirectory()
|
void VDirectoryTree::deleteDirectory()
|
||||||
@ -503,36 +484,26 @@ void VDirectoryTree::editDirectoryInfo()
|
|||||||
VDirectory *curDir = getVDirectory(curItem);
|
VDirectory *curDir = getVDirectory(curItem);
|
||||||
VDirectory *parentDir = curDir->getParentDirectory();
|
VDirectory *parentDir = curDir->getParentDirectory();
|
||||||
QString curName = curDir->getName();
|
QString curName = curDir->getName();
|
||||||
QString info;
|
|
||||||
QString defaultName = curName;
|
|
||||||
|
|
||||||
do {
|
VDirInfoDialog dialog(tr("Folder Information"), "", curDir, parentDir, this);
|
||||||
VDirInfoDialog dialog(tr("Folder Information"), info, defaultName, this);
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
QString name = dialog.getNameInput();
|
||||||
QString name = dialog.getNameInput();
|
if (name == curName) {
|
||||||
if (name == curName) {
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parentDir->findSubDirectory(name, false)) {
|
|
||||||
info = "Name (case-insensitive) already exists. Please choose another name.";
|
|
||||||
defaultName = name;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!curDir->rename(name)) {
|
|
||||||
VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
|
|
||||||
tr("Fail to rename folder <span style=\"%1\">%2</span>.")
|
|
||||||
.arg(g_config->c_dataTextStyle).arg(curName), "",
|
|
||||||
QMessageBox::Ok, QMessageBox::Ok, this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
curItem->setText(0, name);
|
|
||||||
curItem->setToolTip(0, name);
|
|
||||||
emit directoryUpdated(curDir);
|
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
} while (true);
|
if (!curDir->rename(name)) {
|
||||||
|
VUtils::showMessage(QMessageBox::Warning, tr("Warning"),
|
||||||
|
tr("Fail to rename folder <span style=\"%1\">%2</span>.")
|
||||||
|
.arg(g_config->c_dataTextStyle).arg(curName), "",
|
||||||
|
QMessageBox::Ok, QMessageBox::Ok, this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
curItem->setText(0, name);
|
||||||
|
curItem->setToolTip(0, name);
|
||||||
|
emit directoryUpdated(curDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VDirectoryTree::openDirectoryLocation() const
|
void VDirectoryTree::openDirectoryLocation() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user