diff --git a/src/shared/help/bookmarkmanager.cpp b/src/shared/help/bookmarkmanager.cpp
index 932aa3ad2de453322f13f934b5b739c8da34650f..0fcfc625ea90bb0a5ed04d744d0a5cc02620e2f1 100644
--- a/src/shared/help/bookmarkmanager.cpp
+++ b/src/shared/help/bookmarkmanager.cpp
@@ -50,7 +50,7 @@
 
 
 BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title,
-                               const QString &url, QWidget *parent)
+        const QString &url, QWidget *parent)
     : QDialog(parent)
     , m_url(url)
     , m_title(title)
@@ -82,21 +82,21 @@ BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title,
     connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(addAccepted()));
     connect(ui.newFolderButton, SIGNAL(clicked()), this, SLOT(addNewFolder()));
     connect(ui.toolButton, SIGNAL(clicked()), this, SLOT(toolButtonClicked()));
-    connect(ui.bookmarkEdit, SIGNAL(textChanged(const QString&)), this,
-        SLOT(textChanged(const QString&)));
+    connect(ui.bookmarkEdit, SIGNAL(textChanged(QString)), this,
+        SLOT(textChanged(QString)));
 
-    connect(bookmarkManager->treeBookmarkModel(), SIGNAL(itemChanged(QStandardItem*)),
+    connect(bookmarkManager->treeBookmarkModel(),
+        SIGNAL(itemChanged(QStandardItem*)),
         this, SLOT(itemChanged(QStandardItem*)));
 
-    connect(ui.bookmarkFolders, SIGNAL(currentIndexChanged(const QString&)), this,
-        SLOT(selectBookmarkFolder(const QString&)));
+    connect(ui.bookmarkFolders, SIGNAL(currentIndexChanged(QString)), this,
+        SLOT(selectBookmarkFolder(QString)));
 
-    connect(ui.treeView, SIGNAL(customContextMenuRequested(const QPoint&)), this,
-        SLOT(customContextMenuRequested(const QPoint&)));
+    connect(ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this,
+        SLOT(customContextMenuRequested(QPoint)));
 
-    connect(ui.treeView->selectionModel(),
-        SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
-        this, SLOT(currentChanged(const QModelIndex&, const QModelIndex&)));
+    connect(ui.treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,
+        QModelIndex)), this, SLOT(currentChanged(QModelIndex)));
 }
 
 BookmarkDialog::~BookmarkDialog()
@@ -105,8 +105,8 @@ BookmarkDialog::~BookmarkDialog()
 
 void BookmarkDialog::addAccepted()
 {
-    const QItemSelection selection = ui.treeView->selectionModel()->selection();
-    const QModelIndexList list = selection.indexes();
+    QItemSelectionModel *model = ui.treeView->selectionModel();
+    const QModelIndexList &list = model->selection().indexes();
 
     QModelIndex index;
     if (!list.isEmpty())
@@ -118,8 +118,8 @@ void BookmarkDialog::addAccepted()
 
 void BookmarkDialog::addNewFolder()
 {
-    const QItemSelection selection = ui.treeView->selectionModel()->selection();
-    const QModelIndexList list = selection.indexes();
+    QItemSelectionModel *model = ui.treeView->selectionModel();
+    const QModelIndexList &list = model->selection().indexes();
 
     QModelIndex index;
     if (!list.isEmpty())
@@ -130,13 +130,12 @@ void BookmarkDialog::addNewFolder()
     if (newFolder.isValid()) {
         ui.treeView->expand(index);
         const QModelIndex &index = proxyModel->mapFromSource(newFolder);
-        ui.treeView->selectionModel()->setCurrentIndex(index,
-            QItemSelectionModel::ClearAndSelect);
+        model->setCurrentIndex(index, QItemSelectionModel::ClearAndSelect);
 
         ui.bookmarkFolders->clear();
         ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());
 
-        const QString name = index.data().toString();
+        const QString &name = index.data().toString();
         ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
     }
     ui.treeView->setFocus();
@@ -196,9 +195,12 @@ void BookmarkDialog::selectBookmarkFolder(const QString &folderName)
     QList<QStandardItem*> list = model->findItems(folderName,
         Qt::MatchCaseSensitive | Qt::MatchRecursive, 0);
     if (!list.isEmpty()) {
-        QModelIndex index = model->indexFromItem(list.at(0));
-        ui.treeView->selectionModel()->setCurrentIndex(
-            proxyModel->mapFromSource(index), QItemSelectionModel::ClearAndSelect);
+        const QModelIndex &index = model->indexFromItem(list.at(0));
+        QItemSelectionModel *model = ui.treeView->selectionModel();
+        if (model) {
+            model->setCurrentIndex(proxyModel->mapFromSource(index),
+                QItemSelectionModel::ClearAndSelect);
+        }
     }
 }
 
