int main(int argc, char *argv[]) { #if !defined(Q_WS_S60) QApplication::setGraphicsSystem("raster"); #endif // Create the Application QApplication app(argc, argv); // Init the required Resources Q_INIT_RESOURCE(images); // Init the Window/Widget that contains the actual App QDetroBro window; app.setApplicationName("QDetroBro"); app.setApplicationVersion("0.2beta"); app.setOrganizationName("France Telecom R&D - Orange Labs UK"); app.setOrganizationDomain("orange.com"); #ifdef Q_OS_SYMBIAN window.showFullScreen(); qt_SetDefaultIap(); // This will avoid the browser to keep asking for an IAP #else window.show(); #endif return app.exec(); }
//! [6] void Client::requestNewFortune() { getFortuneButton->setEnabled(false); #ifdef Q_OS_SYMBIAN if(!isDefaultIapSet) { qt_SetDefaultIap(); isDefaultIapSet = true; } #endif blockSize = 0; tcpSocket->abort(); //! [7] tcpSocket->connectToHost(hostLineEdit->text(), portLineEdit->text().toInt()); //! [7] }
int main(int argc, char** argv) { // Register a new Message Handler for qDebug/qWarning/qCritical/qFatal #ifdef INSTALL_MESSAGE_HANDLER qInstallMsgHandler(messageHandler); #endif // Create the Application QApplication app(argc, argv); app.setApplicationName(APP_NAME); app.setApplicationVersion(APP_VERSION); app.setOrganizationName(ORG_NAME); app.setOrganizationDomain(ORG_DOMAIN); // Init Resource Files Q_INIT_RESOURCE(qmls); // MainView, that will hold the QML UI MainView mainView; #if defined(Q_OS_SYMBIAN) qt_SetDefaultIap(); // This will avoid the browser to keep asking for an IAP #elif defined(Q_WS_MAEMO_5) mainView.setAttribute(Qt::WA_Maemo5NonComposited, true); //< This will avoid the use of Composite on this Parentless-Widget mainView.setAttribute(Qt::WA_Maemo5AutoOrientation, true); //< "Qt::WA_Maemo5PortraitOrientation" or "Qt::WA_Maemo5LandscapeOrientation" or "Qt::WA_Maemo5AutoOrientation" #endif #if defined(Q_OS_MAC) || defined(Q_OS_WIN32) //desktop build, just open a window // mainView.setWindowFlags(Qt::FramelessWindowHint); mainView.show(); #else //TODO recognise whether Q_OS_LINUX is defined and understand whether is meego or desktop linux //mobile builds, we want the whole screen! mainView.showFullScreen(); #endif // The Core of the Application Core core(&mainView); core.start(); return app.exec(); }
//![0] void FtpWindow::connectOrDisconnect() { #ifdef Q_OS_SYMBIAN if(!bDefaultIapSet) { qt_SetDefaultIap(); bDefaultIapSet = true; } #endif if (ftp) { ftp->abort(); ftp->deleteLater(); ftp = 0; //![0] fileList->setEnabled(false); cdToParentButton->setEnabled(false); downloadButton->setEnabled(false); connectButton->setEnabled(true); connectButton->setText(tr("Connect")); #ifndef QT_NO_CURSOR setCursor(Qt::ArrowCursor); #endif statusLabel->setText(tr("Please enter the name of an FTP server.")); return; } #ifndef QT_NO_CURSOR setCursor(Qt::WaitCursor); #endif //![1] ftp = new QFtp(this); connect(ftp, SIGNAL(commandFinished(int,bool)), this, SLOT(ftpCommandFinished(int,bool))); connect(ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(addToList(QUrlInfo))); connect(ftp, SIGNAL(dataTransferProgress(qint64,qint64)), this, SLOT(updateDataTransferProgress(qint64,qint64))); fileList->clear(); currentPath.clear(); isDirectory.clear(); //![1] //![2] QUrl url(ftpServerLineEdit->text()); if (!url.isValid() || url.scheme().toLower() != QLatin1String("ftp")) { ftp->connectToHost(ftpServerLineEdit->text(), 21); ftp->login(); } else { ftp->connectToHost(url.host(), url.port(21)); if (!url.userName().isEmpty()) ftp->login(QUrl::fromPercentEncoding(url.userName().toLatin1()), url.password()); else ftp->login(); if (!url.path().isEmpty()) ftp->cd(url.path()); } //![2] fileList->setEnabled(true); connectButton->setEnabled(false); connectButton->setText(tr("Disconnect")); statusLabel->setText(tr("Connecting to FTP server %1...") .arg(ftpServerLineEdit->text())); }
void BrowserView::setDefaultIap() { qt_SetDefaultIap(); m_webView->load(QUrl("http://news.bbc.co.uk/text_only.stm")); }