khtml_iface.cc
00001 00002 #include "khtml_iface.h" 00003 #include "khtml_part.h" 00004 #include "khtml_ext.h" 00005 #include <kio/global.h> 00006 #include <qvariant.h> 00007 00008 KHTMLPartIface::KHTMLPartIface( KHTMLPart *_part ) 00009 : DCOPObject( _part->dcopObjectId() ), part(_part) 00010 { 00011 00012 } 00013 00014 void KHTMLPartIface::setJScriptEnabled( bool enable ) 00015 { 00016 part->setJScriptEnabled(enable); 00017 } 00018 00019 bool KHTMLPartIface::jScriptEnabled() const 00020 { 00021 return part->jScriptEnabled(); 00022 } 00023 00024 KHTMLPartIface::~KHTMLPartIface() 00025 { 00026 00027 } 00028 00029 bool KHTMLPartIface::closeURL() 00030 { 00031 return part->closeURL(); 00032 } 00033 00034 bool KHTMLPartIface::metaRefreshEnabled() const 00035 { 00036 return part->metaRefreshEnabled(); 00037 } 00038 00039 void KHTMLPartIface::setDNDEnabled( bool b ) 00040 { 00041 part->setDNDEnabled(b); 00042 } 00043 00044 bool KHTMLPartIface::dndEnabled() const 00045 { 00046 return part->dndEnabled(); 00047 } 00048 00049 void KHTMLPartIface::setJavaEnabled( bool enable ) 00050 { 00051 part->setJavaEnabled( enable ); 00052 } 00053 00054 bool KHTMLPartIface::javaEnabled() const 00055 { 00056 return part->javaEnabled(); 00057 } 00058 00059 void KHTMLPartIface::setPluginsEnabled( bool enable ) 00060 { 00061 part->setPluginsEnabled( enable ); 00062 } 00063 00064 bool KHTMLPartIface::pluginsEnabled() const 00065 { 00066 return part->pluginsEnabled(); 00067 } 00068 00069 void KHTMLPartIface::setAutoloadImages( bool enable ) 00070 { 00071 part->setAutoloadImages( enable ); 00072 } 00073 00074 bool KHTMLPartIface::autoloadImages() const 00075 { 00076 return part->autoloadImages(); 00077 } 00078 00079 void KHTMLPartIface::setOnlyLocalReferences(bool enable) 00080 { 00081 part->setOnlyLocalReferences(enable); 00082 } 00083 00084 void KHTMLPartIface::setMetaRefreshEnabled( bool enable ) 00085 { 00086 part->setMetaRefreshEnabled(enable); 00087 } 00088 00089 bool KHTMLPartIface::onlyLocalReferences() const 00090 { 00091 return part->onlyLocalReferences(); 00092 } 00093 00094 bool KHTMLPartIface::setEncoding( const QString &name ) 00095 { 00096 return part->setEncoding(name); 00097 } 00098 00099 QString KHTMLPartIface::encoding() const 00100 { 00101 return part->encoding(); 00102 } 00103 00104 void KHTMLPartIface::setFixedFont( const QString &name ) 00105 { 00106 part->setFixedFont(name); 00107 00108 } 00109 bool KHTMLPartIface::gotoAnchor( const QString &name ) 00110 { 00111 return part->gotoAnchor(name); 00112 } 00113 00114 void KHTMLPartIface::selectAll() 00115 { 00116 part->selectAll(); 00117 } 00118 00119 QString KHTMLPartIface::lastModified() const 00120 { 00121 return part->lastModified(); 00122 } 00123 00124 void KHTMLPartIface::debugRenderTree() 00125 { 00126 part->slotDebugRenderTree(); 00127 } 00128 00129 void KHTMLPartIface::viewDocumentSource() 00130 { 00131 part->slotViewDocumentSource(); 00132 } 00133 00134 void KHTMLPartIface::saveBackground(const QString &destination) 00135 { 00136 KURL back = part->backgroundURL(); 00137 if (back.isEmpty()) 00138 return; 00139 00140 KIO::MetaData metaData; 00141 metaData["referrer"] = part->referrer(); 00142 KHTMLPopupGUIClient::saveURL( back, destination, metaData ); 00143 } 00144 00145 void KHTMLPartIface::saveDocument(const QString &destination) 00146 { 00147 KURL srcURL( part->url() ); 00148 00149 if ( srcURL.fileName(false).isEmpty() ) 00150 srcURL.setFileName( "index.html" ); 00151 00152 KIO::MetaData metaData; 00153 // Referre unknown? 00154 KHTMLPopupGUIClient::saveURL( srcURL, destination, metaData, part->cacheId() ); 00155 } 00156 00157 void KHTMLPartIface::setUserStyleSheet(const QString &styleSheet) 00158 { 00159 part->setUserStyleSheet(styleSheet); 00160 } 00161 00162 QString KHTMLPartIface::selectedText() const 00163 { 00164 return part->selectedText(); 00165 } 00166 00167 void KHTMLPartIface::viewFrameSource() 00168 { 00169 part->slotViewFrameSource(); 00170 } 00171 00172 QString KHTMLPartIface::evalJS(const QString &script) { 00173 return part->executeScript(script).toString(); 00174 }