Mercurial > projects > qtd
comparison demos/browser/browsermainwindow.d @ 74:37caa90ce503
more porting
author | mandel |
---|---|
date | Fri, 22 May 2009 23:43:58 +0000 |
parents | 7bfd46c330dc |
children | 0654fc9bac95 |
comparison
equal
deleted
inserted
replaced
73:7bfd46c330dc | 74:37caa90ce503 |
---|---|
36 ** If you are unsure which license is appropriate for your use, please | 36 ** If you are unsure which license is appropriate for your use, please |
37 ** contact the sales department at qt-sales@nokia.com. | 37 ** contact the sales department at qt-sales@nokia.com. |
38 ** $QT_END_LICENSE$ | 38 ** $QT_END_LICENSE$ |
39 ** | 39 ** |
40 ****************************************************************************/ | 40 ****************************************************************************/ |
41 module browsermainwindow: | 41 module browsermainwindow; |
42 | 42 |
43 | 43 |
44 import qt.core.QUrl; | 44 import qt.core.QUrl; |
45 import qt.core.QSettings; | 45 import qt.core.QSettings; |
46 import qt.gui.QMainWindow; | 46 import qt.gui.QMainWindow; |
85 | 85 |
86 static const qint32 BrowserMainWindowMagic = 0xba; | 86 static const qint32 BrowserMainWindowMagic = 0xba; |
87 | 87 |
88 public: | 88 public: |
89 | 89 |
90 this(QWidget parent = null, Qt.WindowFlags flags = 0); | 90 this(QWidget parent = null, Qt.WindowFlags flags = 0) |
91 { | 91 { |
92 super(parent, flags); | 92 super(parent, flags); |
93 m_tabWidget = new TabWidget(this); | 93 m_tabWidget = new TabWidget(this); |
94 m_autoSaver = new AutoSaver(this); | 94 m_autoSaver = new AutoSaver(this); |
95 m_historyBack = 0; | 95 m_historyBack = 0; |
163 return size; | 163 return size; |
164 } | 164 } |
165 | 165 |
166 public: | 166 public: |
167 | 167 |
168 static QUrl guessUrlFromString(QString &string) | 168 static QUrl guessUrlFromString(QString string) |
169 { | 169 { |
170 QString urlStr = string.trimmed(); | 170 QString urlStr = string.trimmed(); |
171 QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*")); | 171 auto test = new QRegExp(QLatin1String("^[a-zA-Z]+\\:.*")); |
172 | 172 |
173 // Check if it looks like a qualified URL. Try parsing it and see. | 173 // Check if it looks like a qualified URL. Try parsing it and see. |
174 bool hasSchema = test.exactMatch(urlStr); | 174 bool hasSchema = test.exactMatch(urlStr); |
175 if (hasSchema) { | 175 if (hasSchema) { |
176 QUrl url = QUrl.fromEncoded(urlStr.toUtf8(), QUrl.TolerantMode); | 176 QUrl url = QUrl.fromEncoded(urlStr.toUtf8(), QUrl.TolerantMode); |
216 return m_tabWidget.currentWebView(); | 216 return m_tabWidget.currentWebView(); |
217 } | 217 } |
218 | 218 |
219 QByteArray saveState(bool withTabs) | 219 QByteArray saveState(bool withTabs) |
220 { | 220 { |
221 int version = 2; | 221 int version_ = 2; |
222 QByteArray data; | 222 QByteArray data; |
223 QDataStream stream(&data, QIODevice.WriteOnly); | 223 auto stream = new QDataStream(&data, QIODevice.WriteOnly); |
224 | 224 |
225 stream << qint32(BrowserMainWindowMagic); | 225 stream << qint32(BrowserMainWindowMagic); |
226 stream << qint32(version); | 226 stream << qint32(version_); |
227 | 227 |
228 stream << size(); | 228 stream << size(); |
229 stream << !m_navigationBar.isHidden(); | 229 stream << !m_navigationBar.isHidden(); |
230 stream << !m_bookmarksToolbar.isHidden(); | 230 stream << !m_bookmarksToolbar.isHidden(); |
231 stream << !statusBar().isHidden(); | 231 stream << !statusBar().isHidden(); |
239 | 239 |
240 bool restoreState(QByteArray state) | 240 bool restoreState(QByteArray state) |
241 { | 241 { |
242 int version_ = 2; | 242 int version_ = 2; |
243 QByteArray sd = state; | 243 QByteArray sd = state; |
244 QDataStream stream(&sd, QIODevice.ReadOnly); | 244 auto stream = new QDataStream(&sd, QIODevice.ReadOnly); |
245 if (stream.atEnd()) | 245 if (stream.atEnd()) |
246 return false; | 246 return false; |
247 | 247 |
248 qint32 marker; | 248 qint32 marker; |
249 qint32 v; | 249 qint32 v; |
287 { | 287 { |
288 QUrl url = guessUrlFromString(page); | 288 QUrl url = guessUrlFromString(page); |
289 loadUrl(url); | 289 loadUrl(url); |
290 } | 290 } |
291 | 291 |
292 | |
293 void slotHome() | 292 void slotHome() |
294 { | 293 { |
295 QSettings settings; | 294 QSettings settings; |
296 settings.beginGroup(QLatin1String("MainWindow")); | 295 settings.beginGroup(QLatin1String("MainWindow")); |
297 QString home = settings.value(QLatin1String("home"), QLatin1String("http://qtsoftware.com/")).toString(); | 296 QString home = settings.value(QLatin1String("home"), QLatin1String("http://qtsoftware.com/")).toString(); |
298 loadPage(home); | 297 loadPage(home); |
299 } | 298 } |
300 | 299 |
301 protected: | 300 protected: |
302 | 301 |
303 void closeEvent(QCloseEvent event); | 302 void closeEvent(QCloseEvent event) |
304 { | 303 { |
305 if (m_tabWidget.count() > 1) { | 304 if (m_tabWidget.count() > 1) { |
306 int ret = QMessageBox.warning(this, QString(), | 305 int ret = QMessageBox.warning(this, QString(), |
307 tr("Are you sure you want to close the window?" | 306 tr("Are you sure you want to close the window?" |
308 " There are %1 tab open").arg(m_tabWidget.count()), | 307 " There are %1 tab open").arg(m_tabWidget.count()), |
347 m_stopReload.triggered.connect(&m_reload.trigger); | 346 m_stopReload.triggered.connect(&m_reload.trigger); |
348 m_stopReload.setToolTip(tr("Reload the current page")); | 347 m_stopReload.setToolTip(tr("Reload the current page")); |
349 } | 348 } |
350 } | 349 } |
351 | 350 |
352 void slotUpdateStatusbar(QString &string); | 351 void slotUpdateStatusbar(QString string) |
353 { | 352 { |
354 statusBar().showMessage(string, 2000); | 353 statusBar().showMessage(string, 2000); |
355 } | 354 } |
356 | 355 |
357 void slotUpdateWindowTitle(QString &title = QString()) | 356 void slotUpdateWindowTitle(QString title = QString()) |
358 { | 357 { |
359 if (title.isEmpty()) { | 358 if (title.isEmpty()) { |
360 setWindowTitle(tr("Qt Demo Browser")); | 359 setWindowTitle(tr("Qt Demo Browser")); |
361 } else { | 360 } else { |
362 version(Q_WS_MAC) | 361 version(Q_WS_MAC) |
366 setWindowTitle(tr("%1 - Qt Demo Browser", "Page title and Browser name").arg(title)); | 365 setWindowTitle(tr("%1 - Qt Demo Browser", "Page title and Browser name").arg(title)); |
367 } | 366 } |
368 } | 367 } |
369 } | 368 } |
370 | 369 |
371 void loadUrl(QUrl &url); | 370 void loadUrl(QUrl url) |
372 { | 371 { |
373 if (!currentTab() || !url.isValid()) | 372 if (!currentTab() || !url.isValid()) |
374 return; | 373 return; |
375 | 374 |
376 m_tabWidget.currentLineEdit().setText(QString.fromUtf8(url.toEncoded())); | 375 m_tabWidget.currentLineEdit().setText(QString.fromUtf8(url.toEncoded())); |
399 return; | 398 return; |
400 | 399 |
401 loadPage(file); | 400 loadPage(file); |
402 } | 401 } |
403 | 402 |
404 void slotFilePrintPreview(); | 403 void slotFilePrintPreview() |
405 { | 404 { |
406 version(QT_NO_PRINTER) | 405 version(QT_NO_PRINTER) |
407 { | 406 { |
408 if (!currentTab()) | 407 if (!currentTab()) |
409 return; | 408 return; |
426 bool pb = settings.testAttribute(QWebSettings.PrivateBrowsingEnabled); | 425 bool pb = settings.testAttribute(QWebSettings.PrivateBrowsingEnabled); |
427 if (!pb) { | 426 if (!pb) { |
428 QString title = tr("Are you sure you want to turn on private browsing?"); | 427 QString title = tr("Are you sure you want to turn on private browsing?"); |
429 QString text = tr("<b>%1</b><br><br>When private browsing in turned on," | 428 QString text = tr("<b>%1</b><br><br>When private browsing in turned on," |
430 " webpages are not added to the history," | 429 " webpages are not added to the history," |
431 " items are automatically removed from the Downloads window," \ | 430 " items are automatically removed from the Downloads window," |
432 " new cookies are not stored, current cookies can't be accessed," \ | 431 " new cookies are not stored, current cookies can't be accessed," |
433 " site icons wont be stored, session wont be saved, " \ | 432 " site icons wont be stored, session wont be saved, " |
434 " and searches are not addded to the pop-up menu in the Google search box." \ | 433 " and searches are not addded to the pop-up menu in the Google search box." |
435 " Until you close the window, you can still click the Back and Forward buttons" \ | 434 " Until you close the window, you can still click the Back and Forward buttons" |
436 " to return to the webpages you have opened.").arg(title); | 435 " to return to the webpages you have opened.").arg(title); |
437 | 436 |
438 QMessageBox.StandardButton button = QMessageBox.question(this, QString(), text, | 437 QMessageBox.StandardButton button = QMessageBox.question(this, QString(), text, |
439 QMessageBox.Ok | QMessageBox.Cancel, | 438 QMessageBox.Ok | QMessageBox.Cancel, |
440 QMessageBox.Ok); | 439 QMessageBox.Ok); |
442 settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, true); | 441 settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, true); |
443 } | 442 } |
444 } else { | 443 } else { |
445 settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, false); | 444 settings.setAttribute(QWebSettings.PrivateBrowsingEnabled, false); |
446 | 445 |
447 QList<BrowserMainWindow*> windows = BrowserApplication.instance().mainWindows(); | 446 BrowserMainWindow[] windows = BrowserApplication.instance().mainWindows(); |
448 for (int i = 0; i < windows.count(); ++i) { | 447 for (int i = 0; i < windows.count(); ++i) { |
449 BrowserMainWindow window = windows.at(i); | 448 BrowserMainWindow window = windows.at(i); |
450 window.m_lastSearch = QString.null; | 449 window.m_lastSearch = null; //QString::null |
451 window.tabWidget().clear(); | 450 window.tabWidget().clear(); |
452 } | 451 } |
453 } | 452 } |
454 } | 453 } |
455 | 454 |
461 void slotEditFind() | 460 void slotEditFind() |
462 { | 461 { |
463 if (!currentTab()) | 462 if (!currentTab()) |
464 return; | 463 return; |
465 bool ok; | 464 bool ok; |
466 QString search = QInputDialog.getText(this, tr("Find"), | 465 QString search = QInputDialog.getText(this, tr("Find"), tr("Text:"), QLineEdit.Normal, m_lastSearch, &ok); |
467 tr("Text:"), QLineEdit.Normal, m_lastSearch, &ok); | |
468 if (ok && !search.isEmpty()) { | 466 if (ok && !search.isEmpty()) { |
469 m_lastSearch = search; | 467 m_lastSearch = search; |
470 if (!currentTab().findText(m_lastSearch)) | 468 if (!currentTab().findText(m_lastSearch)) |
471 slotUpdateStatusbar(tr("\"%1\" not found.").arg(m_lastSearch)); | 469 slotUpdateStatusbar(tr("\"%1\" not found.").arg(m_lastSearch)); |
472 } | 470 } |
484 if (!currentTab() && !m_lastSearch.isEmpty()) | 482 if (!currentTab() && !m_lastSearch.isEmpty()) |
485 return; | 483 return; |
486 currentTab().findText(m_lastSearch, QWebPage.FindBackward); | 484 currentTab().findText(m_lastSearch, QWebPage.FindBackward); |
487 } | 485 } |
488 | 486 |
489 | 487 void slotShowBookmarksDialog() |
490 void slotShowBookmarksDialog(); | |
491 { | 488 { |
492 BookmarksDialog dialog = new BookmarksDialog(this); | 489 BookmarksDialog dialog = new BookmarksDialog(this); |
493 dialog.openUrl.connect(&m_tabWidget.loadUrlInCurrentTab); | 490 dialog.openUrl.connect(&m_tabWidget.loadUrlInCurrentTab); |
494 dialog.show(); | 491 dialog.show(); |
495 } | 492 } |
599 { | 596 { |
600 m_toolbarSearch.lineEdit().selectAll(); | 597 m_toolbarSearch.lineEdit().selectAll(); |
601 m_toolbarSearch.lineEdit().setFocus(); | 598 m_toolbarSearch.lineEdit().setFocus(); |
602 } | 599 } |
603 | 600 |
604 void slotToggleInspector(bool enable); | 601 void slotToggleInspector(bool enable) |
605 { | 602 { |
606 QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, enable); | 603 QWebSettings.globalSettings().setAttribute(QWebSettings.DeveloperExtrasEnabled, enable); |
607 if (enable) { | 604 if (enable) { |
608 int result = QMessageBox.question(this, tr("Web Inspector"), | 605 int result = QMessageBox.question(this, tr("Web Inspector"), |
609 tr("The web inspector will only work correctly for pages that were loaded after enabling.\n" | 606 tr("The web inspector will only work correctly for pages that were loaded after enabling.\n" |
629 void slotDownloadManager() | 626 void slotDownloadManager() |
630 { | 627 { |
631 BrowserApplication.downloadManager().show(); | 628 BrowserApplication.downloadManager().show(); |
632 } | 629 } |
633 | 630 |
634 void slotSelectLineEdit(); | 631 void slotSelectLineEdit() |
635 { | 632 { |
636 m_tabWidget.currentLineEdit().selectAll(); | 633 m_tabWidget.currentLineEdit().selectAll(); |
637 m_tabWidget.currentLineEdit().setFocus(); | 634 m_tabWidget.currentLineEdit().setFocus(); |
638 } | 635 } |
639 | 636 |
640 void slotAboutToShowBackMenu(); | 637 void slotAboutToShowBackMenu() |
641 { | 638 { |
642 m_historyBackMenu.clear(); | 639 m_historyBackMenu.clear(); |
643 if (!currentTab()) | 640 if (!currentTab()) |
644 return; | 641 return; |
645 QWebHistory history = currentTab().history(); | 642 QWebHistory history = currentTab().history(); |
653 action.setText(item.title()); | 650 action.setText(item.title()); |
654 m_historyBackMenu.addAction(action); | 651 m_historyBackMenu.addAction(action); |
655 } | 652 } |
656 } | 653 } |
657 | 654 |
658 | 655 void slotAboutToShowForwardMenu() |
659 void slotAboutToShowForwardMenu(); | |
660 { | 656 { |
661 m_historyForwardMenu.clear(); | 657 m_historyForwardMenu.clear(); |
662 if (!currentTab()) | 658 if (!currentTab()) |
663 return; | 659 return; |
664 QWebHistory history = currentTab().history(); | 660 QWebHistory history = currentTab().history(); |
681 m_windowMenu.addAction(m_tabWidget.previousTabAction()); | 677 m_windowMenu.addAction(m_tabWidget.previousTabAction()); |
682 m_windowMenu.addSeparator(); | 678 m_windowMenu.addSeparator(); |
683 m_windowMenu.addAction(tr("Downloads"), this, SLOT(slotDownloadManager()), QKeySequence(tr("Alt+Ctrl+L", "Download Manager"))); | 679 m_windowMenu.addAction(tr("Downloads"), this, SLOT(slotDownloadManager()), QKeySequence(tr("Alt+Ctrl+L", "Download Manager"))); |
684 | 680 |
685 m_windowMenu.addSeparator(); | 681 m_windowMenu.addSeparator(); |
686 QList<BrowserMainWindow*> windows = BrowserApplication.instance().mainWindows(); | 682 BrowserMainWindow[] windows = BrowserApplication.instance().mainWindows(); |
687 for (int i = 0; i < windows.count(); ++i) { | 683 for (int i = 0; i < windows.count(); ++i) { |
688 BrowserMainWindow window = windows.at(i); | 684 BrowserMainWindow window = windows.at(i); |
689 QAction action = m_windowMenu.addAction(window.windowTitle(), this, SLOT(slotShowWindow())); | 685 QAction action = m_windowMenu.addAction(window.windowTitle(), this, SLOT(slotShowWindow())); |
690 action.setData(i); | 686 action.setData(i); |
691 action.setCheckable(true); | 687 action.setCheckable(true); |
704 history.goToItem(history.forwardItems(history.count() - offset + 1).back()); // forward | 700 history.goToItem(history.forwardItems(history.count() - offset + 1).back()); // forward |
705 } | 701 } |
706 | 702 |
707 void slotShowWindow() | 703 void slotShowWindow() |
708 { | 704 { |
709 if (QAction action = qobject_cast<QAction*>(sender())) { | 705 if (QAction action = cast(QAction) sender()) { |
710 QVariant v = action.data(); | 706 QVariant v = action.data(); |
711 if (v.canConvert<int>()) { | 707 if (v.canConvert!(int)()) { |
712 int offset = qvariant_cast<int>(v); | 708 int offset = cast(int) v; |
713 QList<BrowserMainWindow*> windows = BrowserApplication.instance().mainWindows(); | 709 BrowserMainWindow[] windows = BrowserApplication.instance().mainWindows(); |
714 windows.at(offset).activateWindow(); | 710 windows.at(offset).activateWindow(); |
715 windows.at(offset).currentTab().setFocus(); | 711 windows.at(offset).currentTab().setFocus(); |
716 } | 712 } |
717 } | 713 } |
718 } | 714 } |
736 return; | 732 return; |
737 frame.print(&printer); | 733 frame.print(&printer); |
738 } | 734 } |
739 } | 735 } |
740 | 736 |
741 void geometryChangeRequested(QRect &geometry) | 737 void geometryChangeRequested(QRect geometry) |
742 { | 738 { |
743 setGeometry(geometry); | 739 setGeometry(geometry); |
744 } | 740 } |
745 | |
746 | 741 |
747 void updateToolbarActionText(bool visible) | 742 void updateToolbarActionText(bool visible) |
748 { | 743 { |
749 m_viewToolbar.setText(!visible ? tr("Show Toolbar") : tr("Hide Toolbar")); | 744 m_viewToolbar.setText(!visible ? tr("Show Toolbar") : tr("Hide Toolbar")); |
750 } | 745 } |
763 QByteArray data = settings.value(QLatin1String("defaultState")).toByteArray(); | 758 QByteArray data = settings.value(QLatin1String("defaultState")).toByteArray(); |
764 restoreState(data); | 759 restoreState(data); |
765 settings.endGroup(); | 760 settings.endGroup(); |
766 } | 761 } |
767 | 762 |
768 void setupMenu(); | 763 void setupMenu() |
769 { | 764 { |
770 new QShortcut(QKeySequence(Qt.Key_F6), this, SLOT(slotSwapFocus())); | 765 new QShortcut(QKeySequence(Qt.Key_F6), this, SLOT(slotSwapFocus())); |
771 | 766 |
772 // File | 767 // File |
773 QMenu fileMenu = menuBar().addMenu(tr("&File")); | 768 QMenu fileMenu = menuBar().addMenu(tr("&File")); |
856 viewMenu.addAction(m_viewStatusbar); | 851 viewMenu.addAction(m_viewStatusbar); |
857 | 852 |
858 viewMenu.addSeparator(); | 853 viewMenu.addSeparator(); |
859 | 854 |
860 m_stop = viewMenu.addAction(tr("&Stop")); | 855 m_stop = viewMenu.addAction(tr("&Stop")); |
861 QList<QKeySequence> shortcuts; | 856 QKeySequence[] shortcuts; |
862 shortcuts.append(QKeySequence(Qt.CTRL | Qt.Key_Period)); | 857 shortcuts.append(QKeySequence(Qt.CTRL | Qt.Key_Period)); |
863 shortcuts.append(Qt.Key_Escape); | 858 shortcuts.append(Qt.Key_Escape); |
864 m_stop.setShortcuts(shortcuts); | 859 m_stop.setShortcuts(shortcuts); |
865 m_tabWidget.addWebAction(m_stop, QWebPage.Stop); | 860 m_tabWidget.addWebAction(m_stop, QWebPage.Stop); |
866 | 861 |
876 zoomTextOnlyAction.setCheckable(true); | 871 zoomTextOnlyAction.setCheckable(true); |
877 zoomTextOnlyAction.setChecked(false); | 872 zoomTextOnlyAction.setChecked(false); |
878 | 873 |
879 viewMenu.addSeparator(); | 874 viewMenu.addSeparator(); |
880 viewMenu.addAction(tr("Page S&ource"), this, SLOT(slotViewPageSource()), tr("Ctrl+Alt+U")); | 875 viewMenu.addAction(tr("Page S&ource"), this, SLOT(slotViewPageSource()), tr("Ctrl+Alt+U")); |
881 QAction a = viewMenu.addAction(tr("&Full Screen"), this, SLOT(slotViewFullScreen(bool)), Qt.Key_F11); | 876 QAction a = viewMenu.addAction(tr("&Full Screen"), this, SLOT(slotViewFullScreen), Qt.Key_F11); |
882 a.setCheckable(true); | 877 a.setCheckable(true); |
883 | 878 |
884 // History | 879 // History |
885 HistoryMenu historyMenu = new HistoryMenu(this); | 880 HistoryMenu historyMenu = new HistoryMenu(this); |
886 historyMenu.openUrl.connect(&m_tabWidget.loadUrlInCurrentTab); | 881 historyMenu.openUrl.connect(&m_tabWidget.loadUrlInCurrentTab); |
887 historyMenu.hovered.connect(&this.slotUpdateStatusbar); | 882 historyMenu.hovered.connect(&this.slotUpdateStatusbar); |
888 historyMenu.setTitle(tr("Hi&story")); | 883 historyMenu.setTitle(tr("Hi&story")); |
889 menuBar().addMenu(historyMenu); | 884 menuBar().addMenu(historyMenu); |
890 QList<QAction> historyActions; | 885 QAction[] historyActions; |
891 | 886 |
892 m_historyBack = new QAction(tr("Back"), this); | 887 m_historyBack = new QAction(tr("Back"), this); |
893 m_tabWidget.addWebAction(m_historyBack, QWebPage.Back); | 888 m_tabWidget.addWebAction(m_historyBack, QWebPage.Back); |
894 m_historyBack.setShortcuts(QKeySequence.Back); | 889 m_historyBack.setShortcuts(QKeySequence.Back); |
895 m_historyBack.setIconVisibleInMenu(false); | 890 m_historyBack.setIconVisibleInMenu(false); |
919 bookmarksMenu.openUrl.connect(&m_tabWidget.loadUrlInCurrentTab); | 914 bookmarksMenu.openUrl.connect(&m_tabWidget.loadUrlInCurrentTab); |
920 bookmarksMenu.hovered.connect(&this.slotUpdateStatusbar); | 915 bookmarksMenu.hovered.connect(&this.slotUpdateStatusbar); |
921 bookmarksMenu.setTitle(tr("&Bookmarks")); | 916 bookmarksMenu.setTitle(tr("&Bookmarks")); |
922 menuBar().addMenu(bookmarksMenu); | 917 menuBar().addMenu(bookmarksMenu); |
923 | 918 |
924 QList<QAction> bookmarksActions; | 919 QAction[] bookmarksActions; |
925 | 920 |
926 QAction showAllBookmarksAction = new QAction(tr("Show All Bookmarks"), this); | 921 QAction showAllBookmarksAction = new QAction(tr("Show All Bookmarks"), this); |
927 showAllBookmarksAction.triggered().connect(&this.slotShowBookmarksDialog); | 922 showAllBookmarksAction.triggered().connect(&this.slotShowBookmarksDialog); |
928 m_addBookmark = new QAction(QIcon(QLatin1String(":addbookmark.png")), tr("Add Bookmark..."), this); | 923 m_addBookmark = new QAction(QIcon(QLatin1String(":addbookmark.png")), tr("Add Bookmark..."), this); |
929 m_addBookmark.setIconVisibleInMenu(false); | 924 m_addBookmark.setIconVisibleInMenu(false); |
942 | 937 |
943 QMenu toolsMenu = menuBar().addMenu(tr("&Tools")); | 938 QMenu toolsMenu = menuBar().addMenu(tr("&Tools")); |
944 toolsMenu.addAction(tr("Web &Search"), this, SLOT(slotWebSearch()), QKeySequence(tr("Ctrl+K", "Web Search"))); | 939 toolsMenu.addAction(tr("Web &Search"), this, SLOT(slotWebSearch()), QKeySequence(tr("Ctrl+K", "Web Search"))); |
945 version(Q_CC_MINGW) | 940 version(Q_CC_MINGW) |
946 { | 941 { |
947 a = toolsMenu.addAction(tr("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool))); | 942 a = toolsMenu.addAction(tr("Enable Web &Inspector"), this, SLOT(slotToggleInspector)); |
948 a.setCheckable(true); | 943 a.setCheckable(true); |
949 } | 944 } |
950 | 945 |
951 QMenu helpMenu = menuBar().addMenu(tr("&Help")); | 946 QMenu helpMenu = menuBar().addMenu(tr("&Help")); |
952 helpMenu.addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); | 947 helpMenu.addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); |