* @brief Called when Open-button for project file is selected. */
| 898 | * @brief Called when Open-button for project file is selected. |
| 899 | */ |
| 900 | void COpenView::OnLoadProject() |
| 901 | { |
| 902 | UpdateData(TRUE); |
| 903 | |
| 904 | String fileName = AskProjectFileName(true); |
| 905 | if (fileName.empty()) |
| 906 | return; |
| 907 | |
| 908 | ProjectFile project; |
| 909 | if (!CMergeApp::LoadProjectFile(fileName, project)) |
| 910 | return; |
| 911 | if (project.Items().size() == 0) |
| 912 | return; |
| 913 | PathContext paths; |
| 914 | ProjectFileItem& projItem = *project.Items().begin(); |
| 915 | bool bRecurse = m_bRecurse; |
| 916 | projItem.GetPaths(paths, bRecurse); |
| 917 | if (Options::Project::Get(GetOptionsMgr(), Options::Project::Operation::Load, Options::Project::Item::IncludeSubfolders)) |
| 918 | m_bRecurse = bRecurse; |
| 919 | if (paths.GetSize() < 3) |
| 920 | { |
| 921 | m_strPath[0] = paths[0]; |
| 922 | m_strPath[1] = paths[1]; |
| 923 | m_strPath[2].clear(); |
| 924 | m_bReadOnly[0] = projItem.GetLeftReadOnly(); |
| 925 | m_bReadOnly[1] = projItem.GetRightReadOnly(); |
| 926 | m_bReadOnly[2] = false; |
| 927 | } |
| 928 | else |
| 929 | { |
| 930 | m_strPath[0] = paths[0]; |
| 931 | m_strPath[1] = paths[1]; |
| 932 | m_strPath[2] = paths[2]; |
| 933 | m_bReadOnly[0] = projItem.GetLeftReadOnly(); |
| 934 | m_bReadOnly[1] = projItem.GetMiddleReadOnly(); |
| 935 | m_bReadOnly[2] = projItem.GetRightReadOnly(); |
| 936 | } |
| 937 | if (Options::Project::Get(GetOptionsMgr(), Options::Project::Operation::Load, Options::Project::Item::FileFilter) && projItem.HasFilter()) |
| 938 | m_strExt = projItem.GetFilter(); |
| 939 | if (Options::Project::Get(GetOptionsMgr(), Options::Project::Operation::Load, Options::Project::Item::Plugin)) |
| 940 | { |
| 941 | if (projItem.HasUnpacker()) |
| 942 | m_strUnpackerPipeline = projItem.GetUnpacker(); |
| 943 | if (projItem.HasPrediffer()) |
| 944 | m_strPredifferPipeline = projItem.GetPrediffer(); |
| 945 | } |
| 946 | |
| 947 | if (projItem.HasWindowType()) |
| 948 | GetDocument()->m_nWindowType = projItem.GetWindowType(); |
| 949 | if (projItem.HasTableDelimiter()) |
| 950 | GetDocument()->m_cTableDelimiter = projItem.GetTableDelimiter(); |
| 951 | if (projItem.HasTableQuote()) |
| 952 | GetDocument()->m_cTableQuote = projItem.GetTableQuote(); |
| 953 | if (projItem.HasTableAllowNewLinesInQuotes()) |
| 954 | GetDocument()->m_bTableAllowNewLinesInQuotes = projItem.GetTableAllowNewLinesInQuotes(); |
| 955 | |
| 956 | if (Options::Project::Get(GetOptionsMgr(), Options::Project::Operation::Load, Options::Project::Item::CompareOptions)) |
| 957 | { |
nothing calls this directly
no test coverage detected