@@ -213,13 +215,13 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point)
     QAction *removeItem = menu.addAction(tr("Delete Folder"));
     QAction *renameItem = menu.addAction(tr("Rename Folder"));
 
-    QAction *picked_action = menu.exec(ui.treeView->mapToGlobal(point));
-    if (!picked_action)
+    QAction *picked = menu.exec(ui.treeView->mapToGlobal(point));
+    if (!picked)
         return;
 
-    if (picked_action == removeItem) {
-        bookmarkManager->removeBookmarkItem(ui.treeView,
-            proxyModel->mapToSource(index));
+    const QModelIndex &proxyIndex = proxyModel->mapToSource(index);
+    if (picked == removeItem) {
+        bookmarkManager->removeBookmarkItem(ui.treeView, proxyIndex);
         ui.bookmarkFolders->clear();
         ui.bookmarkFolders->addItems(bookmarkManager->bookmarkFolders());
 
@@ -229,10 +231,9 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point)
             name = index.data().toString();
         ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(name));
     }
-    else if (picked_action == renameItem) {
-        QStandardItem *item = bookmarkManager->treeBookmarkModel()->
-            itemFromIndex(proxyModel->mapToSource(index));
-        if (item) {
+    else if (picked == renameItem) {
+        BookmarkModel *model = bookmarkManager->treeBookmarkModel();
+        if (QStandardItem *item = model->itemFromIndex(proxyIndex)) {
             item->setEditable(true);
             ui.treeView->edit(index);
             item->setEditable(false);
@@ -240,19 +241,12 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point)
     }
 }
 
-void BookmarkDialog::currentChanged(const QModelIndex& current,
-                                    const QModelIndex& previous)
+void BookmarkDialog::currentChanged(const QModelIndex &current)
 {
-    Q_UNUSED(previous)
-
-    if (!current.isValid()) {
-        ui.bookmarkFolders->setCurrentIndex(
-            ui.bookmarkFolders->findText(tr("Bookmarks")));
-        return;
-    }
-
-    ui.bookmarkFolders->setCurrentIndex(
-        ui.bookmarkFolders->findText(current.data().toString()));
+    QString text = tr("Bookmarks");
+    if (current.isValid())
+        text = current.data().toString();
+    ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->findText(text));
 }
 
 bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
@@ -263,7 +257,7 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
         QModelIndex index = ui.treeView->currentIndex();
         switch (ke->key()) {
             case Qt::Key_F2: {
-                const QModelIndex& source = proxyModel->mapToSource(index);
+                const QModelIndex &source = proxyModel->mapToSource(index);
                 QStandardItem *item =
                     bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
                 if (item) {
@@ -294,10 +288,11 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
 }
 
 
+// #pragma mark -- BookmarkWidget
 
 
 BookmarkWidget::BookmarkWidget(BookmarkManager *manager, QWidget *parent,
-                               bool showButtons)
+        bool showButtons)
     : QWidget(parent)
     , addButton(0)
     , removeButton(0)
@@ -339,7 +334,7 @@ void BookmarkWidget::filterChanged()
 
     filterBookmarkModel->setFilterRegExp(regExp);
 
-    QModelIndex index = treeView->indexAt(QPoint(1, 1));
+    const QModelIndex &index = treeView->indexAt(QPoint(1, 1));
     if (index.isValid())
         treeView->setCurrentIndex(index);
 
@@ -350,7 +345,8 @@ void BookmarkWidget::filterChanged()
 void BookmarkWidget::expand(const QModelIndex& index)
 {
     const QModelIndex& source = filterBookmarkModel->mapToSource(index);
-    QStandardItem *item = bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
+    QStandardItem *item =
+        bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
     if (item)
         item->setData(treeView->isExpanded(index), Qt::UserRole + 11);
 }
@@ -391,22 +387,22 @@ void BookmarkWidget::customContextMenuRequested(const QPoint &point)
         }
     }
 
