From c7048563b95f8d27b20aac0a0e1fbc5c4584c514 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 27 Dec 2008 12:54:30 +0100 Subject: BrowserMainWindow --> MainWindow --- src/mainwindow.cpp | 862 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 862 insertions(+) create mode 100644 src/mainwindow.cpp (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp new file mode 100644 index 00000000..b57f5379 --- /dev/null +++ b/src/mainwindow.cpp @@ -0,0 +1,862 @@ +/* ============================================================ + * + * This file is a part of the rekonq project + * + * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved + * Copyright (C) 2008 by Andrea Diamantini + * + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + * + * ============================================================ */ + + +// Local Includes +#include "mainwindow.h" +#include "autosaver.h" +#include "browserapplication.h" +#include "downloadmanager.h" +#include "history.h" +#include "settings.h" +#include "tabwidget.h" +#include "bookmarks.h" +#include "webview.h" + +// UI Includes +#include "ui_passworddialog.h" + +// KDE Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Qt Includes +#include +#include +#include +#include +#include +#include +#include + + +MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) + : KMainWindow(parent, flags) + , m_tabWidget(new TabWidget(this)) + , m_autoSaver(new AutoSaver(this)) + , m_historyBack(0) + , m_historyForward(0) + , m_stop(0) + , m_reload(0) +{ + // delete widget accepting close event + setAttribute(Qt::WA_DeleteOnClose, true); + + setupMenu(); + setupToolBar(); + + QWidget *centralWidget = new QWidget(this); + + QVBoxLayout *layout = new QVBoxLayout; + layout->setSpacing(0); + layout->setMargin(0); + addToolBarBreak(); + layout->addWidget(m_tabWidget); + + // Find Bar + m_findBar = new FindBar(this); + connect( m_findBar, SIGNAL( searchString(const QString &) ), this, SLOT( slotFind(const QString &) ) ); + + centralWidget->setLayout(layout); + setCentralWidget(centralWidget); + + connect(m_tabWidget, SIGNAL( loadPage(const QString &) ), this, SLOT( loadPage(const QString &) ) ); + connect(m_tabWidget, SIGNAL( setCurrentTitle(const QString &)), this, SLOT( slotUpdateWindowTitle(const QString &) ) ); + connect(m_tabWidget, SIGNAL( showStatusBarMessage(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); + connect(m_tabWidget, SIGNAL( linkHovered(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); + connect(m_tabWidget, SIGNAL( loadProgress(int)), this, SLOT( slotLoadProgress(int) ) ); + connect(m_tabWidget, SIGNAL( tabsChanged()), m_autoSaver, SLOT( changeOccurred() ) ); + connect(m_tabWidget, SIGNAL( geometryChangeRequested(const QRect &)), this, SLOT( geometryChangeRequested(const QRect &) ) ); + connect(m_tabWidget, SIGNAL( printRequested(QWebFrame *)), this, SLOT( printRequested(QWebFrame *) ) ); + connect(m_tabWidget, SIGNAL( menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT( setVisible(bool) ) ); + connect(m_tabWidget, SIGNAL( statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT( setVisible(bool) ) ); + connect(m_tabWidget, SIGNAL( toolBarVisibilityChangeRequested(bool) ), m_navigationBar, SLOT( setVisible(bool) ) ); + connect(m_tabWidget, SIGNAL( lastTabClosed() ), m_tabWidget, SLOT(newTab() ) ); + + slotUpdateWindowTitle(); + loadDefaultState(); + m_tabWidget->newTab(); +} + + +MainWindow::~MainWindow() +{ + m_autoSaver->changeOccurred(); + m_autoSaver->saveIfNeccessary(); + delete m_navigationBar; +} + + +void MainWindow::loadDefaultState() +{ + KConfig config("rekonqrc"); + KConfigGroup group1 = config.group("MainWindow"); + QByteArray data = group1.readEntry(QString("defaultState"), QByteArray() ); + restoreState(data); +} + + +void MainWindow::save() +{ + BrowserApplication::instance()->saveSession(); + + KConfig config("rekonqrc"); + KConfigGroup group1 = config.group("MainWindow"); + QByteArray data = saveState(); + group1.writeEntry( QString("defaultState"), data ); + + KConfigGroup group2 = config.group("navigation toobar"); + m_navigationBar->saveSettings( group2 ); +} + + +static const qint32 MainWindowMagic = 0xba; + + +QByteArray MainWindow::saveState() const +{ + int version = 2; + QByteArray data; + QDataStream stream(&data, QIODevice::WriteOnly); + + stream << qint32(MainWindowMagic); + stream << qint32(version); + + stream << size(); + + stream << KToolBar::toolBarsLocked(); + bool b = true; // statusBar()->isVisible() ; FIXME + stream << b; + stream << QByteArray(); + return data; +} + + + +void MainWindow::restoreState(const QByteArray &state) +{ + int version = 2; + QByteArray sd = state; + QDataStream stream(&sd, QIODevice::ReadOnly); + if ( stream.atEnd() ) + { + return; + } + + qint32 marker; + qint32 v; + stream >> marker; + stream >> v; + if (marker != MainWindowMagic || v != version) + { + return; + } + + QSize size; + bool showStatusbar; + bool toolbarsLocked; + QByteArray tabState; + + stream >> size; + stream >> toolbarsLocked; + stream >> showStatusbar; + + resize(size); + statusBar()->setVisible(showStatusbar); + updateStatusbarActionText(showStatusbar); + + KToolBar::setToolBarsLocked ( toolbarsLocked ); + return; +} + + +void MainWindow::setupMenu() +{ + // ------------------------------------------------------------- FILE -------------------------------------------------------------------------------------------------- + KMenu *fileMenu = (KMenu *) menuBar()->addMenu( i18n("&File") ); + + fileMenu->addAction( KStandardAction::openNew(this, SLOT( slotFileNew() ) , this ) ); + fileMenu->addAction( KStandardAction::open( this, SLOT( slotFileOpen() ), this ) ); + fileMenu->addAction( i18n("Open Location"), this, SLOT( slotSelectLineEdit() ) ); + fileMenu->addSeparator(); + + fileMenu->addAction( m_tabWidget->newTabAction() ); + fileMenu->addAction( m_tabWidget->closeTabAction() ); + fileMenu->addSeparator(); + + fileMenu->addAction( KStandardAction::saveAs( this, SLOT( slotFileSaveAs() ), this ) ); + fileMenu->addSeparator(); + + fileMenu->addAction( KStandardAction::printPreview( this, SLOT( slotFilePrintPreview() ), this ) ); + fileMenu->addAction( KStandardAction::print( this, SLOT(slotFilePrint()), this) ); + fileMenu->addSeparator(); + + KAction *action = (KAction *) fileMenu->addAction( i18n("Private &Browsing..."), this, SLOT( slotPrivateBrowsing() ) ); + action->setCheckable(true); + fileMenu->addSeparator(); + + fileMenu->addAction( KStandardAction::quit( this , SLOT( close() ), this ) ); + + // ------------------------------------------------------------- EDIT -------------------------------------------------------------------------------------------------- + KMenu *editMenu = (KMenu *) menuBar()->addMenu( i18n("&Edit") ); + + KAction *m_undo = KStandardAction::undo( this , 0 , this ); + editMenu->addAction( m_undo ); + m_tabWidget->addWebAction(m_undo, QWebPage::Undo); + + KAction *m_redo = KStandardAction::redo( this , 0 , this ); + editMenu->addAction( m_redo ); + m_tabWidget->addWebAction(m_redo, QWebPage::Redo); + + editMenu->addSeparator(); + + KAction *m_cut = KStandardAction::cut( this , 0 , this ); + editMenu->addAction( m_cut ); + m_tabWidget->addWebAction(m_cut, QWebPage::Cut); + + KAction *m_copy = KStandardAction::copy( this , 0 , this ); + editMenu->addAction( m_copy ); + m_tabWidget->addWebAction(m_copy, QWebPage::Copy); + + KAction *m_paste = KStandardAction::paste( this , 0 , this ); + editMenu->addAction( m_paste ); + m_tabWidget->addWebAction(m_paste, QWebPage::Paste); + + editMenu->addSeparator(); + + KAction *m_selectall = KStandardAction::selectAll( this , 0 , this ); + editMenu->addAction( m_selectall ); + m_tabWidget->addWebAction(m_selectall, QWebPage::SelectEndOfDocument ); + + editMenu->addSeparator(); + + editMenu->addAction( KStandardAction::find(this, SLOT( slotViewFindBar() ) , this ) ); + editMenu->addAction( KStandardAction::findNext(this, SLOT( slotFindNext() ) , this ) ); + editMenu->addAction( KStandardAction::findPrev(this, SLOT( slotFindPrevious() ) , this ) ); + + // ------------------------------------------------------------- VIEW ------------------------------------------------------------------------------------------------- + KMenu *viewMenu = (KMenu *) menuBar()->addMenu( i18n("&View") ); + + m_viewStatusbar = KStandardAction::showStatusbar( this, SLOT(slotViewStatusbar() ), this); + viewMenu->addAction(m_viewStatusbar); + + viewMenu->addSeparator(); + + m_stop = (KAction *) viewMenu->addAction( KIcon( "process-stop" ), i18n("&Stop") ); + m_stop->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); + m_tabWidget->addWebAction(m_stop, QWebPage::Stop); + + m_reload = (KAction *) viewMenu->addAction( KIcon("view-refresh"), i18n("Reload Page") ); + m_reload->setShortcut(QKeySequence::Refresh); + m_tabWidget->addWebAction(m_reload, QWebPage::Reload); + + viewMenu->addSeparator(); + + KMenu *fontMenu = new KMenu( i18n("Make Text..."), this ); + fontMenu->addAction( i18n("&Bigger"), this, SLOT(slotViewTextBigger()), QKeySequence(Qt::CTRL | Qt::Key_Plus)); + fontMenu->addAction( i18n("&Normal"), this, SLOT(slotViewTextNormal()), QKeySequence(Qt::CTRL | Qt::Key_0)); + fontMenu->addAction( i18n("&Smaller"), this, SLOT(slotViewTextSmaller()), QKeySequence(Qt::CTRL | Qt::Key_Minus)); + + viewMenu->addMenu( fontMenu ); + + viewMenu->addSeparator(); + + // TODO set encoding + + viewMenu->addAction( i18n("Page S&ource"), this, SLOT( slotViewPageSource() ), i18n("Ctrl+Alt+U")); + + KToggleFullScreenAction *tfsa = KStandardAction::fullScreen( this, SLOT( slotViewFullScreen(bool) ), this, this); + viewMenu->addAction( tfsa ); + + // ------------------------------------------------------------- HISTORY -------------------------------------------------------------------------------------------------- + HistoryMenu *historyMenu = new HistoryMenu(this); + connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_tabWidget, SLOT(loadUrlInCurrentTab(const KUrl&))); + connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); + historyMenu->setTitle( i18n("Hi&story") ); + menuBar()->addMenu(historyMenu); + QList historyActions; + + m_historyBack = new KAction( i18n("Back"), this); + m_historyBack->setShortcut( KShortcut( QKeySequence::Back ) ); + m_tabWidget->addWebAction( m_historyBack, QWebPage::Back ); + m_historyBack->setIconVisibleInMenu(false); + + m_historyForward = new KAction( i18n("Forward"), this); + m_historyForward->setShortcut( KShortcut( QKeySequence::Forward ) ); + m_tabWidget->addWebAction( m_historyForward, QWebPage::Forward ); + m_historyForward->setIconVisibleInMenu(false); + + historyActions.append( m_historyBack ); + historyActions.append( m_historyForward ); + historyActions.append( KStandardAction::home(this, SLOT( slotHome() ) , this ) ); + historyActions.append( m_tabWidget->recentlyClosedTabsAction() ); + + historyMenu->setInitialActions(historyActions); + + + + // ------------------------------------------------------------- BOOKMARKS -------------------------------------------------------------------------------------------------- + + BookmarksMenu *bookmarksMenu = new BookmarksMenu( this ); + bookmarksMenu->setTitle( i18n("&Bookmarks") ); + menuBar()->addMenu( bookmarksMenu ); + + // ------------------------------------------------------------- TOOLS ------------------------------------------------------------------------------------------------------ + KMenu* toolsMenu = (KMenu *) menuBar()->addMenu( i18n("&Tools") ); + + toolsMenu->addAction( i18n("Downloads"), this, SLOT( slotDownloadManager() ), i18n("Alt+Ctrl+D") ); + + toolsMenu->addSeparator(); + + action = (KAction *) toolsMenu->addAction( i18n("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool))); + action->setCheckable(true); + + // ------------------------------------------------------------- SETTINGS ------------------------------------------------------------------------------------------------------ + KMenu *settingsMenu = (KMenu *) menuBar()->addMenu( i18n("&Settings") ); + + settingsMenu->addAction( KStandardAction::keyBindings( this, SLOT( configureShortcuts() ), this ) ); //FIXME need new slot and actionCollection !! + settingsMenu->addAction( KStandardAction::preferences(this, SLOT( slotPreferences() ) , this ) ); + + // ------------------------------------------------------------- HELP -------------------------------------------------------------------------------------------------- + menuBar()->addMenu( helpMenu() ); +} + + +void MainWindow::setupToolBar() +{ + m_navigationBar = new KToolBar( i18n("Navigation") , this, Qt::TopToolBarArea, false, false, true); + + m_historyBack = new KAction( KIcon("go-previous"), i18n("Back"), this); + m_historyBackMenu = new KMenu(this); + m_historyBack->setMenu(m_historyBackMenu); + connect(m_historyBack, SIGNAL( triggered() ), this, SLOT( slotOpenPrevious() ) ); + connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); + connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); + m_navigationBar->addAction(m_historyBack); + + m_historyForward = new KAction( KIcon("go-next"), i18n("Forward"), this ); + connect(m_historyForward, SIGNAL( triggered() ), this, SLOT( slotOpenNext() ) ); + m_navigationBar->addAction(m_historyForward); + + m_stopReload = new KAction( KIcon("view-refresh"), i18n("Reload"), this); + m_navigationBar->addAction(m_stopReload); + + m_goHome = new KAction( KIcon( "go-home" ), i18n("Home"),this); + m_navigationBar->addAction(m_goHome); + connect(m_goHome, SIGNAL(triggered()), this, SLOT(slotHome())); + + m_navigationBar->addWidget( m_tabWidget->lineEditStack() ); + + m_searchBar = new SearchBar( m_navigationBar ); + connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); + m_navigationBar->addWidget(m_searchBar); + + // UI settings + setContextMenuPolicy( Qt::PreventContextMenu ); + + // setting initial style (if user hasn't decided something else) + m_navigationBar->setIconDimensions(22); + m_navigationBar->setToolButtonStyle( Qt::ToolButtonIconOnly ); + + KConfig config("rekonqrc"); + KConfigGroup group = config.group("navigation toobar"); + if ( group.exists() ) + { + m_navigationBar->applySettings( group ); + } +} + + +void MainWindow::updateStatusbarActionText(bool visible) +{ + m_viewStatusbar->setText(!visible ? i18n("Show Status Bar") : i18n("Hide Status Bar")); +} + + +void MainWindow::slotViewStatusbar() +{ + if (statusBar()->isVisible()) + { + updateStatusbarActionText(false); + statusBar()->close(); + } + else + { + updateStatusbarActionText(true); + statusBar()->show(); + } + m_autoSaver->changeOccurred(); +} + + +KUrl MainWindow::guessUrlFromString(const QString &string) +{ + QString urlStr = string.trimmed(); + QRegExp test(QLatin1String("^[a-zA-Z]+\\:.*")); + + // Check if it looks like a qualified URL. Try parsing it and see. + bool hasSchema = test.exactMatch(urlStr); + if (hasSchema) + { + QUrl qurl(urlStr, QUrl::TolerantMode); + KUrl url(qurl); + if ( url.isValid() ) + { + return url; + } + } + + // Might be a file. + if (QFile::exists(urlStr)) + { + QFileInfo info(urlStr); + return KUrl::fromPath( info.absoluteFilePath() ); + } + + // Might be a shorturl - try to detect the schema. + if (!hasSchema) + { + int dotIndex = urlStr.indexOf(QLatin1Char('.')); + if (dotIndex != -1) + { + QString prefix = urlStr.left(dotIndex).toLower(); + QString schema = (prefix == QLatin1String("ftp")) ? prefix : QLatin1String("http"); + QUrl qurl(schema + QLatin1String("://") + urlStr, QUrl::TolerantMode); + KUrl url(qurl); + if ( url.isValid() ) + { + return url; + } + } + } + + // Fall back to QUrl's own tolerant parser. + QUrl qurl = QUrl(string, QUrl::TolerantMode); + KUrl url(qurl); + + // finally for cases where the user just types in a hostname add http + if ( qurl.scheme().isEmpty() ) + { + qurl = QUrl(QLatin1String("http://") + string, QUrl::TolerantMode); + url = KUrl(qurl); + } + return url; +} + + +void MainWindow::loadUrl(const KUrl &url) +{ + loadPage( url.url() ); +} + + +void MainWindow::slotDownloadManager() +{ + BrowserApplication::downloadManager()->show(); +} + + +void MainWindow::slotSelectLineEdit() +{ + m_tabWidget->currentLineEdit()->selectAll(); + m_tabWidget->currentLineEdit()->setFocus(); +} + + +void MainWindow::slotFileSaveAs() +{ + BrowserApplication::downloadManager()->download(currentTab()->url(), true); +} + + +void MainWindow::slotPreferences() +{ + SettingsDialog *s = new SettingsDialog(this); + s->show(); +} + + +void MainWindow::slotUpdateStatusbar(const QString &string) +{ + statusBar()->showMessage(string, 2000); +} + + +void MainWindow::slotUpdateWindowTitle(const QString &title) +{ + if (title.isEmpty()) + { + setWindowTitle("rekonq"); + } + else + { + setWindowTitle(title + " - rekonq"); + } +} + + +void MainWindow::slotFileNew() +{ + BrowserApplication::instance()->newMainWindow(); + MainWindow *mw = BrowserApplication::instance()->mainWindow(); + mw->slotHome(); +} + + +void MainWindow::slotFileOpen() +{ + QString file = KFileDialog::getOpenFileName( KUrl(), + i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)"), + this, + i18n("Open Web Resource") ); + + if (file.isEmpty()) + return; + + loadPage(file); +} + + +void MainWindow::slotFilePrintPreview() +{ + if (!currentTab()) + return; + QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this); + connect(dialog, SIGNAL(paintRequested(QPrinter *)), currentTab(), SLOT(print(QPrinter *))); + dialog->exec(); +} + + +void MainWindow::slotFilePrint() +{ + if (!currentTab()) + return; + printRequested(currentTab()->page()->mainFrame()); +} + + +void MainWindow::printRequested(QWebFrame *frame) +{ + QPrinter printer; + QPrintDialog *dialog = new QPrintDialog(&printer, this); + dialog->setWindowTitle( i18n("Print Document") ); + if (dialog->exec() != QDialog::Accepted ) + return; + frame->print(&printer); +} + + +void MainWindow::slotPrivateBrowsing() +{ + QWebSettings *settings = QWebSettings::globalSettings(); + bool pb = settings->testAttribute(QWebSettings::PrivateBrowsingEnabled); + if (!pb) + { + QString title = i18n("Are you sure you want to turn on private browsing?"); + QString text = "" + title + i18n("

When private browsing in turned on," + " webpages are not added to the history," + " items are automatically removed from the Downloads window," \ + " new cookies are not stored, current cookies can't be accessed," \ + " site icons wont be stored, session wont be saved, " \ + " and searches are not addded to the pop-up menu in the Google search box." \ + " Until you close the window, you can still click the Back and Forward buttons" \ + " to return to the webpages you have opened."); + + int button = KMessageBox::questionYesNo( this, text, title ); + if (button == KMessageBox::Ok) + { + settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); + } + } + else + { + settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); + + QList windows = BrowserApplication::instance()->mainWindows(); + for (int i = 0; i < windows.count(); ++i) + { + MainWindow *window = windows.at(i); + window->m_lastSearch = QString::null; + window->tabWidget()->clear(); + } + } +} + + +void MainWindow::closeEvent(QCloseEvent *event) +{ + if (m_tabWidget->count() > 1) + { + int ret = KMessageBox::warningYesNo(this, + i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_tabWidget->count() ) , + i18n("Closing") ); + if (ret == KMessageBox::No) + { + event->ignore(); + return; + } + } + event->accept(); + deleteLater(); +} + + +void MainWindow::slotFind(const QString & search) +{ + if (!currentTab()) + return; + if (!search.isEmpty()) + { + m_lastSearch = search; + if (!currentTab()->findText(m_lastSearch)) + slotUpdateStatusbar( QString(m_lastSearch) + i18n(" not found.") ); + } +} + + +void MainWindow::slotViewFindBar() +{ + m_findBar->showFindBar(); +} + + +void MainWindow::slotFindNext() +{ + if (!currentTab() && !m_lastSearch.isEmpty()) + return; + currentTab()->findText(m_lastSearch); +} + + +void MainWindow::slotFindPrevious() +{ + if (!currentTab() && !m_lastSearch.isEmpty()) + return; + currentTab()->findText(m_lastSearch, QWebPage::FindBackward); +} + + +void MainWindow::slotViewTextBigger() +{ + if (!currentTab()) + return; + currentTab()->setTextSizeMultiplier(currentTab()->textSizeMultiplier() + 0.1); +} + + +void MainWindow::slotViewTextNormal() +{ + if (!currentTab()) + return; + currentTab()->setTextSizeMultiplier(1.0); +} + + +void MainWindow::slotViewTextSmaller() +{ + if (!currentTab()) + return; + currentTab()->setTextSizeMultiplier(currentTab()->textSizeMultiplier() - 0.1); +} + + +// TODO improve this +void MainWindow::slotViewFullScreen(bool makeFullScreen) +{ + KToggleFullScreenAction::setFullScreen( this, makeFullScreen ); +} + + +void MainWindow::slotViewPageSource() +{ + if (!currentTab()) + return; + + QString markup = currentTab()->page()->mainFrame()->toHtml(); + QPlainTextEdit *view = new QPlainTextEdit(markup); + view->setWindowTitle( i18n("Page Source of ") + currentTab()->title() ); + view->setMinimumWidth(640); + view->setAttribute(Qt::WA_DeleteOnClose); + view->show(); +} + + +void MainWindow::slotHome() +{ + KConfig config("rekonqrc"); + KConfigGroup group = config.group("Global Settings"); + QString home = group.readEntry( QString("home"), QString("http://www.kde.org/") ); + loadPage(home); +} + + +void MainWindow::slotToggleInspector(bool enable) +{ + QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable); + if (enable) + { + int result = KMessageBox::questionYesNo(this, + i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" + "Do you want to reload all pages?"), + i18n("Web Inspector") ); + if (result == KMessageBox::Yes) + { + m_tabWidget->reloadAllTabs(); + } + } +} + + +void MainWindow::slotSwapFocus() +{ + if (currentTab()->hasFocus()) + m_tabWidget->currentLineEdit()->setFocus(); + else + currentTab()->setFocus(); +} + + +void MainWindow::loadPage(const QString &page) +{ + if (!currentTab() || page.isEmpty()) + return; + + KUrl url = guessUrlFromString(page); + m_tabWidget->currentLineEdit()->setText( url.prettyUrl() ); + m_tabWidget->loadUrlInCurrentTab(url); +} + + +TabWidget *MainWindow::tabWidget() const +{ + return m_tabWidget; +} + + + +WebView *MainWindow::currentTab() const +{ + return m_tabWidget->currentWebView(); +} + + +void MainWindow::slotLoadProgress(int progress) +{ + if (progress < 100 && progress > 0) + { + disconnect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger())); + if (m_stopIcon.isNull()) + m_stopIcon = KIcon( "process-stop" ); + m_stopReload->setIcon(m_stopIcon); + connect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger())); + m_stopReload->setToolTip( i18n("Stop loading the current page") ); + } + else + { + disconnect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger())); + m_stopReload->setIcon( KIcon("view-refresh") ); + connect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger())); + m_stopReload->setToolTip( i18n("Reload the current page") ); + } +} + + +void MainWindow::slotAboutToShowBackMenu() +{ + m_historyBackMenu->clear(); + if (!currentTab()) + return; + QWebHistory *history = currentTab()->history(); + int historyCount = history->count(); + for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) + { + QWebHistoryItem item = history->backItems(history->count()).at(i); + KAction *action = new KAction(this); + action->setData(-1*(historyCount-i-1)); + QIcon icon = BrowserApplication::instance()->icon(item.url()); + action->setIcon(icon); + action->setText(item.title()); + m_historyBackMenu->addAction(action); + } +} + + +void MainWindow::slotShowWindow() +{ + if (KAction *action = qobject_cast(sender())) + { + QVariant v = action->data(); + if (v.canConvert()) + { + int offset = qvariant_cast(v); + QList windows = BrowserApplication::instance()->mainWindows(); + windows.at(offset)->activateWindow(); + windows.at(offset)->currentTab()->setFocus(); + } + } +} + + +void MainWindow::slotOpenActionUrl(QAction *action) +{ + int offset = action->data().toInt(); + QWebHistory *history = currentTab()->history(); + if (offset < 0) + { + history->goToItem(history->backItems(-1*offset).first()); // back + } + else + { + if (offset > 0) + { + history->goToItem(history->forwardItems(history->count() - offset + 1).back()); // forward + } + } +} + + +void MainWindow::slotOpenPrevious() +{ + QWebHistory *history = currentTab()->history(); + if ( history->canGoBack() ) + history->goToItem( history->backItem() ); +} + + +void MainWindow::slotOpenNext() +{ + QWebHistory *history = currentTab()->history(); + if ( history->canGoForward() ) + history->goToItem( history->forwardItem() ); +} + + +void MainWindow::geometryChangeRequested(const QRect &geometry) +{ + setGeometry(geometry); +} + -- cgit v1.2.1 From 9e7f74269e25062a33af0a2603bf258cd4b228e2 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 29 Dec 2008 01:52:07 +0100 Subject: Ported from KMainWindow to KXmlGuiWindow. Yeah! .. --- src/mainwindow.cpp | 481 +++++++++++++++++++---------------------------------- 1 file changed, 168 insertions(+), 313 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b57f5379..eb0543e9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -19,9 +19,10 @@  * ============================================================ */ -// Local Includes +// Self Includes #include "mainwindow.h" -#include "autosaver.h" + +// Local Includes #include "browserapplication.h" #include "downloadmanager.h" #include "history.h" @@ -54,365 +55,209 @@ #include -MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) - : KMainWindow(parent, flags) - , m_tabWidget(new TabWidget(this)) - , m_autoSaver(new AutoSaver(this)) - , m_historyBack(0) - , m_historyForward(0) - , m_stop(0) - , m_reload(0) +MainWindow::MainWindow() + : KXmlGuiWindow() + , m_tabWidget( new TabWidget(this) ) { - // delete widget accepting close event - setAttribute(Qt::WA_DeleteOnClose, true); - - setupMenu(); - setupToolBar(); + // accept dnd + setAcceptDrops(true); - QWidget *centralWidget = new QWidget(this); + m_tabWidget->newTab(); - QVBoxLayout *layout = new QVBoxLayout; - layout->setSpacing(0); - layout->setMargin(0); - addToolBarBreak(); - layout->addWidget(m_tabWidget); + // tell the KXmlGuiWindow that this is indeed the main widget + setCentralWidget(m_tabWidget); // Find Bar m_findBar = new FindBar(this); connect( m_findBar, SIGNAL( searchString(const QString &) ), this, SLOT( slotFind(const QString &) ) ); - centralWidget->setLayout(layout); - setCentralWidget(centralWidget); - connect(m_tabWidget, SIGNAL( loadPage(const QString &) ), this, SLOT( loadPage(const QString &) ) ); connect(m_tabWidget, SIGNAL( setCurrentTitle(const QString &)), this, SLOT( slotUpdateWindowTitle(const QString &) ) ); connect(m_tabWidget, SIGNAL( showStatusBarMessage(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); connect(m_tabWidget, SIGNAL( linkHovered(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); connect(m_tabWidget, SIGNAL( loadProgress(int)), this, SLOT( slotLoadProgress(int) ) ); - connect(m_tabWidget, SIGNAL( tabsChanged()), m_autoSaver, SLOT( changeOccurred() ) ); +// connect(m_tabWidget, SIGNAL( tabsChanged()), m_autoSaver, SLOT( changeOccurred() ) ); connect(m_tabWidget, SIGNAL( geometryChangeRequested(const QRect &)), this, SLOT( geometryChangeRequested(const QRect &) ) ); connect(m_tabWidget, SIGNAL( printRequested(QWebFrame *)), this, SLOT( printRequested(QWebFrame *) ) ); connect(m_tabWidget, SIGNAL( menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT( setVisible(bool) ) ); connect(m_tabWidget, SIGNAL( statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT( setVisible(bool) ) ); - connect(m_tabWidget, SIGNAL( toolBarVisibilityChangeRequested(bool) ), m_navigationBar, SLOT( setVisible(bool) ) ); +// connect(m_tabWidget, SIGNAL( toolBarVisibilityChangeRequested(bool) ), m_navigationBar, SLOT( setVisible(bool) ) ); connect(m_tabWidget, SIGNAL( lastTabClosed() ), m_tabWidget, SLOT(newTab() ) ); slotUpdateWindowTitle(); - loadDefaultState(); - m_tabWidget->newTab(); -} +// -------------------------------------------------------------------------------------------------------------------------------- -MainWindow::~MainWindow() -{ - m_autoSaver->changeOccurred(); - m_autoSaver->saveIfNeccessary(); - delete m_navigationBar; -} + // then, setup our actions + setupActions(); + // add a status bar + statusBar()->show(); -void MainWindow::loadDefaultState() -{ - KConfig config("rekonqrc"); - KConfigGroup group1 = config.group("MainWindow"); - QByteArray data = group1.readEntry(QString("defaultState"), QByteArray() ); - restoreState(data); -} + // a call to KXmlGuiWindow::setupGUI() populates the GUI + // with actions, using KXMLGUI. + // It also applies the saved mainwindow settings, if any, and ask the + // mainwindow to automatically save settings if changed: window size, + // toolbar position, icon size, etc. + setupGUI(); + // setup history & bookmarks menus + setupCustomMenu(); -void MainWindow::save() -{ - BrowserApplication::instance()->saveSession(); - - KConfig config("rekonqrc"); - KConfigGroup group1 = config.group("MainWindow"); - QByteArray data = saveState(); - group1.writeEntry( QString("defaultState"), data ); - - KConfigGroup group2 = config.group("navigation toobar"); - m_navigationBar->saveSettings( group2 ); -} - - -static const qint32 MainWindowMagic = 0xba; + // setting up custom widgets.. + KToolBar *navigationBar = toolBar( "mainToolBar" ); + navigationBar->addWidget( m_tabWidget->lineEditStack() ); + m_searchBar = new SearchBar( this ); + connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); + navigationBar->addWidget(m_searchBar); -QByteArray MainWindow::saveState() const -{ - int version = 2; - QByteArray data; - QDataStream stream(&data, QIODevice::WriteOnly); - - stream << qint32(MainWindowMagic); - stream << qint32(version); - - stream << size(); - stream << KToolBar::toolBarsLocked(); - bool b = true; // statusBar()->isVisible() ; FIXME - stream << b; - stream << QByteArray(); - return data; } - -void MainWindow::restoreState(const QByteArray &state) +MainWindow::~MainWindow() { - int version = 2; - QByteArray sd = state; - QDataStream stream(&sd, QIODevice::ReadOnly); - if ( stream.atEnd() ) - { - return; - } - - qint32 marker; - qint32 v; - stream >> marker; - stream >> v; - if (marker != MainWindowMagic || v != version) - { - return; - } - - QSize size; - bool showStatusbar; - bool toolbarsLocked; - QByteArray tabState; - - stream >> size; - stream >> toolbarsLocked; - stream >> showStatusbar; - - resize(size); - statusBar()->setVisible(showStatusbar); - updateStatusbarActionText(showStatusbar); - - KToolBar::setToolBarsLocked ( toolbarsLocked ); - return; } -void MainWindow::setupMenu() +void MainWindow::setupActions() { - // ------------------------------------------------------------- FILE -------------------------------------------------------------------------------------------------- - KMenu *fileMenu = (KMenu *) menuBar()->addMenu( i18n("&File") ); - - fileMenu->addAction( KStandardAction::openNew(this, SLOT( slotFileNew() ) , this ) ); - fileMenu->addAction( KStandardAction::open( this, SLOT( slotFileOpen() ), this ) ); - fileMenu->addAction( i18n("Open Location"), this, SLOT( slotSelectLineEdit() ) ); - fileMenu->addSeparator(); - - fileMenu->addAction( m_tabWidget->newTabAction() ); - fileMenu->addAction( m_tabWidget->closeTabAction() ); - fileMenu->addSeparator(); + KAction *a; - fileMenu->addAction( KStandardAction::saveAs( this, SLOT( slotFileSaveAs() ), this ) ); - fileMenu->addSeparator(); + // Standard Actions + KStandardAction::openNew(this, SLOT( slotFileNew() ) , actionCollection() ); + KStandardAction::open( this, SLOT( slotFileOpen() ), actionCollection() ); + KStandardAction::saveAs( this, SLOT( slotFileSaveAs() ), actionCollection() ); + KStandardAction::printPreview( this, SLOT( slotFilePrintPreview() ), actionCollection() ); + KStandardAction::print( this, SLOT( slotFilePrint() ), actionCollection() ); + KStandardAction::quit( this , SLOT( close() ), actionCollection() ); + KStandardAction::find(this, SLOT( slotViewFindBar() ) , actionCollection() ); + KStandardAction::findNext(this, SLOT( slotFindNext() ) , actionCollection() ); + KStandardAction::findPrev(this, SLOT( slotFindPrevious() ) , actionCollection() ); + KStandardAction::fullScreen( this, SLOT( slotViewFullScreen(bool) ), this, actionCollection() ); + KStandardAction::home( this, SLOT( slotHome() ), actionCollection() ); - fileMenu->addAction( KStandardAction::printPreview( this, SLOT( slotFilePrintPreview() ), this ) ); - fileMenu->addAction( KStandardAction::print( this, SLOT(slotFilePrint()), this) ); - fileMenu->addSeparator(); + a = KStandardAction::redisplay( this, 0, actionCollection() ); + m_tabWidget->addWebAction( a, QWebPage::Reload ); - KAction *action = (KAction *) fileMenu->addAction( i18n("Private &Browsing..."), this, SLOT( slotPrivateBrowsing() ) ); - action->setCheckable(true); - fileMenu->addSeparator(); + a = KStandardAction::back( this, 0, actionCollection() ); + m_tabWidget->addWebAction( a, QWebPage::Back ); - fileMenu->addAction( KStandardAction::quit( this , SLOT( close() ), this ) ); + a = KStandardAction::forward( this, 0, actionCollection() ); + m_tabWidget->addWebAction( a, QWebPage::Forward ); - // ------------------------------------------------------------- EDIT -------------------------------------------------------------------------------------------------- - KMenu *editMenu = (KMenu *) menuBar()->addMenu( i18n("&Edit") ); + a = KStandardAction::undo( this , 0 , actionCollection() ); + m_tabWidget->addWebAction( a , QWebPage::Undo ); - KAction *m_undo = KStandardAction::undo( this , 0 , this ); - editMenu->addAction( m_undo ); - m_tabWidget->addWebAction(m_undo, QWebPage::Undo); + a = KStandardAction::redo( this , 0 , actionCollection() ); + m_tabWidget->addWebAction( a, QWebPage::Redo ); - KAction *m_redo = KStandardAction::redo( this , 0 , this ); - editMenu->addAction( m_redo ); - m_tabWidget->addWebAction(m_redo, QWebPage::Redo); + a = KStandardAction::cut( this , 0 , actionCollection() ); + m_tabWidget->addWebAction( a, QWebPage::Cut ); - editMenu->addSeparator(); + a = KStandardAction::copy( this , 0 , actionCollection() ); + m_tabWidget->addWebAction( a, QWebPage::Copy ); - KAction *m_cut = KStandardAction::cut( this , 0 , this ); - editMenu->addAction( m_cut ); - m_tabWidget->addWebAction(m_cut, QWebPage::Cut); + a = KStandardAction::paste( this , 0 , actionCollection() ); + m_tabWidget->addWebAction( a, QWebPage::Paste ); - KAction *m_copy = KStandardAction::copy( this , 0 , this ); - editMenu->addAction( m_copy ); - m_tabWidget->addWebAction(m_copy, QWebPage::Copy); + a = KStandardAction::selectAll( this , 0 , actionCollection() ); + m_tabWidget->addWebAction( a, QWebPage::SelectEndOfDocument ); - KAction *m_paste = KStandardAction::paste( this , 0 , this ); - editMenu->addAction( m_paste ); - m_tabWidget->addWebAction(m_paste, QWebPage::Paste); + // stop reload Action + m_stopReload = new KAction( KIcon("view-refresh"), i18n("reload"), this ); + actionCollection()->addAction( QLatin1String("stop reload") , m_stopReload ); - editMenu->addSeparator(); + // Custom Actions + a = new KAction ( KIcon( "process-stop" ), i18n("&Stop"), this ); + a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); + actionCollection()->addAction( QLatin1String("stop"), a ); + m_tabWidget->addWebAction( a, QWebPage::Stop); + + a = new KAction( KIcon(), i18n("Open Location"), this); + actionCollection()->addAction( QLatin1String("open location"), a ); + connect( a, SIGNAL( triggered(bool) ) , this, SLOT( slotOpenLocation() ) ); - KAction *m_selectall = KStandardAction::selectAll( this , 0 , this ); - editMenu->addAction( m_selectall ); - m_tabWidget->addWebAction(m_selectall, QWebPage::SelectEndOfDocument ); + actionCollection()->addAction( QLatin1String("new tab"), m_tabWidget->newTabAction() ); + actionCollection()->addAction( QLatin1String("close tab"), m_tabWidget->closeTabAction() ); - editMenu->addSeparator(); + a = new KAction( i18n("Private &Browsing..."), this ); + a->setCheckable(true); + actionCollection()->addAction( i18n("private browsing"), a ); + connect( a, SIGNAL( triggered(bool) ) , this, SLOT( slotPrivateBrowsing() ) ); - editMenu->addAction( KStandardAction::find(this, SLOT( slotViewFindBar() ) , this ) ); - editMenu->addAction( KStandardAction::findNext(this, SLOT( slotFindNext() ) , this ) ); - editMenu->addAction( KStandardAction::findPrev(this, SLOT( slotFindPrevious() ) , this ) ); + a = new KAction( i18n("&Bigger"), this ); + a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Plus) ); + actionCollection()->addAction( QLatin1String("bigger font"), a ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextBigger() ) ); - // ------------------------------------------------------------- VIEW ------------------------------------------------------------------------------------------------- - KMenu *viewMenu = (KMenu *) menuBar()->addMenu( i18n("&View") ); + a = new KAction( i18n("&Normal"), this ); + a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_0) ); + actionCollection()->addAction( QLatin1String("normal font"), a ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextNormal() ) ); - m_viewStatusbar = KStandardAction::showStatusbar( this, SLOT(slotViewStatusbar() ), this); - viewMenu->addAction(m_viewStatusbar); + a = new KAction( i18n("&Smaller"), this ); + a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Minus) ); + actionCollection()->addAction( QLatin1String("smaller font"), a ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextSmaller() ) ); - viewMenu->addSeparator(); + a = new KAction( i18n("Page S&ource"), this ); + actionCollection()->addAction( QLatin1String("page source"), a ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewPageSource() ) ); - m_stop = (KAction *) viewMenu->addAction( KIcon( "process-stop" ), i18n("&Stop") ); - m_stop->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); - m_tabWidget->addWebAction(m_stop, QWebPage::Stop); + a = new KAction( KIcon( "kget" ), i18n("Downloads"), this ); + actionCollection()->addAction( QLatin1String("downloads"), a); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotDownloadManager() ) ); - m_reload = (KAction *) viewMenu->addAction( KIcon("view-refresh"), i18n("Reload Page") ); - m_reload->setShortcut(QKeySequence::Refresh); - m_tabWidget->addWebAction(m_reload, QWebPage::Reload); + a = new KAction( KIcon("page-zoom"), i18n("Enable Web &Inspector"), this ); + a->setCheckable(true); + actionCollection()->addAction( QLatin1String("web inspector"), a ); + connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotToggleInspector(bool) ) ); - viewMenu->addSeparator(); + // =================================================================================================================== + // =================================================================================================================== + // FIXME - KMenu *fontMenu = new KMenu( i18n("Make Text..."), this ); - fontMenu->addAction( i18n("&Bigger"), this, SLOT(slotViewTextBigger()), QKeySequence(Qt::CTRL | Qt::Key_Plus)); - fontMenu->addAction( i18n("&Normal"), this, SLOT(slotViewTextNormal()), QKeySequence(Qt::CTRL | Qt::Key_0)); - fontMenu->addAction( i18n("&Smaller"), this, SLOT(slotViewTextSmaller()), QKeySequence(Qt::CTRL | Qt::Key_Minus)); - - viewMenu->addMenu( fontMenu ); - - viewMenu->addSeparator(); - - // TODO set encoding + KAction *historyBack = new KAction( KIcon("go-previous"), i18n("Back"), this); + m_historyBackMenu = new KMenu(this); + historyBack->setMenu(m_historyBackMenu); + connect(historyBack, SIGNAL( triggered( bool ) ), this, SLOT( slotOpenPrevious() ) ); + connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); + connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); + actionCollection()->addAction( QLatin1String("history back"), historyBack); - viewMenu->addAction( i18n("Page S&ource"), this, SLOT( slotViewPageSource() ), i18n("Ctrl+Alt+U")); + KAction *historyForward = new KAction( KIcon("go-next"), i18n("Forward"), this ); + connect(historyForward, SIGNAL( triggered( bool ) ), this, SLOT( slotOpenNext() ) ); + actionCollection()->addAction( QLatin1String("history forward"), m_historyForward ); +} - KToggleFullScreenAction *tfsa = KStandardAction::fullScreen( this, SLOT( slotViewFullScreen(bool) ), this, this); - viewMenu->addAction( tfsa ); - // ------------------------------------------------------------- HISTORY -------------------------------------------------------------------------------------------------- +void MainWindow::setupCustomMenu() +{ + // ------------------------------------------------------------- HISTORY MENU-------------------------------------------------------------------------------------------------- HistoryMenu *historyMenu = new HistoryMenu(this); connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_tabWidget, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle( i18n("Hi&story") ); menuBar()->addMenu(historyMenu); - QList historyActions; - - m_historyBack = new KAction( i18n("Back"), this); - m_historyBack->setShortcut( KShortcut( QKeySequence::Back ) ); - m_tabWidget->addWebAction( m_historyBack, QWebPage::Back ); - m_historyBack->setIconVisibleInMenu(false); - - m_historyForward = new KAction( i18n("Forward"), this); - m_historyForward->setShortcut( KShortcut( QKeySequence::Forward ) ); - m_tabWidget->addWebAction( m_historyForward, QWebPage::Forward ); - m_historyForward->setIconVisibleInMenu(false); + QList historyActions; - historyActions.append( m_historyBack ); - historyActions.append( m_historyForward ); - historyActions.append( KStandardAction::home(this, SLOT( slotHome() ) , this ) ); + historyActions.append( actionCollection()->action("Back") ); + historyActions.append( actionCollection()->action("Forward") ); + historyActions.append( actionCollection()->action("Home") ); historyActions.append( m_tabWidget->recentlyClosedTabsAction() ); historyMenu->setInitialActions(historyActions); + // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - - - // ------------------------------------------------------------- BOOKMARKS -------------------------------------------------------------------------------------------------- - + // --------------------------------------------- BOOKMARKS MENU ----------------------------------------------------------------------------------------------------- BookmarksMenu *bookmarksMenu = new BookmarksMenu( this ); bookmarksMenu->setTitle( i18n("&Bookmarks") ); - menuBar()->addMenu( bookmarksMenu ); - - // ------------------------------------------------------------- TOOLS ------------------------------------------------------------------------------------------------------ - KMenu* toolsMenu = (KMenu *) menuBar()->addMenu( i18n("&Tools") ); - - toolsMenu->addAction( i18n("Downloads"), this, SLOT( slotDownloadManager() ), i18n("Alt+Ctrl+D") ); - - toolsMenu->addSeparator(); - - action = (KAction *) toolsMenu->addAction( i18n("Enable Web &Inspector"), this, SLOT(slotToggleInspector(bool))); - action->setCheckable(true); - - // ------------------------------------------------------------- SETTINGS ------------------------------------------------------------------------------------------------------ - KMenu *settingsMenu = (KMenu *) menuBar()->addMenu( i18n("&Settings") ); - - settingsMenu->addAction( KStandardAction::keyBindings( this, SLOT( configureShortcuts() ), this ) ); //FIXME need new slot and actionCollection !! - settingsMenu->addAction( KStandardAction::preferences(this, SLOT( slotPreferences() ) , this ) ); - - // ------------------------------------------------------------- HELP -------------------------------------------------------------------------------------------------- - menuBar()->addMenu( helpMenu() ); -} - - -void MainWindow::setupToolBar() -{ - m_navigationBar = new KToolBar( i18n("Navigation") , this, Qt::TopToolBarArea, false, false, true); - - m_historyBack = new KAction( KIcon("go-previous"), i18n("Back"), this); - m_historyBackMenu = new KMenu(this); - m_historyBack->setMenu(m_historyBackMenu); - connect(m_historyBack, SIGNAL( triggered() ), this, SLOT( slotOpenPrevious() ) ); - connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); - connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); - m_navigationBar->addAction(m_historyBack); - - m_historyForward = new KAction( KIcon("go-next"), i18n("Forward"), this ); - connect(m_historyForward, SIGNAL( triggered() ), this, SLOT( slotOpenNext() ) ); - m_navigationBar->addAction(m_historyForward); - - m_stopReload = new KAction( KIcon("view-refresh"), i18n("Reload"), this); - m_navigationBar->addAction(m_stopReload); - - m_goHome = new KAction( KIcon( "go-home" ), i18n("Home"),this); - m_navigationBar->addAction(m_goHome); - connect(m_goHome, SIGNAL(triggered()), this, SLOT(slotHome())); - - m_navigationBar->addWidget( m_tabWidget->lineEditStack() ); - - m_searchBar = new SearchBar( m_navigationBar ); - connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); - m_navigationBar->addWidget(m_searchBar); - - // UI settings - setContextMenuPolicy( Qt::PreventContextMenu ); - - // setting initial style (if user hasn't decided something else) - m_navigationBar->setIconDimensions(22); - m_navigationBar->setToolButtonStyle( Qt::ToolButtonIconOnly ); - - KConfig config("rekonqrc"); - KConfigGroup group = config.group("navigation toobar"); - if ( group.exists() ) - { - m_navigationBar->applySettings( group ); - } -} - - -void MainWindow::updateStatusbarActionText(bool visible) -{ - m_viewStatusbar->setText(!visible ? i18n("Show Status Bar") : i18n("Hide Status Bar")); -} - - -void MainWindow::slotViewStatusbar() -{ - if (statusBar()->isVisible()) - { - updateStatusbarActionText(false); - statusBar()->close(); - } - else - { - updateStatusbarActionText(true); - statusBar()->show(); - } - m_autoSaver->changeOccurred(); + menuBar()->addMenu(bookmarksMenu ); + // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ } - KUrl MainWindow::guessUrlFromString(const QString &string) { QString urlStr = string.trimmed(); @@ -480,7 +325,7 @@ void MainWindow::slotDownloadManager() } -void MainWindow::slotSelectLineEdit() +void MainWindow::slotOpenLocation() { m_tabWidget->currentLineEdit()->selectAll(); m_tabWidget->currentLineEdit()->setFocus(); @@ -607,22 +452,22 @@ void MainWindow::slotPrivateBrowsing() } -void MainWindow::closeEvent(QCloseEvent *event) -{ - if (m_tabWidget->count() > 1) - { - int ret = KMessageBox::warningYesNo(this, - i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_tabWidget->count() ) , - i18n("Closing") ); - if (ret == KMessageBox::No) - { - event->ignore(); - return; - } - } - event->accept(); - deleteLater(); -} +// void MainWindow::closeEvent(QCloseEvent *event) +// { +// if (m_tabWidget->count() > 1) +// { +// int ret = KMessageBox::warningYesNo(this, +// i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_tabWidget->count() ) , +// i18n("Closing") ); +// if (ret == KMessageBox::No) +// { +// event->ignore(); +// return; +// } +// } +// event->accept(); +// deleteLater(); +// } void MainWindow::slotFind(const QString & search) @@ -685,7 +530,7 @@ void MainWindow::slotViewTextSmaller() // TODO improve this -void MainWindow::slotViewFullScreen(bool makeFullScreen) +void MainWindow::slotViewFullScreen( bool makeFullScreen ) { KToggleFullScreenAction::setFullScreen( this, makeFullScreen ); } @@ -733,10 +578,14 @@ void MainWindow::slotToggleInspector(bool enable) void MainWindow::slotSwapFocus() { - if (currentTab()->hasFocus()) + if ( currentTab()->hasFocus() ) + { m_tabWidget->currentLineEdit()->setFocus(); + } else + { currentTab()->setFocus(); + } } @@ -764,23 +613,29 @@ WebView *MainWindow::currentTab() const } +// FIXME: this actually doesn't work properly.. void MainWindow::slotLoadProgress(int progress) { if (progress < 100 && progress > 0) { - disconnect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger())); - if (m_stopIcon.isNull()) - m_stopIcon = KIcon( "process-stop" ); - m_stopReload->setIcon(m_stopIcon); - connect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger())); +// disconnect(m_stopReload, SIGNAL( triggered( bool ) ), m_reload, SLOT( trigger() ) ); +// m_stopReload->setIcon( KIcon( "process-stop" ) ); +// connect(m_stopReload, SIGNAL( triggered( bool ) ), m_stop, SLOT( trigger() ) ); + + disconnect( m_stopReload, SIGNAL( triggered( bool ) ), actionCollection()->action( "redisplay" ) , SIGNAL( triggered() ) ); + m_stopReload->setIcon( KIcon( "process-stop" ) ); + connect(m_stopReload, SIGNAL( triggered(bool ) ), actionCollection()->action( "stop" ), SLOT( triggered() ) ); m_stopReload->setToolTip( i18n("Stop loading the current page") ); } else { - disconnect(m_stopReload, SIGNAL(triggered()), m_stop, SLOT(trigger())); - m_stopReload->setIcon( KIcon("view-refresh") ); - connect(m_stopReload, SIGNAL(triggered()), m_reload, SLOT(trigger())); - m_stopReload->setToolTip( i18n("Reload the current page") ); +// disconnect(m_stopReload, SIGNAL( triggered( bool ) ), m_stop, SLOT( trigger() ) ); +// m_stopReload->setIcon( KIcon("view-refresh") ); +// connect(m_stopReload, SIGNAL( triggered( bool ) ), m_reload, SLOT( trigger() ) ); + disconnect( m_stopReload, SIGNAL( triggered( bool ) ), actionCollection()->action( "stop" ) , SIGNAL( triggered( ) ) ); + m_stopReload->setIcon( KIcon( "view-refresh" ) ); + connect(m_stopReload, SIGNAL( triggered( bool ) ), actionCollection()->action( "redisplay" ), SLOT( triggered() ) ); + m_stopReload->setToolTip( i18n("Reload the current page") ); } } -- cgit v1.2.1 From b7fd88eef6b70df7dc05011657187f8c2f3b83d8 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 29 Dec 2008 02:52:20 +0100 Subject: Better menus, icons.. --- src/mainwindow.cpp | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index eb0543e9..152b2ec7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -137,6 +137,7 @@ void MainWindow::setupActions() KStandardAction::findPrev(this, SLOT( slotFindPrevious() ) , actionCollection() ); KStandardAction::fullScreen( this, SLOT( slotViewFullScreen(bool) ), this, actionCollection() ); KStandardAction::home( this, SLOT( slotHome() ), actionCollection() ); + KStandardAction::preferences( this, SLOT( slotPreferences() ), actionCollection() ); a = KStandardAction::redisplay( this, 0, actionCollection() ); m_tabWidget->addWebAction( a, QWebPage::Reload ); @@ -229,7 +230,7 @@ void MainWindow::setupActions() KAction *historyForward = new KAction( KIcon("go-next"), i18n("Forward"), this ); connect(historyForward, SIGNAL( triggered( bool ) ), this, SLOT( slotOpenNext() ) ); - actionCollection()->addAction( QLatin1String("history forward"), m_historyForward ); + actionCollection()->addAction( QLatin1String("history forward"), historyForward ); } @@ -240,7 +241,7 @@ void MainWindow::setupCustomMenu() connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_tabWidget, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle( i18n("Hi&story") ); - menuBar()->addMenu(historyMenu); + menuBar()->insertMenu( actionCollection()->action("downloads"), historyMenu); QList historyActions; historyActions.append( actionCollection()->action("Back") ); @@ -254,7 +255,7 @@ void MainWindow::setupCustomMenu() // --------------------------------------------- BOOKMARKS MENU ----------------------------------------------------------------------------------------------------- BookmarksMenu *bookmarksMenu = new BookmarksMenu( this ); bookmarksMenu->setTitle( i18n("&Bookmarks") ); - menuBar()->addMenu(bookmarksMenu ); + menuBar()->insertMenu( actionCollection()->action("downloads"), bookmarksMenu ); // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ } @@ -616,26 +617,21 @@ WebView *MainWindow::currentTab() const // FIXME: this actually doesn't work properly.. void MainWindow::slotLoadProgress(int progress) { + QAction *stop = actionCollection()->action( "stop" ); + QAction *reload = actionCollection()->action(" redisplay" ); if (progress < 100 && progress > 0) { -// disconnect(m_stopReload, SIGNAL( triggered( bool ) ), m_reload, SLOT( trigger() ) ); -// m_stopReload->setIcon( KIcon( "process-stop" ) ); -// connect(m_stopReload, SIGNAL( triggered( bool ) ), m_stop, SLOT( trigger() ) ); - - disconnect( m_stopReload, SIGNAL( triggered( bool ) ), actionCollection()->action( "redisplay" ) , SIGNAL( triggered() ) ); - m_stopReload->setIcon( KIcon( "process-stop" ) ); - connect(m_stopReload, SIGNAL( triggered(bool ) ), actionCollection()->action( "stop" ), SLOT( triggered() ) ); + disconnect( m_stopReload, SIGNAL( triggered( bool ) ), reload , SIGNAL( triggered(bool) ) ); + m_stopReload->setIcon( KIcon( "process-stop" ) ); + connect(m_stopReload, SIGNAL( triggered(bool ) ), stop, SIGNAL( triggered(bool) ) ); m_stopReload->setToolTip( i18n("Stop loading the current page") ); } else { -// disconnect(m_stopReload, SIGNAL( triggered( bool ) ), m_stop, SLOT( trigger() ) ); -// m_stopReload->setIcon( KIcon("view-refresh") ); -// connect(m_stopReload, SIGNAL( triggered( bool ) ), m_reload, SLOT( trigger() ) ); - disconnect( m_stopReload, SIGNAL( triggered( bool ) ), actionCollection()->action( "stop" ) , SIGNAL( triggered( ) ) ); - m_stopReload->setIcon( KIcon( "view-refresh" ) ); - connect(m_stopReload, SIGNAL( triggered( bool ) ), actionCollection()->action( "redisplay" ), SLOT( triggered() ) ); - m_stopReload->setToolTip( i18n("Reload the current page") ); + disconnect( m_stopReload, SIGNAL( triggered( bool ) ), stop , SIGNAL( triggered(bool ) ) ); + m_stopReload->setIcon( KIcon( "view-refresh" ) ); + connect(m_stopReload, SIGNAL( triggered( bool ) ), reload, SIGNAL( triggered(bool) ) ); + m_stopReload->setToolTip( i18n("Reload the current page") ); } } -- cgit v1.2.1 From 6ebcdb1aa9e4a2f59cf1dd7e38a39be5d8e1c31b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 30 Dec 2008 16:11:37 +0100 Subject: Solved history && bookmarks menu problems.. YEAH!! --- src/mainwindow.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 152b2ec7..d3509e60 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -188,17 +188,17 @@ void MainWindow::setupActions() actionCollection()->addAction( i18n("private browsing"), a ); connect( a, SIGNAL( triggered(bool) ) , this, SLOT( slotPrivateBrowsing() ) ); - a = new KAction( i18n("&Bigger"), this ); + a = new KAction( KIcon("zoom-in"), i18n("&Enlarge font"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Plus) ); actionCollection()->addAction( QLatin1String("bigger font"), a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextBigger() ) ); - a = new KAction( i18n("&Normal"), this ); + a = new KAction( KIcon("zoom-original"), i18n("&Normal font"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_0) ); actionCollection()->addAction( QLatin1String("normal font"), a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextNormal() ) ); - a = new KAction( i18n("&Smaller"), this ); + a = new KAction( KIcon("zoom-out"), i18n("&Shrink font"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Minus) ); actionCollection()->addAction( QLatin1String("smaller font"), a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextSmaller() ) ); @@ -216,6 +216,11 @@ void MainWindow::setupActions() actionCollection()->addAction( QLatin1String("web inspector"), a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotToggleInspector(bool) ) ); + a = new KActionMenu( i18n("B&ookmarks"), this ); + actionCollection()->addAction( QLatin1String("bookmarks"), a ); + BookmarksMenu *bookmarksMenu = new BookmarksMenu( this ); + a->setMenu( bookmarksMenu ); + // =================================================================================================================== // =================================================================================================================== // FIXME @@ -241,7 +246,7 @@ void MainWindow::setupCustomMenu() connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_tabWidget, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle( i18n("Hi&story") ); - menuBar()->insertMenu( actionCollection()->action("downloads"), historyMenu); + menuBar()->insertMenu( actionCollection()->action("bookmarks"), historyMenu); QList historyActions; historyActions.append( actionCollection()->action("Back") ); @@ -253,9 +258,8 @@ void MainWindow::setupCustomMenu() // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ // --------------------------------------------- BOOKMARKS MENU ----------------------------------------------------------------------------------------------------- - BookmarksMenu *bookmarksMenu = new BookmarksMenu( this ); - bookmarksMenu->setTitle( i18n("&Bookmarks") ); - menuBar()->insertMenu( actionCollection()->action("downloads"), bookmarksMenu ); + + // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ } -- cgit v1.2.1 From 9cbf281f4df98feec4325dac050cc633e3bbfe2f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 30 Dec 2008 16:52:23 +0100 Subject: Fixed FindBar crash && refactored to look like kate searchbar --- src/mainwindow.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d3509e60..7bf44d06 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -67,10 +67,6 @@ MainWindow::MainWindow() // tell the KXmlGuiWindow that this is indeed the main widget setCentralWidget(m_tabWidget); - // Find Bar - m_findBar = new FindBar(this); - connect( m_findBar, SIGNAL( searchString(const QString &) ), this, SLOT( slotFind(const QString &) ) ); - connect(m_tabWidget, SIGNAL( loadPage(const QString &) ), this, SLOT( loadPage(const QString &) ) ); connect(m_tabWidget, SIGNAL( setCurrentTitle(const QString &)), this, SLOT( slotUpdateWindowTitle(const QString &) ) ); connect(m_tabWidget, SIGNAL( showStatusBarMessage(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); @@ -112,6 +108,9 @@ MainWindow::MainWindow() connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); navigationBar->addWidget(m_searchBar); + // Find Bar + m_findBar = new FindBar(this); + connect( m_findBar, SIGNAL( searchString(const QString &) ), this, SLOT( slotFind(const QString &) ) ); } -- cgit v1.2.1 From ff09defcd3ce26802866e689125548b059c4f2c3 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 30 Dec 2008 17:24:57 +0100 Subject: Final adjs for 0.0.2 --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7bf44d06..3e0d71fa 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -109,7 +109,7 @@ MainWindow::MainWindow() navigationBar->addWidget(m_searchBar); // Find Bar - m_findBar = new FindBar(this); + m_findBar = new FindBar( this ); connect( m_findBar, SIGNAL( searchString(const QString &) ), this, SLOT( slotFind(const QString &) ) ); } -- cgit v1.2.1 From 0f11df2f16d30ed5edcd0db1f129078bd02338c5 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 7 Jan 2009 17:09:53 +0100 Subject: Removed setFocus from lineEdit->currentWebview so that people can switch trough tabs with CTRL tabbing --- src/mainwindow.cpp | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3e0d71fa..d99ccd46 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -138,32 +138,15 @@ void MainWindow::setupActions() KStandardAction::home( this, SLOT( slotHome() ), actionCollection() ); KStandardAction::preferences( this, SLOT( slotPreferences() ), actionCollection() ); - a = KStandardAction::redisplay( this, 0, actionCollection() ); - m_tabWidget->addWebAction( a, QWebPage::Reload ); - - a = KStandardAction::back( this, 0, actionCollection() ); - m_tabWidget->addWebAction( a, QWebPage::Back ); - - a = KStandardAction::forward( this, 0, actionCollection() ); - m_tabWidget->addWebAction( a, QWebPage::Forward ); - - a = KStandardAction::undo( this , 0 , actionCollection() ); - m_tabWidget->addWebAction( a , QWebPage::Undo ); - - a = KStandardAction::redo( this , 0 , actionCollection() ); - m_tabWidget->addWebAction( a, QWebPage::Redo ); - - a = KStandardAction::cut( this , 0 , actionCollection() ); - m_tabWidget->addWebAction( a, QWebPage::Cut ); - - a = KStandardAction::copy( this , 0 , actionCollection() ); - m_tabWidget->addWebAction( a, QWebPage::Copy ); - - a = KStandardAction::paste( this , 0 , actionCollection() ); - m_tabWidget->addWebAction( a, QWebPage::Paste ); - - a = KStandardAction::selectAll( this , 0 , actionCollection() ); - m_tabWidget->addWebAction( a, QWebPage::SelectEndOfDocument ); + m_tabWidget->addWebAction( KStandardAction::redisplay( this, 0, actionCollection() ) , QWebPage::Reload ); + m_tabWidget->addWebAction( KStandardAction::back( this, 0, actionCollection() ) , QWebPage::Back ); + m_tabWidget->addWebAction( KStandardAction::forward( this, 0, actionCollection() ) , QWebPage::Forward ); + m_tabWidget->addWebAction( KStandardAction::undo( this , 0 , actionCollection() ) , QWebPage::Undo ); + m_tabWidget->addWebAction( KStandardAction::redo( this , 0 , actionCollection() ) , QWebPage::Redo ); + m_tabWidget->addWebAction( KStandardAction::cut( this , 0 , actionCollection() ) , QWebPage::Cut ); + m_tabWidget->addWebAction( KStandardAction::copy( this , 0 , actionCollection() ) , QWebPage::Copy ); + m_tabWidget->addWebAction( KStandardAction::paste( this , 0 , actionCollection() ) , QWebPage::Paste ); + m_tabWidget->addWebAction( KStandardAction::selectAll( this , 0 , actionCollection() ) , QWebPage::SelectEndOfDocument ); // stop reload Action m_stopReload = new KAction( KIcon("view-refresh"), i18n("reload"), this ); -- cgit v1.2.1 From e584eeaf35a7db2ee6e5c63ef3fcf32b92474df1 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 8 Jan 2009 01:49:02 +0100 Subject: Little changes.. --- src/mainwindow.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d99ccd46..9813cf1e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -77,7 +77,6 @@ MainWindow::MainWindow() connect(m_tabWidget, SIGNAL( printRequested(QWebFrame *)), this, SLOT( printRequested(QWebFrame *) ) ); connect(m_tabWidget, SIGNAL( menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT( setVisible(bool) ) ); connect(m_tabWidget, SIGNAL( statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT( setVisible(bool) ) ); -// connect(m_tabWidget, SIGNAL( toolBarVisibilityChangeRequested(bool) ), m_navigationBar, SLOT( setVisible(bool) ) ); connect(m_tabWidget, SIGNAL( lastTabClosed() ), m_tabWidget, SLOT(newTab() ) ); slotUpdateWindowTitle(); @@ -223,7 +222,7 @@ void MainWindow::setupActions() void MainWindow::setupCustomMenu() { - // ------------------------------------------------------------- HISTORY MENU-------------------------------------------------------------------------------------------------- + // -------------------------------- HISTORY MENU ----------------------------------------------------------------------- HistoryMenu *historyMenu = new HistoryMenu(this); connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_tabWidget, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); @@ -237,12 +236,12 @@ void MainWindow::setupCustomMenu() historyActions.append( m_tabWidget->recentlyClosedTabsAction() ); historyMenu->setInitialActions(historyActions); - // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + //-------------------------------------------------------------------------------------------------------------- - // --------------------------------------------- BOOKMARKS MENU ----------------------------------------------------------------------------------------------------- + // ------------------------------ BOOKMARKS MENU -------------------------------------------------------------- - // ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + // ------------------------------------------------------------------------------------------------------------- } KUrl MainWindow::guessUrlFromString(const QString &string) @@ -444,8 +443,9 @@ void MainWindow::slotPrivateBrowsing() // if (m_tabWidget->count() > 1) // { // int ret = KMessageBox::warningYesNo(this, -// i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_tabWidget->count() ) , -// i18n("Closing") ); +// i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_tabWidget->count() ), +// i18n("Closing") +// ); // if (ret == KMessageBox::No) // { // event->ignore(); -- cgit v1.2.1 From 6cf7ab65f009f07cdc0ded9ec377665c124a84ac Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 8 Jan 2009 02:35:46 +0100 Subject: Created mainview! Other minor adjs.. --- src/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9813cf1e..481bac96 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -21,13 +21,13 @@ // Self Includes #include "mainwindow.h" +#include "mainwindow.moc" // Local Includes #include "browserapplication.h" #include "downloadmanager.h" #include "history.h" #include "settings.h" -#include "tabwidget.h" #include "bookmarks.h" #include "webview.h" @@ -57,7 +57,7 @@ MainWindow::MainWindow() : KXmlGuiWindow() - , m_tabWidget( new TabWidget(this) ) + , m_tabWidget( new MainView(this) ) { // accept dnd setAcceptDrops(true); @@ -587,7 +587,7 @@ void MainWindow::loadPage(const QString &page) } -TabWidget *MainWindow::tabWidget() const +MainView *MainWindow::tabWidget() const { return m_tabWidget; } -- cgit v1.2.1 From 3118e255ecf417553a6750950da4cd4880a7a42c Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 9 Jan 2009 02:26:59 +0100 Subject: Last commit before loadPage REMOVAL.. .. --- src/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 481bac96..6d1ccf5d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -169,17 +169,17 @@ void MainWindow::setupActions() actionCollection()->addAction( i18n("private browsing"), a ); connect( a, SIGNAL( triggered(bool) ) , this, SLOT( slotPrivateBrowsing() ) ); - a = new KAction( KIcon("zoom-in"), i18n("&Enlarge font"), this ); + a = new KAction( KIcon("zoom-in"), i18n("&Enlarge Font"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Plus) ); actionCollection()->addAction( QLatin1String("bigger font"), a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextBigger() ) ); - a = new KAction( KIcon("zoom-original"), i18n("&Normal font"), this ); + a = new KAction( KIcon("zoom-original"), i18n("&Normal Font"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_0) ); actionCollection()->addAction( QLatin1String("normal font"), a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextNormal() ) ); - a = new KAction( KIcon("zoom-out"), i18n("&Shrink font"), this ); + a = new KAction( KIcon("zoom-out"), i18n("&Shrink Font"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Minus) ); actionCollection()->addAction( QLatin1String("smaller font"), a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextSmaller() ) ); -- cgit v1.2.1 From a14af0874d4ceac743727af1665ea1d5f15839d9 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 9 Jan 2009 02:44:50 +0100 Subject: removed LoadPage method to semplify API Now we have just loadUrl slot to run pages.. --- src/mainwindow.cpp | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6d1ccf5d..b941e49b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -67,7 +67,7 @@ MainWindow::MainWindow() // tell the KXmlGuiWindow that this is indeed the main widget setCentralWidget(m_tabWidget); - connect(m_tabWidget, SIGNAL( loadPage(const QString &) ), this, SLOT( loadPage(const QString &) ) ); + connect(m_tabWidget, SIGNAL( loadUrlPage(const KUrl &) ), this, SLOT( loadUrl(const KUrl &) ) ); connect(m_tabWidget, SIGNAL( setCurrentTitle(const QString &)), this, SLOT( slotUpdateWindowTitle(const QString &) ) ); connect(m_tabWidget, SIGNAL( showStatusBarMessage(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); connect(m_tabWidget, SIGNAL( linkHovered(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); @@ -236,14 +236,9 @@ void MainWindow::setupCustomMenu() historyActions.append( m_tabWidget->recentlyClosedTabsAction() ); historyMenu->setInitialActions(historyActions); - //-------------------------------------------------------------------------------------------------------------- - - // ------------------------------ BOOKMARKS MENU -------------------------------------------------------------- - - - // ------------------------------------------------------------------------------------------------------------- } + KUrl MainWindow::guessUrlFromString(const QString &string) { QString urlStr = string.trimmed(); @@ -301,7 +296,11 @@ KUrl MainWindow::guessUrlFromString(const QString &string) void MainWindow::loadUrl(const KUrl &url) { - loadPage( url.url() ); + if (!currentTab() || url.isEmpty()) + return; + + m_tabWidget->currentLineEdit()->setText( url.prettyUrl() ); + m_tabWidget->loadUrlInCurrentTab(url); } @@ -360,15 +359,16 @@ void MainWindow::slotFileNew() void MainWindow::slotFileOpen() { - QString file = KFileDialog::getOpenFileName( KUrl(), - i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)"), - this, - i18n("Open Web Resource") ); + QString filePath = KFileDialog::getOpenFileName( KUrl(), + i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)"), + this, + i18n("Open Web Resource") + ); - if (file.isEmpty()) + if (filePath.isEmpty()) return; - loadPage(file); + loadUrl( guessUrlFromString(filePath) ); } @@ -542,7 +542,7 @@ void MainWindow::slotHome() KConfig config("rekonqrc"); KConfigGroup group = config.group("Global Settings"); QString home = group.readEntry( QString("home"), QString("http://www.kde.org/") ); - loadPage(home); + loadUrl( KUrl(home) ); } @@ -576,17 +576,6 @@ void MainWindow::slotSwapFocus() } -void MainWindow::loadPage(const QString &page) -{ - if (!currentTab() || page.isEmpty()) - return; - - KUrl url = guessUrlFromString(page); - m_tabWidget->currentLineEdit()->setText( url.prettyUrl() ); - m_tabWidget->loadUrlInCurrentTab(url); -} - - MainView *MainWindow::tabWidget() const { return m_tabWidget; -- cgit v1.2.1 From 5391120be8cfd3a5d752ac8c7b66bf17b690f303 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 9 Jan 2009 12:10:19 +0100 Subject: BIG change!! Removed use of proxy webactionmapper to manage web actions.. --- src/mainwindow.cpp | 53 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b941e49b..e85cd7b2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -137,15 +137,26 @@ void MainWindow::setupActions() KStandardAction::home( this, SLOT( slotHome() ), actionCollection() ); KStandardAction::preferences( this, SLOT( slotPreferences() ), actionCollection() ); - m_tabWidget->addWebAction( KStandardAction::redisplay( this, 0, actionCollection() ) , QWebPage::Reload ); - m_tabWidget->addWebAction( KStandardAction::back( this, 0, actionCollection() ) , QWebPage::Back ); - m_tabWidget->addWebAction( KStandardAction::forward( this, 0, actionCollection() ) , QWebPage::Forward ); - m_tabWidget->addWebAction( KStandardAction::undo( this , 0 , actionCollection() ) , QWebPage::Undo ); - m_tabWidget->addWebAction( KStandardAction::redo( this , 0 , actionCollection() ) , QWebPage::Redo ); - m_tabWidget->addWebAction( KStandardAction::cut( this , 0 , actionCollection() ) , QWebPage::Cut ); - m_tabWidget->addWebAction( KStandardAction::copy( this , 0 , actionCollection() ) , QWebPage::Copy ); - m_tabWidget->addWebAction( KStandardAction::paste( this , 0 , actionCollection() ) , QWebPage::Paste ); - m_tabWidget->addWebAction( KStandardAction::selectAll( this , 0 , actionCollection() ) , QWebPage::SelectEndOfDocument ); + // WEB Actions (NO KStandardActions..) + KStandardAction::redisplay( m_tabWidget, SLOT( slotWebReload() ), actionCollection() ); + KStandardAction::back( m_tabWidget, SLOT( slotWebBack() ), actionCollection() ); + KStandardAction::forward( m_tabWidget, SLOT( slotWebForward() ), actionCollection() ); + KStandardAction::undo( m_tabWidget, SLOT( slotWebUndo() ), actionCollection() ); + KStandardAction::redo( m_tabWidget, SLOT( slotWebRedo() ), actionCollection() ); + KStandardAction::cut( m_tabWidget, SLOT( slotWebCut() ), actionCollection() ); + KStandardAction::copy( m_tabWidget, SLOT( slotWebCopy() ), actionCollection() ); + KStandardAction::paste( m_tabWidget, SLOT( slotWebPaste() ), actionCollection() ); + KStandardAction::selectAll( m_tabWidget, SLOT( slotWebSelectAll() ), actionCollection() ); + +// m_tabWidget->addWebAction( KStandardAction::redisplay( this, 0, actionCollection() ) , QWebPage::Reload ); +// m_tabWidget->addWebAction( KStandardAction::back( this, 0, actionCollection() ) , QWebPage::Back ); +// m_tabWidget->addWebAction( KStandardAction::forward( this, 0, actionCollection() ) , QWebPage::Forward ); +// m_tabWidget->addWebAction( KStandardAction::undo( this , 0 , actionCollection() ) , QWebPage::Undo ); +// m_tabWidget->addWebAction( KStandardAction::redo( this , 0 , actionCollection() ) , QWebPage::Redo ); +// m_tabWidget->addWebAction( KStandardAction::cut( this , 0 , actionCollection() ) , QWebPage::Cut ); +// m_tabWidget->addWebAction( KStandardAction::copy( this , 0 , actionCollection() ) , QWebPage::Copy ); +// m_tabWidget->addWebAction( KStandardAction::paste( this , 0 , actionCollection() ) , QWebPage::Paste ); +// m_tabWidget->addWebAction( KStandardAction::selectAll( this , 0 , actionCollection() ) , QWebPage::SelectEndOfDocument ); // stop reload Action m_stopReload = new KAction( KIcon("view-refresh"), i18n("reload"), this ); @@ -197,15 +208,13 @@ void MainWindow::setupActions() actionCollection()->addAction( QLatin1String("web inspector"), a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotToggleInspector(bool) ) ); + // BOOKMARKS MENU a = new KActionMenu( i18n("B&ookmarks"), this ); actionCollection()->addAction( QLatin1String("bookmarks"), a ); BookmarksMenu *bookmarksMenu = new BookmarksMenu( this ); a->setMenu( bookmarksMenu ); - // =================================================================================================================== - // =================================================================================================================== - // FIXME - + // history related actions KAction *historyBack = new KAction( KIcon("go-previous"), i18n("Back"), this); m_historyBackMenu = new KMenu(this); historyBack->setMenu(m_historyBackMenu); @@ -217,6 +226,10 @@ void MainWindow::setupActions() KAction *historyForward = new KAction( KIcon("go-next"), i18n("Forward"), this ); connect(historyForward, SIGNAL( triggered( bool ) ), this, SLOT( slotOpenNext() ) ); actionCollection()->addAction( QLatin1String("history forward"), historyForward ); + + // =================================================================================================================== + + } @@ -230,9 +243,8 @@ void MainWindow::setupCustomMenu() menuBar()->insertMenu( actionCollection()->action("bookmarks"), historyMenu); QList historyActions; - historyActions.append( actionCollection()->action("Back") ); - historyActions.append( actionCollection()->action("Forward") ); - historyActions.append( actionCollection()->action("Home") ); + historyActions.append( actionCollection()->action("history back") ); + historyActions.append( actionCollection()->action("history forward") ); historyActions.append( m_tabWidget->recentlyClosedTabsAction() ); historyMenu->setInitialActions(historyActions); @@ -593,20 +605,23 @@ WebView *MainWindow::currentTab() const void MainWindow::slotLoadProgress(int progress) { QAction *stop = actionCollection()->action( "stop" ); - QAction *reload = actionCollection()->action(" redisplay" ); + QAction *reload = actionCollection()->action( "view_redisplay" ); if (progress < 100 && progress > 0) { disconnect( m_stopReload, SIGNAL( triggered( bool ) ), reload , SIGNAL( triggered(bool) ) ); m_stopReload->setIcon( KIcon( "process-stop" ) ); - connect(m_stopReload, SIGNAL( triggered(bool ) ), stop, SIGNAL( triggered(bool) ) ); m_stopReload->setToolTip( i18n("Stop loading the current page") ); + m_stopReload->setText( i18n("Stop") ); + connect(m_stopReload, SIGNAL( triggered(bool ) ), stop, SIGNAL( triggered(bool) ) ); } else { disconnect( m_stopReload, SIGNAL( triggered( bool ) ), stop , SIGNAL( triggered(bool ) ) ); m_stopReload->setIcon( KIcon( "view-refresh" ) ); - connect(m_stopReload, SIGNAL( triggered( bool ) ), reload, SIGNAL( triggered(bool) ) ); m_stopReload->setToolTip( i18n("Reload the current page") ); + m_stopReload->setText( i18n("Reload") ); + connect(m_stopReload, SIGNAL( triggered( bool ) ), reload, SIGNAL( triggered(bool) ) ); + } } -- cgit v1.2.1 From 910f1cc073f95f2928cb29d87561f71a27513872 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 9 Jan 2009 12:26:38 +0100 Subject: Removed WebActionMapper class! Now we are really starting to have adjam web browser.. --- src/mainwindow.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e85cd7b2..e14f8611 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -148,16 +148,6 @@ void MainWindow::setupActions() KStandardAction::paste( m_tabWidget, SLOT( slotWebPaste() ), actionCollection() ); KStandardAction::selectAll( m_tabWidget, SLOT( slotWebSelectAll() ), actionCollection() ); -// m_tabWidget->addWebAction( KStandardAction::redisplay( this, 0, actionCollection() ) , QWebPage::Reload ); -// m_tabWidget->addWebAction( KStandardAction::back( this, 0, actionCollection() ) , QWebPage::Back ); -// m_tabWidget->addWebAction( KStandardAction::forward( this, 0, actionCollection() ) , QWebPage::Forward ); -// m_tabWidget->addWebAction( KStandardAction::undo( this , 0 , actionCollection() ) , QWebPage::Undo ); -// m_tabWidget->addWebAction( KStandardAction::redo( this , 0 , actionCollection() ) , QWebPage::Redo ); -// m_tabWidget->addWebAction( KStandardAction::cut( this , 0 , actionCollection() ) , QWebPage::Cut ); -// m_tabWidget->addWebAction( KStandardAction::copy( this , 0 , actionCollection() ) , QWebPage::Copy ); -// m_tabWidget->addWebAction( KStandardAction::paste( this , 0 , actionCollection() ) , QWebPage::Paste ); -// m_tabWidget->addWebAction( KStandardAction::selectAll( this , 0 , actionCollection() ) , QWebPage::SelectEndOfDocument ); - // stop reload Action m_stopReload = new KAction( KIcon("view-refresh"), i18n("reload"), this ); actionCollection()->addAction( QLatin1String("stop reload") , m_stopReload ); @@ -166,7 +156,7 @@ void MainWindow::setupActions() a = new KAction ( KIcon( "process-stop" ), i18n("&Stop"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); actionCollection()->addAction( QLatin1String("stop"), a ); - m_tabWidget->addWebAction( a, QWebPage::Stop); +// FIXME m_tabWidget->addWebAction( a, QWebPage::Stop); a = new KAction( KIcon(), i18n("Open Location"), this); actionCollection()->addAction( QLatin1String("open location"), a ); -- cgit v1.2.1 From 886bdb99cd998c045e111a2d7e6f77e29d30b784 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 9 Jan 2009 16:37:41 +0100 Subject: Every action is now in ActionCollection!! Fully adopted xmlgui && mainview concepts.. --- src/mainwindow.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e14f8611..6fcdf7e6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -99,6 +99,9 @@ MainWindow::MainWindow() // setup history & bookmarks menus setupCustomMenu(); + // setup Tab Bar + setupTabBar(); + // setting up custom widgets.. KToolBar *navigationBar = toolBar( "mainToolBar" ); navigationBar->addWidget( m_tabWidget->lineEditStack() ); @@ -152,7 +155,7 @@ void MainWindow::setupActions() m_stopReload = new KAction( KIcon("view-refresh"), i18n("reload"), this ); actionCollection()->addAction( QLatin1String("stop reload") , m_stopReload ); - // Custom Actions + // ============== Custom Actions a = new KAction ( KIcon( "process-stop" ), i18n("&Stop"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); actionCollection()->addAction( QLatin1String("stop"), a ); @@ -162,9 +165,6 @@ void MainWindow::setupActions() actionCollection()->addAction( QLatin1String("open location"), a ); connect( a, SIGNAL( triggered(bool) ) , this, SLOT( slotOpenLocation() ) ); - actionCollection()->addAction( QLatin1String("new tab"), m_tabWidget->newTabAction() ); - actionCollection()->addAction( QLatin1String("close tab"), m_tabWidget->closeTabAction() ); - a = new KAction( i18n("Private &Browsing..."), this ); a->setCheckable(true); actionCollection()->addAction( i18n("private browsing"), a ); @@ -198,13 +198,13 @@ void MainWindow::setupActions() actionCollection()->addAction( QLatin1String("web inspector"), a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotToggleInspector(bool) ) ); - // BOOKMARKS MENU + // ================== BOOKMARKS MENU a = new KActionMenu( i18n("B&ookmarks"), this ); actionCollection()->addAction( QLatin1String("bookmarks"), a ); BookmarksMenu *bookmarksMenu = new BookmarksMenu( this ); a->setMenu( bookmarksMenu ); - // history related actions + // ================ history related actions KAction *historyBack = new KAction( KIcon("go-previous"), i18n("Back"), this); m_historyBackMenu = new KMenu(this); historyBack->setMenu(m_historyBackMenu); @@ -217,9 +217,44 @@ void MainWindow::setupActions() connect(historyForward, SIGNAL( triggered( bool ) ), this, SLOT( slotOpenNext() ) ); actionCollection()->addAction( QLatin1String("history forward"), historyForward ); - // =================================================================================================================== + // =================== Tab Actions + a = new KAction( KIcon("tab-new"), i18n("New &Tab"), this); + a->setShortcut( KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T) ); + actionCollection()->addAction( QLatin1String("new tab"), a); + connect(a, SIGNAL(triggered()), m_tabWidget, SLOT(newTab())); + + a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); + a->setShortcut( KShortcut( Qt::CTRL + Qt::Key_W ) ); + actionCollection()->addAction( QLatin1String("close tab"), a); + connect(a, SIGNAL(triggered()), m_tabWidget, SLOT(closeTab())); + + a = new KAction(i18n("Show Next Tab"), this); + a->setShortcuts( QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext() ); + actionCollection()->addAction( QLatin1String("show next tab"), a); + connect(a, SIGNAL(triggered()), m_tabWidget, SLOT(nextTab())); + a = new KAction(i18n("Show Previous Tab"), this); + a->setShortcuts( QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev() ); + actionCollection()->addAction( QLatin1String("show prev tab"), a); + connect(a, SIGNAL(triggered()), m_tabWidget, SLOT(previousTab())); +} + + +void MainWindow::setupTabBar() +{ + // Left corner button + QToolButton *addTabButton = new QToolButton(this); + addTabButton->setDefaultAction( actionCollection()->action("new tab") ); + addTabButton->setAutoRaise(true); + addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_tabWidget->setCornerWidget(addTabButton, Qt::TopLeftCorner); + // right corner button + QToolButton *closeTabButton = new QToolButton(this); + closeTabButton->setDefaultAction( actionCollection()->action("close tab") ); + closeTabButton->setAutoRaise(true); + closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); + m_tabWidget->setCornerWidget(closeTabButton, Qt::TopRightCorner); } -- cgit v1.2.1 From 8b0c34007ddf70de767b036a21d978befb9654d4 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 12 Jan 2009 01:10:49 +0100 Subject: Fixed unconnected STOP web action --- src/mainwindow.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6fcdf7e6..2086ff81 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -151,16 +151,16 @@ void MainWindow::setupActions() KStandardAction::paste( m_tabWidget, SLOT( slotWebPaste() ), actionCollection() ); KStandardAction::selectAll( m_tabWidget, SLOT( slotWebSelectAll() ), actionCollection() ); + a = new KAction ( KIcon( "process-stop" ), i18n("&Stop"), this ); + a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); + actionCollection()->addAction( QLatin1String("stop"), a ); + connect( a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT( slotWebStop() ) ); + // stop reload Action m_stopReload = new KAction( KIcon("view-refresh"), i18n("reload"), this ); actionCollection()->addAction( QLatin1String("stop reload") , m_stopReload ); - // ============== Custom Actions - a = new KAction ( KIcon( "process-stop" ), i18n("&Stop"), this ); - a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); - actionCollection()->addAction( QLatin1String("stop"), a ); -// FIXME m_tabWidget->addWebAction( a, QWebPage::Stop); - + // ============== Custom Actions a = new KAction( KIcon(), i18n("Open Location"), this); actionCollection()->addAction( QLatin1String("open location"), a ); connect( a, SIGNAL( triggered(bool) ) , this, SLOT( slotOpenLocation() ) ); @@ -173,30 +173,30 @@ void MainWindow::setupActions() a = new KAction( KIcon("zoom-in"), i18n("&Enlarge Font"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Plus) ); actionCollection()->addAction( QLatin1String("bigger font"), a ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextBigger() ) ); + connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotViewTextBigger() ) ); a = new KAction( KIcon("zoom-original"), i18n("&Normal Font"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_0) ); actionCollection()->addAction( QLatin1String("normal font"), a ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextNormal() ) ); + connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotViewTextNormal() ) ); a = new KAction( KIcon("zoom-out"), i18n("&Shrink Font"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Minus) ); actionCollection()->addAction( QLatin1String("smaller font"), a ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewTextSmaller() ) ); + connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotViewTextSmaller() ) ); a = new KAction( i18n("Page S&ource"), this ); actionCollection()->addAction( QLatin1String("page source"), a ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotViewPageSource() ) ); + connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotViewPageSource() ) ); a = new KAction( KIcon( "kget" ), i18n("Downloads"), this ); actionCollection()->addAction( QLatin1String("downloads"), a); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotDownloadManager() ) ); + connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotDownloadManager() ) ); a = new KAction( KIcon("page-zoom"), i18n("Enable Web &Inspector"), this ); a->setCheckable(true); actionCollection()->addAction( QLatin1String("web inspector"), a ); - connect( a, SIGNAL( triggered( bool ) ), this, SLOT( slotToggleInspector(bool) ) ); + connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotToggleInspector(bool) ) ); // ================== BOOKMARKS MENU a = new KActionMenu( i18n("B&ookmarks"), this ); @@ -208,35 +208,35 @@ void MainWindow::setupActions() KAction *historyBack = new KAction( KIcon("go-previous"), i18n("Back"), this); m_historyBackMenu = new KMenu(this); historyBack->setMenu(m_historyBackMenu); - connect(historyBack, SIGNAL( triggered( bool ) ), this, SLOT( slotOpenPrevious() ) ); + connect(historyBack, SIGNAL( triggered(bool) ), this, SLOT( slotOpenPrevious() ) ); connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); actionCollection()->addAction( QLatin1String("history back"), historyBack); KAction *historyForward = new KAction( KIcon("go-next"), i18n("Forward"), this ); - connect(historyForward, SIGNAL( triggered( bool ) ), this, SLOT( slotOpenNext() ) ); + connect(historyForward, SIGNAL( triggered(bool) ), this, SLOT( slotOpenNext() ) ); actionCollection()->addAction( QLatin1String("history forward"), historyForward ); // =================== Tab Actions a = new KAction( KIcon("tab-new"), i18n("New &Tab"), this); a->setShortcut( KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T) ); actionCollection()->addAction( QLatin1String("new tab"), a); - connect(a, SIGNAL(triggered()), m_tabWidget, SLOT(newTab())); + connect(a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT(newTab())); a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); a->setShortcut( KShortcut( Qt::CTRL + Qt::Key_W ) ); actionCollection()->addAction( QLatin1String("close tab"), a); - connect(a, SIGNAL(triggered()), m_tabWidget, SLOT(closeTab())); + connect(a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT(closeTab())); a = new KAction(i18n("Show Next Tab"), this); a->setShortcuts( QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext() ); actionCollection()->addAction( QLatin1String("show next tab"), a); - connect(a, SIGNAL(triggered()), m_tabWidget, SLOT(nextTab())); + connect(a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT(nextTab())); a = new KAction(i18n("Show Previous Tab"), this); a->setShortcuts( QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev() ); actionCollection()->addAction( QLatin1String("show prev tab"), a); - connect(a, SIGNAL(triggered()), m_tabWidget, SLOT(previousTab())); + connect(a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT(previousTab())); } -- cgit v1.2.1 From 1e222f437c3e521dc1930b31680a437cc329a078 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 15 Jan 2009 01:01:32 +0100 Subject: - cmake 2.6.2 - changed web inspector icon --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2086ff81..d1f60b5d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -193,7 +193,7 @@ void MainWindow::setupActions() actionCollection()->addAction( QLatin1String("downloads"), a); connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotDownloadManager() ) ); - a = new KAction( KIcon("page-zoom"), i18n("Enable Web &Inspector"), this ); + a = new KAction( KIcon("tools-report-bug"), i18n("Enable Web &Inspector"), this ); a->setCheckable(true); actionCollection()->addAction( QLatin1String("web inspector"), a ); connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotToggleInspector(bool) ) ); -- cgit v1.2.1 From 195641eb0e7972b32756e95340ebd48c21a7feaf Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 18 Jan 2009 02:10:22 +0100 Subject: Partially ported rekonq to KConfigXT technology.. Perhaps ~50%..going on!! --- src/mainwindow.cpp | 105 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 97 insertions(+), 8 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d1f60b5d..6c177103 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -23,11 +23,14 @@ #include "mainwindow.h" #include "mainwindow.moc" +// Auto Includes +#include "rekonq.h" + // Local Includes #include "browserapplication.h" #include "downloadmanager.h" -#include "history.h" #include "settings.h" +#include "history.h" #include "bookmarks.h" #include "webview.h" @@ -62,17 +65,21 @@ MainWindow::MainWindow() // accept dnd setAcceptDrops(true); + // updating rekonq configuration + updateConfiguration(); + + // creating a new tab m_tabWidget->newTab(); // tell the KXmlGuiWindow that this is indeed the main widget setCentralWidget(m_tabWidget); + // connect signals and slots connect(m_tabWidget, SIGNAL( loadUrlPage(const KUrl &) ), this, SLOT( loadUrl(const KUrl &) ) ); connect(m_tabWidget, SIGNAL( setCurrentTitle(const QString &)), this, SLOT( slotUpdateWindowTitle(const QString &) ) ); connect(m_tabWidget, SIGNAL( showStatusBarMessage(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); connect(m_tabWidget, SIGNAL( linkHovered(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); connect(m_tabWidget, SIGNAL( loadProgress(int)), this, SLOT( slotLoadProgress(int) ) ); -// connect(m_tabWidget, SIGNAL( tabsChanged()), m_autoSaver, SLOT( changeOccurred() ) ); connect(m_tabWidget, SIGNAL( geometryChangeRequested(const QRect &)), this, SLOT( geometryChangeRequested(const QRect &) ) ); connect(m_tabWidget, SIGNAL( printRequested(QWebFrame *)), this, SLOT( printRequested(QWebFrame *) ) ); connect(m_tabWidget, SIGNAL( menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT( setVisible(bool) ) ); @@ -80,8 +87,6 @@ MainWindow::MainWindow() connect(m_tabWidget, SIGNAL( lastTabClosed() ), m_tabWidget, SLOT(newTab() ) ); slotUpdateWindowTitle(); -// -------------------------------------------------------------------------------------------------------------------------------- - // then, setup our actions setupActions(); @@ -276,6 +281,93 @@ void MainWindow::setupCustomMenu() } +// TODO FIXME +void MainWindow::updateConfiguration() +{ + // ============== General ================== + m_homePage = ReKonfig::homePage(); + +// int historyExpire = ReKonfig::expireHistory(); +// int days; +// switch (historyExpire) +// { +// case 0: days = 1; break; +// case 1: days = 7; break; +// case 2: days = 14; break; +// case 3: days = 30; break; +// case 4: days = 365; break; +// case 5: days = -1; break; +// default: days = -1; +// } +// m_historyExpire = days; +// +// m_downloadDir = ReKonfig::downloadDir(); + + + // =========== Fonts ============== + QFont standardFont = ReKonfig::standardFont(); + QFont fixedFont = ReKonfig::fixedFont(); + + QWebSettings *defaultSettings = QWebSettings::globalSettings(); + defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); + defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); + defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); + defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); + + + // =========== Privacy ============== + + bool arePluginsEnabled = ReKonfig::enablePlugins(); + bool isJavascriptEnabled = ReKonfig::enableJavascript(); + + defaultSettings->setAttribute(QWebSettings::PluginsEnabled, arePluginsEnabled); + defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, isJavascriptEnabled); + +// int canAcceptCookies = ReKonfig::acceptCookies(); +// int canKeepCookiesUntil = ReKonfig::keepCookiesUntil(); +// +// CookieJar::KeepPolicy keepCookies; +// switch(canAcceptCookies) +// { +// default: +// case 0: +// keepCookies = CookieJar::KeepUntilExpire; +// break; +// case 1: +// keepCookies = CookieJar::KeepUntilExit; +// break; +// case 2: +// keepCookies = CookieJar::KeepUntilTimeLimit; +// break; +// } +// CookieJar *jar = BrowserApplication::cookieJar(); +// QMetaEnum acceptPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("AcceptPolicy")); +// +// CookieJar::KeepPolicy keepPolicy; +// switch(canKeepCookiesUntil) +// { +// default: +// case 0: +// keepPolicy = CookieJar::KeepUntilExpire; +// break; +// case 1: +// keepPolicy = CookieJar::KeepUntilExit; +// break; +// case 2: +// keepPolicy = CookieJar::KeepUntilTimeLimit; +// break; +// } +// +// QMetaEnum keepPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("KeepPolicy")); +// // --- +// BrowserApplication::instance()->loadSettings(); +// BrowserApplication::networkAccessManager()->loadSettings(); +// BrowserApplication::cookieJar()->loadSettings(); +// BrowserApplication::historyManager()->loadSettings(); + +} + + KUrl MainWindow::guessUrlFromString(const QString &string) { QString urlStr = string.trimmed(); @@ -576,10 +668,7 @@ void MainWindow::slotViewPageSource() void MainWindow::slotHome() { - KConfig config("rekonqrc"); - KConfigGroup group = config.group("Global Settings"); - QString home = group.readEntry( QString("home"), QString("http://www.kde.org/") ); - loadUrl( KUrl(home) ); + loadUrl( KUrl(m_homePage) ); } -- cgit v1.2.1 From 93755c7a74614c795036d0830cf080b7e4ff5654 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 18 Jan 2009 02:18:29 +0100 Subject: m_tabWidget --> m_view --- src/mainwindow.cpp | 84 +++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6c177103..bdf2120d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -60,7 +60,7 @@ MainWindow::MainWindow() : KXmlGuiWindow() - , m_tabWidget( new MainView(this) ) + , m_view( new MainView(this) ) { // accept dnd setAcceptDrops(true); @@ -69,22 +69,22 @@ MainWindow::MainWindow() updateConfiguration(); // creating a new tab - m_tabWidget->newTab(); + m_view->newTab(); // tell the KXmlGuiWindow that this is indeed the main widget - setCentralWidget(m_tabWidget); + setCentralWidget(m_view); // connect signals and slots - connect(m_tabWidget, SIGNAL( loadUrlPage(const KUrl &) ), this, SLOT( loadUrl(const KUrl &) ) ); - connect(m_tabWidget, SIGNAL( setCurrentTitle(const QString &)), this, SLOT( slotUpdateWindowTitle(const QString &) ) ); - connect(m_tabWidget, SIGNAL( showStatusBarMessage(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); - connect(m_tabWidget, SIGNAL( linkHovered(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); - connect(m_tabWidget, SIGNAL( loadProgress(int)), this, SLOT( slotLoadProgress(int) ) ); - connect(m_tabWidget, SIGNAL( geometryChangeRequested(const QRect &)), this, SLOT( geometryChangeRequested(const QRect &) ) ); - connect(m_tabWidget, SIGNAL( printRequested(QWebFrame *)), this, SLOT( printRequested(QWebFrame *) ) ); - connect(m_tabWidget, SIGNAL( menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT( setVisible(bool) ) ); - connect(m_tabWidget, SIGNAL( statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT( setVisible(bool) ) ); - connect(m_tabWidget, SIGNAL( lastTabClosed() ), m_tabWidget, SLOT(newTab() ) ); + connect(m_view, SIGNAL( loadUrlPage(const KUrl &) ), this, SLOT( loadUrl(const KUrl &) ) ); + connect(m_view, SIGNAL( setCurrentTitle(const QString &)), this, SLOT( slotUpdateWindowTitle(const QString &) ) ); + connect(m_view, SIGNAL( showStatusBarMessage(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); + connect(m_view, SIGNAL( linkHovered(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); + connect(m_view, SIGNAL( loadProgress(int)), this, SLOT( slotLoadProgress(int) ) ); + connect(m_view, SIGNAL( geometryChangeRequested(const QRect &)), this, SLOT( geometryChangeRequested(const QRect &) ) ); + connect(m_view, SIGNAL( printRequested(QWebFrame *)), this, SLOT( printRequested(QWebFrame *) ) ); + connect(m_view, SIGNAL( menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT( setVisible(bool) ) ); + connect(m_view, SIGNAL( statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT( setVisible(bool) ) ); + connect(m_view, SIGNAL( lastTabClosed() ), m_view, SLOT(newTab() ) ); slotUpdateWindowTitle(); @@ -109,7 +109,7 @@ MainWindow::MainWindow() // setting up custom widgets.. KToolBar *navigationBar = toolBar( "mainToolBar" ); - navigationBar->addWidget( m_tabWidget->lineEditStack() ); + navigationBar->addWidget( m_view->lineEditStack() ); m_searchBar = new SearchBar( this ); connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); @@ -146,20 +146,20 @@ void MainWindow::setupActions() KStandardAction::preferences( this, SLOT( slotPreferences() ), actionCollection() ); // WEB Actions (NO KStandardActions..) - KStandardAction::redisplay( m_tabWidget, SLOT( slotWebReload() ), actionCollection() ); - KStandardAction::back( m_tabWidget, SLOT( slotWebBack() ), actionCollection() ); - KStandardAction::forward( m_tabWidget, SLOT( slotWebForward() ), actionCollection() ); - KStandardAction::undo( m_tabWidget, SLOT( slotWebUndo() ), actionCollection() ); - KStandardAction::redo( m_tabWidget, SLOT( slotWebRedo() ), actionCollection() ); - KStandardAction::cut( m_tabWidget, SLOT( slotWebCut() ), actionCollection() ); - KStandardAction::copy( m_tabWidget, SLOT( slotWebCopy() ), actionCollection() ); - KStandardAction::paste( m_tabWidget, SLOT( slotWebPaste() ), actionCollection() ); - KStandardAction::selectAll( m_tabWidget, SLOT( slotWebSelectAll() ), actionCollection() ); + KStandardAction::redisplay( m_view, SLOT( slotWebReload() ), actionCollection() ); + KStandardAction::back( m_view, SLOT( slotWebBack() ), actionCollection() ); + KStandardAction::forward( m_view, SLOT( slotWebForward() ), actionCollection() ); + KStandardAction::undo( m_view, SLOT( slotWebUndo() ), actionCollection() ); + KStandardAction::redo( m_view, SLOT( slotWebRedo() ), actionCollection() ); + KStandardAction::cut( m_view, SLOT( slotWebCut() ), actionCollection() ); + KStandardAction::copy( m_view, SLOT( slotWebCopy() ), actionCollection() ); + KStandardAction::paste( m_view, SLOT( slotWebPaste() ), actionCollection() ); + KStandardAction::selectAll( m_view, SLOT( slotWebSelectAll() ), actionCollection() ); a = new KAction ( KIcon( "process-stop" ), i18n("&Stop"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); actionCollection()->addAction( QLatin1String("stop"), a ); - connect( a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT( slotWebStop() ) ); + connect( a, SIGNAL( triggered(bool) ), m_view, SLOT( slotWebStop() ) ); // stop reload Action m_stopReload = new KAction( KIcon("view-refresh"), i18n("reload"), this ); @@ -226,22 +226,22 @@ void MainWindow::setupActions() a = new KAction( KIcon("tab-new"), i18n("New &Tab"), this); a->setShortcut( KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T) ); actionCollection()->addAction( QLatin1String("new tab"), a); - connect(a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT(newTab())); + connect(a, SIGNAL( triggered(bool) ), m_view, SLOT(newTab())); a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); a->setShortcut( KShortcut( Qt::CTRL + Qt::Key_W ) ); actionCollection()->addAction( QLatin1String("close tab"), a); - connect(a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT(closeTab())); + connect(a, SIGNAL( triggered(bool) ), m_view, SLOT(closeTab())); a = new KAction(i18n("Show Next Tab"), this); a->setShortcuts( QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext() ); actionCollection()->addAction( QLatin1String("show next tab"), a); - connect(a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT(nextTab())); + connect(a, SIGNAL( triggered(bool) ), m_view, SLOT(nextTab())); a = new KAction(i18n("Show Previous Tab"), this); a->setShortcuts( QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev() ); actionCollection()->addAction( QLatin1String("show prev tab"), a); - connect(a, SIGNAL( triggered(bool) ), m_tabWidget, SLOT(previousTab())); + connect(a, SIGNAL( triggered(bool) ), m_view, SLOT(previousTab())); } @@ -252,14 +252,14 @@ void MainWindow::setupTabBar() addTabButton->setDefaultAction( actionCollection()->action("new tab") ); addTabButton->setAutoRaise(true); addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); - m_tabWidget->setCornerWidget(addTabButton, Qt::TopLeftCorner); + m_view->setCornerWidget(addTabButton, Qt::TopLeftCorner); // right corner button QToolButton *closeTabButton = new QToolButton(this); closeTabButton->setDefaultAction( actionCollection()->action("close tab") ); closeTabButton->setAutoRaise(true); closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); - m_tabWidget->setCornerWidget(closeTabButton, Qt::TopRightCorner); + m_view->setCornerWidget(closeTabButton, Qt::TopRightCorner); } @@ -267,7 +267,7 @@ void MainWindow::setupCustomMenu() { // -------------------------------- HISTORY MENU ----------------------------------------------------------------------- HistoryMenu *historyMenu = new HistoryMenu(this); - connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_tabWidget, SLOT(loadUrlInCurrentTab(const KUrl&))); + connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle( i18n("Hi&story") ); menuBar()->insertMenu( actionCollection()->action("bookmarks"), historyMenu); @@ -275,7 +275,7 @@ void MainWindow::setupCustomMenu() historyActions.append( actionCollection()->action("history back") ); historyActions.append( actionCollection()->action("history forward") ); - historyActions.append( m_tabWidget->recentlyClosedTabsAction() ); + historyActions.append( m_view->recentlyClosedTabsAction() ); historyMenu->setInitialActions(historyActions); } @@ -428,8 +428,8 @@ void MainWindow::loadUrl(const KUrl &url) if (!currentTab() || url.isEmpty()) return; - m_tabWidget->currentLineEdit()->setText( url.prettyUrl() ); - m_tabWidget->loadUrlInCurrentTab(url); + m_view->currentLineEdit()->setText( url.prettyUrl() ); + m_view->loadUrlInCurrentTab(url); } @@ -441,8 +441,8 @@ void MainWindow::slotDownloadManager() void MainWindow::slotOpenLocation() { - m_tabWidget->currentLineEdit()->selectAll(); - m_tabWidget->currentLineEdit()->setFocus(); + m_view->currentLineEdit()->selectAll(); + m_view->currentLineEdit()->setFocus(); } @@ -569,10 +569,10 @@ void MainWindow::slotPrivateBrowsing() // void MainWindow::closeEvent(QCloseEvent *event) // { -// if (m_tabWidget->count() > 1) +// if (m_view->count() > 1) // { // int ret = KMessageBox::warningYesNo(this, -// i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_tabWidget->count() ), +// i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_view->count() ), // i18n("Closing") // ); // if (ret == KMessageBox::No) @@ -683,7 +683,7 @@ void MainWindow::slotToggleInspector(bool enable) i18n("Web Inspector") ); if (result == KMessageBox::Yes) { - m_tabWidget->reloadAllTabs(); + m_view->reloadAllTabs(); } } } @@ -693,7 +693,7 @@ void MainWindow::slotSwapFocus() { if ( currentTab()->hasFocus() ) { - m_tabWidget->currentLineEdit()->setFocus(); + m_view->currentLineEdit()->setFocus(); } else { @@ -704,14 +704,14 @@ void MainWindow::slotSwapFocus() MainView *MainWindow::tabWidget() const { - return m_tabWidget; + return m_view; } WebView *MainWindow::currentTab() const { - return m_tabWidget->currentWebView(); + return m_view->currentWebView(); } -- cgit v1.2.1 From 76d30285358bedd8b2fc6caf48d2a871f7546685 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 19 Jan 2009 02:26:13 +0100 Subject: Ported tons of code to KConfigXT. To merge kcfg branch we need just to port cookie settings.. --- src/mainwindow.cpp | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bdf2120d..629899e4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -66,7 +66,8 @@ MainWindow::MainWindow() setAcceptDrops(true); // updating rekonq configuration - updateConfiguration(); + slotUpdateConf(); +// QTimer::singleShot(0, this, SLOT( postLaunch() ) ); // creating a new tab m_view->newTab(); @@ -118,7 +119,6 @@ MainWindow::MainWindow() // Find Bar m_findBar = new FindBar( this ); connect( m_findBar, SIGNAL( searchString(const QString &) ), this, SLOT( slotFind(const QString &) ) ); - } @@ -282,28 +282,11 @@ void MainWindow::setupCustomMenu() // TODO FIXME -void MainWindow::updateConfiguration() +void MainWindow::slotUpdateConf() { // ============== General ================== m_homePage = ReKonfig::homePage(); -// int historyExpire = ReKonfig::expireHistory(); -// int days; -// switch (historyExpire) -// { -// case 0: days = 1; break; -// case 1: days = 7; break; -// case 2: days = 14; break; -// case 3: days = 30; break; -// case 4: days = 365; break; -// case 5: days = -1; break; -// default: days = -1; -// } -// m_historyExpire = days; -// -// m_downloadDir = ReKonfig::downloadDir(); - - // =========== Fonts ============== QFont standardFont = ReKonfig::standardFont(); QFont fixedFont = ReKonfig::fixedFont(); @@ -454,7 +437,17 @@ void MainWindow::slotFileSaveAs() void MainWindow::slotPreferences() { + // an instance the dialog could be already created and could be cached, + // in which case you want to display the cached dialog + if ( SettingsDialog::showDialog( "settings" ) ) + return; + + // we didn't find an instance of this dialog, so lets create it SettingsDialog *s = new SettingsDialog(this); + + // keep us informed when the user changes settings + connect( s, SIGNAL(settingsChanged(const QString&)), this, SLOT(slotUpdateConf()) ); + s->show(); } -- cgit v1.2.1 From 504311e2a45c18e08865269985f00f7f3f3e6e8a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 20 Jan 2009 19:03:00 +0100 Subject: Implemented a new function to download data with KJob technologies.. It's not working. For now. But we are nearing the goal.. --- src/mainwindow.cpp | 61 +++++++----------------------------------------------- 1 file changed, 7 insertions(+), 54 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 629899e4..482c351d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -28,9 +28,10 @@ // Local Includes #include "browserapplication.h" -#include "downloadmanager.h" #include "settings.h" #include "history.h" +#include "cookiejar.h" +#include "networkaccessmanager.h" #include "bookmarks.h" #include "webview.h" @@ -194,10 +195,6 @@ void MainWindow::setupActions() actionCollection()->addAction( QLatin1String("page source"), a ); connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotViewPageSource() ) ); - a = new KAction( KIcon( "kget" ), i18n("Downloads"), this ); - actionCollection()->addAction( QLatin1String("downloads"), a); - connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotDownloadManager() ) ); - a = new KAction( KIcon("tools-report-bug"), i18n("Enable Web &Inspector"), this ); a->setCheckable(true); actionCollection()->addAction( QLatin1String("web inspector"), a ); @@ -306,48 +303,10 @@ void MainWindow::slotUpdateConf() defaultSettings->setAttribute(QWebSettings::PluginsEnabled, arePluginsEnabled); defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, isJavascriptEnabled); -// int canAcceptCookies = ReKonfig::acceptCookies(); -// int canKeepCookiesUntil = ReKonfig::keepCookiesUntil(); -// -// CookieJar::KeepPolicy keepCookies; -// switch(canAcceptCookies) -// { -// default: -// case 0: -// keepCookies = CookieJar::KeepUntilExpire; -// break; -// case 1: -// keepCookies = CookieJar::KeepUntilExit; -// break; -// case 2: -// keepCookies = CookieJar::KeepUntilTimeLimit; -// break; -// } -// CookieJar *jar = BrowserApplication::cookieJar(); -// QMetaEnum acceptPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("AcceptPolicy")); -// -// CookieJar::KeepPolicy keepPolicy; -// switch(canKeepCookiesUntil) -// { -// default: -// case 0: -// keepPolicy = CookieJar::KeepUntilExpire; -// break; -// case 1: -// keepPolicy = CookieJar::KeepUntilExit; -// break; -// case 2: -// keepPolicy = CookieJar::KeepUntilTimeLimit; -// break; -// } -// -// QMetaEnum keepPolicyEnum = jar->staticMetaObject.enumerator(jar->staticMetaObject.indexOfEnumerator("KeepPolicy")); -// // --- -// BrowserApplication::instance()->loadSettings(); -// BrowserApplication::networkAccessManager()->loadSettings(); -// BrowserApplication::cookieJar()->loadSettings(); -// BrowserApplication::historyManager()->loadSettings(); - + // load Settings on main classes + BrowserApplication::networkAccessManager()->loadSettings(); + BrowserApplication::cookieJar()->loadSettings(); + BrowserApplication::historyManager()->loadSettings(); } @@ -416,12 +375,6 @@ void MainWindow::loadUrl(const KUrl &url) } -void MainWindow::slotDownloadManager() -{ - BrowserApplication::downloadManager()->show(); -} - - void MainWindow::slotOpenLocation() { m_view->currentLineEdit()->selectAll(); @@ -431,7 +384,7 @@ void MainWindow::slotOpenLocation() void MainWindow::slotFileSaveAs() { - BrowserApplication::downloadManager()->download(currentTab()->url(), true); + BrowserApplication::instance()->downloadUrl( currentTab()->url() ); } -- cgit v1.2.1 From 22bc40e17d463ec817a9c9c1f461b4f7990c5450 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 21 Jan 2009 02:03:30 +0100 Subject: Reimplemented download system based on KGet one. Thanks Lucas ;) Rekonq now has its one! --- src/mainwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 482c351d..7a7ec427 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -384,7 +384,10 @@ void MainWindow::slotOpenLocation() void MainWindow::slotFileSaveAs() { - BrowserApplication::instance()->downloadUrl( currentTab()->url() ); + KUrl srcUrl = currentTab()->url(); + QString destPath = KFileDialog::getSaveFileName(); + KUrl destUrl = KUrl(destPath); + BrowserApplication::instance()->downloadUrl( srcUrl, destUrl ); } -- cgit v1.2.1 From feb5472021e697aa2722806a4a46ec56dfa1579f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 27 Jan 2009 12:21:11 +0100 Subject: We now have the FINAL search bar!! Yeah!!! --- src/mainwindow.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7a7ec427..10d6f8ce 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -57,6 +57,7 @@ #include #include #include +#include MainWindow::MainWindow() @@ -73,8 +74,18 @@ MainWindow::MainWindow() // creating a new tab m_view->newTab(); - // tell the KXmlGuiWindow that this is indeed the main widget - setCentralWidget(m_view); + // creating a centralWidget containing m_view and the hidden findbar + QWidget *centralWidget = new QWidget; + QVBoxLayout *layout = new QVBoxLayout; + layout->addWidget(m_view); + + // Find Bar + m_findBar = new FindBar(this); + connect( m_findBar, SIGNAL( searchString(const QString &) ), this, SLOT( slotFind(const QString &) ) ); + layout->addWidget(m_findBar); + + centralWidget->setLayout(layout); + setCentralWidget(centralWidget); // connect signals and slots connect(m_view, SIGNAL( loadUrlPage(const KUrl &) ), this, SLOT( loadUrl(const KUrl &) ) ); @@ -116,10 +127,6 @@ MainWindow::MainWindow() m_searchBar = new SearchBar( this ); connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); navigationBar->addWidget(m_searchBar); - - // Find Bar - m_findBar = new FindBar( this ); - connect( m_findBar, SIGNAL( searchString(const QString &) ), this, SLOT( slotFind(const QString &) ) ); } @@ -543,7 +550,9 @@ void MainWindow::slotFind(const QString & search) { m_lastSearch = search; if (!currentTab()->findText(m_lastSearch)) + { slotUpdateStatusbar( QString(m_lastSearch) + i18n(" not found.") ); + } } } @@ -556,7 +565,7 @@ void MainWindow::slotViewFindBar() void MainWindow::slotFindNext() { - if (!currentTab() && !m_lastSearch.isEmpty()) + if (!currentTab() && m_lastSearch.isEmpty()) return; currentTab()->findText(m_lastSearch); } @@ -564,7 +573,7 @@ void MainWindow::slotFindNext() void MainWindow::slotFindPrevious() { - if (!currentTab() && !m_lastSearch.isEmpty()) + if (!currentTab() && m_lastSearch.isEmpty()) return; currentTab()->findText(m_lastSearch, QWebPage::FindBackward); } -- cgit v1.2.1 From de1b2a26f7eaebd3fa1fa2eeb30f4e26afb534fe Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 27 Jan 2009 17:33:26 +0100 Subject: Fixed MenuBar. Fixed BookmarkLine in rekonqui.rc Now we need just the code to implement it.. --- src/mainwindow.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 10d6f8ce..0d93ea60 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -63,6 +63,7 @@ MainWindow::MainWindow() : KXmlGuiWindow() , m_view( new MainView(this) ) + , m_manager(0) { // accept dnd setAcceptDrops(true); @@ -107,6 +108,16 @@ MainWindow::MainWindow() // add a status bar statusBar()->show(); + // ----- BOOKMARKS MENU: this has to be done BEFORE setupGUI!! + KUrl bookfile = KUrl( "~/.kde/share/apps/konqueror/bookmarks.xml" ); // share konqueror bookmarks + m_manager = KBookmarkManager::managerForExternalFile( bookfile.path() ); + + KAction *a = new KActionMenu( i18n("B&ookmarks"), this ); + actionCollection()->addAction( QLatin1String("bookmarks"), a ); + BookmarksMenu *bookmarksMenu = new BookmarksMenu( this, m_manager ); + a->setMenu( bookmarksMenu ); + + // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. // It also applies the saved mainwindow settings, if any, and ask the @@ -114,8 +125,8 @@ MainWindow::MainWindow() // toolbar position, icon size, etc. setupGUI(); - // setup history & bookmarks menus - setupCustomMenu(); + // setup history menu + setupHistoryMenu(); // setup Tab Bar setupTabBar(); @@ -207,12 +218,6 @@ void MainWindow::setupActions() actionCollection()->addAction( QLatin1String("web inspector"), a ); connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotToggleInspector(bool) ) ); - // ================== BOOKMARKS MENU - a = new KActionMenu( i18n("B&ookmarks"), this ); - actionCollection()->addAction( QLatin1String("bookmarks"), a ); - BookmarksMenu *bookmarksMenu = new BookmarksMenu( this ); - a->setMenu( bookmarksMenu ); - // ================ history related actions KAction *historyBack = new KAction( KIcon("go-previous"), i18n("Back"), this); m_historyBackMenu = new KMenu(this); @@ -267,9 +272,8 @@ void MainWindow::setupTabBar() } -void MainWindow::setupCustomMenu() +void MainWindow::setupHistoryMenu() { - // -------------------------------- HISTORY MENU ----------------------------------------------------------------------- HistoryMenu *historyMenu = new HistoryMenu(this); connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); -- cgit v1.2.1 From 1024f77ad03ef3d30d8be6aa61542a057a100868 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 28 Jan 2009 00:59:08 +0100 Subject: Removed unuseful "Select All" action. If someone needs it, I can try to implement it one day.. --- src/mainwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0d93ea60..d956642b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -34,6 +34,8 @@ #include "networkaccessmanager.h" #include "bookmarks.h" #include "webview.h" +#include "mainview.h" +#include "bookmarks.h" // UI Includes #include "ui_passworddialog.h" @@ -173,7 +175,6 @@ void MainWindow::setupActions() KStandardAction::cut( m_view, SLOT( slotWebCut() ), actionCollection() ); KStandardAction::copy( m_view, SLOT( slotWebCopy() ), actionCollection() ); KStandardAction::paste( m_view, SLOT( slotWebPaste() ), actionCollection() ); - KStandardAction::selectAll( m_view, SLOT( slotWebSelectAll() ), actionCollection() ); a = new KAction ( KIcon( "process-stop" ), i18n("&Stop"), this ); a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); -- cgit v1.2.1 From d467ccf90fb3e8c851db97c44f551aeaa9fa289f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 28 Jan 2009 15:58:37 +0100 Subject: New BookmarkBar!! 1st version, Yeah!! --- src/mainwindow.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d956642b..87ae0ac0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -50,6 +50,7 @@ #include #include #include +#include // Qt Includes #include @@ -65,7 +66,7 @@ MainWindow::MainWindow() : KXmlGuiWindow() , m_view( new MainView(this) ) - , m_manager(0) + , m_bookmarksProvider( new BookmarksProvider(this) ) { // accept dnd setAcceptDrops(true); @@ -111,14 +112,10 @@ MainWindow::MainWindow() statusBar()->show(); // ----- BOOKMARKS MENU: this has to be done BEFORE setupGUI!! - KUrl bookfile = KUrl( "~/.kde/share/apps/konqueror/bookmarks.xml" ); // share konqueror bookmarks - m_manager = KBookmarkManager::managerForExternalFile( bookfile.path() ); - KAction *a = new KActionMenu( i18n("B&ookmarks"), this ); actionCollection()->addAction( QLatin1String("bookmarks"), a ); - BookmarksMenu *bookmarksMenu = new BookmarksMenu( this, m_manager ); - a->setMenu( bookmarksMenu ); - + KMenu *bmMenu = m_bookmarksProvider->bookmarksMenu(); + a->setMenu( bmMenu ); // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. @@ -137,6 +134,9 @@ MainWindow::MainWindow() KToolBar *navigationBar = toolBar( "mainToolBar" ); navigationBar->addWidget( m_view->lineEditStack() ); + KToolBar *bmToolbar = toolBar("bookmarksToolBar"); + m_bookmarksProvider->provideBmToolbar( bmToolbar ); + m_searchBar = new SearchBar( this ); connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); navigationBar->addWidget(m_searchBar); -- cgit v1.2.1 From 2649aba801efdbf57f10b55a5e6c46dbd13cdbb4 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 29 Jan 2009 10:52:28 +0100 Subject: Fixed Find bar use. --- src/mainwindow.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 87ae0ac0..c7c1a47e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -551,14 +551,8 @@ void MainWindow::slotFind(const QString & search) { if (!currentTab()) return; - if (!search.isEmpty()) - { - m_lastSearch = search; - if (!currentTab()->findText(m_lastSearch)) - { - slotUpdateStatusbar( QString(m_lastSearch) + i18n(" not found.") ); - } - } + m_lastSearch = search; + slotFindNext(); } @@ -572,7 +566,10 @@ void MainWindow::slotFindNext() { if (!currentTab() && m_lastSearch.isEmpty()) return; - currentTab()->findText(m_lastSearch); + if (!currentTab()->findText(m_lastSearch, QWebPage::FindWrapsAroundDocument)) + { + slotUpdateStatusbar( QString(m_lastSearch) + i18n(" not found.") ); + } } @@ -580,7 +577,10 @@ void MainWindow::slotFindPrevious() { if (!currentTab() && m_lastSearch.isEmpty()) return; - currentTab()->findText(m_lastSearch, QWebPage::FindBackward); + if (!currentTab()->findText(m_lastSearch, QWebPage::FindBackward)) + { + slotUpdateStatusbar( QString(m_lastSearch) + i18n(" not found.") ); + } } -- cgit v1.2.1 From ba12e93de03b052ade877b0ddfaef125579e15eb Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 29 Jan 2009 11:59:45 +0100 Subject: Definitely fixed FindBar (orat least, I hope so) Add some comments --- src/mainwindow.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c7c1a47e..294bf589 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -652,17 +652,17 @@ void MainWindow::slotToggleInspector(bool enable) } -void MainWindow::slotSwapFocus() -{ - if ( currentTab()->hasFocus() ) - { - m_view->currentLineEdit()->setFocus(); - } - else - { - currentTab()->setFocus(); - } -} +// void MainWindow::slotSwapFocus() +// { +// if ( currentTab()->hasFocus() ) +// { +// m_view->currentLineEdit()->setFocus(); +// } +// else +// { +// currentTab()->setFocus(); +// } +// } MainView *MainWindow::tabWidget() const @@ -723,20 +723,20 @@ void MainWindow::slotAboutToShowBackMenu() } -void MainWindow::slotShowWindow() -{ - if (KAction *action = qobject_cast(sender())) - { - QVariant v = action->data(); - if (v.canConvert()) - { - int offset = qvariant_cast(v); - QList windows = BrowserApplication::instance()->mainWindows(); - windows.at(offset)->activateWindow(); - windows.at(offset)->currentTab()->setFocus(); - } - } -} +// void MainWindow::slotShowWindow() +// { +// if (KAction *action = qobject_cast(sender())) +// { +// QVariant v = action->data(); +// if (v.canConvert()) +// { +// int offset = qvariant_cast(v); +// QList windows = BrowserApplication::instance()->mainWindows(); +// windows.at(offset)->activateWindow(); +// windows.at(offset)->currentTab()->setFocus(); +// } +// } +// } void MainWindow::slotOpenActionUrl(QAction *action) -- cgit v1.2.1 From 0ee5dac23e4b687755c18dd68bcc47625bc59532 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 8 Feb 2009 18:53:48 +0100 Subject: Ready for 0.0.3 release. Last fixes.. --- src/mainwindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 294bf589..ecd5e452 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -73,8 +73,7 @@ MainWindow::MainWindow() // updating rekonq configuration slotUpdateConf(); -// QTimer::singleShot(0, this, SLOT( postLaunch() ) ); - + // creating a new tab m_view->newTab(); @@ -137,6 +136,10 @@ MainWindow::MainWindow() KToolBar *bmToolbar = toolBar("bookmarksToolBar"); m_bookmarksProvider->provideBmToolbar( bmToolbar ); + // setting up toolbars to NOT have context menu enabled + setContextMenuPolicy( Qt::ActionsContextMenu ); + + // search bar m_searchBar = new SearchBar( this ); connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); navigationBar->addWidget(m_searchBar); -- cgit v1.2.1 From 39ff47469cdc4a7df148368ed60470dc042f677e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 15 Feb 2009 15:44:52 +0100 Subject: {Browser,}Application. Again.. --- src/mainwindow.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ecd5e452..ee028abb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -27,7 +27,7 @@ #include "rekonq.h" // Local Includes -#include "browserapplication.h" +#include "application.h" #include "settings.h" #include "history.h" #include "cookiejar.h" @@ -319,9 +319,9 @@ void MainWindow::slotUpdateConf() defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, isJavascriptEnabled); // load Settings on main classes - BrowserApplication::networkAccessManager()->loadSettings(); - BrowserApplication::cookieJar()->loadSettings(); - BrowserApplication::historyManager()->loadSettings(); + Application::networkAccessManager()->loadSettings(); + Application::cookieJar()->loadSettings(); + Application::historyManager()->loadSettings(); } @@ -402,7 +402,7 @@ void MainWindow::slotFileSaveAs() KUrl srcUrl = currentTab()->url(); QString destPath = KFileDialog::getSaveFileName(); KUrl destUrl = KUrl(destPath); - BrowserApplication::instance()->downloadUrl( srcUrl, destUrl ); + Application::instance()->downloadUrl( srcUrl, destUrl ); } @@ -444,8 +444,8 @@ void MainWindow::slotUpdateWindowTitle(const QString &title) void MainWindow::slotFileNew() { - BrowserApplication::instance()->newMainWindow(); - MainWindow *mw = BrowserApplication::instance()->mainWindow(); + Application::instance()->newMainWindow(); + MainWindow *mw = Application::instance()->mainWindow(); mw->slotHome(); } @@ -520,7 +520,7 @@ void MainWindow::slotPrivateBrowsing() { settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); - QList windows = BrowserApplication::instance()->mainWindows(); + QList windows = Application::instance()->mainWindows(); for (int i = 0; i < windows.count(); ++i) { MainWindow *window = windows.at(i); @@ -718,7 +718,7 @@ void MainWindow::slotAboutToShowBackMenu() QWebHistoryItem item = history->backItems(history->count()).at(i); KAction *action = new KAction(this); action->setData(-1*(historyCount-i-1)); - QIcon icon = BrowserApplication::instance()->icon(item.url()); + QIcon icon = Application::instance()->icon(item.url()); action->setIcon(icon); action->setText(item.title()); m_historyBackMenu->addAction(action); @@ -734,7 +734,7 @@ void MainWindow::slotAboutToShowBackMenu() // if (v.canConvert()) // { // int offset = qvariant_cast(v); -// QList windows = BrowserApplication::instance()->mainWindows(); +// QList windows = Application::instance()->mainWindows(); // windows.at(offset)->activateWindow(); // windows.at(offset)->currentTab()->setFocus(); // } -- cgit v1.2.1 From 4150695c5fff0504cf19ad74b3f185bd67397497 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 16 Feb 2009 00:06:28 +0100 Subject: new singleton Application class. Try 1.. --- src/mainwindow.cpp | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ee028abb..91ee8028 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -74,9 +74,6 @@ MainWindow::MainWindow() // updating rekonq configuration slotUpdateConf(); - // creating a new tab - m_view->newTab(); - // creating a centralWidget containing m_view and the hidden findbar QWidget *centralWidget = new QWidget; QVBoxLayout *layout = new QVBoxLayout; @@ -444,9 +441,8 @@ void MainWindow::slotUpdateWindowTitle(const QString &title) void MainWindow::slotFileNew() { - Application::instance()->newMainWindow(); - MainWindow *mw = Application::instance()->mainWindow(); - mw->slotHome(); + Application::instance()->newTab(); + slotHome(); } @@ -520,13 +516,9 @@ void MainWindow::slotPrivateBrowsing() { settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); - QList windows = Application::instance()->mainWindows(); - for (int i = 0; i < windows.count(); ++i) - { - MainWindow *window = windows.at(i); - window->m_lastSearch = QString::null; - window->tabWidget()->clear(); - } + MainWindow* win = Application::instance()->mainWindow(); + win->m_lastSearch = QString::null; + win->tabWidget()->clear(); } } @@ -726,22 +718,6 @@ void MainWindow::slotAboutToShowBackMenu() } -// void MainWindow::slotShowWindow() -// { -// if (KAction *action = qobject_cast(sender())) -// { -// QVariant v = action->data(); -// if (v.canConvert()) -// { -// int offset = qvariant_cast(v); -// QList windows = Application::instance()->mainWindows(); -// windows.at(offset)->activateWindow(); -// windows.at(offset)->currentTab()->setFocus(); -// } -// } -// } - - void MainWindow::slotOpenActionUrl(QAction *action) { int offset = action->data().toInt(); -- cgit v1.2.1 From f168eab1529acb33d48857e29c6ddf22a626f41b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 20 Feb 2009 18:05:22 +0100 Subject: On the street to SingleRekonq.. --- src/mainwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 91ee8028..213d3a84 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -145,6 +145,8 @@ MainWindow::MainWindow() MainWindow::~MainWindow() { + delete m_view; + delete m_bookmarksProvider; } -- cgit v1.2.1 From 75310e79287a8bdffb86cc1dfda1a0f069383cd6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 20 Feb 2009 19:06:41 +0100 Subject: Last commit before branching "di brutto".. --- src/mainwindow.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 213d3a84..07b0fb9c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -65,9 +65,12 @@ MainWindow::MainWindow() : KXmlGuiWindow() - , m_view( new MainView(this) ) - , m_bookmarksProvider( new BookmarksProvider(this) ) + , m_view(0) + , m_bookmarksProvider(0) { + m_view = new MainView(this); + m_bookmarksProvider = new BookmarksProvider(this); + // accept dnd setAcceptDrops(true); -- cgit v1.2.1 From ea94738bf6c59ce254a6f177e978814019c856a4 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 1 Mar 2009 12:10:53 +0100 Subject: Fixing Font Troubles. Try 1.. --- src/mainwindow.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 07b0fb9c..5a591883 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -51,6 +51,8 @@ #include #include #include +#include + // Qt Includes #include @@ -302,12 +304,28 @@ void MainWindow::slotUpdateConf() m_homePage = ReKonfig::homePage(); // =========== Fonts ============== - QFont standardFont = ReKonfig::standardFont(); - QFont fixedFont = ReKonfig::fixedFont(); - QWebSettings *defaultSettings = QWebSettings::globalSettings(); + + QFont standardFont = ReKonfig::standardFont(); + if( !standardFont.exactMatch() ) + { + kWarning() << "Webkit Standard Font doesn't match! Setting to KDE general font.."; + standardFont = KGlobalSettings::generalFont(); + ReKonfig::setStandardFont( standardFont ); + ReKonfig::self()->writeConfig(); + } defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); + + + QFont fixedFont = ReKonfig::fixedFont(); + if( !fixedFont.exactMatch() ) + { + kWarning() << "Webkit Fixed Font doesn't match! Setting to KDE fixed font.."; + fixedFont = KGlobalSettings::fixedFont(); + ReKonfig::setFixedFont( fixedFont ); + ReKonfig::self()->writeConfig(); + } defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); -- cgit v1.2.1 From 0b8ee38c5326fa668906a3f66a959423d84f85d1 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 10 Mar 2009 23:05:09 +0100 Subject: Some fixes --- src/mainwindow.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5a591883..98ce7d99 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -151,7 +151,6 @@ MainWindow::MainWindow() MainWindow::~MainWindow() { delete m_view; - delete m_bookmarksProvider; } -- cgit v1.2.1 From 963fc785301e378096fc53648e972c57a962c0dd Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 11 Mar 2009 00:07:49 +0100 Subject: Some fixes on MainWindow --- src/mainwindow.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 98ce7d99..f28450fe 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -67,18 +67,15 @@ MainWindow::MainWindow() : KXmlGuiWindow() - , m_view(0) - , m_bookmarksProvider(0) + , m_view( new MainView(this) ) + , m_bookmarksProvider( new BookmarksProvider(this) ) { - m_view = new MainView(this); - m_bookmarksProvider = new BookmarksProvider(this); - // accept dnd setAcceptDrops(true); // updating rekonq configuration slotUpdateConf(); - + // creating a centralWidget containing m_view and the hidden findbar QWidget *centralWidget = new QWidget; QVBoxLayout *layout = new QVBoxLayout; @@ -92,6 +89,13 @@ MainWindow::MainWindow() centralWidget->setLayout(layout); setCentralWidget(centralWidget); + // setting size policies + QRect desktopRect = QApplication::desktop()->screenGeometry(); + QSize size = desktopRect.size() * 0.8; + setMinimumSize( size ); + + setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); + // connect signals and slots connect(m_view, SIGNAL( loadUrlPage(const KUrl &) ), this, SLOT( loadUrl(const KUrl &) ) ); connect(m_view, SIGNAL( setCurrentTitle(const QString &)), this, SLOT( slotUpdateWindowTitle(const QString &) ) ); @@ -139,7 +143,7 @@ MainWindow::MainWindow() m_bookmarksProvider->provideBmToolbar( bmToolbar ); // setting up toolbars to NOT have context menu enabled - setContextMenuPolicy( Qt::ActionsContextMenu ); + setContextMenuPolicy( Qt::DefaultContextMenu ); // search bar m_searchBar = new SearchBar( this ); @@ -296,7 +300,6 @@ void MainWindow::setupHistoryMenu() } -// TODO FIXME void MainWindow::slotUpdateConf() { // ============== General ================== -- cgit v1.2.1 From b5044060c9263d223c99055b9bd6b93c9fb966c7 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 11 Mar 2009 00:55:47 +0100 Subject: Forwarding class declarations to speed up compilation.. --- src/mainwindow.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f28450fe..e24f4cf7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -41,6 +41,7 @@ #include "ui_passworddialog.h" // KDE Includes +#include #include #include #include @@ -55,14 +56,9 @@ // Qt Includes -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include MainWindow::MainWindow() -- cgit v1.2.1 From 33af8415b29e428d926bb6e61f77e7faf91c4ff6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 12 Mar 2009 00:53:37 +0100 Subject: Solved initial size problem! --- src/mainwindow.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e24f4cf7..1c515218 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -86,10 +86,6 @@ MainWindow::MainWindow() setCentralWidget(centralWidget); // setting size policies - QRect desktopRect = QApplication::desktop()->screenGeometry(); - QSize size = desktopRect.size() * 0.8; - setMinimumSize( size ); - setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); // connect signals and slots @@ -154,6 +150,14 @@ MainWindow::~MainWindow() } +QSize MainWindow::sizeHint() const +{ + QRect desktopRect = QApplication::desktop()->screenGeometry(); + QSize size = desktopRect.size() * 0.8; + return size; +} + + void MainWindow::setupActions() { KAction *a; -- cgit v1.2.1 From b0f157b2546b754753ca8e22dba075af292f27f8 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 21 Mar 2009 12:14:24 +0100 Subject: Added comment --- src/mainwindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1c515218..1c475c0b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -300,11 +300,15 @@ void MainWindow::setupHistoryMenu() } +// FIXME +// check ALL variables: including alwaysShowTabbar.. + void MainWindow::slotUpdateConf() { // ============== General ================== m_homePage = ReKonfig::homePage(); + // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); -- cgit v1.2.1 From 39409ac6a2880ad815d6096231d0fcdcfd2547f6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 22 Mar 2009 10:21:09 +0100 Subject: Fixed Copyright intro --- src/mainwindow.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1c475c0b..a42b50a0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1,22 +1,23 @@ /* ============================================================ - * - * This file is a part of the rekonq project - * - * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved - * Copyright (C) 2008 by Andrea Diamantini - * - * - * This program is free software; you can redistribute it - * and/or modify it under the terms of the GNU General - * Public License as published by the Free Software Foundation; - * either version 2, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * ============================================================ */ +* +* This file is a part of the rekonq project +* +* Copyright (C) 2007-2008 Trolltech ASA. All rights reserved +* Copyright (C) 2008 by Andrea Diamantini +* +* +* This program is free software; you can redistribute it +* and/or modify it under the terms of the GNU General +* Public License as published by the Free Software Foundation; +* either version 2, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* ============================================================ */ + // Self Includes -- cgit v1.2.1 From 02fd27dbebff8cc3d11b096085968128f19a9c57 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 22 Mar 2009 12:21:07 +0100 Subject: removed margins (avaddon suggestion..) --- src/mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a42b50a0..22110c59 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -76,6 +76,7 @@ MainWindow::MainWindow() // creating a centralWidget containing m_view and the hidden findbar QWidget *centralWidget = new QWidget; QVBoxLayout *layout = new QVBoxLayout; + layout->setMargin(0); layout->addWidget(m_view); // Find Bar -- cgit v1.2.1 From aab36b488647e298857b7ec24bce0f2b143e4520 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 20 Mar 2009 00:57:19 +0100 Subject: working on fixing font problem.. --- src/mainwindow.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 22110c59..56eb6ecc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -314,28 +314,30 @@ void MainWindow::slotUpdateConf() // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); + int fnSize = ReKonfig::fontSize(); + QFont standardFont = ReKonfig::standardFont(); - if( !standardFont.exactMatch() ) - { - kWarning() << "Webkit Standard Font doesn't match! Setting to KDE general font.."; - standardFont = KGlobalSettings::generalFont(); - ReKonfig::setStandardFont( standardFont ); - ReKonfig::self()->writeConfig(); - } +// if( !standardFont.exactMatch() ) +// { +// kWarning() << "Webkit Standard Font doesn't match! Setting to KDE general font.."; +// standardFont = KGlobalSettings::generalFont(); +// ReKonfig::setStandardFont( standardFont ); +// ReKonfig::self()->writeConfig(); +// } defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); + defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); QFont fixedFont = ReKonfig::fixedFont(); - if( !fixedFont.exactMatch() ) - { - kWarning() << "Webkit Fixed Font doesn't match! Setting to KDE fixed font.."; - fixedFont = KGlobalSettings::fixedFont(); - ReKonfig::setFixedFont( fixedFont ); - ReKonfig::self()->writeConfig(); - } +// if( !fixedFont.exactMatch() ) +// { +// kWarning() << "Webkit Fixed Font doesn't match! Setting to KDE fixed font.."; +// fixedFont = KGlobalSettings::fixedFont(); +// ReKonfig::setFixedFont( fixedFont ); +// ReKonfig::self()->writeConfig(); +// } defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); + defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); // =========== Privacy ============== -- cgit v1.2.1 From 5cb207d1e190efc5ebe8d202bde35ad48c1e9212 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 24 Mar 2009 02:02:25 +0100 Subject: Some fixes on font dim. Updating data still doesn't work.. --- src/mainwindow.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 56eb6ecc..df596bdd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -317,25 +317,11 @@ void MainWindow::slotUpdateConf() int fnSize = ReKonfig::fontSize(); QFont standardFont = ReKonfig::standardFont(); -// if( !standardFont.exactMatch() ) -// { -// kWarning() << "Webkit Standard Font doesn't match! Setting to KDE general font.."; -// standardFont = KGlobalSettings::generalFont(); -// ReKonfig::setStandardFont( standardFont ); -// ReKonfig::self()->writeConfig(); -// } defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); QFont fixedFont = ReKonfig::fixedFont(); -// if( !fixedFont.exactMatch() ) -// { -// kWarning() << "Webkit Fixed Font doesn't match! Setting to KDE fixed font.."; -// fixedFont = KGlobalSettings::fixedFont(); -// ReKonfig::setFixedFont( fixedFont ); -// ReKonfig::self()->writeConfig(); -// } defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); @@ -352,6 +338,15 @@ void MainWindow::slotUpdateConf() Application::networkAccessManager()->loadSettings(); Application::cookieJar()->loadSettings(); Application::historyManager()->loadSettings(); + + // ============ Proxy ================ +} + + +void MainWindow::slotUpdateBrowser() +{ + slotUpdateConf(); + tabWidget()->reloadAllTabs(); } @@ -447,9 +442,9 @@ void MainWindow::slotPreferences() SettingsDialog *s = new SettingsDialog(this); // keep us informed when the user changes settings - connect( s, SIGNAL(settingsChanged(const QString&)), this, SLOT(slotUpdateConf()) ); + connect(s, SIGNAL(settingsChanged(const QString&)), this, SLOT(slotUpdateBrowser())); - s->show(); + s->exec(); } -- cgit v1.2.1 From 48b25611c94d380b40948a3de0bfab5678668e1d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 25 Mar 2009 00:47:24 +0100 Subject: Huge update. Fixed quite all of the settings troubles.. From now on, we (mainly) go on WebView bugfixing.. --- src/mainwindow.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index df596bdd..e286cc36 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -309,7 +309,7 @@ void MainWindow::slotUpdateConf() { // ============== General ================== m_homePage = ReKonfig::homePage(); - + mainView()->showTabBar(); // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); @@ -320,33 +320,29 @@ void MainWindow::slotUpdateConf() defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); - QFont fixedFont = ReKonfig::fixedFont(); defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); - // =========== Privacy ============== - bool arePluginsEnabled = ReKonfig::enablePlugins(); bool isJavascriptEnabled = ReKonfig::enableJavascript(); defaultSettings->setAttribute(QWebSettings::PluginsEnabled, arePluginsEnabled); defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, isJavascriptEnabled); - // load Settings on main classes + // ====== load Settings on main classes Application::networkAccessManager()->loadSettings(); Application::cookieJar()->loadSettings(); Application::historyManager()->loadSettings(); - // ============ Proxy ================ } void MainWindow::slotUpdateBrowser() { slotUpdateConf(); - tabWidget()->reloadAllTabs(); + mainView()->reloadAllTabs(); } @@ -435,7 +431,7 @@ void MainWindow::slotPreferences() { // an instance the dialog could be already created and could be cached, // in which case you want to display the cached dialog - if ( SettingsDialog::showDialog( "settings" ) ) + if ( SettingsDialog::showDialog( "rekonfig" ) ) return; // we didn't find an instance of this dialog, so lets create it @@ -546,7 +542,7 @@ void MainWindow::slotPrivateBrowsing() MainWindow* win = Application::instance()->mainWindow(); win->m_lastSearch = QString::null; - win->tabWidget()->clear(); + win->mainView()->clear(); } } @@ -688,7 +684,7 @@ void MainWindow::slotToggleInspector(bool enable) // } -MainView *MainWindow::tabWidget() const +MainView *MainWindow::mainView() const { return m_view; } -- cgit v1.2.1 From 562c5b1284a13e1ceeff7da4d2198b995c96968b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 25 Mar 2009 01:11:46 +0100 Subject: updated TODO, fixed History menu shortcut, updated Message.sh --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e286cc36..4abfcd15 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -290,7 +290,7 @@ void MainWindow::setupHistoryMenu() HistoryMenu *historyMenu = new HistoryMenu(this); connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); - historyMenu->setTitle( i18n("Hi&story") ); + historyMenu->setTitle( i18n("&History") ); menuBar()->insertMenu( actionCollection()->action("bookmarks"), historyMenu); QList historyActions; -- cgit v1.2.1 From fbd78bee04e335314337c57c679dae2dd0820dae Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 27 Mar 2009 03:36:22 +0100 Subject: improved fullscreen --- src/mainwindow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4abfcd15..54516e78 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -630,6 +630,16 @@ void MainWindow::slotViewTextSmaller() // TODO improve this void MainWindow::slotViewFullScreen( bool makeFullScreen ) { + if ( makeFullScreen == true ) + { + menuBar()->hide(); + toolBar("mainToolBar")->hide(); + } + else + { + menuBar()->show(); + toolBar("mainToolBar")->show(); + } KToggleFullScreenAction::setFullScreen( this, makeFullScreen ); } -- cgit v1.2.1 From 473540ed565ce6c2f5767e29b956aad0dadf458d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 28 Mar 2009 15:46:46 +0100 Subject: Added QNetworkDiskCache. Thanks to Ben Meyer's Qt Blog post --- src/mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 54516e78..6f12220f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -236,6 +236,7 @@ void MainWindow::setupActions() m_historyBackMenu = new KMenu(this); historyBack->setMenu(m_historyBackMenu); connect(historyBack, SIGNAL( triggered(bool) ), this, SLOT( slotOpenPrevious() ) ); +// FIXME < --------------------------------------------------------------------------------------------------------------------------------------| connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); actionCollection()->addAction( QLatin1String("history back"), historyBack); -- cgit v1.2.1 From a934072cf9695e46e793898102590322f43c0733 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 28 Mar 2009 15:53:26 +0100 Subject: astyle. First round.. --- src/mainwindow.cpp | 358 ++++++++++++++++++++++++++--------------------------- 1 file changed, 179 insertions(+), 179 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6f12220f..d76b0d8d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -63,9 +63,9 @@ MainWindow::MainWindow() - : KXmlGuiWindow() - , m_view( new MainView(this) ) - , m_bookmarksProvider( new BookmarksProvider(this) ) + : KXmlGuiWindow() + , m_view(new MainView(this)) + , m_bookmarksProvider(new BookmarksProvider(this)) { // accept dnd setAcceptDrops(true); @@ -81,26 +81,26 @@ MainWindow::MainWindow() // Find Bar m_findBar = new FindBar(this); - connect( m_findBar, SIGNAL( searchString(const QString &) ), this, SLOT( slotFind(const QString &) ) ); + connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); layout->addWidget(m_findBar); centralWidget->setLayout(layout); setCentralWidget(centralWidget); // setting size policies - setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // connect signals and slots - connect(m_view, SIGNAL( loadUrlPage(const KUrl &) ), this, SLOT( loadUrl(const KUrl &) ) ); - connect(m_view, SIGNAL( setCurrentTitle(const QString &)), this, SLOT( slotUpdateWindowTitle(const QString &) ) ); - connect(m_view, SIGNAL( showStatusBarMessage(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); - connect(m_view, SIGNAL( linkHovered(const QString&)), statusBar(), SLOT( showMessage(const QString&) ) ); - connect(m_view, SIGNAL( loadProgress(int)), this, SLOT( slotLoadProgress(int) ) ); - connect(m_view, SIGNAL( geometryChangeRequested(const QRect &)), this, SLOT( geometryChangeRequested(const QRect &) ) ); - connect(m_view, SIGNAL( printRequested(QWebFrame *)), this, SLOT( printRequested(QWebFrame *) ) ); - connect(m_view, SIGNAL( menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT( setVisible(bool) ) ); - connect(m_view, SIGNAL( statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT( setVisible(bool) ) ); - connect(m_view, SIGNAL( lastTabClosed() ), m_view, SLOT(newTab() ) ); + connect(m_view, SIGNAL(loadUrlPage(const KUrl &)), this, SLOT(loadUrl(const KUrl &))); + connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); + connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + connect(m_view, SIGNAL(linkHovered(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); + connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); + connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); + connect(m_view, SIGNAL(menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT(setVisible(bool))); + connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); + connect(m_view, SIGNAL(lastTabClosed()), m_view, SLOT(newTab())); slotUpdateWindowTitle(); @@ -111,10 +111,10 @@ MainWindow::MainWindow() statusBar()->show(); // ----- BOOKMARKS MENU: this has to be done BEFORE setupGUI!! - KAction *a = new KActionMenu( i18n("B&ookmarks"), this ); - actionCollection()->addAction( QLatin1String("bookmarks"), a ); + KAction *a = new KActionMenu(i18n("B&ookmarks"), this); + actionCollection()->addAction(QLatin1String("bookmarks"), a); KMenu *bmMenu = m_bookmarksProvider->bookmarksMenu(); - a->setMenu( bmMenu ); + a->setMenu(bmMenu); // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. @@ -130,17 +130,17 @@ MainWindow::MainWindow() setupTabBar(); // setting up custom widgets.. - KToolBar *navigationBar = toolBar( "mainToolBar" ); - navigationBar->addWidget( m_view->lineEditStack() ); + KToolBar *navigationBar = toolBar("mainToolBar"); + navigationBar->addWidget(m_view->lineEditStack()); KToolBar *bmToolbar = toolBar("bookmarksToolBar"); - m_bookmarksProvider->provideBmToolbar( bmToolbar ); + m_bookmarksProvider->provideBmToolbar(bmToolbar); // setting up toolbars to NOT have context menu enabled - setContextMenuPolicy( Qt::DefaultContextMenu ); + setContextMenuPolicy(Qt::DefaultContextMenu); // search bar - m_searchBar = new SearchBar( this ); + m_searchBar = new SearchBar(this); connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); navigationBar->addWidget(m_searchBar); } @@ -165,106 +165,106 @@ void MainWindow::setupActions() KAction *a; // Standard Actions - KStandardAction::openNew(this, SLOT( slotFileNew() ) , actionCollection() ); - KStandardAction::open( this, SLOT( slotFileOpen() ), actionCollection() ); - KStandardAction::saveAs( this, SLOT( slotFileSaveAs() ), actionCollection() ); - KStandardAction::printPreview( this, SLOT( slotFilePrintPreview() ), actionCollection() ); - KStandardAction::print( this, SLOT( slotFilePrint() ), actionCollection() ); - KStandardAction::quit( this , SLOT( close() ), actionCollection() ); - KStandardAction::find(this, SLOT( slotViewFindBar() ) , actionCollection() ); - KStandardAction::findNext(this, SLOT( slotFindNext() ) , actionCollection() ); - KStandardAction::findPrev(this, SLOT( slotFindPrevious() ) , actionCollection() ); - KStandardAction::fullScreen( this, SLOT( slotViewFullScreen(bool) ), this, actionCollection() ); - KStandardAction::home( this, SLOT( slotHome() ), actionCollection() ); - KStandardAction::preferences( this, SLOT( slotPreferences() ), actionCollection() ); + KStandardAction::openNew(this, SLOT(slotFileNew()) , actionCollection()); + KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection()); + KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection()); + KStandardAction::printPreview(this, SLOT(slotFilePrintPreview()), actionCollection()); + KStandardAction::print(this, SLOT(slotFilePrint()), actionCollection()); + KStandardAction::quit(this , SLOT(close()), actionCollection()); + KStandardAction::find(this, SLOT(slotViewFindBar()) , actionCollection()); + KStandardAction::findNext(this, SLOT(slotFindNext()) , actionCollection()); + KStandardAction::findPrev(this, SLOT(slotFindPrevious()) , actionCollection()); + KStandardAction::fullScreen(this, SLOT(slotViewFullScreen(bool)), this, actionCollection()); + KStandardAction::home(this, SLOT(slotHome()), actionCollection()); + KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection()); // WEB Actions (NO KStandardActions..) - KStandardAction::redisplay( m_view, SLOT( slotWebReload() ), actionCollection() ); - KStandardAction::back( m_view, SLOT( slotWebBack() ), actionCollection() ); - KStandardAction::forward( m_view, SLOT( slotWebForward() ), actionCollection() ); - KStandardAction::undo( m_view, SLOT( slotWebUndo() ), actionCollection() ); - KStandardAction::redo( m_view, SLOT( slotWebRedo() ), actionCollection() ); - KStandardAction::cut( m_view, SLOT( slotWebCut() ), actionCollection() ); - KStandardAction::copy( m_view, SLOT( slotWebCopy() ), actionCollection() ); - KStandardAction::paste( m_view, SLOT( slotWebPaste() ), actionCollection() ); - - a = new KAction ( KIcon( "process-stop" ), i18n("&Stop"), this ); - a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Period) ); - actionCollection()->addAction( QLatin1String("stop"), a ); - connect( a, SIGNAL( triggered(bool) ), m_view, SLOT( slotWebStop() ) ); - - // stop reload Action - m_stopReload = new KAction( KIcon("view-refresh"), i18n("reload"), this ); - actionCollection()->addAction( QLatin1String("stop reload") , m_stopReload ); - - // ============== Custom Actions - a = new KAction( KIcon(), i18n("Open Location"), this); - actionCollection()->addAction( QLatin1String("open location"), a ); - connect( a, SIGNAL( triggered(bool) ) , this, SLOT( slotOpenLocation() ) ); - - a = new KAction( i18n("Private &Browsing..."), this ); + KStandardAction::redisplay(m_view, SLOT(slotWebReload()), actionCollection()); + KStandardAction::back(m_view, SLOT(slotWebBack()), actionCollection()); + KStandardAction::forward(m_view, SLOT(slotWebForward()), actionCollection()); + KStandardAction::undo(m_view, SLOT(slotWebUndo()), actionCollection()); + KStandardAction::redo(m_view, SLOT(slotWebRedo()), actionCollection()); + KStandardAction::cut(m_view, SLOT(slotWebCut()), actionCollection()); + KStandardAction::copy(m_view, SLOT(slotWebCopy()), actionCollection()); + KStandardAction::paste(m_view, SLOT(slotWebPaste()), actionCollection()); + + a = new KAction(KIcon("process-stop"), i18n("&Stop"), this); + a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Period)); + actionCollection()->addAction(QLatin1String("stop"), a); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotWebStop())); + + // stop reload Action + m_stopReload = new KAction(KIcon("view-refresh"), i18n("reload"), this); + actionCollection()->addAction(QLatin1String("stop reload") , m_stopReload); + + // ============== Custom Actions + a = new KAction(KIcon(), i18n("Open Location"), this); + actionCollection()->addAction(QLatin1String("open location"), a); + connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); + + a = new KAction(i18n("Private &Browsing..."), this); a->setCheckable(true); - actionCollection()->addAction( i18n("private browsing"), a ); - connect( a, SIGNAL( triggered(bool) ) , this, SLOT( slotPrivateBrowsing() ) ); + actionCollection()->addAction(i18n("private browsing"), a); + connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing())); - a = new KAction( KIcon("zoom-in"), i18n("&Enlarge Font"), this ); - a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Plus) ); - actionCollection()->addAction( QLatin1String("bigger font"), a ); - connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotViewTextBigger() ) ); + a = new KAction(KIcon("zoom-in"), i18n("&Enlarge Font"), this); + a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus)); + actionCollection()->addAction(QLatin1String("bigger font"), a); + connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextBigger())); - a = new KAction( KIcon("zoom-original"), i18n("&Normal Font"), this ); - a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_0) ); - actionCollection()->addAction( QLatin1String("normal font"), a ); - connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotViewTextNormal() ) ); + a = new KAction(KIcon("zoom-original"), i18n("&Normal Font"), this); + a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0)); + actionCollection()->addAction(QLatin1String("normal font"), a); + connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextNormal())); - a = new KAction( KIcon("zoom-out"), i18n("&Shrink Font"), this ); - a->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_Minus) ); - actionCollection()->addAction( QLatin1String("smaller font"), a ); - connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotViewTextSmaller() ) ); + a = new KAction(KIcon("zoom-out"), i18n("&Shrink Font"), this); + a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus)); + actionCollection()->addAction(QLatin1String("smaller font"), a); + connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextSmaller())); - a = new KAction( i18n("Page S&ource"), this ); - actionCollection()->addAction( QLatin1String("page source"), a ); - connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotViewPageSource() ) ); + a = new KAction(i18n("Page S&ource"), this); + actionCollection()->addAction(QLatin1String("page source"), a); + connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewPageSource())); - a = new KAction( KIcon("tools-report-bug"), i18n("Enable Web &Inspector"), this ); + a = new KAction(KIcon("tools-report-bug"), i18n("Enable Web &Inspector"), this); a->setCheckable(true); - actionCollection()->addAction( QLatin1String("web inspector"), a ); - connect( a, SIGNAL( triggered(bool) ), this, SLOT( slotToggleInspector(bool) ) ); + actionCollection()->addAction(QLatin1String("web inspector"), a); + connect(a, SIGNAL(triggered(bool)), this, SLOT(slotToggleInspector(bool))); // ================ history related actions - KAction *historyBack = new KAction( KIcon("go-previous"), i18n("Back"), this); + KAction *historyBack = new KAction(KIcon("go-previous"), i18n("Back"), this); m_historyBackMenu = new KMenu(this); historyBack->setMenu(m_historyBackMenu); - connect(historyBack, SIGNAL( triggered(bool) ), this, SLOT( slotOpenPrevious() ) ); + connect(historyBack, SIGNAL(triggered(bool)), this, SLOT(slotOpenPrevious())); // FIXME < --------------------------------------------------------------------------------------------------------------------------------------| connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); - actionCollection()->addAction( QLatin1String("history back"), historyBack); + actionCollection()->addAction(QLatin1String("history back"), historyBack); - KAction *historyForward = new KAction( KIcon("go-next"), i18n("Forward"), this ); - connect(historyForward, SIGNAL( triggered(bool) ), this, SLOT( slotOpenNext() ) ); - actionCollection()->addAction( QLatin1String("history forward"), historyForward ); + KAction *historyForward = new KAction(KIcon("go-next"), i18n("Forward"), this); + connect(historyForward, SIGNAL(triggered(bool)), this, SLOT(slotOpenNext())); + actionCollection()->addAction(QLatin1String("history forward"), historyForward); // =================== Tab Actions - a = new KAction( KIcon("tab-new"), i18n("New &Tab"), this); - a->setShortcut( KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T) ); - actionCollection()->addAction( QLatin1String("new tab"), a); - connect(a, SIGNAL( triggered(bool) ), m_view, SLOT(newTab())); + a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); + a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T)); + actionCollection()->addAction(QLatin1String("new tab"), a); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab())); a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); - a->setShortcut( KShortcut( Qt::CTRL + Qt::Key_W ) ); - actionCollection()->addAction( QLatin1String("close tab"), a); - connect(a, SIGNAL( triggered(bool) ), m_view, SLOT(closeTab())); + a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_W)); + actionCollection()->addAction(QLatin1String("close tab"), a); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(closeTab())); a = new KAction(i18n("Show Next Tab"), this); - a->setShortcuts( QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext() ); - actionCollection()->addAction( QLatin1String("show next tab"), a); - connect(a, SIGNAL( triggered(bool) ), m_view, SLOT(nextTab())); + a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext()); + actionCollection()->addAction(QLatin1String("show next tab"), a); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(nextTab())); a = new KAction(i18n("Show Previous Tab"), this); - a->setShortcuts( QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev() ); - actionCollection()->addAction( QLatin1String("show prev tab"), a); - connect(a, SIGNAL( triggered(bool) ), m_view, SLOT(previousTab())); + a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); + actionCollection()->addAction(QLatin1String("show prev tab"), a); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); } @@ -272,14 +272,14 @@ void MainWindow::setupTabBar() { // Left corner button QToolButton *addTabButton = new QToolButton(this); - addTabButton->setDefaultAction( actionCollection()->action("new tab") ); + addTabButton->setDefaultAction(actionCollection()->action("new tab")); addTabButton->setAutoRaise(true); addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); m_view->setCornerWidget(addTabButton, Qt::TopLeftCorner); // right corner button QToolButton *closeTabButton = new QToolButton(this); - closeTabButton->setDefaultAction( actionCollection()->action("close tab") ); + closeTabButton->setDefaultAction(actionCollection()->action("close tab")); closeTabButton->setAutoRaise(true); closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); m_view->setCornerWidget(closeTabButton, Qt::TopRightCorner); @@ -291,13 +291,13 @@ void MainWindow::setupHistoryMenu() HistoryMenu *historyMenu = new HistoryMenu(this); connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); - historyMenu->setTitle( i18n("&History") ); - menuBar()->insertMenu( actionCollection()->action("bookmarks"), historyMenu); + historyMenu->setTitle(i18n("&History")); + menuBar()->insertMenu(actionCollection()->action("bookmarks"), historyMenu); QList historyActions; - historyActions.append( actionCollection()->action("history back") ); - historyActions.append( actionCollection()->action("history forward") ); - historyActions.append( m_view->recentlyClosedTabsAction() ); + historyActions.append(actionCollection()->action("history back")); + historyActions.append(actionCollection()->action("history forward")); + historyActions.append(m_view->recentlyClosedTabsAction()); historyMenu->setInitialActions(historyActions); } @@ -308,7 +308,7 @@ void MainWindow::setupHistoryMenu() void MainWindow::slotUpdateConf() { - // ============== General ================== + // ============== General ================== m_homePage = ReKonfig::homePage(); mainView()->showTabBar(); @@ -354,34 +354,34 @@ KUrl MainWindow::guessUrlFromString(const QString &string) // Check if it looks like a qualified URL. Try parsing it and see. bool hasSchema = test.exactMatch(urlStr); - if (hasSchema) + if (hasSchema) { QUrl qurl(urlStr, QUrl::TolerantMode); KUrl url(qurl); - if ( url.isValid() ) + if (url.isValid()) { return url; } } // Might be a file. - if (QFile::exists(urlStr)) + if (QFile::exists(urlStr)) { QFileInfo info(urlStr); - return KUrl::fromPath( info.absoluteFilePath() ); + return KUrl::fromPath(info.absoluteFilePath()); } // Might be a shorturl - try to detect the schema. - if (!hasSchema) + if (!hasSchema) { int dotIndex = urlStr.indexOf(QLatin1Char('.')); - if (dotIndex != -1) + if (dotIndex != -1) { QString prefix = urlStr.left(dotIndex).toLower(); QString schema = (prefix == QLatin1String("ftp")) ? prefix : QLatin1String("http"); QUrl qurl(schema + QLatin1String("://") + urlStr, QUrl::TolerantMode); KUrl url(qurl); - if ( url.isValid() ) + if (url.isValid()) { return url; } @@ -393,7 +393,7 @@ KUrl MainWindow::guessUrlFromString(const QString &string) KUrl url(qurl); // finally for cases where the user just types in a hostname add http - if ( qurl.scheme().isEmpty() ) + if (qurl.scheme().isEmpty()) { qurl = QUrl(QLatin1String("http://") + string, QUrl::TolerantMode); url = KUrl(qurl); @@ -407,7 +407,7 @@ void MainWindow::loadUrl(const KUrl &url) if (!currentTab() || url.isEmpty()) return; - m_view->currentLineEdit()->setText( url.prettyUrl() ); + m_view->currentLineEdit()->setText(url.prettyUrl()); m_view->loadUrlInCurrentTab(url); } @@ -424,7 +424,7 @@ void MainWindow::slotFileSaveAs() KUrl srcUrl = currentTab()->url(); QString destPath = KFileDialog::getSaveFileName(); KUrl destUrl = KUrl(destPath); - Application::instance()->downloadUrl( srcUrl, destUrl ); + Application::instance()->downloadUrl(srcUrl, destUrl); } @@ -432,7 +432,7 @@ void MainWindow::slotPreferences() { // an instance the dialog could be already created and could be cached, // in which case you want to display the cached dialog - if ( SettingsDialog::showDialog( "rekonfig" ) ) + if (SettingsDialog::showDialog("rekonfig")) return; // we didn't find an instance of this dialog, so lets create it @@ -453,11 +453,11 @@ void MainWindow::slotUpdateStatusbar(const QString &string) void MainWindow::slotUpdateWindowTitle(const QString &title) { - if (title.isEmpty()) + if (title.isEmpty()) { setWindowTitle("rekonq"); - } - else + } + else { setWindowTitle(title + " - rekonq"); } @@ -473,16 +473,16 @@ void MainWindow::slotFileNew() void MainWindow::slotFileOpen() { - QString filePath = KFileDialog::getOpenFileName( KUrl(), - i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)"), - this, - i18n("Open Web Resource") + QString filePath = KFileDialog::getOpenFileName(KUrl(), + i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)"), + this, + i18n("Open Web Resource") ); if (filePath.isEmpty()) return; - loadUrl( guessUrlFromString(filePath) ); + loadUrl(guessUrlFromString(filePath)); } @@ -508,8 +508,8 @@ void MainWindow::printRequested(QWebFrame *frame) { QPrinter printer; QPrintDialog *dialog = new QPrintDialog(&printer, this); - dialog->setWindowTitle( i18n("Print Document") ); - if (dialog->exec() != QDialog::Accepted ) + dialog->setWindowTitle(i18n("Print Document")); + if (dialog->exec() != QDialog::Accepted) return; frame->print(&printer); } @@ -519,25 +519,25 @@ void MainWindow::slotPrivateBrowsing() { QWebSettings *settings = QWebSettings::globalSettings(); bool pb = settings->testAttribute(QWebSettings::PrivateBrowsingEnabled); - if (!pb) + if (!pb) { QString title = i18n("Are you sure you want to turn on private browsing?"); QString text = "" + title + i18n("

When private browsing in turned on," - " webpages are not added to the history," - " items are automatically removed from the Downloads window," \ - " new cookies are not stored, current cookies can't be accessed," \ - " site icons wont be stored, session wont be saved, " \ - " and searches are not addded to the pop-up menu in the Google search box." \ - " Until you close the window, you can still click the Back and Forward buttons" \ - " to return to the webpages you have opened."); - - int button = KMessageBox::questionYesNo( this, text, title ); - if (button == KMessageBox::Ok) + " webpages are not added to the history," + " items are automatically removed from the Downloads window," \ + " new cookies are not stored, current cookies can't be accessed," \ + " site icons wont be stored, session wont be saved, " \ + " and searches are not addded to the pop-up menu in the Google search box." \ + " Until you close the window, you can still click the Back and Forward buttons" \ + " to return to the webpages you have opened."); + + int button = KMessageBox::questionYesNo(this, text, title); + if (button == KMessageBox::Ok) { settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); } - } - else + } + else { settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); @@ -550,13 +550,13 @@ void MainWindow::slotPrivateBrowsing() // void MainWindow::closeEvent(QCloseEvent *event) // { -// if (m_view->count() > 1) +// if (m_view->count() > 1) // { -// int ret = KMessageBox::warningYesNo(this, +// int ret = KMessageBox::warningYesNo(this, // i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_view->count() ), -// i18n("Closing") +// i18n("Closing") // ); -// if (ret == KMessageBox::No) +// if (ret == KMessageBox::No) // { // event->ignore(); // return; @@ -588,7 +588,7 @@ void MainWindow::slotFindNext() return; if (!currentTab()->findText(m_lastSearch, QWebPage::FindWrapsAroundDocument)) { - slotUpdateStatusbar( QString(m_lastSearch) + i18n(" not found.") ); + slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found.")); } } @@ -599,7 +599,7 @@ void MainWindow::slotFindPrevious() return; if (!currentTab()->findText(m_lastSearch, QWebPage::FindBackward)) { - slotUpdateStatusbar( QString(m_lastSearch) + i18n(" not found.") ); + slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found.")); } } @@ -629,9 +629,9 @@ void MainWindow::slotViewTextSmaller() // TODO improve this -void MainWindow::slotViewFullScreen( bool makeFullScreen ) +void MainWindow::slotViewFullScreen(bool makeFullScreen) { - if ( makeFullScreen == true ) + if (makeFullScreen == true) { menuBar()->hide(); toolBar("mainToolBar")->hide(); @@ -641,7 +641,7 @@ void MainWindow::slotViewFullScreen( bool makeFullScreen ) menuBar()->show(); toolBar("mainToolBar")->show(); } - KToggleFullScreenAction::setFullScreen( this, makeFullScreen ); + KToggleFullScreenAction::setFullScreen(this, makeFullScreen); } @@ -652,7 +652,7 @@ void MainWindow::slotViewPageSource() QString markup = currentTab()->page()->mainFrame()->toHtml(); QPlainTextEdit *view = new QPlainTextEdit(markup); - view->setWindowTitle( i18n("Page Source of ") + currentTab()->title() ); + view->setWindowTitle(i18n("Page Source of ") + currentTab()->title()); view->setMinimumWidth(640); view->setAttribute(Qt::WA_DeleteOnClose); view->show(); @@ -661,20 +661,20 @@ void MainWindow::slotViewPageSource() void MainWindow::slotHome() { - loadUrl( KUrl(m_homePage) ); + loadUrl(KUrl(m_homePage)); } void MainWindow::slotToggleInspector(bool enable) { QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, enable); - if (enable) + if (enable) { - int result = KMessageBox::questionYesNo(this, - i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" - "Do you want to reload all pages?"), - i18n("Web Inspector") ); - if (result == KMessageBox::Yes) + int result = KMessageBox::questionYesNo(this, + i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" + "Do you want to reload all pages?"), + i18n("Web Inspector")); + if (result == KMessageBox::Yes) { m_view->reloadAllTabs(); } @@ -711,23 +711,23 @@ WebView *MainWindow::currentTab() const // FIXME: this actually doesn't work properly.. void MainWindow::slotLoadProgress(int progress) { - QAction *stop = actionCollection()->action( "stop" ); - QAction *reload = actionCollection()->action( "view_redisplay" ); - if (progress < 100 && progress > 0) + QAction *stop = actionCollection()->action("stop"); + QAction *reload = actionCollection()->action("view_redisplay"); + if (progress < 100 && progress > 0) { - disconnect( m_stopReload, SIGNAL( triggered( bool ) ), reload , SIGNAL( triggered(bool) ) ); - m_stopReload->setIcon( KIcon( "process-stop" ) ); - m_stopReload->setToolTip( i18n("Stop loading the current page") ); - m_stopReload->setText( i18n("Stop") ); - connect(m_stopReload, SIGNAL( triggered(bool ) ), stop, SIGNAL( triggered(bool) ) ); - } - else + disconnect(m_stopReload, SIGNAL(triggered(bool)), reload , SIGNAL(triggered(bool))); + m_stopReload->setIcon(KIcon("process-stop")); + m_stopReload->setToolTip(i18n("Stop loading the current page")); + m_stopReload->setText(i18n("Stop")); + connect(m_stopReload, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); + } + else { - disconnect( m_stopReload, SIGNAL( triggered( bool ) ), stop , SIGNAL( triggered(bool ) ) ); - m_stopReload->setIcon( KIcon( "view-refresh" ) ); - m_stopReload->setToolTip( i18n("Reload the current page") ); - m_stopReload->setText( i18n("Reload") ); - connect(m_stopReload, SIGNAL( triggered( bool ) ), reload, SIGNAL( triggered(bool) ) ); + disconnect(m_stopReload, SIGNAL(triggered(bool)), stop , SIGNAL(triggered(bool))); + m_stopReload->setIcon(KIcon("view-refresh")); + m_stopReload->setToolTip(i18n("Reload the current page")); + m_stopReload->setText(i18n("Reload")); + connect(m_stopReload, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool))); } } @@ -740,11 +740,11 @@ void MainWindow::slotAboutToShowBackMenu() return; QWebHistory *history = currentTab()->history(); int historyCount = history->count(); - for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) + for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) { QWebHistoryItem item = history->backItems(history->count()).at(i); KAction *action = new KAction(this); - action->setData(-1*(historyCount-i-1)); + action->setData(-1*(historyCount - i - 1)); QIcon icon = Application::instance()->icon(item.url()); action->setIcon(icon); action->setText(item.title()); @@ -761,7 +761,7 @@ void MainWindow::slotOpenActionUrl(QAction *action) { history->goToItem(history->backItems(-1*offset).first()); // back } - else + else { if (offset > 0) { @@ -774,16 +774,16 @@ void MainWindow::slotOpenActionUrl(QAction *action) void MainWindow::slotOpenPrevious() { QWebHistory *history = currentTab()->history(); - if ( history->canGoBack() ) - history->goToItem( history->backItem() ); + if (history->canGoBack()) + history->goToItem(history->backItem()); } void MainWindow::slotOpenNext() { QWebHistory *history = currentTab()->history(); - if ( history->canGoForward() ) - history->goToItem( history->forwardItem() ); + if (history->canGoForward()) + history->goToItem(history->forwardItem()); } -- cgit v1.2.1 From 651f97d0652e90ab1af4e80418f42468cc5932e2 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 28 Mar 2009 23:46:38 +0100 Subject: pedantic --- src/mainwindow.cpp | 90 ++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 46 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d76b0d8d..5dd8663e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -76,7 +76,7 @@ MainWindow::MainWindow() // creating a centralWidget containing m_view and the hidden findbar QWidget *centralWidget = new QWidget; QVBoxLayout *layout = new QVBoxLayout; - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_view); // Find Bar @@ -102,6 +102,9 @@ MainWindow::MainWindow() connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); connect(m_view, SIGNAL(lastTabClosed()), m_view, SLOT(newTab())); + connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); + connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); + slotUpdateWindowTitle(); // then, setup our actions @@ -194,76 +197,76 @@ void MainWindow::setupActions() connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotWebStop())); // stop reload Action - m_stopReload = new KAction(KIcon("view-refresh"), i18n("reload"), this); - actionCollection()->addAction(QLatin1String("stop reload") , m_stopReload); + m_stopReloadAction = new KAction(KIcon("view-refresh"), i18n("reload"), this); + actionCollection()->addAction(QLatin1String("stop_reload") , m_stopReloadAction); + m_stopReloadAction->setShortcutConfigurable(false); // ============== Custom Actions a = new KAction(KIcon(), i18n("Open Location"), this); - actionCollection()->addAction(QLatin1String("open location"), a); + actionCollection()->addAction(QLatin1String("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); a = new KAction(i18n("Private &Browsing..."), this); a->setCheckable(true); - actionCollection()->addAction(i18n("private browsing"), a); + actionCollection()->addAction(i18n("private_browsing"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing())); a = new KAction(KIcon("zoom-in"), i18n("&Enlarge Font"), this); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus)); - actionCollection()->addAction(QLatin1String("bigger font"), a); + actionCollection()->addAction(QLatin1String("bigger_font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextBigger())); a = new KAction(KIcon("zoom-original"), i18n("&Normal Font"), this); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0)); - actionCollection()->addAction(QLatin1String("normal font"), a); + actionCollection()->addAction(QLatin1String("normal_font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextNormal())); a = new KAction(KIcon("zoom-out"), i18n("&Shrink Font"), this); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus)); - actionCollection()->addAction(QLatin1String("smaller font"), a); + actionCollection()->addAction(QLatin1String("smaller_font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextSmaller())); a = new KAction(i18n("Page S&ource"), this); - actionCollection()->addAction(QLatin1String("page source"), a); + actionCollection()->addAction(QLatin1String("page_source"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewPageSource())); a = new KAction(KIcon("tools-report-bug"), i18n("Enable Web &Inspector"), this); a->setCheckable(true); - actionCollection()->addAction(QLatin1String("web inspector"), a); + actionCollection()->addAction(QLatin1String("web_inspector"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotToggleInspector(bool))); // ================ history related actions - KAction *historyBack = new KAction(KIcon("go-previous"), i18n("Back"), this); + m_historyBackAction = new KAction(KIcon("go-previous"), i18n("Back"), this); m_historyBackMenu = new KMenu(this); - historyBack->setMenu(m_historyBackMenu); - connect(historyBack, SIGNAL(triggered(bool)), this, SLOT(slotOpenPrevious())); -// FIXME < --------------------------------------------------------------------------------------------------------------------------------------| + m_historyBackAction->setMenu(m_historyBackMenu); + connect(m_historyBackAction, SIGNAL(triggered(bool)), this, SLOT(slotOpenPrevious())); connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); - actionCollection()->addAction(QLatin1String("history back"), historyBack); + actionCollection()->addAction(QLatin1String("history_back"), m_historyBackAction); - KAction *historyForward = new KAction(KIcon("go-next"), i18n("Forward"), this); - connect(historyForward, SIGNAL(triggered(bool)), this, SLOT(slotOpenNext())); - actionCollection()->addAction(QLatin1String("history forward"), historyForward); + m_historyForwardAction = new KAction(KIcon("go-next"), i18n("Forward"), this); + connect(m_historyForwardAction, SIGNAL(triggered(bool)), this, SLOT(slotOpenNext())); + actionCollection()->addAction(QLatin1String("history_forward"), m_historyForwardAction); // =================== Tab Actions a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T)); - actionCollection()->addAction(QLatin1String("new tab"), a); + actionCollection()->addAction(QLatin1String("new_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab())); a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_W)); - actionCollection()->addAction(QLatin1String("close tab"), a); + actionCollection()->addAction(QLatin1String("close_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(closeTab())); a = new KAction(i18n("Show Next Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext()); - actionCollection()->addAction(QLatin1String("show next tab"), a); + actionCollection()->addAction(QLatin1String("show_next_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(nextTab())); a = new KAction(i18n("Show Previous Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); - actionCollection()->addAction(QLatin1String("show prev tab"), a); + actionCollection()->addAction(QLatin1String("show_prev_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); } @@ -272,14 +275,14 @@ void MainWindow::setupTabBar() { // Left corner button QToolButton *addTabButton = new QToolButton(this); - addTabButton->setDefaultAction(actionCollection()->action("new tab")); + addTabButton->setDefaultAction(actionCollection()->action("new_tab")); addTabButton->setAutoRaise(true); addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); m_view->setCornerWidget(addTabButton, Qt::TopLeftCorner); // right corner button QToolButton *closeTabButton = new QToolButton(this); - closeTabButton->setDefaultAction(actionCollection()->action("close tab")); + closeTabButton->setDefaultAction(actionCollection()->action("close_tab")); closeTabButton->setAutoRaise(true); closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); m_view->setCornerWidget(closeTabButton, Qt::TopRightCorner); @@ -293,19 +296,9 @@ void MainWindow::setupHistoryMenu() connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); menuBar()->insertMenu(actionCollection()->action("bookmarks"), historyMenu); - QList historyActions; - - historyActions.append(actionCollection()->action("history back")); - historyActions.append(actionCollection()->action("history forward")); - historyActions.append(m_view->recentlyClosedTabsAction()); - - historyMenu->setInitialActions(historyActions); } -// FIXME -// check ALL variables: including alwaysShowTabbar.. - void MainWindow::slotUpdateConf() { // ============== General ================== @@ -451,6 +444,13 @@ void MainWindow::slotUpdateStatusbar(const QString &string) } +void MainWindow::slotUpdateActions() +{ + m_historyBackAction->setEnabled(currentTab()->history()->canGoBack()); + m_historyForwardAction->setEnabled(currentTab()->history()->canGoForward()); +} + + void MainWindow::slotUpdateWindowTitle(const QString &title) { if (title.isEmpty()) @@ -628,7 +628,6 @@ void MainWindow::slotViewTextSmaller() } -// TODO improve this void MainWindow::slotViewFullScreen(bool makeFullScreen) { if (makeFullScreen == true) @@ -708,26 +707,25 @@ WebView *MainWindow::currentTab() const } -// FIXME: this actually doesn't work properly.. void MainWindow::slotLoadProgress(int progress) { QAction *stop = actionCollection()->action("stop"); QAction *reload = actionCollection()->action("view_redisplay"); if (progress < 100 && progress > 0) { - disconnect(m_stopReload, SIGNAL(triggered(bool)), reload , SIGNAL(triggered(bool))); - m_stopReload->setIcon(KIcon("process-stop")); - m_stopReload->setToolTip(i18n("Stop loading the current page")); - m_stopReload->setText(i18n("Stop")); - connect(m_stopReload, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); + disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), reload , SIGNAL(triggered(bool))); + m_stopReloadAction->setIcon(KIcon("process-stop")); + m_stopReloadAction->setToolTip(i18n("Stop loading the current page")); + m_stopReloadAction->setText(i18n("Stop")); + connect(m_stopReloadAction, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); } else { - disconnect(m_stopReload, SIGNAL(triggered(bool)), stop , SIGNAL(triggered(bool))); - m_stopReload->setIcon(KIcon("view-refresh")); - m_stopReload->setToolTip(i18n("Reload the current page")); - m_stopReload->setText(i18n("Reload")); - connect(m_stopReload, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool))); + disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), stop , SIGNAL(triggered(bool))); + m_stopReloadAction->setIcon(KIcon("view-refresh")); + m_stopReloadAction->setToolTip(i18n("Reload the current page")); + m_stopReloadAction->setText(i18n("Reload")); + connect(m_stopReloadAction, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool))); } } -- cgit v1.2.1 From 98f53721514116b876d18bf0a2da89d2a53cc97d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 29 Mar 2009 00:05:45 +0100 Subject: Revert "pedantic" Too much things committed a time.. This reverts commit 651f97d0652e90ab1af4e80418f42468cc5932e2. --- src/mainwindow.cpp | 90 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 44 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5dd8663e..d76b0d8d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -76,7 +76,7 @@ MainWindow::MainWindow() // creating a centralWidget containing m_view and the hidden findbar QWidget *centralWidget = new QWidget; QVBoxLayout *layout = new QVBoxLayout; - layout->setContentsMargins(0, 0, 0, 0); + layout->setMargin(0); layout->addWidget(m_view); // Find Bar @@ -102,9 +102,6 @@ MainWindow::MainWindow() connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); connect(m_view, SIGNAL(lastTabClosed()), m_view, SLOT(newTab())); - connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); - connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); - slotUpdateWindowTitle(); // then, setup our actions @@ -197,76 +194,76 @@ void MainWindow::setupActions() connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotWebStop())); // stop reload Action - m_stopReloadAction = new KAction(KIcon("view-refresh"), i18n("reload"), this); - actionCollection()->addAction(QLatin1String("stop_reload") , m_stopReloadAction); - m_stopReloadAction->setShortcutConfigurable(false); + m_stopReload = new KAction(KIcon("view-refresh"), i18n("reload"), this); + actionCollection()->addAction(QLatin1String("stop reload") , m_stopReload); // ============== Custom Actions a = new KAction(KIcon(), i18n("Open Location"), this); - actionCollection()->addAction(QLatin1String("open_location"), a); + actionCollection()->addAction(QLatin1String("open location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); a = new KAction(i18n("Private &Browsing..."), this); a->setCheckable(true); - actionCollection()->addAction(i18n("private_browsing"), a); + actionCollection()->addAction(i18n("private browsing"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing())); a = new KAction(KIcon("zoom-in"), i18n("&Enlarge Font"), this); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus)); - actionCollection()->addAction(QLatin1String("bigger_font"), a); + actionCollection()->addAction(QLatin1String("bigger font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextBigger())); a = new KAction(KIcon("zoom-original"), i18n("&Normal Font"), this); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0)); - actionCollection()->addAction(QLatin1String("normal_font"), a); + actionCollection()->addAction(QLatin1String("normal font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextNormal())); a = new KAction(KIcon("zoom-out"), i18n("&Shrink Font"), this); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus)); - actionCollection()->addAction(QLatin1String("smaller_font"), a); + actionCollection()->addAction(QLatin1String("smaller font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextSmaller())); a = new KAction(i18n("Page S&ource"), this); - actionCollection()->addAction(QLatin1String("page_source"), a); + actionCollection()->addAction(QLatin1String("page source"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewPageSource())); a = new KAction(KIcon("tools-report-bug"), i18n("Enable Web &Inspector"), this); a->setCheckable(true); - actionCollection()->addAction(QLatin1String("web_inspector"), a); + actionCollection()->addAction(QLatin1String("web inspector"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotToggleInspector(bool))); // ================ history related actions - m_historyBackAction = new KAction(KIcon("go-previous"), i18n("Back"), this); + KAction *historyBack = new KAction(KIcon("go-previous"), i18n("Back"), this); m_historyBackMenu = new KMenu(this); - m_historyBackAction->setMenu(m_historyBackMenu); - connect(m_historyBackAction, SIGNAL(triggered(bool)), this, SLOT(slotOpenPrevious())); + historyBack->setMenu(m_historyBackMenu); + connect(historyBack, SIGNAL(triggered(bool)), this, SLOT(slotOpenPrevious())); +// FIXME < --------------------------------------------------------------------------------------------------------------------------------------| connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); - actionCollection()->addAction(QLatin1String("history_back"), m_historyBackAction); + actionCollection()->addAction(QLatin1String("history back"), historyBack); - m_historyForwardAction = new KAction(KIcon("go-next"), i18n("Forward"), this); - connect(m_historyForwardAction, SIGNAL(triggered(bool)), this, SLOT(slotOpenNext())); - actionCollection()->addAction(QLatin1String("history_forward"), m_historyForwardAction); + KAction *historyForward = new KAction(KIcon("go-next"), i18n("Forward"), this); + connect(historyForward, SIGNAL(triggered(bool)), this, SLOT(slotOpenNext())); + actionCollection()->addAction(QLatin1String("history forward"), historyForward); // =================== Tab Actions a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T)); - actionCollection()->addAction(QLatin1String("new_tab"), a); + actionCollection()->addAction(QLatin1String("new tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab())); a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_W)); - actionCollection()->addAction(QLatin1String("close_tab"), a); + actionCollection()->addAction(QLatin1String("close tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(closeTab())); a = new KAction(i18n("Show Next Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext()); - actionCollection()->addAction(QLatin1String("show_next_tab"), a); + actionCollection()->addAction(QLatin1String("show next tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(nextTab())); a = new KAction(i18n("Show Previous Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); - actionCollection()->addAction(QLatin1String("show_prev_tab"), a); + actionCollection()->addAction(QLatin1String("show prev tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); } @@ -275,14 +272,14 @@ void MainWindow::setupTabBar() { // Left corner button QToolButton *addTabButton = new QToolButton(this); - addTabButton->setDefaultAction(actionCollection()->action("new_tab")); + addTabButton->setDefaultAction(actionCollection()->action("new tab")); addTabButton->setAutoRaise(true); addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); m_view->setCornerWidget(addTabButton, Qt::TopLeftCorner); // right corner button QToolButton *closeTabButton = new QToolButton(this); - closeTabButton->setDefaultAction(actionCollection()->action("close_tab")); + closeTabButton->setDefaultAction(actionCollection()->action("close tab")); closeTabButton->setAutoRaise(true); closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); m_view->setCornerWidget(closeTabButton, Qt::TopRightCorner); @@ -296,9 +293,19 @@ void MainWindow::setupHistoryMenu() connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); menuBar()->insertMenu(actionCollection()->action("bookmarks"), historyMenu); + QList historyActions; + + historyActions.append(actionCollection()->action("history back")); + historyActions.append(actionCollection()->action("history forward")); + historyActions.append(m_view->recentlyClosedTabsAction()); + + historyMenu->setInitialActions(historyActions); } +// FIXME +// check ALL variables: including alwaysShowTabbar.. + void MainWindow::slotUpdateConf() { // ============== General ================== @@ -444,13 +451,6 @@ void MainWindow::slotUpdateStatusbar(const QString &string) } -void MainWindow::slotUpdateActions() -{ - m_historyBackAction->setEnabled(currentTab()->history()->canGoBack()); - m_historyForwardAction->setEnabled(currentTab()->history()->canGoForward()); -} - - void MainWindow::slotUpdateWindowTitle(const QString &title) { if (title.isEmpty()) @@ -628,6 +628,7 @@ void MainWindow::slotViewTextSmaller() } +// TODO improve this void MainWindow::slotViewFullScreen(bool makeFullScreen) { if (makeFullScreen == true) @@ -707,25 +708,26 @@ WebView *MainWindow::currentTab() const } +// FIXME: this actually doesn't work properly.. void MainWindow::slotLoadProgress(int progress) { QAction *stop = actionCollection()->action("stop"); QAction *reload = actionCollection()->action("view_redisplay"); if (progress < 100 && progress > 0) { - disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), reload , SIGNAL(triggered(bool))); - m_stopReloadAction->setIcon(KIcon("process-stop")); - m_stopReloadAction->setToolTip(i18n("Stop loading the current page")); - m_stopReloadAction->setText(i18n("Stop")); - connect(m_stopReloadAction, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); + disconnect(m_stopReload, SIGNAL(triggered(bool)), reload , SIGNAL(triggered(bool))); + m_stopReload->setIcon(KIcon("process-stop")); + m_stopReload->setToolTip(i18n("Stop loading the current page")); + m_stopReload->setText(i18n("Stop")); + connect(m_stopReload, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); } else { - disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), stop , SIGNAL(triggered(bool))); - m_stopReloadAction->setIcon(KIcon("view-refresh")); - m_stopReloadAction->setToolTip(i18n("Reload the current page")); - m_stopReloadAction->setText(i18n("Reload")); - connect(m_stopReloadAction, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool))); + disconnect(m_stopReload, SIGNAL(triggered(bool)), stop , SIGNAL(triggered(bool))); + m_stopReload->setIcon(KIcon("view-refresh")); + m_stopReload->setToolTip(i18n("Reload the current page")); + m_stopReload->setText(i18n("Reload")); + connect(m_stopReload, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool))); } } -- cgit v1.2.1 From 94d9bd4c079961c88a57cfc89a3771308823de2b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 29 Mar 2009 00:10:49 +0100 Subject: merged some parts of pawel clone. In previous commit.. --- src/mainwindow.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5dd8663e..ed347bef 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -19,7 +19,6 @@ * ============================================================ */ - // Self Includes #include "mainwindow.h" #include "mainwindow.moc" -- cgit v1.2.1 From 08deb6b161ef0cdda7ed8e49870b16f41d78eb4e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 29 Mar 2009 00:13:01 +0100 Subject: Revert "Revert "pedantic"" Reapplied previous changes. Sorry for confusion. Time to bed.. This reverts commit 98f53721514116b876d18bf0a2da89d2a53cc97d. --- src/mainwindow.cpp | 90 ++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 46 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3f252ca2..ed347bef 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -75,7 +75,7 @@ MainWindow::MainWindow() // creating a centralWidget containing m_view and the hidden findbar QWidget *centralWidget = new QWidget; QVBoxLayout *layout = new QVBoxLayout; - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_view); // Find Bar @@ -101,6 +101,9 @@ MainWindow::MainWindow() connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); connect(m_view, SIGNAL(lastTabClosed()), m_view, SLOT(newTab())); + connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); + connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); + slotUpdateWindowTitle(); // then, setup our actions @@ -193,76 +196,76 @@ void MainWindow::setupActions() connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotWebStop())); // stop reload Action - m_stopReload = new KAction(KIcon("view-refresh"), i18n("reload"), this); - actionCollection()->addAction(QLatin1String("stop reload") , m_stopReload); + m_stopReloadAction = new KAction(KIcon("view-refresh"), i18n("reload"), this); + actionCollection()->addAction(QLatin1String("stop_reload") , m_stopReloadAction); + m_stopReloadAction->setShortcutConfigurable(false); // ============== Custom Actions a = new KAction(KIcon(), i18n("Open Location"), this); - actionCollection()->addAction(QLatin1String("open location"), a); + actionCollection()->addAction(QLatin1String("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); a = new KAction(i18n("Private &Browsing..."), this); a->setCheckable(true); - actionCollection()->addAction(i18n("private browsing"), a); + actionCollection()->addAction(i18n("private_browsing"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing())); a = new KAction(KIcon("zoom-in"), i18n("&Enlarge Font"), this); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus)); - actionCollection()->addAction(QLatin1String("bigger font"), a); + actionCollection()->addAction(QLatin1String("bigger_font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextBigger())); a = new KAction(KIcon("zoom-original"), i18n("&Normal Font"), this); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0)); - actionCollection()->addAction(QLatin1String("normal font"), a); + actionCollection()->addAction(QLatin1String("normal_font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextNormal())); a = new KAction(KIcon("zoom-out"), i18n("&Shrink Font"), this); a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus)); - actionCollection()->addAction(QLatin1String("smaller font"), a); + actionCollection()->addAction(QLatin1String("smaller_font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextSmaller())); a = new KAction(i18n("Page S&ource"), this); - actionCollection()->addAction(QLatin1String("page source"), a); + actionCollection()->addAction(QLatin1String("page_source"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewPageSource())); a = new KAction(KIcon("tools-report-bug"), i18n("Enable Web &Inspector"), this); a->setCheckable(true); - actionCollection()->addAction(QLatin1String("web inspector"), a); + actionCollection()->addAction(QLatin1String("web_inspector"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotToggleInspector(bool))); // ================ history related actions - KAction *historyBack = new KAction(KIcon("go-previous"), i18n("Back"), this); + m_historyBackAction = new KAction(KIcon("go-previous"), i18n("Back"), this); m_historyBackMenu = new KMenu(this); - historyBack->setMenu(m_historyBackMenu); - connect(historyBack, SIGNAL(triggered(bool)), this, SLOT(slotOpenPrevious())); -// FIXME < --------------------------------------------------------------------------------------------------------------------------------------| + m_historyBackAction->setMenu(m_historyBackMenu); + connect(m_historyBackAction, SIGNAL(triggered(bool)), this, SLOT(slotOpenPrevious())); connect(m_historyBackMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowBackMenu())); connect(m_historyBackMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenActionUrl(QAction *))); - actionCollection()->addAction(QLatin1String("history back"), historyBack); + actionCollection()->addAction(QLatin1String("history_back"), m_historyBackAction); - KAction *historyForward = new KAction(KIcon("go-next"), i18n("Forward"), this); - connect(historyForward, SIGNAL(triggered(bool)), this, SLOT(slotOpenNext())); - actionCollection()->addAction(QLatin1String("history forward"), historyForward); + m_historyForwardAction = new KAction(KIcon("go-next"), i18n("Forward"), this); + connect(m_historyForwardAction, SIGNAL(triggered(bool)), this, SLOT(slotOpenNext())); + actionCollection()->addAction(QLatin1String("history_forward"), m_historyForwardAction); // =================== Tab Actions a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T)); - actionCollection()->addAction(QLatin1String("new tab"), a); + actionCollection()->addAction(QLatin1String("new_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab())); a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_W)); - actionCollection()->addAction(QLatin1String("close tab"), a); + actionCollection()->addAction(QLatin1String("close_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(closeTab())); a = new KAction(i18n("Show Next Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext()); - actionCollection()->addAction(QLatin1String("show next tab"), a); + actionCollection()->addAction(QLatin1String("show_next_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(nextTab())); a = new KAction(i18n("Show Previous Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); - actionCollection()->addAction(QLatin1String("show prev tab"), a); + actionCollection()->addAction(QLatin1String("show_prev_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); } @@ -271,14 +274,14 @@ void MainWindow::setupTabBar() { // Left corner button QToolButton *addTabButton = new QToolButton(this); - addTabButton->setDefaultAction(actionCollection()->action("new tab")); + addTabButton->setDefaultAction(actionCollection()->action("new_tab")); addTabButton->setAutoRaise(true); addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); m_view->setCornerWidget(addTabButton, Qt::TopLeftCorner); // right corner button QToolButton *closeTabButton = new QToolButton(this); - closeTabButton->setDefaultAction(actionCollection()->action("close tab")); + closeTabButton->setDefaultAction(actionCollection()->action("close_tab")); closeTabButton->setAutoRaise(true); closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); m_view->setCornerWidget(closeTabButton, Qt::TopRightCorner); @@ -292,19 +295,9 @@ void MainWindow::setupHistoryMenu() connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); menuBar()->insertMenu(actionCollection()->action("bookmarks"), historyMenu); - QList historyActions; - - historyActions.append(actionCollection()->action("history back")); - historyActions.append(actionCollection()->action("history forward")); - historyActions.append(m_view->recentlyClosedTabsAction()); - - historyMenu->setInitialActions(historyActions); } -// FIXME -// check ALL variables: including alwaysShowTabbar.. - void MainWindow::slotUpdateConf() { // ============== General ================== @@ -450,6 +443,13 @@ void MainWindow::slotUpdateStatusbar(const QString &string) } +void MainWindow::slotUpdateActions() +{ + m_historyBackAction->setEnabled(currentTab()->history()->canGoBack()); + m_historyForwardAction->setEnabled(currentTab()->history()->canGoForward()); +} + + void MainWindow::slotUpdateWindowTitle(const QString &title) { if (title.isEmpty()) @@ -627,7 +627,6 @@ void MainWindow::slotViewTextSmaller() } -// TODO improve this void MainWindow::slotViewFullScreen(bool makeFullScreen) { if (makeFullScreen == true) @@ -707,26 +706,25 @@ WebView *MainWindow::currentTab() const } -// FIXME: this actually doesn't work properly.. void MainWindow::slotLoadProgress(int progress) { QAction *stop = actionCollection()->action("stop"); QAction *reload = actionCollection()->action("view_redisplay"); if (progress < 100 && progress > 0) { - disconnect(m_stopReload, SIGNAL(triggered(bool)), reload , SIGNAL(triggered(bool))); - m_stopReload->setIcon(KIcon("process-stop")); - m_stopReload->setToolTip(i18n("Stop loading the current page")); - m_stopReload->setText(i18n("Stop")); - connect(m_stopReload, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); + disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), reload , SIGNAL(triggered(bool))); + m_stopReloadAction->setIcon(KIcon("process-stop")); + m_stopReloadAction->setToolTip(i18n("Stop loading the current page")); + m_stopReloadAction->setText(i18n("Stop")); + connect(m_stopReloadAction, SIGNAL(triggered(bool)), stop, SIGNAL(triggered(bool))); } else { - disconnect(m_stopReload, SIGNAL(triggered(bool)), stop , SIGNAL(triggered(bool))); - m_stopReload->setIcon(KIcon("view-refresh")); - m_stopReload->setToolTip(i18n("Reload the current page")); - m_stopReload->setText(i18n("Reload")); - connect(m_stopReload, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool))); + disconnect(m_stopReloadAction, SIGNAL(triggered(bool)), stop , SIGNAL(triggered(bool))); + m_stopReloadAction->setIcon(KIcon("view-refresh")); + m_stopReloadAction->setToolTip(i18n("Reload the current page")); + m_stopReloadAction->setText(i18n("Reload")); + connect(m_stopReloadAction, SIGNAL(triggered(bool)), reload, SIGNAL(triggered(bool))); } } -- cgit v1.2.1 From 76ff257898ea60c37cb20cff320d7c747c4a8b3c Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 29 Mar 2009 07:49:41 +0200 Subject: Search wrap --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ed347bef..c459fc42 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -596,7 +596,7 @@ void MainWindow::slotFindPrevious() { if (!currentTab() && m_lastSearch.isEmpty()) return; - if (!currentTab()->findText(m_lastSearch, QWebPage::FindBackward)) + if (!currentTab()->findText(m_lastSearch, QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument)) { slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found.")); } -- cgit v1.2.1 From 0b151ba388d46c4112b4e861d45f0d8229c8a599 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 29 Mar 2009 08:04:31 +0200 Subject: API change (rename). In MainView, newTab --> newWebView --- src/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c459fc42..2a5f9295 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -99,7 +99,7 @@ MainWindow::MainWindow() connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); connect(m_view, SIGNAL(menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT(setVisible(bool))); connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); - connect(m_view, SIGNAL(lastTabClosed()), m_view, SLOT(newTab())); + connect(m_view, SIGNAL(lastTabClosed()), m_view, SLOT(newWebView())); connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); @@ -251,7 +251,7 @@ void MainWindow::setupActions() a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T)); actionCollection()->addAction(QLatin1String("new_tab"), a); - connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newTab())); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newWebView())); a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_W)); @@ -465,7 +465,7 @@ void MainWindow::slotUpdateWindowTitle(const QString &title) void MainWindow::slotFileNew() { - Application::instance()->newTab(); + Application::instance()->newWebView(); slotHome(); } -- cgit v1.2.1 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 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) (limited to 'src/mainwindow.cpp') 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(); } -- cgit v1.2.1 From 892cddc30a03f32f249dadac7be4f39667bd1410 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 1 Apr 2009 23:53:48 +0200 Subject: Fixed no more used download action && i18n --> QLatin1String on "private_browsing".. --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 92040bfe..08b6e33c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -222,7 +222,7 @@ void MainWindow::setupActions() a = new KAction(i18n("Private &Browsing..."), this); a->setCheckable(true); - actionCollection()->addAction(i18n("private_browsing"), a); + actionCollection()->addAction(QLatin1String("private_browsing"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing())); a = new KAction(KIcon("zoom-in"), i18n("&Enlarge Font"), this); -- cgit v1.2.1 From 77f330c61d1da50db4817881cc13cbd98dbd0bd1 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 2 Apr 2009 00:04:37 +0200 Subject: updated FullScreenView --- src/mainwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 08b6e33c..e864f80f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -648,11 +648,13 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) { menuBar()->hide(); toolBar("mainToolBar")->hide(); + toolBar("locationToolBar")->hide(); } else { menuBar()->show(); toolBar("mainToolBar")->show(); + toolBar("locationToolBar")->show(); } KToggleFullScreenAction::setFullScreen(this, makeFullScreen); } -- cgit v1.2.1 From 0d6af7007186d8db3a063908a51ef5deb770f0bd Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 2 Apr 2009 01:19:56 +0200 Subject: Various fixes, including bookmarks bar --- src/mainwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e864f80f..566a1b45 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -132,6 +132,10 @@ MainWindow::MainWindow() // setup history menu: this has to be done AFTER setupGUI!! setupHistoryMenu(); + // bookmarks bar: this has to be done AFTER setupGUI!! + KToolBar *bmToolbar = toolBar("bookmarksToolBar"); + m_bookmarksProvider->provideBmToolbar(bmToolbar); + // setup Tab Bar setupTabBar(); @@ -170,10 +174,6 @@ void MainWindow::setupToolBars() 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); } -- cgit v1.2.1 From f2372797940d2e2eea16592cbb855fd4ec828fca Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 2 Apr 2009 02:01:43 +0200 Subject: Added show/hide menubar action --- src/mainwindow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 566a1b45..bae54d94 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -194,6 +194,7 @@ void MainWindow::setupActions() KStandardAction::fullScreen(this, SLOT(slotViewFullScreen(bool)), this, actionCollection()); KStandardAction::home(this, SLOT(slotHome()), actionCollection()); KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection()); + KStandardAction::showMenubar(this, SLOT(slotShowMenubar(bool)), actionCollection()); // WEB Actions (NO KStandardActions..) KStandardAction::redisplay(m_view, SLOT(slotWebReload()), actionCollection()); @@ -806,3 +807,11 @@ void MainWindow::geometryChangeRequested(const QRect &geometry) setGeometry(geometry); } + +void MainWindow::slotShowMenubar(bool enable) +{ + if(enable) + menuBar()->show(); + else + menuBar()->hide(); +} \ No newline at end of file -- cgit v1.2.1 From 9f566cd9bd8364336815f9e3fc537a6974ec2f90 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 2 Apr 2009 02:16:49 +0200 Subject: QKeySequence --> KShortCut --- src/mainwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bae54d94..bd630580 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -207,7 +207,7 @@ void MainWindow::setupActions() KStandardAction::paste(m_view, SLOT(slotWebPaste()), actionCollection()); a = new KAction(KIcon("process-stop"), i18n("&Stop"), this); - a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Period)); + a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Period)); actionCollection()->addAction(QLatin1String("stop"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotWebStop())); @@ -227,17 +227,17 @@ void MainWindow::setupActions() connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing())); a = new KAction(KIcon("zoom-in"), i18n("&Enlarge Font"), this); - a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Plus)); + a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Plus)); actionCollection()->addAction(QLatin1String("bigger_font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextBigger())); a = new KAction(KIcon("zoom-original"), i18n("&Normal Font"), this); - a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_0)); + a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_0)); actionCollection()->addAction(QLatin1String("normal_font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextNormal())); a = new KAction(KIcon("zoom-out"), i18n("&Shrink Font"), this); - a->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Minus)); + a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Minus)); actionCollection()->addAction(QLatin1String("smaller_font"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewTextSmaller())); -- cgit v1.2.1 From d9c7b45280fc470413e125e52ca1558884429530 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 3 Apr 2009 01:21:23 +0200 Subject: Open Location Icon --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bd630580..e25373e9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -217,7 +217,7 @@ void MainWindow::setupActions() m_stopReloadAction->setShortcutConfigurable(false); // ============== Custom Actions - a = new KAction(KIcon(), i18n("Open Location"), this); + a = new KAction(KIcon("document-open-remote"), i18n("Open Location"), this); actionCollection()->addAction(QLatin1String("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); -- cgit v1.2.1 From 8daa07c56435cd2892bd5f0a85e9db0755c0df85 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 5 Apr 2009 16:33:18 +0200 Subject: Upgrading rekonq UI, 1st step Updating menubar and main toolbar. --- src/mainwindow.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e25373e9..0b6bb738 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -182,7 +182,6 @@ void MainWindow::setupActions() KAction *a; // Standard Actions - KStandardAction::openNew(this, SLOT(slotFileNew()) , actionCollection()); KStandardAction::open(this, SLOT(slotFileOpen()), actionCollection()); KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection()); KStandardAction::printPreview(this, SLOT(slotFilePrintPreview()), actionCollection()); @@ -479,11 +478,11 @@ void MainWindow::slotUpdateWindowTitle(const QString &title) } -void MainWindow::slotFileNew() -{ - Application::instance()->newWebView(); - slotHome(); -} +// void MainWindow::slotFileNew() +// { +// Application::instance()->newWebView(); +// slotHome(); +// } void MainWindow::slotFileOpen() -- cgit v1.2.1 From ea971b44ba71143d9cf2e622b91aa4fbe23f456a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 5 Apr 2009 16:39:22 +0200 Subject: removed new/close tab tabbar buttons --- src/mainwindow.cpp | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0b6bb738..54c5ab77 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -137,7 +137,7 @@ MainWindow::MainWindow() m_bookmarksProvider->provideBmToolbar(bmToolbar); // setup Tab Bar - setupTabBar(); +// setupTabBar(); // setting up toolbars to NOT have context menu enabled setContextMenuPolicy(Qt::DefaultContextMenu); @@ -285,22 +285,22 @@ void MainWindow::setupActions() } -void MainWindow::setupTabBar() -{ - // Left corner button - QToolButton *addTabButton = new QToolButton(this); - addTabButton->setDefaultAction(actionCollection()->action("new_tab")); - addTabButton->setAutoRaise(true); - addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); - m_view->setCornerWidget(addTabButton, Qt::TopLeftCorner); - - // right corner button - QToolButton *closeTabButton = new QToolButton(this); - closeTabButton->setDefaultAction(actionCollection()->action("close_tab")); - closeTabButton->setAutoRaise(true); - closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); - m_view->setCornerWidget(closeTabButton, Qt::TopRightCorner); -} +// void MainWindow::setupTabBar() +// { +// // Left corner button +// QToolButton *addTabButton = new QToolButton(this); +// addTabButton->setDefaultAction(actionCollection()->action("new_tab")); +// addTabButton->setAutoRaise(true); +// addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); +// m_view->setCornerWidget(addTabButton, Qt::TopLeftCorner); +// +// // right corner button +// QToolButton *closeTabButton = new QToolButton(this); +// closeTabButton->setDefaultAction(actionCollection()->action("close_tab")); +// closeTabButton->setAutoRaise(true); +// closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); +// m_view->setCornerWidget(closeTabButton, Qt::TopRightCorner); +// } void MainWindow::setupHistoryMenu() -- cgit v1.2.1 From 245509053d7fd6427b8d7170ab088917b7fe70f0 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 5 Apr 2009 18:13:13 +0200 Subject: Ported Authentication Ui to Kdialog shining.. ;) --- src/mainwindow.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e25373e9..b028913f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -37,9 +37,6 @@ #include "mainview.h" #include "bookmarks.h" -// UI Includes -#include "ui_passworddialog.h" - // KDE Includes #include #include -- cgit v1.2.1 From 844b918e9acdf55ee77efcd5726e34933f0dbd78 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 7 Apr 2009 18:34:57 +0200 Subject: tools actions --- src/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ef0a3951..8090cb23 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -217,7 +217,7 @@ void MainWindow::setupActions() actionCollection()->addAction(QLatin1String("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); - a = new KAction(i18n("Private &Browsing..."), this); + a = new KAction(KIcon("view-media-artist"), i18n("Private &Browsing"), this); a->setCheckable(true); actionCollection()->addAction(QLatin1String("private_browsing"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing())); @@ -241,7 +241,7 @@ void MainWindow::setupActions() actionCollection()->addAction(QLatin1String("page_source"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewPageSource())); - a = new KAction(KIcon("tools-report-bug"), i18n("Enable Web &Inspector"), this); + a = new KAction(KIcon("tools-report-bug"), i18n("Web &Inspector"), this); a->setCheckable(true); actionCollection()->addAction(QLatin1String("web_inspector"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotToggleInspector(bool))); -- cgit v1.2.1 From f861745be0039908096d974f7c70681cd7cbe5e9 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 7 Apr 2009 20:23:32 +0200 Subject: Added CTRL + N shortcut to open new tab action. As new window doesn't exist anymore.. --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8090cb23..dd89d679 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -261,7 +261,7 @@ void MainWindow::setupActions() // =================== Tab Actions a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); - a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T)); + a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_N, Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T)); actionCollection()->addAction(QLatin1String("new_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newWebView())); -- cgit v1.2.1 From 02985e3b566f03a4cfda74e6c6369cdda2a6a8b0 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 7 Apr 2009 20:40:15 +0200 Subject: Fixed new tab QKeySequence --- src/mainwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index dd89d679..21ceb8ee 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -261,7 +261,10 @@ void MainWindow::setupActions() // =================== Tab Actions a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); - a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_N, Qt::CTRL + Qt::SHIFT + Qt::Key_N, Qt::CTRL + Qt::Key_T)); + QList newTabShortcutList; + newTabShortcutList << QKeySequence(QKeySequence::New); + newTabShortcutList << QKeySequence(QKeySequence::AddTab); + a->setShortcut(KShortcut(newTabShortcutList)); actionCollection()->addAction(QLatin1String("new_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newWebView())); -- cgit v1.2.1 From 074a549f33e199175a4c080c88ed3a9b6d91d1c0 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 7 Apr 2009 20:20:15 +0200 Subject: Added settings webkit section, with rekonq personal settings. --- src/mainwindow.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 21ceb8ee..d58208ba 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -332,12 +332,28 @@ void MainWindow::slotUpdateConfiguration() defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); - // =========== Privacy ============== - bool arePluginsEnabled = ReKonfig::enablePlugins(); - bool isJavascriptEnabled = ReKonfig::enableJavascript(); - - defaultSettings->setAttribute(QWebSettings::PluginsEnabled, arePluginsEnabled); - defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, isJavascriptEnabled); +// // =========== Privacy ============== +// bool arePluginsEnabled = ReKonfig::enablePlugins(); +// bool isJavascriptEnabled = ReKonfig::enableJavascript(); +// +// defaultSettings->setAttribute(QWebSettings::PluginsEnabled, arePluginsEnabled); +// defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, isJavascriptEnabled); + + // ================ WebKit ============================ + defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages()); + defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, ReKonfig::javascriptEnabled()); + defaultSettings->setAttribute(QWebSettings::JavaEnabled, ReKonfig::javaEnabled()); + defaultSettings->setAttribute(QWebSettings::PluginsEnabled, ReKonfig::pluginsEnabled()); + defaultSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, ReKonfig::privateBrowsingEnabled()); + defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, ReKonfig::javascriptCanOpenWindows()); + defaultSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, ReKonfig::javascriptCanAccessClipboard()); + defaultSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, ReKonfig::developerExtrasEnabled()); + defaultSettings->setAttribute(QWebSettings::LinksIncludedInFocusChain, ReKonfig::linksIncludedInFocusChain()); + defaultSettings->setAttribute(QWebSettings::ZoomTextOnly, ReKonfig::zoomTextOnly()); + defaultSettings->setAttribute(QWebSettings::PrintElementBackgrounds, ReKonfig::printElementBackgrounds()); + defaultSettings->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, ReKonfig::offlineStorageDatabaseEnabled()); + defaultSettings->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, ReKonfig::offlineWebApplicationCacheEnabled()); + defaultSettings->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, ReKonfig::localStorageDatabaseEnabled()); // ====== load Settings on main classes Application::networkAccessManager()->loadSettings(); -- cgit v1.2.1 From b19f1410a9f0f0a0b6c9141fe399a98248eed594 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 7 Apr 2009 21:17:14 +0200 Subject: Fixed Webkit settings, removing tools actions (no use case in settings, for me) Private Browsing & Web Inspector. Fixed that actions in tools menu --- src/mainwindow.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d58208ba..54d632d2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -217,11 +217,6 @@ void MainWindow::setupActions() actionCollection()->addAction(QLatin1String("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); - a = new KAction(KIcon("view-media-artist"), i18n("Private &Browsing"), this); - a->setCheckable(true); - actionCollection()->addAction(QLatin1String("private_browsing"), a); - connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing())); - a = new KAction(KIcon("zoom-in"), i18n("&Enlarge Font"), this); a->setShortcut(KShortcut(Qt::CTRL | Qt::Key_Plus)); actionCollection()->addAction(QLatin1String("bigger_font"), a); @@ -241,11 +236,17 @@ void MainWindow::setupActions() actionCollection()->addAction(QLatin1String("page_source"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotViewPageSource())); + // ================ Tools (WebKit) Actions a = new KAction(KIcon("tools-report-bug"), i18n("Web &Inspector"), this); a->setCheckable(true); actionCollection()->addAction(QLatin1String("web_inspector"), a); connect(a, SIGNAL(triggered(bool)), this, SLOT(slotToggleInspector(bool))); + a = new KAction(KIcon("view-media-artist"), i18n("Private &Browsing"), this); + a->setCheckable(true); + actionCollection()->addAction(QLatin1String("private_browsing"), a); + connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotPrivateBrowsing(bool))); + // ================ history related actions m_historyBackAction = new KAction(KIcon("go-previous"), i18n("Back"), this); m_historyBackMenu = new KMenu(this); @@ -344,10 +345,8 @@ void MainWindow::slotUpdateConfiguration() defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, ReKonfig::javascriptEnabled()); defaultSettings->setAttribute(QWebSettings::JavaEnabled, ReKonfig::javaEnabled()); defaultSettings->setAttribute(QWebSettings::PluginsEnabled, ReKonfig::pluginsEnabled()); - defaultSettings->setAttribute(QWebSettings::PrivateBrowsingEnabled, ReKonfig::privateBrowsingEnabled()); defaultSettings->setAttribute(QWebSettings::JavascriptCanOpenWindows, ReKonfig::javascriptCanOpenWindows()); defaultSettings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, ReKonfig::javascriptCanAccessClipboard()); - defaultSettings->setAttribute(QWebSettings::DeveloperExtrasEnabled, ReKonfig::developerExtrasEnabled()); defaultSettings->setAttribute(QWebSettings::LinksIncludedInFocusChain, ReKonfig::linksIncludedInFocusChain()); defaultSettings->setAttribute(QWebSettings::ZoomTextOnly, ReKonfig::zoomTextOnly()); defaultSettings->setAttribute(QWebSettings::PrintElementBackgrounds, ReKonfig::printElementBackgrounds()); @@ -359,7 +358,6 @@ void MainWindow::slotUpdateConfiguration() Application::networkAccessManager()->loadSettings(); Application::cookieJar()->loadSettings(); Application::historyManager()->loadSettings(); - } @@ -545,16 +543,14 @@ void MainWindow::printRequested(QWebFrame *frame) } -void MainWindow::slotPrivateBrowsing() +void MainWindow::slotPrivateBrowsing(bool enable) { QWebSettings *settings = QWebSettings::globalSettings(); - bool pb = settings->testAttribute(QWebSettings::PrivateBrowsingEnabled); - if (!pb) + if (enable) { QString title = i18n("Are you sure you want to turn on private browsing?"); QString text = "" + title + i18n("

When private browsing in turned on," " webpages are not added to the history," - " items are automatically removed from the Downloads window," \ " new cookies are not stored, current cookies can't be accessed," \ " site icons wont be stored, session wont be saved, " \ " and searches are not addded to the pop-up menu in the Google search box." \ @@ -566,6 +562,10 @@ void MainWindow::slotPrivateBrowsing() { settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); } + else + { + actionCollection()->action("private_browsing")->setChecked(false); + } } else { -- cgit v1.2.1 From 5a9d9ad3b251ab1ff3c62af465f37bdf5fd0bf6e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 8 Apr 2009 10:51:29 +0200 Subject: Removed unuseful commented code --- src/mainwindow.cpp | 68 +----------------------------------------------------- 1 file changed, 1 insertion(+), 67 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 54d632d2..20020ca3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -133,9 +133,6 @@ MainWindow::MainWindow() KToolBar *bmToolbar = toolBar("bookmarksToolBar"); m_bookmarksProvider->provideBmToolbar(bmToolbar); - // setup Tab Bar -// setupTabBar(); - // setting up toolbars to NOT have context menu enabled setContextMenuPolicy(Qt::DefaultContextMenu); } @@ -286,24 +283,6 @@ void MainWindow::setupActions() } -// void MainWindow::setupTabBar() -// { -// // Left corner button -// QToolButton *addTabButton = new QToolButton(this); -// addTabButton->setDefaultAction(actionCollection()->action("new_tab")); -// addTabButton->setAutoRaise(true); -// addTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); -// m_view->setCornerWidget(addTabButton, Qt::TopLeftCorner); -// -// // right corner button -// QToolButton *closeTabButton = new QToolButton(this); -// closeTabButton->setDefaultAction(actionCollection()->action("close_tab")); -// closeTabButton->setAutoRaise(true); -// closeTabButton->setToolButtonStyle(Qt::ToolButtonIconOnly); -// m_view->setCornerWidget(closeTabButton, Qt::TopRightCorner); -// } - - void MainWindow::setupHistoryMenu() { HistoryMenu *historyMenu = new HistoryMenu(this); @@ -333,12 +312,7 @@ void MainWindow::slotUpdateConfiguration() defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); -// // =========== Privacy ============== -// bool arePluginsEnabled = ReKonfig::enablePlugins(); -// bool isJavascriptEnabled = ReKonfig::enableJavascript(); -// -// defaultSettings->setAttribute(QWebSettings::PluginsEnabled, arePluginsEnabled); -// defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, isJavascriptEnabled); + // =========== Privacy ============== // ================ WebKit ============================ defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages()); @@ -492,13 +466,6 @@ void MainWindow::slotUpdateWindowTitle(const QString &title) } -// void MainWindow::slotFileNew() -// { -// Application::instance()->newWebView(); -// slotHome(); -// } - - void MainWindow::slotFileOpen() { QString filePath = KFileDialog::getOpenFileName(KUrl(), @@ -577,26 +544,6 @@ void MainWindow::slotPrivateBrowsing(bool enable) } } - -// void MainWindow::closeEvent(QCloseEvent *event) -// { -// if (m_view->count() > 1) -// { -// int ret = KMessageBox::warningYesNo(this, -// i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_view->count() ), -// i18n("Closing") -// ); -// if (ret == KMessageBox::No) -// { -// event->ignore(); -// return; -// } -// } -// event->accept(); -// deleteLater(); -// } - - void MainWindow::slotFind(const QString & search) { if (!currentTab()) @@ -713,19 +660,6 @@ void MainWindow::slotToggleInspector(bool enable) } -// void MainWindow::slotSwapFocus() -// { -// if ( currentTab()->hasFocus() ) -// { -// m_view->currentLineEdit()->setFocus(); -// } -// else -// { -// currentTab()->setFocus(); -// } -// } - - MainView *MainWindow::mainView() const { return m_view; -- cgit v1.2.1 From 11fa0d96626b4417718aeef2cf8316a97bce02ed Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 8 Apr 2009 10:59:12 +0200 Subject: Asking user to close rekonq if there are more than 1 tabs opened.. (Oh, Dear.. my English..) --- src/mainwindow.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 20020ca3..249dd389 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -763,4 +763,21 @@ void MainWindow::slotShowMenubar(bool enable) menuBar()->show(); else menuBar()->hide(); +} + + +bool MainWindow::queryClose() +{ + if (m_view->count() > 1) + { + int ret = KMessageBox::warningYesNo(this, + i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_view->count() ), + i18n("Closing") + ); + if (ret == KMessageBox::No) + { + return false; + } + } + return true; } \ No newline at end of file -- cgit v1.2.1 From 4de5fd991b2a797e8644c581db6fe41cc4791735 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 9 Apr 2009 18:46:46 +0200 Subject: Removed unuseful lasttabclosed signal in mainview. This becamed unuseful because of choose to do nothing if just 1 tab opened. --- src/mainwindow.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 249dd389..c074d667 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -87,21 +87,24 @@ MainWindow::MainWindow() // setting size policies setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - // connect signals and slots + // --------- connect signals and slots connect(m_view, SIGNAL(loadUrlPage(const KUrl &)), this, SLOT(loadUrl(const KUrl &))); connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); - connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), statusBar(), SLOT(showMessage(const QString&))); - connect(m_view, SIGNAL(linkHovered(const QString&)), statusBar(), SLOT(showMessage(const QString&))); connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); connect(m_view, SIGNAL(menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT(setVisible(bool))); connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); - connect(m_view, SIGNAL(lastTabClosed()), m_view, SLOT(newWebView())); + // status bar message + connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + connect(m_view, SIGNAL(linkHovered(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + + // update toolbar actions connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); - + // -------------------------------------- + slotUpdateWindowTitle(); // then, setup our actions -- cgit v1.2.1 From 7a93d8a59aa0f693ae533a35b0bc3e4607d3f5ff Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 9 Apr 2009 19:03:50 +0200 Subject: Refactoring find bar following (a bit) Pawel suggestions.. Applied match Case search --- src/mainwindow.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c074d667..2d959034 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -566,7 +566,18 @@ void MainWindow::slotFindNext() { if (!currentTab() && m_lastSearch.isEmpty()) return; - if (!currentTab()->findText(m_lastSearch, QWebPage::FindWrapsAroundDocument)) + + QWebPage::FindFlags options; + if(m_findBar->matchCase()) + { + options = QWebPage::FindCaseSensitively | QWebPage::FindWrapsAroundDocument; + } + else + { + options = QWebPage::FindWrapsAroundDocument; + } + + if (!currentTab()->findText(m_lastSearch, options)) { slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found.")); } @@ -577,7 +588,18 @@ void MainWindow::slotFindPrevious() { if (!currentTab() && m_lastSearch.isEmpty()) return; - if (!currentTab()->findText(m_lastSearch, QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument)) + + QWebPage::FindFlags options; + if(m_findBar->matchCase()) + { + options = QWebPage::FindCaseSensitively | QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument; + } + else + { + options = QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument; + } + + if (!currentTab()->findText(m_lastSearch, options)) { slotUpdateStatusbar(QString(m_lastSearch) + i18n(" not found.")); } -- cgit v1.2.1 From ca03da46425a95e0fd2c2eaed42437b7ea3551a0 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 9 Apr 2009 19:28:19 +0200 Subject: Updated TODO --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2d959034..76312c32 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -805,4 +805,4 @@ bool MainWindow::queryClose() } } return true; -} \ No newline at end of file +} -- cgit v1.2.1 From 6d37e632d445b51f5321b4138dcd1fce0cae30f9 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 10 Apr 2009 18:57:01 +0200 Subject: Fixed webview API Removed some unuseful comments --- src/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 76312c32..82f555ef 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -272,7 +272,7 @@ void MainWindow::setupActions() a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_W)); actionCollection()->addAction(QLatin1String("close_tab"), a); - connect(a, SIGNAL(triggered(bool)), m_view, SLOT(closeTab())); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotCloseTab())); a = new KAction(i18n("Show Next Tab"), this); a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabPrev() : KStandardShortcut::tabNext()); @@ -341,7 +341,7 @@ void MainWindow::slotUpdateConfiguration() void MainWindow::slotUpdateBrowser() { slotUpdateConfiguration(); - mainView()->reloadAllTabs(); + mainView()->slotReloadAllTabs(); } @@ -679,7 +679,7 @@ void MainWindow::slotToggleInspector(bool enable) i18n("Web Inspector")); if (result == KMessageBox::Yes) { - m_view->reloadAllTabs(); + m_view->slotReloadAllTabs(); } } } -- cgit v1.2.1 From 18d99a283702f6365aae7f493f09064b5679a51a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 10 Apr 2009 19:48:29 +0200 Subject: pedantic --- src/mainwindow.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 82f555ef..0fdd538e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -315,8 +315,6 @@ void MainWindow::slotUpdateConfiguration() defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); - // =========== Privacy ============== - // ================ WebKit ============================ defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages()); defaultSettings->setAttribute(QWebSettings::JavascriptEnabled, ReKonfig::javascriptEnabled()); @@ -796,7 +794,7 @@ bool MainWindow::queryClose() if (m_view->count() > 1) { int ret = KMessageBox::warningYesNo(this, - i18n("Are you sure you want to close the window?" " There are %1 tab open" , m_view->count() ), + i18n("Are you sure you want to close the window?\nThere are %1 tab open" , m_view->count() ), i18n("Closing") ); if (ret == KMessageBox::No) -- cgit v1.2.1 From 88855cf4570f1c9b39fdc5957a551d37d4835011 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 13 Apr 2009 18:53:30 +0200 Subject: dolphin && konqueror -like exit confirmation dialog --- src/mainwindow.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0fdd538e..809a209e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -50,6 +50,7 @@ #include #include #include +#include // Qt Includes @@ -791,16 +792,52 @@ void MainWindow::slotShowMenubar(bool enable) bool MainWindow::queryClose() { + KConfig config("rekonqrc"); + KConfigGroup group = config.group("Hand Settings"); + bool doNotAskAgainResult = group.readEntry("ExitConfirmationDialog", false); + + if(doNotAskAgainResult) + return true; + if (m_view->count() > 1) { - int ret = KMessageBox::warningYesNo(this, - i18n("Are you sure you want to close the window?\nThere are %1 tab open" , m_view->count() ), - i18n("Closing") - ); - if (ret == KMessageBox::No) + KDialog *dialog = new KDialog(this, Qt::Dialog); + dialog->setCaption( i18n("Closing") ); + dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::Cancel ); + dialog->setModal(true); + dialog->showButtonSeparator(true); + dialog->setButtonGuiItem(KDialog::Yes, KStandardGuiItem::quit()); + dialog->setButtonGuiItem(KDialog::No, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close"))); + dialog->setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel()); + dialog->setDefaultButton(KDialog::Yes); + + int ret = KMessageBox::createKMessageBox( dialog, + QMessageBox::Warning, + i18n("Are you sure you want to close the window?\nThere are %1 tab open" , m_view->count() ), + QStringList(), + i18n("Do not ask again"), + &doNotAskAgainResult, + KMessageBox::Notify + ); + + if (doNotAskAgainResult) { - return false; + group.writeEntry("ExitConfirmationDialog", true); + } + + switch (ret) + { + case KDialog::Yes: + // Quit + return true; + break; + case KDialog::No: + // Close only the current tab + m_view->slotCloseTab(); + default: + return false; } } + return true; -} +} \ No newline at end of file -- cgit v1.2.1 From 969eb157c5343eae7efefb7e48a843c4ec2180b8 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 17 Apr 2009 14:24:35 +0200 Subject: set (Untitled) to untitled pages.. --- src/mainwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 809a209e..b68a6ad1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -840,4 +840,5 @@ bool MainWindow::queryClose() } return true; -} \ No newline at end of file +} + \ No newline at end of file -- cgit v1.2.1 From cc6c9e776848b49dc717a8d351d103f3f7be9642 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 18 Apr 2009 03:24:47 +0200 Subject: clear location bar action. As requested --- src/mainwindow.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b68a6ad1..077a057b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -162,7 +162,7 @@ void MainWindow::setupToolBars() // location bar a = new KAction(i18n("Location Bar"), this); - a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_L, Qt::Key_F6)); + a->setShortcut(KShortcut(Qt::Key_F6)); a->setDefaultWidget(m_view->lineEditStack()); actionCollection()->addAction(QLatin1String("url_bar"), a); @@ -284,6 +284,15 @@ void MainWindow::setupActions() a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); actionCollection()->addAction(QLatin1String("show_prev_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); + + // clear Location Bar action (Henry de Valance WISH) + a = new KAction(KIcon("edit-clear-locationbar-rtl"), i18n("Clear Location Bar"), this); + a->setShortcut(Qt::CTRL+Qt::Key_L); + actionCollection()->addAction(QLatin1String("clear_location"),a); + connect(a, SIGNAL(triggered(bool)), this, SLOT(slotClearLocationBar())); + a->setWhatsThis(i18n( "Clear Location bar

" + "Clears the contents of the location bar." )); + } @@ -841,4 +850,12 @@ bool MainWindow::queryClose() return true; } - \ No newline at end of file + + +void MainWindow::slotClearLocationBar() +{ + QLineEdit *lineEdit = m_view->currentLineEdit(); + lineEdit->clear(); + lineEdit->setFocus(); +} + -- cgit v1.2.1 From 1510e5115bf27218f8bf775e22927e213018ee86 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 19 Apr 2009 12:13:19 +0200 Subject: Porting "view page source" code to KDE from Pawel's clone --- src/mainwindow.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 077a057b..37e1f760 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -661,12 +661,29 @@ void MainWindow::slotViewPageSource() if (!currentTab()) return; - QString markup = currentTab()->page()->mainFrame()->toHtml(); - QPlainTextEdit *view = new QPlainTextEdit(markup); - view->setWindowTitle(i18n("Page Source of ") + currentTab()->title()); - view->setMinimumWidth(640); - view->setAttribute(Qt::WA_DeleteOnClose); - view->show(); + KUrl url(currentTab()->url()); + bool isTempFile = false; + if (!url.isLocalFile()) + { + KTemporaryFile sourceFile; + + /// TODO: autochoose tempfile suffix + sourceFile.setSuffix(QString(".html")); + sourceFile.setAutoRemove(false); + + if (sourceFile.open()) + { + QDataStream stream(&sourceFile); + stream << currentTab()->page()->mainFrame()->toHtml().toUtf8(); + + url = KUrl(); + url.setPath(sourceFile.fileName()); + isTempFile = true; + } + } + KRun::runUrl(url, QLatin1String("text/plain"), this, isTempFile); +} + } -- cgit v1.2.1 From f7843a008851ca9fdd31b6e01bdb7f8e6206633d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 19 Apr 2009 16:56:07 +0200 Subject: Simpler MessageBoxs handling.. --- src/mainwindow.cpp | 54 ++++++++++++++++++------------------------------------ 1 file changed, 18 insertions(+), 36 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 37e1f760..9b04cbbd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -699,9 +699,11 @@ void MainWindow::slotToggleInspector(bool enable) if (enable) { int result = KMessageBox::questionYesNo(this, - i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" - "Do you want to reload all pages?"), - i18n("Web Inspector")); + i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" + "Do you want to reload all pages?"), + i18n("Web Inspector") + ); + if (result == KMessageBox::Yes) { m_view->slotReloadAllTabs(); @@ -818,46 +820,26 @@ void MainWindow::slotShowMenubar(bool enable) bool MainWindow::queryClose() { - KConfig config("rekonqrc"); - KConfigGroup group = config.group("Hand Settings"); - bool doNotAskAgainResult = group.readEntry("ExitConfirmationDialog", false); - - if(doNotAskAgainResult) - return true; - if (m_view->count() > 1) { - KDialog *dialog = new KDialog(this, Qt::Dialog); - dialog->setCaption( i18n("Closing") ); - dialog->setButtons(KDialog::Yes | KDialog::No | KDialog::Cancel ); - dialog->setModal(true); - dialog->showButtonSeparator(true); - dialog->setButtonGuiItem(KDialog::Yes, KStandardGuiItem::quit()); - dialog->setButtonGuiItem(KDialog::No, KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close"))); - dialog->setButtonGuiItem(KDialog::Cancel, KStandardGuiItem::cancel()); - dialog->setDefaultButton(KDialog::Yes); - - int ret = KMessageBox::createKMessageBox( dialog, - QMessageBox::Warning, - i18n("Are you sure you want to close the window?\nThere are %1 tab open" , m_view->count() ), - QStringList(), - i18n("Do not ask again"), - &doNotAskAgainResult, - KMessageBox::Notify - ); - - if (doNotAskAgainResult) - { - group.writeEntry("ExitConfirmationDialog", true); - } - switch (ret) + int answer = KMessageBox::questionYesNoCancel( + this, + i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) open" , m_view->count()), + i18n("Are you sure you want to close the window?"), + KStandardGuiItem::quit(), + KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")), + KStandardGuiItem::cancel(), + "confirmClosingMultipleTabs" + ); + + switch (answer) { - case KDialog::Yes: + case KMessageBox::Yes: // Quit return true; break; - case KDialog::No: + case KMessageBox::No: // Close only the current tab m_view->slotCloseTab(); default: -- cgit v1.2.1 From 8eac211c434358cbe536eb6f1448f1d565a5f26f Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 21 Apr 2009 11:27:17 +0200 Subject: Moving new download system to mainline. I did some changes to fit things as simple as possible. We can obviously improve things in a second moment.. --- src/mainwindow.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9b04cbbd..8180b1e1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -36,6 +36,7 @@ #include "webview.h" #include "mainview.h" #include "bookmarks.h" +#include "download.h" // KDE Includes #include @@ -51,6 +52,7 @@ #include #include #include +#include // Qt Includes @@ -428,9 +430,7 @@ void MainWindow::slotOpenLocation() void MainWindow::slotFileSaveAs() { KUrl srcUrl = currentTab()->url(); - QString destPath = KFileDialog::getSaveFileName(); - KUrl destUrl = KUrl(destPath); - Application::instance()->downloadUrl(srcUrl, destUrl); + Application::downloadManager()->newDownload(srcUrl); } @@ -492,6 +492,7 @@ void MainWindow::slotFileOpen() } +// TODO: Port to KDE void MainWindow::slotFilePrintPreview() { if (!currentTab()) @@ -510,6 +511,7 @@ void MainWindow::slotFilePrint() } +// TODO: Port to KDE void MainWindow::printRequested(QWebFrame *frame) { QPrinter printer; @@ -684,8 +686,6 @@ void MainWindow::slotViewPageSource() KRun::runUrl(url, QLatin1String("text/plain"), this, isTempFile); } -} - void MainWindow::slotHome() { -- cgit v1.2.1 From 2612c0c79ceeed46f432421ee09a45a466824ee7 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 21 Apr 2009 23:44:58 +0200 Subject: Fixing MainWindow code --- src/mainwindow.cpp | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8180b1e1..7b9139cc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -64,7 +64,6 @@ MainWindow::MainWindow() : KXmlGuiWindow() , m_view(new MainView(this)) - , m_bookmarksProvider(new BookmarksProvider(this)) , m_findBar(new FindBar(this)) , m_searchBar(new SearchBar(this)) { @@ -120,10 +119,13 @@ MainWindow::MainWindow() setupToolBars(); // ----- BOOKMARKS MENU: this has to be done BEFORE setupGUI!! - KAction *a = new KActionMenu(i18n("B&ookmarks"), this); - actionCollection()->addAction(QLatin1String("bookmarks"), a); - KMenu *bmMenu = m_bookmarksProvider->bookmarksMenu(); - a->setMenu(bmMenu); +// KAction *a = new KActionMenu(i18n("B&ookmarks"), this); +// actionCollection()->addAction(QLatin1String("bookmarks"), a); +// KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(); +// a->setMenu(bmMenu); + + KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(); + actionCollection()->addAction(QLatin1String("bookmarks"), bmMenu); // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. @@ -136,8 +138,8 @@ MainWindow::MainWindow() setupHistoryMenu(); // bookmarks bar: this has to be done AFTER setupGUI!! - KToolBar *bmToolbar = toolBar("bookmarksToolBar"); - m_bookmarksProvider->provideBmToolbar(bmToolbar); +// KToolBar *bmToolbar = toolBar("bookmarksToolBar"); +// m_bookmarkProvider->provideBmToolbar(bmToolbar); // setting up toolbars to NOT have context menu enabled setContextMenuPolicy(Qt::DefaultContextMenu); @@ -174,6 +176,10 @@ void MainWindow::setupToolBars() a->setDefaultWidget(m_searchBar); connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); actionCollection()->addAction(QLatin1String("search_bar"), a); + + // bookmarks bar + KAction *bookmarkBarAction = Application::bookmarkProvider()->bookmarkToolBarAction(); + a = actionCollection()->addAction(QLatin1String("bookmarks_bar"), bookmarkBarAction); } @@ -304,7 +310,16 @@ void MainWindow::setupHistoryMenu() connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); + + // setting history menu position menuBar()->insertMenu(actionCollection()->action("bookmarks"), historyMenu); + + // setting initial actions + QList historyActions; + historyActions.append(actionCollection()->action("history_back")); + historyActions.append(actionCollection()->action("history_forward")); + historyActions.append(m_view->recentlyClosedTabsAction()); + historyMenu->setInitialActions(historyActions); } @@ -858,3 +873,17 @@ void MainWindow::slotClearLocationBar() lineEdit->setFocus(); } + +QAction *MainWindow::actionByName(const QString name) +{ + QAction *ret = actionCollection()->action(name); + + if (ret) + return ret; + + /* else */ + kWarning() << "Action named: " << name << " not found, returning empty action."; + + return new QAction(this); // return empty object instead of NULL pointer +} + -- cgit v1.2.1 From 182a330e250008177d05a5ef4ed0bd87226ee954 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 22 Apr 2009 01:18:22 +0200 Subject: Side Panel --- src/mainwindow.cpp | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7b9139cc..82b15ebf 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -37,6 +37,8 @@ #include "mainview.h" #include "bookmarks.h" #include "download.h" +#include "findbar.h" +#include "sidepanel.h" // KDE Includes #include @@ -66,6 +68,7 @@ MainWindow::MainWindow() , m_view(new MainView(this)) , m_findBar(new FindBar(this)) , m_searchBar(new SearchBar(this)) + , m_sidePanel(0) { // accept dnd setAcceptDrops(true); @@ -73,19 +76,23 @@ MainWindow::MainWindow() // updating rekonq configuration slotUpdateConfiguration(); - // creating a centralWidget containing m_view and the hidden findbar + // creating a centralWidget containing panel, m_view and the hidden findbar QWidget *centralWidget = new QWidget; + centralWidget->setContentsMargins(0, 0, 0, 0); + + // setting layout QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_view); - - // Adding Find Bar - connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); layout->addWidget(m_findBar); - centralWidget->setLayout(layout); + + // central widget setCentralWidget(centralWidget); + // Adding Find Bar + connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); + // setting size policies setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -127,6 +134,7 @@ MainWindow::MainWindow() KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(); actionCollection()->addAction(QLatin1String("bookmarks"), bmMenu); + setupSidePanel(); // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. // It also applies the saved mainwindow settings, if any, and ask the @@ -143,6 +151,8 @@ MainWindow::MainWindow() // setting up toolbars to NOT have context menu enabled setContextMenuPolicy(Qt::DefaultContextMenu); + + } @@ -304,6 +314,28 @@ void MainWindow::setupActions() } +void MainWindow::setupSidePanel() +{ + // Setup history side panel + m_sidePanel = new SidePanel(i18n("History"), this); + connect(m_sidePanel, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); + connect(m_sidePanel, SIGNAL(destroyed()), Application::instance(), SLOT(slotSaveConfiguration())); + + addDockWidget(Qt::LeftDockWidgetArea, m_sidePanel); + + // setup side panel actions + KAction* a = new KAction(this); + a->setText(i18n("History")); + a->setCheckable(true); + a->setChecked(ReKonfig::showSideBar()); + a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H)); + actionCollection()->addAction(QLatin1String("show_history_panel"), a); + + // connect to toogle action + connect(a, SIGNAL(triggered(bool)), m_sidePanel->toggleViewAction(), SLOT(trigger())); +} + + void MainWindow::setupHistoryMenu() { HistoryMenu *historyMenu = new HistoryMenu(this); -- cgit v1.2.1 From db75cbfd9bbb52858d6434e96ac914424a66fe09 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 22 Apr 2009 01:24:48 +0200 Subject: Trivial fixes --- src/mainwindow.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 82b15ebf..7ada3cb2 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -119,22 +119,16 @@ MainWindow::MainWindow() // then, setup our actions setupActions(); - // 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); -// KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(); -// a->setMenu(bmMenu); - + // Bookmark Menu KActionMenu *bmMenu = Application::bookmarkProvider()->bookmarkActionMenu(); actionCollection()->addAction(QLatin1String("bookmarks"), bmMenu); + // Side Panel: this has to be done BEFORE setupGUI!! setupSidePanel(); + // a call to KXmlGuiWindow::setupGUI() populates the GUI // with actions, using KXMLGUI. // It also applies the saved mainwindow settings, if any, and ask the @@ -145,14 +139,11 @@ MainWindow::MainWindow() // setup history menu: this has to be done AFTER setupGUI!! setupHistoryMenu(); - // bookmarks bar: this has to be done AFTER setupGUI!! -// KToolBar *bmToolbar = toolBar("bookmarksToolBar"); -// m_bookmarkProvider->provideBmToolbar(bmToolbar); + // add a status bar + statusBar()->show(); // setting up toolbars to NOT have context menu enabled setContextMenuPolicy(Qt::DefaultContextMenu); - - } -- cgit v1.2.1 From 7557af13f9f904cb9a6240d2101fb14e1ffdca99 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 22 Apr 2009 01:33:28 +0200 Subject: Fixing Copyrights --- src/mainwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7ada3cb2..c0c83b0b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3,7 +3,8 @@ * This file is a part of the rekonq project * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved -* Copyright (C) 2008 by Andrea Diamantini +* Copyright (C) 2008-2009 by Andrea Diamantini +* Copyright (C) 2009 rekonq team. Please, see AUTHORS file for details * * * This program is free software; you can redistribute it -- cgit v1.2.1 From c9697e9d9e5f59ab1f23b0ff87a366c1ab89aa27 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 23 Apr 2009 01:54:44 +0200 Subject: Fixing strings: pano suggestions --- src/mainwindow.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index c0c83b0b..03a7b01a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -219,7 +219,7 @@ void MainWindow::setupActions() connect(a, SIGNAL(triggered(bool)), m_view, SLOT(slotWebStop())); // stop reload Action - m_stopReloadAction = new KAction(KIcon("view-refresh"), i18n("reload"), this); + m_stopReloadAction = new KAction(KIcon("view-refresh"), i18n("Reload"), this); actionCollection()->addAction(QLatin1String("stop_reload") , m_stopReloadAction); m_stopReloadAction->setShortcutConfigurable(false); @@ -519,7 +519,7 @@ void MainWindow::slotUpdateWindowTitle(const QString &title) void MainWindow::slotFileOpen() { QString filePath = KFileDialog::getOpenFileName(KUrl(), - i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz);;All files (*.*)"), + i18n("Web Resources (*.html *.htm *.svg *.png *.gif *.svgz); All files (*.*)"), this, i18n("Open Web Resource") ); @@ -570,8 +570,8 @@ void MainWindow::slotPrivateBrowsing(bool enable) QString title = i18n("Are you sure you want to turn on private browsing?"); QString text = "" + title + i18n("

When private browsing in turned on," " webpages are not added to the history," - " new cookies are not stored, current cookies can't be accessed," \ - " site icons wont be stored, session wont be saved, " \ + " new cookies are not stored, current cookies cannot be accessed," \ + " site icons will not be stored, session will not be saved, " \ " and searches are not addded to the pop-up menu in the Google search box." \ " Until you close the window, you can still click the Back and Forward buttons" \ " to return to the webpages you have opened."); -- cgit v1.2.1 From 2399843ceb70b45b2c1a47b680e11ba1e623ef45 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 25 Apr 2009 23:55:14 +0200 Subject: Another importing step. Need to fix cookies' classes and then (I think) we are near the goal.. --- src/mainwindow.cpp | 66 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 25 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 03a7b01a..80d18675 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -40,6 +40,8 @@ #include "download.h" #include "findbar.h" #include "sidepanel.h" +#include "urlbar.h" +#include "stackedurlbar.h" // KDE Includes #include @@ -169,7 +171,7 @@ void MainWindow::setupToolBars() // location bar a = new KAction(i18n("Location Bar"), this); a->setShortcut(KShortcut(Qt::Key_F6)); - a->setDefaultWidget(m_view->lineEditStack()); + a->setDefaultWidget(m_view->urlBarStack()); actionCollection()->addAction(QLatin1String("url_bar"), a); // search bar @@ -204,7 +206,8 @@ void MainWindow::setupActions() KStandardAction::showMenubar(this, SLOT(slotShowMenubar(bool)), actionCollection()); // WEB Actions (NO KStandardActions..) - KStandardAction::redisplay(m_view, SLOT(slotWebReload()), actionCollection()); + a = KStandardAction::redisplay(m_view, SLOT(slotWebReload()), actionCollection()); + a->setText( i18n("Reload") ); KStandardAction::back(m_view, SLOT(slotWebBack()), actionCollection()); KStandardAction::forward(m_view, SLOT(slotWebForward()), actionCollection()); KStandardAction::undo(m_view, SLOT(slotWebUndo()), actionCollection()); @@ -225,6 +228,7 @@ void MainWindow::setupActions() // ============== Custom Actions a = new KAction(KIcon("document-open-remote"), i18n("Open Location"), this); + a->setShortcut(Qt::CTRL+Qt::Key_L); actionCollection()->addAction(QLatin1String("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); @@ -294,15 +298,6 @@ void MainWindow::setupActions() a->setShortcuts(QApplication::isRightToLeft() ? KStandardShortcut::tabNext() : KStandardShortcut::tabPrev()); actionCollection()->addAction(QLatin1String("show_prev_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); - - // clear Location Bar action (Henry de Valance WISH) - a = new KAction(KIcon("edit-clear-locationbar-rtl"), i18n("Clear Location Bar"), this); - a->setShortcut(Qt::CTRL+Qt::Key_L); - actionCollection()->addAction(QLatin1String("clear_location"),a); - connect(a, SIGNAL(triggered(bool)), this, SLOT(slotClearLocationBar())); - a->setWhatsThis(i18n( "Clear Location bar

" - "Clears the contents of the location bar." )); - } @@ -454,15 +449,15 @@ void MainWindow::loadUrl(const KUrl &url) if (!currentTab() || url.isEmpty()) return; - m_view->currentLineEdit()->setText(url.prettyUrl()); + m_view->currentUrlBar()->setUrl(url.prettyUrl()); m_view->loadUrlInCurrentTab(url); } void MainWindow::slotOpenLocation() { - m_view->currentLineEdit()->selectAll(); - m_view->currentLineEdit()->setFocus(); + m_view->currentUrlBar()->selectAll(); + m_view->currentUrlBar()->setFocus(); } @@ -681,18 +676,47 @@ void MainWindow::slotViewTextSmaller() void MainWindow::slotViewFullScreen(bool makeFullScreen) { + // state flags + static bool menubarFlag; + static bool mainToolBarFlag; + static bool locationBarFlag; + static bool bookmarksToolBarFlag; + static bool statusBarFlag; + static bool sidePanelFlag; + if (makeFullScreen == true) { + // save current state + menubarFlag = menuBar()->isHidden(); + mainToolBarFlag = toolBar("mainToolBar")->isHidden(); + locationBarFlag = toolBar("locationToolBar")->isHidden(); + bookmarksToolBarFlag = toolBar("bookmarksToolBar")->isHidden(); + statusBarFlag = statusBar()->isHidden(); + sidePanelFlag = sidePanel()->isHidden(); + menuBar()->hide(); toolBar("mainToolBar")->hide(); toolBar("locationToolBar")->hide(); + toolBar("bookmarksToolBar")->hide(); + statusBar()->hide(); + sidePanel()->hide(); } else { - menuBar()->show(); - toolBar("mainToolBar")->show(); - toolBar("locationToolBar")->show(); + if (!menubarFlag) + menuBar()->show(); + if (!mainToolBarFlag) + toolBar("mainToolBar")->show(); + if (!locationBarFlag) + toolBar("locationToolBar")->show(); + if (!bookmarksToolBarFlag) + toolBar("bookmarksToolBar")->show(); + if (!statusBarFlag) + statusBar()->show(); + if (!sidePanelFlag) + sidePanel()->show(); } + KToggleFullScreenAction::setFullScreen(this, makeFullScreen); } @@ -890,14 +914,6 @@ bool MainWindow::queryClose() } -void MainWindow::slotClearLocationBar() -{ - QLineEdit *lineEdit = m_view->currentLineEdit(); - lineEdit->clear(); - lineEdit->setFocus(); -} - - QAction *MainWindow::actionByName(const QString name) { QAction *ret = actionCollection()->action(name); -- cgit v1.2.1 From e657ef44ef1eef1f998101ab3dcce1a251d729fc Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 26 Apr 2009 01:45:38 +0200 Subject: Fixed copyright strings, per file, as decided --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 80d18675..fe22f328 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4,7 +4,7 @@ * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved * Copyright (C) 2008-2009 by Andrea Diamantini -* Copyright (C) 2009 rekonq team. Please, see AUTHORS file for details +* Copyright (C) 2009 by Paweł Prażak * * * This program is free software; you can redistribute it -- cgit v1.2.1 From 53a8bd0bd87c1fb417d7206a1494534d5fa48cc2 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 27 Apr 2009 00:20:26 +0200 Subject: bookmarks fixes --- src/mainwindow.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fe22f328..78995855 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -115,8 +115,11 @@ MainWindow::MainWindow() // update toolbar actions connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); - // -------------------------------------- + // bookmarks loading + connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); + + slotUpdateWindowTitle(); // then, setup our actions @@ -396,10 +399,12 @@ KUrl MainWindow::guessUrlFromString(const QString &string) // Check if it looks like a qualified URL. Try parsing it and see. bool hasSchema = test.exactMatch(urlStr); + if (hasSchema) { QUrl qurl(urlStr, QUrl::TolerantMode); KUrl url(qurl); + if (url.isValid()) { return url; @@ -417,12 +422,14 @@ KUrl MainWindow::guessUrlFromString(const QString &string) if (!hasSchema) { int dotIndex = urlStr.indexOf(QLatin1Char('.')); + if (dotIndex != -1) { QString prefix = urlStr.left(dotIndex).toLower(); QString schema = (prefix == QLatin1String("ftp")) ? prefix : QLatin1String("http"); QUrl qurl(schema + QLatin1String("://") + urlStr, QUrl::TolerantMode); KUrl url(qurl); + if (url.isValid()) { return url; -- cgit v1.2.1 From a03c2606e80829bb65bd5621e206f161a79a6e6c Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 27 Apr 2009 01:04:36 +0200 Subject: KDE printing system --- src/mainwindow.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 78995855..a9364ef1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -59,6 +59,9 @@ #include #include +#include +#include + // Qt Includes #include @@ -533,14 +536,15 @@ void MainWindow::slotFileOpen() } -// TODO: Port to KDE void MainWindow::slotFilePrintPreview() { if (!currentTab()) return; - QPrintPreviewDialog *dialog = new QPrintPreviewDialog(this); - connect(dialog, SIGNAL(paintRequested(QPrinter *)), currentTab(), SLOT(print(QPrinter *))); - dialog->exec(); + + QPrinter printer; + KPrintPreview previewdlg( &printer, this ); + currentTab()->print(&printer); + previewdlg.exec(); } @@ -552,12 +556,11 @@ void MainWindow::slotFilePrint() } -// TODO: Port to KDE void MainWindow::printRequested(QWebFrame *frame) { QPrinter printer; - QPrintDialog *dialog = new QPrintDialog(&printer, this); - dialog->setWindowTitle(i18n("Print Document")); + + QPrintDialog *dialog = KdePrint::createPrintDialog( &printer, this ); if (dialog->exec() != QDialog::Accepted) return; frame->print(&printer); -- cgit v1.2.1 From fdbd70a77a8c294e0a578073c738f3bc4dfa6ab5 Mon Sep 17 00:00:00 2001 From: Alexandr Domrachev Date: Mon, 27 Apr 2009 17:05:43 +0000 Subject: Some changes ported for merge to mainline (bookmarks & links handling related) Added author: me :) Bookmark owner: openFolderinTabs implemented Links handling ported from Pawel branch Issue #1 fixed --- src/mainwindow.cpp | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a9364ef1..5f112abd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -103,7 +103,6 @@ MainWindow::MainWindow() setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // --------- connect signals and slots - connect(m_view, SIGNAL(loadUrlPage(const KUrl &)), this, SLOT(loadUrl(const KUrl &))); connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); @@ -118,9 +117,6 @@ MainWindow::MainWindow() // update toolbar actions connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); - - // bookmarks loading - connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); slotUpdateWindowTitle(); @@ -184,7 +180,7 @@ void MainWindow::setupToolBars() 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&))); + connect(m_searchBar, SIGNAL(search(const KUrl&)), m_view, SLOT(openUrl(const KUrl &))); actionCollection()->addAction(QLatin1String("search_bar"), a); // bookmarks bar @@ -311,11 +307,12 @@ void MainWindow::setupSidePanel() { // Setup history side panel m_sidePanel = new SidePanel(i18n("History"), this); - connect(m_sidePanel, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); + connect(m_sidePanel, SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)), + m_view, SLOT(openUrl(const KUrl &, Rekonq::OpenType))); connect(m_sidePanel, SIGNAL(destroyed()), Application::instance(), SLOT(slotSaveConfiguration())); - + addDockWidget(Qt::LeftDockWidgetArea, m_sidePanel); - + // setup side panel actions KAction* a = new KAction(this); a->setText(i18n("History")); @@ -323,7 +320,7 @@ void MainWindow::setupSidePanel() a->setChecked(ReKonfig::showSideBar()); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H)); actionCollection()->addAction(QLatin1String("show_history_panel"), a); - + // connect to toogle action connect(a, SIGNAL(triggered(bool)), m_sidePanel->toggleViewAction(), SLOT(trigger())); } @@ -332,7 +329,7 @@ void MainWindow::setupSidePanel() void MainWindow::setupHistoryMenu() { HistoryMenu *historyMenu = new HistoryMenu(this); - connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&))); + connect(historyMenu, SIGNAL(openUrl(const KUrl &)), m_view, SLOT(openUrl(const KUrl &))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); @@ -454,16 +451,6 @@ KUrl MainWindow::guessUrlFromString(const QString &string) } -void MainWindow::loadUrl(const KUrl &url) -{ - if (!currentTab() || url.isEmpty()) - return; - - m_view->currentUrlBar()->setUrl(url.prettyUrl()); - m_view->loadUrlInCurrentTab(url); -} - - void MainWindow::slotOpenLocation() { m_view->currentUrlBar()->selectAll(); @@ -532,7 +519,7 @@ void MainWindow::slotFileOpen() if (filePath.isEmpty()) return; - loadUrl(guessUrlFromString(filePath)); + mainView()->openUrl(guessUrlFromString(filePath)); } @@ -693,7 +680,7 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) static bool bookmarksToolBarFlag; static bool statusBarFlag; static bool sidePanelFlag; - + if (makeFullScreen == true) { // save current state @@ -703,7 +690,7 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) bookmarksToolBarFlag = toolBar("bookmarksToolBar")->isHidden(); statusBarFlag = statusBar()->isHidden(); sidePanelFlag = sidePanel()->isHidden(); - + menuBar()->hide(); toolBar("mainToolBar")->hide(); toolBar("locationToolBar")->hide(); @@ -745,12 +732,12 @@ void MainWindow::slotViewPageSource() /// TODO: autochoose tempfile suffix sourceFile.setSuffix(QString(".html")); sourceFile.setAutoRemove(false); - + if (sourceFile.open()) { QDataStream stream(&sourceFile); stream << currentTab()->page()->mainFrame()->toHtml().toUtf8(); - + url = KUrl(); url.setPath(sourceFile.fileName()); isTempFile = true; @@ -762,7 +749,7 @@ void MainWindow::slotViewPageSource() void MainWindow::slotHome() { - loadUrl(KUrl(m_homePage)); + mainView()->openUrl(KUrl(m_homePage)); } @@ -896,7 +883,7 @@ bool MainWindow::queryClose() if (m_view->count() > 1) { - int answer = KMessageBox::questionYesNoCancel( + int answer = KMessageBox::questionYesNoCancel( this, i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) open" , m_view->count()), i18n("Are you sure you want to close the window?"), @@ -906,7 +893,7 @@ bool MainWindow::queryClose() "confirmClosingMultipleTabs" ); - switch (answer) + switch (answer) { case KMessageBox::Yes: // Quit -- cgit v1.2.1 From 32da13f039241349c894f5c13cc1954c16c2e783 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 28 Apr 2009 03:19:14 +0200 Subject: Revert "Some changes ported for merge to mainline (bookmarks & links handling related)" links hadling problem This reverts commit fdbd70a77a8c294e0a578073c738f3bc4dfa6ab5. --- src/mainwindow.cpp | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5f112abd..a9364ef1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -103,6 +103,7 @@ MainWindow::MainWindow() setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // --------- connect signals and slots + connect(m_view, SIGNAL(loadUrlPage(const KUrl &)), this, SLOT(loadUrl(const KUrl &))); connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); @@ -117,6 +118,9 @@ MainWindow::MainWindow() // update toolbar actions connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); + + // bookmarks loading + connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); slotUpdateWindowTitle(); @@ -180,7 +184,7 @@ void MainWindow::setupToolBars() 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&)), m_view, SLOT(openUrl(const KUrl &))); + connect(m_searchBar, SIGNAL(search(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); actionCollection()->addAction(QLatin1String("search_bar"), a); // bookmarks bar @@ -307,12 +311,11 @@ void MainWindow::setupSidePanel() { // Setup history side panel m_sidePanel = new SidePanel(i18n("History"), this); - connect(m_sidePanel, SIGNAL(openUrl(const KUrl &, Rekonq::OpenType)), - m_view, SLOT(openUrl(const KUrl &, Rekonq::OpenType))); + connect(m_sidePanel, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); connect(m_sidePanel, SIGNAL(destroyed()), Application::instance(), SLOT(slotSaveConfiguration())); - + addDockWidget(Qt::LeftDockWidgetArea, m_sidePanel); - + // setup side panel actions KAction* a = new KAction(this); a->setText(i18n("History")); @@ -320,7 +323,7 @@ void MainWindow::setupSidePanel() a->setChecked(ReKonfig::showSideBar()); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H)); actionCollection()->addAction(QLatin1String("show_history_panel"), a); - + // connect to toogle action connect(a, SIGNAL(triggered(bool)), m_sidePanel->toggleViewAction(), SLOT(trigger())); } @@ -329,7 +332,7 @@ void MainWindow::setupSidePanel() void MainWindow::setupHistoryMenu() { HistoryMenu *historyMenu = new HistoryMenu(this); - connect(historyMenu, SIGNAL(openUrl(const KUrl &)), m_view, SLOT(openUrl(const KUrl &))); + connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); @@ -451,6 +454,16 @@ KUrl MainWindow::guessUrlFromString(const QString &string) } +void MainWindow::loadUrl(const KUrl &url) +{ + if (!currentTab() || url.isEmpty()) + return; + + m_view->currentUrlBar()->setUrl(url.prettyUrl()); + m_view->loadUrlInCurrentTab(url); +} + + void MainWindow::slotOpenLocation() { m_view->currentUrlBar()->selectAll(); @@ -519,7 +532,7 @@ void MainWindow::slotFileOpen() if (filePath.isEmpty()) return; - mainView()->openUrl(guessUrlFromString(filePath)); + loadUrl(guessUrlFromString(filePath)); } @@ -680,7 +693,7 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) static bool bookmarksToolBarFlag; static bool statusBarFlag; static bool sidePanelFlag; - + if (makeFullScreen == true) { // save current state @@ -690,7 +703,7 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) bookmarksToolBarFlag = toolBar("bookmarksToolBar")->isHidden(); statusBarFlag = statusBar()->isHidden(); sidePanelFlag = sidePanel()->isHidden(); - + menuBar()->hide(); toolBar("mainToolBar")->hide(); toolBar("locationToolBar")->hide(); @@ -732,12 +745,12 @@ void MainWindow::slotViewPageSource() /// TODO: autochoose tempfile suffix sourceFile.setSuffix(QString(".html")); sourceFile.setAutoRemove(false); - + if (sourceFile.open()) { QDataStream stream(&sourceFile); stream << currentTab()->page()->mainFrame()->toHtml().toUtf8(); - + url = KUrl(); url.setPath(sourceFile.fileName()); isTempFile = true; @@ -749,7 +762,7 @@ void MainWindow::slotViewPageSource() void MainWindow::slotHome() { - mainView()->openUrl(KUrl(m_homePage)); + loadUrl(KUrl(m_homePage)); } @@ -883,7 +896,7 @@ bool MainWindow::queryClose() if (m_view->count() > 1) { - int answer = KMessageBox::questionYesNoCancel( + int answer = KMessageBox::questionYesNoCancel( this, i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) open" , m_view->count()), i18n("Are you sure you want to close the window?"), @@ -893,7 +906,7 @@ bool MainWindow::queryClose() "confirmClosingMultipleTabs" ); - switch (answer) + switch (answer) { case KMessageBox::Yes: // Quit -- cgit v1.2.1 From b83de023d2fe60dca70f6662d4c9264b44db5aaf Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 28 Apr 2009 18:27:12 +0200 Subject: removing location toolbar to let toolbars be more configurable --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a9364ef1..377f74a8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -76,7 +76,7 @@ MainWindow::MainWindow() , m_searchBar(new SearchBar(this)) , m_sidePanel(0) { - // accept dnd + // accept d'n'd setAcceptDrops(true); // updating rekonq configuration -- cgit v1.2.1 From b60da9d6300097f31d163e86e2d689e9b2bc7cb6 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 29 Apr 2009 00:52:52 +0200 Subject: Removed unused MainView loadUrlPage signal --- src/mainwindow.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 377f74a8..827f10c1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -103,7 +103,6 @@ MainWindow::MainWindow() setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // --------- connect signals and slots - connect(m_view, SIGNAL(loadUrlPage(const KUrl &)), this, SLOT(loadUrl(const KUrl &))); connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); -- cgit v1.2.1 From 5fb7d909e87be4ea5a07b7a29271c96b7db4a9b3 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 29 Apr 2009 01:41:58 +0200 Subject: Fixed loading Url methods. Now in all rekonq code we have just a loadUrl method in mainview (doing the dirty job) and one in mainwindow, provided for convenience. Every class needing loading an url has a openUrl signal. Hope this should go well.. --- src/mainwindow.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 827f10c1..56ae108e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -331,7 +331,7 @@ void MainWindow::setupSidePanel() void MainWindow::setupHistoryMenu() { HistoryMenu *historyMenu = new HistoryMenu(this); - connect(historyMenu, SIGNAL(openUrl(const KUrl&)), m_view, SLOT(loadUrlInCurrentTab(const KUrl&))); + connect(historyMenu, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); connect(historyMenu, SIGNAL(hovered(const QString&)), this, SLOT(slotUpdateStatusbar(const QString&))); historyMenu->setTitle(i18n("&History")); @@ -455,11 +455,7 @@ KUrl MainWindow::guessUrlFromString(const QString &string) void MainWindow::loadUrl(const KUrl &url) { - if (!currentTab() || url.isEmpty()) - return; - - m_view->currentUrlBar()->setUrl(url.prettyUrl()); - m_view->loadUrlInCurrentTab(url); + m_view->loadUrl(url); } -- cgit v1.2.1 From ae7ac6a017bce310a160bb9152062635fdc72188 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 29 Apr 2009 10:50:22 +0200 Subject: Some fixes and warning on webview createWindow --- src/mainwindow.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 56ae108e..87129528 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -152,6 +152,8 @@ MainWindow::MainWindow() // setting up toolbars to NOT have context menu enabled setContextMenuPolicy(Qt::DefaultContextMenu); + + QTimer::singleShot(0, this, SLOT(postLaunch())); } @@ -161,6 +163,11 @@ MainWindow::~MainWindow() } +void MainWindow::postLaunch() +{ +} + + QSize MainWindow::sizeHint() const { QRect desktopRect = QApplication::desktop()->screenGeometry(); -- cgit v1.2.1 From 4b81f30b71bd34b543d29026301e2877d05d0c7d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 29 Apr 2009 11:01:49 +0200 Subject: Faster MainWindow loading.. --- src/mainwindow.cpp | 61 ++++++++++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 34 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 87129528..b45a63b6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -76,9 +76,6 @@ MainWindow::MainWindow() , m_searchBar(new SearchBar(this)) , m_sidePanel(0) { - // accept d'n'd - setAcceptDrops(true); - // updating rekonq configuration slotUpdateConfiguration(); @@ -96,34 +93,9 @@ MainWindow::MainWindow() // central widget setCentralWidget(centralWidget); - // Adding Find Bar - connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); - // setting size policies setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - - // --------- connect signals and slots - connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); - connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); - connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); - connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); - connect(m_view, SIGNAL(menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT(setVisible(bool))); - connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); - - // status bar message - connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), statusBar(), SLOT(showMessage(const QString&))); - connect(m_view, SIGNAL(linkHovered(const QString&)), statusBar(), SLOT(showMessage(const QString&))); - - // update toolbar actions - connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); - connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); - // bookmarks loading - connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); - - - slotUpdateWindowTitle(); - // then, setup our actions setupActions(); @@ -147,12 +119,6 @@ MainWindow::MainWindow() // setup history menu: this has to be done AFTER setupGUI!! setupHistoryMenu(); - // add a status bar - statusBar()->show(); - - // setting up toolbars to NOT have context menu enabled - setContextMenuPolicy(Qt::DefaultContextMenu); - QTimer::singleShot(0, this, SLOT(postLaunch())); } @@ -165,6 +131,33 @@ MainWindow::~MainWindow() void MainWindow::postLaunch() { + // --------- connect signals and slots + connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); + connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); + connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); + connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); + connect(m_view, SIGNAL(menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT(setVisible(bool))); + connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); + + // status bar messages + connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + connect(m_view, SIGNAL(linkHovered(const QString&)), statusBar(), SLOT(showMessage(const QString&))); + + // update toolbar actions signals + connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); + connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); + + // Find Bar signal + connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); + + // bookmarks loading + connect(Application::bookmarkProvider(), SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); + + // setting up toolbars to NOT have context menu enabled + setContextMenuPolicy(Qt::DefaultContextMenu); + + // accept d'n'd + setAcceptDrops(true); } -- cgit v1.2.1 From e3d3973995e3d4afeb5fe4e70dacfa632ce48fc5 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 29 Apr 2009 11:16:39 +0200 Subject: Other optimizations on MainWindow loading --- src/mainwindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b45a63b6..59196975 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -116,9 +116,6 @@ MainWindow::MainWindow() // toolbar position, icon size, etc. setupGUI(); - // setup history menu: this has to be done AFTER setupGUI!! - setupHistoryMenu(); - QTimer::singleShot(0, this, SLOT(postLaunch())); } @@ -131,6 +128,9 @@ MainWindow::~MainWindow() void MainWindow::postLaunch() { + // setup history menu: this has to be done AFTER setupGUI!! + setupHistoryMenu(); + // --------- connect signals and slots connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); -- cgit v1.2.1 From 82862fbd150afae0101757d1d6081e0e6ddf7baa Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 29 Apr 2009 11:24:11 +0200 Subject: astyle --- src/mainwindow.cpp | 79 +++++++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 42 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 59196975..be2198bd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -95,7 +95,7 @@ MainWindow::MainWindow() // setting size policies setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - + // then, setup our actions setupActions(); @@ -212,7 +212,7 @@ void MainWindow::setupActions() // WEB Actions (NO KStandardActions..) a = KStandardAction::redisplay(m_view, SLOT(slotWebReload()), actionCollection()); - a->setText( i18n("Reload") ); + a->setText(i18n("Reload")); KStandardAction::back(m_view, SLOT(slotWebBack()), actionCollection()); KStandardAction::forward(m_view, SLOT(slotWebForward()), actionCollection()); KStandardAction::undo(m_view, SLOT(slotWebUndo()), actionCollection()); @@ -233,7 +233,7 @@ void MainWindow::setupActions() // ============== Custom Actions a = new KAction(KIcon("document-open-remote"), i18n("Open Location"), this); - a->setShortcut(Qt::CTRL+Qt::Key_L); + a->setShortcut(Qt::CTRL + Qt::Key_L); actionCollection()->addAction(QLatin1String("open_location"), a); connect(a, SIGNAL(triggered(bool)) , this, SLOT(slotOpenLocation())); @@ -312,9 +312,9 @@ void MainWindow::setupSidePanel() m_sidePanel = new SidePanel(i18n("History"), this); connect(m_sidePanel, SIGNAL(openUrl(const KUrl&)), this, SLOT(loadUrl(const KUrl&))); connect(m_sidePanel, SIGNAL(destroyed()), Application::instance(), SLOT(slotSaveConfiguration())); - + addDockWidget(Qt::LeftDockWidgetArea, m_sidePanel); - + // setup side panel actions KAction* a = new KAction(this); a->setText(i18n("History")); @@ -322,7 +322,7 @@ void MainWindow::setupSidePanel() a->setChecked(ReKonfig::showSideBar()); a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_H)); actionCollection()->addAction(QLatin1String("show_history_panel"), a); - + // connect to toogle action connect(a, SIGNAL(triggered(bool)), m_sidePanel->toggleViewAction(), SLOT(trigger())); } @@ -537,7 +537,7 @@ void MainWindow::slotFilePrintPreview() return; QPrinter printer; - KPrintPreview previewdlg( &printer, this ); + KPrintPreview previewdlg(&printer, this); currentTab()->print(&printer); previewdlg.exec(); } @@ -555,7 +555,7 @@ void MainWindow::printRequested(QWebFrame *frame) { QPrinter printer; - QPrintDialog *dialog = KdePrint::createPrintDialog( &printer, this ); + QPrintDialog *dialog = KdePrint::createPrintDialog(&printer, this); if (dialog->exec() != QDialog::Accepted) return; frame->print(&printer); @@ -617,7 +617,7 @@ void MainWindow::slotFindNext() return; QWebPage::FindFlags options; - if(m_findBar->matchCase()) + if (m_findBar->matchCase()) { options = QWebPage::FindCaseSensitively | QWebPage::FindWrapsAroundDocument; } @@ -639,7 +639,7 @@ void MainWindow::slotFindPrevious() return; QWebPage::FindFlags options; - if(m_findBar->matchCase()) + if (m_findBar->matchCase()) { options = QWebPage::FindCaseSensitively | QWebPage::FindBackward | QWebPage::FindWrapsAroundDocument; } @@ -684,24 +684,21 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) // state flags static bool menubarFlag; static bool mainToolBarFlag; - static bool locationBarFlag; static bool bookmarksToolBarFlag; static bool statusBarFlag; static bool sidePanelFlag; - + if (makeFullScreen == true) { // save current state menubarFlag = menuBar()->isHidden(); mainToolBarFlag = toolBar("mainToolBar")->isHidden(); - locationBarFlag = toolBar("locationToolBar")->isHidden(); bookmarksToolBarFlag = toolBar("bookmarksToolBar")->isHidden(); statusBarFlag = statusBar()->isHidden(); sidePanelFlag = sidePanel()->isHidden(); - + menuBar()->hide(); toolBar("mainToolBar")->hide(); - toolBar("locationToolBar")->hide(); toolBar("bookmarksToolBar")->hide(); statusBar()->hide(); sidePanel()->hide(); @@ -712,8 +709,6 @@ void MainWindow::slotViewFullScreen(bool makeFullScreen) menuBar()->show(); if (!mainToolBarFlag) toolBar("mainToolBar")->show(); - if (!locationBarFlag) - toolBar("locationToolBar")->show(); if (!bookmarksToolBarFlag) toolBar("bookmarksToolBar")->show(); if (!statusBarFlag) @@ -740,12 +735,12 @@ void MainWindow::slotViewPageSource() /// TODO: autochoose tempfile suffix sourceFile.setSuffix(QString(".html")); sourceFile.setAutoRemove(false); - + if (sourceFile.open()) { QDataStream stream(&sourceFile); stream << currentTab()->page()->mainFrame()->toHtml().toUtf8(); - + url = KUrl(); url.setPath(sourceFile.fileName()); isTempFile = true; @@ -767,10 +762,10 @@ void MainWindow::slotToggleInspector(bool enable) if (enable) { int result = KMessageBox::questionYesNo(this, - i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" - "Do you want to reload all pages?"), - i18n("Web Inspector") - ); + i18n("The web inspector will only work correctly for pages that were loaded after enabling.\n" + "Do you want to reload all pages?"), + i18n("Web Inspector") + ); if (result == KMessageBox::Yes) { @@ -879,7 +874,7 @@ void MainWindow::geometryChangeRequested(const QRect &geometry) void MainWindow::slotShowMenubar(bool enable) { - if(enable) + if (enable) menuBar()->show(); else menuBar()->hide(); @@ -891,27 +886,27 @@ bool MainWindow::queryClose() if (m_view->count() > 1) { - int answer = KMessageBox::questionYesNoCancel( - this, - i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) open" , m_view->count()), - i18n("Are you sure you want to close the window?"), - KStandardGuiItem::quit(), - KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")), - KStandardGuiItem::cancel(), - "confirmClosingMultipleTabs" + int answer = KMessageBox::questionYesNoCancel( + this, + i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) open" , m_view->count()), + i18n("Are you sure you want to close the window?"), + KStandardGuiItem::quit(), + KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")), + KStandardGuiItem::cancel(), + "confirmClosingMultipleTabs" ); - switch (answer) + switch (answer) { - case KMessageBox::Yes: - // Quit - return true; - break; - case KMessageBox::No: - // Close only the current tab - m_view->slotCloseTab(); - default: - return false; + case KMessageBox::Yes: + // Quit + return true; + break; + case KMessageBox::No: + // Close only the current tab + m_view->slotCloseTab(); + default: + return false; } } -- cgit v1.2.1 From 2c9ea8dd8a766c1518d2d09e711bde3d7e52270e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 1 May 2009 01:44:22 +0200 Subject: i18n plural bugs. Courtesy patch of Kristol Baf --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index be2198bd..7ac0125c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -888,7 +888,7 @@ bool MainWindow::queryClose() int answer = KMessageBox::questionYesNoCancel( this, - i18n("Are you sure you want to close the window?\n" "You have %1 tab(s) open" , m_view->count()), + i18n("Are you sure you want to close the window?\n" "You have %1 tabs open" , m_view->count()), i18n("Are you sure you want to close the window?"), KStandardGuiItem::quit(), KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")), -- cgit v1.2.1 From ca88e015f36d8f729e612e9a70c1b0ed65f0731d Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 1 May 2009 02:53:23 +0200 Subject: Open tabs in brackground. Step 1 --- src/mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7ac0125c..8426bb94 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -352,6 +352,7 @@ void MainWindow::slotUpdateConfiguration() // ============== General ================== m_homePage = ReKonfig::homePage(); mainView()->showTabBar(); + mainView()->setMakeTabCurrent( ReKonfig::openTabsBack() ); // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); -- cgit v1.2.1 From bfd67ca0babd981596e21431646b29590c28f2d0 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 2 May 2009 02:15:08 +0200 Subject: other i18n fix from Kristol --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8426bb94..38156dcd 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -889,7 +889,7 @@ bool MainWindow::queryClose() int answer = KMessageBox::questionYesNoCancel( this, - i18n("Are you sure you want to close the window?\n" "You have %1 tabs open" , m_view->count()), + i18np("Are you sure you want to close the window?\n" "You have 1 tap open","Are you sure you want to close the window?\n" "You have %1 tabs open" , m_view->count()), i18n("Are you sure you want to close the window?"), KStandardGuiItem::quit(), KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")), -- cgit v1.2.1 From 0d324ed688eda0e1f172353d33ca33731b8f6764 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 2 May 2009 02:32:34 +0200 Subject: Open Back/Forward tabs fixed --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8426bb94..94e4dd11 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -352,7 +352,7 @@ void MainWindow::slotUpdateConfiguration() // ============== General ================== m_homePage = ReKonfig::homePage(); mainView()->showTabBar(); - mainView()->setMakeTabCurrent( ReKonfig::openTabsBack() ); + mainView()->setMakeBackTab( ReKonfig::openTabsBack() ); // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); -- cgit v1.2.1 From 6ba5990c664150cf4e3dda72ade152fbdc7caa80 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 2 May 2009 15:37:24 +0200 Subject: s/tap/tab/ --- src/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4f76d180..d1ab721f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -889,7 +889,7 @@ bool MainWindow::queryClose() int answer = KMessageBox::questionYesNoCancel( this, - i18np("Are you sure you want to close the window?\n" "You have 1 tap open","Are you sure you want to close the window?\n" "You have %1 tabs open" , m_view->count()), + i18np("Are you sure you want to close the window?\n" "You have 1 tab open","Are you sure you want to close the window?\n" "You have %1 tabs open" , m_view->count()), i18n("Are you sure you want to close the window?"), KStandardGuiItem::quit(), KGuiItem(i18n("C&lose Current Tab"), KIcon("tab-close")), -- cgit v1.2.1 From ad1b1665405727ff96381c5818a5abfc7e225e96 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 4 May 2009 11:15:58 +0200 Subject: Fixing opening window resizing and removing menubar & toolbar. rekonq has just one mainwindow. --- src/mainwindow.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d1ab721f..1ab59e2d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -134,10 +134,12 @@ void MainWindow::postLaunch() // --------- connect signals and slots connect(m_view, SIGNAL(setCurrentTitle(const QString &)), this, SLOT(slotUpdateWindowTitle(const QString &))); connect(m_view, SIGNAL(loadProgress(int)), this, SLOT(slotLoadProgress(int))); - connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); connect(m_view, SIGNAL(printRequested(QWebFrame *)), this, SLOT(printRequested(QWebFrame *))); - connect(m_view, SIGNAL(menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT(setVisible(bool))); - connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); + + // FIXME: these slots will be commented out until rekonq will have just ONE mainwindow +// connect(m_view, SIGNAL(geometryChangeRequested(const QRect &)), this, SLOT(geometryChangeRequested(const QRect &))); +// connect(m_view, SIGNAL(menuBarVisibilityChangeRequested(bool)), menuBar(), SLOT(setVisible(bool))); +// connect(m_view, SIGNAL(statusBarVisibilityChangeRequested(bool)), statusBar(), SLOT(setVisible(bool))); // status bar messages connect(m_view, SIGNAL(showStatusBarMessage(const QString&)), statusBar(), SLOT(showMessage(const QString&))); @@ -867,9 +869,13 @@ void MainWindow::slotOpenNext() } +// FIXME: this change will be there until rekonq'll have ONE mainwindow +// (probably forever..) void MainWindow::geometryChangeRequested(const QRect &geometry) { - setGeometry(geometry); + Q_UNUSED(geometry) +// setGeometry(geometry); + kDebug() << "No geometry change allowed"; } -- cgit v1.2.1 From 879d04c8c1aa5375a161da5cc0c8c7a4d64f8216 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 4 May 2009 12:51:02 +0200 Subject: Hardcoded new tab shortcuts to 1. CTRL + T 2. CTRL + N --- src/mainwindow.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1ab59e2d..63de9853 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -284,10 +284,7 @@ void MainWindow::setupActions() // =================== Tab Actions a = new KAction(KIcon("tab-new"), i18n("New &Tab"), this); - QList newTabShortcutList; - newTabShortcutList << QKeySequence(QKeySequence::New); - newTabShortcutList << QKeySequence(QKeySequence::AddTab); - a->setShortcut(KShortcut(newTabShortcutList)); + a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_T, Qt::CTRL + Qt::Key_N)); actionCollection()->addAction(QLatin1String("new_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(newWebView())); -- cgit v1.2.1 From 06b2dc0ce6ec6dd4cb090c22e2f9f8521138146b Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 6 May 2009 03:09:23 +0200 Subject: EBN Krazy fixes. 1st round.. --- src/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 63de9853..7af04da0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -572,7 +572,7 @@ void MainWindow::slotPrivateBrowsing(bool enable) " webpages are not added to the history," " new cookies are not stored, current cookies cannot be accessed," \ " site icons will not be stored, session will not be saved, " \ - " and searches are not addded to the pop-up menu in the Google search box." \ + " and searches are not added to the pop-up menu in the Google search box." \ " Until you close the window, you can still click the Back and Forward buttons" \ " to return to the webpages you have opened."); @@ -591,7 +591,7 @@ void MainWindow::slotPrivateBrowsing(bool enable) settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); MainWindow* win = Application::instance()->mainWindow(); - win->m_lastSearch = QString::null; + win->m_lastSearch.clear(); win->mainView()->clear(); } } -- cgit v1.2.1