summaryrefslogtreecommitdiffstats
path: root/examples/xml
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2011-04-28 17:39:11 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2011-04-28 17:39:11 (GMT)
commit3abaecc3aec4e46f1c5969c33875fd45aa542385 (patch)
tree58613c5d2b765018c31d0b189e9c5a34d8adde69 /examples/xml
parentddb22795641253a026b72f752ebc769745dd41be (diff)
downloadQt-3abaecc3aec4e46f1c5969c33875fd45aa542385.zip
Qt-3abaecc3aec4e46f1c5969c33875fd45aa542385.tar.gz
Qt-3abaecc3aec4e46f1c5969c33875fd45aa542385.tar.bz2
Squashed commit of the changes from the mobile-examples repository
(4.7-generated-declarative branch).
Diffstat (limited to 'examples/xml')
-rw-r--r--examples/xml/dombookmarks/dombookmarks.desktop11
-rw-r--r--examples/xml/dombookmarks/dombookmarks.pro15
-rw-r--r--examples/xml/dombookmarks/main.cpp5
-rw-r--r--examples/xml/dombookmarks/mainwindow.cpp18
-rw-r--r--examples/xml/htmlinfo/htmlinfo.desktop11
-rw-r--r--examples/xml/htmlinfo/htmlinfo.pro11
-rw-r--r--examples/xml/htmlinfo/main.cpp5
-rw-r--r--examples/xml/htmlinfo/resources.qrc11
-rw-r--r--examples/xml/rsslisting/main.cpp4
-rw-r--r--examples/xml/rsslisting/rsslisting.cpp20
-rw-r--r--examples/xml/rsslisting/rsslisting.desktop11
-rw-r--r--examples/xml/rsslisting/rsslisting.h15
-rw-r--r--examples/xml/rsslisting/rsslisting.pro13
-rw-r--r--examples/xml/saxbookmarks/saxbookmarks.desktop11
-rw-r--r--examples/xml/saxbookmarks/saxbookmarks.pro2
-rw-r--r--examples/xml/streambookmarks/main.cpp3
-rw-r--r--examples/xml/streambookmarks/mainwindow.cpp18
-rw-r--r--examples/xml/streambookmarks/streambookmarks.desktop11
-rw-r--r--examples/xml/streambookmarks/streambookmarks.pro9
-rw-r--r--examples/xml/xml.pro1
-rw-r--r--examples/xml/xmlstreamlint/xmlstreamlint.desktop11
-rw-r--r--examples/xml/xmlstreamlint/xmlstreamlint.pro4
22 files changed, 209 insertions, 11 deletions
diff --git a/examples/xml/dombookmarks/dombookmarks.desktop b/examples/xml/dombookmarks/dombookmarks.desktop
new file mode 100644
index 0000000..dfaa8a6
--- /dev/null
+++ b/examples/xml/dombookmarks/dombookmarks.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=DOM Bookmarks
+Exec=/opt/usr/bin/dombookmarks
+Icon=dombookmarks
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/xml/dombookmarks/dombookmarks.pro b/examples/xml/dombookmarks/dombookmarks.pro
index 80bbec4..374d9e3 100644
--- a/examples/xml/dombookmarks/dombookmarks.pro
+++ b/examples/xml/dombookmarks/dombookmarks.pro
@@ -13,8 +13,17 @@ INSTALLS += target sources
symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+symbian: {
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+ addFiles.sources = frank.xbel jennifer.xbel
+ addFiles.path = files
+ DEPLOYMENT += addFiles
+}
+
wince*: {
- addFiles.files = frank.xbel jennifer.xbel
- addFiles.path = "\\My Documents"
- DEPLOYMENT += addFiles
+ addFiles.files = frank.xbel jennifer.xbel
+ addFiles.path = "\\My Documents"
+ DEPLOYMENT += addFiles
}
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
+
diff --git a/examples/xml/dombookmarks/main.cpp b/examples/xml/dombookmarks/main.cpp
index 71ce6ae..6a3bb8c 100644
--- a/examples/xml/dombookmarks/main.cpp
+++ b/examples/xml/dombookmarks/main.cpp
@@ -46,7 +46,12 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow mainWin;
+#if defined(Q_OS_SYMBIAN)
+ mainWin.showMaximized();
+#else
mainWin.show();
+#endif
+
mainWin.open();
return app.exec();
}
diff --git a/examples/xml/dombookmarks/mainwindow.cpp b/examples/xml/dombookmarks/mainwindow.cpp
index b3bfe64..0a3a3f9 100644
--- a/examples/xml/dombookmarks/mainwindow.cpp
+++ b/examples/xml/dombookmarks/mainwindow.cpp
@@ -59,6 +59,15 @@ MainWindow::MainWindow()
void MainWindow::open()
{
+#if defined(Q_OS_SYMBIAN)
+ // Look for bookmarks on the same drive where the application is installed to,
+ // if drive is not read only. QDesktopServices::DataLocation does this check,
+ // and returns writable drive.
+ QString bookmarksFolder =
+ QDesktopServices::storageLocation(QDesktopServices::DataLocation).left(1);
+ bookmarksFolder.append(":/Data/qt/saxbookmarks");
+ QDir::setCurrent(bookmarksFolder);
+#endif
QString fileName =
QFileDialog::getOpenFileName(this, tr("Open Bookmark File"),
QDir::currentPath(),
@@ -81,6 +90,15 @@ void MainWindow::open()
void MainWindow::saveAs()
{
+#if defined(Q_OS_SYMBIAN)
+ // Look for bookmarks on the same drive where the application is installed to,
+ // if drive is not read only. QDesktopServices::DataLocation does this check,
+ // and returns writable drive.
+ QString bookmarksFolder =
+ QDesktopServices::storageLocation(QDesktopServices::DataLocation).left(1);
+ bookmarksFolder.append(":/Data/qt/saxbookmarks");
+ QDir::setCurrent(bookmarksFolder);
+#endif
QString fileName =
QFileDialog::getSaveFileName(this, tr("Save Bookmark File"),
QDir::currentPath(),
diff --git a/examples/xml/htmlinfo/htmlinfo.desktop b/examples/xml/htmlinfo/htmlinfo.desktop
new file mode 100644
index 0000000..901a285
--- /dev/null
+++ b/examples/xml/htmlinfo/htmlinfo.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=XML HTML Info
+Exec=/opt/usr/bin/htmlinfo
+Icon=htmlinfo
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/xml/htmlinfo/htmlinfo.pro b/examples/xml/htmlinfo/htmlinfo.pro
index 94b3a07..9b84cfd 100644
--- a/examples/xml/htmlinfo/htmlinfo.pro
+++ b/examples/xml/htmlinfo/htmlinfo.pro
@@ -1,6 +1,10 @@
SOURCES += main.cpp
QT -= gui
+RESOURCES = resources.qrc
+
+win32: CONFIG += console
+
wince*|symbian:{
htmlfiles.files = *.html
htmlfiles.path = .
@@ -9,11 +13,12 @@ wince*|symbian:{
# install
target.path = $$[QT_INSTALL_EXAMPLES]/xml/htmlinfo
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.html htmlinfo.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/xml/htmlinfo
-INSTALLS += target sources
+INSTALLS += target
symbian {
TARGET.UID3 = 0xA000C609
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
}
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
+
+symbian: warning(This example does not work on Symbian platform)
diff --git a/examples/xml/htmlinfo/main.cpp b/examples/xml/htmlinfo/main.cpp
index cb7ac52..4e36b1c 100644
--- a/examples/xml/htmlinfo/main.cpp
+++ b/examples/xml/htmlinfo/main.cpp
@@ -101,7 +101,8 @@ int main(int argc, char **argv)
QStringList filter;
filter << "*.htm";
filter << "*.html";
- QStringList htmlFiles = QDir::current().entryList(filter, QDir::Files);
+
+ QStringList htmlFiles = QDir(":/").entryList(filter, QDir::Files);
QTextStream out(stdout);
@@ -112,7 +113,7 @@ int main(int argc, char **argv)
// parse each html file and write the result to file/stream
foreach(QString file, htmlFiles)
- parseHtmlFile(out, file);
+ parseHtmlFile(out, ":/" + file);
return 0;
}
diff --git a/examples/xml/htmlinfo/resources.qrc b/examples/xml/htmlinfo/resources.qrc
new file mode 100644
index 0000000..a8cf88d
--- /dev/null
+++ b/examples/xml/htmlinfo/resources.qrc
@@ -0,0 +1,11 @@
+<RCC>
+ <qresource prefix="/">
+ <file>apache_org.html</file>
+ <file>nokia_com.html</file>
+ <file>simpleexample.html</file>
+ <file>trolltech_com.html</file>
+ <file>w3c_org.html</file>
+ <file>youtube_com.html</file>
+ </qresource>
+</RCC>
+
diff --git a/examples/xml/rsslisting/main.cpp b/examples/xml/rsslisting/main.cpp
index 011569f..78abb92 100644
--- a/examples/xml/rsslisting/main.cpp
+++ b/examples/xml/rsslisting/main.cpp
@@ -58,6 +58,10 @@ int main(int argc, char **argv)
{
QApplication app(argc, argv);
RSSListing *rsslisting = new RSSListing;
+#if defined(Q_OS_SYMBIAN)
+ rsslisting->showMaximized();
+#else
rsslisting->show();
+#endif
return app.exec();
}
diff --git a/examples/xml/rsslisting/rsslisting.cpp b/examples/xml/rsslisting/rsslisting.cpp
index 5840f08..ffc6d1a 100644
--- a/examples/xml/rsslisting/rsslisting.cpp
+++ b/examples/xml/rsslisting/rsslisting.cpp
@@ -74,6 +74,24 @@ its operation, and also allows very large data sources to be read.
RSSListing::RSSListing(QWidget *parent)
: QWidget(parent), currentReply(0)
{
+#ifdef Q_OS_SYMBIAN
+ // Set Internet Access Point
+ QNetworkConfigurationManager manager;
+ const bool canStartIAP = manager.capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces;
+
+ // Is there default access point, use it
+ QNetworkConfiguration cfg = manager.defaultConfiguration();
+ if (!cfg.isValid() || !canStartIAP) {
+ // Available Access Points not found
+ QMessageBox::warning(this, "Error", "No access point");
+ return;
+ }
+
+ m_session = new QNetworkSession(cfg);
+ m_session->open();
+ m_session->waitForOpened();
+#endif
+
lineEdit = new QLineEdit(this);
lineEdit->setText("http://labs.qt.nokia.com/blogs/feed");
@@ -104,7 +122,9 @@ RSSListing::RSSListing(QWidget *parent)
layout->addWidget(treeWidget);
setWindowTitle(tr("RSS listing example"));
+#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5)
resize(640,480);
+#endif
}
/*
diff --git a/examples/xml/rsslisting/rsslisting.desktop b/examples/xml/rsslisting/rsslisting.desktop
new file mode 100644
index 0000000..e45fe4a
--- /dev/null
+++ b/examples/xml/rsslisting/rsslisting.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=RSS-Listing
+Exec=/opt/usr/bin/rsslisting
+Icon=rsslisting
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/xml/rsslisting/rsslisting.h b/examples/xml/rsslisting/rsslisting.h
index 98254f8..49c6940 100644
--- a/examples/xml/rsslisting/rsslisting.h
+++ b/examples/xml/rsslisting/rsslisting.h
@@ -48,6 +48,16 @@
#include <QXmlStreamReader>
#include <QUrl>
+#ifdef Q_OS_SYMBIAN
+// Bearer
+#include <QNetworkConfigurationManager>
+#include <QNetworkSession>
+#include <QPointer>
+
+// QtMobility namespace
+QTM_USE_NAMESPACE
+#endif
+
QT_BEGIN_NAMESPACE
class QLineEdit;
class QTreeWidget;
@@ -84,6 +94,11 @@ private:
QLineEdit *lineEdit;
QTreeWidget *treeWidget;
QPushButton *fetchButton;
+
+#ifdef Q_OS_SYMBIAN
+ // for bearer management
+ QPointer<QNetworkSession> m_session;
+#endif
};
#endif
diff --git a/examples/xml/rsslisting/rsslisting.pro b/examples/xml/rsslisting/rsslisting.pro
index e93cad0..2515de7 100644
--- a/examples/xml/rsslisting/rsslisting.pro
+++ b/examples/xml/rsslisting/rsslisting.pro
@@ -8,5 +8,16 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS rsslisting.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/xml/rsslisting
INSTALLS += target sources
-symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+symbian {
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+
+ # For QtMobility
+ CONFIG += mobility
+ MOBILITY = bearer
+
+ # For QtMobility
+ TARGET.CAPABILITY = NetworkServices
+}
+
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
diff --git a/examples/xml/saxbookmarks/saxbookmarks.desktop b/examples/xml/saxbookmarks/saxbookmarks.desktop
new file mode 100644
index 0000000..5f983d2
--- /dev/null
+++ b/examples/xml/saxbookmarks/saxbookmarks.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=SAX Bookmarks
+Exec=/opt/usr/bin/saxbookmarks
+Icon=saxbookmarks
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/xml/saxbookmarks/saxbookmarks.pro b/examples/xml/saxbookmarks/saxbookmarks.pro
index d4b09b6..a55aa6d 100644
--- a/examples/xml/saxbookmarks/saxbookmarks.pro
+++ b/examples/xml/saxbookmarks/saxbookmarks.pro
@@ -26,3 +26,5 @@ symbian: {
addFiles.path = /data/qt/saxbookmarks
DEPLOYMENT += addFiles
}
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
+
diff --git a/examples/xml/streambookmarks/main.cpp b/examples/xml/streambookmarks/main.cpp
index c44e921..d909c01 100644
--- a/examples/xml/streambookmarks/main.cpp
+++ b/examples/xml/streambookmarks/main.cpp
@@ -47,6 +47,9 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow mainWin;
+#ifdef Q_OS_SYMBIAN
+ mainWin.showFullScreen();
+#endif
mainWin.show();
mainWin.open();
return app.exec();
diff --git a/examples/xml/streambookmarks/mainwindow.cpp b/examples/xml/streambookmarks/mainwindow.cpp
index e9236e9..ac839fe 100644
--- a/examples/xml/streambookmarks/mainwindow.cpp
+++ b/examples/xml/streambookmarks/mainwindow.cpp
@@ -68,6 +68,15 @@ MainWindow::MainWindow()
//! [1]
void MainWindow::open()
{
+#if defined(Q_OS_SYMBIAN)
+ // Look for bookmarks on the same drive where the application is installed to,
+ // if drive is not read only. QDesktopServices::DataLocation does this check,
+ // and returns writable drive.
+ QString bookmarksFolder =
+ QDesktopServices::storageLocation(QDesktopServices::DataLocation).left(1);
+ bookmarksFolder.append(":/Data/qt/saxbookmarks");
+ QDir::setCurrent(bookmarksFolder);
+#endif
QString fileName =
QFileDialog::getOpenFileName(this, tr("Open Bookmark File"),
QDir::currentPath(),
@@ -103,6 +112,15 @@ void MainWindow::open()
//! [2]
void MainWindow::saveAs()
{
+#if defined(Q_OS_SYMBIAN)
+ // Look for bookmarks on the same drive where the application is installed to,
+ // if drive is not read only. QDesktopServices::DataLocation does this check,
+ // and returns writable drive.
+ QString bookmarksFolder =
+ QDesktopServices::storageLocation(QDesktopServices::DataLocation).left(1);
+ bookmarksFolder.append(":/Data/qt/saxbookmarks");
+ QDir::setCurrent(bookmarksFolder);
+#endif
QString fileName =
QFileDialog::getSaveFileName(this, tr("Save Bookmark File"),
QDir::currentPath(),
diff --git a/examples/xml/streambookmarks/streambookmarks.desktop b/examples/xml/streambookmarks/streambookmarks.desktop
new file mode 100644
index 0000000..29961a9
--- /dev/null
+++ b/examples/xml/streambookmarks/streambookmarks.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=QXmlStream Bookmarks
+Exec=/opt/usr/bin/streambookmarks
+Icon=streambookmarks
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/xml/streambookmarks/streambookmarks.pro b/examples/xml/streambookmarks/streambookmarks.pro
index 2b1841f..0f2d55d 100644
--- a/examples/xml/streambookmarks/streambookmarks.pro
+++ b/examples/xml/streambookmarks/streambookmarks.pro
@@ -13,4 +13,11 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS streambookmarks.pro *.xb
sources.path = $$[QT_INSTALL_EXAMPLES]/xml/streambookmarks
INSTALLS += target sources
-symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+symbian: {
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+ addFiles.sources = frank.xbel jennifer.xbel
+ addFiles.path = /data/qt/streambookmarks
+ DEPLOYMENT += addFiles
+}
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
+
diff --git a/examples/xml/xml.pro b/examples/xml/xml.pro
index 6d232e5..4043e01 100644
--- a/examples/xml/xml.pro
+++ b/examples/xml/xml.pro
@@ -17,4 +17,3 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS xml.pro README
sources.path = $$[QT_INSTALL_EXAMPLES]/xml
INSTALLS += target sources
-symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/xml/xmlstreamlint/xmlstreamlint.desktop b/examples/xml/xmlstreamlint/xmlstreamlint.desktop
new file mode 100644
index 0000000..6f85e36
--- /dev/null
+++ b/examples/xml/xmlstreamlint/xmlstreamlint.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=XML Stream Lint
+Exec=/opt/usr/bin/xmlstreamlint
+Icon=xmlstreamlint
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/xml/xmlstreamlint/xmlstreamlint.pro b/examples/xml/xmlstreamlint/xmlstreamlint.pro
index 6a09f1a..1274d13 100644
--- a/examples/xml/xmlstreamlint/xmlstreamlint.pro
+++ b/examples/xml/xmlstreamlint/xmlstreamlint.pro
@@ -10,3 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/xml/xmlstreamlint
INSTALLS += target sources
symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri)
+
+symbian: warning(This example does not work on Symbian platform)
+simulator: warning(This example does not work on Simulator platform)