~ubuntu-branches/ubuntu/oneiric/virtualbox-ose/oneiric

« back to all changes in this revision

Viewing changes to src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIImportApplianceWzd.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-01-30 23:27:25 UTC
  • mfrom: (0.3.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20110130232725-2ouajjd2ggdet0zd
Tags: 4.0.2-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Drop ubuntu-01-fix-build-gcc45.patch, fixed upstream.
* Drop ubuntu-02-as-needed.patch, added to the Debian package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: UIImportApplianceWzd.cpp $ */
 
1
/* $Id: UIImportApplianceWzd.cpp 35234 2010-12-20 09:40:31Z vboxsync $ */
2
2
/** @file
3
3
 *
4
4
 * VBox frontends: Qt4 GUI ("VirtualBox"):
101
101
    }
102
102
}
103
103
 
104
 
UIImportApplianceWzd::UIImportApplianceWzd(QWidget *pParent) : QIWizard(pParent)
 
104
UIImportApplianceWzd::UIImportApplianceWzd(const QString &strFile /* = "" */, QWidget *pParent /* = 0 */)
 
105
  : QIWizard(pParent)
105
106
{
106
107
    /* Create & add pages */
107
 
    addPage(new UIImportApplianceWzdPage1);
 
108
    if (strFile.isEmpty())
 
109
        addPage(new UIImportApplianceWzdPage1);
108
110
    addPage(new UIImportApplianceWzdPage2);
 
111
    if (!strFile.isEmpty())
 
112
    {
 
113
        VBoxImportApplianceWgt *applianceWidget = field("applianceWidget").value<ImportAppliancePointer>();
 
114
 
 
115
        if (!applianceWidget->setFile(strFile))
 
116
            return;
 
117
    }
109
118
 
110
119
    /* Initial translate */
111
120
    retranslateUi();
130
139
    connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(sltCurrentIdChanged(int)));
131
140
}
132
141
 
 
142
bool UIImportApplianceWzd::isValid() const
 
143
{
 
144
    bool fResult = false;
 
145
    if (VBoxImportApplianceWgt *applianceWidget = field("applianceWidget").value<ImportAppliancePointer>())
 
146
        fResult = applianceWidget->isValid();
 
147
 
 
148
    return fResult;
 
149
}
 
150
 
133
151
void UIImportApplianceWzd::retranslateUi()
134
152
{
135
153
    /* Wizard title */
164
182
 
165
183
    /* Translate the file selector */
166
184
    m_pFileSelector->setFileDialogTitle(tr("Select an appliance to import"));
167
 
    m_pFileSelector->setFileFilters(tr("Open Virtualization Format (%1)").arg("*.ovf"));
 
185
    m_pFileSelector->setFileFilters(tr("Open Virtualization Format (%1)").arg("*.ova *.ovf"));
168
186
 
169
187
    /* Wizard page 1 title */
170
188
    setTitle(tr("Welcome to the Appliance Import Wizard!"));
184
202
 
185
203
bool UIImportApplianceWzdPage1::isComplete() const
186
204
{
187
 
    return m_pFileSelector->path().toLower().endsWith(".ovf") && QFileInfo(m_pFileSelector->path()).exists();
 
205
    const QString &strFile = m_pFileSelector->path().toLower();
 
206
    return VBoxGlobal::hasAllowedExtension(strFile, VBoxDefs::OVFFileExts) && QFileInfo(m_pFileSelector->path()).exists();
188
207
}
189
208
 
190
209
bool UIImportApplianceWzdPage1::validatePage()
232
251
 
233
252
bool UIImportApplianceWzdPage2::validatePage()
234
253
{
 
254
    startProcessing();
 
255
    bool fResult = import();
 
256
    endProcessing();
 
257
    return fResult;
 
258
}
 
259
 
 
260
bool UIImportApplianceWzdPage2::import()
 
261
{
235
262
    /* Make sure the final values are puted back */
236
263
    m_pSettingsCnt->prepareImport();
237
264
    /* Check if there are license agreements the user must confirm */