diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
commit | dc6b8e72fed2586239e3514819238c520636c9d9 (patch) | |
tree | 88b200df0a0b7fab9d6f147596173556f1ed9a13 /quanta/project/projectupload.cpp | |
parent | 6927d4436e54551917f600b706a8d6109e49de1c (diff) | |
download | tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/project/projectupload.cpp')
-rw-r--r-- | quanta/project/projectupload.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/quanta/project/projectupload.cpp b/quanta/project/projectupload.cpp index e95f9446..ce621c07 100644 --- a/quanta/project/projectupload.cpp +++ b/quanta/project/projectupload.cpp @@ -18,20 +18,20 @@ //qt includes -#include <qlistview.h> -#include <qeventloop.h> -#include <qfileinfo.h> -#include <qlineedit.h> -#include <qpushbutton.h> -#include <qstringlist.h> -#include <qregexp.h> -#include <qlabel.h> -#include <qcombobox.h> -#include <qurl.h> -#include <qcheckbox.h> -#include <qtimer.h> -#include <qframe.h> -#include <qtooltip.h> +#include <tqlistview.h> +#include <tqeventloop.h> +#include <tqfileinfo.h> +#include <tqlineedit.h> +#include <tqpushbutton.h> +#include <tqstringlist.h> +#include <tqregexp.h> +#include <tqlabel.h> +#include <tqcombobox.h> +#include <tqurl.h> +#include <tqcheckbox.h> +#include <tqtimer.h> +#include <tqframe.h> +#include <tqtooltip.h> //kde includes #include <kapplication.h> @@ -62,7 +62,7 @@ #include "qextfileinfo.h" #include "resource.h" -ProjectUpload::ProjectUpload(const KURL& url, const QString& profileName, bool showOnlyProfiles, bool quickUpload, bool markOnly, const char* name) +ProjectUpload::ProjectUpload(const KURL& url, const TQString& profileName, bool showOnlyProfiles, bool quickUpload, bool markOnly, const char* name) :ProjectUploadS( 0L, name, false, Qt::WDestructiveClose) { m_quickUpload = quickUpload; @@ -83,7 +83,7 @@ ProjectUpload::ProjectUpload(const KURL& url, const QString& profileName, bool s { if (markOnly) markAsUploaded->setChecked(true); - QTimer::singleShot(10, this, SLOT(slotBuildTree())); + TQTimer::singleShot(10, this, TQT_SLOT(slotBuildTree())); currentItem = 0L; } } @@ -95,20 +95,20 @@ ProjectUpload::~ProjectUpload() delete baseUrl; } -void ProjectUpload::initProjectInfo(const QString& defaultProfile) +void ProjectUpload::initProjectInfo(const TQString& defaultProfile) { baseUrl = new KURL(); // list->setMultiSelection(true); - QDomDocument *dom = m_project->sessionDom(); + TQDomDocument *dom = m_project->sessionDom(); m_profilesNode = dom->firstChild().firstChild().namedItem("uploadprofiles"); if (m_profilesNode.isNull()) //compat code, remove when upgrade from 3.2 is not supported { m_currentProfileElement = dom->firstChild().firstChild().namedItem("upload").toElement(); m_defaultProfile = m_currentProfileElement.attribute("user","") + "@" + m_currentProfileElement.attribute("remote_host",""); - QDomElement e = dom->createElement("uploadprofiles"); + TQDomElement e = dom->createElement("uploadprofiles"); e.setAttribute("defaultProfile", m_defaultProfile); - QDomElement el = dom->createElement("profile"); + TQDomElement el = dom->createElement("profile"); el.setAttribute("remote_host", m_currentProfileElement.attribute("remote_host","")); el.setAttribute("user", m_currentProfileElement.attribute("user","")); el.setAttribute("remote_path", m_currentProfileElement.attribute("remote_path","")); @@ -128,10 +128,10 @@ void ProjectUpload::initProjectInfo(const QString& defaultProfile) m_defaultProfile = m_profilesNode.toElement().attribute("defaultProfile"); else m_defaultProfile = defaultProfile; - QDomNodeList profileList = m_profilesNode.toElement().elementsByTagName("profile"); - QDomElement e; + TQDomNodeList profileList = m_profilesNode.toElement().elementsByTagName("profile"); + TQDomElement e; m_currentProfileElement = profileList.item(0).toElement(); - QString s; + TQString s; int defaultIdx = 0; for (uint i = 0; i < profileList.count(); i++) { @@ -149,7 +149,7 @@ void ProjectUpload::initProjectInfo(const QString& defaultProfile) buttonRemoveProfile->setEnabled(comboProfile->count() > 1); keepPasswords->setChecked(m_project->keepPasswd); uploadInProgress = false; - connect( this, SIGNAL( uploadNext() ), SLOT( slotUploadNext() ) ); + connect( this, TQT_SIGNAL( uploadNext() ), TQT_SLOT( slotUploadNext() ) ); setProfileTooltip(); } @@ -159,12 +159,12 @@ void ProjectUpload::slotBuildTree() emit eventHappened("upload_requested", m_project->projectBaseURL().url(), ""); loadRemoteUploadInfo(); KIO::UDSEntry entry; - QString strUrl = QuantaCommon::qUrl(startUrl); + TQString strUrl = QuantaCommon::qUrl(startUrl); bool isDirectory = strUrl.endsWith("/"); bool forceUpload = !startUrl.isEmpty(); - QString s; - QDomElement el; - QDomNodeList nl = m_project->dom()->elementsByTagName("item"); + TQString s; + TQDomElement el; + TQDomNodeList nl = m_project->dom()->elementsByTagName("item"); totalProgress->setTotalSteps(nl.count() - 1 ); totalProgress->setValue(0); totalText->setText(i18n("Scanning project files...")); @@ -174,7 +174,7 @@ void ProjectUpload::slotBuildTree() { u = QExtFileInfo::toAbsolute(startUrl, u); } - QDict<KFileItem> projectDirFiles; + TQDict<KFileItem> projectDirFiles; if (startUrl.isEmpty() || strUrl.endsWith("/")) //upload a folder { @@ -184,7 +184,7 @@ void ProjectUpload::slotBuildTree() projectDirFiles.insert(u.url(), new KFileItem(KFileItem::Unknown, KFileItem::Unknown, u, true)); } - QTime t; + TQTime t; t.start(); u = m_project->projectBaseURL(); @@ -245,8 +245,8 @@ void ProjectUpload::slotBuildTree() void ProjectUpload::buildSelectedItemList() { - QListViewItem *item; - QListViewItemIterator it(list); + TQListViewItem *item; + TQListViewItemIterator it(list); toUpload.clear(); needsConfirmation.clear(); for ( ; it.current(); ++it ) @@ -274,7 +274,7 @@ void ProjectUpload::buildSelectedItemList() void ProjectUpload::initBaseUrl() { - QString path = m_currentProfileElement.attribute("remote_path",""); + TQString path = m_currentProfileElement.attribute("remote_path",""); if (!path.startsWith("/")) path.prepend("/"); @@ -283,7 +283,7 @@ void ProjectUpload::initBaseUrl() baseUrl->setHost(m_currentProfileElement.attribute("remote_host","")); baseUrl->setPath(path); baseUrl->setUser(m_currentProfileElement.attribute("user","")); - QString password; + TQString password; if (keepPasswords->isChecked()) { m_project->keepPasswd = true; @@ -304,16 +304,16 @@ void ProjectUpload::startUpload() { if (m_profilesOnly) { - QDialog::accept(); + TQDialog::accept(); return; } stopUpload = false; initBaseUrl(); if (markAsUploaded->isChecked()) { - QStringList selectedList; - QListViewItem *item; - QListViewItemIterator it(list); + TQStringList selectedList; + TQListViewItem *item; + TQListViewItemIterator it(list); for ( ; it.current(); ++it ) { item = it.current(); @@ -333,8 +333,8 @@ void ProjectUpload::startUpload() } } //update upload time - QDomNodeList nl = m_project->dom()->elementsByTagName("item"); - QDomElement el; + TQDomNodeList nl = m_project->dom()->elementsByTagName("item"); + TQDomElement el; for ( uint i = 0; i < nl.count(); i++ ) { el = nl.item(i).toElement(); @@ -351,14 +351,14 @@ void ProjectUpload::startUpload() int confirmCount = needsConfirmation.count(); if (confirmCount > 0) { - QValueList<QListViewItem*>::Iterator it; - QStringList confirmList; + TQValueList<TQListViewItem*>::Iterator it; + TQStringList confirmList; for (it = needsConfirmation.begin(); it != needsConfirmation.end(); ++it) { confirmList.append(((UploadTreeFile*)(*it))->url().prettyURL(0, KURL::StripFileProtocol)); } bool ok; - QStringList confirmedList = KInputDialog::getItemList(i18n("Confirm Upload"), i18n("Confirm that you want to upload the following files (unselect the files you do not want to upload):"), confirmList, confirmList, true, &ok, this); + TQStringList confirmedList = KInputDialog::getItemList(i18n("Confirm Upload"), i18n("Confirm that you want to upload the following files (unselect the files you do not want to upload):"), confirmList, confirmList, true, &ok, this); if (!ok) return; for (it = needsConfirmation.begin(); it != needsConfirmation.end(); ++it) { @@ -382,7 +382,7 @@ void ProjectUpload::startUpload() } else { if (KMessageBox::warningContinueCancel(this, i18n("<qt><b>%1</b> seems to be unaccessible.<br>Do you want to proceed with upload?</qt>") - .arg(u.prettyURL(0, KURL::StripFileProtocol)),QString::null,KStdGuiItem::cont()) == KMessageBox::Continue) + .arg(u.prettyURL(0, KURL::StripFileProtocol)),TQString::null,KStdGuiItem::cont()) == KMessageBox::Continue) { upload(); return; @@ -456,12 +456,12 @@ void ProjectUpload::upload() emit eventHappened("before_upload", from.url(), to.url()); KIO::FileCopyJob *job = KIO::file_copy( from, to, fileItem->permissions(), true, false, false ); - connect( job, SIGNAL( result( KIO::Job * ) ),this, - SLOT( uploadFinished( KIO::Job * ) ) ); - connect( job, SIGNAL( percent( KIO::Job *,unsigned long ) ), - this, SLOT( uploadProgress( KIO::Job *,unsigned long ) ) ); - connect( job, SIGNAL( infoMessage( KIO::Job *,const QString& ) ), - this, SLOT( uploadMessage( KIO::Job *,const QString& ) ) ); + connect( job, TQT_SIGNAL( result( KIO::Job * ) ),this, + TQT_SLOT( uploadFinished( KIO::Job * ) ) ); + connect( job, TQT_SIGNAL( percent( KIO::Job *,unsigned long ) ), + this, TQT_SLOT( uploadProgress( KIO::Job *,unsigned long ) ) ); + connect( job, TQT_SIGNAL( infoMessage( KIO::Job *,const TQString& ) ), + this, TQT_SLOT( uploadMessage( KIO::Job *,const TQString& ) ) ); labelCurFile->setText(i18n("Current: %1").arg(currentURL.fileName())); currentProgress->setProgress( 0 ); @@ -500,7 +500,7 @@ void ProjectUpload::uploadProgress ( KIO::Job *, unsigned long percent ) currentProgress->setProgress( percent ); } -void ProjectUpload::uploadMessage ( KIO::Job *, const QString & msg ) +void ProjectUpload::uploadMessage ( KIO::Job *, const TQString & msg ) { labelCurFile->setText( currentURL.fileName() + " : " + msg ); } @@ -515,7 +515,7 @@ void ProjectUpload::selectModified() { for ( KURL::List::Iterator file = modified.begin(); file != modified.end(); ++file ) { - QListViewItem *it = list->findItem( (*file).path() ); + TQListViewItem *it = list->findItem( (*file).path() ); it->setSelected(true); it->repaint(); } @@ -544,7 +544,7 @@ void ProjectUpload::collapseAll() list->collapseAll(); } -void ProjectUpload::resizeEvent ( QResizeEvent *t ) +void ProjectUpload::resizeEvent ( TQResizeEvent *t ) { ProjectUploadS::resizeEvent(t); list->setColumnWidth(0,list->width()-list->columnWidth(1)-list->columnWidth(2)-20); @@ -556,8 +556,8 @@ void ProjectUpload::slotUploadNext() if (!suspendUpload) { totalProgress->setProgress(totalProgress->progress()+1); - // QListViewItem *it = list->findItem( currentURL.path() ); - QListViewItem *it = currentItem; + // TQListViewItem *it = list->findItem( currentURL.path() ); + TQListViewItem *it = currentItem; if (it) { it->setSelected(false); @@ -569,8 +569,8 @@ void ProjectUpload::slotUploadNext() toUpload.remove( it ); //update upload time - QDomNodeList nl = m_project->dom()->elementsByTagName("item"); - QDomElement el; + TQDomNodeList nl = m_project->dom()->elementsByTagName("item"); + TQDomElement el; for ( uint i = 0; i < nl.count(); i++ ) { el = nl.item(i).toElement(); @@ -587,10 +587,10 @@ void ProjectUpload::slotUploadNext() void ProjectUpload::clearProjectModified() { - QDomNodeList nl = m_project->dom()->elementsByTagName("item"); + TQDomNodeList nl = m_project->dom()->elementsByTagName("item"); for ( unsigned int i=0; i<nl.count(); i++ ) { - QDomElement el = nl.item(i).toElement(); + TQDomElement el = nl.item(i).toElement(); m_uploadTimeList[el.attribute("url")] = el.attribute("modified_time").toInt(); } modified.clear(); @@ -601,7 +601,7 @@ void ProjectUpload::clearProjectModified() void ProjectUpload::slotNewProfile() { UploadProfileDlgS *profileDlg = new UploadProfileDlgS(this); - QDomElement el = m_currentProfileElement; + TQDomElement el = m_currentProfileElement; m_currentProfileElement = m_project->dom()->createElement("profile"); fillProfileDlg(profileDlg); if (profileDlg->exec()) @@ -638,7 +638,7 @@ void ProjectUpload::slotRemoveProfile() KMessageBox::error(this, i18n("You cannot remove the last profile."), i18n("Profile Removal Error") ); } else { - QString profileName = comboProfile->currentText(); + TQString profileName = comboProfile->currentText(); if (KMessageBox::warningContinueCancel(this, i18n("<qt>Do you really want to remove the <b>%1</b> upload profile?</qt>").arg(profileName), i18n("Profile Removal"), KStdGuiItem::del()) == KMessageBox::Continue) { @@ -648,7 +648,7 @@ void ProjectUpload::slotRemoveProfile() if (newIdx >= comboProfile->count()) newIdx = idx - 1; comboProfile->setCurrentItem(newIdx); - QString currentProfile = comboProfile->currentText(); + TQString currentProfile = comboProfile->currentText(); slotNewProfileSelected(currentProfile); if (profileName == defaultProfile()) { @@ -669,13 +669,13 @@ void ProjectUpload::fillProfileDlg(UploadProfileDlgS *profileDlg) profileDlg->lineUser->setText(m_currentProfileElement.attribute("user","")); profileDlg->linePath->setText(m_currentProfileElement.attribute("remote_path","")); profileDlg->port->setText( m_currentProfileElement.attribute("remote_port","") ); - QString def_p = m_currentProfileElement.attribute("remote_protocol","ftp"); + TQString def_p = m_currentProfileElement.attribute("remote_protocol","ftp"); - QStringList protocols = KProtocolInfo::protocols(); + TQStringList protocols = KProtocolInfo::protocols(); protocols.sort(); for ( uint i=0; i<protocols.count(); i++ ) { - QString protocol = protocols[i]; + TQString protocol = protocols[i]; KURL p; p.setProtocol(protocol); if ( KProtocolInfo::supportsWriting(p) && @@ -687,7 +687,7 @@ void ProjectUpload::fillProfileDlg(UploadProfileDlgS *profileDlg) profileDlg->comboProtocol->setCurrentItem(profileDlg->comboProtocol->count()-1 ); } } - QString entry = profileDlg->comboProtocol->currentText() + "://" + profileDlg->lineUser->text() + "@" + profileDlg->lineHost->text(); + TQString entry = profileDlg->comboProtocol->currentText() + "://" + profileDlg->lineUser->text() + "@" + profileDlg->lineHost->text(); if (m_project->keepPasswd || m_project->passwordSaved(entry)) { profileDlg->linePasswd->insert(m_project->password(entry)); @@ -703,7 +703,7 @@ void ProjectUpload::fillProfileDlg(UploadProfileDlgS *profileDlg) void ProjectUpload::readProfileDlg(UploadProfileDlgS *profileDlg) { - QString path = profileDlg->linePath->text(); + TQString path = profileDlg->linePath->text(); if (path.startsWith("~/")) { KUser user; @@ -715,7 +715,7 @@ void ProjectUpload::readProfileDlg(UploadProfileDlgS *profileDlg) m_currentProfileElement.setAttribute("remote_path", path); m_currentProfileElement.setAttribute("remote_port", profileDlg->port->text()); m_currentProfileElement.setAttribute("remote_protocol", profileDlg->comboProtocol->currentText()); - QString passwd = QString(profileDlg->linePasswd->password()); + TQString passwd = TQString(profileDlg->linePasswd->password()); m_project->savePassword(profileDlg->comboProtocol->currentText() + "://" + profileDlg->lineUser->text() + "@" + profileDlg->lineHost->text(), passwd, profileDlg->keepPasswd->isChecked()); m_lastEditedProfileElement = m_currentProfileElement; m_lastPassword = passwd; @@ -723,11 +723,11 @@ void ProjectUpload::readProfileDlg(UploadProfileDlgS *profileDlg) m_profilesNode.toElement().setAttribute("defaultProfile", profileDlg->lineProfileName->text()); } -void ProjectUpload::slotNewProfileSelected(const QString& profileName) +void ProjectUpload::slotNewProfileSelected(const TQString& profileName) { - QDomNodeList profileList = m_profilesNode.toElement().elementsByTagName("profile"); - QDomElement e; - QString s; + TQDomNodeList profileList = m_profilesNode.toElement().elementsByTagName("profile"); + TQDomElement e; + TQString s; for (uint i = 0; i < profileList.count(); i++) { e = profileList.item(i).toElement(); @@ -747,7 +747,7 @@ void ProjectUpload::slotNewProfileSelected(const QString& profileName) } } -QString ProjectUpload::defaultProfile() +TQString ProjectUpload::defaultProfile() { return m_profilesNode.toElement().attribute("defaultProfile"); } @@ -767,47 +767,47 @@ void ProjectUpload::reject() } } - QDialog::reject(); + TQDialog::reject(); } void ProjectUpload::setProfileTooltip() { - QString tip = m_currentProfileElement.attribute("remote_protocol","ftp") + "://"; - QString user = m_currentProfileElement.attribute("user",""); + TQString tip = m_currentProfileElement.attribute("remote_protocol","ftp") + "://"; + TQString user = m_currentProfileElement.attribute("user",""); if (! user.isEmpty()) { tip += user + "@"; } tip += m_currentProfileElement.attribute("remote_host",""); - QString port = m_currentProfileElement.attribute("remote_port",""); + TQString port = m_currentProfileElement.attribute("remote_port",""); if (! port.isEmpty()) { tip += ":" + port; } tip += m_currentProfileElement.attribute("remote_path",""); - QToolTip::add(comboProfile, tip); + TQToolTip::add(comboProfile, tip); } void ProjectUpload::loadRemoteUploadInfo() { - QDomNodeList nl = m_currentProfileElement.elementsByTagName("uploadeditem"); + TQDomNodeList nl = m_currentProfileElement.elementsByTagName("uploadeditem"); for (uint i = 0; i < nl.count(); i++) { - QDomElement el = nl.item(i).toElement(); + TQDomElement el = nl.item(i).toElement(); m_uploadTimeList[el.attribute("url")] = el.attribute("upload_time").toInt(); } } void ProjectUpload::saveRemoteUploadInfo() { - QDomNode parent = m_currentProfileElement.parentNode(); - QDomNode profileNode = m_currentProfileElement.cloneNode(false); + TQDomNode parent = m_currentProfileElement.parentNode(); + TQDomNode profileNode = m_currentProfileElement.cloneNode(false); parent.removeChild(m_currentProfileElement); parent.appendChild(profileNode); - QMap<QString, int>::ConstIterator it; + TQMap<TQString, int>::ConstIterator it; for (it = m_uploadTimeList.constBegin(); it != m_uploadTimeList.constEnd(); ++it) { - QDomElement el = m_uploadStatusDom.createElement("uploadeditem"); + TQDomElement el = m_uploadStatusDom.createElement("uploadeditem"); el.setAttribute("url", it.key()); el.setAttribute("upload_time", it.data()); profileNode.appendChild(el); |