diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-10-20 16:52:52 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-10-20 16:52:52 +0200 |
commit | 21e8478e02d0d56e8ea225d504f980717a58d203 (patch) | |
tree | 5a76cc7207fbbb0d5ce6158511ea17b310e5272a /src | |
parent | fix compilation on windows (diff) | |
download | rekonq-21e8478e02d0d56e8ea225d504f980717a58d203.tar.xz |
Fixing WebHistory moves and removing a strange SIGNAL/SLOT connection.
Lionel, did you write a wrong function there?
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwindow.cpp | 36 | ||||
-rw-r--r-- | src/webview.cpp | 1 |
2 files changed, 21 insertions, 16 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b41b630f..f68a3880 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1054,22 +1054,22 @@ void MainWindow::slotAboutToShowBackMenu() return; QWebHistory *history = currentTab()->history(); int historyCount = history->count(); + // Limit history views in the menu to 8 - int limit = 0; + if(historyCount > 8) + historyCount = 8; + + kDebug() << "History Count: " << historyCount; for (int i = history->backItems(historyCount).count() - 1; i >= 0; --i) { - qDebug() << history->currentItemIndex(); QWebHistoryItem item = history->backItems(history->count()).at(i); KAction *action = new KAction(this); - action->setData(history->currentItemIndex() - (i + 1)); - QIcon icon = Application::icon(item.url()); + action->setData( i - history->currentItemIndex() ); + kDebug() << "Current Item Index: " << history->currentItemIndex(); + QIcon icon = Application::icon(item.url()); action->setIcon(icon); action->setText(item.title()); m_historyBackMenu->addAction(action); - ++limit; - if (limit >= 8) { - break; - } } } @@ -1077,20 +1077,26 @@ void MainWindow::slotAboutToShowBackMenu() void MainWindow::slotOpenActionUrl(QAction *action) { int offset = action->data().toInt(); + kDebug() << "Offset: " << offset; QWebHistory *history = currentTab()->history(); - qDebug() << offset; - qDebug() << history->itemAt(offset).isValid(); + + if(!history->itemAt(offset).isValid()) + { + kDebug() << "Invalid Offset!"; + return; + } + if (offset < 0) { history->goToItem(history->itemAt(offset)); // back + return; } - else + + if (offset > 0) { - if (offset > 0) - { - history->goToItem(history->forwardItems(history->count() - offset + 1).back()); // forward - } + history->goToItem(history->forwardItems(history->count() - offset).back()); // forward FIXME CRASH } + } diff --git a/src/webview.cpp b/src/webview.cpp index 1815e871..7ece6855 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -64,7 +64,6 @@ WebView::WebView(QWidget* parent) connect(page(), SIGNAL(statusBarMessage(const QString&)), this, SLOT(setStatusBarText(const QString&))); connect(this, SIGNAL(loadProgress(int)), this, SLOT(slotUpdateProgress(int))); connect(this, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool))); - connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); } |