[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kdelibs/frameworks] /: Move KCharSelect in kwidgetsaddons
From: Kevin Ottens <ervin+bluesystems () kde ! org>
Date: 2013-08-19 14:08:41
Message-ID: E1VBQ8P-0006Mq-0o () scm ! kde ! org
[Download RAW message or body]
Git commit 9be3e2adb3188127ca5b39471362ccaedf321f29 by Kevin Ottens.
Committed on 13/08/2013 at 16:24.
Pushed by ervin into branch 'frameworks'.
Move KCharSelect in kwidgetsaddons
M +0 -5 staging/kde4attic/src/CMakeLists.txt
M +5 -0 tier1/kwidgetsaddons/src/CMakeLists.txt
R +- -- tier1/kwidgetsaddons/src/kcharselect-data [from: \
staging/kde4attic/src/kcharselect-data - 100% similarity] R +0 -0 \
tier1/kwidgetsaddons/src/kcharselect-translation.cpp [from: \
staging/kde4attic/src/kcharselect-translation.cpp - 100% similarity] R +54 -54 \
tier1/kwidgetsaddons/src/kcharselect.cpp [from: staging/kde4attic/src/kcharselect.cpp \
- 085% similarity] R +2 -2 tier1/kwidgetsaddons/src/kcharselect.h [from: \
staging/kde4attic/src/kcharselect.h - 098% similarity] R +1 -1 \
tier1/kwidgetsaddons/src/kcharselect_p.h [from: staging/kde4attic/src/kcharselect_p.h \
- 099% similarity] R +14 -14 tier1/kwidgetsaddons/src/kcharselectdata.cpp [from: \
staging/kde4attic/src/kcharselectdata.cpp - 096% similarity] R +1 -1 \
tier1/kwidgetsaddons/src/kcharselectdata_p.h [from: \
staging/kde4attic/src/kcharselectdata_p.h - 098% similarity]
http://commits.kde.org/kdelibs/9be3e2adb3188127ca5b39471362ccaedf321f29
diff --git a/staging/kde4attic/src/CMakeLists.txt \
b/staging/kde4attic/src/CMakeLists.txt index 21758e1..928d201 100644
--- a/staging/kde4attic/src/CMakeLists.txt
+++ b/staging/kde4attic/src/CMakeLists.txt
@@ -15,8 +15,6 @@ configure_file(localization/config-localization.h.cmake \
${CMAKE_CURRENT_BINARY_D
set(kde4attic_SRCS
kanimatedbutton.cpp
- kcharselect.cpp
- kcharselectdata.cpp
kdatecombobox.cpp
kdatepicker.cpp
kdatetable.cpp
@@ -140,7 +138,6 @@ install( FILES
install(FILES
kanimatedbutton.h
- kcharselect.h
kdatecombobox.h
kdatepicker.h
kdatetable.h
@@ -169,5 +166,3 @@ install(FILES
configure_file(localization/all_languages.desktop \
${CMAKE_CURRENT_BINARY_DIR}/all_languages @ONLY) install( FILES \
${CMAKE_CURRENT_BINARY_DIR}/all_languages DESTINATION ${LOCALE_INSTALL_DIR} ) \
install( FILES localization/entry.desktop DESTINATION \
${LOCALE_INSTALL_DIR}/en_US )
-
-install(FILES kcharselect-data DESTINATION ${DATA_INSTALL_DIR}/kcharselect)
diff --git a/tier1/kwidgetsaddons/src/CMakeLists.txt \
b/tier1/kwidgetsaddons/src/CMakeLists.txt index 7a31a65..c17c648 100644
--- a/tier1/kwidgetsaddons/src/CMakeLists.txt
+++ b/tier1/kwidgetsaddons/src/CMakeLists.txt
@@ -1,6 +1,8 @@
set(kwidgetsaddons_SRCS
kacceleratormanager.cpp
+ kcharselect.cpp
+ kcharselectdata.cpp
kcolorbutton.cpp
kfontaction.cpp
fonthelpers.cpp
@@ -78,6 +80,7 @@ install(TARGETS KWidgetsAddons EXPORT KWidgetsAddonsTargets \
${INSTALL_TARGETS_DE
install(FILES
kacceleratormanager.h
+ kcharselect.h
kcolorbutton.h
kdragwidgetdecorator.h
kdualaction.h
@@ -128,3 +131,5 @@ install(FILES
${CMAKE_CURRENT_BINARY_DIR}/kwidgetsaddons_export.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel
)
+
+install(FILES kcharselect-data DESTINATION ${DATA_INSTALL_DIR}/kcharselect)
diff --git a/staging/kde4attic/src/kcharselect-data \
b/tier1/kwidgetsaddons/src/kcharselect-data similarity index 100%
rename from staging/kde4attic/src/kcharselect-data
rename to tier1/kwidgetsaddons/src/kcharselect-data
diff --git a/staging/kde4attic/src/kcharselect-translation.cpp \
b/tier1/kwidgetsaddons/src/kcharselect-translation.cpp similarity index 100%
rename from staging/kde4attic/src/kcharselect-translation.cpp
rename to tier1/kwidgetsaddons/src/kcharselect-translation.cpp
diff --git a/staging/kde4attic/src/kcharselect.cpp \
b/tier1/kwidgetsaddons/src/kcharselect.cpp similarity index 85%
rename from staging/kde4attic/src/kcharselect.cpp
rename to tier1/kwidgetsaddons/src/kcharselect.cpp
index b791838..35c9497 100644
--- a/staging/kde4attic/src/kcharselect.cpp
+++ b/tier1/kwidgetsaddons/src/kcharselect.cpp
@@ -284,7 +284,7 @@ void KCharSelectTable::keyPressEvent(QKeyEvent *e)
if (d->model)
switch (e->key()) {
case Qt::Key_Space:
- emit activated(' ');
+ emit activated(QLatin1Char(' '));
return;
break;
case Qt::Key_Enter: case Qt::Key_Return: {
@@ -351,9 +351,9 @@ void KCharSelect::initWidget(const Controls controls, QObject \
*actionParent)
QAction *findAction = new QAction(this);
connect(findAction, SIGNAL(triggered(bool)), this, \
SLOT(_k_activateSearchLine()));
- findAction->setObjectName("edit_find");
+ findAction->setObjectName(QStringLiteral("edit_find"));
findAction->setText(tr("&Find..."));
- findAction->setIcon(QIcon::fromTheme("edit-find"));
+ findAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-find")));
findAction->setShortcuts(QKeySequence::keyBindings(QKeySequence::Find));
attachToActionParent(findAction, actionParent);
@@ -374,29 +374,29 @@ void KCharSelect::initWidget(const Controls controls, QObject \
*actionParent) comboLayout->addWidget(d->backButton);
d->backButton->setEnabled(false);
d->backButton->setText(tr("Previous in History", "Goes to previous character"));
- d->backButton->setIcon(QIcon::fromTheme("go-previous"));
+ d->backButton->setIcon(QIcon::fromTheme(QStringLiteral("go-previous")));
d->backButton->setToolTip(tr("Previous Character in History"));
d->forwardButton = new QToolButton(this);
comboLayout->addWidget(d->forwardButton);
d->forwardButton->setEnabled(false);
d->forwardButton->setText(tr("Next in History", "Goes to next character"));
- d->forwardButton->setIcon(QIcon::fromTheme("go-next"));
+ d->forwardButton->setIcon(QIcon::fromTheme(QStringLiteral("go-next")));
d->forwardButton->setToolTip(tr("Next Character in History"));
QAction *backAction = new QAction(this);
connect(backAction, SIGNAL(triggered(bool)), d->backButton, \
SLOT(animateClick()));
- backAction->setObjectName("go_back");
+ backAction->setObjectName(QStringLiteral("go_back"));
backAction->setText(tr("&Back", "go back"));
- backAction->setIcon(QIcon::fromTheme("go-previous"));
+ backAction->setIcon(QIcon::fromTheme(QStringLiteral("go-previous")));
backAction->setShortcuts(QKeySequence::keyBindings(QKeySequence::Back));
attachToActionParent(backAction, actionParent);
QAction *forwardAction = new QAction(this);
connect(forwardAction, SIGNAL(triggered(bool)), d->forwardButton, \
SLOT(animateClick()));
- forwardAction->setObjectName("go_forward");
+ forwardAction->setObjectName(QStringLiteral("go_forward"));
forwardAction->setText(tr("&Forward", "go forward"));
- forwardAction->setIcon(QIcon::fromTheme("go-next"));
+ forwardAction->setIcon(QIcon::fromTheme(QStringLiteral("go-next")));
forwardAction->setShortcuts(QKeySequence::keyBindings(QKeySequence::Forward));
attachToActionParent(forwardAction, actionParent);
@@ -664,13 +664,13 @@ void \
KCharSelect::KCharSelectPrivate::_k_updateCurrentChar(const QChar &c)
void KCharSelect::KCharSelectPrivate::_k_slotUpdateUnicode(const QChar &c)
{
- QString html = "<p>" + tr("Character:") + ' ' + s_data()->display(c, \
charTable->font()) + ' ' +
- s_data()->formatCode(c.unicode()) + "<br />";
+ QString html = QStringLiteral("<p>") + tr("Character:") + QLatin1Char(' ') + \
s_data()->display(c, charTable->font()) + QLatin1Char(' ') + + \
s_data()->formatCode(c.unicode()) + QStringLiteral("<br />");
QString name = s_data()->name(c);
if (!name.isEmpty()) {
//is name ever empty? </p> should always be there...
- html += tr("Name: ") + name.toHtmlEscaped() + "</p>";
+ html += tr("Name: ") + name.toHtmlEscaped() + QStringLiteral("</p>");
}
QStringList aliases = s_data()->aliases(c);
QStringList notes = s_data()->notes(c);
@@ -678,116 +678,116 @@ void \
KCharSelect::KCharSelectPrivate::_k_slotUpdateUnicode(const QChar &c) QStringList \
equivalents = s_data()->equivalents(c); QStringList approxEquivalents = \
s_data()->approximateEquivalents(c);
if (!(aliases.isEmpty() && notes.isEmpty() && seeAlso.isEmpty() && \
equivalents.isEmpty() && approxEquivalents.isEmpty())) {
- html += "<p><b>" + tr("Annotations and Cross References") + "</b></p>";
+ html += QStringLiteral("<p><b>") + tr("Annotations and Cross References") + \
QStringLiteral("</b></p>"); }
if (!aliases.isEmpty()) {
- html += "<p style=\"margin-bottom: 0px;\">" + tr("Alias names:") + "</p><ul \
style=\"margin-top: 0px;\">"; + html += QStringLiteral("<p \
style=\"margin-bottom: 0px;\">") + tr("Alias names:") + QStringLiteral("</p><ul \
style=\"margin-top: 0px;\">"); foreach(const QString &alias, aliases) {
- html += "<li>" + alias.toHtmlEscaped() + "</li>";
+ html += QStringLiteral("<li>") + alias.toHtmlEscaped() + \
QStringLiteral("</li>"); }
- html += "</ul>";
+ html += QStringLiteral("</ul>");
}
if (!notes.isEmpty()) {
- html += "<p style=\"margin-bottom: 0px;\">" + tr("Notes:") + "</p><ul \
style=\"margin-top: 0px;\">"; + html += QStringLiteral("<p \
style=\"margin-bottom: 0px;\">") + tr("Notes:") + QStringLiteral("</p><ul \
style=\"margin-top: 0px;\">"); foreach(const QString ¬e, notes) {
- html += "<li>" + createLinks(note.toHtmlEscaped()) + "</li>";
+ html += QStringLiteral("<li>") + createLinks(note.toHtmlEscaped()) + \
QStringLiteral("</li>"); }
- html += "</ul>";
+ html += QStringLiteral("</ul>");
}
if (!seeAlso.isEmpty()) {
- html += "<p style=\"margin-bottom: 0px;\">" + tr("See also:") + "</p><ul \
style=\"margin-top: 0px;\">"; + html += QStringLiteral("<p \
style=\"margin-bottom: 0px;\">") + tr("See also:") + QStringLiteral("</p><ul \
style=\"margin-top: 0px;\">"); foreach(const QChar &c2, seeAlso) {
- html += "<li><a href=\"" + QString::number(c2.unicode(), 16) + "\">";
+ html += QStringLiteral("<li><a href=\"") + QString::number(c2.unicode(), \
16) + QStringLiteral("\">"); if (s_data()->isPrint(c2)) {
- html += "&#" + QString::number(c2.unicode()) + "; ";
+ html += QStringLiteral("&#") + QString::number(c2.unicode()) + \
QStringLiteral("; "); }
- html += s_data()->formatCode(c2.unicode()) + ' ' + \
s_data()->name(c2).toHtmlEscaped() + "</a></li>"; + html += \
s_data()->formatCode(c2.unicode()) + QLatin1Char(' ') + \
s_data()->name(c2).toHtmlEscaped() + QStringLiteral("</a></li>"); }
- html += "</ul>";
+ html += QStringLiteral("</ul>");
}
if (!equivalents.isEmpty()) {
- html += "<p style=\"margin-bottom: 0px;\">" + tr("Equivalents:") + "</p><ul \
style=\"margin-top: 0px;\">"; + html += QStringLiteral("<p \
style=\"margin-bottom: 0px;\">") + tr("Equivalents:") + QStringLiteral("</p><ul \
style=\"margin-top: 0px;\">"); foreach(const QString &equivalent, equivalents) {
- html += "<li>" + createLinks(equivalent.toHtmlEscaped()) + "</li>";
+ html += QStringLiteral("<li>") + createLinks(equivalent.toHtmlEscaped()) \
+ QStringLiteral("</li>"); }
- html += "</ul>";
+ html += QStringLiteral("</ul>");
}
if (!approxEquivalents.isEmpty()) {
- html += "<p style=\"margin-bottom: 0px;\">" + tr("Approximate equivalents:") \
+ "</p><ul style=\"margin-top: 0px;\">"; + html += QStringLiteral("<p \
style=\"margin-bottom: 0px;\">") + tr("Approximate equivalents:") + \
QStringLiteral("</p><ul style=\"margin-top: 0px;\">"); foreach(const QString \
&approxEquivalent, approxEquivalents) {
- html += "<li>" + createLinks(approxEquivalent.toHtmlEscaped()) + \
"</li>"; + html += QStringLiteral("<li>") + \
createLinks(approxEquivalent.toHtmlEscaped()) + QStringLiteral("</li>"); }
- html += "</ul>";
+ html += QStringLiteral("</ul>");
}
QStringList unihan = s_data()->unihanInfo(c);
if (unihan.count() == 7) {
- html += "<p><b>" + tr("CJK Ideograph Information") + "</b></p><p>";
+ html += QStringLiteral("<p><b>") + tr("CJK Ideograph Information") + \
QStringLiteral("</b></p><p>"); bool newline = true;
if (!unihan[0].isEmpty()) {
html += tr("Definition in English: ") + unihan[0];
newline = false;
}
if (!unihan[2].isEmpty()) {
- if (!newline) html += "<br>";
+ if (!newline) html += QStringLiteral("<br>");
html += tr("Mandarin Pronunciation: ") + unihan[2];
newline = false;
}
if (!unihan[1].isEmpty()) {
- if (!newline) html += "<br>";
+ if (!newline) html += QStringLiteral("<br>");
html += tr("Cantonese Pronunciation: ") + unihan[1];
newline = false;
}
if (!unihan[6].isEmpty()) {
- if (!newline) html += "<br>";
+ if (!newline) html += QStringLiteral("<br>");
html += tr("Japanese On Pronunciation: ") + unihan[6];
newline = false;
}
if (!unihan[5].isEmpty()) {
- if (!newline) html += "<br>";
+ if (!newline) html += QStringLiteral("<br>");
html += tr("Japanese Kun Pronunciation: ") + unihan[5];
newline = false;
}
if (!unihan[3].isEmpty()) {
- if (!newline) html += "<br>";
+ if (!newline) html += QStringLiteral("<br>");
html += tr("Tang Pronunciation: ") + unihan[3];
newline = false;
}
if (!unihan[4].isEmpty()) {
- if (!newline) html += "<br>";
+ if (!newline) html += QStringLiteral("<br>");
html += tr("Korean Pronunciation: ") + unihan[4];
newline = false;
}
- html += "</p>";
+ html += QStringLiteral("</p>");
}
- html += "<p><b>" + tr("General Character Properties") + "</b><br>";
- html += tr("Block: ") + s_data()->block(c) + "<br>";
- html += tr("Unicode category: ") + s_data()->categoryText(s_data()->category(c)) \
+ "</p>"; + html += QStringLiteral("<p><b>") + tr("General Character Properties") \
+ QStringLiteral("</b><br>"); + html += tr("Block: ") + s_data()->block(c) + \
QStringLiteral("<br>"); + html += tr("Unicode category: ") + \
s_data()->categoryText(s_data()->category(c)) + QStringLiteral("</p>");
QByteArray utf8 = QString(c).toUtf8();
- html += "<p><b>" + tr("Various Useful Representations") + "</b><br>";
+ html += QStringLiteral("<p><b>") + tr("Various Useful Representations") + \
QStringLiteral("</b><br>"); html += tr("UTF-8:");
foreach(unsigned char c, utf8)
- html += ' ' + s_data()->formatCode(c, 2, "0x");
- html += "<br>" + tr("UTF-16: ") + s_data()->formatCode(c.unicode(), 4, "0x") + \
"<br>"; + html += QLatin1Char(' ') + s_data()->formatCode(c, 2, \
QStringLiteral("0x")); + html += QStringLiteral("<br>") + tr("UTF-16: ") + \
s_data()->formatCode(c.unicode(), 4, QStringLiteral("0x")) + QStringLiteral("<br>"); \
html += tr("C octal escaped UTF-8: "); foreach(unsigned char c, utf8)
- html += s_data()->formatCode(c, 3, "\\", 8);
- html += "<br>" + tr("XML decimal entity:") + " &#" + \
QString::number(c.unicode()) + ";</p>"; + html += s_data()->formatCode(c, 3, \
QStringLiteral("\\"), 8); + html += QStringLiteral("<br>") + tr("XML decimal \
entity:") + QStringLiteral(" &#") + QString::number(c.unicode()) + \
QStringLiteral(";</p>");
detailBrowser->setHtml(html);
}
QString KCharSelect::KCharSelectPrivate::createLinks(QString s)
{
- QRegExp rx("\\b([\\dABCDEF]{4})\\b");
+ QRegExp rx(QStringLiteral("\\b([\\dABCDEF]{4})\\b"));
QStringList chars;
int pos = 0;
@@ -800,12 +800,12 @@ QString KCharSelect::KCharSelectPrivate::createLinks(QString s)
QSet<QString> chars2 = QSet<QString>::fromList(chars);
foreach(const QString &c, chars2) {
int unicode = c.toInt(0, 16);
- QString link = "<a href=\"" + c + "\">";
+ QString link = QStringLiteral("<a href=\"") + c + QStringLiteral("\">");
if (s_data()->isPrint(QChar(unicode))) {
- link += "&#" + QString::number(unicode) + "; ";
+ link += QStringLiteral("&#") + QString::number(unicode) + \
QStringLiteral("; "); }
- link += "U+" + c + ' ';
- link += s_data()->name(QChar(unicode)).toHtmlEscaped() + "</a>";
+ link += QStringLiteral("U+") + c + QLatin1Char(' ');
+ link += s_data()->name(QChar(unicode)).toHtmlEscaped() + \
QStringLiteral("</a>"); s.replace(c, link);
}
return s;
@@ -907,9 +907,9 @@ QVariant KCharSelectItemModel::data(const QModelIndex &index, int \
role) const
QChar c = m_chars[pos];
if (role == Qt::ToolTipRole) {
- QString result = s_data()->display(c, m_font) + "<br />" + \
s_data()->name(c).toHtmlEscaped() + "<br />" +
- tr("Unicode code point:") + ' ' + \
s_data()->formatCode(c.unicode()) + "<br />" +
- tr("In decimal", "Character") + ' ' + \
QString::number(c.unicode()); + QString result = s_data()->display(c, m_font) \
+ QStringLiteral("<br />") + s_data()->name(c).toHtmlEscaped() + QStringLiteral("<br \
/>") + + tr("Unicode code point:") + QLatin1Char(' ') + \
s_data()->formatCode(c.unicode()) + QStringLiteral("<br />") + + \
tr("In decimal", "Character") + QLatin1Char(' ') + QString::number(c.unicode()); \
return QVariant(result); } else if (role == Qt::TextAlignmentRole)
return QVariant(Qt::AlignHCenter | Qt::AlignVCenter);
diff --git a/staging/kde4attic/src/kcharselect.h \
b/tier1/kwidgetsaddons/src/kcharselect.h similarity index 98%
rename from staging/kde4attic/src/kcharselect.h
rename to tier1/kwidgetsaddons/src/kcharselect.h
index 3f98f07..b926629 100644
--- a/staging/kde4attic/src/kcharselect.h
+++ b/tier1/kwidgetsaddons/src/kcharselect.h
@@ -24,7 +24,7 @@
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QWidget>
-#include <kde4attic_export.h>
+#include <kwidgetsaddons_export.h>
class QFont;
class QUrl;
@@ -55,7 +55,7 @@ class QUrl;
* @author Daniel Laidig <d.laidig@gmx.de>
*/
-class KDE4ATTIC_EXPORT KCharSelect : public QWidget
+class KWIDGETSADDONS_EXPORT KCharSelect : public QWidget
{
Q_OBJECT
Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont)
diff --git a/staging/kde4attic/src/kcharselect_p.h \
b/tier1/kwidgetsaddons/src/kcharselect_p.h similarity index 99%
rename from staging/kde4attic/src/kcharselect_p.h
rename to tier1/kwidgetsaddons/src/kcharselect_p.h
index 8f32c9b..c96b9df 100644
--- a/staging/kde4attic/src/kcharselect_p.h
+++ b/tier1/kwidgetsaddons/src/kcharselect_p.h
@@ -172,7 +172,7 @@ public:
QStringList mimeTypes() const
{
QStringList types;
- types << "text/plain";
+ types << QStringLiteral("text/plain");
return types;
}
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int \
column, const QModelIndex &parent)
diff --git a/staging/kde4attic/src/kcharselectdata.cpp \
b/tier1/kwidgetsaddons/src/kcharselectdata.cpp similarity index 96%
rename from staging/kde4attic/src/kcharselectdata.cpp
rename to tier1/kwidgetsaddons/src/kcharselectdata.cpp
index b429403..0c285c2 100644
--- a/staging/kde4attic/src/kcharselectdata.cpp
+++ b/tier1/kwidgetsaddons/src/kcharselectdata.cpp
@@ -102,7 +102,7 @@ bool KCharSelectData::openDataFile()
if(!dataFile.isEmpty()) {
return true;
} else {
- QFile file(QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
"kcharselect/kcharselect-data")); + QFile \
file(QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
QStringLiteral("kcharselect/kcharselect-data"))); if \
(!file.open(QIODevice::ReadOnly)) { return false;
}
@@ -158,7 +158,7 @@ QString KCharSelectData::formatCode(ushort code, int length, \
const QString& pref {
QString s = QString::number(code, base).toUpper();
while (s.size() < length)
- s.prepend('0');
+ s.prepend(QLatin1Char('0'));
s.prepend(prefix);
return s;
}
@@ -260,7 +260,7 @@ QString KCharSelectData::name(const QChar& c)
if ((unicode >= 0x3400 && unicode <= 0x4DB5)
|| (unicode >= 0x4e00 && unicode <= 0x9fa5)) {
// || (unicode >= 0x20000 && unicode <= 0x2A6D6) // useless, since limited \
to 16 bit
- return "CJK UNIFIED IDEOGRAPH-" + QString::number(unicode, 16);
+ return QStringLiteral("CJK UNIFIED IDEOGRAPH-") + QString::number(unicode, \
16); } else if (c >= 0xac00 && c <= 0xd7af) {
/* compute hangul syllable name as per UAX #15 */
int SIndex = c.unicode() - SBase;
@@ -306,7 +306,7 @@ QString KCharSelectData::name(const QChar& c)
max = mid - 1;
else {
quint32 offset = qFromLittleEndian<quint32>(data + offsetBegin + \
mid*6 + 2);
- s = QString(dataFile.constData() + offset + 1);
+ s = QString::fromUtf8(dataFile.constData() + offset + 1);
break;
}
}
@@ -656,15 +656,15 @@ bool KCharSelectData::isCombining(const QChar &c)
QString KCharSelectData::display(const QChar &c, const QFont &font)
{
if (!isDisplayable(c)) {
- return QString("<b>") + tr("Non-printable") + "</b>";
+ return QStringLiteral("<b>") + tr("Non-printable") + QStringLiteral("</b>");
} else {
- QString s = QString("<font size=\"+4\" face=\"") + font.family() + "\">";
+ QString s = QStringLiteral("<font size=\"+4\" face=\"") + font.family() + \
QStringLiteral("\">"); if (isCombining(c)) {
s += displayCombining(c);
} else {
- s += "&#" + QString::number(c.unicode()) + ';';
+ s += QStringLiteral("&#") + QString::number(c.unicode()) + \
QLatin1Char(';'); }
- s += "</font>";
+ s += QStringLiteral("</font>");
return s;
}
}
@@ -681,8 +681,8 @@ QString KCharSelectData::displayCombining(const QChar &c)
* Eventually, it would be nice to determine whether the character
* combines to the left or to the right, etc.
*/
- QString s = " &#" + QString::number(c.unicode()) + "; " +
- " (ab&#" + QString::number(c.unicode()) + ";c)";
+ QString s = QStringLiteral(" &#") + QString::number(c.unicode()) + \
QStringLiteral("; ") + + QStringLiteral(" (ab&#") + \
QString::number(c.unicode()) + QStringLiteral(";c)"); return s;
}
@@ -740,7 +740,7 @@ QList<QChar> KCharSelectData::find(const QString& needle)
return returnRes;
}
- QRegExp regExp("^(|u\\+|U\\+|0x|0X)([A-Fa-f0-9]{4})$");
+ QRegExp regExp(QStringLiteral("^(|u\\+|U\\+|0x|0X)([A-Fa-f0-9]{4})$"));
foreach(const QString &s, searchStrings) {
if(regExp.exactMatch(s)) {
returnRes.append(regExp.cap(2).toInt(0, 16));
@@ -808,14 +808,14 @@ QStringList KCharSelectData::splitString(const QString& s)
int end = 0;
int length = s.length();
while (end < length) {
- while (end < length && (s[end].isLetterOrNumber() || s[end] == '+')) {
+ while (end < length && (s[end].isLetterOrNumber() || s[end] == \
QLatin1Char('+'))) { end++;
}
if (start != end) {
result.append(s.mid(start, end - start));
}
start = end;
- while (end < length && !(s[end].isLetterOrNumber() || s[end] == '+')) {
+ while (end < length && !(s[end].isLetterOrNumber() || s[end] == \
QLatin1Char('+'))) { end++;
start++;
}
@@ -846,7 +846,7 @@ Index KCharSelectData::createIndex(const QByteArray& dataFile)
for (int pos = 0; pos <= max; pos++) {
const quint16 unicode = qFromLittleEndian<quint16>(udata + nameOffsetBegin + \
pos*6);
quint32 offset = qFromLittleEndian<quint32>(udata + nameOffsetBegin + pos*6 \
+ 2);
- appendToIndex(&i, unicode, QString(data + offset + 1));
+ appendToIndex(&i, unicode, QString::fromUtf8(data + offset + 1));
}
// details
diff --git a/staging/kde4attic/src/kcharselectdata_p.h \
b/tier1/kwidgetsaddons/src/kcharselectdata_p.h similarity index 98%
rename from staging/kde4attic/src/kcharselectdata_p.h
rename to tier1/kwidgetsaddons/src/kcharselectdata_p.h
index 25bcd75..f0b35ff 100644
--- a/staging/kde4attic/src/kcharselectdata_p.h
+++ b/tier1/kwidgetsaddons/src/kcharselectdata_p.h
@@ -35,7 +35,7 @@ typedef QMap<QString, QVector<quint16> > Index;
class KCharSelectData
{
public:
- QString formatCode(ushort code, int length = 4, const QString& prefix = "U+", \
int base = 16); + QString formatCode(ushort code, int length = 4, const QString& \
prefix = QStringLiteral("U+"), int base = 16);
QList<QChar> blockContents(int block);
QList<int> sectionContents(int section);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic