Index: /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.cpp	(revision 70528)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.cpp	(revision 70529)
@@ -27,19 +27,11 @@
 # endif
 # include <QLabel>
-# include <QLineEdit>
-# include <QPlainTextEdit>
 # include <QPushButton>
-# include <QTextCursor>
-# include <QToolButton>
-# include <QScrollArea>
-
+# include <QSpacerItem>
 /* GUI includes: */
-# include "UIIconPool.h"
-# include "UISpecialControls.h"
+# include "QIToolButton.h"
 # include "UIVMLogViewerBookmarksPanel.h"
 # include "UIVMLogViewerWidget.h"
-# ifdef VBOX_WS_MAC
-#  include "VBoxUtils-darwin.h"
-# endif
+
 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
 
@@ -49,15 +41,15 @@
     , m_iMaxBookmarkTextLength(60)
     , m_pBookmarksComboBox(0)
-    , m_clearAllButton(0)
-    , m_clearCurrentButton(0)
+    , m_pDeleteAllButton(0)
+    , m_pDeleteCurrentButton(0)
+    , m_pSpacerItem(0)
 {
     prepare();
 }
 
-void UIVMLogViewerBookmarksPanel::updateBookmarkList()
+void UIVMLogViewerBookmarksPanel::updateBookmarkList(const QVector<QPair<int, QString> > *bookmarkVector)
 {
     if (!m_pBookmarksComboBox || !viewer())
         return;
-    const QVector<QPair<int, QString> > *bookmarkVector = viewer()->currentBookmarkVector();
     if (!bookmarkVector)
         return;
@@ -65,4 +57,5 @@
     m_pBookmarksComboBox->clear();
     QStringList bList;
+    bList << "Bookmarks List";
     for(int i = 0; i < bookmarkVector->size(); ++i)
     {
@@ -78,4 +71,6 @@
     }
     m_pBookmarksComboBox->addItems(bList);
+    /* Goto last item of the combobox: */
+    m_pBookmarksComboBox->setCurrentIndex(m_pBookmarksComboBox->count()-1);
 }
 
@@ -84,7 +79,12 @@
     if (!m_pBookmarksComboBox)
         return;
-    if (index >= m_pBookmarksComboBox->count())
+    /* If there is only Title of the combo, then goto that item: */
+    if (m_pBookmarksComboBox->count() == 1 || index >= m_pBookmarksComboBox->count())
+    {
+        m_pBookmarksComboBox->setCurrentIndex(0);
         return;
-    m_pBookmarksComboBox->setCurrentIndex(index);
+    }
+    /* index+1 since we always have a 0th item in our combo box. */
+    m_pBookmarksComboBox->setCurrentIndex(index+1);
 }
 
@@ -99,9 +99,33 @@
     m_pBookmarksComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
     m_pBookmarksComboBox->setMaximumWidth(fontMetrics.width('a') * (m_iMaxBookmarkTextLength + 2));
-    mainLayout()->addWidget(m_pBookmarksComboBox, 2, Qt::AlignLeft);
+    /* Make sure we have 0th item in our combo box. */
+    m_pBookmarksComboBox->insertItem(0, "Bookmarks List");
+
+
+    mainLayout()->addWidget(m_pBookmarksComboBox, 2/*, Qt::AlignLeft*/);
+
+    m_pDeleteCurrentButton = new QIToolButton(this);
+    m_pDeleteCurrentButton->setIcon(m_pDeleteCurrentButton->style()->standardIcon(QStyle::SP_TitleBarCloseButton));
+
+    AssertPtrReturnVoid(m_pBookmarksComboBox);
+    mainLayout()->addWidget(m_pDeleteCurrentButton, 0);
+
+    m_pDeleteAllButton = new QPushButton(this);
+    AssertPtrReturnVoid(m_pDeleteAllButton);
+    mainLayout()->addWidget(m_pDeleteAllButton, 0);
+
+
+    m_pSpacerItem = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
+    AssertPtrReturnVoid(m_pSpacerItem);
+    mainLayout()->addItem(m_pSpacerItem);
 }
 
 void UIVMLogViewerBookmarksPanel::prepareConnections()
 {
+    connect(m_pBookmarksComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
+            this, &UIVMLogViewerBookmarksPanel::sltBookmarkSelected);
+
+    connect(m_pDeleteAllButton, &QPushButton::clicked, this, &UIVMLogViewerBookmarksPanel::sigDeleteAllBookmarks);
+    connect(m_pDeleteCurrentButton, &QIToolButton::clicked, this, &UIVMLogViewerBookmarksPanel::sltDeleteCurrentBookmark);
 }
 
@@ -109,4 +133,29 @@
 void UIVMLogViewerBookmarksPanel::retranslateUi()
 {
+    if (m_pDeleteCurrentButton)
+        m_pDeleteCurrentButton->setToolTip(UIVMLogViewerWidget::tr("Delete the current bookmark."));
+    if (m_pDeleteAllButton)
+    {
+        m_pDeleteAllButton->setToolTip(UIVMLogViewerWidget::tr("Delete all bookmarks."));
+        m_pDeleteAllButton->setText(UIVMLogViewerWidget::tr("Delete all"));
+    }
     UIVMLogViewerPanel::retranslateUi();
 }
+
+void UIVMLogViewerBookmarksPanel::sltDeleteCurrentBookmark()
+{
+    if (!m_pBookmarksComboBox)
+        return;
+
+    if (m_pBookmarksComboBox->currentIndex() == 0)
+        return;
+    emit sigDeleteBookmark(m_pBookmarksComboBox->currentIndex() - 1);
+}
+
+void UIVMLogViewerBookmarksPanel::sltBookmarkSelected(int index)
+{
+    /* Do nothing if the index is 0, that is combo box title item: */
+    if (index <= 0)
+        return;
+   emit sigBookmarkSelected(index - 1);
+}
Index: /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.h	(revision 70528)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerBookmarksPanel.h	(revision 70529)
@@ -25,7 +25,6 @@
 class QComboBox;
 class QPushButton;
-
-
-
+class QSpacerItem;
+class QIToolButton;
 
 /** UIVMLogViewerPanel extension providing GUI for bookmark management. Show a list of bookmarks currently set
@@ -36,4 +35,8 @@
 
 signals:
+
+    void sigDeleteBookmark(int bookmarkIndex);
+    void sigDeleteAllBookmarks();
+    void sigBookmarkSelected(int index);
 
 public:
@@ -47,7 +50,5 @@
        user switches to another log page tab etc. */
     void setBookmarksList(const QVector<QPair<int, QString> > &bookmarkList);
-    void updateBookmarkList();
-    /* @a index is the index of the curent bookmark. */
-    void setBookmarkIndex(int index);
+    void updateBookmarkList(const QVector<QPair<int, QString> > *bookmarkVector);
 
 public slots:
@@ -63,10 +64,17 @@
 private slots:
 
+    void sltDeleteCurrentBookmark();
+    void sltBookmarkSelected(int index);
+
 private:
+
+    /* @a index is the index of the curent bookmark. */
+    void setBookmarkIndex(int index);
 
     const int     m_iMaxBookmarkTextLength;
     QComboBox    *m_pBookmarksComboBox;
-    QPushButton  *m_clearAllButton;
-    QPushButton  *m_clearCurrentButton;
+    QPushButton  *m_pDeleteAllButton;
+    QIToolButton *m_pDeleteCurrentButton;
+    QSpacerItem  *m_pSpacerItem;
 };
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp	(revision 70528)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp	(revision 70529)
@@ -120,5 +120,5 @@
     if (pFocus && pFocus->parent() == this)
         focusNextPrevChild(true);
-    if(m_pViewer)
+    if (m_pViewer)
         m_pViewer->hidePanel(this);
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp	(revision 70528)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp	(revision 70529)
@@ -54,6 +54,6 @@
 /** We use a modified scrollbar style for our QPlainTextEdits to get the
     markings on the scrollbars correctly. The default scrollbarstyle does not
-    reveal the height of the pushbuttons on the scrollbar to compute the marking
-    locations correctlt. so we turn them off: */
+    reveal the height of the pushbuttons on the scrollbar (on either side of it, with arrow on them)
+    to compute the marking locations correctly. Thus we turn these push buttons off: */
 const QString verticalScrollBarStyle("QScrollBar:vertical {"
                                      "border: 1px ridge grey; "
@@ -114,6 +114,7 @@
 
 private:
+
     /* Stores the relative (to scrollbar's height) positions of markings,
-       where we draw a horizontal line. */
+       where we draw a horizontal line. Values are in [0.0, 1.0]*/
     QVector<float> m_markingsVector;
 };
@@ -201,4 +202,5 @@
     , m_pActionBookmark(0)
     , m_pMenu(0)
