本文整理汇总了C++中dom::Element::elementId方法的典型用法代码示例。如果您正苦于以下问题:C++ Element::elementId方法的具体用法?C++ Element::elementId怎么用?C++ Element::elementId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dom::Element
的用法示例。
在下文中一共展示了Element::elementId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotPopupMenu
/*
we just simplify the process. if we use KParts::BrowserExtension, we have to do
lots extra work, adding so much classes. so just hack like following.
grab useful code from TDEHTMLPopupGUIClient(tdehtml_ext.cpp),
and change a little bit to fit our needs
*/
void EvaChatView::slotPopupMenu( const TQString & _url, const TQPoint & point )
{
menu->clear();
bool isImage = false;
bool hasSelection = TDEHTMLPart::hasSelection();
KURL url = KURL(_url);
if(d) delete d;
d = new MenuPrivateData;
d->m_url = url;
DOM::Element e = nodeUnderMouse();
if ( !e.isNull() && (e.elementId() == ID_IMG) ) {
DOM::HTMLImageElement ie = static_cast<DOM::HTMLImageElement>(e);
TQString src = ie.src().string();
d->m_imageURL = KURL(src);
d->m_suggestedFilename = src.right(src.length() - src.findRev("/") -1);
isImage=true;
}
TDEAction *action = 0L;
if(hasSelection) {
//action = new TDEAction( i18n( "&Copy Text" ), TDEShortcut("Ctrl+C"), this, SLOT( copy() ),
// actionCollection(), "copy" );
//action = KStdAction::copy( browserExtension(), SLOT(copy()), actionCollection(), "copy");
//action->setText(i18n("&Copy Text"));
//action->setEnabled(true);
copyAction->plug(menu);
// search text
TQString selectedText = TDEHTMLPart::selectedText();
if ( selectedText.length()>18 ) {
selectedText.truncate(15);
selectedText+="...";
}
#ifdef HAS_KONTQUEROR
// Fill search provider entries
TDEConfig config("kuriikwsfilterrc");
config.setGroup("General");
const TQString defaultEngine = config.readEntry("DefaultSearchEngine", "google");
const char keywordDelimiter = config.readNumEntry("KeywordDelimiter", ':');
// default search provider
KService::Ptr service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").arg(defaultEngine));
// search provider icon
TQPixmap icon;
KURIFilterData data;
TQStringList list;
const TQString defaultSearchProviderPrefix = *(service->property("Keys").toStringList().begin()) + keywordDelimiter;
data.setData( defaultSearchProviderPrefix + TQString("some keyword") );
list << "kurisearchfilter" << "kuriikwsfilter";
TQString name;
if ( KURIFilter::self()->filterURI(data, list) ) {
TQString iconPath = locate("cache", KMimeType::favIconForURL(data.uri()) + ".png");
if ( iconPath.isEmpty() )
icon = SmallIcon("edit-find");
else
icon = TQPixmap( iconPath );
name = service->name();
} else {
icon = SmallIcon("google");
name = "Google";
}
action = new TDEAction( i18n( "Search '%1' at %2" ).arg( selectedText ).arg( name ), icon, 0, this,
SLOT( searchProvider() ), actionCollection(), "searchProvider" );
action->plug(menu);
// favorite search providers
TQStringList favoriteEngines;
favoriteEngines = config.readListEntry("FavoriteSearchEngines"); // for KDE 3.2 API compatibility
if(favoriteEngines.isEmpty())
favoriteEngines << "google" << "google_groups" << "google_news" << "webster" << "dmoz" << "wikipedia";
if ( !favoriteEngines.isEmpty()) {
TDEActionMenu* providerList = new TDEActionMenu( i18n( "Search '%1' At" ).arg( selectedText ), actionCollection(), "searchProviderList" );
bool hasSubMenus = false;
TQStringList::ConstIterator it = favoriteEngines.begin();
for ( ; it != favoriteEngines.end(); ++it ) {
if (*it==defaultEngine)
continue;
service = KService::serviceByDesktopPath(TQString("searchproviders/%1.desktop").arg(*it));
if (!service)
continue;
//.........这里部分代码省略.........