KHTML
khtml_childframe.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 * 00003 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 00004 * 1999-2001 Lars Knoll <knoll@kde.org> 00005 * 1999-2001 Antti Koivisto <koivisto@kde.org> 00006 * 2000-2001 Simon Hausmann <hausmann@kde.org> 00007 * 2000-2001 Dirk Mueller <mueller@kde.org> 00008 * 2000 Stefan Schimanski <1Stein@gmx.de> 00009 * 2001-2005 George Staikos <staikos@kde.org> 00010 * 2010 Maksim Orlovich <maksim@kde.org> 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Library General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 2 of the License, or (at your option) any later version. 00016 * 00017 * This library is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Library General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU Library General Public License 00023 * along with this library; see the file COPYING.LIB. If not, write to 00024 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00025 * Boston, MA 02110-1301, USA. 00026 */ 00027 #include "khtml_childframe_p.h" 00028 #include "khtmlpart_p.h" 00029 #include "khtml_part.h" 00030 00031 namespace khtml { 00032 00033 ChildFrame::ChildFrame() : QObject (0) { 00034 setObjectName( "khtml_child_frame" ); 00035 m_jscript = 0L; 00036 m_bCompleted = false; m_bPreloaded = false; m_type = Frame; m_bNotify = false; 00037 m_bPendingRedirection = false; 00038 } 00039 00040 ChildFrame::~ChildFrame() { 00041 if (m_run) 00042 m_run.data()->abort(); 00043 delete m_jscript; 00044 } 00045 00046 const char* ChildFrame::typeString() const 00047 { 00048 switch (m_type) { 00049 case khtml::ChildFrame::Frame: 00050 return "frame"; 00051 case khtml::ChildFrame::IFrame: 00052 return "iframe"; 00053 case khtml::ChildFrame::Object: 00054 return "object"; 00055 default: 00056 return "HUH???"; 00057 } 00058 } 00059 00060 static QDebug& ind(const QDebug& dbgIn, int ind) 00061 { 00062 QDebug& dbg = const_cast<QDebug&>(dbgIn); 00063 00064 for (int i = 0; i < ind; ++i) 00065 dbg << " "; 00066 return dbg; 00067 } 00068 00069 void ChildFrame::dump(int i) 00070 { 00071 ind(qDebug(), i) << typeString() << m_name 00072 << this << m_part.data() 00073 << "url:" << (m_part.isNull() ? 00074 QString::fromLatin1("") : 00075 m_part->url().url()) 00076 << "el:" << (m_partContainerElement.isNull() ? 00077 QString::fromLatin1("") : 00078 DOM::getPrintableName(m_partContainerElement.data()->id())) 00079 << "sn:" << m_serviceName << "st:" << m_serviceType 00080 << "kr:" << m_run.data() << "comp:" << m_bCompleted; 00081 } 00082 00083 void ChildFrame::dumpFrameTree(KHTMLPart* part) 00084 { 00085 static int i = 0; 00086 00087 KHTMLPartPrivate* d = part->impl(); 00088 00089 if (!d->m_objects.isEmpty()) { 00090 ind(qDebug(), i) << "objects:"; 00091 i += 4; 00092 00093 for (QList<khtml::ChildFrame*>::Iterator io = d->m_objects.begin(); io != d->m_objects.end(); ++io) { 00094 khtml::ChildFrame* cf = (*io); 00095 cf->dump(i); 00096 if (KHTMLPart* p = ::qobject_cast<KHTMLPart*>(cf->m_part.data())) { 00097 i += 4; 00098 dumpFrameTree(p); 00099 i -= 4; 00100 } 00101 } 00102 i -= 4; 00103 } 00104 00105 if (!d->m_frames.isEmpty()) { 00106 ind(qDebug(), i) << "frames:"; 00107 i += 4; 00108 00109 for (QList<khtml::ChildFrame*>::Iterator ifr = d->m_frames.begin(); ifr != d->m_frames.end(); ++ifr) { 00110 khtml::ChildFrame* cf = (*ifr); 00111 cf->dump(i); 00112 if (KHTMLPart* p = ::qobject_cast<KHTMLPart*>(cf->m_part.data())) { 00113 i += 4; 00114 dumpFrameTree(p); 00115 i -= 4; 00116 } 00117 } 00118 i -= 4; 00119 } 00120 } 00121 00122 00123 } // namespace khtml 00124 00125 00126 KHTMLFrameList::Iterator KHTMLFrameList::find( const QString &name ) 00127 { 00128 Iterator it = begin(); 00129 const Iterator e = end(); 00130 00131 for (; it!=e; ++it ) 00132 if ( (*it)->m_name==name ) 00133 break; 00134 00135 return it; 00136 } 00137 00138 // kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
KDE 4.6 API Reference