Changeset 7351 in vbox for trunk/src/VBox
- Timestamp:
- Mar 7, 2008 11:35:29 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28771
- Location:
- trunk/src/VBox/Frontends
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r7342 r7351 1872 1872 .warnAboutAutoConvertedSettings (formatVersion, fileList); 1873 1873 1874 if (rc == QIMessageBox::No) 1875 { 1876 /* create backup copies */ 1877 for (QValueList <CMachine>::Iterator m = machines.begin(); 1878 /* machines.end() means global config => manual loop break */ ;) 1879 { 1880 QString of, nf; 1881 1882 if (m == machines.end()) 1883 { 1884 if (!isGlobalConverted) 1885 break; 1886 of = mVBox.GetSettingsFilePath(); 1887 nf = QString ("%1.%2.bak").arg (of, mVBox.GetSettingsFileVersion()); 1888 } 1889 else 1890 { 1891 of = (*m).GetSettingsFilePath(); 1892 nf = QString ("%1.%2.bak").arg (of, (*m).GetSettingsFileVersion()); 1893 } 1894 1895 int vrc = RTFileCopyEx (of.utf8(), nf.utf8(), 1896 RTFILECOPY_FLAG_NO_DENY_WRITE, 1897 NULL, NULL); 1898 1899 /* try progressive suffix on failure */ 1900 if (vrc == VERR_ALREADY_EXISTS) 1901 { 1902 QString tmp = nf; 1903 for (int i = 0; i < 9 && RT_FAILURE (vrc); ++ i) 1904 { 1905 nf = QString ("%1.%2"). arg (tmp).arg (i); 1906 vrc = RTFileCopyEx (of.utf8(), nf.utf8(), 1907 RTFILECOPY_FLAG_NO_DENY_WRITE, 1908 NULL, NULL); 1909 } 1910 } 1911 1912 if (RT_FAILURE (vrc)) 1913 { 1914 vboxProblem().cannotCopyFile (of, nf, vrc); 1915 if (m == machines.end()) 1916 { 1917 /* remove from further processing */ 1918 isGlobalConverted = false; 1919 break; 1920 } 1921 else 1922 /* remove from further processing */ 1923 m = machines.remove (m); 1924 } 1925 else 1926 { 1927 if (m == machines.end()) 1928 break; 1929 ++ m; 1930 } 1931 } 1932 } 1933 1934 if (rc == QIMessageBox::Yes || rc == QIMessageBox::No) 1935 { 1936 /* save all settings files */ 1874 if (rc == QIMessageBox::No || rc == QIMessageBox::Yes) 1875 { 1876 /* backup (optionally) and save all settings files 1877 * (QIMessageBox::No = Backup, QIMessageBox::Yes = Save) */ 1878 1937 1879 for (QValueList <CMachine>::Iterator m = machines.begin(); 1938 1880 /* machines.end() means global config => manual loop break */ ;) … … 1942 1884 if (isGlobalConverted) 1943 1885 { 1944 mVBox.SaveSettings(); 1886 if (rc == QIMessageBox::No) 1887 mVBox.SaveSettingsWithBackup(); 1888 else 1889 mVBox.SaveSettings(); 1890 1945 1891 if (!mVBox.isOk()) 1946 1892 vboxProblem().cannotSaveGlobalSettings (mVBox); … … 1953 1899 { 1954 1900 CMachine sm = session.GetMachine(); 1955 sm.SaveSettings(); 1901 if (rc == QIMessageBox::No) 1902 sm.SaveSettingsWithBackup(); 1903 else 1904 sm.SaveSettings(); 1905 ; 1956 1906 if (!sm.isOk()) 1957 1907 vboxProblem().cannotSaveMachineSettings (sm); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r7342 r7351 1662 1662 "<p>Note that if you select <b>Cancel</b>, the auto-converted " 1663 1663 "settings files will be implicitly saved in the new format anyway " 1664 "once you change a setting or start a virtual machine.</p>") 1664 "once you change a setting or start a virtual machine, but " 1665 "<b>no</b> backup copies will be created in this case.</p>") 1665 1666 .arg (aFormatVersion), 1666 1667 aFileList, -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp
r7342 r7351 1886 1886 .warnAboutAutoConvertedSettings (formatVersion, fileList); 1887 1887 1888 if (rc == QIMessageBox::No) 1889 { 1890 /* create backup copies */ 1891 for (QList <CMachine>::Iterator m = machines.begin(); 1892 /* machines.end() means global config => manual loop break */ ;) 1893 { 1894 QString of, nf; 1895 1896 if (m == machines.end()) 1897 { 1898 if (!isGlobalConverted) 1899 break; 1900 of = mVBox.GetSettingsFilePath(); 1901 nf = QString ("%1.%2.bak").arg (of, mVBox.GetSettingsFileVersion()); 1902 } 1903 else 1904 { 1905 of = (*m).GetSettingsFilePath(); 1906 nf = QString ("%1.%2.bak").arg (of, (*m).GetSettingsFileVersion()); 1907 } 1908 1909 int vrc = RTFileCopyEx (of.utf8(), nf.utf8(), 1910 RTFILECOPY_FLAG_NO_DENY_WRITE, 1911 NULL, NULL); 1912 1913 /* try progressive suffix on failure */ 1914 if (vrc == VERR_ALREADY_EXISTS) 1915 { 1916 QString tmp = nf; 1917 for (int i = 0; i < 9 && RT_FAILURE (vrc); ++ i) 1918 { 1919 nf = QString ("%1.%2"). arg (tmp).arg (i); 1920 vrc = RTFileCopyEx (of.utf8(), nf.utf8(), 1921 RTFILECOPY_FLAG_NO_DENY_WRITE, 1922 NULL, NULL); 1923 } 1924 } 1925 1926 if (RT_FAILURE (vrc)) 1927 { 1928 vboxProblem().cannotCopyFile (of, nf, vrc); 1929 if (m == machines.end()) 1930 { 1931 /* remove from further processing */ 1932 isGlobalConverted = false; 1933 break; 1934 } 1935 else 1936 /* remove from further processing */ 1937 m = machines.remove (m); 1938 } 1939 else 1940 { 1941 if (m == machines.end()) 1942 break; 1943 ++ m; 1944 } 1945 } 1946 } 1947 1948 if (rc == QIMessageBox::Yes || rc == QIMessageBox::No) 1949 { 1950 /* save all settings files */ 1888 if (rc == QIMessageBox::No || rc == QIMessageBox::Yes) 1889 { 1890 /* backup (optionally) and save all settings files 1891 * (QIMessageBox::No = Backup, QIMessageBox::Yes = Save) */ 1892 1951 1893 for (QList <CMachine>::Iterator m = machines.begin(); 1952 1894 /* machines.end() means global config => manual loop break */ ;) … … 1956 1898 if (isGlobalConverted) 1957 1899 { 1958 mVBox.SaveSettings(); 1900 if (rc == QIMessageBox::No) 1901 mVBox.SaveSettingsWithBackup(); 1902 else 1903 mVBox.SaveSettings(); 1904 1959 1905 if (!mVBox.isOk()) 1960 1906 vboxProblem().cannotSaveGlobalSettings (mVBox); … … 1967 1913 { 1968 1914 CMachine sm = session.GetMachine(); 1969 sm.SaveSettings(); 1915 if (rc == QIMessageBox::No) 1916 sm.SaveSettingsWithBackup(); 1917 else 1918 sm.SaveSettings(); 1919 ; 1970 1920 if (!sm.isOk()) 1971 1921 vboxProblem().cannotSaveMachineSettings (sm); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxProblemReporter.cpp
r7342 r7351 1668 1668 "<p>Note that if you select <b>Cancel</b>, the auto-converted " 1669 1669 "settings files will be implicitly saved in the new format anyway " 1670 "once you change a setting or start a virtual machine.</p>") 1670 "once you change a setting or start a virtual machine, but " 1671 "<b>no</b> backup copies will be created in this case.</p>") 1671 1672 .arg (aFormatVersion), 1672 1673 aFileList,
Note:
See TracChangeset
for help on using the changeset viewer.