+    , m_bMarkBookmarkLines(0)
 {
     /* Prepare VM Log-Viewer: */
@@ -237,31 +239,57 @@
 }
 
+void UIVMLogViewerWidget::sltDeleteBookmark(int index)
+{
+    QVector<LogBookmark>* bookmarkVector = currentBookmarkVector();
+    if(!bookmarkVector || bookmarkVector->size() <= index)
+        return;
+    bookmarkVector->remove(index, 1);
+    if (m_pBookmarksPanel)
+        m_pBookmarksPanel->updateBookmarkList(bookmarkVector);
+}
+
+void UIVMLogViewerWidget::sltDeleteAllBookmarks()
+{
+    QVector<LogBookmark>* bookmarkVector = currentBookmarkVector();
+    if(!bookmarkVector)
+        return;
+    bookmarkVector->clear();
+    if (m_pBookmarksPanel)
+        m_pBookmarksPanel->updateBookmarkList(bookmarkVector);
+}
+
+void UIVMLogViewerWidget::sltBookmarkSelected(int index)
+{
+    QVector<LogBookmark>* bookmarkVector = currentBookmarkVector();
+    if(!bookmarkVector || index >= bookmarkVector->size())
+        return;
+    if(!currentLogPage() || !currentLogPage()->document())
+        return;
+
+    int lineNumber = bookmarkVector->at(index).first;
+    QTextCursor cursor(currentLogPage()->document()->findBlockByLineNumber(lineNumber));
+    currentLogPage()->setTextCursor(cursor);
+
+}
+
 void UIVMLogViewerWidget::sltPanelActionTriggered(bool checked)
 {
     QAction *pSenderAction = qobject_cast<QAction*>(sender());
-    if(!pSenderAction)
+    if (!pSenderAction)
         return;
     UIVMLogViewerPanel* pPanel = 0;
     /* Look for the sender() within the m_panelActionMap's values: */
-    for(QMap<UIVMLogViewerPanel*, QAction*>::const_iterator iterator = m_panelActionMap.begin();
+    for (QMap<UIVMLogViewerPanel*, QAction*>::const_iterator iterator = m_panelActionMap.begin();
         iterator != m_panelActionMap.end(); ++iterator)
     {
-        if(iterator.value() == pSenderAction)
+        if (iterator.value() == pSenderAction)
             pPanel = iterator.key();
     }
-    if(!pPanel)
-        return;
-    if(checked)
+    if (!pPanel)
+        return;
+    if (checked)
         showPanel(pPanel);
     else
         hidePanel(pPanel);
-}
-
-void UIVMLogViewerWidget::sltShowHideSearchPanel()
-{
-    if (!m_pSearchPanel)
-        return;
-    /* Show/hide search-panel: */
-    m_pSearchPanel->isHidden() ? m_pSearchPanel->show() : m_pSearchPanel->hide();
 }
 
@@ -371,12 +399,4 @@
 }
 
-void UIVMLogViewerWidget::sltShowHideFilterPanel()
-{
-    if (!m_pFilterPanel)
-        return;
-    /* Show/hide filter-panel: */
-    m_pFilterPanel->isHidden() ? m_pFilterPanel->show() : m_pFilterPanel->hide();
-}
-
 void UIVMLogViewerWidget::sltSearchResultHighLigting()
 {
@@ -402,4 +422,8 @@
         m_pSearchPanel->reset();
     m_iCurrentTabIndex = tabIndex;
+    /* We keep a separate QVector<LogBookmark> for each log page: */
+    QVector<LogBookmark>* bookmarkVector = currentBookmarkVector();
+    if(bookmarkVector && m_pBookmarksPanel)
+        m_pBookmarksPanel->updateBookmarkList(bookmarkVector);
 }
 
@@ -409,11 +433,4 @@
     if (m_pSearchPanel && m_pSearchPanel->isVisible())
         m_pSearchPanel->refresh();
-}
-
-void UIVMLogViewerWidget::sltShowHideBookmarkPanel()
-{
-    if (!m_pBookmarksPanel)
-        return;
-    m_pBookmarksPanel->isHidden() ? m_pBookmarksPanel->show() : m_pBookmarksPanel->hide();
 }
 
@@ -440,8 +457,5 @@
     pBookmarkVector->push_back(bookmark);
     if (m_pBookmarksPanel)
-    {
-        m_pBookmarksPanel->updateBookmarkList();
-        m_pBookmarksPanel->setBookmarkIndex(pBookmarkVector->size() - 1);
-    }
+        m_pBookmarksPanel->updateBookmarkList(pBookmarkVector);
 }
 
