implement Delete several log files at once #110
This commit is contained in:
@@ -3539,6 +3539,9 @@ p, li { white-space: pre-wrap; }
|
|||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
<property name="indentation">
|
<property name="indentation">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -1360,18 +1360,21 @@ void settingsDialogImpl::refreshLogFileList()
|
|||||||
|
|
||||||
void settingsDialogImpl::deleteLogFile()
|
void settingsDialogImpl::deleteLogFile()
|
||||||
{
|
{
|
||||||
QTreeWidgetItem* selectedItem = treeWidget_logFiles->currentItem();
|
QList<QTreeWidgetItem*> selectedItemsList = treeWidget_logFiles->selectedItems();
|
||||||
|
|
||||||
if(selectedItem) {
|
if(!selectedItemsList.isEmpty()) {
|
||||||
int ret = QMessageBox::warning(this, tr("PokerTH - Log file"),
|
int ret = QMessageBox::warning(this, tr("PokerTH - Delete log files"),
|
||||||
tr("Do you really want to delete the selected log file?"),
|
tr("Do you really want to delete the selected log files?"),
|
||||||
QMessageBox::Yes | QMessageBox::No);
|
QMessageBox::Yes | QMessageBox::No);
|
||||||
|
|
||||||
if(ret == QMessageBox::Yes) {
|
if(ret == QMessageBox::Yes) {
|
||||||
|
|
||||||
QFile fileToDelete (selectedItem->data(0, Qt::UserRole).toString());
|
for (int i = 0; i < selectedItemsList.size(); ++i) {
|
||||||
if(!fileToDelete.remove()) {
|
|
||||||
QMessageBox::warning(this, "Remove log file", "PokerTH cannot remove this log file, please check if you have write access to this file!", QMessageBox::Close );
|
QFile fileToDelete (selectedItemsList.at(i)->data(0, Qt::UserRole).toString());
|
||||||
|
if(!fileToDelete.remove()) {
|
||||||
|
QMessageBox::warning(this, "Remove log file", "PokerTH cannot remove this log file, please check if you have write access to this file!", QMessageBox::Close );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
refreshLogFileList();
|
refreshLogFileList();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user