From 0748751c9f097d9d866605306bbdd4b96e2a5c4e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 27 Apr 2011 19:16:41 +0200 Subject: Squashed commit of the changes from the mobile-examples repository (4.7-generated-declarative branch). --- examples/xml/dombookmarks/dombookmarks.pro | 15 ++++++++++++--- examples/xml/dombookmarks/main.cpp | 5 +++++ examples/xml/dombookmarks/mainwindow.cpp | 18 ++++++++++++++++++ examples/xml/htmlinfo/htmlinfo.pro | 7 +++++++ examples/xml/htmlinfo/main.cpp | 5 +++-- examples/xml/rsslisting/main.cpp | 4 ++++ examples/xml/rsslisting/rsslisting.cpp | 20 ++++++++++++++++++++ examples/xml/rsslisting/rsslisting.h | 15 +++++++++++++++ examples/xml/rsslisting/rsslisting.pro | 12 +++++++++++- examples/xml/saxbookmarks/saxbookmarks.pro | 2 ++ examples/xml/streambookmarks/main.cpp | 3 +++ examples/xml/streambookmarks/mainwindow.cpp | 18 ++++++++++++++++++ examples/xml/streambookmarks/streambookmarks.pro | 8 +++++++- examples/xml/xml.pro | 1 + examples/xml/xmlstreamlint/xmlstreamlint.pro | 4 ++++ 15 files changed, 130 insertions(+), 7 deletions(-) (limited to 'examples/xml') diff --git a/examples/xml/dombookmarks/dombookmarks.pro b/examples/xml/dombookmarks/dombookmarks.pro index aa815457f5..3d38ca3f47 100644 --- a/examples/xml/dombookmarks/dombookmarks.pro +++ b/examples/xml/dombookmarks/dombookmarks.pro @@ -13,8 +13,17 @@ INSTALLS += target sources symbian: CONFIG += qt_example +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 71ce6aec0b..6a3bb8c1a9 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 b3bfe64e17..0a3a3f9c3b 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.pro b/examples/xml/htmlinfo/htmlinfo.pro index b7a262580b..7a58ed35a0 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 = . @@ -17,3 +21,6 @@ symbian { TARGET.UID3 = 0xA000C609 CONFIG += qt_example } +maemo5: CONFIG += qt_example + +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 cb7ac528f0..4e36b1c2cd 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/rsslisting/main.cpp b/examples/xml/rsslisting/main.cpp index 011569f2b6..78abb92e8d 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 5840f08d09..ffc6d1a6c7 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.h b/examples/xml/rsslisting/rsslisting.h index 98254f839b..49c694092c 100644 --- a/examples/xml/rsslisting/rsslisting.h +++ b/examples/xml/rsslisting/rsslisting.h @@ -48,6 +48,16 @@ #include #include +#ifdef Q_OS_SYMBIAN +// Bearer +#include +#include +#include + +// 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 m_session; +#endif }; #endif diff --git a/examples/xml/rsslisting/rsslisting.pro b/examples/xml/rsslisting/rsslisting.pro index c883b77ada..413fdf651e 100644 --- a/examples/xml/rsslisting/rsslisting.pro +++ b/examples/xml/rsslisting/rsslisting.pro @@ -8,5 +8,15 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS rsslisting.pro sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/xml/rsslisting INSTALLS += target sources -symbian: CONFIG += qt_example +symbian { + CONFIG += qt_example + # For QtMobility + CONFIG += mobility + MOBILITY = bearer + + # For QtMobility + TARGET.CAPABILITY = NetworkServices +} + +maemo5: CONFIG += qt_example diff --git a/examples/xml/saxbookmarks/saxbookmarks.pro b/examples/xml/saxbookmarks/saxbookmarks.pro index bb1e0961e7..f03fae8ed4 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 c44e921e82..d909c01b51 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 e9236e93e6..ac839fe9a0 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.pro b/examples/xml/streambookmarks/streambookmarks.pro index 91abf97ec2..9ccbb619be 100644 --- a/examples/xml/streambookmarks/streambookmarks.pro +++ b/examples/xml/streambookmarks/streambookmarks.pro @@ -13,4 +13,10 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS streambookmarks.pro *.xb sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/xml/streambookmarks INSTALLS += target sources -symbian: CONFIG += qt_example +symbian: { + CONFIG += qt_example + addFiles.sources = frank.xbel jennifer.xbel + addFiles.path = /data/qt/streambookmarks + DEPLOYMENT += addFiles +} +maemo5: CONFIG += qt_example diff --git a/examples/xml/xml.pro b/examples/xml/xml.pro index 7ef5eadbaa..485e08f809 100644 --- a/examples/xml/xml.pro +++ b/examples/xml/xml.pro @@ -18,3 +18,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/xml INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example diff --git a/examples/xml/xmlstreamlint/xmlstreamlint.pro b/examples/xml/xmlstreamlint/xmlstreamlint.pro index 9eb5b2a49e..dcc8197441 100644 --- a/examples/xml/xmlstreamlint/xmlstreamlint.pro +++ b/examples/xml/xmlstreamlint/xmlstreamlint.pro @@ -10,3 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/xml/xmlstreamlint INSTALLS += target sources symbian: CONFIG += qt_example +maemo5: CONFIG += qt_example + +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) -- cgit v1.2.3