diff options
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r-- | src/mainwindow.cpp | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7f2bcdeb..4e9c4b26 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -147,7 +147,7 @@ MainWindow::~MainWindow() { Application::instance()->removeMainWindow(this); delete m_popup; - delete m_view; +// delete m_view; } @@ -207,7 +207,9 @@ void MainWindow::postLaunch() // update toolbar actions signals connect(m_view, SIGNAL(tabsChanged()), this, SLOT(slotUpdateActions())); connect(m_view, SIGNAL(currentChanged(int)), this, SLOT(slotUpdateActions())); - + // launch it manually. Just the first time... + slotUpdateActions(); + // Find Bar signal connect(m_findBar, SIGNAL(searchString(const QString &)), this, SLOT(slotFind(const QString &))); @@ -1054,22 +1056,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 +1079,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 } + } |