@@ -528,6 +542,11 @@
         m_pBookmarksPanel->hide();
         m_pMainLayout->insertWidget(4, m_pBookmarksPanel);
-    }
-
+        connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigDeleteBookmark,
+                this, &UIVMLogViewerWidget::sltDeleteBookmark);
+        connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigDeleteAllBookmarks,
+                this, &UIVMLogViewerWidget::sltDeleteAllBookmarks);
+        connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigBookmarkSelected,
+                this, &UIVMLogViewerWidget::sltBookmarkSelected);
+    }
 }
 
@@ -714,5 +733,5 @@
     if (m_pActionBookmark)
     {
-        m_pActionBookmark->setText(tr("&Bookmark..."));
+        m_pActionBookmark->setText(tr("&Bookmarks"));
         m_pActionBookmark->setToolTip(tr("Bookmark the line"));
         m_pActionBookmark->setStatusTip(tr("Bookmark the line"));
@@ -839,7 +858,7 @@
         panel->setVisible(false);
     QMap<UIVMLogViewerPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel);
-    if(iterator != m_panelActionMap.end())
-    {
-        if(iterator.value()->isChecked())
+    if (iterator != m_panelActionMap.end())
+    {
+        if (iterator.value()->isChecked())
             iterator.value()->setChecked(false);
     }
@@ -851,7 +870,7 @@
         panel->setVisible(true);
     QMap<UIVMLogViewerPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel);
-    if(iterator != m_panelActionMap.end())
-    {
-        if(!iterator.value()->isChecked())
+    if (iterator != m_panelActionMap.end())
+    {
+        if (!iterator.value()->isChecked())
             iterator.value()->setChecked(true);
     }
Index: /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h	(revision 70528)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h	(revision 70529)
@@ -63,5 +63,5 @@
     /** Destructs the VM Log-Viewer. */
     ~UIVMLogViewerWidget();
-    /* Returns the width of the current log page. return 0 if there is no current log page: */
+    /** Returns the width of the current log page. return 0 if there is no current log page: */
     int defaultLogPageWidth() const;
 
@@ -89,11 +89,18 @@
     void sltSave();
 
+    /** @name Bookmark related slots
+     * @{ */
+    /** Deletes the bookmark with @p index from the current logs bookmark list. */
+        void sltDeleteBookmark(int index);
+        void sltDeleteAllBookmarks();
+        /** Scroll the plain text edit to the selected bookmark. */
+        void sltBookmarkSelected(int index);
+        /** Creates a bookmark out of line number and block text. */
+        void sltCreateBookmarkAtLine(QPair<int, QString> bookmark);
+        /** Determines the (middle) line number of the visible text and calls sltCreateBookmarkAtLine. */
+        void sltCreateBookmarkAtCurrent();
+    /** @} */
+
     void sltPanelActionTriggered(bool checked);
-    void sltShowHideFilterPanel();
-    void sltShowHideSearchPanel();
-    void sltShowHideBookmarkPanel();
-    /* Handles QAction sync. when a panel is closed (hidden) by panel's own close button */
-    //void sltPanelCloseButton();
-
     /** Handles the search result highlight changes. */
     void sltSearchResultHighLigting();
@@ -101,9 +108,4 @@
     void sltTabIndexChange(int tabIndex);
     void sltFilterApplied();
-    /* create a bookmark out of line number and block text. */
-    void sltCreateBookmarkAtLine(QPair<int, QString> bookmark);
-    /* Determines the (middle) line number of the visible text and calls sltCreateBookmarkAtLine. */
-    void sltCreateBookmarkAtCurrent();
-
 
 private:
@@ -179,8 +181,7 @@
     VMLogMap             m_logMap;
     mutable BookmarkMap  m_bookmarkMap;
-
-    QVBoxLayout      *m_pMainLayout;
-
-    /** Holds the widget embedding type. */
+    QVBoxLayout         *m_pMainLayout;
+
+    /** Holds the widget's embedding type. */
     const EmbedTo m_enmEmbedding;
 
@@ -199,9 +200,8 @@
         /** Holds the Bookmark action instance. */
         QAction   *m_pActionBookmark;
-
         /** Holds the menu object instance. */
         QMenu     *m_pMenu;
     /** @} */
-
+    const bool     m_bMarkBookmarkLines;
     friend class UIVMLogViewerBookmarksPanel;
     friend class UIVMLogViewerFilterPanel;
