Changeset 34811 in vbox for trunk/src/VBox
- Timestamp:
- Dec 7, 2010 6:23:35 PM (14 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp
r31885 r34811 34 34 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 35 35 36 VBoxLicenseViewer::VBoxLicenseViewer (const QString &aFilePath) 37 : QIWithRetranslateUI<QDialog> () 38 , mFilePath (aFilePath) 39 , mLicenseText (0) 40 , mAgreeButton (0) 41 , mDisagreeButton (0) 36 VBoxLicenseViewer::VBoxLicenseViewer() 37 : QIWithRetranslateUI<QDialog>() 38 , mLicenseText (0) 39 , mAgreeButton (0) 40 , mDisagreeButton (0) 42 41 { 43 42 #ifndef Q_WS_WIN … … 71 70 } 72 71 73 int VBoxLicenseViewer:: exec()72 int VBoxLicenseViewer::showLicenseFromFile(const QString &strLicenseFileName) 74 73 { 75 /* read & show the license file*/76 QFile file (mFilePath);77 if (file.open 74 /* Read license file: */ 75 QFile file(strLicenseFileName); 76 if (file.open(QIODevice::ReadOnly)) 78 77 { 79 mLicenseText->setText (file.readAll()); 80 return QDialog::exec(); 78 return showLicenseFromString(file.readAll()); 81 79 } 82 80 else 83 81 { 84 vboxProblem().cannotOpenLicenseFile (this, mFilePath);82 vboxProblem().cannotOpenLicenseFile(this, strLicenseFileName); 85 83 return QDialog::Rejected; 86 84 } 85 } 86 87 int VBoxLicenseViewer::showLicenseFromString(const QString &strLicenseText) 88 { 89 /* Set license text: */ 90 mLicenseText->setText(strLicenseText); 91 return exec(); 87 92 } 88 93 … … 93 98 mAgreeButton->setText (tr ("I &Agree")); 94 99 mDisagreeButton->setText (tr ("I &Disagree")); 100 } 101 102 int VBoxLicenseViewer::exec() 103 { 104 return QDialog::exec(); 95 105 } 96 106 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.h
r31885 r34811 37 37 public: 38 38 39 VBoxLicenseViewer (const QString &aFilePath);39 VBoxLicenseViewer(); 40 40 41 public slots: 42 43 int exec(); 41 int showLicenseFromFile(const QString &strLicenseFileName); 42 int showLicenseFromString(const QString &strLicenseText); 44 43 45 44 protected: … … 48 47 49 48 private slots: 49 50 int exec(); 50 51 51 52 void onScrollBarMoving (int aValue); … … 60 61 61 62 /* Private member vars */ 62 QString mFilePath;63 63 QTextBrowser *mLicenseText; 64 64 QPushButton *mAgreeButton; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r34740 r34811 2137 2137 return true; 2138 2138 2139 VBoxLicenseViewer licenseDialog (latestFilePath);2140 bool result = licenseDialog. exec() == QDialog::Accepted;2139 VBoxLicenseViewer licenseDialog; 2140 bool result = licenseDialog.showLicenseFromFile(latestFilePath) == QDialog::Accepted; 2141 2141 if (result) 2142 2142 virtualBox().SetExtraData (VBoxDefs::GUI_LicenseKey, (strList << latestVersion).join(",")); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
r34806 r34811 27 27 #include "VBoxGlobal.h" 28 28 #include "VBoxProblemReporter.h" 29 #include "VBoxLicenseViewer.h" 29 30 30 31 /* Extension package item: */ … … 129 130 if (extPackFile.GetUsable()) 130 131 { 131 bool fAck = vboxProblem().confirmInstallingPackage(extPackFile.GetName(),132 QString("%1.%2").arg(extPackFile.GetVersion()).arg(extPackFile.GetRevision()),133 extPackFile.GetDescription());134 135 if ( fAck)132 /* Ask user to confirm installation: */ 133 QString strPackName = extPackFile.GetName(); 134 QString strPackVersion = QString("%1.%2").arg(extPackFile.GetVersion()).arg(extPackFile.GetRevision()); 135 QString strPackDescription = extPackFile.GetDescription(); 136 if (vboxProblem().confirmInstallingPackage(strPackName, strPackVersion, strPackDescription)) 136 137 { 137 /* TODO: Display license! */ 138 139 /* Install package: */ 140 extPackFile.Install(); 141 if (extPackFile.isOk()) 142 fInstalled = true; 143 else 144 vboxProblem().cannotInstallExtPack(strFilePath, extPackFile, pParent); 138 /* Display license if necessary: */ 139 bool fShouldBeLicenseShown = extPackFile.GetShowLicense(); 140 QString strLicense = extPackFile.GetLicense(); 141 VBoxLicenseViewer licenseViewer; 142 if (!fShouldBeLicenseShown || licenseViewer.showLicenseFromString(strLicense) == QDialog::Accepted) 143 { 144 /* Install package: */ 145 extPackFile.Install(); 146 if (extPackFile.isOk()) 147 fInstalled = true; 148 else 149 vboxProblem().cannotInstallExtPack(strFilePath, extPackFile, pParent); 150 } 145 151 } 146 152 }
Note:
See TracChangeset
for help on using the changeset viewer.