From fb612bbc722ef83c65c63961723f10969f9a6cee Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 1 Apr 2009 12:48:03 +0200 Subject: Importing clones PART 1 I apologies for this "strange" way of importing code. But we have 3 (or 4) different ideas about UIs.. and I have to decide one. So, best way I found is importing manually changes. I'll write something about that soon. We basically need to better learn git cooperation (I'm first). Anyway, thank you a lot for your time and your ideas. I really apprecciate your efforts ;) --- src/mainwindow.cpp | 51 +++++++++++++++++++++++++++++++++------------------ src/mainwindow.h | 9 ++++++--- src/rekonqui.rc | 12 ++++++++++-- 3 files changed, 49 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2a5f9295..92040bfe 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -65,12 +65,14 @@ MainWindow::MainWindow() : KXmlGuiWindow() , m_view(new MainView(this)) , m_bookmarksProvider(new BookmarksProvider(this)) + , m_findBar(new FindBar(this)) + , m_searchBar(new SearchBar(this)) { // accept dnd setAcceptDrops(true); // updating rekonq configuration - slotUpdateConf(); + slotUpdateConfiguration(); // creating a centralWidget containing m_view and the hidden findbar QWidget *centralWidget = new QWidget; @@ -78,8 +80,7 @@ MainWindow::MainWindow() layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_view); - // Find Bar - m_findBar = new FindBar(this); + // Adding Find Bar connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); layout->addWidget(m_findBar); @@ -112,6 +113,9 @@ MainWindow::MainWindow() // add a status bar statusBar()->show(); + // setting up toolbars: this has to be done BEFORE setupGUI!! + setupToolBars(); + // ----- BOOKMARKS MENU: this has to be done BEFORE setupGUI!! KAction *a = new KActionMenu(i18n("B&ookmarks"), this); actionCollection()->addAction(QLatin1String("bookmarks"), a); @@ -125,26 +129,14 @@ MainWindow::MainWindow() // toolbar position, icon size, etc. setupGUI(); - // setup history menu + // setup history menu: this has to be done AFTER setupGUI!! setupHistoryMenu(); // setup Tab Bar setupTabBar(); - // setting up custom widgets.. - KToolBar *navigationBar = toolBar("mainToolBar"); - navigationBar->addWidget(m_view->lineEditStack()); - - KToolBar *bmToolbar = toolBar("bookmarksToolBar"); - m_bookmarksProvider->provideBmToolbar(bmToolbar); - // setting up toolbars to NOT have context menu enabled setContextMenuPolicy(Qt::DefaultContextMenu); - - // search bar - m_searchBar = new SearchBar(this); - connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); - navigationBar->addWidget(m_searchBar); } @@ -162,6 +154,29 @@ QSize MainWindow::sizeHint() const } +void MainWindow::setupToolBars() +{ + KAction *a; + + // location bar + a = new KAction(i18n("Location Bar"), this); + a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_L, Qt::Key_F6)); + a->setDefaultWidget(m_view->lineEditStack()); + actionCollection()->addAction(QLatin1String("url_bar"), a); + + // search bar + a = new KAction(i18n("Search Bar"), this); + a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_K)); + a->setDefaultWidget(m_searchBar); + connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); + actionCollection()->addAction(QLatin1String("search_bar"), a); + + // bookmarks bar + KToolBar *bmToolbar = toolBar("bookmarksToolBar"); + m_bookmarksProvider->provideBmToolbar(bmToolbar); +} + + void MainWindow::setupActions() { KAction *a; @@ -298,7 +313,7 @@ void MainWindow::setupHistoryMenu() } -void MainWindow::slotUpdateConf() +void MainWindow::slotUpdateConfiguration() { // ============== General ================== m_homePage = ReKonfig::homePage(); @@ -334,7 +349,7 @@ void MainWindow::slotUpdateConf() void MainWindow::slotUpdateBrowser() { - slotUpdateConf(); + slotUpdateConfiguration(); mainView()->reloadAllTabs(); } diff --git a/src/mainwindow.h b/src/mainwindow.h index c9bec75e..c12f8fce 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -64,6 +64,7 @@ private: void setupActions(); void setupHistoryMenu(); void setupTabBar(); + void setupToolBars(); public slots: void slotHome(); @@ -71,7 +72,7 @@ public slots: void slotUpdateBrowser(); private slots: - void slotUpdateConf(); + void slotUpdateConfiguration(); void slotLoadProgress(int); void slotUpdateStatusbar(const QString &string); void slotUpdateActions(); @@ -114,20 +115,22 @@ private slots: void slotPreferences(); private: - SearchBar *m_searchBar; - FindBar *m_findBar; KMenu *m_historyBackMenu; KMenu *m_windowMenu; + KAction *m_stopReloadAction; KAction *m_stopAction; KAction *m_reloadAction; KAction *m_historyBackAction; KAction *m_historyForwardAction; + QString m_lastSearch; QString m_homePage; MainView *m_view; BookmarksProvider *m_bookmarksProvider; + FindBar *m_findBar; + SearchBar *m_searchBar; }; #endif // MAINWINDOW_H diff --git a/src/rekonqui.rc b/src/rekonqui.rc index babf2c62..bc4f9c37 100644 --- a/src/rekonqui.rc +++ b/src/rekonqui.rc @@ -1,6 +1,6 @@ - + @@ -68,13 +68,21 @@ -Main Toolbar + +Main Toolbar + + +Location Toolbar + + + +