MCPcopy Create free account
hub / github.com/cxasm/notepad-- / updateProAfterSaveNewFile

Method updateProAfterSaveNewFile

src/cceditor/ccnotepad.cpp:5522–5558  ·  view source on GitHub ↗

保存一个新建的文件后,更新相关配置

Source from the content-addressed store, hash-verified

5520
5521//保存一个新建的文件后,更新相关配置
5522void CCNotePad::updateProAfterSaveNewFile(int curTabIndex, QString fileName, ScintillaEditView* pEdit)
5523{
5524 getRegularFilePath(fileName);
5525 //保存成功后,更新文件的路径和tab标签
5526 QFileInfo fi(fileName);
5527 QString fileLabel(fi.fileName());
5528
5529 ui.editTabWidget->setTabText(curTabIndex, fileLabel);
5530
5531 //删除新文件的索引
5532 QVariant v = pEdit->property(Edit_File_New);
5533
5534 int newFileIndex = v.toInt();
5535
5536 if (newFileIndex >= 0)
5537 {
5538 //如果是新建文件,则删除对于的记录
5539 FileManager::getInstance().delNewFileNode(newFileIndex);
5540 }
5541
5542 v.setValue(-1);
5543 pEdit->setProperty(Edit_File_New, v);
5544
5545 //更新路径名称
5546 QVariant fp(fileName);
5547 pEdit->setProperty(Edit_View_FilePath, fp);
5548
5549 //setWindowTitle(fileName);
5550 setFileOpenAttrProperty(pEdit, OpenAttr::Text);
5551 setWindowTitleMode(fileName, OpenAttr::Text);
5552
5553 ui.editTabWidget->setTabToolTip(curTabIndex, fileName);
5554
5555 autoSetDocLexer(pEdit);
5556
5557 addWatchFilePath(fileName);
5558}
5559
5560//
5561void CCNotePad::saveTabEdit(int tabIndex)

Callers

nothing calls this directly

Calls 3

getRegularFilePathFunction · 0.85
setFileOpenAttrPropertyFunction · 0.85
delNewFileNodeMethod · 0.80

Tested by

no test coverage detected