| 6136 | } |
| 6137 | |
| 6138 | void CCNotePad::closeFileStatic(int index, QSettings& qs) |
| 6139 | { |
| 6140 | QWidget* pw = ui.editTabWidget->widget(index); |
| 6141 | QString filePath = pw->property(Edit_View_FilePath).toString(); |
| 6142 | |
| 6143 | //16进制的处理逻辑 |
| 6144 | int type = getDocTypeProperty(pw); |
| 6145 | |
| 6146 | if (HEX_TYPE == type) |
| 6147 | { |
| 6148 | ui.editTabWidget->removeTab(index); |
| 6149 | pw->deleteLater(); |
| 6150 | FileManager::getInstance().closeHexFileHand(filePath); |
| 6151 | return; |
| 6152 | } |
| 6153 | else if (BIG_TEXT_RO_TYPE == type) |
| 6154 | { |
| 6155 | ui.editTabWidget->removeTab(index); |
| 6156 | pw->deleteLater(); |
| 6157 | |
| 6158 | FileManager::getInstance().closeBigTextRoFileHand(filePath); |
| 6159 | return; |
| 6160 | } |
| 6161 | else if (SUPER_BIG_TEXT_RO_TYPE == type) |
| 6162 | { |
| 6163 | ui.editTabWidget->removeTab(index); |
| 6164 | pw->deleteLater(); |
| 6165 | |
| 6166 | FileManager::getInstance().closeSuperBigTextFileHand(filePath); |
| 6167 | return; |
| 6168 | } |
| 6169 | |
| 6170 | //关闭之前,检查是否要保存。如果文档为脏,则静默保存为temp文件 |
| 6171 | ScintillaEditView* pEdit = dynamic_cast<ScintillaEditView*>(pw); |
| 6172 | if ((pEdit != nullptr)) |
| 6173 | { |
| 6174 | saveTempFile(pEdit,index,qs); |
| 6175 | } |
| 6176 | |
| 6177 | ui.editTabWidget->removeTab(index); |
| 6178 | |
| 6179 | QVariant v = pw->property(Edit_File_New); |
| 6180 | |
| 6181 | int newFileIndex = v.toInt(); |
| 6182 | |
| 6183 | if (newFileIndex >= 0) |
| 6184 | { |
| 6185 | //如果是新建文件,则删除对应的记录 |
| 6186 | FileManager::getInstance().delNewFileNode(newFileIndex); |
| 6187 | } |
| 6188 | |
| 6189 | //这里是在退出程序的过程中,不需要更新最近打开文件菜单列表 |
| 6190 | |
| 6191 | //取消监控文件 |
| 6192 | removeWatchFilePath(filePath); |
| 6193 | pw->deleteLater(); |
| 6194 | } |
| 6195 |
nothing calls this directly
no test coverage detected