From d6f8bbb45b267065a6907e71ff9c98bb6d161241 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:56:07 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1157658 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/projectsession.cpp | 112 ++++++++++++++++++++++++------------------------- 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'src/projectsession.cpp') diff --git a/src/projectsession.cpp b/src/projectsession.cpp index be3ec4a1..1b09ca71 100644 --- a/src/projectsession.cpp +++ b/src/projectsession.cpp @@ -15,10 +15,10 @@ * * ***************************************************************************/ -#include -#include -#include -#include +#include +#include +#include +#include #include #include @@ -58,21 +58,21 @@ void ProjectSession::initXMLTree() // or a new project gets generated (which doesn't have a kdevses file // either as the project has never been closed before opening it). domdoc.clear(); - QDomDocument doc("KDevPrjSession"); + TQDomDocument doc("KDevPrjSession"); domdoc=doc; domdoc.appendChild( domdoc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) ); // KDevPrjSession is the root element of the XML file - QDomElement session = domdoc.documentElement(); + TQDomElement session = domdoc.documentElement(); session = domdoc.createElement("KDevPrjSession"); domdoc.appendChild( session); } //--------------------------------------------------------------------------- -bool ProjectSession::restoreFromFile( const QString & sessionFileName, const QValueList< KDevPlugin * > plugins ) +bool ProjectSession::restoreFromFile( const TQString & sessionFileName, const TQValueList< KDevPlugin * > plugins ) { bool bFileOpenOK = true; - QFile f(sessionFileName); + TQFile f(sessionFileName); if ( f.open(IO_ReadOnly) ) { // file opened successfully bool ok = domdoc.setContent( &f); f.close(); @@ -96,7 +96,7 @@ bool ProjectSession::restoreFromFile( const QString & sessionFileName, const QVa return false; } - QDomElement session = domdoc.documentElement(); + TQDomElement session = domdoc.documentElement(); // read the information about the mainframe widget if (bFileOpenOK) { @@ -104,13 +104,13 @@ bool ProjectSession::restoreFromFile( const QString & sessionFileName, const QVa } // now also let the plugins load their session stuff - QDomElement pluginListEl = session.namedItem("pluginList").toElement(); - QValueList::ConstIterator it = plugins.begin(); + TQDomElement pluginListEl = session.namedItem("pluginList").toElement(); + TQValueList::ConstIterator it = plugins.begin(); while( it != plugins.end() ) { KDevPlugin* pPlugin = (*it); - QString pluginName = pPlugin->instance()->instanceName(); - QDomElement pluginEl = pluginListEl.namedItem(pluginName).toElement(); + TQString pluginName = pPlugin->instance()->instanceName(); + TQDomElement pluginEl = pluginListEl.namedItem(pluginName).toElement(); if (!pluginEl.isNull()) { // now plugin, load what you find! pPlugin->restorePartialProjectSession(&pluginEl); @@ -118,15 +118,15 @@ bool ProjectSession::restoreFromFile( const QString & sessionFileName, const QVa ++it; } - QTimer::singleShot( 0, this, SLOT(loadDocument()) ); + TQTimer::singleShot( 0, this, TQT_SLOT(loadDocument()) ); return true; } //--------------------------------------------------------------------------- -void ProjectSession::recreateDocs(QDomElement& el) +void ProjectSession::recreateDocs(TQDomElement& el) { -//// QDomElement mainframeEl = el.namedItem("Mainframe").toElement(); +//// TQDomElement mainframeEl = el.namedItem("Mainframe").toElement(); //// bool bMaxMode =initXMLTree() (bool) mainframeEl.attribute("MaximizeMode", "0").toInt(); //// QextMdiMainFrm* pMainWidget = (QextMdiMainFrm*) qApp->mainWidget(); //// pMainWidget->setEnableMaximizedChildFrmMode(bMaxMode); @@ -134,17 +134,17 @@ void ProjectSession::recreateDocs(QDomElement& el) //// pMainWidget->hideViewTaskBar(); // read the information about the documents - QDomElement docsAndViewsEl = el.namedItem("DocsAndViews").toElement(); + TQDomElement docsAndViewsEl = el.namedItem("DocsAndViews").toElement(); int nNrOfDocs = docsAndViewsEl.attribute("NumberOfDocuments", "0").toInt(); // loop over all docs int nDoc = 0; - QDomElement docEl; + TQDomElement docEl; for (docEl = docsAndViewsEl.firstChild().toElement(), nDoc = 0; nDoc < nNrOfDocs; nDoc++, docEl = docEl.nextSibling().toElement()) { // read the document name and type - QString docName = docEl.attribute( "URL", ""); + TQString docName = docEl.attribute( "URL", ""); if (!docName.isEmpty() /* && URL::exists(docName)*/) { KURL url(docName); // create the views of this document, the first view creation will also create the document @@ -163,7 +163,7 @@ void ProjectSession::recreateDocs(QDomElement& el) } //--------------------------------------------------------------------------- -void ProjectSession::recreateViews(KURL& url, QDomElement docEl, bool activate) +void ProjectSession::recreateViews(KURL& url, TQDomElement docEl, bool activate) { // read information about the views int nNrOfViews = docEl.attribute( "NumberOfViews", "0").toInt(); @@ -173,7 +173,7 @@ void ProjectSession::recreateViews(KURL& url, QDomElement docEl, bool activate) if ( nNrOfViews > 0 ) { - QDomElement viewEl = docEl.firstChild().toElement(); + TQDomElement viewEl = docEl.firstChild().toElement(); DocumentData dd; dd.type = viewEl.attribute("Type"); dd.line = viewEl.attribute("line", "0").toInt(); @@ -188,9 +188,9 @@ void ProjectSession::recreateViews(KURL& url, QDomElement docEl, bool activate) // loop over all views of this document int nView = 0; - QDomElement viewEl; - QString viewType; - QString context; + TQDomElement viewEl; + TQString viewType; + TQString context; if (docEl.hasAttribute("context")) { context = docEl.attribute("context"); } @@ -213,7 +213,7 @@ void ProjectSession::recreateViews(KURL& url, QDomElement docEl, bool activate) else { PartController::getInstance()->showDocument(url); } - QDomElement viewPropertiesEl = viewEl.namedItem("AdditionalSettings").toElement(); + TQDomElement viewPropertiesEl = viewEl.namedItem("AdditionalSettings").toElement(); if (!viewPropertiesEl.isNull()) { emit sig_restoreAdditionalViewProperties(url.url(), &viewPropertiesEl); } @@ -230,16 +230,16 @@ void ProjectSession::recreateViews(KURL& url, QDomElement docEl, bool activate) } //--------------------------------------------------------------------------- -bool ProjectSession::saveToFile( const QString & sessionFileName, const QValueList< KDevPlugin * > plugins ) +bool ProjectSession::saveToFile( const TQString & sessionFileName, const TQValueList< KDevPlugin * > plugins ) { - QString section, keyword; - QDomElement session = domdoc.documentElement(); + TQString section, keyword; + TQDomElement session = domdoc.documentElement(); int nDocs = 0; - QString docIdStr; + TQString docIdStr; //// // read the information about the mainframe widget -//// QDomElement mainframeEl = session.namedItem("Mainframe").toElement(); +//// TQDomElement mainframeEl = session.namedItem("Mainframe").toElement(); //// if(mainframeEl.isNull()){ //// mainframeEl=domdoc.createElement("Mainframe"); //// session.appendChild( mainframeEl); @@ -249,22 +249,22 @@ bool ProjectSession::saveToFile( const QString & sessionFileName, const QValueLi // read the information about the documents - QDomElement docsAndViewsEl = session.namedItem("DocsAndViews").toElement(); + TQDomElement docsAndViewsEl = session.namedItem("DocsAndViews").toElement(); if (docsAndViewsEl.isNull()) { docsAndViewsEl = domdoc.createElement("DocsAndViews"); session.appendChild( docsAndViewsEl); } else { // we need to remove the old ones before memorizing the current ones (to avoid merging) - QDomNode n = docsAndViewsEl.firstChild(); + TQDomNode n = docsAndViewsEl.firstChild(); while ( !n.isNull() ) { - QDomNode toBeRemoved = n; + TQDomNode toBeRemoved = n; n = n.nextSibling(); docsAndViewsEl.removeChild(toBeRemoved); } } - QPtrListIterator it( *PartController::getInstance()->parts() ); + TQPtrListIterator it( *PartController::getInstance()->parts() ); for ( ; it.current(); ++it ) { @@ -272,16 +272,16 @@ bool ProjectSession::saveToFile( const QString & sessionFileName, const QValueLi if (!pReadOnlyPart) continue; - QString url = pReadOnlyPart->url().url(); + TQString url = pReadOnlyPart->url().url(); docIdStr.setNum(nDocs); - QDomElement docEl = domdoc.createElement("Doc" + docIdStr); + TQDomElement docEl = domdoc.createElement("Doc" + docIdStr); docEl.setAttribute( "URL", url); docsAndViewsEl.appendChild( docEl); nDocs++; docEl.setAttribute( "NumberOfViews", 1); - QDomElement viewEl = domdoc.createElement( "View0"); + TQDomElement viewEl = domdoc.createElement( "View0"); docEl.appendChild( viewEl); if ( dynamic_cast(pReadOnlyPart) ) @@ -299,7 +299,7 @@ bool ProjectSession::saveToFile( const QString & sessionFileName, const QValueLi } if ( KTextEditor::EncodingInterface * ei = dynamic_cast( pReadOnlyPart ) ) { - QString encoding = ei->encoding(); + TQString encoding = ei->encoding(); if ( !encoding.isNull() ) { viewEl.setAttribute( "Encoding", encoding ); @@ -313,10 +313,10 @@ bool ProjectSession::saveToFile( const QString & sessionFileName, const QValueLi } /* - QPtrListIterator it( *PartController::getInstance()->parts() ); + TQPtrListIterator it( *PartController::getInstance()->parts() ); for ( ; it.current(); ++it ) { -//// QString partName = it.current()->name(); -//// QMessageBox::information(0L,"",partName); +//// TQString partName = it.current()->name(); +//// TQMessageBox::information(0L,"",partName); KParts::ReadOnlyPart* pReadOnlyPart = dynamic_cast(it.current()); if (!pReadOnlyPart) @@ -325,34 +325,34 @@ bool ProjectSession::saveToFile( const QString & sessionFileName, const QValueLi HTMLDocumentationPart* pDocuPart = dynamic_cast(pReadOnlyPart); /// @todo Save relative path for project sharing? - QString url = pReadOnlyPart->url().url(); + TQString url = pReadOnlyPart->url().url(); docIdStr.setNum(nDocs); - QDomElement docEl = domdoc.createElement("Doc" + docIdStr); + TQDomElement docEl = domdoc.createElement("Doc" + docIdStr); docEl.setAttribute( "URL", url); docsAndViewsEl.appendChild( docEl); nDocs++; //// docEl.setAttribute( "Type", "???"); //// // get the view list -//// QPtrList viewList = pDoc->viewList(); +//// TQPtrList viewList = pDoc->viewList(); //// // write the number of views //// docEl.setAttribute( "NumberOfViews", viewList.count()); docEl.setAttribute( "NumberOfViews", 1); // loop over all views of this document int nView = 0; //// KWriteView* pView = 0L; - QString viewIdStr; + TQString viewIdStr; //// for (viewList.first(), nView = 0; viewList.current() != 0; viewList.next(), nView++) { //// pView = viewList.current(); //// if (pView != 0L) { viewIdStr.setNum( nView); - QDomElement viewEl = domdoc.createElement( "View"+viewIdStr); + TQDomElement viewEl = domdoc.createElement( "View"+viewIdStr); docEl.appendChild( viewEl); // focus? //// viewEl.setAttribute("Focus", (((CEditWidget*)pView->parentWidget()) == m_pDocViewMan->currentEditView())); viewEl.setAttribute("Type", "???"); - QDomElement viewPropertiesEl = domdoc.createElement("AdditionalSettings"); + TQDomElement viewPropertiesEl = domdoc.createElement("AdditionalSettings"); viewEl.appendChild(viewPropertiesEl); emit sig_saveAdditionalViewProperties(url, &viewPropertiesEl); @@ -375,27 +375,27 @@ bool ProjectSession::saveToFile( const QString & sessionFileName, const QValueLi // now also let the project-related plugins save their session stuff // read the information about the documents - QDomElement pluginListEl = session.namedItem("pluginList").toElement(); + TQDomElement pluginListEl = session.namedItem("pluginList").toElement(); if (pluginListEl.isNull()) { pluginListEl = domdoc.createElement("pluginList"); session.appendChild( pluginListEl); } else { // we need to remove the old ones before memorizing the current ones (to avoid merging) - QDomNode n = pluginListEl.firstChild(); + TQDomNode n = pluginListEl.firstChild(); while ( !n.isNull() ) { - QDomNode toBeRemoved = n; + TQDomNode toBeRemoved = n; n = n.nextSibling(); pluginListEl.removeChild(toBeRemoved); } } - QValueList::ConstIterator itt = plugins.begin(); + TQValueList::ConstIterator itt = plugins.begin(); while( itt != plugins.end() ) { KDevPlugin* pPlugin = (*itt); - QString pluginName = pPlugin->instance()->instanceName(); - QDomElement pluginEl = domdoc.createElement(pluginName); + TQString pluginName = pPlugin->instance()->instanceName(); + TQDomElement pluginEl = domdoc.createElement(pluginName); // now plugin, save what you have! pPlugin->savePartialProjectSession(&pluginEl); @@ -409,9 +409,9 @@ bool ProjectSession::saveToFile( const QString & sessionFileName, const QValueLi } // Write it out to the session file on disc - QFile f(sessionFileName); + TQFile f(sessionFileName); if ( f.open(IO_WriteOnly) ) { // file opened successfully - QTextStream t( &f ); // use a text stream + TQTextStream t( &f ); // use a text stream t << domdoc.toCString(); f.close(); } @@ -444,7 +444,7 @@ void ProjectSession::loadDocument( ) _docDataList.pop_front(); loadDocument(); - //QTimer::singleShot( 0, this, SLOT(loadDocument()) ); + //TQTimer::singleShot( 0, this, TQT_SLOT(loadDocument()) ); } } -- cgit v1.2.1