MCPcopy Create free account
hub / github.com/KDE/kdiff3 / insertCodec

Method insertCodec

src/difftextwindow.cpp:2184–2200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2182}
2183
2184void EncodingLabel::insertCodec(const QString& visibleCodecName, const QByteArray& nameArray, QList<QByteArray>& codecList, QMenu* pMenu, const QByteArray& currentTextCodecName) const
2185{
2186 if(!codecList.contains(nameArray))
2187 {
2188 QAction* pAction = new QAction(pMenu); // menu takes ownership, so deleting the menu deletes the action too.
2189 const QLatin1String codecName = QLatin1String(nameArray);
2190
2191 pAction->setText(visibleCodecName.isEmpty() ? codecName : visibleCodecName + u8" (" + codecName + u8")");
2192 pAction->setData(nameArray);
2193 pAction->setCheckable(true);
2194 if(currentTextCodecName == nameArray)
2195 pAction->setChecked(true);
2196 pMenu->addAction(pAction);
2197 chk_connect_a(pAction, &QAction::triggered, this, &EncodingLabel::slotSelectEncoding);
2198 codecList.append(nameArray);
2199 }
2200}
2201
2202void EncodingLabel::slotSelectEncoding()
2203{

Callers

nothing calls this directly

Calls 4

setTextMethod · 0.80
setDataMethod · 0.80
appendMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected