diff options
| author | Andrea Diamantini <adjam7@gmail.com> | 2009-01-09 02:44:50 +0100 | 
|---|---|---|
| committer | Andrea Diamantini <adjam7@gmail.com> | 2009-01-09 02:44:50 +0100 | 
| commit | a14af0874d4ceac743727af1665ea1d5f15839d9 (patch) | |
| tree | 1bcfa9d51e54e76440be62916e54821d9b997643 /src | |
| parent | Last commit before loadPage REMOVAL.. (diff) | |
| download | rekonq-a14af0874d4ceac743727af1665ea1d5f15839d9.tar.xz | |
removed LoadPage method to semplify API
Now we have just loadUrl slot to run pages..
Diffstat (limited to 'src')
| -rw-r--r-- | src/browserapplication.cpp | 9 | ||||
| -rw-r--r-- | src/mainview.cpp | 4 | ||||
| -rw-r--r-- | src/mainview.h | 2 | ||||
| -rw-r--r-- | src/mainwindow.cpp | 41 | ||||
| -rw-r--r-- | src/mainwindow.h | 9 | 
5 files changed, 29 insertions, 36 deletions
| diff --git a/src/browserapplication.cpp b/src/browserapplication.cpp index bc29d64e..bb8c76b1 100644 --- a/src/browserapplication.cpp +++ b/src/browserapplication.cpp @@ -135,9 +135,14 @@ void BrowserApplication::postLaunch()          KCmdLineArgs *args = KCmdLineArgs::parsedArgs();          int n = args->count();          if (n > 1) -            mainWindow()->loadPage(args->arg(n-1)); +        { +            KUrl url = MainWindow::guessUrlFromString( args->arg(n-1) ); +            mainWindow()->loadUrl( url ); +        }          else +        {              mainWindow()->slotHome(); +        }      }      BrowserApplication::historyManager();  } @@ -272,7 +277,7 @@ bool BrowserApplication::isTheOnlyBrowser() const  void BrowserApplication::openUrl(const KUrl &url)  { -    mainWindow()->loadPage( url.url() ); +    mainWindow()->loadUrl( url );  } diff --git a/src/mainview.cpp b/src/mainview.cpp index 79cb865d..d4318cdf 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -477,9 +477,11 @@ void MainView::lineEditReturnPressed()  {      if (QLineEdit *lineEdit = qobject_cast<QLineEdit*>(sender()))       { -        emit loadPage(lineEdit->text()); +        emit loadUrlPage( KUrl( lineEdit->text() ) );          if (m_lineEdits->currentWidget() == lineEdit) +        {              currentWebView()->setFocus(); +        }      }  } diff --git a/src/mainview.h b/src/mainview.h index 3ffeef32..0458611d 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -96,7 +96,7 @@ public:  signals:      // tab widget signals -    void loadPage(const QString &url); +    void loadUrlPage(const KUrl &url);      void tabsChanged();      void lastTabClosed(); 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; diff --git a/src/mainwindow.h b/src/mainwindow.h index fb251657..e34c799e 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -45,9 +45,6 @@ class WebView;   * This class serves as the main window for rekonq.     * It handles the menus, toolbars, and status bars.   * - * @short Main window class - * @author Andrea Diamantini adjam7_AT_gmail_DOT_com - *   */  class MainWindow : public KXmlGuiWindow  @@ -66,11 +63,11 @@ private:      void setupActions();      void setupCustomMenu(); -private slots: - -    void loadPage(const QString &url); +public slots:      void slotHome();      void loadUrl(const KUrl &url); + +private slots:      void slotLoadProgress(int);      void slotUpdateStatusbar(const QString &string);      void slotUpdateWindowTitle(const QString &title = QString()); | 
