本文整理汇总了C++中KBookmark::internalElement方法的典型用法代码示例。如果您正苦于以下问题:C++ KBookmark::internalElement方法的具体用法?C++ KBookmark::internalElement怎么用?C++ KBookmark::internalElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KBookmark
的用法示例。
在下文中一共展示了KBookmark::internalElement方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotProperties
void KonqSidebarBookmarkModule::slotProperties(KonqSidebarBookmarkItem *bi)
{
if (!bi) {
bi = dynamic_cast<KonqSidebarBookmarkItem*>( tree()->selectedItem() );
if (!bi)
return;
}
KBookmark bookmark = bi->bookmark();
QString folder = bookmark.isGroup() ? QString::null : bookmark.url().pathOrURL();
BookmarkEditDialog dlg( bookmark.fullText(), folder, 0, 0,
i18n("Bookmark Properties") );
if ( dlg.exec() != KDialogBase::Accepted )
return;
makeTextNodeMod(bookmark, "title", dlg.finalTitle());
if ( !dlg.finalUrl().isNull() )
{
KURL u = KURL::fromPathOrURL(dlg.finalUrl());
bookmark.internalElement().setAttribute("href", u.url(0, 106));
}
KBookmarkGroup parentBookmark = bookmark.parentGroup();
KonqBookmarkManager::self()->emitChanged( parentBookmark );
}
示例2: undo
void EditCommand::undo()
{
kDebug() << "Setting old value" << mOldValue << "in bk" << mAddress << "col" << mCol;
KBookmark bk = m_model->bookmarkManager()->findByAddress(mAddress);
if(mCol==-2)
{
bk.internalElement().setAttribute("toolbar", mOldValue);
}
else if(mCol==-1)
{
bk.setIcon(mOldValue);
}
else if(mCol==0)
{
bk.setFullText(mOldValue);
}
else if(mCol==1)
{
bk.setUrl(KUrl(mOldValue));
}
else if(mCol==2)
{
bk.setDescription(mOldValue);
}
m_model->emitDataChanged(bk);
}
示例3: makeTextNodeMod
void makeTextNodeMod(KBookmark bk, const QString &m_nodename, const QString &m_newText) {
QDomNode subnode = bk.internalElement().namedItem(m_nodename);
if (subnode.isNull()) {
subnode = bk.internalElement().ownerDocument().createElement(m_nodename);
bk.internalElement().appendChild(subnode);
}
if (subnode.firstChild().isNull()) {
QDomText domtext = subnode.ownerDocument().createTextNode("");
subnode.appendChild(domtext);
}
QDomText domtext = subnode.firstChild().toText();
QString m_oldText = domtext.data();
domtext.setData(m_newText);
}
示例4: redo
void DeleteCommand::redo()
{
KBookmark bk = m_model->bookmarkManager()->findByAddress(m_from);
Q_ASSERT(!bk.isNull());
if (m_contentOnly) {
QDomElement groupRoot = bk.internalElement();
QDomNode n = groupRoot.firstChild();
while (!n.isNull()) {
QDomElement e = n.toElement();
if (!e.isNull()) {
// kDebug() << e.tagName();
}
QDomNode next = n.nextSibling();
groupRoot.removeChild(n);
n = next;
}
return;
}
// TODO - bug - unparsed xml is lost after undo,
// we must store it all therefore
//FIXME this removes the comments, that's bad!
if (!m_cmd) {
if (bk.isGroup()) {
m_cmd = new CreateCommand(m_model,
m_from, bk.fullText(), bk.icon(),
bk.internalElement().attribute("folded") == "no");
m_subCmd = deleteAll(m_model, bk.toGroup());
m_subCmd->redo();
} else {
m_cmd = (bk.isSeparator())
? new CreateCommand(m_model, m_from)
: new CreateCommand(m_model, m_from, bk.fullText(),
bk.icon(), bk.url());
}
}
m_cmd->undo();
}