| 969 | } |
| 970 | |
| 971 | void DocumentManagerPrivate::createDraft() |
| 972 | { |
| 973 | if (document->isNew()) { |
| 974 | int i = 1; |
| 975 | QString draftPath; |
| 976 | |
| 977 | // Make sure draft file name is unique. |
| 978 | do { |
| 979 | draftPath = draftLocation + "/" + draftName + "-" + QString::number(i) + ".md"; |
| 980 | i++; |
| 981 | } while (QFileInfo(draftPath).exists()); |
| 982 | |
| 983 | setFilePath(draftPath); |
| 984 | saveFile(); |
| 985 | } |
| 986 | } |
| 987 | |
| 988 | } |
no test coverage detected