Rekonq's tabs are not able to show text with ampersands. Same applies to the 
bookmark toolbar. The reason is that ampersands are used in Qt to specify 
accelerator keys and therefore are removed from the visible text, leaving the 
following character underlined.

The attached patch works around this by writing "&&" to tab texts and bookmark 
texts instead of plain "&". This fixes bug 
https://bugs.kde.org/show_bug.cgi?id=235001
diff --git a/src/bookmarks/bookmarkcontextmenu.cpp b/src/bookmarks/bookmarkcontextmenu.cpp
index 4760871..c96fa7b 100644
--- a/src/bookmarks/bookmarkcontextmenu.cpp
+++ b/src/bookmarks/bookmarkcontextmenu.cpp
@@ -213,11 +213,12 @@ void BookmarkContextMenu::deleteBookmark()
 {
     KBookmark bm = bookmark();
     bool folder = bm.isGroup();
+    QString name = QString(bm.text()).replace("&&", "&");
 
     if (KMessageBox::warningContinueCancel(
                 QApplication::activeWindow(),
-                folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", bm.text())
-                : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", bm.text()),
+                folder ? i18n("Are you sure you wish to remove the bookmark folder\n\"%1\"?", name)
+                : i18n("Are you sure you wish to remove the bookmark\n\"%1\"?", name),
                 folder ? i18n("Bookmark Folder Deletion")
                 : i18n("Bookmark Deletion"),
                 KStandardGuiItem::del())
@@ -233,9 +234,10 @@ void BookmarkContextMenu::deleteBookmark()
 void BookmarkContextMenu::editBookmark()
 {
     KBookmark selected = bookmark();
-
+    selected.setFullText(selected.text().replace("&&", "&"));
     KBookmarkDialog *dialog = owner()->bookmarkDialog(manager(), QApplication::activeWindow());
     dialog->editBookmark(selected);
+    selected.setFullText(selected.text().replace("&", "&&"));
     delete dialog;
 }
 
@@ -317,7 +319,7 @@ void BookmarkContextMenu::bookmarkCurrentPage()
         if (selected.isGroup())
             parent = selected.toGroup();
 
-        KBookmark newBk = parent.addBookmark(owner()->currentTitle(), KUrl(owner()->currentUrl()), "text-html");
+        KBookmark newBk = parent.addBookmark(owner()->currentTitle().replace("&", "&&"), KUrl(owner()->currentUrl()), "text-html");
         parent.moveBookmark(newBk, selected.parentGroup().previous(selected));
     }
 
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp
index 03146ea..605b963 100644
--- a/src/bookmarks/bookmarksmanager.cpp
+++ b/src/bookmarks/bookmarksmanager.cpp
@@ -409,7 +409,9 @@ void BookmarkProvider::fillBookmarkBar(KToolBar *toolBar)
 
         else
         {
-            toolBar->addAction(new KBookmarkAction(bookmark, m_owner, this));
+            KBookmarkAction* a = new KBookmarkAction(bookmark, m_owner, this);
+            a->setIconText(a->iconText().replace("&", "&&"));
+            toolBar->addAction(a);
         }
     }
 }
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 1c36adc..e0c9970 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -592,11 +592,10 @@ void MainView::webViewIconChanged()
 
 void MainView::webViewTitleChanged(const QString &title)
 {
-    QString tabTitle = title;
-    if (title.isEmpty())
-    {
-        tabTitle = i18n("(Untitled)");
-    }
+    QString viewTitle = title.isEmpty()? i18n("(Untitled)") : title;
+    QString tabTitle = viewTitle;
+    tabTitle.replace("&", "&&");
+    
     WebView *view = qobject_cast<WebView *>(sender());
     int index = indexOf(view->parentWidget());
     if (-1 != index)
@@ -605,7 +604,7 @@ void MainView::webViewTitleChanged(const QString &title)
     }
     if (currentIndex() == index)
     {
-        emit currentTitle(tabTitle);
+        emit currentTitle(viewTitle);
     }
     Application::historyManager()->updateHistoryEntry(view->url(), tabTitle);
 }
_______________________________________________
rekonq mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/rekonq

Reply via email to