默认打印设置的编辑, 文件管理器不识别U盘修复、文件管理器对中文文件名的支持修复
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "SysPara.h"
|
||||
#include <QDir>
|
||||
#include <QStringList>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QTextStream>
|
||||
@@ -133,9 +134,8 @@ void FileManageWidget::onDelSelectedBtnClicked()
|
||||
auto items = m_focusedListView->selectedItems();
|
||||
for(auto item : items) {
|
||||
auto filename = item->data(AbsPathRole).toString();
|
||||
QString cmd = QString("rm %1").arg(filename);
|
||||
int ret = system(cmd.toLatin1().constData());
|
||||
qInfo() << "Command: " << cmd << ", result: " << ret;
|
||||
bool ret = QFile::remove(filename);
|
||||
qInfo() << "Delete: " << filename << ", result: " << ret;
|
||||
}
|
||||
|
||||
updateFileListView(m_focusedListView);
|
||||
@@ -143,14 +143,27 @@ void FileManageWidget::onDelSelectedBtnClicked()
|
||||
|
||||
void FileManageWidget::updateUDiskDevList()
|
||||
{
|
||||
QDir dir(UDISK_DOC_ROOT_DIR);
|
||||
if(!dir.exists()) {
|
||||
ui->udiskSelectBox->clear();
|
||||
return;
|
||||
bool hasUDisk = false;
|
||||
QFile mountsFile("/proc/mounts");
|
||||
if (mountsFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&mountsFile);
|
||||
while (!in.atEnd()) {
|
||||
const QString line = in.readLine();
|
||||
if (line.contains("/udisk ")) {
|
||||
hasUDisk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
mountsFile.close();
|
||||
}
|
||||
|
||||
if(ui->udiskSelectBox->currentText() != tr("U盘")){
|
||||
ui->udiskSelectBox->clear();
|
||||
if (!hasUDisk) {
|
||||
QDir dir(UDISK_DOC_ROOT_DIR);
|
||||
hasUDisk = dir.exists();
|
||||
}
|
||||
|
||||
ui->udiskSelectBox->clear();
|
||||
if (hasUDisk) {
|
||||
ui->udiskSelectBox->addItem(tr("U盘"));
|
||||
ui->udiskSelectBox->setCurrentIndex(0);
|
||||
}
|
||||
@@ -227,10 +240,10 @@ void FileManageWidget::copyFiles(QListWidget *from, QListWidget *to)
|
||||
|
||||
auto items = from->selectedItems();
|
||||
for(auto item : items) {
|
||||
auto filename = item->data(AbsPathRole).toString();
|
||||
QString cmd = QString("cp %1 %2").arg(filename).arg(destPath);
|
||||
auto ret = system(cmd.toLatin1().constData());
|
||||
qInfo() << "Command: " << cmd << ", result: " << ret;
|
||||
auto srcPath = item->data(AbsPathRole).toString();
|
||||
auto destFilePath = destPath + QFileInfo(srcPath).fileName();
|
||||
bool ret = QFile::copy(srcPath, destFilePath);
|
||||
qInfo() << "Copy: " << srcPath << " -> " << destFilePath << ", result: " << ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,4 +288,4 @@ void FileManageWidget::applyStyleSheet()
|
||||
)";
|
||||
|
||||
this->setStyleSheet(styleSheet);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user