src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
changeset 29 b72c6db6890b
parent 19 fcece45ef507
child 30 5dc02b23752f
equal deleted inserted replaced
25:e24348a560a6 29:b72c6db6890b
  3069     function to dynamically return different user agents for different URLs, based on the \a url parameter.
  3069     function to dynamically return different user agents for different URLs, based on the \a url parameter.
  3070 
  3070 
  3071     The default implementation returns the following value:
  3071     The default implementation returns the following value:
  3072 
  3072 
  3073     "Mozilla/5.0 (%Platform%; %Security%; %Subplatform%; %Locale%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%"
  3073     "Mozilla/5.0 (%Platform%; %Security%; %Subplatform%; %Locale%) AppleWebKit/%WebKitVersion% (KHTML, like Gecko) %AppVersion Safari/%WebKitVersion%"
       
  3074     
       
  3075     On mobile platforms such as Symbian S60 and Maemo, "Mobile Safari" is used instead of "Safari".
  3074 
  3076 
  3075     In this string the following values are replaced at run-time:
  3077     In this string the following values are replaced at run-time:
  3076     \list
  3078     \list
  3077     \o %Platform% and %Subplatform% are expanded to the windowing system and the operation system.
  3079     \o %Platform% and %Subplatform% are expanded to the windowing system and the operation system.
  3078     \o %Security% expands to U if SSL is enabled, otherwise N. SSL is enabled if QSslSocket::supportsSsl() returns true.
  3080     \o %Security% expands to U if SSL is enabled, otherwise N. SSL is enabled if QSslSocket::supportsSsl() returns true.
  3095 #elif defined Q_WS_WIN
  3097 #elif defined Q_WS_WIN
  3096     "Windows"
  3098     "Windows"
  3097 #elif defined Q_WS_X11
  3099 #elif defined Q_WS_X11
  3098     "X11"
  3100     "X11"
  3099 #elif defined Q_OS_SYMBIAN
  3101 #elif defined Q_OS_SYMBIAN
  3100     "SymbianOS"
  3102     "Symbian"
  3101 #else
  3103 #else
  3102     "Unknown"
  3104     "Unknown"
  3103 #endif
  3105 #endif
  3104     // Placeholder for Platform Version
  3106     // Placeholder for Platform Version
  3105     "%1; "
  3107     "%1; "
  3162 #elif defined Q_OS_SOLARIS
  3164 #elif defined Q_OS_SOLARIS
  3163     "Sun Solaris"
  3165     "Sun Solaris"
  3164 #elif defined Q_OS_ULTRIX
  3166 #elif defined Q_OS_ULTRIX
  3165     "DEC Ultrix"
  3167     "DEC Ultrix"
  3166 #elif defined Q_WS_S60
  3168 #elif defined Q_WS_S60
  3167     "Series60"
  3169     ""
  3168 #elif defined Q_OS_UNIX
  3170 #elif defined Q_OS_UNIX
  3169     "UNIX BSD/SYSV system"
  3171     "UNIX BSD/SYSV system"
  3170 #elif defined Q_OS_UNIXWARE
  3172 #elif defined Q_OS_UNIXWARE
  3171     "UnixWare Seven, Open UNIX Eight"
  3173     "UnixWare Seven, Open UNIX Eight"
  3172 #else
  3174 #else
  3179     QString osVer;
  3181     QString osVer;
  3180 #ifdef Q_OS_SYMBIAN
  3182 #ifdef Q_OS_SYMBIAN
  3181     QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
  3183     QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
  3182     switch (symbianVersion) {
  3184     switch (symbianVersion) {
  3183     case QSysInfo::SV_9_2:
  3185     case QSysInfo::SV_9_2:
  3184         osVer = "/9.2";
  3186         osVer = "OS/9.2";
  3185         break;
  3187         break;
  3186     case QSysInfo::SV_9_3:
  3188     case QSysInfo::SV_9_3:
  3187         osVer = "/9.3";
  3189         osVer = "OS/9.3";
  3188         break;
  3190         break;
  3189     case QSysInfo::SV_9_4:
  3191     case QSysInfo::SV_9_4:
  3190         osVer = "/9.4";
  3192         osVer = "OS/9.4";
       
  3193         break;
       
  3194     case QSysInfo::SV_SF_2:
       
  3195         osVer = "/2";
       
  3196         break;
       
  3197     case QSysInfo::SV_SF_3:
       
  3198         osVer = "/3";
       
  3199         break;
       
  3200     case QSysInfo::SV_SF_4:
       
  3201         osVer = "/4";
  3191         break;
  3202         break;
  3192     default: 
  3203     default: 
  3193         osVer = "Unknown";
  3204         osVer = "";
  3194     }
  3205     }
  3195 #endif
  3206 #endif
  3196     ua = ua.arg(osVer);
  3207     ua = ua.arg(osVer);
  3197 
  3208 
  3198     QChar securityStrength(QLatin1Char('N'));
  3209     QChar securityStrength(QLatin1Char('N'));
  3257     ua = QString(ua).arg(ver);
  3268     ua = QString(ua).arg(ver);
  3258 #endif
  3269 #endif
  3259 
  3270 
  3260     // SubPlatform Version
  3271     // SubPlatform Version
  3261     QString subPlatformVer;
  3272     QString subPlatformVer;
  3262 #ifdef Q_OS_SYMBIAN
  3273 #ifdef Q_WS_S60
  3263     QSysInfo::S60Version s60Version = QSysInfo::s60Version();
  3274     QSysInfo::S60Version s60Version = QSysInfo::s60Version();
  3264     switch (s60Version) {
  3275     switch (s60Version) {
  3265     case QSysInfo::SV_S60_3_1:
  3276     case QSysInfo::SV_S60_3_1:
  3266         subPlatformVer = "/3.1";
  3277         subPlatformVer = "Series60/3.1";
  3267         break;
  3278         break;
  3268     case QSysInfo::SV_S60_3_2:
  3279     case QSysInfo::SV_S60_3_2:
  3269         subPlatformVer = "/3.2";
  3280         subPlatformVer = "Series60/3.2";
  3270         break;
  3281         break;
  3271     case QSysInfo::SV_S60_5_0:
  3282     case QSysInfo::SV_S60_5_0:
  3272         subPlatformVer = "/5.0";
  3283         subPlatformVer = "Series60/5.0";
  3273         break;
  3284         break;
  3274     default: 
  3285     default: 
  3275         subPlatformVer = " Unknown";
  3286         subPlatformVer = "";
  3276     }
  3287     }
  3277 #endif
  3288 #endif
  3278     ua = ua.arg(subPlatformVer);
  3289     ua = ua.arg(subPlatformVer);
  3279 
  3290 
  3280     // Language
  3291     // Language
  3281     QLocale locale;
  3292     QLocale locale;
  3282     if (view())
  3293     if (view())
  3283         locale = view()->locale();
  3294         locale = view()->locale();
  3284     QString name = locale.name();
  3295     QString name = locale.name();
  3285     name[2] = QLatin1Char('-');
  3296     name.replace(QLatin1Char('_'), QLatin1Char('-'));
  3286     ua.append(name);
  3297     ua.append(name);
  3287     ua.append(QLatin1String(") "));
  3298     ua.append(QLatin1String(") "));
  3288 
  3299 
  3289     // webkit/qt version
  3300     // webkit/qt version
  3290     ua.append(QString(QLatin1String("AppleWebKit/%1 (KHTML, like Gecko) "))
  3301     ua.append(QString(QLatin1String("AppleWebKit/%1 (KHTML, like Gecko) "))
  3303         // Qt version
  3314         // Qt version
  3304         ua.append(QLatin1String("Qt/"));
  3315         ua.append(QLatin1String("Qt/"));
  3305         ua.append(QLatin1String(qVersion()));
  3316         ua.append(QLatin1String(qVersion()));
  3306     }
  3317     }
  3307 
  3318 
       
  3319 #if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
       
  3320     ua.append(QString(QLatin1String(" Mobile Safari/%1"))
       
  3321                       .arg(qWebKitVersion()));
       
  3322 #else
  3308     ua.append(QString(QLatin1String(" Safari/%1"))
  3323     ua.append(QString(QLatin1String(" Safari/%1"))
  3309                       .arg(qWebKitVersion()));
  3324                       .arg(qWebKitVersion()));
       
  3325 #endif
  3310 
  3326 
  3311     return ua;
  3327     return ua;
  3312 }
  3328 }
  3313 
  3329 
  3314 
  3330