summaryrefslogtreecommitdiffstats
path: root/konq-plugins/webarchiver/archivedialog.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:22:56 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:22:56 +0000
commit7346aee26bf190a7e70333c40fab4caca847cd27 (patch)
tree4b019b434f88dcc3eeaafe1d3f26240b4c4718e8 /konq-plugins/webarchiver/archivedialog.cpp
parent23a3d3aa5b44cbdf305495919866d9dbf4f6da54 (diff)
downloadtdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.tar.gz
tdeaddons-7346aee26bf190a7e70333c40fab4caca847cd27.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1157634 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/webarchiver/archivedialog.cpp')
-rw-r--r--konq-plugins/webarchiver/archivedialog.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/konq-plugins/webarchiver/archivedialog.cpp b/konq-plugins/webarchiver/archivedialog.cpp
index 71390c2..a28da2c 100644
--- a/konq-plugins/webarchiver/archivedialog.cpp
+++ b/konq-plugins/webarchiver/archivedialog.cpp
@@ -19,7 +19,7 @@
*/
#include "archivedialog.h"
-#include <qwidget.h>
+#include <tqwidget.h>
#include <khtml_part.h>
#include "archiveviewbase.h"
#include <kinstance.h>
@@ -35,21 +35,21 @@
#include <kdebug.h>
#include <kgenericfactory.h>
#include <kactivelabel.h>
-#include <qstylesheet.h>
-#include <qiodevice.h>
+#include <tqstylesheet.h>
+#include <tqiodevice.h>
#include <klistview.h>
#include <kio/job.h>
#include <kapplication.h>
#include <kurllabel.h>
#include <kprogress.h>
#include <kstringhandler.h>
-#include <qpushbutton.h>
+#include <tqpushbutton.h>
#undef DEBUG_WAR
#define CONTENT_TYPE "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">"
-ArchiveDialog::ArchiveDialog(QWidget *parent, const QString &filename,
+ArchiveDialog::ArchiveDialog(TQWidget *parent, const TQString &filename,
KHTMLPart *part) :
KDialogBase(parent, "WebArchiveDialog", false, i18n("Web Archiver"),
KDialogBase::Ok | KDialogBase::Cancel | KDialogBase::User1 ),
@@ -59,8 +59,8 @@ ArchiveDialog::ArchiveDialog(QWidget *parent, const QString &filename,
setMainWidget(m_widget);
setWFlags(getWFlags() | WDestructiveClose);
- m_widget->urlLabel->setText(QString("<a href=\"")+m_url.url()+"\">"+KStringHandler::csqueeze( m_url.url(), 80 )+"</a>");
- m_widget->targetLabel->setText(QString("<a href=\"")+filename+"\">"+KStringHandler::csqueeze( filename, 80 )+"</a>");
+ m_widget->urlLabel->setText(TQString("<a href=\"")+m_url.url()+"\">"+KStringHandler::csqueeze( m_url.url(), 80 )+"</a>");
+ m_widget->targetLabel->setText(TQString("<a href=\"")+filename+"\">"+KStringHandler::csqueeze( filename, 80 )+"</a>");
if(part->document().ownerDocument().isNull())
m_document = part->document();
@@ -83,12 +83,12 @@ void ArchiveDialog::archive()
kdDebug(90110) << "Web Archive opened " << endl;
#endif
- m_linkDict.insert(QString("index.html"), QString(""));
+ m_linkDict.insert(TQString("index.html"), TQString(""));
saveFile("index.html");
} else {
- const QString title = i18n( "Unable to Open Web-Archive" );
- const QString text = i18n( "Unable to open \n %1 \n for writing." ).arg(m_tarBall->fileName());
+ const TQString title = i18n( "Unable to Open Web-Archive" );
+ const TQString text = i18n( "Unable to open \n %1 \n for writing." ).arg(m_tarBall->fileName());
KMessageBox::sorry( 0L, text, title );
}
}
@@ -100,15 +100,15 @@ ArchiveDialog::~ArchiveDialog()
/* Store the HTMLized DOM-Tree to a temporary file and add it to the Tar-Ball */
-void ArchiveDialog::saveFile( const QString&)
+void ArchiveDialog::saveFile( const TQString&)
{
KTempFile tmpFile;
if (!(tmpFile.status())) {
- QString temp;
+ TQString temp;
m_state=Retrieving;
- QTextStream *tempStream = new QTextStream(&temp, IO_ReadOnly);
+ TQTextStream *tempStream = new TQTextStream(&temp, IO_ReadOnly);
saveToArchive(tempStream);
@@ -122,8 +122,8 @@ void ArchiveDialog::saveFile( const QString&)
downloadNext();
} else {
- const QString title = i18n( "Could Not Open Temporary File" );
- const QString text = i18n( "Could not open a temporary file" );
+ const TQString title = i18n( "Could Not Open Temporary File" );
+ const TQString text = i18n( "Could not open a temporary file" );
KMessageBox::sorry( 0, text, title );
}
}
@@ -131,8 +131,8 @@ void ArchiveDialog::saveFile( const QString&)
void ArchiveDialog::setSavingState()
{
KTempFile tmpFile;
- QTextStream* textStream = tmpFile.textStream();
- textStream->setEncoding(QTextStream::UnicodeUTF8);
+ TQTextStream* textStream = tmpFile.textStream();
+ textStream->setEncoding(TQTextStream::UnicodeUTF8);
m_widget->progressBar->setProgress(m_widget->progressBar->totalSteps());
@@ -141,10 +141,10 @@ void ArchiveDialog::setSavingState()
tmpFile.close();
- QString fileName="index.html";
- QFile file(tmpFile.name());
+ TQString fileName="index.html";
+ TQFile file(tmpFile.name());
file.open(IO_ReadOnly);
- m_tarBall->writeFile(fileName, QString::null, QString::null, file.size(), file.readAll());
+ m_tarBall->writeFile(fileName, TQString::null, TQString::null, file.size(), file.readAll());
#ifdef DEBUG_WAR
kdDebug(90110) << "HTML-file written: " << fileName << endl;
#endif
@@ -164,7 +164,7 @@ void ArchiveDialog::setSavingState()
/* Recursively travers the DOM-Tree */
-void ArchiveDialog::saveToArchive(QTextStream* _textStream)
+void ArchiveDialog::saveToArchive(TQTextStream* _textStream)
{
if (!_textStream) return;
@@ -182,7 +182,7 @@ void ArchiveDialog::saveToArchive(QTextStream* _textStream)
}
}
-static bool hasAttribute(const DOM::Node &pNode, const QString &attrName, const QString &attrValue)
+static bool hasAttribute(const DOM::Node &pNode, const TQString &attrName, const TQString &attrValue)
{
const DOM::Element element = (const DOM::Element) pNode;
DOM::Attr attr;
@@ -197,7 +197,7 @@ static bool hasAttribute(const DOM::Node &pNode, const QString &attrName, const
return false;
}
-static bool hasChildNode(const DOM::Node &pNode, const QString &nodeName)
+static bool hasChildNode(const DOM::Node &pNode, const TQString &nodeName)
{
DOM::Node child;
try
@@ -222,12 +222,12 @@ static bool hasChildNode(const DOM::Node &pNode, const QString &nodeName)
/* Transform DOM-Tree to HTML */
void ArchiveDialog::saveArchiveRecursive(const DOM::Node &pNode, const KURL& baseURL,
- QTextStream* _textStream, int indent)
+ TQTextStream* _textStream, int indent)
{
- const QString nodeNameOrig(pNode.nodeName().string());
- const QString nodeName(pNode.nodeName().string().upper());
- QString text;
- QString strIndent;
+ const TQString nodeNameOrig(pNode.nodeName().string());
+ const TQString nodeName(pNode.nodeName().string().upper());
+ TQString text;
+ TQString strIndent;
strIndent.fill(' ', indent);
const DOM::Element element = (const DOM::Element) pNode;
DOM::Node child;
@@ -253,8 +253,8 @@ void ArchiveDialog::saveArchiveRecursive(const DOM::Node &pNode, const KURL& bas
text = strIndent;
}
text += "<" + nodeNameOrig;
- QString attributes;
- QString attrNameOrig, attrName, attrValue;
+ TQString attributes;
+ TQString attrNameOrig, attrName, attrValue;
DOM::Attr attr;
DOM::NamedNodeMap attrs = element.attributes();
unsigned long lmap = attrs.length();
@@ -284,7 +284,7 @@ void ArchiveDialog::saveArchiveRecursive(const DOM::Node &pNode, const KURL& bas
((nodeName == "IMG" || nodeName == "INPUT" || nodeName == "SCRIPT") && attrName == "SRC") ||
((nodeName == "BODY" || nodeName == "TABLE" || nodeName == "TH" || nodeName == "TD") && attrName == "BACKGROUND")) {
// Some people use carriage return in file names and browsers support that!
- attrValue = handleLink(baseURL, attrValue.replace(QRegExp("\\s"), ""));
+ attrValue = handleLink(baseURL, attrValue.replace(TQRegExp("\\s"), ""));
}
/*
* ## Make recursion level configurable
@@ -313,18 +313,18 @@ void ArchiveDialog::saveArchiveRecursive(const DOM::Node &pNode, const KURL& bas
}
}
} else {
- const QString& nodeValue(pNode.nodeValue().string());
+ const TQString& nodeValue(pNode.nodeValue().string());
if (!(nodeValue.isEmpty())) {
// Don't escape < > in JS or CSS
- QString parentNodeName = pNode.parentNode().nodeName().string().upper();
+ TQString parentNodeName = pNode.parentNode().nodeName().string().upper();
if (parentNodeName == "STYLE") {
text = analyzeInternalCSS(baseURL, pNode.nodeValue().string());
} else if (m_bPreserveWS) {
- text = QStyleSheet::escape(pNode.nodeValue().string());
+ text = TQStyleSheet::escape(pNode.nodeValue().string());
} else if (parentNodeName == "SCRIPT") {
text = pNode.nodeValue().string();
} else {
- text = strIndent + QStyleSheet::escape(pNode.nodeValue().string());
+ text = strIndent + TQStyleSheet::escape(pNode.nodeValue().string());
}
}
}
@@ -392,11 +392,11 @@ void ArchiveDialog::saveArchiveRecursive(const DOM::Node &pNode, const KURL& bas
/* Extract the URL, download it's content and return an unique name for the link */
-QString ArchiveDialog::handleLink(const KURL& _url, const QString& _link)
+TQString ArchiveDialog::handleLink(const KURL& _url, const TQString& _link)
{
KURL url(getAbsoluteURL(_url, _link));
- QString tarFileName;
+ TQString tarFileName;
if (kapp->authorizeURLAction("redirect", _url, url))
{
if (m_state==Retrieving)
@@ -422,7 +422,7 @@ void ArchiveDialog::downloadNext()
#ifdef DEBUG_WAR
kdDebug(90110) << "URL : " << url.url() << endl;
#endif
- QString tarFileName;
+ TQString tarFileName;
// Only download file once
if (m_downloadedURLDict.contains(url.url())) {
@@ -440,15 +440,15 @@ void ArchiveDialog::downloadNext()
delete m_tmpFile;
m_tmpFile=new KTempFile();
m_tmpFile->close();
- QFile::remove(m_tmpFile->name());
+ TQFile::remove(m_tmpFile->name());
kdDebug(90110) << "downloading: " << url.url() << " to: " << m_tmpFile->name() << endl;
KURL dsturl;
dsturl.setPath(m_tmpFile->name());
KIO::Job *job=KIO::file_copy(url, dsturl, -1, false, false, false);
job->addMetaData("cache", "cache"); // Use entry from cache if available.
- connect(job, SIGNAL(result( KIO::Job *)), this, SLOT(finishedDownloadingURL( KIO::Job *)) );
+ connect(job, TQT_SIGNAL(result( KIO::Job *)), this, TQT_SLOT(finishedDownloadingURL( KIO::Job *)) );
- m_currentLVI=new QListViewItem(m_widget->listView, url.prettyURL());
+ m_currentLVI=new TQListViewItem(m_widget->listView, url.prettyURL());
m_widget->listView->insertItem( m_currentLVI );
m_currentLVI->setText(1,i18n("Downloading"));
}
@@ -461,7 +461,7 @@ void ArchiveDialog::finishedDownloadingURL( KIO::Job *job )
{
if ( job->error() )
{
-// QString s=job->errorString();
+// TQString s=job->errorString();
m_currentLVI->setText(1,i18n("Error"));
}
else
@@ -472,12 +472,12 @@ void ArchiveDialog::finishedDownloadingURL( KIO::Job *job )
KURL url=m_urlsToDownload[m_iterator];
- QString tarFileName = getUniqueFileName(url.fileName());
+ TQString tarFileName = getUniqueFileName(url.fileName());
// Add file to Tar-Ball
- QFile file(m_tmpFile->name());
+ TQFile file(m_tmpFile->name());
file.open(IO_ReadOnly);
- m_tarBall->writeFile(tarFileName, QString::null, QString::null, file.size(), file.readAll());
+ m_tarBall->writeFile(tarFileName, TQString::null, TQString::null, file.size(), file.readAll());
file.close();
m_tmpFile->unlink();
delete m_tmpFile;
@@ -486,7 +486,7 @@ void ArchiveDialog::finishedDownloadingURL( KIO::Job *job )
// Add URL to downloaded URLs
m_downloadedURLDict.insert(url.url(), tarFileName);
- m_linkDict.insert(tarFileName, QString(""));
+ m_linkDict.insert(tarFileName, TQString(""));
m_iterator++;
downloadNext();
@@ -494,7 +494,7 @@ void ArchiveDialog::finishedDownloadingURL( KIO::Job *job )
/* Create an absolute URL for download */
-KURL ArchiveDialog::getAbsoluteURL(const KURL& _url, const QString& _link)
+KURL ArchiveDialog::getAbsoluteURL(const KURL& _url, const TQString& _link)
{
// Does all the magic for me
return KURL(_url, _link);
@@ -502,31 +502,31 @@ KURL ArchiveDialog::getAbsoluteURL(const KURL& _url, const QString& _link)
/* Adds an id to a fileName to make it unique relative to the Tar-Ball */
-QString ArchiveDialog::getUniqueFileName(const QString& fileName)
+TQString ArchiveDialog::getUniqueFileName(const TQString& fileName)
{
// Name clash -> add unique id
static int id=2;
- QString uniqueFileName(fileName);
+ TQString uniqueFileName(fileName);
#ifdef DEBUG_WAR
kdDebug(90110) << "getUniqueFileName(..): [" << fileName << "]" << endl;
#endif
while (uniqueFileName.isEmpty() || m_linkDict.contains(uniqueFileName))
- uniqueFileName = QString::number(id++) + fileName;
+ uniqueFileName = TQString::number(id++) + fileName;
return uniqueFileName;
}
/* Search for Images in CSS, extract them and adjust CSS */
-QString ArchiveDialog::analyzeInternalCSS(const KURL& _url, const QString& string)
+TQString ArchiveDialog::analyzeInternalCSS(const KURL& _url, const TQString& string)
{
#ifdef DEBUG_WAR
kdDebug () << "analyzeInternalCSS" << endl;
#endif
- QString str(string);
+ TQString str(string);
int pos = 0;
int startUrl = 0;
int endUrl = 0;
@@ -543,7 +543,7 @@ QString ArchiveDialog::analyzeInternalCSS(const KURL& _url, const QString& strin
endUrl = pos;
if (str[pos-1]=='"' || str[pos-1]=='\'') // CSS 'feature'
endUrl--;
- QString url = str.mid(startUrl, endUrl-startUrl);
+ TQString url = str.mid(startUrl, endUrl-startUrl);
#ifdef DEBUG_WAR
kdDebug () << "url: " << url << endl;