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

Method findFileIsOpenAtPad

src/cceditor/ccnotepad.cpp:3450–3472  ·  view source on GitHub ↗

判断文件是否已经打开中,是则返回其tabindex,否则-1

Source from the content-addressed store, hash-verified

3448
3449//判断文件是否已经打开中,是则返回其tabindex,否则-1
3450int CCNotePad::findFileIsOpenAtPad(QString filePath)
3451{
3452 int ret = -1;
3453 getRegularFilePath(filePath);
3454
3455 for (int i = 0; i < ui.editTabWidget->count(); ++i)
3456 {
3457 QWidget* pw = ui.editTabWidget->widget(i);
3458 if (pw != nullptr)
3459 {
3460 QString curPath = pw->property(Edit_View_FilePath).toString();
3461 getRegularFilePath(curPath);
3462
3463 if (curPath == filePath)
3464 {
3465 ret = i;
3466 break;
3467 }
3468 }
3469 }
3470
3471 return ret;
3472}
3473
3474//判断新建名称是否已经存在,是 true
3475bool CCNotePad::isNewFileNameExist(QString& fileName)

Callers

nothing calls this directly

Calls 1

getRegularFilePathFunction · 0.85

Tested by

no test coverage detected