Index: trunk/examples/animation/animatedtiles/animatedtiles.pro
===================================================================
--- trunk/examples/animation/animatedtiles/animatedtiles.pro	(revision 727)
+++ trunk/examples/animation/animatedtiles/animatedtiles.pro	(revision 769)
@@ -7,2 +7,7 @@
 sources.path = $$[QT_INSTALL_EXAMPLES]/animation/animatedtiles
 INSTALLS += target sources
+
+symbian {
+    TARGET.UID3 = 0xA000D7D1
+    include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
Index: trunk/examples/animation/appchooser/appchooser.pro
===================================================================
--- trunk/examples/animation/appchooser/appchooser.pro	(revision 727)
+++ trunk/examples/animation/appchooser/appchooser.pro	(revision 769)
@@ -7,2 +7,7 @@
 sources.path = $$[QT_INSTALL_EXAMPLES]/animation/appchooser
 INSTALLS += target sources
+
+symbian {
+    TARGET.UID3 = 0xA000E3F5
+    include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
Index: trunk/examples/animation/easing/easing.pro
===================================================================
--- trunk/examples/animation/easing/easing.pro	(revision 727)
+++ trunk/examples/animation/easing/easing.pro	(revision 769)
@@ -13,2 +13,7 @@
 sources.path = $$[QT_INSTALL_EXAMPLES]/animation/easing
 INSTALLS += target sources
+
+symbian {
+    TARGET.UID3 = 0xA000E3F6
+    include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
Index: trunk/examples/animation/moveblocks/moveblocks.pro
===================================================================
--- trunk/examples/animation/moveblocks/moveblocks.pro	(revision 727)
+++ trunk/examples/animation/moveblocks/moveblocks.pro	(revision 769)
@@ -6,2 +6,7 @@
 sources.path = $$[QT_INSTALL_EXAMPLES]/animation/moveblocks
 INSTALLS += target sources
+
+symbian {
+    TARGET.UID3 = 0xA000E3F7
+    include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
Index: trunk/examples/animation/states/states.pro
===================================================================
--- trunk/examples/animation/states/states.pro	(revision 727)
+++ trunk/examples/animation/states/states.pro	(revision 769)
@@ -7,2 +7,7 @@
 sources.path = $$[QT_INSTALL_EXAMPLES]/animation/states
 INSTALLS += target sources
+
+symbian {
+    TARGET.UID3 = 0xA000E3F8
+    include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
Index: trunk/examples/animation/stickman/stickman.pro
===================================================================
--- trunk/examples/animation/stickman/stickman.pro	(revision 727)
+++ trunk/examples/animation/stickman/stickman.pro	(revision 769)
@@ -18,2 +18,7 @@
 sources.path = $$[QT_INSTALL_EXAMPLES]/animation/stickman
 INSTALLS += target sources
+
+symbian {
+    TARGET.UID3 = 0xA000E3F9
+    include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
Index: trunk/examples/assistant/simpletextviewer/findfiledialog.cpp
===================================================================
--- trunk/examples/assistant/simpletextviewer/findfiledialog.cpp	(revision 727)
+++ trunk/examples/assistant/simpletextviewer/findfiledialog.cpp	(revision 769)
@@ -103,5 +103,5 @@
         QString data(file.readAll());
 
-        if (fileName.endsWith(".html"))
+        if (fileName.endsWith(QLatin1String(".html")))
             currentEditor->setHtml(data);
         else
@@ -120,5 +120,5 @@
 void FindFileDialog::findFiles()
 {
-    QRegExp filePattern(fileNameComboBox->currentText() + "*");
+    QRegExp filePattern(fileNameComboBox->currentText() + '*');
     filePattern.setPatternSyntax(QRegExp::Wildcard);
 
@@ -128,5 +128,5 @@
     QStringList matchingFiles;
 
-    foreach (QString file, allFiles) {
+    foreach (const QString &file, allFiles) {
         if (filePattern.exactMatch(file))
             matchingFiles << file;
Index: trunk/examples/designer/taskmenuextension/tictactoedialog.h
===================================================================
--- trunk/examples/designer/taskmenuextension/tictactoedialog.h	(revision 727)
+++ trunk/examples/designer/taskmenuextension/tictactoedialog.h	(revision 769)
@@ -56,5 +56,5 @@
 
 public:
-    TicTacToeDialog(TicTacToe *plugin = 0, QWidget *parent = 0);
+    explicit TicTacToeDialog(TicTacToe *plugin = 0, QWidget *parent = 0);
 
     QSize sizeHint() const;
Index: trunk/examples/examples.pro
===================================================================
--- trunk/examples/examples.pro	(revision 727)
+++ trunk/examples/examples.pro	(revision 769)
@@ -37,4 +37,6 @@
                 sql \
                 uitools \
+                animation \
+                gestures \
                 xml
 
Index: trunk/examples/gestures/imagegestures/imagegestures.pro
===================================================================
--- trunk/examples/gestures/imagegestures/imagegestures.pro	(revision 727)
+++ trunk/examples/gestures/imagegestures/imagegestures.pro	(revision 769)
@@ -15,2 +15,7 @@
 INSTALLS += target \
     sources
+
+symbian {
+    TARGET.UID3 = 0xA000D7D0
+    include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
Index: trunk/examples/multimedia/audiodevices/audiodevices.cpp
===================================================================
--- trunk/examples/multimedia/audiodevices/audiodevices.cpp	(revision 727)
+++ trunk/examples/multimedia/audiodevices/audiodevices.cpp	(revision 769)
@@ -44,4 +44,38 @@
 
 #include "audiodevices.h"
+
+// Utility functions for converting QAudioFormat fields into text
+
+QString toString(QAudioFormat::SampleType sampleType)
+{
+    QString result("Unknown");
+    switch (sampleType) {
+    case QAudioFormat::SignedInt:
+        result = "SignedInt";
+        break;
+    case QAudioFormat::UnSignedInt:
+        result = "UnSignedInt";
+        break;
+    case QAudioFormat::Float:
+        result = "Float";
+        break;
+    }
+    return result;
+}
+
+QString toString(QAudioFormat::Endian endian)
+{
+    QString result("Unknown");
+    switch (endian) {
+    case QAudioFormat::LittleEndian:
+        result = "LittleEndian";
+        break;
+    case QAudioFormat::BigEndian:
+        result = "BigEndian";
+        break;
+    }
+    return result;
+}
+
 
 AudioDevicesBase::AudioDevicesBase(QWidget *parent, Qt::WFlags f)
@@ -68,4 +102,5 @@
     connect(sampleTypesBox, SIGNAL(activated(int)), SLOT(sampleTypeChanged(int)));
     connect(endianBox, SIGNAL(activated(int)), SLOT(endianChanged(int)));
+    connect(populateTableButton, SIGNAL(clicked()), SLOT(populateTable()));
 
     modeBox->setCurrentIndex(0);
@@ -82,10 +117,9 @@
 {
     // tries to set all the settings picked.
-    logOutput->clear();
-    logOutput->append("NOTE: an invalid codec audio/test exists for testing, to get a fail condition.");
+    testResult->clear();
 
     if (!deviceInfo.isNull()) {
         if (deviceInfo.isFormatSupported(settings)) {
-            logOutput->append(tr("Success"));
+            testResult->setText(tr("Success"));
             nearestFreq->setText("");
             nearestChannel->setText("");
@@ -96,38 +130,21 @@
         } else {
             QAudioFormat nearest = deviceInfo.nearestFormat(settings);
-            logOutput->append(tr("Failed"));
+            testResult->setText(tr("Failed"));
             nearestFreq->setText(QString("%1").arg(nearest.frequency()));
             nearestChannel->setText(QString("%1").arg(nearest.channels()));
             nearestCodec->setText(nearest.codec());
             nearestSampleSize->setText(QString("%1").arg(nearest.sampleSize()));
-
-            switch(nearest.sampleType()) {
-                case QAudioFormat::SignedInt:
-                    nearestSampleType->setText("SignedInt");
-                    break;
-                case QAudioFormat::UnSignedInt:
-                    nearestSampleType->setText("UnSignedInt");
-                    break;
-                case QAudioFormat::Float:
-                    nearestSampleType->setText("Float");
-                    break;
-                case QAudioFormat::Unknown:
-                    nearestSampleType->setText("Unknown");
-            }
-            switch(nearest.byteOrder()) {
-                case QAudioFormat::LittleEndian:
-                    nearestEndian->setText("LittleEndian");
-                    break;
-                case QAudioFormat::BigEndian:
-                    nearestEndian->setText("BigEndian");
-            }
+            nearestSampleType->setText(toString(nearest.sampleType()));
+            nearestEndian->setText(toString(nearest.byteOrder()));
         }
     }
     else
-        logOutput->append(tr("No Device"));
+        testResult->setText(tr("No Device"));
 }
 
 void AudioTest::modeChanged(int idx)
 {
+    testResult->clear();
+
     // mode has changed
     if (idx == 0)
@@ -139,8 +156,13 @@
     foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(mode))
         deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
+
+    deviceBox->setCurrentIndex(0);
+    deviceChanged(0);
 }
 
 void AudioTest::deviceChanged(int idx)
 {
+    testResult->clear();
+
     if (deviceBox->count() == 0)
         return;
@@ -181,36 +203,66 @@
     sampleTypesBox->clear();
     QList<QAudioFormat::SampleType> sampleTypez = deviceInfo.supportedSampleTypes();
-    for (int i = 0; i < sampleTypez.size(); ++i) {
-        switch(sampleTypez.at(i)) {
-            case QAudioFormat::SignedInt:
-                sampleTypesBox->addItem("SignedInt");
-                break;
-            case QAudioFormat::UnSignedInt:
-                sampleTypesBox->addItem("UnSignedInt");
-                break;
-            case QAudioFormat::Float:
-                sampleTypesBox->addItem("Float");
-                break;
-            case QAudioFormat::Unknown:
-                sampleTypesBox->addItem("Unknown");
-        }
-	if (sampleTypez.size())
-            settings.setSampleType(sampleTypez.at(0));
-    }
+
+    for (int i = 0; i < sampleTypez.size(); ++i)
+        sampleTypesBox->addItem(toString(sampleTypez.at(i)));
+    if (sampleTypez.size())
+        settings.setSampleType(sampleTypez.at(0));
 
     endianBox->clear();
     QList<QAudioFormat::Endian> endianz = deviceInfo.supportedByteOrders();
-    for (int i = 0; i < endianz.size(); ++i) {
-        switch (endianz.at(i)) {
-            case QAudioFormat::LittleEndian:
-                endianBox->addItem("Little Endian");
-                break;
-            case QAudioFormat::BigEndian:
-                endianBox->addItem("Big Endian");
-                break;
-        }
-    }
+    for (int i = 0; i < endianz.size(); ++i)
+        endianBox->addItem(toString(endianz.at(i)));
     if (endianz.size())
         settings.setByteOrder(endianz.at(0));
+
+    allFormatsTable->clearContents();
+}
+
+void AudioTest::populateTable()
+{
+    int row = 0;
+
+    QAudioFormat format;
+    foreach (QString codec, deviceInfo.supportedCodecs()) {
+        format.setCodec(codec);
+        foreach (int frequency, deviceInfo.supportedFrequencies()) {
+            format.setFrequency(frequency);
+            foreach (int channels, deviceInfo.supportedChannels()) {
+                format.setChannels(channels);
+                foreach (QAudioFormat::SampleType sampleType, deviceInfo.supportedSampleTypes()) {
+                    format.setSampleType(sampleType);
+                    foreach (int sampleSize, deviceInfo.supportedSampleSizes()) {
+                        format.setSampleSize(sampleSize);
+                        foreach (QAudioFormat::Endian endian, deviceInfo.supportedByteOrders()) {
+                            format.setByteOrder(endian);
+                            if (deviceInfo.isFormatSupported(format)) {
+                                allFormatsTable->setRowCount(row + 1);
+
+                                QTableWidgetItem *codecItem = new QTableWidgetItem(format.codec());
+                                allFormatsTable->setItem(row, 0, codecItem);
+
+                                QTableWidgetItem *frequencyItem = new QTableWidgetItem(QString("%1").arg(format.frequency()));
+                                allFormatsTable->setItem(row, 1, frequencyItem);
+
+                                QTableWidgetItem *channelsItem = new QTableWidgetItem(QString("%1").arg(format.channels()));
+                                allFormatsTable->setItem(row, 2, channelsItem);
+
+                                QTableWidgetItem *sampleTypeItem = new QTableWidgetItem(toString(format.sampleType()));
+                                allFormatsTable->setItem(row, 3, sampleTypeItem);
+
+                                QTableWidgetItem *sampleSizeItem = new QTableWidgetItem(QString("%1").arg(format.sampleSize()));
+                                allFormatsTable->setItem(row, 4, sampleSizeItem);
+
+                                QTableWidgetItem *byteOrderItem = new QTableWidgetItem(toString(format.byteOrder()));
+                                allFormatsTable->setItem(row, 5, byteOrderItem);
+
+                                ++row;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
 }
 
Index: trunk/examples/multimedia/audiodevices/audiodevices.h
===================================================================
--- trunk/examples/multimedia/audiodevices/audiodevices.h	(revision 727)
+++ trunk/examples/multimedia/audiodevices/audiodevices.h	(revision 769)
@@ -75,4 +75,6 @@
     void endianChanged(int idx);
     void test();
+    void populateTable();
+
 };
 
Index: trunk/examples/multimedia/audiodevices/audiodevicesbase.ui
===================================================================
--- trunk/examples/multimedia/audiodevices/audiodevicesbase.ui	(revision 727)
+++ trunk/examples/multimedia/audiodevices/audiodevicesbase.ui	(revision 769)
@@ -7,6 +7,6 @@
     <x>0</x>
     <y>0</y>
-    <width>504</width>
-    <height>702</height>
+    <width>679</width>
+    <height>598</height>
    </rect>
   </property>
@@ -17,239 +17,377 @@
    <layout class="QVBoxLayout" name="verticalLayout">
     <item>
-     <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0">
-       <widget class="QLabel" name="deviceLabel">
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
-          <horstretch>1</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="text">
-         <string>Device</string>
-        </property>
-       </widget>
-      </item>
-      <item row="0" column="1">
-       <widget class="QLabel" name="modeLabel">
-        <property name="text">
-         <string>Mode</string>
-        </property>
-       </widget>
-      </item>
-      <item row="1" column="0">
-       <widget class="QComboBox" name="deviceBox"/>
-      </item>
-      <item row="1" column="1">
-       <widget class="QComboBox" name="modeBox">
-        <item>
-         <property name="text">
-          <string>Input</string>
-         </property>
+     <widget class="QScrollArea" name="scrollArea">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="widgetResizable">
+       <bool>true</bool>
+      </property>
+      <widget class="QWidget" name="scrollAreaWidgetContents">
+       <property name="geometry">
+        <rect>
+         <x>0</x>
+         <y>0</y>
+         <width>659</width>
+         <height>558</height>
+        </rect>
+       </property>
+       <layout class="QGridLayout" name="gridLayout_4">
+        <item row="0" column="0">
+         <layout class="QGridLayout" name="gridLayout_2">
+          <item row="0" column="0">
+           <widget class="QLabel" name="modeLabel">
+            <property name="text">
+             <string>Mode</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QLabel" name="deviceLabel">
+            <property name="text">
+             <string>Device</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <widget class="QComboBox" name="modeBox">
+            <item>
+             <property name="text">
+              <string>Input</string>
+             </property>
+            </item>
+            <item>
+             <property name="text">
+              <string>Output</string>
+             </property>
+            </item>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QComboBox" name="deviceBox"/>
+          </item>
+          <item row="2" column="0" colspan="2">
+           <widget class="QTabWidget" name="tabWidget">
+            <property name="currentIndex">
+             <number>0</number>
+            </property>
+            <widget class="QWidget" name="testFormatTab">
+             <attribute name="title">
+              <string>Test format</string>
+             </attribute>
+             <layout class="QGridLayout" name="gridLayout">
+              <item row="0" column="1">
+               <widget class="QLabel" name="actualLabel">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="frameShape">
+                 <enum>QFrame::NoFrame</enum>
+                </property>
+                <property name="frameShadow">
+                 <enum>QFrame::Plain</enum>
+                </property>
+                <property name="text">
+                 <string>&lt;i&gt;Actual Settings&lt;/i&gt;</string>
+                </property>
+                <property name="textFormat">
+                 <enum>Qt::RichText</enum>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="2">
+               <widget class="QLabel" name="nearestLabel">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="frameShape">
+                 <enum>QFrame::NoFrame</enum>
+                </property>
+                <property name="frameShadow">
+                 <enum>QFrame::Plain</enum>
+                </property>
+                <property name="text">
+                 <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;Nearest Settings&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+                </property>
+                <property name="textFormat">
+                 <enum>Qt::RichText</enum>
+                </property>
+                <property name="alignment">
+                 <set>Qt::AlignCenter</set>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QComboBox" name="frequencyBox">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="2">
+               <widget class="QLineEdit" name="nearestFreq">
+                <property name="enabled">
+                 <bool>false</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="1">
+               <widget class="QComboBox" name="channelsBox"/>
+              </item>
+              <item row="5" column="2">
+               <widget class="QLineEdit" name="nearestChannel">
+                <property name="enabled">
+                 <bool>false</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="9" column="1">
+               <widget class="QComboBox" name="sampleSizesBox"/>
+              </item>
+              <item row="9" column="2">
+               <widget class="QLineEdit" name="nearestSampleSize">
+                <property name="enabled">
+                 <bool>false</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="14" column="1">
+               <widget class="QComboBox" name="endianBox"/>
+              </item>
+              <item row="14" column="2">
+               <widget class="QLineEdit" name="nearestEndian">
+                <property name="enabled">
+                 <bool>false</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="15" column="1">
+               <widget class="QPushButton" name="testButton">
+                <property name="text">
+                 <string>Test</string>
+                </property>
+               </widget>
+              </item>
+              <item row="15" column="2">
+               <widget class="QLabel" name="testResult">
+                <property name="text">
+                 <string/>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLabel" name="actualFreqLabel">
+                <property name="text">
+                 <string>Frequency (Hz)</string>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="0">
+               <widget class="QLabel" name="actualChannelLabel">
+                <property name="text">
+                 <string>Channels</string>
+                </property>
+               </widget>
+              </item>
+              <item row="9" column="0">
+               <widget class="QLabel" name="actualSampleSizeLabel">
+                <property name="text">
+                 <string>Sample size (bits)</string>
+                </property>
+               </widget>
+              </item>
+              <item row="14" column="0">
+               <widget class="QLabel" name="actualEndianLabel">
+                <property name="text">
+                 <string>Endianess</string>
+                </property>
+               </widget>
+              </item>
+              <item row="16" column="0" colspan="3">
+               <widget class="QLabel" name="label">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="text">
+                 <string>Note: an invalid codec 'audio/test' exists in order to allow an invalid format to be constructed, and therefore to trigger a 'nearest format' calculation.</string>
+                </property>
+                <property name="wordWrap">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLabel" name="actualCodecLabel">
+                <property name="text">
+                 <string>Codec</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="2">
+               <widget class="QLineEdit" name="nearestCodec">
+                <property name="enabled">
+                 <bool>false</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QComboBox" name="codecsBox"/>
+              </item>
+              <item row="6" column="0">
+               <widget class="QLabel" name="actualSampleTypeLabel">
+                <property name="text">
+                 <string>SampleType</string>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="1">
+               <widget class="QComboBox" name="sampleTypesBox"/>
+              </item>
+              <item row="6" column="2">
+               <widget class="QLineEdit" name="nearestSampleType">
+                <property name="enabled">
+                 <bool>false</bool>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+            <widget class="QWidget" name="tab">
+             <attribute name="title">
+              <string>All formats</string>
+             </attribute>
+             <layout class="QVBoxLayout" name="verticalLayout_2">
+              <item>
+               <widget class="QPushButton" name="populateTableButton">
+                <property name="text">
+                 <string>Populate table</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QTableWidget" name="allFormatsTable">
+                <property name="editTriggers">
+                 <set>QAbstractItemView::NoEditTriggers</set>
+                </property>
+                <property name="dragDropOverwriteMode">
+                 <bool>false</bool>
+                </property>
+                <property name="selectionMode">
+                 <enum>QAbstractItemView::NoSelection</enum>
+                </property>
+                <property name="selectionBehavior">
+                 <enum>QAbstractItemView::SelectItems</enum>
+                </property>
+                <property name="textElideMode">
+                 <enum>Qt::ElideNone</enum>
+                </property>
+                <property name="sortingEnabled">
+                 <bool>false</bool>
+                </property>
+                <property name="wordWrap">
+                 <bool>false</bool>
+                </property>
+                <property name="cornerButtonEnabled">
+                 <bool>false</bool>
+                </property>
+                <attribute name="horizontalHeaderHighlightSections">
+                 <bool>false</bool>
+                </attribute>
+                <attribute name="verticalHeaderVisible">
+                 <bool>false</bool>
+                </attribute>
+                <attribute name="verticalHeaderHighlightSections">
+                 <bool>false</bool>
+                </attribute>
+                <attribute name="verticalHeaderVisible">
+                 <bool>false</bool>
+                </attribute>
+                <attribute name="horizontalHeaderHighlightSections">
+                 <bool>false</bool>
+                </attribute>
+                <attribute name="verticalHeaderHighlightSections">
+                 <bool>false</bool>
+                </attribute>
+                <column>
+                 <property name="text">
+                  <string>Codec</string>
+                 </property>
+                 <property name="textAlignment">
+                  <set>AlignHCenter|AlignVCenter|AlignCenter</set>
+                 </property>
+                </column>
+                <column>
+                 <property name="text">
+                  <string>Frequency (Hz)</string>
+                 </property>
+                 <property name="textAlignment">
+                  <set>AlignHCenter|AlignVCenter|AlignCenter</set>
+                 </property>
+                </column>
+                <column>
+                 <property name="text">
+                  <string>Channels</string>
+                 </property>
+                 <property name="textAlignment">
+                  <set>AlignHCenter|AlignVCenter|AlignCenter</set>
+                 </property>
+                </column>
+                <column>
+                 <property name="text">
+                  <string>Sample type</string>
+                 </property>
+                 <property name="textAlignment">
+                  <set>AlignHCenter|AlignVCenter|AlignCenter</set>
+                 </property>
+                </column>
+                <column>
+                 <property name="text">
+                  <string>Sample size (bits)</string>
+                 </property>
+                 <property name="textAlignment">
+                  <set>AlignHCenter|AlignVCenter|AlignCenter</set>
+                 </property>
+                </column>
+                <column>
+                 <property name="text">
+                  <string>Endianness</string>
+                 </property>
+                 <property name="textAlignment">
+                  <set>AlignHCenter|AlignVCenter|AlignCenter</set>
+                 </property>
+                </column>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </widget>
+          </item>
+         </layout>
         </item>
-        <item>
-         <property name="text">
-          <string>Output</string>
-         </property>
-        </item>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="actualLabel">
-        <property name="frameShape">
-         <enum>QFrame::Panel</enum>
-        </property>
-        <property name="frameShadow">
-         <enum>QFrame::Raised</enum>
-        </property>
-        <property name="text">
-         <string>Actual Settings</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="1">
-       <widget class="QLabel" name="nearestLabel">
-        <property name="frameShape">
-         <enum>QFrame::Panel</enum>
-        </property>
-        <property name="frameShadow">
-         <enum>QFrame::Raised</enum>
-        </property>
-        <property name="text">
-         <string>Nearest Settings</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="0">
-       <widget class="QLabel" name="actualFreqLabel">
-        <property name="text">
-         <string>Frequency</string>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="1">
-       <widget class="QLabel" name="nearestFreqLabel">
-        <property name="text">
-         <string>Frequency</string>
-        </property>
-       </widget>
-      </item>
-      <item row="4" column="0">
-       <widget class="QComboBox" name="frequencyBox"/>
-      </item>
-      <item row="4" column="1">
-       <widget class="QLineEdit" name="nearestFreq">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="5" column="0">
-       <widget class="QLabel" name="actualChannelsLabel">
-        <property name="text">
-         <string>Channels</string>
-        </property>
-       </widget>
-      </item>
-      <item row="5" column="1">
-       <widget class="QLabel" name="nearestChannelLabel">
-        <property name="text">
-         <string>Channel</string>
-        </property>
-       </widget>
-      </item>
-      <item row="6" column="0">
-       <widget class="QComboBox" name="channelsBox"/>
-      </item>
-      <item row="6" column="1">
-       <widget class="QLineEdit" name="nearestChannel">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="7" column="0">
-       <widget class="QLabel" name="actualCodecLabel">
-        <property name="text">
-         <string>Codecs</string>
-        </property>
-       </widget>
-      </item>
-      <item row="7" column="1">
-       <widget class="QLabel" name="nearestCodecLabel">
-        <property name="text">
-         <string>Codec</string>
-        </property>
-       </widget>
-      </item>
-      <item row="8" column="0">
-       <widget class="QComboBox" name="codecsBox"/>
-      </item>
-      <item row="8" column="1">
-       <widget class="QLineEdit" name="nearestCodec">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="9" column="0">
-       <widget class="QLabel" name="actualSampleSizeLabel">
-        <property name="text">
-         <string>SampleSize</string>
-        </property>
-       </widget>
-      </item>
-      <item row="9" column="1">
-       <widget class="QLabel" name="nearestSampleSizeLabel">
-        <property name="text">
-         <string>SampleSize</string>
-        </property>
-       </widget>
-      </item>
-      <item row="10" column="0">
-       <widget class="QComboBox" name="sampleSizesBox"/>
-      </item>
-      <item row="10" column="1">
-       <widget class="QLineEdit" name="nearestSampleSize">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="11" column="0">
-       <widget class="QLabel" name="actualSampleTypeLabel">
-        <property name="text">
-         <string>SampleType</string>
-        </property>
-       </widget>
-      </item>
-      <item row="11" column="1">
-       <widget class="QLabel" name="nearestSampleTypeLabel">
-        <property name="text">
-         <string>SampleType</string>
-        </property>
-       </widget>
-      </item>
-      <item row="12" column="0">
-       <widget class="QComboBox" name="sampleTypesBox"/>
-      </item>
-      <item row="12" column="1">
-       <widget class="QLineEdit" name="nearestSampleType">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="13" column="0">
-       <widget class="QLabel" name="actualEndianLabel">
-        <property name="text">
-         <string>Endianess</string>
-        </property>
-       </widget>
-      </item>
-      <item row="13" column="1">
-       <widget class="QLabel" name="nearestEndianLabel">
-        <property name="text">
-         <string>Endianess</string>
-        </property>
-       </widget>
-      </item>
-      <item row="14" column="0">
-       <widget class="QComboBox" name="endianBox"/>
-      </item>
-      <item row="14" column="1">
-       <widget class="QLineEdit" name="nearestEndian">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-       </widget>
-      </item>
-      <item row="15" column="0" colspan="2">
-       <widget class="QTextEdit" name="logOutput">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-        <property name="minimumSize">
-         <size>
-          <width>0</width>
-          <height>40</height>
-         </size>
-        </property>
-       </widget>
-      </item>
-      <item row="16" column="0" colspan="2">
-       <widget class="QPushButton" name="testButton">
-        <property name="text">
-         <string>Test</string>
-        </property>
-       </widget>
-      </item>
-     </layout>
+       </layout>
+      </widget>
+     </widget>
     </item>
    </layout>
Index: trunk/examples/multimedia/audiodevices/main.cpp
===================================================================
--- trunk/examples/multimedia/audiodevices/main.cpp	(revision 727)
+++ trunk/examples/multimedia/audiodevices/main.cpp	(revision 769)
@@ -50,5 +50,9 @@
 
     AudioTest audio;
+#ifdef Q_OS_SYMBIAN
+    audio.showMaximized();
+#else
     audio.show();
+#endif
 
     return app.exec();
Index: trunk/examples/multimedia/audioinput/audioinput.cpp
===================================================================
--- trunk/examples/multimedia/audioinput/audioinput.cpp	(revision 727)
+++ trunk/examples/multimedia/audioinput/audioinput.cpp	(revision 769)
@@ -49,14 +49,47 @@
 #include <QAudioDeviceInfo>
 #include <QAudioInput>
+
+#include <QtCore/qendian.h>
+
 #include "audioinput.h"
 
-#define BUFFER_SIZE 4096
-
-AudioInfo::AudioInfo(QObject *parent, QAudioInput *device)
-    :QIODevice(parent)
-{
-    input = device;
-
-    m_maxValue = 0;
+const QString InputTest::PushModeLabel(tr("Enable push mode"));
+const QString InputTest::PullModeLabel(tr("Enable pull mode"));
+const QString InputTest::SuspendLabel(tr("Suspend recording"));
+const QString InputTest::ResumeLabel(tr("Resume recording"));
+
+const int BufferSize = 4096;
+
+AudioInfo::AudioInfo(const QAudioFormat &format, QObject *parent)
+    :   QIODevice(parent)
+    ,   m_format(format)
+    ,   m_maxAmplitude(0)
+    ,   m_level(0.0)
+
+{
+    switch (m_format.sampleSize()) {
+    case 8:
+        switch (m_format.sampleType()) {
+        case QAudioFormat::UnSignedInt:
+            m_maxAmplitude = 255;
+            break;
+        case QAudioFormat::SignedInt:
+            m_maxAmplitude = 127;
+            break;
+        default: ;
+        }
+        break;
+    case 16:
+        switch (m_format.sampleType()) {
+        case QAudioFormat::UnSignedInt:
+            m_maxAmplitude = 65535;
+            break;
+        case QAudioFormat::SignedInt:
+            m_maxAmplitude = 32767;
+            break;
+        default: ;
+        }
+        break;
+    }
 }
 
@@ -85,37 +118,45 @@
 qint64 AudioInfo::writeData(const char *data, qint64 len)
 {
-    int samples = len/2; // 2 bytes per sample
-    int maxAmp = 32768; // max for S16 samples
-    bool clipping = false;
-
-    m_maxValue = 0;
-
-    qint16 *s = (qint16*)data;
-
-    // sample format is S16LE, only!
-
-    for (int i = 0; i < samples; ++i) {
-        qint16 sample = *s;
-        s++;
-        if (abs(sample) > m_maxValue) m_maxValue = abs(sample);
-    }
-    // check for clipping
-    if (m_maxValue >= (maxAmp - 1))
-        clipping = true;
-
-    float value = ((float)m_maxValue/(float)maxAmp);
-    if (clipping)
-        m_maxValue = 100;
-    else
-        m_maxValue = (int)(value*100);
+    if (m_maxAmplitude) {
+        Q_ASSERT(m_format.sampleSize() % 8 == 0);
+        const int channelBytes = m_format.sampleSize() / 8;
+        const int sampleBytes = m_format.channels() * channelBytes;
+        Q_ASSERT(len % sampleBytes == 0);
+        const int numSamples = len / sampleBytes;
+
+        quint16 maxValue = 0;
+        const unsigned char *ptr = reinterpret_cast<const unsigned char *>(data);
+
+        for (int i = 0; i < numSamples; ++i) {
+            for(int j = 0; j < m_format.channels(); ++j) {
+                quint16 value = 0;
+
+                if (m_format.sampleSize() == 8 && m_format.sampleType() == QAudioFormat::UnSignedInt) {
+                    value = *reinterpret_cast<const quint8*>(ptr);
+                } else if (m_format.sampleSize() == 8 && m_format.sampleType() == QAudioFormat::SignedInt) {
+                    value = qAbs(*reinterpret_cast<const qint8*>(ptr));
+                } else if (m_format.sampleSize() == 16 && m_format.sampleType() == QAudioFormat::UnSignedInt) {
+                    if (m_format.byteOrder() == QAudioFormat::LittleEndian)
+                        value = qFromLittleEndian<quint16>(ptr);
+                    else
+                        value = qFromBigEndian<quint16>(ptr);
+                } else if (m_format.sampleSize() == 16 && m_format.sampleType() == QAudioFormat::SignedInt) {
+                    if (m_format.byteOrder() == QAudioFormat::LittleEndian)
+                        value = qAbs(qFromLittleEndian<qint16>(ptr));
+                    else
+                        value = qAbs(qFromBigEndian<qint16>(ptr));
+                }
+
+                maxValue = qMax(value, maxValue);
+                ptr += channelBytes;
+            }
+        }
+
+        maxValue = qMin(maxValue, m_maxAmplitude);
+        m_level = qreal(maxValue) / m_maxAmplitude;
+    }
 
     emit update();
-
     return len;
-}
-
-int AudioInfo::LinearMax()
-{
-    return m_maxValue;
 }
 
@@ -126,5 +167,5 @@
     setAutoFillBackground(true);
 
-    level = 0;
+    m_level = 0;
     setMinimumHeight(30);
     setMinimumWidth(200);
@@ -140,10 +181,10 @@
                            painter.viewport().right()-20,
                            painter.viewport().bottom()-20));
-    if (level == 0)
+    if (m_level == 0.0)
         return;
 
     painter.setPen(Qt::red);
 
-    int pos = ((painter.viewport().right()-20)-(painter.viewport().left()+11))*level/100;
+    int pos = ((painter.viewport().right()-20)-(painter.viewport().left()+11))*m_level;
     for (int i = 0; i < 10; ++i) {
         int x1 = painter.viewport().left()+11;
@@ -158,7 +199,7 @@
 }
 
-void RenderArea::setLevel(int value)
-{
-    level = value;
+void RenderArea::setLevel(qreal value)
+{
+    m_level = value;
     repaint();
 }
@@ -166,84 +207,104 @@
 
 InputTest::InputTest()
-{
-    QWidget *window = new QWidget;
-    QVBoxLayout* layout = new QVBoxLayout;
-
-    canvas = new RenderArea;
-    layout->addWidget(canvas);
-
-    deviceBox = new QComboBox(this);
+    :   m_canvas(0)
+    ,   m_modeButton(0)
+    ,   m_suspendResumeButton(0)
+    ,   m_deviceBox(0)
+    ,   m_device(QAudioDeviceInfo::defaultInputDevice())
+    ,   m_audioInfo(0)
+    ,   m_audioInput(0)
+    ,   m_input(0)
+    ,   m_pullMode(false)
+    ,   m_buffer(BufferSize, 0)
+{
+    initializeWindow();
+    initializeAudio();
+}
+
+InputTest::~InputTest() {}
+
+void InputTest::initializeWindow()
+{
+    QScopedPointer<QWidget> window(new QWidget);
+    QScopedPointer<QVBoxLayout> layout(new QVBoxLayout);
+
+    m_canvas = new RenderArea(this);
+    layout->addWidget(m_canvas);
+
+    m_deviceBox = new QComboBox(this);
     QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
     for(int i = 0; i < devices.size(); ++i)
-        deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i)));
-
-    connect(deviceBox, SIGNAL(activated(int)), SLOT(deviceChanged(int)));
-    layout->addWidget(deviceBox);
-
-    button = new QPushButton(this);
-    button->setText(tr("Click for Push Mode"));
-    connect(button, SIGNAL(clicked()), SLOT(toggleMode()));
-    layout->addWidget(button);
-
-    button2 = new QPushButton(this);
-    button2->setText(tr("Click To Suspend"));
-    connect(button2, SIGNAL(clicked()), SLOT(toggleSuspend()));
-    layout->addWidget(button2);
-
-    window->setLayout(layout);
-    setCentralWidget(window);
-    window->show();
-
-    buffer = new char[BUFFER_SIZE];
-
-    pullMode = true;
-
-    format.setFrequency(8000);
-    format.setChannels(1);
-    format.setSampleSize(16);
-    format.setSampleType(QAudioFormat::SignedInt);
-    format.setByteOrder(QAudioFormat::LittleEndian);
-    format.setCodec("audio/pcm");
+        m_deviceBox->addItem(devices.at(i).deviceName(), qVariantFromValue(devices.at(i)));
+
+    connect(m_deviceBox, SIGNAL(activated(int)), SLOT(deviceChanged(int)));
+    layout->addWidget(m_deviceBox);
+
+    m_modeButton = new QPushButton(this);
+    m_modeButton->setText(PushModeLabel);
+    connect(m_modeButton, SIGNAL(clicked()), SLOT(toggleMode()));
+    layout->addWidget(m_modeButton);
+
+    m_suspendResumeButton = new QPushButton(this);
+    m_suspendResumeButton->setText(SuspendLabel);
+    connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspend()));
+    layout->addWidget(m_suspendResumeButton);
+
+    window->setLayout(layout.data());
+    layout.take(); // ownership transferred
+
+    setCentralWidget(window.data());
+    QWidget *const windowPtr = window.take(); // ownership transferred
+    windowPtr->show();
+}
+
+void InputTest::initializeAudio()
+{
+    m_pullMode = true;
+
+    m_format.setFrequency(8000);
+    m_format.setChannels(1);
+    m_format.setSampleSize(16);
+    m_format.setSampleType(QAudioFormat::SignedInt);
+    m_format.setByteOrder(QAudioFormat::LittleEndian);
+    m_format.setCodec("audio/pcm");
 
     QAudioDeviceInfo info(QAudioDeviceInfo::defaultInputDevice());
-    if (!info.isFormatSupported(format)) {
-        qWarning()<<"default format not supported try to use nearest";
-        format = info.nearestFormat(format);
-    }
-
-    if(format.sampleSize() != 16) {
-        qWarning()<<"audio device doesn't support 16 bit samples, example cannot run";
-        audioInput = 0;
-        button->setDisabled(true);
-        button2->setDisabled(true);
+    if (!info.isFormatSupported(m_format)) {
+        qWarning() << "Default format not supported - trying to use nearest";
+        m_format = info.nearestFormat(m_format);
+    }
+
+    m_audioInfo  = new AudioInfo(m_format, this);
+    connect(m_audioInfo, SIGNAL(update()), SLOT(refreshDisplay()));
+
+    createAudioInput();
+}
+
+void InputTest::createAudioInput()
+{
+    m_audioInput = new QAudioInput(m_device, m_format, this);
+    connect(m_audioInput, SIGNAL(notify()), SLOT(notified()));
+    connect(m_audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
+    m_audioInfo->start();
+    m_audioInput->start(m_audioInfo);
+}
+
+void InputTest::notified()
+{
+    qWarning() << "bytesReady = " << m_audioInput->bytesReady()
+               << ", " << "elapsedUSecs = " <<m_audioInput->elapsedUSecs()
+               << ", " << "processedUSecs = "<<m_audioInput->processedUSecs();
+}
+
+void InputTest::readMore()
+{
+    if(!m_audioInput)
         return;
-    }
-
-    audioInput = new QAudioInput(format,this);
-    connect(audioInput, SIGNAL(notify()), SLOT(status()));
-    connect(audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(state(QAudio::State)));
-    audioinfo  = new AudioInfo(this,audioInput);
-    connect(audioinfo, SIGNAL(update()), SLOT(refreshDisplay()));
-    audioinfo->start();
-    audioInput->start(audioinfo);
-}
-
-InputTest::~InputTest() {}
-
-void InputTest::status()
-{
-    qWarning()<<"bytesReady = "<<audioInput->bytesReady()<<" bytes, elapsedUSecs = "<<audioInput->elapsedUSecs()<<", processedUSecs = "<<audioInput->processedUSecs();
-}
-
-void InputTest::readMore()
-{
-    if(!audioInput)
-        return;
-    qint64 len = audioInput->bytesReady();
+    qint64 len = m_audioInput->bytesReady();
     if(len > 4096)
         len = 4096;
-    qint64 l = input->read(buffer,len);
+    qint64 l = m_input->read(m_buffer.data(), len);
     if(l > 0) {
-        audioinfo->write(buffer,l);
+        m_audioInfo->write(m_buffer.constData(), l);
     }
 }
@@ -252,16 +313,18 @@
 {
     // Change bewteen pull and push modes
-    audioInput->stop();
-
-    if (pullMode) {
-        button->setText(tr("Click for Pull Mode"));
-        input = audioInput->start();
-        connect(input, SIGNAL(readyRead()), SLOT(readMore()));
-        pullMode = false;
+    m_audioInput->stop();
+
+    if (m_pullMode) {
+        m_modeButton->setText(PullModeLabel);
+        m_input = m_audioInput->start();
+        connect(m_input, SIGNAL(readyRead()), SLOT(readMore()));
+        m_pullMode = false;
     } else {
-        button->setText(tr("Click for Push Mode"));
-        pullMode = true;
-        audioInput->start(audioinfo);
-    }
+        m_modeButton->setText(PushModeLabel);
+        m_pullMode = true;
+        m_audioInput->start(m_audioInfo);
+    }
+
+    m_suspendResumeButton->setText(SuspendLabel);
 }
 
@@ -269,44 +332,40 @@
 {
     // toggle suspend/resume
-    if(audioInput->state() == QAudio::SuspendedState) {
+    if(m_audioInput->state() == QAudio::SuspendedState) {
         qWarning() << "status: Suspended, resume()";
-        audioInput->resume();
-        button2->setText("Click To Suspend");
-    } else if (audioInput->state() == QAudio::ActiveState) {
+        m_audioInput->resume();
+        m_suspendResumeButton->setText(SuspendLabel);
+    } else if (m_audioInput->state() == QAudio::ActiveState) {
         qWarning() << "status: Active, suspend()";
-        audioInput->suspend();
-        button2->setText("Click To Resume");
-    } else if (audioInput->state() == QAudio::StoppedState) {
+        m_audioInput->suspend();
+        m_suspendResumeButton->setText(ResumeLabel);
+    } else if (m_audioInput->state() == QAudio::StoppedState) {
         qWarning() << "status: Stopped, resume()";
-        audioInput->resume();
-        button2->setText("Click To Suspend");
-    } else if (audioInput->state() == QAudio::IdleState) {
+        m_audioInput->resume();
+        m_suspendResumeButton->setText(SuspendLabel);
+    } else if (m_audioInput->state() == QAudio::IdleState) {
         qWarning() << "status: IdleState";
     }
 }
 
-void InputTest::state(QAudio::State state)
-{
-    qWarning() << " state=" << state;
+void InputTest::stateChanged(QAudio::State state)
+{
+    qWarning() << "state = " << state;
 }
 
 void InputTest::refreshDisplay()
 {
-    canvas->setLevel(audioinfo->LinearMax());
-    canvas->repaint();
-}
-
-void InputTest::deviceChanged(int idx)
-{
-    audioinfo->stop();
-    audioInput->stop();
-    audioInput->disconnect(this);
-    delete audioInput;
-
-    device = deviceBox->itemData(idx).value<QAudioDeviceInfo>();
-    audioInput = new QAudioInput(device, format, this);
-    connect(audioInput, SIGNAL(notify()), SLOT(status()));
-    connect(audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(state(QAudio::State)));
-    audioinfo->start();
-    audioInput->start(audioinfo);
-}
+    m_canvas->setLevel(m_audioInfo->level());
+    m_canvas->repaint();
+}
+
+void InputTest::deviceChanged(int index)
+{
+    m_audioInfo->stop();
+    m_audioInput->stop();
+    m_audioInput->disconnect(this);
+    delete m_audioInput;
+
+    m_device = m_deviceBox->itemData(index).value<QAudioDeviceInfo>();
+    createAudioInput();
+}
Index: trunk/examples/multimedia/audioinput/audioinput.h
===================================================================
--- trunk/examples/multimedia/audioinput/audioinput.h	(revision 727)
+++ trunk/examples/multimedia/audioinput/audioinput.h	(revision 769)
@@ -46,4 +46,5 @@
 #include <QPushButton>
 #include <QComboBox>
+#include <QByteArray>
 
 #include <qaudioinput.h>
@@ -53,5 +54,5 @@
     Q_OBJECT
 public:
-    AudioInfo(QObject *parent, QAudioInput *device);
+    AudioInfo(const QAudioFormat &format, QObject *parent);
     ~AudioInfo();
 
@@ -59,13 +60,13 @@
     void stop();
 
-    int LinearMax();
+    qreal level() const { return m_level; }
 
     qint64 readData(char *data, qint64 maxlen);
     qint64 writeData(const char *data, qint64 len);
 
-    QAudioInput *input;
-
 private:
-    int m_maxValue;
+    const QAudioFormat m_format;
+    quint16 m_maxAmplitude;
+    qreal m_level; // 0.0 <= m_level <= 1.0
 
 signals:
@@ -81,5 +82,5 @@
     RenderArea(QWidget *parent = 0);
 
-    void setLevel(int value);
+    void setLevel(qreal value);
 
 protected:
@@ -87,6 +88,6 @@
 
 private:
-    int level;
-    QPixmap pixmap;
+    qreal m_level;
+    QPixmap m_pixmap;
 };
 
@@ -98,28 +99,37 @@
     ~InputTest();
 
+private:
+    void initializeWindow();
+    void initializeAudio();
+    void createAudioInput();
+
 private slots:
     void refreshDisplay();
-    void status();
+    void notified();
     void readMore();
     void toggleMode();
     void toggleSuspend();
-    void state(QAudio::State s);
-    void deviceChanged(int idx);
+    void stateChanged(QAudio::State state);
+    void deviceChanged(int index);
 
 private:
-    AudioInfo *audioinfo;
-    QAudioDeviceInfo device;
-    QAudioFormat format;
-    QAudioInput *audioInput;
-    QIODevice *input;
-    RenderArea *canvas;
+    // Owned by layout
+    RenderArea *m_canvas;
+    QPushButton *m_modeButton;
+    QPushButton *m_suspendResumeButton;
+    QComboBox *m_deviceBox;
 
-    bool pullMode;
+    QAudioDeviceInfo m_device;
+    AudioInfo *m_audioInfo;
+    QAudioFormat m_format;
+    QAudioInput *m_audioInput;
+    QIODevice *m_input;
+    bool m_pullMode;
+    QByteArray m_buffer;
 
-    QPushButton *button;
-    QPushButton *button2;
-    QComboBox *deviceBox;
-
-    char *buffer;
+    static const QString PushModeLabel;
+    static const QString PullModeLabel;
+    static const QString SuspendLabel;
+    static const QString ResumeLabel;
 };
 
Index: trunk/examples/multimedia/audioinput/audioinput.pro
===================================================================
--- trunk/examples/multimedia/audioinput/audioinput.pro	(revision 727)
+++ trunk/examples/multimedia/audioinput/audioinput.pro	(revision 769)
@@ -13,4 +13,5 @@
 symbian {
     TARGET.UID3 = 0xA000D7BF
+    TARGET.CAPABILITY += UserEnvironment
     include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
 }
Index: trunk/examples/multimedia/audiooutput/audiooutput.cpp
===================================================================
--- trunk/examples/multimedia/audiooutput/audiooutput.cpp	(revision 727)
+++ trunk/examples/multimedia/audiooutput/audiooutput.cpp	(revision 769)
@@ -45,28 +45,32 @@
 #include <QAudioOutput>
 #include <QAudioDeviceInfo>
+#include <QtCore/qmath.h>
+#include <QtCore/qendian.h>
 #include "audiooutput.h"
 
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#define SECONDS     1
-#define FREQ        600
-#define SYSTEM_FREQ 44100
-
-Generator::Generator(QObject *parent)
-    :QIODevice( parent )
-{
-    finished = false;
-    buffer = new char[SECONDS*SYSTEM_FREQ*4+1000];
-    t=buffer;
-    len=fillData(t,FREQ,SECONDS); /* mono FREQHz sine */
-    pos   = 0;
-    total = len;
+const QString AudioTest::PushModeLabel(tr("Enable push mode"));
+const QString AudioTest::PullModeLabel(tr("Enable pull mode"));
+const QString AudioTest::SuspendLabel(tr("Suspend playback"));
+const QString AudioTest::ResumeLabel(tr("Resume playback"));
+
+const int DurationSeconds = 1;
+const int ToneFrequencyHz = 600;
+const int DataFrequencyHz = 44100;
+const int BufferSize      = 32768;
+
+
+Generator::Generator(const QAudioFormat &format,
+                     qint64 durationUs,
+                     int frequency,
+                     QObject *parent)
+    :   QIODevice(parent)
+    ,   m_pos(0)
+{
+    generateData(format, durationUs, frequency);
 }
 
 Generator::~Generator()
 {
-    delete [] buffer;
+
 }
 
@@ -78,45 +82,63 @@
 void Generator::stop()
 {
+    m_pos = 0;
     close();
 }
 
-int Generator::putShort(char *t, unsigned int value)
-{
-    *(unsigned char *)(t++)=value&255;
-    *(unsigned char *)(t)=(value/256)&255;
-    return 2;
-}
-
-int Generator::fillData(char *start, int frequency, int seconds)
-{
-    int i, len=0;
-    int value;
-    for(i=0; i<seconds*SYSTEM_FREQ; i++) {
-        value=(int)(32767.0*sin(2.0*M_PI*((double)(i))*(double)(frequency)/SYSTEM_FREQ));
-        putShort(start, value);
-        start += 4;
-        len+=2;
-    }
-    return len;
-}
-
-qint64 Generator::readData(char *data, qint64 maxlen)
-{
-    int len = maxlen;
-    if (len > 16384)
-        len = 16384;
-
-    if (len < (SECONDS*SYSTEM_FREQ*2)-pos) {
-        // Normal
-        memcpy(data,t+pos,len);
-        pos+=len;
-        return len;
-    } else {
-        // Whats left and reset to start
-        qint64 left = (SECONDS*SYSTEM_FREQ*2)-pos;
-        memcpy(data,t+pos,left);
-        pos=0;
-        return left;
-    }
+void Generator::generateData(const QAudioFormat &format, qint64 durationUs, int frequency)
+{
+    const int channelBytes = format.sampleSize() / 8;
+    const int sampleBytes = format.channels() * channelBytes;
+
+    qint64 length = (format.frequency() * format.channels() * (format.sampleSize() / 8))
+                        * durationUs / 100000;
+
+    Q_ASSERT(length % sampleBytes == 0);
+    Q_UNUSED(sampleBytes) // suppress warning in release builds
+
+    m_buffer.resize(length);
+    unsigned char *ptr = reinterpret_cast<unsigned char *>(m_buffer.data());
+    int sampleIndex = 0;
+
+    while (length) {
+        const qreal x = qSin(2 * M_PI * frequency * qreal(sampleIndex % format.frequency()) / format.frequency());
+        for (int i=0; i<format.channels(); ++i) {
+            if (format.sampleSize() == 8 && format.sampleType() == QAudioFormat::UnSignedInt) {
+                const quint8 value = static_cast<quint8>((1.0 + x) / 2 * 255);
+                *reinterpret_cast<quint8*>(ptr) = value;
+            } else if (format.sampleSize() == 8 && format.sampleType() == QAudioFormat::SignedInt) {
+                const qint8 value = static_cast<qint8>(x * 127);
+                *reinterpret_cast<quint8*>(ptr) = value;
+            } else if (format.sampleSize() == 16 && format.sampleType() == QAudioFormat::UnSignedInt) {
+                quint16 value = static_cast<quint16>((1.0 + x) / 2 * 65535);
+                if (format.byteOrder() == QAudioFormat::LittleEndian)
+                    qToLittleEndian<quint16>(value, ptr);
+                else
+                    qToBigEndian<quint16>(value, ptr);
+            } else if (format.sampleSize() == 16 && format.sampleType() == QAudioFormat::SignedInt) {
+                qint16 value = static_cast<qint16>(x * 32767);
+                if (format.byteOrder() == QAudioFormat::LittleEndian)
+                    qToLittleEndian<qint16>(value, ptr);
+                else
+                    qToBigEndian<qint16>(value, ptr);
+            }
+
+            ptr += channelBytes;
+            length -= channelBytes;
+        }
+        ++sampleIndex;
+    }
+}
+
+qint64 Generator::readData(char *data, qint64 len)
+{
+    qint64 total = 0;
+    while (len - total) {
+        const qint64 chunk = qMin((m_buffer.size() - m_pos), len - total);
+        memcpy(data, m_buffer.constData() + m_pos, chunk);
+        m_pos = (m_pos + chunk) % m_buffer.size();
+        total += chunk;
+    }
+    return total;
 }
 
@@ -129,157 +151,165 @@
 }
 
+qint64 Generator::bytesAvailable() const
+{
+    return m_buffer.size() + QIODevice::bytesAvailable();
+}
+
 AudioTest::AudioTest()
-{
-    QWidget *window = new QWidget;
-    QVBoxLayout* layout = new QVBoxLayout;
-
-    deviceBox = new QComboBox(this);
+    :   m_pullTimer(new QTimer(this))
+    ,   m_modeButton(0)
+    ,   m_suspendResumeButton(0)
+    ,   m_deviceBox(0)
+    ,   m_device(QAudioDeviceInfo::defaultOutputDevice())
+    ,   m_generator(0)
+    ,   m_audioOutput(0)
+    ,   m_output(0)
+    ,   m_buffer(BufferSize, 0)
+{
+    initializeWindow();
+    initializeAudio();
+}
+
+void AudioTest::initializeWindow()
+{
+    QScopedPointer<QWidget> window(new QWidget);
+    QScopedPointer<QVBoxLayout> layout(new QVBoxLayout);
+
+    m_deviceBox = new QComboBox(this);
     foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput))
-        deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
-    connect(deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
-    layout->addWidget(deviceBox);
-
-    button = new QPushButton(this);
-    button->setText(tr("Click for Push Mode"));
-    connect(button,SIGNAL(clicked()),SLOT(toggle()));
-    layout->addWidget(button);
-
-    button2 = new QPushButton(this);
-    button2->setText(tr("Click To Suspend"));
-    connect(button2,SIGNAL(clicked()),SLOT(togglePlay()));
-    layout->addWidget(button2);
-
-    window->setLayout(layout);
-    setCentralWidget(window);
-    window->show();
-
-    buffer = new char[BUFFER_SIZE];
-
-    gen = new Generator(this);
-
-    pullMode = true;
-
-    timer = new QTimer(this);
-    connect(timer,SIGNAL(timeout()),SLOT(writeMore()));
-
-    gen->start();
-
-    settings.setFrequency(SYSTEM_FREQ);
-    settings.setChannels(1);
-    settings.setSampleSize(16);
-    settings.setCodec("audio/pcm");
-    settings.setByteOrder(QAudioFormat::LittleEndian);
-    settings.setSampleType(QAudioFormat::SignedInt);
+        m_deviceBox->addItem(deviceInfo.deviceName(), qVariantFromValue(deviceInfo));
+    connect(m_deviceBox,SIGNAL(activated(int)),SLOT(deviceChanged(int)));
+    layout->addWidget(m_deviceBox);
+
+    m_modeButton = new QPushButton(this);
+    m_modeButton->setText(PushModeLabel);
+    connect(m_modeButton, SIGNAL(clicked()), SLOT(toggleMode()));
+    layout->addWidget(m_modeButton);
+
+    m_suspendResumeButton = new QPushButton(this);
+    m_suspendResumeButton->setText(SuspendLabel);
+    connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspendResume()));
+    layout->addWidget(m_suspendResumeButton);
+
+    window->setLayout(layout.data());
+    layout.take(); // ownership transferred
+
+    setCentralWidget(window.data());
+    QWidget *const windowPtr = window.take(); // ownership transferred
+    windowPtr->show();
+}
+
+void AudioTest::initializeAudio()
+{
+    connect(m_pullTimer, SIGNAL(timeout()), SLOT(pullTimerExpired()));
+
+    m_pullMode = true;
+
+    m_format.setFrequency(DataFrequencyHz);
+    m_format.setChannels(1);
+    m_format.setSampleSize(16);
+    m_format.setCodec("audio/pcm");
+    m_format.setByteOrder(QAudioFormat::LittleEndian);
+    m_format.setSampleType(QAudioFormat::SignedInt);
 
     QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
-    if (!info.isFormatSupported(settings)) {
-        qWarning()<<"default format not supported try to use nearest";
-        settings = info.nearestFormat(settings);
-    }
-
-    if(settings.sampleSize() != 16) {
-        qWarning()<<"audio device doesn't support 16 bit samples, example cannot run";
-        button->setDisabled(true);
-        button2->setDisabled(true);
-        audioOutput = 0;
-        return;
-    }
-
-    audioOutput = new QAudioOutput(settings,this);
-    connect(audioOutput,SIGNAL(notify()),SLOT(status()));
-    connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
-
-    audioOutput->start(gen);
+    if (!info.isFormatSupported(m_format)) {
+        qWarning() << "Default format not supported - trying to use nearest";
+        m_format = info.nearestFormat(m_format);
+    }
+
+    m_generator = new Generator(m_format, DurationSeconds*1000000, ToneFrequencyHz, this);
+
+    createAudioOutput();
+}
+
+void AudioTest::createAudioOutput()
+{
+    delete m_audioOutput;
+    m_audioOutput = 0;
+    m_audioOutput = new QAudioOutput(m_device, m_format, this);
+    connect(m_audioOutput, SIGNAL(notify()), SLOT(notified()));
+    connect(m_audioOutput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
+    m_generator->start();
+    m_audioOutput->start(m_generator);
 }
 
 AudioTest::~AudioTest()
 {
-    delete [] buffer;
-}
-
-void AudioTest::deviceChanged(int idx)
-{
-    timer->stop();
-    gen->stop();
-    audioOutput->stop();
-    audioOutput->disconnect(this);
-    delete audioOutput;
-
-    device = deviceBox->itemData(idx).value<QAudioDeviceInfo>();
-    audioOutput = new QAudioOutput(device,settings,this);
-    connect(audioOutput,SIGNAL(notify()),SLOT(status()));
-    connect(audioOutput,SIGNAL(stateChanged(QAudio::State)),SLOT(state(QAudio::State)));
-    gen->start();
-    audioOutput->start(gen);
-}
-
-void AudioTest::status()
-{
-    qWarning() << "byteFree = " << audioOutput->bytesFree() << " bytes, elapsedUSecs = " << audioOutput->elapsedUSecs() << ", processedUSecs = " << audioOutput->processedUSecs();
-}
-
-void AudioTest::writeMore()
-{
-    if (!audioOutput)
-        return;
-
-    if (audioOutput->state() == QAudio::StoppedState)
-        return;
-
-    int    l;
-    int    out;
-
-    int chunks = audioOutput->bytesFree()/audioOutput->periodSize();
-    while(chunks) {
-       l = gen->read(buffer,audioOutput->periodSize());
-       if (l > 0)
-           out = output->write(buffer,l);
-       if (l != audioOutput->periodSize())
-	   break;
-       chunks--;
-    }
-}
-
-void AudioTest::toggle()
-{
-    // Change between pull and push modes
-
-    timer->stop();
-    audioOutput->stop();
-
-    if (pullMode) {
-        button->setText("Click for Pull Mode");
-        output = audioOutput->start();
-        pullMode = false;
-        timer->start(20);
+
+}
+
+void AudioTest::deviceChanged(int index)
+{
+    m_pullTimer->stop();
+    m_generator->stop();
+    m_audioOutput->stop();
+    m_audioOutput->disconnect(this);
+    m_device = m_deviceBox->itemData(index).value<QAudioDeviceInfo>();
+    createAudioOutput();
+}
+
+void AudioTest::notified()
+{
+    qWarning() << "bytesFree = " << m_audioOutput->bytesFree()
+               << ", " << "elapsedUSecs = " << m_audioOutput->elapsedUSecs()
+               << ", " << "processedUSecs = " << m_audioOutput->processedUSecs();
+}
+
+void AudioTest::pullTimerExpired()
+{
+    if (m_audioOutput && m_audioOutput->state() != QAudio::StoppedState) {
+        int chunks = m_audioOutput->bytesFree()/m_audioOutput->periodSize();
+        while (chunks) {
+           const qint64 len = m_generator->read(m_buffer.data(), m_audioOutput->periodSize());
+           if (len)
+               m_output->write(m_buffer.data(), len);
+           if (len != m_audioOutput->periodSize())
+               break;
+           --chunks;
+        }
+    }
+}
+
+void AudioTest::toggleMode()
+{
+    m_pullTimer->stop();
+    m_audioOutput->stop();
+
+    if (m_pullMode) {
+        m_modeButton->setText(PullModeLabel);
+        m_output = m_audioOutput->start();
+        m_pullMode = false;
+        m_pullTimer->start(20);
     } else {
-        button->setText("Click for Push Mode");
-        pullMode = true;
-        audioOutput->start(gen);
-    }
-}
-
-void AudioTest::togglePlay()
-{
-    // toggle suspend/resume
-    if (audioOutput->state() == QAudio::SuspendedState) {
+        m_modeButton->setText(PushModeLabel);
+        m_pullMode = true;
+        m_audioOutput->start(m_generator);
+    }
+
+    m_suspendResumeButton->setText(SuspendLabel);
+}
+
+void AudioTest::toggleSuspendResume()
+{
+    if (m_audioOutput->state() == QAudio::SuspendedState) {
         qWarning() << "status: Suspended, resume()";
-        audioOutput->resume();
-        button2->setText("Click To Suspend");
-    } else if (audioOutput->state() == QAudio::ActiveState) {
+        m_audioOutput->resume();
+        m_suspendResumeButton->setText(SuspendLabel);
+    } else if (m_audioOutput->state() == QAudio::ActiveState) {
         qWarning() << "status: Active, suspend()";
-        audioOutput->suspend();
-        button2->setText("Click To Resume");
-    } else if (audioOutput->state() == QAudio::StoppedState) {
+        m_audioOutput->suspend();
+        m_suspendResumeButton->setText(ResumeLabel);
+    } else if (m_audioOutput->state() == QAudio::StoppedState) {
         qWarning() << "status: Stopped, resume()";
-        audioOutput->resume();
-        button2->setText("Click To Suspend");
-    } else if (audioOutput->state() == QAudio::IdleState) {
+        m_audioOutput->resume();
+        m_suspendResumeButton->setText(SuspendLabel);
+    } else if (m_audioOutput->state() == QAudio::IdleState) {
         qWarning() << "status: IdleState";
     }
 }
 
-void AudioTest::state(QAudio::State state)
-{
-    qWarning() << " state=" << state;
-}
+void AudioTest::stateChanged(QAudio::State state)
+{
+    qWarning() << "state = " << state;
+}
Index: trunk/examples/multimedia/audiooutput/audiooutput.h
===================================================================
--- trunk/examples/multimedia/audiooutput/audiooutput.h	(revision 727)
+++ trunk/examples/multimedia/audiooutput/audiooutput.h	(revision 769)
@@ -42,6 +42,4 @@
 #include <math.h>
 
-#define BUFFER_SIZE 32768
-
 #include <QObject>
 #include <QMainWindow>
@@ -50,4 +48,5 @@
 #include <QPushButton>
 #include <QComboBox>
+#include <QByteArray>
 
 #include <QAudioOutput>
@@ -57,5 +56,5 @@
     Q_OBJECT
 public:
-    Generator(QObject *parent);
+    Generator(const QAudioFormat &format, qint64 durationUs, int frequency, QObject *parent);
     ~Generator();
 
@@ -63,18 +62,14 @@
     void stop();
 
-    char *t;
-    int  len;
-    int  pos;
-    int  total;
-    char *buffer;
-    bool finished;
-    int  chunk_size;
-
     qint64 readData(char *data, qint64 maxlen);
     qint64 writeData(const char *data, qint64 len);
+    qint64 bytesAvailable() const;
 
 private:
-    int putShort(char *t, unsigned int value);
-    int fillData(char *start, int frequency, int seconds);
+    void generateData(const QAudioFormat &format, qint64 durationUs, int frequency);
+
+private:
+    qint64 m_pos;
+    QByteArray m_buffer;
 };
 
@@ -86,25 +81,38 @@
     ~AudioTest();
 
-    QAudioDeviceInfo  device;
-    Generator*        gen;
-    QAudioOutput*     audioOutput;
-    QIODevice*        output;
-    QTimer*           timer;
-    QAudioFormat      settings;
+private:
+    void initializeWindow();
+    void initializeAudio();
+    void createAudioOutput();
 
-    bool              pullMode;
-    char*             buffer;
+private:
+    QTimer*          m_pullTimer;
 
-    QPushButton*      button;
-    QPushButton*      button2;
-    QComboBox*     deviceBox;
+    // Owned by layout
+    QPushButton*     m_modeButton;
+    QPushButton*     m_suspendResumeButton;
+    QComboBox*       m_deviceBox;
+
+    QAudioDeviceInfo m_device;
+    Generator*       m_generator;
+    QAudioOutput*    m_audioOutput;
+    QIODevice*       m_output; // not owned
+    QAudioFormat     m_format;
+
+    bool             m_pullMode;
+    QByteArray       m_buffer;
+
+    static const QString PushModeLabel;
+    static const QString PullModeLabel;
+    static const QString SuspendLabel;
+    static const QString ResumeLabel;
 
 private slots:
-    void status();
-    void writeMore();
-    void toggle();
-    void togglePlay();
-    void state(QAudio::State s);
-    void deviceChanged(int idx);
+    void notified();
+    void pullTimerExpired();
+    void toggleMode();
+    void toggleSuspendResume();
+    void stateChanged(QAudio::State state);
+    void deviceChanged(int index);
 };
 
Index: trunk/examples/network/fortuneclient/fortuneclient.pro
===================================================================
--- trunk/examples/network/fortuneclient/fortuneclient.pro	(revision 727)
+++ trunk/examples/network/fortuneclient/fortuneclient.pro	(revision 769)
@@ -13,5 +13,5 @@
     include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
     HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
-    LIBS += -lesock
+    LIBS += -lesock -lcommdb -linsock # For IAP selection
     TARGET.CAPABILITY = "NetworkServices ReadUserData WriteUserData"
     TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
Index: trunk/examples/network/fortuneserver/fortuneserver.pro
===================================================================
--- trunk/examples/network/fortuneserver/fortuneserver.pro	(revision 727)
+++ trunk/examples/network/fortuneserver/fortuneserver.pro	(revision 769)
@@ -14,5 +14,5 @@
     include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
     HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
-    LIBS += -lesock
+    LIBS += -lesock -lcommdb -linsock # For IAP selection
     TARGET.CAPABILITY = "All -TCB"
     TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
Index: trunk/examples/network/googlesuggest/googlesuggest.cpp
===================================================================
--- trunk/examples/network/googlesuggest/googlesuggest.cpp	(revision 727)
+++ trunk/examples/network/googlesuggest/googlesuggest.cpp	(revision 769)
@@ -233,2 +233,3 @@
 }
 //! [9]
+
Index: trunk/examples/network/googlesuggest/searchbox.cpp
===================================================================
--- trunk/examples/network/googlesuggest/searchbox.cpp	(revision 727)
+++ trunk/examples/network/googlesuggest/searchbox.cpp	(revision 769)
@@ -71,2 +71,3 @@
 }
 //! [2]
+
Index: trunk/examples/network/http/httpwindow.cpp
===================================================================
--- trunk/examples/network/http/httpwindow.cpp	(revision 727)
+++ trunk/examples/network/http/httpwindow.cpp	(revision 769)
@@ -50,7 +50,7 @@
 {
 #ifndef QT_NO_OPENSSL
-    urlLineEdit = new QLineEdit("https://");
+    urlLineEdit = new QLineEdit("https://qt.nokia.com/");
 #else
-    urlLineEdit = new QLineEdit("http://");
+    urlLineEdit = new QLineEdit("http://qt.nokia.com/");
 #endif
 
@@ -71,19 +71,12 @@
     progressDialog = new QProgressDialog(this);
 
-    http = new QHttp(this);
-
     connect(urlLineEdit, SIGNAL(textChanged(QString)),
             this, SLOT(enableDownloadButton()));
-    connect(http, SIGNAL(requestFinished(int,bool)),
-            this, SLOT(httpRequestFinished(int,bool)));
-    connect(http, SIGNAL(dataReadProgress(int,int)),
-            this, SLOT(updateDataReadProgress(int,int)));
-    connect(http, SIGNAL(responseHeaderReceived(QHttpResponseHeader)),
-            this, SLOT(readResponseHeader(QHttpResponseHeader)));
-    connect(http, SIGNAL(authenticationRequired(QString,quint16,QAuthenticator*)),
-            this, SLOT(slotAuthenticationRequired(QString,quint16,QAuthenticator*)));
+
+    connect(&qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
+            this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*)));
 #ifndef QT_NO_OPENSSL
-    connect(http, SIGNAL(sslErrors(QList<QSslError>)),
-            this, SLOT(sslErrors(QList<QSslError>)));
+    connect(&qnam, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),
+            this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
 #endif
     connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload()));
@@ -105,7 +98,19 @@
 }
 
+void HttpWindow::startRequest(QUrl url)
+{
+    reply = qnam.get(QNetworkRequest(url));
+    connect(reply, SIGNAL(finished()),
+            this, SLOT(httpFinished()));
+    connect(reply, SIGNAL(readyRead()),
+            this, SLOT(httpReadyRead()));
+    connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
+            this, SLOT(updateDataReadProgress(qint64,qint64)));
+}
+
 void HttpWindow::downloadFile()
 {
-    QUrl url(urlLineEdit->text());
+    url = urlLineEdit->text();
+
     QFileInfo fileInfo(url.path());
     QString fileName = fileInfo.fileName();
@@ -133,19 +138,12 @@
     }
 
-    QHttp::ConnectionMode mode = url.scheme().toLower() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp;
-    http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
-    
-    if (!url.userName().isEmpty())
-        http->setUser(url.userName(), url.password());
-
-    httpRequestAborted = false;
-    QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/");
-    if (path.isEmpty())
-        path = "/";
-    httpGetId = http->get(path, file);
 
     progressDialog->setWindowTitle(tr("HTTP"));
     progressDialog->setLabelText(tr("Downloading %1.").arg(fileName));
     downloadButton->setEnabled(false);
+
+    // schedule the request
+    httpRequestAborted = false;
+    startRequest(url);
 }
 
@@ -154,12 +152,10 @@
     statusLabel->setText(tr("Download canceled."));
     httpRequestAborted = true;
-    http->abort();
+    reply->abort();
     downloadButton->setEnabled(true);
 }
 
-void HttpWindow::httpRequestFinished(int requestId, bool error)
-{
-    if (requestId != httpGetId)
-        return;
+void HttpWindow::httpFinished()
+{
     if (httpRequestAborted) {
         if (file) {
@@ -169,52 +165,56 @@
             file = 0;
         }
-
+        reply->deleteLater();
         progressDialog->hide();
         return;
     }
 
-    if (requestId != httpGetId)
-        return;
-
     progressDialog->hide();
+    file->flush();
     file->close();
 
-    if (error) {
+
+    QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
+    if (reply->error()) {
         file->remove();
         QMessageBox::information(this, tr("HTTP"),
                                  tr("Download failed: %1.")
-                                 .arg(http->errorString()));
+                                 .arg(reply->errorString()));
+        downloadButton->setEnabled(true);
+    } else if (!redirectionTarget.isNull()) {        
+        QUrl newUrl = url.resolved(redirectionTarget.toUrl());
+        if (QMessageBox::question(this, tr("HTTP"),
+                                  tr("Redirect to %1 ?").arg(newUrl.toString()),
+                                  QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
+            url = newUrl;
+            reply->deleteLater();
+            file->open(QIODevice::WriteOnly);
+            file->resize(0);
+            startRequest(url);
+            return;
+        }
     } else {
         QString fileName = QFileInfo(QUrl(urlLineEdit->text()).path()).fileName();
         statusLabel->setText(tr("Downloaded %1 to current directory.").arg(fileName));
-    }
-
-    downloadButton->setEnabled(true);
+        downloadButton->setEnabled(true);
+    }
+
+    reply->deleteLater();
+    reply = 0;
     delete file;
     file = 0;
 }
 
-void HttpWindow::readResponseHeader(const QHttpResponseHeader &responseHeader)
-{
-    switch (responseHeader.statusCode()) {
-    case 200:                   // Ok
-    case 301:                   // Moved Permanently
-    case 302:                   // Found
-    case 303:                   // See Other
-    case 307:                   // Temporary Redirect
-        // these are not error conditions
-        break;
-
-    default:
-        QMessageBox::information(this, tr("HTTP"),
-                                 tr("Download failed: %1.")
-                                 .arg(responseHeader.reasonPhrase()));
-        httpRequestAborted = true;
-        progressDialog->hide();
-        http->abort();
-    }
-}
-
-void HttpWindow::updateDataReadProgress(int bytesRead, int totalBytes)
+void HttpWindow::httpReadyRead()
+{
+    // this slot gets called everytime the QNetworkReply has new data.
+    // We read all of its new data and write it into the file.
+    // That way we use less RAM than when reading it at the finished()
+    // signal of the QNetworkReply
+    if (file)
+        file->write(reply->readAll());
+}
+
+void HttpWindow::updateDataReadProgress(qint64 bytesRead, qint64 totalBytes)
 {
     if (httpRequestAborted)
@@ -230,5 +230,5 @@
 }
 
-void HttpWindow::slotAuthenticationRequired(const QString &hostName, quint16, QAuthenticator *authenticator)
+void HttpWindow::slotAuthenticationRequired(QNetworkReply*,QAuthenticator *authenticator)
 {
     QDialog dlg;
@@ -236,6 +236,11 @@
     ui.setupUi(&dlg);
     dlg.adjustSize();
-    ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(hostName));
-    
+    ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(url.host()));
+
+    // Did the URL have information? Fill the UI
+    // This is only relevant if the URL-supplied credentials were wrong
+    ui.userEdit->setText(url.userName());
+    ui.passwordEdit->setText(url.password());
+
     if (dlg.exec() == QDialog::Accepted) {
         authenticator->setUser(ui.userEdit->text());
@@ -245,5 +250,5 @@
 
 #ifndef QT_NO_OPENSSL
-void HttpWindow::sslErrors(const QList<QSslError> &errors)
+void HttpWindow::sslErrors(QNetworkReply*,const QList<QSslError> &errors)
 {
     QString errorString;
@@ -254,8 +259,8 @@
     }
     
-    if (QMessageBox::warning(this, tr("HTTP Example"),
+    if (QMessageBox::warning(this, tr("HTTP"),
                              tr("One or more SSL errors has occurred: %1").arg(errorString),
                              QMessageBox::Ignore | QMessageBox::Abort) == QMessageBox::Ignore) {
-        http->ignoreSslErrors();
+        reply->ignoreSslErrors();
     }
 }
Index: trunk/examples/network/http/httpwindow.h
===================================================================
--- trunk/examples/network/http/httpwindow.h	(revision 727)
+++ trunk/examples/network/http/httpwindow.h	(revision 769)
@@ -44,10 +44,10 @@
 
 #include <QDialog>
+#include <QNetworkAccessManager>
+#include <QUrl>
 
 QT_BEGIN_NAMESPACE
 class QDialogButtonBox;
 class QFile;
-class QHttp;
-class QHttpResponseHeader;
 class QLabel;
 class QLineEdit;
@@ -56,4 +56,7 @@
 class QSslError;
 class QAuthenticator;
+class QNetworkReply;
+
+
 QT_END_NAMESPACE
 
@@ -65,14 +68,16 @@
     HttpWindow(QWidget *parent = 0);
 
+    void startRequest(QUrl url);
+
 private slots:
     void downloadFile();
     void cancelDownload();
-    void httpRequestFinished(int requestId, bool error);
-    void readResponseHeader(const QHttpResponseHeader &responseHeader);
-    void updateDataReadProgress(int bytesRead, int totalBytes);
+    void httpFinished();
+    void httpReadyRead();
+    void updateDataReadProgress(qint64 bytesRead, qint64 totalBytes);
     void enableDownloadButton();
-    void slotAuthenticationRequired(const QString &, quint16, QAuthenticator *);
+    void slotAuthenticationRequired(QNetworkReply*,QAuthenticator *);
 #ifndef QT_NO_OPENSSL
-    void sslErrors(const QList<QSslError> &errors);
+    void sslErrors(QNetworkReply*,const QList<QSslError> &errors);
 #endif
 
@@ -86,5 +91,7 @@
     QDialogButtonBox *buttonBox;
 
-    QHttp *http;
+    QUrl url;
+    QNetworkAccessManager qnam;
+    QNetworkReply *reply;
     QFile *file;
     int httpGetId;
Index: trunk/examples/network/http/main.cpp
===================================================================
--- trunk/examples/network/http/main.cpp	(revision 727)
+++ trunk/examples/network/http/main.cpp	(revision 769)
@@ -47,5 +47,4 @@
 {
     QApplication app(argc, argv);
-    qWarning("The usage of QHttp is not recommended anymore, please use QNetworkAccessManager.");
     HttpWindow httpWin;
     httpWin.show();
Index: trunk/examples/network/loopback/dialog.cpp
===================================================================
--- trunk/examples/network/loopback/dialog.cpp	(revision 727)
+++ trunk/examples/network/loopback/dialog.cpp	(revision 769)
@@ -45,10 +45,10 @@
 #include "dialog.h"
 
-#if !defined(Q_OS_WINCE)
+#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
 static const int TotalBytes = 50 * 1024 * 1024;
 #else
 static const int TotalBytes = 5 * 1024 * 1024;
 #endif
-static const int PayloadSize = 65536;
+static const int PayloadSize = 64 * 1024; // 64 KB
 
 Dialog::Dialog(QWidget *parent)
@@ -131,4 +131,5 @@
 void Dialog::startTransfer()
 {
+    // called when the TCP client connected to the loopback server
     bytesToWrite = TotalBytes - (int)tcpClient.write(QByteArray(PayloadSize, '@'));
     clientStatusLabel->setText(tr("Connected"));
@@ -156,6 +157,9 @@
 void Dialog::updateClientProgress(qint64 numBytes)
 {
+    // callen when the TCP client has written some bytes
     bytesWritten += (int)numBytes;
-    if (bytesToWrite > 0)
+
+    // only write more if not finished and when the Qt write buffer is below a certain size.
+    if (bytesToWrite > 0 && tcpClient.bytesToWrite() <= 4*PayloadSize)
         bytesToWrite -= (int)tcpClient.write(QByteArray(qMin(bytesToWrite, PayloadSize), '@'));
 
Index: trunk/examples/network/network-chat/chatdialog.cpp
===================================================================
--- trunk/examples/network/network-chat/chatdialog.cpp	(revision 727)
+++ trunk/examples/network/network-chat/chatdialog.cpp	(revision 769)
@@ -80,5 +80,5 @@
     cursor.movePosition(QTextCursor::End);
     QTextTable *table = cursor.insertTable(1, 2, tableFormat);
-    table->cellAt(0, 0).firstCursorPosition().insertText("<" + from + "> ");
+    table->cellAt(0, 0).firstCursorPosition().insertText('<' + from + "> ");
     table->cellAt(0, 1).firstCursorPosition().insertText(message);
     QScrollBar *bar = textEdit->verticalScrollBar();
Index: trunk/examples/network/network-chat/client.cpp
===================================================================
--- trunk/examples/network/network-chat/client.cpp	(revision 727)
+++ trunk/examples/network/network-chat/client.cpp	(revision 769)
@@ -70,6 +70,6 @@
 QString Client::nickName() const
 {
-    return QString(peerManager->userName()) + "@" + QHostInfo::localHostName()
-           + ":" + QString::number(server.serverPort());
+    return QString(peerManager->userName()) + '@' + QHostInfo::localHostName()
+           + ':' + QString::number(server.serverPort());
 }
 
Index: trunk/examples/network/network-chat/connection.cpp
===================================================================
--- trunk/examples/network/network-chat/connection.cpp	(revision 727)
+++ trunk/examples/network/network-chat/connection.cpp	(revision 769)
@@ -84,5 +84,5 @@
 
     QByteArray msg = message.toUtf8();
-    QByteArray data = "MESSAGE " + QByteArray::number(msg.size()) + " " + msg;
+    QByteArray data = "MESSAGE " + QByteArray::number(msg.size()) + ' ' + msg;
     return write(data) == data.size();
 }
@@ -119,5 +119,5 @@
         }
 
-        username = QString(buffer) + "@" + peerAddress().toString() + ":"
+        username = QString(buffer) + '@' + peerAddress().toString() + ':'
                    + QString::number(peerPort());
         currentDataType = Undefined;
@@ -163,5 +163,5 @@
 {
     QByteArray greeting = greetingMessage.toUtf8();
-    QByteArray data = "GREETING " + QByteArray::number(greeting.size()) + " " + greeting;
+    QByteArray data = "GREETING " + QByteArray::number(greeting.size()) + ' ' + greeting;
     if (write(data) == data.size())
         isGreetingMessageSent = true;
Index: trunk/examples/network/network-chat/network-chat.pro
===================================================================
--- trunk/examples/network/network-chat/network-chat.pro	(revision 727)
+++ trunk/examples/network/network-chat/network-chat.pro	(revision 769)
@@ -22,5 +22,6 @@
     include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
     HEADERS += $$QT_SOURCE_TREE/examples/network/qftp/sym_iap_util.h
-    LIBS += -lesock -lconnmon -lcharconv -linsock
+    LIBS += -lesock -lcommdb -linsock # For IAP selection
+    LIBS += -lcharconv
     TARGET.CAPABILITY = "NetworkServices ReadUserData WriteUserData"
     TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
Index: trunk/examples/network/network-chat/peermanager.cpp
===================================================================
--- trunk/examples/network/network-chat/peermanager.cpp	(revision 727)
+++ trunk/examples/network/network-chat/peermanager.cpp	(revision 769)
@@ -62,5 +62,5 @@
         int index = environment.indexOf(QRegExp(string));
         if (index != -1) {
-            QStringList stringList = environment.at(index).split("=");
+            QStringList stringList = environment.at(index).split('=');
             if (stringList.size() == 2) {
                 username = stringList.at(1).toUtf8();
Index: trunk/examples/network/qftp/ftpwindow.cpp
===================================================================
--- trunk/examples/network/qftp/ftpwindow.cpp	(revision 727)
+++ trunk/examples/network/qftp/ftpwindow.cpp	(revision 769)
@@ -325,5 +325,6 @@
         fileList->clear();
         isDirectory.clear();
-        currentPath += "/" + name;
+        currentPath += '/';
+        currentPath += name;
         ftp->cd(name);
         ftp->list();
Index: trunk/examples/network/qftp/sym_iap_util.h
===================================================================
--- trunk/examples/network/qftp/sym_iap_util.h	(revision 727)
+++ trunk/examples/network/qftp/sym_iap_util.h	(revision 769)
@@ -61,4 +61,5 @@
 
 _LIT(KIapNameSetting, "IAP\\Name");             // text - mandatory
+_LIT(KIapTableIdField, "IAP\Id");
 _LIT(KIapDialogPref, "IAP\\DialogPref");        // TUnit32 - optional
 _LIT(KIapService, "IAP\\IAPService");           // TUnit32 - mandatory
@@ -299,5 +300,5 @@
     return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length());
 #else
-    return QString::fromUtf16(aDescriptor.Ptr(), aDescriptor.Length());
+    return QString((const QChar *)aDescriptor.Ptr(), aDescriptor.Length());
 #endif
 }
@@ -368,9 +369,12 @@
 
     socketServ.Connect();
+
+    TCommDbConnPref prefs;
+    prefs.SetDialogPreference(ECommDbDialogPrefPrompt);
+
     connection.Open(socketServ);
-    connection.Start();
+    connection.Start(prefs);
 
     connection.GetDesSetting(TPtrC(KIapNameSetting), iapName);
-
     //connection.Stop();
 
@@ -379,7 +383,9 @@
 
     int error = 0;
-    if(!qt_SetDefaultIapName(strIapName, error)) {
-        //printf("failed setdefaultif @ %i with %s and errno = %d \n", __LINE__, strIapName.toUtf8().data(), error);
-        strIapName = QString("");
+    if(!strIapName.isEmpty()) {
+        if(!qt_SetDefaultIapName(strIapName, error)) {
+            //printf("failed setdefaultif @ %i with %s and errno = %d \n", __LINE__, strIapName.toUtf8().data(), error);
+            strIapName = QString("");
+        }
     }
 
Index: trunk/examples/network/securesocketclient/sslclient.cpp
===================================================================
--- trunk/examples/network/securesocketclient/sslclient.cpp	(revision 727)
+++ trunk/examples/network/securesocketclient/sslclient.cpp	(revision 769)
@@ -178,5 +178,5 @@
 {
     QString input = form->sessionInput->text();
-    appendString(input + "\n");
+    appendString(input + '\n');
     socket->write(input.toUtf8() + "\r\n");
     form->sessionInput->clear();
Index: trunk/examples/network/torrent/trackerclient.cpp
===================================================================
--- trunk/examples/network/torrent/trackerclient.cpp	(revision 727)
+++ trunk/examples/network/torrent/trackerclient.cpp	(revision 769)
@@ -106,5 +106,5 @@
     if (fullUrl.contains("?passkey")) {
         passkey = metaInfo.announceUrl().mid(fullUrl.indexOf("?passkey"), -1);
-        passkey += "&";
+        passkey += '&';
     }
 
Index: trunk/examples/openvg/star/starwidget.cpp
===================================================================
--- trunk/examples/openvg/star/starwidget.cpp	(revision 727)
+++ trunk/examples/openvg/star/starwidget.cpp	(revision 769)
@@ -94,6 +94,7 @@
     painter.beginNativePainting();
 
-    // Cache the path if we haven't already.
-    if (path == VG_INVALID_HANDLE) {
+    // Cache the path if we haven't already or if the path has
+    // become invalid because the window's context has changed.
+    if (path == VG_INVALID_HANDLE || !vgGetPathCapabilities(path)) {
         path = vgCreatePath(VG_PATH_FORMAT_STANDARD,
                             VG_PATH_DATATYPE_F,
Index: trunk/examples/sql/masterdetail/masterdetail.pro
===================================================================
--- trunk/examples/sql/masterdetail/masterdetail.pro	(revision 727)
+++ trunk/examples/sql/masterdetail/masterdetail.pro	(revision 769)
@@ -16,3 +16,6 @@
 INSTALLS += target sources
 
-symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+symbian {
+    TARGET.UID3 = 0xA000D7CF
+    include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+}
Index: trunk/examples/sql/sql.pro
===================================================================
--- trunk/examples/sql/sql.pro	(revision 727)
+++ trunk/examples/sql/sql.pro	(revision 769)
@@ -6,8 +6,10 @@
                         sqlwidgetmapper
 
+!wince*:  SUBDIRS   +=  masterdetail
+
 !wince*:!symbian: SUBDIRS += \
                         querymodel \
-                        tablemodel \
-                        masterdetail
+                        tablemodel
+
 
 # install
Index: trunk/examples/symbianpkgrules.pri
===================================================================
--- trunk/examples/symbianpkgrules.pri	(revision 727)
+++ trunk/examples/symbianpkgrules.pri	(revision 769)
@@ -11,5 +11,6 @@
     " "
 
-default_deployment.pkg_prerules += vendorinfo
+examples_deployment.pkg_prerules += vendorinfo
+DEPLOYMENT += examples_deployment
 
 isEmpty(ICON):ICON = $$QT_SOURCE_TREE/src/s60installs/qt.svg
Index: trunk/examples/uitools/textfinder/textfinder.cpp
===================================================================
--- trunk/examples/uitools/textfinder/textfinder.cpp	(revision 727)
+++ trunk/examples/uitools/textfinder/textfinder.cpp	(revision 769)
@@ -117,5 +117,5 @@
         document->undo();
 
-    if (searchString == "") {
+    if (searchString.isEmpty()) {
         QMessageBox::information(this, tr("Empty Search Field"),
                 "The search field is empty. Please enter a word and click Find.");
Index: trunk/examples/widgets/softkeys/softkeys.cpp
===================================================================
--- trunk/examples/widgets/softkeys/softkeys.cpp	(revision 727)
+++ trunk/examples/widgets/softkeys/softkeys.cpp	(revision 769)
@@ -71,4 +71,10 @@
     toggleButton->setCheckable(true);
 
+    modeButton = new QPushButton(tr("Loop SK window type"), this);
+    modeButton->setContextMenuPolicy(Qt::NoContextMenu);
+
+    modeLabel = new QLabel(tr("Normal maximized"), this);
+    modeLabel->setContextMenuPolicy(Qt::NoContextMenu);
+
     pushButton = new QPushButton(tr("File Dialog"), this);
     pushButton->setContextMenuPolicy(Qt::NoContextMenu);
@@ -88,4 +94,6 @@
     layout->addWidget(pushButton, 2, 1);
     layout->addWidget(comboBox, 3, 0, 1, 2);
+    layout->addWidget(modeButton, 4, 0, 1, 2);
+    layout->addWidget(modeLabel, 5, 0, 1, 2);
     central->setLayout(layout);
 
@@ -98,4 +106,5 @@
     connect(exit, SIGNAL(triggered()), this, SLOT(exitApplication()));
     connect(toggleButton, SIGNAL(clicked()), this, SLOT(setCustomSoftKeys()));
+    connect(modeButton, SIGNAL(clicked()), this, SLOT(setMode()));
     pushButton->setFocus();
 }
@@ -134,4 +143,33 @@
 }
 
+void MainWindow::setMode()
+{
+    if(isMaximized()) {
+        showFullScreen();
+        modeLabel->setText(tr("Normal Fullscreen"));
+    } else {
+        Qt::WindowFlags flags = windowFlags();
+        if(flags & Qt::WindowSoftkeysRespondHint) {
+            flags |= Qt::WindowSoftkeysVisibleHint;
+            flags &= ~Qt::WindowSoftkeysRespondHint;
+            setWindowFlags(flags); // Hides visible window
+            showFullScreen();
+            modeLabel->setText(tr("Fullscreen with softkeys"));
+        } else if(flags & Qt::WindowSoftkeysVisibleHint) {
+            flags &= ~Qt::WindowSoftkeysVisibleHint;
+            flags &= ~Qt::WindowSoftkeysRespondHint;
+            setWindowFlags(flags); // Hides visible window
+            showMaximized();
+            modeLabel->setText(tr("Normal Maximized"));
+        } else {
+            flags &= ~Qt::WindowSoftkeysVisibleHint;
+            flags |= Qt::WindowSoftkeysRespondHint;
+            setWindowFlags(flags); // Hides visible window
+            showFullScreen();
+            modeLabel->setText(tr("Fullscreen with SK respond"));
+        }
+    }
+}
+
 void MainWindow::exitApplication()
 {
Index: trunk/examples/widgets/softkeys/softkeys.h
===================================================================
--- trunk/examples/widgets/softkeys/softkeys.h	(revision 727)
+++ trunk/examples/widgets/softkeys/softkeys.h	(revision 769)
@@ -58,4 +58,5 @@
     void cancelPressed();
     void setCustomSoftKeys();
+    void setMode();
 public:
     MainWindow(QWidget *parent = 0);
@@ -64,13 +65,15 @@
     QGridLayout *layout;
     QWidget *central;
-    QTextEdit* textEditor;
+    QTextEdit *textEditor;
     QLabel *infoLabel;
-    QPushButton* toggleButton;
-    QPushButton* pushButton;
-    QMenu* fileMenu;
-    QAction* addSoftKeysAct;
-    QAction* exit;
-    QAction* ok;
-    QAction* cancel;
+    QPushButton *toggleButton;
+    QPushButton *pushButton;
+    QPushButton *modeButton;
+    QLabel *modeLabel;
+    QMenu *fileMenu;
+    QAction *addSoftKeysAct;
+    QAction *exit;
+    QAction *ok;
+    QAction *cancel;
 };
 
Index: trunk/examples/widgets/stylesheet/mainwindow.ui
===================================================================
--- trunk/examples/widgets/stylesheet/mainwindow.ui	(revision 727)
+++ trunk/examples/widgets/stylesheet/mainwindow.ui	(revision 769)
@@ -197,5 +197,5 @@
        <item row="1" column="2" colspan="2" >
         <widget class="QRadioButton" name="femaleRadioButton" >
-         <property name="styleSheet" >
+         <property name="toolTip">
           <string>Check this if you are female</string>
          </property>
Index: trunk/examples/widgets/wiggly/dialog.cpp
===================================================================
--- trunk/examples/widgets/wiggly/dialog.cpp	(revision 727)
+++ trunk/examples/widgets/wiggly/dialog.cpp	(revision 769)
@@ -57,4 +57,15 @@
     setLayout(layout);
 
+#ifdef QT_SOFTKEYS_ENABLED
+    QAction *exitAction = new QAction(tr("Exit"), this);
+    exitAction->setSoftKeyRole(QAction::NegativeSoftKey);
+    connect (exitAction, SIGNAL(triggered()),this, SLOT(close()));
+    addAction (exitAction);
+
+    Qt::WindowFlags flags = windowFlags();
+    flags |= Qt::WindowSoftkeysVisibleHint;
+    setWindowFlags(flags);
+#endif
+
     connect(lineEdit, SIGNAL(textChanged(QString)),
             wigglyWidget, SLOT(setText(QString)));
Index: trunk/examples/widgets/windowflags/controllerwindow.cpp
===================================================================
--- trunk/examples/widgets/windowflags/controllerwindow.cpp	(revision 727)
+++ trunk/examples/widgets/windowflags/controllerwindow.cpp	(revision 769)
@@ -59,5 +59,5 @@
     bottomLayout->addWidget(quitButton);
 
-    QVBoxLayout *mainLayout = new QVBoxLayout;
+    QHBoxLayout *mainLayout = new QHBoxLayout;
     mainLayout->addWidget(typeGroupBox);
     mainLayout->addWidget(hintsGroupBox);
