VirtualBox

Changeset 20619 in vbox


Ignore:
Timestamp:
Jun 16, 2009 10:26:16 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
48683
Message:

FE/Qt4: 3837: New registration method - Replacing countries text-field with combo-box.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxRegistrationDlg.h

    r20568 r20619  
    7070private:
    7171
    72     void postRequest (const QUrl &aUrl);
     72    void populateCountries();
    7373    void abortRequest (const QString &aReason);
    7474    void finish();
    7575
    76     bool isFieldValid (QLineEdit *aLe) const;
     76    bool isFieldValid (QWidget *aWidget) const;
    7777
    7878    VBoxRegistrationDlg **mSelf;
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxRegistrationDlg.cpp

    r20568 r20619  
    245245    mLeNewCompany->setValidator (new QRegExpValidator (nameExp, this));
    246246
    247     mLeNewCountry->setMaxLength (50);
    248     mLeNewCountry->setValidator (new QRegExpValidator (nameExp, this));
    249 
    250247    mLeNewEmail->setMaxLength (50);
    251248    mLeNewEmail->setValidator (new QRegExpValidator (emailExp, this));
     
    256253    mLeNewPassword2->setMaxLength (20);
    257254    mLeNewPassword2->setValidator (new QRegExpValidator (passwordExp, this));
     255
     256    populateCountries();
    258257
    259258    /* Setup validation */
     
    266265    connect (mRbOld, SIGNAL (toggled (bool)), this, SLOT (radioButtonToggled()));
    267266    connect (mRbNew, SIGNAL (toggled (bool)), this, SLOT (radioButtonToggled()));
     267    connect (mCbNewCountry, SIGNAL (currentIndexChanged (int)), mWvalReg, SLOT (revalidate()));
    268268
    269269    /* Setup other connections */
     
    302302    /* Translate uic generated strings */
    303303    Ui::VBoxRegistrationDlg::retranslateUi (this);
     304
     305    /* Translate the first element of countries list */
     306    mCbNewCountry->setItemText (0, tr ("Select Country/Territory"));
    304307}
    305308
     
    313316    mLeNewLastName->setEnabled (current == mRbNew);
    314317    mLeNewCompany->setEnabled (current == mRbNew);
    315     mLeNewCountry->setEnabled (current == mRbNew);
     318    mCbNewCountry->setEnabled (current == mRbNew);
    316319    mLeNewEmail->setEnabled (current == mRbNew);
    317320    mLeNewPassword->setEnabled (current == mRbNew);
     
    330333    mLeNewLastName->setEnabled (false);
    331334    mLeNewCompany->setEnabled (false);
    332     mLeNewCountry->setEnabled (false);
     335    mCbNewCountry->setEnabled (false);
    333336    mLeNewEmail->setEnabled (false);
    334337    mLeNewPassword->setEnabled (false);
     
    434437        url.addQueryItem ("lastname", mLeNewLastName->text());
    435438        url.addQueryItem ("company", mLeNewCompany->text());
    436         url.addQueryItem ("country", mLeNewCountry->text());
     439        url.addQueryItem ("country", mCbNewCountry->currentText());
    437440    }
    438441
     
    475478        /* Check for fields correctness */
    476479        if (!isFieldValid (mLeNewFirstName) || !isFieldValid (mLeNewLastName) ||
    477             !isFieldValid (mLeNewCompany) || !isFieldValid (mLeNewCountry) ||
     480            !isFieldValid (mLeNewCompany) || !isFieldValid (mCbNewCountry) ||
    478481            !isFieldValid (mLeNewEmail) ||
    479482            !isFieldValid (mLeNewPassword) || !isFieldValid (mLeNewPassword2))
     
    500503    Assert (mPageStack->currentWidget() == mPageReg);
    501504    mLeOldEmail->setFocus();
     505}
     506
     507void VBoxRegistrationDlg::populateCountries()
     508{
     509    QStringList list ("Empty");
     510    list << "Afghanistan"
     511         << "Albania"
     512         << "Algeria"
     513         << "American Samoa"
     514         << "Andorra"
     515         << "Angola"
     516         << "Anguilla"
     517         << "Antartica"
     518         << "Antigua & Barbuda"
     519         << "Argentina"
     520         << "Armenia"
     521         << "Aruba"
     522         << "Ascension Island"
     523         << "Australia"
     524         << "Austria"
     525         << "Azerbaijan"
     526         << "Bahamas"
     527         << "Bahrain"
     528         << "Bangladesh"
     529         << "Barbados"
     530         << "Belarus"
     531         << "Belgium"
     532         << "Belize"
     533         << "Benin"
     534         << "Bermuda"
     535         << "Bhutan"
     536         << "Bolivia"
     537         << "Bosnia and Herzegovina"
     538         << "Botswana"
     539         << "Bouvet Island"
     540         << "Brazil"
     541         << "British Indian Ocean Territory"
     542         << "Brunei Darussalam"
     543         << "Bulgaria"
     544         << "Burkina Faso"
     545         << "Burundi"
     546         << "Cambodia"
     547         << "Cameroon"
     548         << "Canada"
     549         << "Cape Verde"
     550         << "Cayman Islands"
     551         << "Central African Republic"
     552         << "Chad"
     553         << "Chile"
     554         << "China"
     555         << "Christmas Island"
     556         << "Cocos (Keeling) Islands"
     557         << "Colombia"
     558         << "Comoros"
     559         << "Congo, Democratic People's Republic"
     560         << "Congo, Republic of"
     561         << "Cook Islands"
     562         << "Costa Rica"
     563         << "Cote d'Ivoire"
     564         << "Croatia/Hrvatska"
     565         << "Cyprus"
     566         << "Czech Republic"
     567         << "Denmark"
     568         << "Djibouti"
     569         << "Dominica"
     570         << "Dominican Republic"
     571         << "East Timor"
     572         << "Ecuador"
     573         << "Egypt"
     574         << "El Salvador"
     575         << "Equatorial Guinea"
     576         << "Eritrea"
     577         << "Estonia"
     578         << "Ethiopia"
     579         << "Falkland Islands (Malvina)"
     580         << "Faroe Islands"
     581         << "Fiji"
     582         << "Finland"
     583         << "France"
     584         << "French Guiana"
     585         << "French Polynesia"
     586         << "French Southern Territories"
     587         << "Gabon"
     588         << "Gambia"
     589         << "Georgia"
     590         << "Germany"
     591         << "Ghana"
     592         << "Gibraltar"
     593         << "Greece"
     594         << "Greenland"
     595         << "Grenada"
     596         << "Guadeloupe"
     597         << "Guam"
     598         << "Guatemala"
     599         << "Guernsey"
     600         << "Guinea"
     601         << "Guinea-Bissau"
     602         << "Guyana"
     603         << "Haiti"
     604         << "Heard and McDonald Islands"
     605         << "Holy See (City Vatican State)"
     606         << "Honduras"
     607         << "Hong Kong"
     608         << "Hungary"
     609         << "Iceland"
     610         << "India"
     611         << "Indonesia"
     612         << "Iraq"
     613         << "Ireland"
     614         << "Isle of Man"
     615         << "Israel"
     616         << "Italy"
     617         << "Jamaica"
     618         << "Japan"
     619         << "Jersey"
     620         << "Jordan"
     621         << "Kazakhstan"
     622         << "Kenya"
     623         << "Kiribati"
     624         << "Korea, Republic of"
     625         << "Kuwait"
     626         << "Kyrgyzstan"
     627         << "Lao People's Democratic Republic"
     628         << "Latvia"
     629         << "Lebanon"
     630         << "Lesotho"
     631         << "Liberia"
     632         << "Libyan Arab Jamahiriya"
     633         << "Liechtenstein"
     634         << "Lithuania"
     635         << "Luxembourg"
     636         << "Macau"
     637         << "Macedonia, Former Yugoslav Republic"
     638         << "Madagascar"
     639         << "Malawi"
     640         << "Malaysia"
     641         << "Maldives"
     642         << "Mali"
     643         << "Malta"
     644         << "Marshall Islands"
     645         << "Martinique"
     646         << "Mauritania"
     647         << "Mauritius"
     648         << "Mayotte"
     649         << "Mexico"
     650         << "Micronesia, Federal State of"
     651         << "Moldova, Republic of"
     652         << "Monaco"
     653         << "Mongolia"
     654         << "Montserrat"
     655         << "Morocco"
     656         << "Mozambique"
     657         << "Namibia"
     658         << "Nauru"
     659         << "Nepal"
     660         << "Netherlands"
     661         << "Netherlands Antilles"
     662         << "New Caledonia"
     663         << "New Zealand"
     664         << "Nicaragua"
     665         << "Niger"
     666         << "Nigeria"
     667         << "Niue"
     668         << "Norfolk Island"
     669         << "Northern Mariana Island"
     670         << "Norway"
     671         << "Oman"
     672         << "Pakistan"
     673         << "Palau"
     674         << "Panama"
     675         << "Papua New Guinea"
     676         << "Paraguay"
     677         << "Peru"
     678         << "Philippines"
     679         << "Pitcairn Island"
     680         << "Poland"
     681         << "Portugal"
     682         << "Puerto Rico"
     683         << "Qatar"
     684         << "Reunion Island"
     685         << "Romania"
     686         << "Russian Federation"
     687         << "Rwanda"
     688         << "Saint Kitts and Nevis"
     689         << "Saint Lucia"
     690         << "Saint Vincent and the Grenadines"
     691         << "San Marino"
     692         << "Sao Tome & Principe"
     693         << "Saudi Arabia"
     694         << "Senegal"
     695         << "Seychelles"
     696         << "Sierra Leone"
     697         << "Singapore"
     698         << "Slovak Republic"
     699         << "Slovenia"
     700         << "Solomon Islands"
     701         << "Somalia"
     702         << "South Africa"
     703         << "South Georgia and the South Sandwich Islands"
     704         << "Spain"
     705         << "Sri Lanka"
     706         << "St Pierre and Miquelon"
     707         << "St. Helena"
     708         << "Suriname"
     709         << "Svalbard And Jan Mayen Island"
     710         << "Swaziland"
     711         << "Sweden"
     712         << "Switzerland"
     713         << "Taiwan"
     714         << "Tajikistan"
     715         << "Tanzania"
     716         << "Thailand"
     717         << "Togo"
     718         << "Tokelau"
     719         << "Tonga"
     720         << "Trinidad and Tobago"
     721         << "Tunisia"
     722         << "Turkey"
     723         << "Turkmenistan"
     724         << "Turks and Ciacos Islands"
     725         << "Tuvalu"
     726         << "US Minor Outlying Islands"
     727         << "Uganda"
     728         << "Ukraine"
     729         << "United Arab Emirates"
     730         << "United Kingdom"
     731         << "United States"
     732         << "Uruguay"
     733         << "Uzbekistan"
     734         << "Vanuatu"
     735         << "Venezuela"
     736         << "Vietnam"
     737         << "Virgin Island (British)"
     738         << "Virgin Islands (USA)"
     739         << "Wallis And Futuna Islands"
     740         << "Western Sahara"
     741         << "Western Samoa"
     742         << "Yemen"
     743         << "Yugoslavia"
     744         << "Zambia"
     745         << "Zimbabwe";
     746    mCbNewCountry->addItems (list);
    502747}
    503748
     
    527772}
    528773
    529 bool VBoxRegistrationDlg::isFieldValid (QLineEdit *aLe) const
    530 {
    531     QString text (aLe->text());
    532     int position;
    533     return aLe->validator()->validate (text, position) == QValidator::Acceptable;
    534 }
    535 
     774bool VBoxRegistrationDlg::isFieldValid (QWidget *aWidget) const
     775{
     776    if (QLineEdit *le = qobject_cast <QLineEdit*> (aWidget))
     777    {
     778        QString text (le->text());
     779        int position;
     780        return le->validator()->validate (text, position) == QValidator::Acceptable;
     781    }
     782    else if (QComboBox *cb = qobject_cast <QComboBox*> (aWidget))
     783    {
     784        return cb->currentIndex() > 0;
     785    }
     786    return false;
     787}
     788
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxRegistrationDlg.ui

    r19223 r20619  
    288288         </property>
    289289         <property name="buddy" >
    290           <cstring>mLeNewCountry</cstring>
     290          <cstring>mCbNewCountry</cstring>
    291291         </property>
    292292        </widget>
    293293       </item>
    294294       <item row="12" column="3" >
    295         <widget class="QLineEdit" name="mLeNewCountry" >
     295        <widget class="QComboBox" name="mCbNewCountry" >
    296296         <property name="whatsThis" >
    297297          <string>Enter your full name using Latin characters.</string>
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette