summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp36
-rw-r--r--src/webview.cpp1
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()));
}