-    QAction *picked_action = menu.exec(treeView->mapToGlobal(point));
-    if (!picked_action)
+    QAction *pickedAction = menu.exec(treeView->mapToGlobal(point));
+    if (!pickedAction)
         return;
 
-    if (picked_action == showItem) {
+    if (pickedAction == showItem) {
         emit requestShowLink(data);
     }
-    else if (picked_action == showItemNewTab) {
+    else if (pickedAction == showItemNewTab) {
         Help::Internal::CentralWidget::instance()->setSourceInNewTab(data);
     }
-    else if (picked_action == removeItem) {
+    else if (pickedAction == removeItem) {
         bookmarkManager->removeBookmarkItem(treeView,
             filterBookmarkModel->mapToSource(index));
     }
-    else if (picked_action == renameItem) {
-        const QModelIndex& source = filterBookmarkModel->mapToSource(index);
+    else if (pickedAction == renameItem) {
+        const QModelIndex &source = filterBookmarkModel->mapToSource(index);
         QStandardItem *item =
             bookmarkManager->treeBookmarkModel()->itemFromIndex(source);
         if (item) {
@@ -452,8 +448,8 @@ void BookmarkWidget::setup(bool showButtons)
 
         addButton = new QToolButton(this);
         addButton->setText(tr("Add"));
-        addButton->setIcon(QIcon(QString::fromLatin1(
-            ":/trolltech/assistant/images/" SYSTEM "/addtab.png")));
+        addButton->setIcon(QIcon(QLatin1String(":/trolltech/assistant/images/"
+            SYSTEM "/addtab.png")));
         addButton->setAutoRaise(true);
         addButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
         hlayout->addWidget(addButton);
@@ -461,8 +457,8 @@ void BookmarkWidget::setup(bool showButtons)
 
         removeButton = new QToolButton(this);
         removeButton->setText(tr("Remove"));
-        removeButton->setIcon(QIcon(QString::fromLatin1(
-            ":/trolltech/assistant/images/" SYSTEM "/closetab.png")));
+        removeButton->setIcon(QIcon(QLatin1String(":/trolltech/assistant/images/"
+            SYSTEM "/closetab.png")));
         removeButton->setAutoRaise(true);
         removeButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
         hlayout->addWidget(removeButton);
@@ -480,17 +476,14 @@ void BookmarkWidget::setup(bool showButtons)
     treeView->viewport()->installEventFilter(this);
     treeView->setContextMenuPolicy(Qt::CustomContextMenu);
 
-    connect(treeView, SIGNAL(expanded(const QModelIndex&)), this,
-        SLOT(expand(const QModelIndex&)));
-
-    connect(treeView, SIGNAL(collapsed(const QModelIndex&)), this,
-        SLOT(expand(const QModelIndex&)));
-
-    connect(treeView, SIGNAL(activated(const QModelIndex&)), this,
-        SLOT(activated(const QModelIndex&)));
-
-    connect(treeView, SIGNAL(customContextMenuRequested(const QPoint&)),
-        this, SLOT(customContextMenuRequested(const QPoint&)));
+    connect(treeView, SIGNAL(expanded(QModelIndex)), this,
+        SLOT(expand(QModelIndex)));
+    connect(treeView, SIGNAL(collapsed(QModelIndex)), this,
+        SLOT(expand(QModelIndex)));
+    connect(treeView, SIGNAL(activated(QModelIndex)), this,
+        SLOT(activated(QModelIndex)));
+    connect(treeView, SIGNAL(customContextMenuRequested(QPoint)),
+        this, SLOT(customContextMenuRequested(QPoint)));
 
     filterBookmarkModel->setFilterKeyColumn(0);
     filterBookmarkModel->setDynamicSortFilter(true);
@@ -518,17 +511,17 @@ bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
         if (e->type() == QEvent::KeyPress) {
             QKeyEvent *ke = static_cast<QKeyEvent*>(e);
             if (index.isValid() && searchField->text().isEmpty()) {
+                const QModelIndex &src = filterBookmarkModel->mapToSource(index);
                 if (ke->key() == Qt::Key_F2) {
-                    QStandardItem *item =  bookmarkManager->treeBookmarkModel()
-                        ->itemFromIndex(filterBookmarkModel->mapToSource(index));
+                    QStandardItem *item =
+                        bookmarkManager->treeBookmarkModel()->itemFromIndex(src);
                     if (item) {
                         item->setEditable(true);
                         treeView->edit(index);
                         item->setEditable(false);
                     }
                 } else if (ke->key() == Qt::Key_Delete) {
-                    bookmarkManager->removeBookmarkItem(treeView,
-                        filterBookmarkModel->mapToSource(index));
+                    bookmarkManager->removeBookmarkItem(treeView, src);
                 }
             }
 
@@ -579,6 +572,7 @@ bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
 }
 
 
+// #pragma mark -- BookmarkModel
 
 
 BookmarkModel::BookmarkModel(int rows, int columns, QObject * parent)
@@ -598,13 +592,15 @@ Qt::DropActions BookmarkModel::supportedDropActions() const
 Qt::ItemFlags BookmarkModel::flags(const QModelIndex &index) const
 {
     Qt::ItemFlags defaultFlags = QStandardItemModel::flags(index);
-    if (index.data(Qt::UserRole + 10).toString() == QLatin1String("Folder"))
+    if ((!index.isValid()) // can only happen for the invisible root item
+        || index.data(Qt::UserRole + 10).toString() == QLatin1String("Folder"))
         return (Qt::ItemIsDropEnabled | defaultFlags) &~ Qt::ItemIsDragEnabled;
 
     return (Qt::ItemIsDragEnabled | defaultFlags) &~ Qt::ItemIsDropEnabled;
 }
 
 
+// #pragma mark -- BookmarkManager
 
 
 BookmarkManager::BookmarkManager(QHelpEngineCore* _helpEngine)
@@ -612,10 +608,9 @@ BookmarkManager::BookmarkManager(QHelpEngineCore* _helpEngine)
     , listModel(new BookmarkModel(0, 1, this))
     , helpEngine(_helpEngine)
 {
+    bookmarkIcon = QIcon(QLatin1String(":/help/images/bookmark.png"));
     folderIcon = QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon);
-    treeModel->setHeaderData(0, Qt::Horizontal, tr("Bookmark"));
-    listModel->setHeaderData(0, Qt::Horizontal, tr("Bookmark"));
-
+    
     connect(treeModel, SIGNAL(itemChanged(QStandardItem*)), this,
         SLOT(itemChanged(QStandardItem*)));
 }
@@ -638,22 +633,10 @@ BookmarkModel* BookmarkManager::listBookmarkModel()
 
 void BookmarkManager::saveBookmarks()
 {
-    qint32 depth = 0;
     QByteArray bookmarks;
     QDataStream stream(&bookmarks, QIODevice::WriteOnly);
-    QStandardItem *root = treeModel->invisibleRootItem();
-
-    for (int i = 0; i < root->rowCount(); ++i) {
-        const QStandardItem *item = root->child(i);
-        stream << depth; // root
-        stream << item->data(Qt::DisplayRole).toString();
-        stream << item->data(Qt::UserRole + 10).toString();
-        stream << item->data(Qt::UserRole + 11).toBool();
 
-        if (item->rowCount() > 0) {
-            readBookmarksRecursive(item, stream, (depth +1));
-        }
-    }
+    readBookmarksRecursive(treeModel->invisibleRootItem(), stream, 0);
     helpEngine->setCustomValue(QLatin1String("Bookmarks"), bookmarks);
 }
 
@@ -689,16 +672,17 @@ QModelIndex BookmarkManager::addNewFolder(const QModelIndex& index)
     return treeModel->indexFromItem(item);
 }
 
-void BookmarkManager::removeBookmarkItem(QTreeView *treeView, const QModelIndex& index)
+void BookmarkManager::removeBookmarkItem(QTreeView *treeView,
+    const QModelIndex& index)
 {
     QStandardItem *item = treeModel->itemFromIndex(index);
     if (item) {
         QString data = index.data(Qt::UserRole + 10).toString();
         if (data == QLatin1String("Folder") && item->rowCount() > 0) {
             int value = QMessageBox::question(treeView, tr("Remove"),
-                        tr("You are going to delete a Folder which will also<br>"
-                        "remove its content. Are you sure you would like to continue?"),
-                        QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
+                tr("You are going to delete a Folder which will also<br>"
+                "remove its content. Are you sure you would like to continue?"),
+                QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
 
             if (value == QMessageBox::Cancel)
                 return;
@@ -720,27 +704,25 @@ void BookmarkManager::removeBookmarkItem(QTreeView *treeView, const QModelIndex&
 }
 
 void BookmarkManager::showBookmarkDialog(QWidget* parent, const QString &name,
-                                         const QString &url)
+    const QString &url)
 {
     BookmarkDialog dialog(this, name, url, parent);
     dialog.exec();
 }
 
 void BookmarkManager::addNewBookmark(const QModelIndex& index,
-                                     const QString &name, const QString &url)
+    const QString &name, const QString &url)
 {
     QStandardItem *item = new QStandardItem(name);
     item->setEditable(false);
     item->setData(false, Qt::UserRole + 11);
     item->setData(url, Qt::UserRole + 10);
 
-    if (index.isValid()) {
+    if (index.isValid())
         treeModel->itemFromIndex(index)->appendRow(item);
-        listModel->appendRow(item->clone());
-    } else {
+    else
         treeModel->appendRow(item);
-        listModel->appendRow(item->clone());
-    }
+    listModel->appendRow(item->clone());
 }
 
 void BookmarkManager::itemChanged(QStandardItem *item)
@@ -771,7 +753,8 @@ void BookmarkManager::setupBookmarkModels()
     QList<int> lastDepths;
     QList<QStandardItem*> parents;
 
-    QByteArray ba = helpEngine->customValue(QLatin1String("Bookmarks")).toByteArray();
+    QByteArray ba =
+        helpEngine->customValue(QLatin1String("Bookmarks")).toByteArray();
     QDataStream stream(ba);
     while (!stream.atEnd()) {
         stream >> depth >> name >> type >> expanded;
@@ -796,10 +779,12 @@ void BookmarkManager::setupBookmarkModels()
             }
         }
 
-        if (type == QLatin1String("Folder"))
-            item->setIcon(folderIcon);
-        else
+        if (type != QLatin1String("Folder")) {
+            item->setIcon(bookmarkIcon);
             listModel->appendRow(item->clone());
+        } else {
+            item->setIcon(folderIcon);
+        }
     }
 }
 
@@ -841,8 +826,7 @@ void BookmarkManager::removeBookmarkFolderItems(QStandardItem *item)
 }
 
 void BookmarkManager::readBookmarksRecursive(const QStandardItem *item,
-                                             QDataStream &stream,
-                                             const qint32 depth) const
+    QDataStream &stream, const qint32 depth) const
 {
     for (int j = 0; j < item->rowCount(); ++j) {
         const QStandardItem *child = item->child(j);
diff --git a/src/shared/help/bookmarkmanager.h b/src/shared/help/bookmarkmanager.h
index c4f4780bc6196ec7dae2de090049376e2c47d488..6b32cd8886d8c4613c761b1383646fbb6a1457cf 100644
--- a/src/shared/help/bookmarkmanager.h
+++ b/src/shared/help/bookmarkmanager.h
@@ -76,7 +76,7 @@ private slots:
     void textChanged(const QString& string);
     void selectBookmarkFolder(const QString &folderName);
     void customContextMenuRequested(const QPoint &point);
-    void currentChanged(const QModelIndex& current, const QModelIndex& previous);
+    void currentChanged(const QModelIndex& current);
     
 private:
     bool eventFilter(QObject *object, QEvent *e);
@@ -184,7 +184,8 @@ private:
 private:
     QString oldText;
     QIcon folderIcon;
-    
+    QIcon bookmarkIcon;
+
     BookmarkModel *treeModel;
     BookmarkModel *listModel;
     QStandardItem *renameItem;