void FileSystemWidget::renameFolder() { QFileInfo info = contextFileInfo(); if (!info.isDir()) { return; } QString folderName = QInputDialog::getText(m_liteApp->mainWindow(), tr("Rename Folder"),tr("Folder Name"), QLineEdit::Normal,info.fileName()); if (!folderName.isEmpty() && folderName != info.fileName()) { QDir dir = contextDir(); dir.cdUp(); #ifdef Q_OS_WIN QString _old = info.filePath(); QString _new = dir.path()+"/"+folderName; if (!MoveFileW(_old.toStdWString().c_str(),_new.toStdWString().c_str())) { QMessageBox::information(m_liteApp->mainWindow(),tr("Rename Folder"), tr("Failed to rename the folder!")); } #else if (!dir.rename(info.fileName(),folderName)) { QMessageBox::information(m_liteApp->mainWindow(),tr("Rename Folder"), tr("Failed to rename the folder!")); } #endif } }
void FileSystemWidget::newFileWizard() { QString filePath; QString projPath; QFileInfo info = contextFileInfo(); QDir dir = contextDir(); if (!info.isFile()) { filePath = dir.absolutePath(); projPath = dir.absolutePath(); } else { filePath = dir.absolutePath(); dir.cdUp(); projPath = dir.absolutePath(); } m_liteApp->fileManager()->execFileWizard(projPath,filePath); }
void FileSystemWidget::removeFile() { QFileInfo info = contextFileInfo(); if (!info.isFile()) { return; } int ret = QMessageBox::question(m_liteApp->mainWindow(),tr("Remove File"), tr("Confirm remove the file and continue"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No); if (ret == QMessageBox::Yes) { if (!QFile::remove(info.filePath())) { QMessageBox::information(m_liteApp->mainWindow(),tr("Remove File"), tr("Failed to remove the file!")); } } }
void FileBrowser::removeFile() { QFileInfo info = contextFileInfo(); if (!info.isFile()) { return; } int ret = QMessageBox::question(m_liteApp->mainWindow(),tr("Delete File"), tr("Are you sure that you want to permanently delete this file?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (ret == QMessageBox::Yes) { if (!QFile::remove(info.filePath())) { QMessageBox::information(m_liteApp->mainWindow(),tr("Delete File"), tr("Failed to delete the file!")); } } }
void FileBrowser::removeFolder() { QFileInfo info = contextFileInfo(); if (!info.isDir()) { return; } int ret = QMessageBox::warning(m_liteApp->mainWindow(),tr("Delete Folder"), tr("Are you sure that you want to permanently delete this folder and all of its contents?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (ret == QMessageBox::Yes) { if (!m_fileModel->rmdir(m_contextIndex)) { QMessageBox::information(m_liteApp->mainWindow(),tr("Delete Folder"), tr("Failed to delete the folder!")); } } }
void FileBrowser::removeFolder() { QFileInfo info = contextFileInfo(); if (!info.isDir()) { return; } int ret = QMessageBox::warning(m_liteApp->mainWindow(),tr("Remove Folder"), tr("Confirm remove the foler and continue"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No); if (ret == QMessageBox::Yes) { if (!m_fileModel->rmdir(m_contextIndex)) { QMessageBox::information(m_liteApp->mainWindow(),tr("Remove Folder"), tr("Failed to remove the folder!")); } } }
void GopathBrowser::renameFile() { QFileInfo info = contextFileInfo(); if (!info.isFile()) { return; } QString fileName = QInputDialog::getText(m_liteApp->mainWindow(), tr("Rename File"),tr("File Name"), QLineEdit::Normal,info.fileName()); if (!fileName.isEmpty() && fileName != info.fileName()) { QDir dir = contextDir(); if (!QFile::rename(info.filePath(),QFileInfo(dir,fileName).filePath())) { QMessageBox::information(m_liteApp->mainWindow(),tr("Rename File"), tr("Failed to rename the file!")); } } }
void GopathBrowser::removeFolder() { QFileInfo info = contextFileInfo(); if (!info.isDir()) { return; } int ret = QMessageBox::warning(m_liteApp->mainWindow(),tr("Remove Folder"), tr("Confirm remove the foler and continue"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No); if (ret == QMessageBox::Yes) { QDir dir = info.dir(); if (!dir.rmdir(info.fileName())) { QMessageBox::information(m_liteApp->mainWindow(),tr("Remove Folder"), tr("Failed to remove the folder!")); } } }
void GopathBrowser::renameFolder() { QFileInfo info = contextFileInfo(); if (!info.isDir()) { return; } QString folderName = QInputDialog::getText(m_liteApp->mainWindow(), tr("Rename Folder"),tr("Folder Name"), QLineEdit::Normal,info.fileName()); if (!folderName.isEmpty() && folderName != info.fileName()) { QDir dir = contextDir(); dir.cdUp(); if (!dir.rename(info.fileName(),folderName)) { QMessageBox::information(m_liteApp->mainWindow(),tr("Rename Folder"), tr("Failed to rename the folder!")); } } }
void FileSystemWidget::removeFolder() { QFileInfo info = contextFileInfo(); if (!info.isDir()) { return; } int ret = QMessageBox::warning(m_liteApp->mainWindow(),tr("Remove Folder"), tr("Confirm remove the foler and continue"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No); if (ret == QMessageBox::Yes) { QDir dir = info.dir(); m_model->fileWatcher()->removePath(info.filePath()); if (!dir.rmdir(info.fileName())) { QMessageBox::information(m_liteApp->mainWindow(),tr("Remove Folder"), tr("Failed to remove the folder!")); m_model->fileWatcher()->addPath(info.filePath()); } } }
void FileSystemWidget::removeFolder() { QFileInfo info = contextFileInfo(); if (!info.isDir()) { return; } int ret = QMessageBox::warning(m_liteApp->mainWindow(),tr("Delete Folder"), tr("Are you sure that you want to permanently delete this folder and all of its contents?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No); if (ret == QMessageBox::Yes) { QDir dir = info.dir(); m_model->fileWatcher()->removePath(info.filePath()); if (!dir.rmdir(info.fileName())) { QMessageBox::information(m_liteApp->mainWindow(),tr("Delete Folder"), tr("Failed to delete the folder!")); m_model->fileWatcher()->addPath(info.filePath()); } } }
void FileSystemWidget::renameFile() { QFileInfo info = contextFileInfo(); if (!info.isFile()) { return; } QString fileName = QInputDialog::getText(m_liteApp->mainWindow(), tr("Rename File"),tr("File Name"), QLineEdit::Normal,info.fileName()); if (!fileName.isEmpty() && fileName != info.fileName()) { QDir dir = contextDir(); #ifdef Q_OS_WIN if (!MoveFileW(info.filePath().toStdWString().c_str(),QFileInfo(dir,fileName).filePath().toStdWString().c_str())) { QMessageBox::information(m_liteApp->mainWindow(),tr("Rename File"), tr("Failed to rename the file!")); } #else if (!QFile::rename(info.filePath(),QFileInfo(dir,fileName).filePath())) { QMessageBox::information(m_liteApp->mainWindow(),tr("Rename File"), tr("Failed to rename the file!")); } #endif } }