diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
commit | e985f7e545f4739493965aad69bbecb136dc9346 (patch) | |
tree | 54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /quanta/treeviews/templatestreeview.cpp | |
parent | f7670c198945adc3b95ad69a959fe5f8ae55b493 (diff) | |
download | tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip |
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'quanta/treeviews/templatestreeview.cpp')
-rw-r--r-- | quanta/treeviews/templatestreeview.cpp | 92 |
1 files changed, 46 insertions, 46 deletions
diff --git a/quanta/treeviews/templatestreeview.cpp b/quanta/treeviews/templatestreeview.cpp index f1eaca73..75218842 100644 --- a/quanta/treeviews/templatestreeview.cpp +++ b/quanta/treeviews/templatestreeview.cpp @@ -79,22 +79,22 @@ TQMap<TQString, TQString> i18nToType; //TemplatesTreeBranch implementation -TemplatesTreeBranch::TemplatesTreeBranch(KFileTreeView *parent, const KURL& url, +TemplatesTreeBranch::TemplatesTreeBranch(KFileTreeView *tqparent, const KURL& url, const TQString& name, const TQPixmap& pix, bool showHidden, KFileTreeViewItem *branchRoot) - : BaseTreeBranch(parent, url, name, pix, showHidden, branchRoot) + : BaseTreeBranch(tqparent, url, name, pix, showHidden, branchRoot) { } -KFileTreeViewItem* TemplatesTreeBranch::createTreeViewItem(KFileTreeViewItem *parent, +KFileTreeViewItem* TemplatesTreeBranch::createTreeViewItem(KFileTreeViewItem *tqparent, KFileItem *fileItem ) { BaseTreeViewItem *tvi = 0; - if( parent && fileItem ) + if( tqparent && fileItem ) { KURL url = fileItem->url(); - tvi = new BaseTreeViewItem( parent, fileItem, this ); + tvi = new BaseTreeViewItem( tqparent, fileItem, this ); if (tvi && fileItem->isDir()) { if (url.isLocalFile()) @@ -106,7 +106,7 @@ KFileTreeViewItem* TemplatesTreeBranch::createTreeViewItem(KFileTreeViewItem *pa } } else { - url = static_cast<BaseTreeViewItem*>(parent)->url(); + url = static_cast<BaseTreeViewItem*>(tqparent)->url(); } TQFileInfo dotFileInfo(url.path() + "/.dirinfo"); while ((!dotFileInfo.exists()) && (dotFileInfo.dirPath() != "/")) @@ -123,14 +123,14 @@ KFileTreeViewItem* TemplatesTreeBranch::createTreeViewItem(KFileTreeViewItem *pa } else - kdDebug(24000) << "TemplatesTreeBranch::createTreeViewItem: Have no parent" << endl; + kdDebug(24000) << "TemplatesTreeBranch::createTreeViewItem: Have no tqparent" << endl; return tvi; } -TemplatesTreeView::TemplatesTreeView(KMainWindow *parent, const char *name ) - : BaseTreeView(parent,name), m_projectDir(0), m_mainWindow(parent) +TemplatesTreeView::TemplatesTreeView(KMainWindow *tqparent, const char *name ) + : BaseTreeView(tqparent,name), m_projectDir(0), m_mainWindow(tqparent) { typeToi18n["text/all"] = i18n("Text Snippet"); typeToi18n["file/all"] = i18n("Binary File"); @@ -285,13 +285,13 @@ void TemplatesTreeView::slotMenu(KListView*, TQListViewItem *item, const TQPoint TQString menuText = ""; - if (m_dirInfo.mimeType.upper().contains("TEXT")) + if (m_dirInfo.mimeType.upper().tqcontains("TEXT")) menuText = i18n(textMenu.utf8()); - else if (m_dirInfo.mimeType.upper().contains("FILE")) + else if (m_dirInfo.mimeType.upper().tqcontains("FILE")) menuText = i18n(binaryMenu.utf8()); - else if (m_dirInfo.mimeType.upper().contains("TEMPLATE")) + else if (m_dirInfo.mimeType.upper().tqcontains("TEMPLATE")) menuText = i18n(docMenu.utf8()); - else if (m_dirInfo.mimeType.upper().contains("SITE")) + else if (m_dirInfo.mimeType.upper().tqcontains("SITE")) menuText = i18n(siteMenu.utf8()); if (menuText.isEmpty()) @@ -350,17 +350,17 @@ void TemplatesTreeView::slotSelectFile(TQListViewItem *item) if ( !kftvItem->isDir() ) { m_dirInfo = readDirInfo(); -/* if (m_dirInfo.mimeType.upper().contains("SITE")) +/* if (m_dirInfo.mimeType.upper().tqcontains("SITE")) { slotExtractSiteTemplate(); return; }*/ if (expandArchiv(kftvItem)) return; - if (m_dirInfo.mimeType.upper().contains("TEXT")) + if (m_dirInfo.mimeType.upper().tqcontains("TEXT")) slotInsertInDocument(); - else if (m_dirInfo.mimeType.upper().contains("FILE")) + else if (m_dirInfo.mimeType.upper().tqcontains("FILE")) slotInsertTag(); - else if (m_dirInfo.mimeType.upper().contains("TEMPLATE")) + else if (m_dirInfo.mimeType.upper().tqcontains("TEMPLATE")) slotNewDocument(); } } @@ -383,10 +383,10 @@ void TemplatesTreeView::slotNewDir() if (m_dirInfo.mimeType.isEmpty()) { - createDirDlg->parentAttr->setText(i18n("&Inherit parent attribute (nothing)")); + createDirDlg->tqparentAttr->setText(i18n("&Inherit tqparent attribute (nothing)")); } else { - createDirDlg->parentAttr->setText(i18n("&Inherit parent attribute (%1)").arg(typeToi18n[m_dirInfo.mimeType])); + createDirDlg->tqparentAttr->setText(i18n("&Inherit tqparent attribute (%1)").tqarg(typeToi18n[m_dirInfo.mimeType])); } if (createDirDlg->exec()) { @@ -404,10 +404,10 @@ void TemplatesTreeView::slotNewDir() if (!dir.mkdir(startDir+"/"+createDirDlg->dirName->text())) { KMessageBox::error(this,i18n("Error while creating the new folder.\n \ - Maybe you do not have permission to write in the %1 folder.").arg(startDir)); + Maybe you do not have permission to write in the %1 folder.").tqarg(startDir)); return; } - if (! createDirDlg->parentAttr->isChecked()) + if (! createDirDlg->tqparentAttr->isChecked()) { m_dirInfo.mimeType = i18nToType[createDirDlg->typesCombo->currentText()]; m_dirInfo.preText = ""; @@ -465,15 +465,15 @@ void TemplatesTreeView::contentsDropEvent(TQDropEvent *e) *(tempFile->textStream()) << content; tempFile->close(); bool proceed = true; - if (QExtFileInfo::exists(url, false, this)) + if (TQExtFileInfo::exists(url, false, this)) { - proceed = KMessageBox::warningContinueCancel(this, i18n("<qt>The file <b>%1</b> already exists.<br>Do you want to overwrite it?</qt>").arg(url.prettyURL(0, KURL::StripFileProtocol)),i18n("Overwrite"), i18n("Overwrite")) == KMessageBox::Continue; + proceed = KMessageBox::warningContinueCancel(this, i18n("<qt>The file <b>%1</b> already exists.<br>Do you want to overwrite it?</qt>").tqarg(url.prettyURL(0, KURL::StripFileProtocol)),i18n("Overwrite"), i18n("Overwrite")) == KMessageBox::Continue; } if (proceed) { if (!QuantaNetAccess::upload(tempFile->name(), url, m_parent, false)) { - KMessageBox::error(this,i18n("<qt>Could not write to file <b>%1</b>.<br>Check if you have rights to write there or that your connection is working.</qt>").arg(url.prettyURL(0, KURL::StripFileProtocol))); + KMessageBox::error(this,i18n("<qt>Could not write to file <b>%1</b>.<br>Check if you have rights to write there or that your connection is working.</qt>").tqarg(url.prettyURL(0, KURL::StripFileProtocol))); } } delete tempFile; @@ -612,14 +612,14 @@ void TemplatesTreeView::slotProperties() m_parentDirInfo = readDirInfo(dotFileInfo.dirPath()); if (!dotFileInfo.exists() || m_dirInfo.mimeType == m_parentDirInfo.mimeType) { - m_quantaProperties->parentAttr->setChecked(true); + m_quantaProperties->tqparentAttr->setChecked(true); } if (m_parentDirInfo.mimeType.isEmpty()) { - m_quantaProperties->parentAttr->setText(i18n("&Inherit parent attribute (nothing)")); + m_quantaProperties->tqparentAttr->setText(i18n("&Inherit tqparent attribute (nothing)")); } else { - m_quantaProperties->parentAttr->setText(i18n("&Inherit parent attribute (%1)").arg(typeToi18n[m_parentDirInfo.mimeType])); + m_quantaProperties->tqparentAttr->setText(i18n("&Inherit tqparent attribute (%1)").tqarg(typeToi18n[m_parentDirInfo.mimeType])); } m_quantaProperties->preTextEdit->setText(m_dirInfo.preText); m_quantaProperties->postTextEdit->setText(m_dirInfo.postText); @@ -652,7 +652,7 @@ void TemplatesTreeView::slotProperties() TQString type = el.attribute("type", "tag"); if (type == "script") { - tmpStr = action->text().replace(TQRegExp("\\&(?!\\&)"),""); + tmpStr = action->text().tqreplace(TQRegExp("\\&(?!\\&)"),""); m_quantaProperties->actionCombo->insertItem(tmpStr); if (tmpStr == name) pos = j; @@ -681,7 +681,7 @@ void TemplatesTreeView::slotPropertiesApplied() DirInfo m_localDirInfo; TQString typeString = ""; - if (!m_quantaProperties->parentAttr->isChecked()) + if (!m_quantaProperties->tqparentAttr->isChecked()) { m_localDirInfo.mimeType = m_quantaProperties->typesCombo->currentText(); typeString = m_localDirInfo.mimeType; @@ -709,10 +709,10 @@ void TemplatesTreeView::slotPropertiesApplied() bool result = writeDirInfo(); KFileTreeViewItem *item = currentKFileTreeViewItem(); if (item && !item->isDir()) - item = static_cast<KFileTreeViewItem *>(item->parent()); + item = static_cast<KFileTreeViewItem *>(item->tqparent()); if (result && item && !typeString.isEmpty()) { - if (item->parent() && item->isDir()) + if (item->tqparent() && item->isDir()) item->setText(1, typeString); updateTypeDescription(item, typeString); } @@ -723,7 +723,7 @@ void TemplatesTreeView::slotPropertiesApplied() void TemplatesTreeView::updateTypeDescription(KFileTreeViewItem *item, const TQString &typeString) { - if (item->parent() && item->isDir()) + if (item->tqparent() && item->isDir()) item->setText(1, typeString); KFileTreeViewItem *curItem = static_cast<KFileTreeViewItem *>(item->firstChild()); while (curItem && curItem != static_cast<KFileTreeViewItem *>(item->nextSibling())) @@ -783,7 +783,7 @@ void TemplatesTreeView::slotDragInsert(TQDropEvent *e) { if(m_dirInfo.mimeType == "text/all") // default to inserting in document { - if(!mimeType.contains("text", false) && QuantaCommon::denyBinaryInsert(this) != KMessageBox::Yes) + if(!mimeType.tqcontains("text", false) && QuantaCommon::denyBinaryInsert(this) != KMessageBox::Yes) { return; } @@ -798,7 +798,7 @@ void TemplatesTreeView::slotDragInsert(TQDropEvent *e) else if(m_dirInfo.mimeType == "template/all") { - if(!mimeType.contains("text", false) && QuantaCommon::denyBinaryInsert(this) != KMessageBox::Yes) + if(!mimeType.tqcontains("text", false) && QuantaCommon::denyBinaryInsert(this) != KMessageBox::Yes) { return; } @@ -846,7 +846,7 @@ void TemplatesTreeView::slotPaste() { if (currentItem()) { - QClipboard *cb = TQApplication::clipboard(); + TQClipboard *cb = TQApplication::tqclipboard(); KURL::List list( TQStringList::split( TQChar('\n'), cb->text() ) ); KURL url; @@ -873,11 +873,11 @@ void TemplatesTreeView::slotDelete() KURL url = currentURL(); TQString msg; if ( currentKFileTreeViewItem()->isDir() ) - msg = i18n("Do you really want to delete folder \n%1 ?\n").arg(url.path()); + msg = i18n("Do you really want to delete folder \n%1 ?\n").tqarg(url.path()); else - msg = i18n("Do you really want to delete file \n%1 ?\n").arg(url.path()); + msg = i18n("Do you really want to delete file \n%1 ?\n").tqarg(url.path()); - if ( KMessageBox::warningContinueCancel(this, msg, TQString::null, KStdGuiItem::del()) == KMessageBox::Continue ) + if ( KMessageBox::warningContinueCancel(this, msg, TQString(), KStdGuiItem::del()) == KMessageBox::Continue ) { KIO::Job *job = KIO::del(url); connect( job, TQT_SIGNAL( result( KIO::Job *) ), this , TQT_SLOT( slotJobFinished( KIO::Job *) ) ); @@ -911,7 +911,7 @@ KURL TemplatesTreeView::filterTemplate() TQDomElement el = action->data(); TQString type = el.attribute("type", "tag"); tmpStr = action->text(); - tmpStr.replace(TQRegExp("\\&(?!\\&)"),""); + tmpStr.tqreplace(TQRegExp("\\&(?!\\&)"),""); if (type == "script" && tmpStr == name) { filterAction = action; @@ -925,7 +925,7 @@ KURL TemplatesTreeView::filterTemplate() filterAction->setInputFileName(url.path()); filterAction->execute(true); filterAction->setOutputFile(0L); - filterAction->setInputFileName(TQString::null); + filterAction->setInputFileName(TQString()); tempFile->close(); tempFileList.append(tempFile); url.setPath(tempFile->name()); @@ -953,14 +953,14 @@ TQString TemplatesTreeView::createTemplateTarball() if ( ! currentKFileTreeViewItem()->isDir() ) files.append(url); else { - files = QExtFileInfo::allFiles(dirURL, "*", this) ; + files = TQExtFileInfo::allFiles(dirURL, "*", this) ; dirURL = dirURL.upURL(); } for ( KURL::List::Iterator it_f = files.begin(); it_f != files.end(); ++it_f ) { if (!(*it_f).fileName(false).isEmpty()) { - url = QExtFileInfo::toRelative( (*it_f), dirURL) ; + url = TQExtFileInfo::toRelative( (*it_f), dirURL) ; TQFile file((*it_f).path()); file.open(IO_ReadOnly); @@ -1006,7 +1006,7 @@ void TemplatesTreeView::slotSendInMail() delete mailDlg; return; } - kapp->invokeMailer(toStr, TQString::null, TQString::null, subjectStr, message, TQString::null, attachmentFile); + kapp->invokeMailer(toStr, TQString(), TQString(), subjectStr, message, TQString(), attachmentFile); } delete mailDlg; } @@ -1062,9 +1062,9 @@ void TemplatesTreeView::slotExtractSiteTemplate() } else error = true; KIO::NetAccess::removeTempFile(tempFile); - if (!m_projectBaseURL.isEmpty() && !QExtFileInfo::toRelative(targetURL, m_projectBaseURL).url().startsWith(".")) + if (!m_projectBaseURL.isEmpty() && !TQExtFileInfo::toRelative(targetURL, m_projectBaseURL).url().startsWith(".")) { - if (KMessageBox::questionYesNo(this, i18n("You have extracted the site template to a folder which is not under your main project folder.\nDo you want to copy the folder into the main project folder?"), TQString::null, i18n("Copy Folder"), i18n("Do Not Copy")) == KMessageBox::Yes) + if (KMessageBox::questionYesNo(this, i18n("You have extracted the site template to a folder which is not under your main project folder.\nDo you want to copy the folder into the main project folder?"), TQString(), i18n("Copy Folder"), i18n("Do Not Copy")) == KMessageBox::Yes) { emit insertDirInProject(targetURL); } @@ -1072,7 +1072,7 @@ void TemplatesTreeView::slotExtractSiteTemplate() } else error = true; if (error) - KMessageBox::error(this, i18n("<qt>Some error happened while extracting the <i>%1</i> site template file.<br>Check that you have write permission for <i>%2</i> and that there is enough free space in your temporary folder.</qt>").arg(url.prettyURL(0, KURL::StripFileProtocol)).arg(targetURL.prettyURL(0, KURL::StripFileProtocol))); + KMessageBox::error(this, i18n("<qt>Some error happened while extracting the <i>%1</i> site template file.<br>Check that you have write permission for <i>%2</i> and that there is enough free space in your temporary folder.</qt>").tqarg(url.prettyURL(0, KURL::StripFileProtocol)).tqarg(targetURL.prettyURL(0, KURL::StripFileProtocol))); } } |