Changeset View
Changeset View
Standalone View
Standalone View
src/cataloglistview/catalogmodel.cpp
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Line(s) | 160 | } else if (role == Qt::UserRole) { | |||
---|---|---|---|---|---|
165 | case IsModified: return m_catalog->isModified(index.row()); | 165 | case IsModified: return m_catalog->isModified(index.row()); | ||
166 | case IsPlural: return m_catalog->isPlural(index.row()); | 166 | case IsPlural: return m_catalog->isPlural(index.row()); | ||
167 | default: role = Qt::DisplayRole; | 167 | default: role = Qt::DisplayRole; | ||
168 | } | 168 | } | ||
169 | } else if (role == StringFilterRole) { //exclude UI strings | 169 | } else if (role == StringFilterRole) { //exclude UI strings | ||
170 | if (index.column() >= TranslationStatus) | 170 | if (index.column() >= TranslationStatus) | ||
171 | return QVariant(); | 171 | return QVariant(); | ||
172 | else if (index.column() == Source || index.column() == Target) { | 172 | else if (index.column() == Source || index.column() == Target) { | ||
173 | static const DocPosition::Part parts[] = {DocPosition::Source, DocPosition::Target}; | 173 | QString str = index.column() == Source ? m_catalog->msgidWithPlurals(index.row()) : m_catalog->msgstrWithPlurals(index.row()); | ||
174 | QString str = m_catalog->catalogString(DocPosition(index.row(), parts[index.column() == Target])).string; | | |||
175 | return m_ignoreAccel ? str.remove(Project::instance()->accel()) : str; | 174 | return m_ignoreAccel ? str.remove(Project::instance()->accel()) : str; | ||
176 | } | 175 | } | ||
177 | role = Qt::DisplayRole; | 176 | role = Qt::DisplayRole; | ||
178 | } | 177 | } | ||
179 | if (role != Qt::DisplayRole) | 178 | if (role != Qt::DisplayRole) | ||
180 | return QVariant(); | 179 | return QVariant(); | ||
181 | 180 | | |||
182 | 181 | | |||
183 | 182 | | |||
184 | switch (index.column()) { | 183 | switch (index.column()) { | ||
185 | case Key: return index.row() + 1; | 184 | case Key: return index.row() + 1; | ||
186 | case Source: return m_catalog->msgid(index.row()); | 185 | case Source: | ||
187 | case Target: return m_catalog->msgstr(index.row()); | 186 | return m_catalog->msgidWithPlurals(index.row()); | ||
187 | case Target: | ||||
188 | return m_catalog->msgstrWithPlurals(index.row()); | ||||
188 | case Notes: { | 189 | case Notes: { | ||
189 | QString result; | 190 | QString result; | ||
190 | foreach (const Note ¬e, m_catalog->notes(index.row())) | 191 | foreach (const Note ¬e, m_catalog->notes(index.row())) | ||
191 | result += note.content; | 192 | result += note.content; | ||
192 | return result; | 193 | return result; | ||
193 | } | 194 | } | ||
194 | case Context: return m_catalog->context(index.row()); | 195 | case Context: return m_catalog->context(index.row()); | ||
195 | case TranslationStatus: | 196 | case TranslationStatus: | ||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |