From b9c374725620ec064db7610132a8b8969fa405b9 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 4 Jul 2011 19:59:21 +0000 Subject: TQt4 port kile This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kile@1239285 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/kile/kilestructurewidget.cpp | 192 +++++++++++++++++++-------------------- 1 file changed, 96 insertions(+), 96 deletions(-) (limited to 'src/kile/kilestructurewidget.cpp') diff --git a/src/kile/kilestructurewidget.cpp b/src/kile/kilestructurewidget.cpp index 3735f23..b3205a6 100644 --- a/src/kile/kilestructurewidget.cpp +++ b/src/kile/kilestructurewidget.cpp @@ -17,10 +17,10 @@ // 2005-11-02: dani // - cleaning up source (local variables etc.) -// - added different QToolTips for each item +// - added different TQToolTips for each item // - add more types of KilelistViewItems // - KileStruct::Sect and KileStruct::BeginFloat will remember assigned labels, -// which are displayed as QToolTips, if these labels are defined in the +// which are displayed as TQToolTips, if these labels are defined in the // same or the next line // - Caption for type KileStruct::BeginFloat are displayed in the title // of this item @@ -59,10 +59,10 @@ #include "kilestructurewidget.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include "kiledebug.h" @@ -81,25 +81,25 @@ ////////////////////// KileListViewItem with all info ////////////////////// -KileListViewItem::KileListViewItem(QListViewItem * parent, QListViewItem * after, const QString &title, const KURL &url, uint line, uint column, int type, int level, uint startline, uint startcol) : - KListViewItem(parent,after), +KileListViewItem::KileListViewItem(TQListViewItem * tqparent, TQListViewItem * after, const TQString &title, const KURL &url, uint line, uint column, int type, int level, uint startline, uint startcol) : + KListViewItem(tqparent,after), m_title(title), m_url(url), m_line(line), m_column(column), m_type(type), m_level(level), m_startline(startline), m_startcol(startcol) { setItemEntry(); } -KileListViewItem::KileListViewItem(QListView * parent, const QString & label) : - KListViewItem(parent,label), +KileListViewItem::KileListViewItem(TQListView * tqparent, const TQString & label) : + KListViewItem(tqparent,label), m_title(label), m_url(KURL()), m_line(0), m_column(0), m_type(KileStruct::None), m_level(0) {} -KileListViewItem::KileListViewItem(QListViewItem * parent, const QString & label) : - KListViewItem(parent,label), +KileListViewItem::KileListViewItem(TQListViewItem * tqparent, const TQString & label) : + KListViewItem(tqparent,label), m_title(label), m_url(KURL()), m_line(0), m_column(0), m_type(KileStruct::None), m_level(0) {} -void KileListViewItem::setTitle(const QString &title) +void KileListViewItem::setTitle(const TQString &title) { m_title = title; setItemEntry(); @@ -107,15 +107,15 @@ void KileListViewItem::setTitle(const QString &title) void KileListViewItem::setItemEntry() { - setText(0, m_title + " (" + i18n("line") + ' ' + QString::number(m_line) + ')'); + setText(0, m_title + " (" + i18n("line") + ' ' + TQString::number(m_line) + ')'); } ////////////////////// introduce a new ToolTip ////////////////////// -KileListViewToolTip::KileListViewToolTip(KListView *listview) : QToolTip(listview->viewport()), m_listview(listview) +KileListViewToolTip::KileListViewToolTip(KListView *listview) : TQToolTip(listview->viewport()), m_listview(listview) {} -void KileListViewToolTip::maybeTip(const QPoint &p) +void KileListViewToolTip::maybeTip(const TQPoint &p) { if ( ! m_listview ) return; @@ -125,7 +125,7 @@ void KileListViewToolTip::maybeTip(const QPoint &p) if ( !item ) return; - const QRect rect = m_listview->itemRect(item); + const TQRect rect = m_listview->tqitemRect(item); if ( ! rect.isValid() ) return; @@ -133,7 +133,7 @@ void KileListViewToolTip::maybeTip(const QPoint &p) { tip(rect,i18n("Label: ") + item->label()); } - else if ( item->line()==0 && item->column()==0 && item->parent()==0L ) // only root + else if ( item->line()==0 && item->column()==0 && item->tqparent()==0L ) // only root { tip(rect,i18n("Click left to jump to the line. A double click will open\n a text file or a graphics file. When a label is assigned\nto this item, it will be shown when the mouse is over\nthis item. Items for a graphics file or an assigned label\nalso offer a context menu (right mouse button).")); } @@ -154,17 +154,17 @@ namespace KileWidget setSorting(-1,true); setAllColumnsShowFocus(true); setFullWidth(true); - setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored); + tqsetSizePolicy(TQSizePolicy::Ignored,TQSizePolicy::Ignored); - QToolTip::remove(this); + TQToolTip::remove(this); new KileListViewToolTip(this); - //connect(this, SIGNAL(clicked(QListViewItem *)), m_stack, SLOT(slotClicked(QListViewItem *))); - connect(this, SIGNAL(doubleClicked(QListViewItem *)), m_stack, SLOT(slotDoubleClicked(QListViewItem *))); - connect(this, SIGNAL(contextMenu(KListView *, QListViewItem *, const QPoint & )), m_stack, SLOT(slotPopup(KListView *, QListViewItem * , const QPoint & ))); + //connect(this, TQT_SIGNAL(clicked(TQListViewItem *)), m_stack, TQT_SLOT(slotClicked(TQListViewItem *))); + connect(this, TQT_SIGNAL(doubleClicked(TQListViewItem *)), m_stack, TQT_SLOT(slotDoubleClicked(TQListViewItem *))); + connect(this, TQT_SIGNAL(contextMenu(KListView *, TQListViewItem *, const TQPoint & )), m_stack, TQT_SLOT(slotPopup(KListView *, TQListViewItem * , const TQPoint & ))); - connect(this, SIGNAL(executed(QListViewItem*)), m_stack, SLOT(slotClicked(QListViewItem*))); - connect(m_stack, SIGNAL(configChanged()), this, SLOT(slotConfigChanged())); + connect(this, TQT_SIGNAL(executed(TQListViewItem*)), m_stack, TQT_SLOT(slotClicked(TQListViewItem*))); + connect(m_stack, TQT_SIGNAL(configChanged()), this, TQT_SLOT(slotConfigChanged())); init(); } @@ -173,16 +173,16 @@ namespace KileWidget void StructureList::init() { - QString title = (m_docinfo == 0L ) ? i18n("No \"structure data\" to display.") : m_docinfo->url().fileName(); + TQString title = (m_docinfo == 0L ) ? i18n("No \"structure data\" to display.") : m_docinfo->url().fileName(); m_root = new KileListViewItem(this, title); if ( m_docinfo != 0L ) { m_root->setURL(m_docinfo->url()); m_root->setOpen(true); m_root->setPixmap(0, SmallIcon("contents")); - connect(m_docinfo, SIGNAL(foundItem(const QString&, uint, uint, int, int, uint, uint, const QString &, const QString &)), - this, SLOT(addItem(const QString&, uint, uint, int, int, uint, uint, const QString &, const QString &))); -// connect(m_docinfo, SIGNAL(doneUpdating()), this, SLOT(insertInMasterList())); + connect(m_docinfo, TQT_SIGNAL(foundItem(const TQString&, uint, uint, int, int, uint, uint, const TQString &, const TQString &)), + this, TQT_SLOT(addItem(const TQString&, uint, uint, int, int, uint, uint, const TQString &, const TQString &))); +// connect(m_docinfo, TQT_SIGNAL(doneUpdating()), this, TQT_SLOT(insertInMasterList())); } m_parent[0]=m_parent[1]=m_parent[2]=m_parent[3]=m_parent[4]=m_parent[5]=m_parent[6]=m_root; @@ -232,7 +232,7 @@ namespace KileWidget } void StructureList::slotConfigChanged(){ - QWidget *current = m_stack->visibleWidget(); + TQWidget *current = m_stack->visibleWidget(); if(!current) return; cleanUp(false); @@ -247,7 +247,7 @@ namespace KileWidget m_openByLine.clear(); m_openByFolders.clear(); - QListViewItemIterator it(this); + TQListViewItemIterator it(this); KileListViewItem *item = 0L; while ( it.current() ) { @@ -256,7 +256,7 @@ namespace KileWidget { //we don't accept duplicate entries in the map, remove this item alltogether //and rely on the openByLine map instead - if ( m_openByTitle.contains ( item->title() ) ) + if ( m_openByTitle.tqcontains ( item->title() ) ) m_openByTitle.remove ( item->title() ); else m_openByTitle [ item->title() ] = item->isOpen(); @@ -266,60 +266,60 @@ namespace KileWidget ++it; } - if ( m_folders.contains("labels") ) + if ( m_folders.tqcontains("labels") ) m_openByFolders["labels"] = m_folders["labels"]->isOpen(); - if ( m_folders.contains("refs") ) + if ( m_folders.tqcontains("refs") ) m_openByFolders["refs"] = m_folders["refs"]->isOpen(); - if ( m_folders.contains("bibs") ) + if ( m_folders.tqcontains("bibs") ) m_openByFolders["bibs"] = m_folders["bibs"]->isOpen(); - if ( m_folders.contains("todo") ) + if ( m_folders.tqcontains("todo") ) m_openByFolders["todo"] = m_folders["todo"]->isOpen(); - if ( m_folders.contains("fixme") ) + if ( m_folders.tqcontains("fixme") ) m_openByFolders["fixme"] = m_folders["fixme"]->isOpen(); } - bool StructureList::shouldBeOpen(KileListViewItem *item, const QString & folder, int level) + bool StructureList::shouldBeOpen(KileListViewItem *item, const TQString & folder, int level) { - if ( item->parent() == 0L ) + if ( item->tqparent() == 0L ) return true; if ( folder == "labels" ) { - if ( m_openByFolders.contains("labels") ) + if ( m_openByFolders.tqcontains("labels") ) return m_openByFolders["labels"]; else return m_openStructureLabels; } else if ( folder == "refs" ) { - if ( m_openByFolders.contains("refs") ) + if ( m_openByFolders.tqcontains("refs") ) return m_openByFolders["refs"]; else return m_openStructureReferences; } else if ( folder == "bibs" ) { - if ( m_openByFolders.contains("bibs") ) + if ( m_openByFolders.tqcontains("bibs") ) return m_openByFolders["bibs"]; else return m_openStructureBibitems; } else if ( folder=="todo" || folder=="fixme" ) { - if ( m_openByFolders.contains(folder) ) + if ( m_openByFolders.tqcontains(folder) ) return m_openByFolders[folder]; else return m_openStructureTodo; } - if ( m_openByTitle.contains(item->title()) ) + if ( m_openByTitle.tqcontains(item->title()) ) return m_openByTitle [ item->title() ]; - else if ( m_openByLine.contains(item->line()) ) + else if ( m_openByLine.tqcontains(item->line()) ) return m_openByLine [ item->line() ]; //TODO check surrounding lines as well else return ((folder == "root") && level <= m_stack->level()); } - KileListViewItem* StructureList::createFolder(const QString &folder) + KileListViewItem* StructureList::createFolder(const TQString &folder) { KileListViewItem *fldr= new KileListViewItem(m_root, folder); fldr->setOpen(false); @@ -354,7 +354,7 @@ namespace KileWidget return m_folders[folder]; } - KileListViewItem* StructureList::folder(const QString &folder) + KileListViewItem* StructureList::folder(const TQString &folder) { KileListViewItem *item = m_folders[folder]; if ( item == 0L ) item = createFolder(folder); @@ -366,7 +366,7 @@ namespace KileWidget m_stack->raiseWidget(this); } - KileListViewItem *StructureList::parentFor(int lev, const QString & fldr) + KileListViewItem *StructureList::tqparentFor(int lev, const TQString & fldr) { KileListViewItem *par = 0L; @@ -402,8 +402,8 @@ namespace KileWidget /* some items have a special action: - KileStruct::Sect: The new item is saved in m_lastSectioning, so that all following entries - can be inserted as children. \part will drop back to level 0 of the Listview, - all other sectioning commands will be children of the last sectioning item. + can be inserted as tqchildren. \part will drop back to level 0 of the Listview, + all other sectioning commands will be tqchildren of the last sectioning item. If a \label command follows in the same or the next line, it is assigned to this item. - KileStruct::BeginFloat: @@ -436,9 +436,9 @@ namespace KileWidget immediately as next command, it is inserted into the title of this item. */ - void StructureList::addItem(const QString &title, uint line, uint column, int type, int lev, + void StructureList::addItem(const TQString &title, uint line, uint column, int type, int lev, uint startline, uint startcol, - const QString & pix, const QString &fldr /* = "root" */) + const TQString & pix, const TQString &fldr /* = "root" */) { // KILE_DEBUG() << "\t\taddItem: " << title << ", with type " << type << endl; if ( m_stop ) return; @@ -450,7 +450,7 @@ namespace KileWidget } else if ( type==KileStruct::Caption && m_lastFloat ) { - QString floattitle = m_lastFloat->title(); + TQString floattitle = m_lastFloat->title(); if ( floattitle=="figure" || floattitle=="table" ) m_lastFloat->setTitle(floattitle+": "+title); } @@ -504,17 +504,17 @@ namespace KileWidget m_lastType = type; m_lastLine = line; - //find the parent for the new element - KileListViewItem *parentItem = ( type==KileStruct::BeamerBeginBlock && m_lastFrameEnv ) ? m_lastFrameEnv : parentFor(lev, fldr); - if ( parentItem == 0L ) + //find the tqparent for the new element + KileListViewItem *tqparentItem = ( type==KileStruct::BeamerBeginBlock && m_lastFrameEnv ) ? m_lastFrameEnv : tqparentFor(lev, fldr); + if ( tqparentItem == 0L ) { - KMessageBox::error(0,i18n("Can't create ListviewItem: no parent found.")); + KMessageBox::error(0,i18n("Can't create ListviewItem: no tqparent found.")); return; } //find the last element at this level KileListViewItem *lastChild = 0L; - KileListViewItem *nextChild = (KileListViewItem *)parentItem->firstChild(); + KileListViewItem *nextChild = (KileListViewItem *)tqparentItem->firstChild(); while ( nextChild ) { lastChild = nextChild; @@ -522,14 +522,14 @@ namespace KileWidget } // create a new item - KileListViewItem *newChild = new KileListViewItem(parentItem, lastChild, title, m_docinfo->url(), line, column, type, lev, startline, startcol); + KileListViewItem *newChild = new KileListViewItem(tqparentItem, lastChild, title, m_docinfo->url(), line, column, type, lev, startline, startcol); if ( ! pix.isNull() ) newChild->setPixmap(0,SmallIcon(pix)); //m_stop = true; //if the level is not greater than the defaultLevel - //open the parentItem to make this item visible - parentItem->setOpen( shouldBeOpen(parentItem,fldr,lev) ); + //open the tqparentItem to make this item visible + tqparentItem->setOpen( shouldBeOpen(tqparentItem,fldr,lev) ); //update the m_parent levels, such that section etc. get inserted at the correct level //m_current = newChild; @@ -559,7 +559,7 @@ namespace KileWidget void StructureList::showReferences(KileInfo *ki) { // remove old listview item for references, if it exists - if ( m_folders.contains("refs") ) + if ( m_folders.tqcontains("refs") ) { KileListViewItem *refitem = m_folders["refs"]; m_root->takeItem(refitem); @@ -574,19 +574,19 @@ namespace KileWidget return; // read list with all labels - const QStringList *list = ki->allLabels(); + const TQStringList *list = ki->allLabels(); //KILE_DEBUG() << "\tfound " << list->count() << " labels" << endl; - QMap labelmap; - for ( QStringList::ConstIterator itmap=list->begin(); itmap!=list->end(); ++itmap ) + TQMap labelmap; + for ( TQStringList::ConstIterator itmap=list->begin(); itmap!=list->end(); ++itmap ) { labelmap[(*itmap)] = true; } // now check if there are unsolved references - QValueListConstIterator it; + TQValueListConstIterator it; for ( it=m_references.begin(); it!=m_references.end(); ++it ) { - if ( ! labelmap.contains((*it).name()) ) + if ( ! labelmap.tqcontains((*it).name()) ) { KileListViewItem *refitem = folder("refs"); refitem->setOpen( shouldBeOpen(refitem,"refs",0) ); @@ -595,10 +595,10 @@ namespace KileWidget } } - ////////////////////// Structure: QWidgetStack ////////////////////// + ////////////////////// Structure: TQWidgetStack ////////////////////// - Structure::Structure(KileInfo *ki, QWidget * parent, const char * name) : - QWidgetStack(parent,name), + Structure::Structure(KileInfo *ki, TQWidget * tqparent, const char * name) : + TQWidgetStack(tqparent,name), m_ki(ki), m_docinfo(0L) { @@ -606,7 +606,7 @@ namespace KileWidget setLineWidth(0); setMidLineWidth(0); setMargin(0); - setSizePolicy(QSizePolicy::Ignored,QSizePolicy::Ignored); + tqsetSizePolicy(TQSizePolicy::Ignored,TQSizePolicy::Ignored); m_default = new StructureList(this, 0L); m_default->activate(); @@ -630,7 +630,7 @@ namespace KileWidget m_map.insert(docinfo, view, true); } - void Structure::slotClicked(QListViewItem * itm) + void Structure::slotClicked(TQListViewItem * itm) { KILE_DEBUG() << "\tStructure::slotClicked" << endl; @@ -640,15 +640,15 @@ namespace KileWidget if (! (item->type() & KileStruct::None )) emit(setCursor(item->url(), item->line()-1, item->column())); - else if ( item->parent() == 0L ) //root item + else if ( item->tqparent() == 0L ) //root item emit(setCursor(item->url(), 0, 0)); } - void Structure::slotDoubleClicked(QListViewItem * itm) + void Structure::slotDoubleClicked(TQListViewItem * itm) { KILE_DEBUG() << "\tStructure::slotDoubleClicked" << endl; KileListViewItem *item = (KileListViewItem*)(itm); - static QRegExp::QRegExp suffix("\\.[\\d\\w]*$"); + static TQRegExp::TQRegExp suffix("\\.[\\d\\w]*$"); if (!item) return; @@ -657,9 +657,9 @@ namespace KileWidget if ( item->type() & (KileStruct::Input | KileStruct::Bibliography | KileStruct::Graphics) ) { - QString fname = item->title(); + TQString fname = item->title(); - if(fname.find(suffix) != -1) // check if we have a suffix, if not add standard suffixes + if(fname.tqfind(suffix) != -1) // check if we have a suffix, if not add standard suffixes { KILE_DEBUG() << "Suffix found: " << suffix.cap(0) << endl; } @@ -679,11 +679,11 @@ namespace KileWidget if(fname.left(1) != "/") // no absolute path { - QString fn = m_ki->getCompileName(); - fname= QFileInfo(fn).dirPath() + '/' + fname; + TQString fn = m_ki->getCompileName(); + fname= TQFileInfo(fn).dirPath() + '/' + fname; } - QFileInfo fi(fname); + TQFileInfo fi(fname); KURL url; url.setPath(fname); @@ -695,14 +695,14 @@ namespace KileWidget KRun::runURL(url,pMime->name()); } else - emit(fileOpen(url, QString::null)); + emit(fileOpen(url, TQString())); } else if( item->type() == KileStruct::Bibliography ){ fname = m_ki->checkOtherPaths(fi.dirPath(),fi.fileName(),KileInfo::bibinputs); fi.setFile(fname); url.setPath(fname); if(fi.isReadable()){ - emit(fileOpen(url, QString::null)); + emit(fileOpen(url, TQString())); } } else if( item->type() == KileStruct::Input ){ @@ -710,11 +710,11 @@ namespace KileWidget fi.setFile(fname); url.setPath(fname); if(fi.isReadable()){ - emit(fileOpen(url, QString::null)); + emit(fileOpen(url, TQString())); } } else{ - if ( KMessageBox::warningYesNo(this, i18n("Cannot find the included file. The file does not exist, is not readable or Kile is unable to determine the correct path to it. The filename causing this error was: %1.\nDo you want to create this file?").arg(fname), i18n("Cannot Find File")) + if ( KMessageBox::warningYesNo(this, i18n("Cannot find the included file. The file does not exist, is not readable or Kile is unable to determine the correct path to it. The filename causing this error was: %1.\nDo you want to create this file?").tqarg(fname), i18n("Cannot Find File")) == KMessageBox::Yes) { emit(fileNew(url)); @@ -728,7 +728,7 @@ namespace KileWidget // - sectioning: 10 - 16 // - graphics: 100ff - void Structure::slotPopup(KListView *, QListViewItem *itm, const QPoint &point) + void Structure::slotPopup(KListView *, TQListViewItem *itm, const TQPoint &point) { KILE_DEBUG() << "\tStructure::slotPopup" << endl; @@ -761,11 +761,11 @@ namespace KileWidget if(m_popupInfo.left(1) != "/") // no absolute path { - QString fn = m_ki->getCompileName(); - m_popupInfo = QFileInfo(fn).dirPath() + '/' + m_popupInfo; + TQString fn = m_ki->getCompileName(); + m_popupInfo = TQFileInfo(fn).dirPath() + '/' + m_popupInfo; } - QFileInfo fi(m_popupInfo); + TQFileInfo fi(m_popupInfo); if ( fi.isReadable() ) { KURL url; @@ -796,7 +796,7 @@ namespace KileWidget if ( m_popup->count() > 0 ) { - connect(m_popup,SIGNAL(activated(int)),this,SLOT(slotPopupActivated(int))); + connect(m_popup,TQT_SIGNAL(activated(int)),this,TQT_SLOT(slotPopupActivated(int))); m_popup->exec(point); } } @@ -816,7 +816,7 @@ namespace KileWidget { KILE_DEBUG() << "\tStructure::slotPopupLabel (" << id << ")"<< endl; - QString s = m_popupItem->label(); + TQString s = m_popupItem->label(); if ( id==1 || id==4 ) s = "\\ref{" + s + '}'; else if ( id==2 || id==5 ) @@ -825,7 +825,7 @@ namespace KileWidget if ( id <= 3 ) emit( sendText(s) ); else - QApplication::clipboard()->setText(s); + TQApplication::tqclipboard()->setText(s); } // id's 10..16 (already checked) @@ -864,13 +864,13 @@ namespace KileWidget { if ( info == 0L ) return false; else - return m_map.contains(info); + return m_map.tqcontains(info); } void Structure::closeDocumentInfo(KileDocument::Info *docinfo) { m_docinfo = 0L; - if ( m_map.contains(docinfo) ) + if ( m_map.tqcontains(docinfo) ) { StructureList *data = m_map[docinfo]; m_map.remove(docinfo); @@ -882,8 +882,8 @@ namespace KileWidget void Structure::clear() { - QMapIterator it; - QMapIterator itend(m_map.end()); + TQMapIterator it; + TQMapIterator itend(m_map.end()); for ( it = m_map.begin(); it != itend; ++it) if ( it.data() != 0L ) delete it.data(); @@ -974,7 +974,7 @@ namespace KileWidget bool found = false; uint foundRow,foundCol; StructureList *structurelist = viewFor(docinfo); - QListViewItemIterator it( structurelist ); + TQListViewItemIterator it( structurelist ); while ( it.current() ) { KileListViewItem *item = (KileListViewItem *)(it.current()); -- cgit v1.2.3