Bookmarks: Compile with QT_NO_CAST_FROM_ASCII

Change-Id: I54a3ff0ecf0393fc7b525e1ee86d68f18e9cd387
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Orgad Shaneh
2012-11-26 20:42:43 +02:00
committed by Friedemann Kleint
parent b7fea5fe53
commit e943fcb39f
3 changed files with 9 additions and 6 deletions

View File

@@ -119,7 +119,7 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
painter->save(); painter->save();
QFontMetrics fm(opt.font); QFontMetrics fm(opt.font);
static int lwidth = fm.width("8888") + 18; static int lwidth = fm.width(QLatin1String("8888")) + 18;
QColor backgroundColor; QColor backgroundColor;
QColor textColor; QColor textColor;
@@ -753,11 +753,11 @@ void BookmarkManager::addBookmark(Bookmark *bookmark, bool userset)
void BookmarkManager::addBookmark(const QString &s) void BookmarkManager::addBookmark(const QString &s)
{ {
// index3 is a frontier beetween note text and other bookmarks data // index3 is a frontier beetween note text and other bookmarks data
int index3 = s.lastIndexOf('\t'); int index3 = s.lastIndexOf(QLatin1Char('\t'));
if (index3 < 0) if (index3 < 0)
index3 = s.size(); index3 = s.size();
int index2 = s.lastIndexOf(':', index3 - 1); int index2 = s.lastIndexOf(QLatin1Char(':'), index3 - 1);
int index1 = s.indexOf(':'); int index1 = s.indexOf(QLatin1Char(':'));
if (index3 != -1 || index2 != -1 || index1 != -1) { if (index3 != -1 || index2 != -1 || index1 != -1) {
const QString &filePath = s.mid(index1+1, index2-index1-1); const QString &filePath = s.mid(index1+1, index2-index1-1);
@@ -795,7 +795,7 @@ void BookmarkManager::saveBookmarks()
foreach (const Bookmark *bookmark, m_bookmarksList) foreach (const Bookmark *bookmark, m_bookmarksList)
list << bookmarkToString(bookmark); list << bookmarkToString(bookmark);
sessionManager()->setValue("Bookmarks", list); sessionManager()->setValue(QLatin1String("Bookmarks"), list);
} }
void BookmarkManager::operateTooltip(TextEditor::ITextEditor *textEditor, const QPoint &pos, Bookmark *mark) void BookmarkManager::operateTooltip(TextEditor::ITextEditor *textEditor, const QPoint &pos, Bookmark *mark)
@@ -814,7 +814,7 @@ void BookmarkManager::operateTooltip(TextEditor::ITextEditor *textEditor, const
void BookmarkManager::loadBookmarks() void BookmarkManager::loadBookmarks()
{ {
removeAllBookmarks(); removeAllBookmarks();
const QStringList &list = sessionManager()->value("Bookmarks").toStringList(); const QStringList &list = sessionManager()->value(QLatin1String("Bookmarks")).toStringList();
foreach (const QString &bookmarkString, list) foreach (const QString &bookmarkString, list)
addBookmark(bookmarkString); addBookmark(bookmarkString);

View File

@@ -6,6 +6,8 @@ include(../../plugins/projectexplorer/projectexplorer.pri)
include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/texteditor/texteditor.pri) include(../../plugins/texteditor/texteditor.pri)
DEFINES += QT_NO_CAST_FROM_ASCII
HEADERS += bookmarksplugin.h \ HEADERS += bookmarksplugin.h \
bookmark.h \ bookmark.h \
bookmarkmanager.h \ bookmarkmanager.h \

View File

@@ -13,6 +13,7 @@ QtcPlugin {
Depends { name: "Locator" } Depends { name: "Locator" }
Depends { name: "cpp" } Depends { name: "cpp" }
cpp.defines: base.concat(["QT_NO_CAST_FROM_ASCII"])
files: [ files: [
"bookmark.cpp", "bookmark.cpp",