From f58b35586cb703395fb123f7ea3e4b9b99033e63 Mon Sep 17 00:00:00 2001 From: kh Date: Thu, 23 Apr 2009 14:18:06 +0200 Subject: cleanup, normalized connect, etc... Task-number: none Reviewed-by: TrustMe --- tools/assistant/tools/assistant/mainwindow.cpp | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index bcafacc..dbfac90 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -134,10 +134,10 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) dock->setWidget(m_searchWidget); addDockWidget(Qt::LeftDockWidgetArea, dock); - connect(m_searchWidget, SIGNAL(requestShowLink(const QUrl&)), - m_centralWidget, SLOT(setSource(const QUrl&))); - connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(const QUrl&)), - m_centralWidget, SLOT(setSourceInNewTab(const QUrl&))); + connect(m_searchWidget, SIGNAL(requestShowLink(QUrl)), m_centralWidget, + SLOT(setSource(QUrl))); + connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)), + m_centralWidget, SLOT(setSourceInNewTab(QUrl))); #endif QString defWindowTitle = tr("Qt Assistant"); @@ -304,6 +304,7 @@ bool MainWindow::initHelpDB() hc.addCustomFilter(tr("Unfiltered"), QStringList()); hc.setCustomValue(unfiltered, 1); } + m_helpEngine->blockSignals(true); m_helpEngine->setCurrentFilter(tr("Unfiltered")); m_helpEngine->blockSignals(false); @@ -318,10 +319,10 @@ bool MainWindow::initHelpDB() void MainWindow::lookForNewQtDocumentation() { m_qtDocInstaller = new QtDocInstaller(m_helpEngine->collectionFile()); - connect(m_qtDocInstaller, SIGNAL(errorMessage(const QString&)), - this, SLOT(displayInstallationError(const QString&))); - connect(m_qtDocInstaller, SIGNAL(docsInstalled(bool)), - this, SLOT(qtDocumentationInstalled(bool))); + connect(m_qtDocInstaller, SIGNAL(errorMessage(QString)), this, + SLOT(displayInstallationError(QString))); + connect(m_qtDocInstaller, SIGNAL(docsInstalled(bool)), this, + SLOT(qtDocumentationInstalled(bool))); QString versionKey = QString(QLatin1String("qtVersion%1$$$qt")). arg(QLatin1String(QT_VERSION_STR)); @@ -353,8 +354,8 @@ void MainWindow::checkInitState() if (!m_connectedInitSignals) { connect(m_helpEngine->contentModel(), SIGNAL(contentsCreated()), this, SLOT(checkInitState())); - connect(m_helpEngine->indexModel(), SIGNAL(indexCreated()), - this, SLOT(checkInitState())); + connect(m_helpEngine->indexModel(), SIGNAL(indexCreated()), this, + SLOT(checkInitState())); m_connectedInitSignals = true; } } else { @@ -601,8 +602,8 @@ void MainWindow::setupFilterToolbar() connect(m_helpEngine, SIGNAL(setupFinished()), this, SLOT(setupFilterCombo())); - connect(m_filterCombo, SIGNAL(activated(const QString&)), this, - SLOT(filterDocumentation(const QString&))); + connect(m_filterCombo, SIGNAL(activated(QString)), this, + SLOT(filterDocumentation(QString))); setupFilterCombo(); } @@ -626,12 +627,12 @@ void MainWindow::setupAddressToolbar() toolBarMenu()->addAction(addressToolBar->toggleViewAction()); // address lineedit - connect(m_addressLineEdit, SIGNAL(returnPressed()), - this, SLOT(gotoAddress())); - connect(m_centralWidget, SIGNAL(currentViewerChanged()), - this, SLOT(showNewAddress())); - connect(m_centralWidget, SIGNAL(sourceChanged(const QUrl&)), - this, SLOT(showNewAddress(const QUrl&))); + connect(m_addressLineEdit, SIGNAL(returnPressed()), this, + SLOT(gotoAddress())); + connect(m_centralWidget, SIGNAL(currentViewerChanged()), this, + SLOT(showNewAddress())); + connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this, + SLOT(showNewAddress(QUrl))); } void MainWindow::updateAboutMenuText() @@ -712,10 +713,10 @@ void MainWindow::showPreferences() { PreferencesDialog dia(m_helpEngine, this); - connect(&dia, SIGNAL(updateApplicationFont()), - this, SLOT(updateApplicationFont())); - connect(&dia, SIGNAL(updateBrowserFont()), - m_centralWidget, SLOT(updateBrowserFont())); + connect(&dia, SIGNAL(updateApplicationFont()), this, + SLOT(updateApplicationFont())); + connect(&dia, SIGNAL(updateBrowserFont()), m_centralWidget, + SLOT(updateBrowserFont())); dia.showDialog(); } @@ -950,8 +951,7 @@ QWidget* MainWindow::setupBookmarkWidget() { m_bookmarkManager = new BookmarkManager(m_helpEngine); m_bookmarkWidget = new BookmarkWidget(m_bookmarkManager, this); - connect(m_bookmarkWidget, SIGNAL(addBookmark()), - this, SLOT(addBookmark())); + connect(m_bookmarkWidget, SIGNAL(addBookmark()), this, SLOT(addBookmark())); return m_bookmarkWidget; } -- cgit v0.12 From bc5995bd76dc665aab343263b51185cdfc9fd086 Mon Sep 17 00:00:00 2001 From: kh Date: Thu, 23 Apr 2009 14:20:24 +0200 Subject: Set the current filter if one gets passed by commandline. Task-number: none Reviewed-by: kh --- tools/assistant/tools/assistant/mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index dbfac90..cd6cdf1 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -228,6 +228,9 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) else if (m_cmdLine->bookmarks() == CmdLineParser::Activate) showBookmarks(); + if (!m_cmdLine->currentFilter().isEmpty()) + m_helpEngine->setCurrentFilter(m_cmdLine->currentFilter()); + if (usesDefaultCollection()) QTimer::singleShot(0, this, SLOT(lookForNewQtDocumentation())); else -- cgit v0.12 From aa234610048a741cddc991be25b84d235f40e345 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 23 Apr 2009 14:11:36 +0200 Subject: use qdoc3 debug version only when it is available By default there is no debug version built of qdoc3. In this case we should call the release build. Reviewed-by: kh --- doc/doc.pri | 2 +- tools/qdoc3/qdoc3.pro | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/doc/doc.pri b/doc/doc.pri index 46df3cb..a4c77fe 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -4,7 +4,7 @@ win32 { QT_WINCONFIG = release/ - CONFIG(debug, debug|release) { + !CONFIG(release, debug|release) { QT_WINCONFIG = debug/ } } diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 3268585..2bba8fb 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -99,10 +99,3 @@ SOURCES += apigenerator.cpp \ webxmlgenerator.cpp \ yyindent.cpp - -win32 { - QT_WINCONFIG = release - CONFIG(debug, debug|release) { - QT_WINCONFIG = debug - } -} -- cgit v0.12 From b51dd5a7b328291c5dbda540ce228e7d867662cb Mon Sep 17 00:00:00 2001 From: jasplin Date: Thu, 23 Apr 2009 14:26:19 +0200 Subject: Revert "Fixed key sequence eating behavior for QShortcut and QAction." This reverts commit 031adeaf42ddaef8d01338f6c59ba97170be5d53. The patch had some unforeseen side-effects for Creator. It may also affect other existing applications in a similar way. For now, this behavior (eating key sequences for disabled shortcuts) should be achieved using a local workaround in creator. Reviewed-by: mariusSO Task-number: 251246 --- src/gui/kernel/qaction.cpp | 47 +++++++++------------------------- src/gui/kernel/qaction_p.h | 1 - src/gui/kernel/qshortcut.cpp | 20 +++++++-------- src/gui/kernel/qshortcutmap.cpp | 9 ++++--- tests/auto/qaction/tst_qaction.cpp | 33 ------------------------ tests/auto/qshortcut/tst_qshortcut.cpp | 7 ++--- 6 files changed, 31 insertions(+), 86 deletions(-) diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 4edc1ca..abb17d7 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -136,27 +136,25 @@ void QActionPrivate::redoGrab(QShortcutMap &map) void QActionPrivate::redoGrabAlternate(QShortcutMap &map) { Q_Q(QAction); - for (int i = 0; i < alternateShortcutIds.size(); ++i) - if (int id = alternateShortcutIds.at(i)) + foreach (int id, alternateShortcutIds) + if (id) map.removeShortcut(id, q); alternateShortcutIds.clear(); if (alternateShortcuts.isEmpty()) return; - for (int i = 0; i < alternateShortcuts.size(); ++i) { - const QKeySequence &alternate = alternateShortcuts.at(i); + foreach (const QKeySequence& alternate, alternateShortcuts) { if (!alternate.isEmpty()) alternateShortcutIds.append(map.addShortcut(q, alternate, shortcutContext)); else alternateShortcutIds.append(0); } - if (!enabled) { - for (int i = 0; i < alternateShortcutIds.size(); ++i) - map.setShortcutEnabled(false, alternateShortcutIds.at(i), q); + foreach (int id, alternateShortcutIds) + map.setShortcutEnabled(false, id, q); } if (!autorepeat) { - for (int i = 0; i < alternateShortcutIds.size(); ++i) - map.setShortcutAutoRepeat(false, alternateShortcutIds.at(i), q); + foreach (int id, alternateShortcutIds) + map.setShortcutAutoRepeat(false, id, q); } } @@ -165,26 +163,10 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) Q_Q(QAction); if (shortcutId) map.setShortcutEnabled(enable, shortcutId, q); - for (int i = 0; i < alternateShortcutIds.size(); ++i) - if (int id = alternateShortcutIds.at(i)) + foreach (int id, alternateShortcutIds) + if (id) map.setShortcutEnabled(enable, id, q); } - -void QActionPrivate::removeAll(QShortcutMap &map) -{ - Q_Q(QAction); - if (shortcutId) { - map.removeShortcut(shortcutId, q); - shortcutId = 0; - } - - for (int i = 0; i < alternateShortcutIds.size(); ++i) - if (int id = alternateShortcutIds.at(i)) - map.removeShortcut(id, q); - - alternateShortcutIds.clear(); -} - #endif // QT_NO_SHORTCUT @@ -633,8 +615,8 @@ QAction::~QAction() #ifndef QT_NO_SHORTCUT if (d->shortcutId && qApp) { qApp->d_func()->shortcutMap.removeShortcut(d->shortcutId, this); - for (int i = 0; i < d->alternateShortcutIds.size(); ++i) - qApp->d_func()->shortcutMap.removeShortcut(d->alternateShortcutIds.at(i), this); + foreach (int id, d->alternateShortcutIds) + qApp->d_func()->shortcutMap.removeShortcut(id, this); } #endif } @@ -1067,12 +1049,7 @@ void QAction::setVisible(bool b) d->visible = b; d->enabled = b && !d->forceDisabled && (!d->group || d->group->isEnabled()) ; #ifndef QT_NO_SHORTCUT - if (b) { - d->redoGrab(qApp->d_func()->shortcutMap); - d->redoGrabAlternate(qApp->d_func()->shortcutMap); - } else { - d->removeAll(qApp->d_func()->shortcutMap); - } + d->setShortcutEnabled(d->enabled, qApp->d_func()->shortcutMap); #endif d->sendDataChanged(); } diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h index a5b3731..0617ef5 100644 --- a/src/gui/kernel/qaction_p.h +++ b/src/gui/kernel/qaction_p.h @@ -111,7 +111,6 @@ public: void redoGrab(QShortcutMap &map); void redoGrabAlternate(QShortcutMap &map); void setShortcutEnabled(bool enable, QShortcutMap &map); - void removeAll(QShortcutMap &map); static QShortcutMap *globalMap; #endif // QT_NO_SHORTCUT diff --git a/src/gui/kernel/qshortcut.cpp b/src/gui/kernel/qshortcut.cpp index f3c93c6..50b6e59 100644 --- a/src/gui/kernel/qshortcut.cpp +++ b/src/gui/kernel/qshortcut.cpp @@ -385,21 +385,19 @@ bool QShortcut::event(QEvent *e) { Q_D(QShortcut); bool handled = false; - if (e->type() == QEvent::Shortcut) { + if (d->sc_enabled && e->type() == QEvent::Shortcut) { QShortcutEvent *se = static_cast(e); if (se->shortcutId() == d->sc_id && se->key() == d->sc_sequence){ - if (d->sc_enabled) { #ifndef QT_NO_WHATSTHIS - if (QWhatsThis::inWhatsThisMode()) { - QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis); - handled = true; - } else + if (QWhatsThis::inWhatsThisMode()) { + QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis); + handled = true; + } else #endif - if (se->isAmbiguous()) - emit activatedAmbiguously(); - else - emit activated(); - } + if (se->isAmbiguous()) + emit activatedAmbiguously(); + else + emit activated(); handled = true; } } diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index 415d71e..1babeb6 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -368,8 +368,9 @@ bool QShortcutMap::tryShortcutEvent(QObject *o, QKeyEvent *e) default: break; } - - return true; + // If nextState is QKeySequence::ExactMatch && identicals.count == 0 + // we've only found disabled shortcuts + return identicalMatches > 0 || result == QKeySequence::PartialMatch; } /*! \internal @@ -491,7 +492,9 @@ QKeySequence::SequenceMatch QShortcutMap::find(QKeyEvent *e) // We don't need partials, if we have identicals if (d->identicals.size()) break; - partialFound = true; + // We only care about enabled partials, so we don't consume + // key events when all partials are disabled! + partialFound |= (*it).enabled; } } ++it; diff --git a/tests/auto/qaction/tst_qaction.cpp b/tests/auto/qaction/tst_qaction.cpp index 8e4ae86..34f2dfd 100644 --- a/tests/auto/qaction/tst_qaction.cpp +++ b/tests/auto/qaction/tst_qaction.cpp @@ -46,7 +46,6 @@ #include #include #include -#include //TESTED_CLASS= //TESTED_FILES= @@ -75,7 +74,6 @@ private slots: void setStandardKeys(); void alternateShortcuts(); void enabledVisibleInteraction(); - void invisibleActionWithComplexShortcut(); void task200823_tooltip(); private: @@ -324,36 +322,5 @@ void tst_QAction::task200823_tooltip() QCOMPARE(action->toolTip(), ref); } -void tst_QAction::invisibleActionWithComplexShortcut() -{ - QAction action(0); - action.setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E, Qt::Key_1)); - - QLineEdit edit; - edit.addAction(&action); - edit.show(); - QTest::qWait(100); - - QSignalSpy spy(&action, SIGNAL(triggered())); - - action.setVisible(true); - QTest::keyPress(&edit, Qt::Key_E, Qt::ControlModifier); - QTest::keyRelease(&edit, Qt::Key_E, Qt::ControlModifier); - QTest::keyPress(&edit, Qt::Key_1, Qt::NoModifier); - QTest::keyRelease(&edit, Qt::Key_1, Qt::NoModifier); - QCOMPARE(spy.count(), 1); - QCOMPARE(edit.text(), QLatin1String("")); - - edit.clear(); - spy.clear(); - action.setVisible(false); - QTest::keyPress(&edit, Qt::Key_E, Qt::ControlModifier); - QTest::keyRelease(&edit, Qt::Key_E, Qt::ControlModifier); - QTest::keyPress(&edit, Qt::Key_1, Qt::NoModifier); - QTest::keyRelease(&edit, Qt::Key_1, Qt::NoModifier); - QCOMPARE(spy.count(), 0); - QCOMPARE(edit.text(), QLatin1String("1")); -} - QTEST_MAIN(tst_QAction) #include "tst_qaction.moc" diff --git a/tests/auto/qshortcut/tst_qshortcut.cpp b/tests/auto/qshortcut/tst_qshortcut.cpp index cd80204..69ebf74 100644 --- a/tests/auto/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/qshortcut/tst_qshortcut.cpp @@ -987,16 +987,17 @@ void tst_QShortcut::keypressConsumption() cut1->setEnabled(false); cut2->setEnabled(false); - edit->clear(); + // Make sure keypresses is passed on, since all multiple keysequences + // with Ctrl+I are disabled sendKeyEvents(edit, Qt::CTRL + Qt::Key_I, 0); // Send key to edit QCOMPARE( currentResult, NoResult ); QCOMPARE( ambigResult, NoResult ); - QVERIFY(edit->toPlainText().isEmpty()); + QVERIFY(edit->toPlainText().endsWith("")); sendKeyEvents(edit, Qt::Key_A, 'a'); // Send key to edit QCOMPARE( currentResult, NoResult ); QCOMPARE( ambigResult, NoResult ); - QVERIFY(edit->toPlainText().isEmpty()); + QVERIFY(edit->toPlainText().endsWith("a")); clearAllShortcuts(); } -- cgit v0.12 From a9157844903870521d94a5a576efd143f04f2aa3 Mon Sep 17 00:00:00 2001 From: kh Date: Thu, 23 Apr 2009 15:08:23 +0200 Subject: update the filter combobox if we set a passed filter --- tools/assistant/tools/assistant/mainwindow.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index cd6cdf1..c1e9027 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -228,8 +228,17 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) else if (m_cmdLine->bookmarks() == CmdLineParser::Activate) showBookmarks(); - if (!m_cmdLine->currentFilter().isEmpty()) - m_helpEngine->setCurrentFilter(m_cmdLine->currentFilter()); + if (!m_cmdLine->currentFilter().isEmpty()) { + const QString &curFilter = m_cmdLine->currentFilter(); + m_helpEngine->setCurrentFilter(curFilter); + int idx = m_filterCombo->findText(curFilter); + if (idx >= 0) { + bool blocked = m_filterCombo->signalsBlocked(); + m_filterCombo->blockSignals(true); + m_filterCombo->setCurrentIndex(idx); + m_filterCombo->blockSignals(blocked); + } + } if (usesDefaultCollection()) QTimer::singleShot(0, this, SLOT(lookForNewQtDocumentation())); -- cgit v0.12 From 11eb20de2bbc2bb0809a0238d3124613ffac6ed4 Mon Sep 17 00:00:00 2001 From: kh Date: Thu, 23 Apr 2009 15:11:16 +0200 Subject: make sure we wait until the page has fully loaded before duplicating --- tools/assistant/tools/assistant/centralwidget.cpp | 4 ++++ tools/assistant/tools/assistant/helpviewer.cpp | 12 +++++++++++- tools/assistant/tools/assistant/helpviewer.h | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 1b0e671..633747a 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -277,7 +277,11 @@ CentralWidget *CentralWidget::instance() void CentralWidget::newTab() { HelpViewer* viewer = currentHelpViewer(); +#if !defined(QT_NO_WEBKIT) + if (viewer && viewer->hasLoadFinished()) +#else if (viewer) +#endif setSourceInNewTab(viewer->source()); } diff --git a/tools/assistant/tools/assistant/helpviewer.cpp b/tools/assistant/tools/assistant/helpviewer.cpp index f7225fa..5ce6e14 100644 --- a/tools/assistant/tools/assistant/helpviewer.cpp +++ b/tools/assistant/tools/assistant/helpviewer.cpp @@ -269,7 +269,10 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *, } HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) - : QWebView(parent), helpEngine(engine), parentWidget(parent) + : QWebView(parent) + , helpEngine(engine) + , parentWidget(parent) + , loadFinished(false) { setAcceptDrops(false); @@ -295,10 +298,12 @@ HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) connect(page(), SIGNAL(linkHovered(QString, QString, QString)), this, SIGNAL(highlighted(QString))); connect(this, SIGNAL(urlChanged(QUrl)), this, SIGNAL(sourceChanged(QUrl))); + connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool))); } void HelpViewer::setSource(const QUrl &url) { + loadFinished = false; if (url.toString() == QLatin1String("help")) { load(QUrl(QLatin1String("qthelp://com.trolltech.com." "assistantinternal_1.0.0/assistant/assistant.html"))); @@ -385,6 +390,11 @@ void HelpViewer::mousePressEvent(QMouseEvent *event) QWebView::mousePressEvent(event); } +void HelpViewer::setLoadFinished(bool ok) +{ + loadFinished = ok; +} + #else // !defined(QT_NO_WEBKIT) HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) diff --git a/tools/assistant/tools/assistant/helpviewer.h b/tools/assistant/tools/assistant/helpviewer.h index eea7340..c66b69c 100644 --- a/tools/assistant/tools/assistant/helpviewer.h +++ b/tools/assistant/tools/assistant/helpviewer.h @@ -92,6 +92,8 @@ public: { return pageAction(QWebPage::Forward)->isEnabled(); } inline bool isBackwardAvailable() const { return pageAction(QWebPage::Back)->isEnabled(); } + inline bool hasLoadFinished() const + { return loadFinished; } public Q_SLOTS: void home(); @@ -111,10 +113,12 @@ protected: private Q_SLOTS: void actionChanged(); + void setLoadFinished(bool ok); private: QHelpEngine *helpEngine; CentralWidget* parentWidget; + bool loadFinished; }; #else -- cgit v0.12 From a5c7f0c0ea7dc47cf7cbd740af3dc6b241d68ffb Mon Sep 17 00:00:00 2001 From: jasplin Date: Thu, 23 Apr 2009 15:08:08 +0200 Subject: Revert "Removed dead code." This reverts commit 99d243860548d6be8a68dfd027c51530351d12cb. Needed because of commit b51dd5a7b328291c5dbda540ce228e7d867662cb. --- src/gui/kernel/qshortcutmap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp index 1babeb6..ed9654b 100644 --- a/src/gui/kernel/qshortcutmap.cpp +++ b/src/gui/kernel/qshortcutmap.cpp @@ -359,6 +359,8 @@ bool QShortcutMap::tryShortcutEvent(QObject *o, QKeyEvent *e) else e->ignore(); + int identicalMatches = d->identicals.count(); + switch(result) { case QKeySequence::NoMatch: return stateWasAccepted; -- cgit v0.12 From 6d0bdd9a3130985451c61d8caa53148c10263059 Mon Sep 17 00:00:00 2001 From: kh Date: Thu, 23 Apr 2009 15:14:32 +0200 Subject: fixes open an empty page on invalid keyword --- tools/assistant/tools/assistant/indexwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/assistant/tools/assistant/indexwindow.cpp b/tools/assistant/tools/assistant/indexwindow.cpp index 0beb5ee..a2c0950 100644 --- a/tools/assistant/tools/assistant/indexwindow.cpp +++ b/tools/assistant/tools/assistant/indexwindow.cpp @@ -197,6 +197,8 @@ void IndexWindow::open(QHelpIndexWidget* indexWidget, const QModelIndex &index) url = tc.link(); } else if (links.count() == 1) { url = links.constBegin().value(); + } else { + return; } if (url.path().endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive)) -- cgit v0.12 From 7fec4bb21bc78760bd1603efb1b62453ac743e01 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 23 Apr 2009 15:03:43 +0200 Subject: fix pro file --- tests/auto/qlocalsocket/test/test.pro | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro index 8ce7c50..7befdf9 100644 --- a/tests/auto/qlocalsocket/test/test.pro +++ b/tests/auto/qlocalsocket/test/test.pro @@ -1,7 +1,5 @@ load(qttest_p4) -include(../src/src.pri) - DEFINES += QLOCALSERVER_DEBUG DEFINES += QLOCALSOCKET_DEBUG !wince*: { @@ -14,14 +12,16 @@ DEFINES += QLOCALSOCKET_DEBUG QT = core network SOURCES += ../tst_qlocalsocket.cpp -TARGET = ../tst_qlocalsocket -win32 { +TARGET = tst_qlocalsocket +CONFIG(debug_and_release) { CONFIG(debug, debug|release) { - TARGET = ../../debug/tst_qlocalsocket -} else { - TARGET = ../../release/tst_qlocalsocket + DESTDIR = ../debug + } else { + DESTDIR = ../release } +} else { + DESTDIR = .. } wince* { -- cgit v0.12 From eb48c652475a11d32e8ce5fd7d42cea827656f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Thu, 23 Apr 2009 11:44:00 +0200 Subject: Fixes for QByteArrayMatcher Copy constructor and assignment operator lose data: pointer to content and the length of content also need to be copied over. QByteArrayMatcher::pattern() would return a null byte array if instance was initialized with c-string. Changed default constructor to explicitly initialize pattern length to zero. The bug in the assignment operator is a regression against 4.4.3. Task-number: 251958 Reviewed-by: MariusSO Reviewed-by: paul --- src/corelib/tools/qbytearraymatcher.cpp | 3 +- src/corelib/tools/qbytearraymatcher.h | 7 +- tests/auto/qbytearraymatcher/qbytearraymatcher.pro | 4 + .../qbytearraymatcher/tst_qbytearraymatcher.cpp | 124 +++++++++++++++++++++ 4 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 tests/auto/qbytearraymatcher/qbytearraymatcher.pro create mode 100644 tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index cd4cf90..211d190 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -120,6 +120,7 @@ QByteArrayMatcher::QByteArrayMatcher() : d(0) { p.p = 0; + p.l = 0; qMemSet(p.q_skiptable, 0, sizeof(p.q_skiptable)); } @@ -170,7 +171,7 @@ QByteArrayMatcher::~QByteArrayMatcher() QByteArrayMatcher &QByteArrayMatcher::operator=(const QByteArrayMatcher &other) { q_pattern = other.q_pattern; - qMemCopy(p.q_skiptable, other.p.q_skiptable, sizeof(p.q_skiptable)); + qMemCopy(&p, &other.p, sizeof(p)); return *this; } diff --git a/src/corelib/tools/qbytearraymatcher.h b/src/corelib/tools/qbytearraymatcher.h index d7f2366..633e92c 100644 --- a/src/corelib/tools/qbytearraymatcher.h +++ b/src/corelib/tools/qbytearraymatcher.h @@ -67,7 +67,12 @@ public: int indexIn(const QByteArray &ba, int from = 0) const; int indexIn(const char *str, int len, int from = 0) const; - inline QByteArray pattern() const { return q_pattern; } + inline QByteArray pattern() const + { + if (q_pattern.isNull()) + return QByteArray((const char*)p.p, p.l); + return q_pattern; + } private: QByteArrayMatcherPrivate *d; diff --git a/tests/auto/qbytearraymatcher/qbytearraymatcher.pro b/tests/auto/qbytearraymatcher/qbytearraymatcher.pro new file mode 100644 index 0000000..1618c3e --- /dev/null +++ b/tests/auto/qbytearraymatcher/qbytearraymatcher.pro @@ -0,0 +1,4 @@ +load(qttest_p4) +SOURCES += tst_qbytearraymatcher.cpp + +QT = core diff --git a/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp b/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp new file mode 100644 index 0000000..c3f2fd9 --- /dev/null +++ b/tests/auto/qbytearraymatcher/tst_qbytearraymatcher.cpp @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include + +#include + +class tst_QByteArrayMatcher : public QObject +{ + Q_OBJECT + +private slots: + void interface(); + void task251958(); +}; + +static QByteArrayMatcher matcher1; + +void tst_QByteArrayMatcher::interface() +{ + const char needle[] = "abc123"; + QByteArray haystack(500, 'a'); + haystack.insert(6, "123"); + haystack.insert(31, "abc"); + haystack.insert(42, "abc123"); + haystack.insert(84, "abc123"); + + matcher1 = QByteArrayMatcher(QByteArray(needle)); + QByteArrayMatcher matcher2; + matcher2.setPattern(QByteArray(needle)); + + QByteArrayMatcher matcher3 = QByteArrayMatcher(QByteArray(needle)); + QByteArrayMatcher matcher4(needle, sizeof(needle - 1)); + QByteArrayMatcher matcher5(matcher2); + QByteArrayMatcher matcher6; + matcher6 = matcher3; + + QCOMPARE(matcher1.indexIn(haystack), 42); + QCOMPARE(matcher2.indexIn(haystack), 42); + QCOMPARE(matcher3.indexIn(haystack), 42); + QCOMPARE(matcher4.indexIn(haystack), 42); + QCOMPARE(matcher5.indexIn(haystack), 42); + QCOMPARE(matcher6.indexIn(haystack), 42); + + QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length()), 42); + + QCOMPARE(matcher1.indexIn(haystack, 43), 84); + QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length(), 43), 84); + QCOMPARE(matcher1.indexIn(haystack, 85), -1); + QCOMPARE(matcher1.indexIn(haystack.constData(), haystack.length(), 85), -1); + + QByteArrayMatcher matcher7(QByteArray("123")); + QCOMPARE(matcher7.indexIn(haystack), 6); + + matcher7 = QByteArrayMatcher(QByteArray("abc")); + QCOMPARE(matcher7.indexIn(haystack), 31); + + matcher7.setPattern(matcher4.pattern()); + QCOMPARE(matcher7.indexIn(haystack), 42); +} + + +static QByteArrayMatcher matcher; + +void tst_QByteArrayMatcher::task251958() +{ + const char p_data[] = { 0x0, 0x0, 0x1 }; + QByteArray pattern(p_data, sizeof(p_data)); + + QByteArray haystack(8, '\0'); + haystack[7] = 0x1; + + matcher = QByteArrayMatcher(pattern); + QCOMPARE(matcher.indexIn(haystack, 0), 5); + QCOMPARE(matcher.indexIn(haystack, 1), 5); + QCOMPARE(matcher.indexIn(haystack, 2), 5); + + matcher.setPattern(pattern); + QCOMPARE(matcher.indexIn(haystack, 0), 5); + QCOMPARE(matcher.indexIn(haystack, 1), 5); + QCOMPARE(matcher.indexIn(haystack, 2), 5); +} + +QTEST_APPLESS_MAIN(tst_QByteArrayMatcher) +#include "tst_qbytearraymatcher.moc" -- cgit v0.12 From 2e8ece735d6a31f4657192e77b9dc53fb2a03e9c Mon Sep 17 00:00:00 2001 From: Ariya Hidayat Date: Thu, 23 Apr 2009 14:13:35 +0200 Subject: Added Google Chat client as a new WebKit example Reviewed-by: Simon Hausmann --- demos/qtdemo/xml/examples.xml | 1 + doc/src/examples.qdoc | 1 + doc/src/examples/googlechat.qdoc | 51 +++++++ doc/src/images/googlechat-example.png | Bin 0 -> 52624 bytes examples/webkit/googlechat/form.ui | 214 ++++++++++++++++++++++++++++++ examples/webkit/googlechat/googlechat.cpp | 163 +++++++++++++++++++++++ examples/webkit/googlechat/googlechat.h | 71 ++++++++++ examples/webkit/googlechat/googlechat.pro | 11 ++ examples/webkit/googlechat/main.cpp | 51 +++++++ examples/webkit/webkit.pro | 3 +- 10 files changed, 565 insertions(+), 1 deletion(-) create mode 100644 doc/src/examples/googlechat.qdoc create mode 100644 doc/src/images/googlechat-example.png create mode 100644 examples/webkit/googlechat/form.ui create mode 100644 examples/webkit/googlechat/googlechat.cpp create mode 100644 examples/webkit/googlechat/googlechat.h create mode 100644 examples/webkit/googlechat/googlechat.pro create mode 100644 examples/webkit/googlechat/main.cpp diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml index 07c2691..667f9f2 100644 --- a/demos/qtdemo/xml/examples.xml +++ b/demos/qtdemo/xml/examples.xml @@ -217,6 +217,7 @@ + diff --git a/doc/src/examples.qdoc b/doc/src/examples.qdoc index 2b7aea3..efe9b2f 100644 --- a/doc/src/examples.qdoc +++ b/doc/src/examples.qdoc @@ -348,6 +348,7 @@ \list \o \l{webkit/previewer}{Previewer}\raisedaster \o \l{webkit/formextractor}{Form Extractor} + \o \l{webkit/googlechat}{Google Chat} \o \l{webkit/fancybrowser}{Fancy Browser} \endlist diff --git a/doc/src/examples/googlechat.qdoc b/doc/src/examples/googlechat.qdoc new file mode 100644 index 0000000..f2d61cf --- /dev/null +++ b/doc/src/examples/googlechat.qdoc @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webkit/googlechat + \title Google Chat Example + + The Google Chat example shows how to use implement a simple Google Chat + client with QtWebKit. + + \image googlechat-example.png + +*/ diff --git a/doc/src/images/googlechat-example.png b/doc/src/images/googlechat-example.png new file mode 100644 index 0000000..0338445 Binary files /dev/null and b/doc/src/images/googlechat-example.png differ diff --git a/examples/webkit/googlechat/form.ui b/examples/webkit/googlechat/form.ui new file mode 100644 index 0000000..3b9fb82 --- /dev/null +++ b/examples/webkit/googlechat/form.ui @@ -0,0 +1,214 @@ + + + Form + + + + 0 + 0 + 286 + 413 + + + + Google Talk Client + + + + 0 + + + 0 + + + + + 1 + + + + + + + Qt::Vertical + + + + 20 + 170 + + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + 24 + + + + + + + Qt::Vertical + + + + 20 + 169 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 119 + + + + + + + + Google username: + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 17 + + + + + + + + Password: + + + + + + + QLineEdit::Password + + + + + + + Qt::Vertical + + + + 20 + 118 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Login + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + 0 + + + 0 + + + + + + about:blank + + + + + + + + + + + + + QWebView + QWidget +
QtWebKit/QWebView
+
+
+ + +
diff --git a/examples/webkit/googlechat/googlechat.cpp b/examples/webkit/googlechat/googlechat.cpp new file mode 100644 index 0000000..9ac2cd2 --- /dev/null +++ b/examples/webkit/googlechat/googlechat.cpp @@ -0,0 +1,163 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "googlechat.h" + +#define GOOGLECHAT_URL "http://talkgadget.google.com/talkgadget/m" + +GoogleChat::GoogleChat(): QWidget() { + form.setupUi(this); + setFixedSize(320, 480); + + form.userNameEdit->setFocus(); + connect(form.userNameEdit, SIGNAL(textChanged(QString)), SLOT(adjustLoginButton())); + connect(form.userNameEdit, SIGNAL(returnPressed()), SLOT(inputPassword())); + + connect(form.passwordEdit, SIGNAL(textChanged(QString)), SLOT(adjustLoginButton())); + connect(form.passwordEdit, SIGNAL(returnPressed()), SLOT(doLogin())); + + form.loginButton->setEnabled(false); + connect(form.loginButton, SIGNAL(clicked()), SLOT(doLogin())); + + connect(form.webView, SIGNAL(loadFinished(bool)), SLOT(initialPage(bool))); + connect(form.webView, SIGNAL(loadProgress(int)), + form.progressBar, SLOT(setValue(int))); + form.webView->setUrl((QUrl(GOOGLECHAT_URL))); + form.webView->setContextMenuPolicy(Qt::PreventContextMenu); + + showStatus("Wait..."); +} + +void GoogleChat::showStatus(const QString &msg) { + form.statusLabel->setText(msg); + form.stackedWidget->setCurrentIndex(0); +} + +void GoogleChat::showError(const QString &msg) { + form.progressBar->hide(); + showStatus(QString("Error: %1").arg(msg)); +} + +QString GoogleChat::evalJS(const QString &js) { + QWebFrame *frame = form.webView->page()->mainFrame(); + return frame->evaluateJavaScript(js).toString(); +} + +void GoogleChat::adjustLoginButton() { + userName = form.userNameEdit->text(); + password = form.passwordEdit->text(); + bool ok = !userName.isEmpty() && !password.isEmpty(); + form.loginButton->setEnabled(ok); +} + +void GoogleChat::inputPassword() { + if (!form.userNameEdit->text().isEmpty()) + form.passwordEdit->setFocus(); +} + +void GoogleChat::doLogin() { + userName = form.userNameEdit->text(); + password = form.passwordEdit->text(); + bool ok = !userName.isEmpty() && !password.isEmpty(); + if (!ok) + return; + + form.progressBar->setValue(0); + form.progressBar->show(); + connect(form.webView, SIGNAL(loadFinished(bool)), SLOT(loginPage(bool))); + connect(form.webView, SIGNAL(loadProgress(int)), + form.progressBar, SLOT(setValue(int))); + showStatus("Logging in..."); + + QString userEmail = userName + "@gmail.com"; + evalJS(QString("document.getElementById('Email').value = \"%1\";").arg(userEmail)); + evalJS(QString("document.getElementById('Passwd').value = \"%1\";").arg(password)); + evalJS("document.getElementById('gaia_loginform').submit();"); +} + +void GoogleChat::initialPage(bool ok) { + if (ok) { + QString s1 = evalJS("document.getElementById('Email').name"); + QString s2 = evalJS("document.getElementById('Passwd').name"); + QString s3 = evalJS("document.getElementById('gaia_loginform').id"); + if (s1 == "Email" && s2 == "Passwd" && s3 == "gaia_loginform") { + form.stackedWidget->setCurrentIndex(1); + form.webView->disconnect(); + return; + } + } + + showError("SERVICE unavailable."); +} + +void GoogleChat::hideElements() +{ + evalJS("var e = document.getElementsByClassName('footer-footer')[0]; e.parentElement.removeChild(e)"); + evalJS("var e = document.getElementsByClassName('title-bar-bg title-bar')[0]; e.parentElement.removeChild(e)"); + QTimer::singleShot(2000, this, SLOT(hideElements())); +} + +void GoogleChat::loginPage(bool ok) { + QString location = form.webView->url().toString(); + if (!ok) { + if (location.indexOf("CheckCookie")) + return; + showError("Service unavailable"); + } else { + // check for any error message + QString c = evalJS("document.getElementsByClassName('errormsg').length"); + if (c == "0") { + form.stackedWidget->setCurrentIndex(2); + QTimer::singleShot(500, this, SLOT(hideElements())); + return; + } + + QString err = "Unknown login failure."; + if (c == "1") { + err = evalJS("document.getElementsByClassName('errormsg')[0].textContent"); + err = err.simplified(); + } + showError(err); + } +} diff --git a/examples/webkit/googlechat/googlechat.h b/examples/webkit/googlechat/googlechat.h new file mode 100644 index 0000000..c92632c --- /dev/null +++ b/examples/webkit/googlechat/googlechat.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "ui_form.h" + +class GoogleChat: public QWidget +{ + Q_OBJECT + +public: + GoogleChat(); + +protected: + void showStatus(const QString &msg); + void showError(const QString &msg); + QString evalJS(const QString &js); + +private slots: + + void adjustLoginButton(); + void inputPassword(); + void doLogin(); + void initialPage(bool ok); + void loginPage(bool ok); + void hideElements(); + +private: + Ui::Form form; + QString userName; + QString password; +}; diff --git a/examples/webkit/googlechat/googlechat.pro b/examples/webkit/googlechat/googlechat.pro new file mode 100644 index 0000000..14b7085 --- /dev/null +++ b/examples/webkit/googlechat/googlechat.pro @@ -0,0 +1,11 @@ +QT += webkit +HEADERS = googlechat.h +SOURCES = main.cpp \ + googlechat.cpp +FORMS = form.ui + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/webkit/googlechat +sources.files = $$SOURCES $$HEADERS $$FORMS *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/googlechat +INSTALLS += target sources diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp new file mode 100644 index 0000000..26feeea --- /dev/null +++ b/examples/webkit/googlechat/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "googlechat.h" + +int main(int argc, char * argv[]) +{ + QApplication app(argc, argv); + GoogleChat *chat = new GoogleChat; + chat->show(); + return app.exec(); +} diff --git a/examples/webkit/webkit.pro b/examples/webkit/webkit.pro index a49830a..225816a 100644 --- a/examples/webkit/webkit.pro +++ b/examples/webkit/webkit.pro @@ -1,7 +1,8 @@ TEMPLATE = subdirs SUBDIRS += formextractor \ previewer \ - fancybrowser + fancybrowser \ + googlechat # install target.path = $$[QT_INSTALL_EXAMPLES]/webkit -- cgit v0.12