From 0a80cfd57d271dd44221467efb426675fa470356 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 28 Jun 2011 18:31:12 +0000 Subject: TQt4 port kvirc This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1238719 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/modules/aliaseditor/aliaseditor.cpp | 374 ++++++++++++++++---------------- 1 file changed, 187 insertions(+), 187 deletions(-) (limited to 'src/modules/aliaseditor/aliaseditor.cpp') diff --git a/src/modules/aliaseditor/aliaseditor.cpp b/src/modules/aliaseditor/aliaseditor.cpp index 3317fd3f..74d37529 100644 --- a/src/modules/aliaseditor/aliaseditor.cpp +++ b/src/modules/aliaseditor/aliaseditor.cpp @@ -41,34 +41,34 @@ #include "kvi_module.h" #include "kvi_valuelist.h" -#include -#include +#include +#include #include "kvi_tal_vbox.h" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include extern KviAliasEditorWindow * g_pAliasEditorWindow; extern KviModule * g_pAliasEditorModule; -KviAliasEditorListViewItem::KviAliasEditorListViewItem(KviTalListView * pListView,Type eType,const QString &szName) +KviAliasEditorListViewItem::KviAliasEditorListViewItem(KviTalListView * pListView,Type eType,const TQString &szName) : KviTalListViewItem(pListView), m_eType(eType), m_pParentNamespaceItem(0) { setName(szName); } -KviAliasEditorListViewItem::KviAliasEditorListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,Type eType,const QString &szName) +KviAliasEditorListViewItem::KviAliasEditorListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,Type eType,const TQString &szName) : KviTalListViewItem(pParentNamespaceItem), m_eType(eType), m_pParentNamespaceItem(pParentNamespaceItem) { setName(szName); } -QString KviAliasEditorListViewItem::key(int column,bool bAsc) const +TQString KviAliasEditorListViewItem::key(int column,bool bAsc) const { - QString ret; + TQString ret; if(m_eType == Namespace)ret = "1"; else ret = "2"; ret += m_szName; @@ -76,55 +76,55 @@ QString KviAliasEditorListViewItem::key(int column,bool bAsc) const } -void KviAliasEditorListViewItem::setName(const QString &szName) +void KviAliasEditorListViewItem::setName(const TQString &szName) { m_szName = szName; setText(0,m_szName); } -KviAliasListViewItem::KviAliasListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,const QString &szName) +KviAliasListViewItem::KviAliasListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,const TQString &szName) : KviAliasEditorListViewItem(pParentNamespaceItem,KviAliasEditorListViewItem::Alias,szName) { setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIAS))); - m_cPos=QPoint(0,0); + m_cPos=TQPoint(0,0); } -KviAliasListViewItem::KviAliasListViewItem(KviTalListView * pListView,const QString &szName) +KviAliasListViewItem::KviAliasListViewItem(KviTalListView * pListView,const TQString &szName) : KviAliasEditorListViewItem(pListView,KviAliasEditorListViewItem::Alias,szName) { setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIAS))); - m_cPos=QPoint(0,0); + m_cPos=TQPoint(0,0); } -KviAliasNamespaceListViewItem::KviAliasNamespaceListViewItem(KviTalListView * pListView,const QString &szName) +KviAliasNamespaceListViewItem::KviAliasNamespaceListViewItem(KviTalListView * pListView,const TQString &szName) : KviAliasEditorListViewItem(pListView,KviAliasEditorListViewItem::Namespace,szName) { setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_NAMESPACE))); } -KviAliasNamespaceListViewItem::KviAliasNamespaceListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,const QString &szName) +KviAliasNamespaceListViewItem::KviAliasNamespaceListViewItem(KviAliasNamespaceListViewItem * pParentNamespaceItem,const TQString &szName) : KviAliasEditorListViewItem(pParentNamespaceItem,KviAliasEditorListViewItem::Namespace,szName) { setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_NAMESPACE))); } -KviAliasNamespaceListViewItem * KviAliasNamespaceListViewItem::findNamespaceItem(const QString &szName) +KviAliasNamespaceListViewItem * KviAliasNamespaceListViewItem::findNamespaceItem(const TQString &szName) { KviAliasEditorListViewItem * it = (KviAliasEditorListViewItem *)firstChild(); while(it) { if(it->isNamespace()) { - if(KviQString::equalCI(szName,it->name()))return (KviAliasNamespaceListViewItem *)it; + if(KviTQString::equalCI(szName,it->name()))return (KviAliasNamespaceListViewItem *)it; } it = (KviAliasEditorListViewItem *)it->nextSibling(); } return 0; } -KviAliasNamespaceListViewItem * KviAliasNamespaceListViewItem::getNamespaceItem(const QString &szName) +KviAliasNamespaceListViewItem * KviAliasNamespaceListViewItem::getNamespaceItem(const TQString &szName) { KviAliasNamespaceListViewItem * it = findNamespaceItem(szName); if(it)return it; @@ -132,21 +132,21 @@ KviAliasNamespaceListViewItem * KviAliasNamespaceListViewItem::getNamespaceItem( return it; } -KviAliasListViewItem * KviAliasNamespaceListViewItem::findAliasItem(const QString &szName) +KviAliasListViewItem * KviAliasNamespaceListViewItem::findAliasItem(const TQString &szName) { KviAliasEditorListViewItem * it = (KviAliasEditorListViewItem *)firstChild(); while(it) { if(it->isAlias()) { - if(KviQString::equalCI(szName,it->name()))return (KviAliasListViewItem *)it; + if(KviTQString::equalCI(szName,it->name()))return (KviAliasListViewItem *)it; } it = (KviAliasEditorListViewItem *)it->nextSibling(); } return 0; } -KviAliasListViewItem * KviAliasNamespaceListViewItem::getAliasItem(const QString &szName) +KviAliasListViewItem * KviAliasNamespaceListViewItem::getAliasItem(const TQString &szName) { KviAliasListViewItem * it = findAliasItem(szName); if(it)return it; @@ -155,16 +155,16 @@ KviAliasListViewItem * KviAliasNamespaceListViewItem::getAliasItem(const QString } -KviAliasListViewItem * KviAliasNamespaceListViewItem::createFullAliasItem(const QString &szFullName) +KviAliasListViewItem * KviAliasNamespaceListViewItem::createFullAliasItem(const TQString &szFullName) { - QStringList lNamespaces; - QString szName; + TQStringList lNamespaces; + TQString szName; KviAliasEditor::splitFullAliasOrNamespaceName(szFullName,lNamespaces,szName); if(lNamespaces.isEmpty()) return getAliasItem(szName); - QStringList::Iterator it = lNamespaces.begin(); + TQStringList::Iterator it = lNamespaces.begin(); KviAliasNamespaceListViewItem * nit = getNamespaceItem(*it); ++it; @@ -177,16 +177,16 @@ KviAliasListViewItem * KviAliasNamespaceListViewItem::createFullAliasItem(const return nit->getAliasItem(szName); } -KviAliasNamespaceListViewItem * KviAliasNamespaceListViewItem::createFullNamespaceItem(const QString &szFullName) +KviAliasNamespaceListViewItem * KviAliasNamespaceListViewItem::createFullNamespaceItem(const TQString &szFullName) { - QStringList lNamespaces; - QString szName; + TQStringList lNamespaces; + TQString szName; KviAliasEditor::splitFullAliasOrNamespaceName(szFullName,lNamespaces,szName); if(lNamespaces.isEmpty()) return getNamespaceItem(szName); - QStringList::Iterator it = lNamespaces.begin(); + TQStringList::Iterator it = lNamespaces.begin(); KviAliasNamespaceListViewItem * nit = getNamespaceItem(*it); ++it; @@ -200,21 +200,21 @@ KviAliasNamespaceListViewItem * KviAliasNamespaceListViewItem::createFullNamespa } -KviAliasEditor::KviAliasEditor(QWidget * par) -: QWidget(par) +KviAliasEditor::KviAliasEditor(TQWidget * par) +: TQWidget(par) { m_pLastEditedItem = 0; m_pLastClickedItem = 0; - m_szDir = QDir::homeDirPath(); + m_szDir = TQDir::homeDirPath(); - QGridLayout * l = new QGridLayout(this,1,1,2,2); + TQGridLayout * l = new TQGridLayout(this,1,1,2,2); #ifdef COMPILE_USE_QT4 - m_pSplitter = new QSplitter(Qt::Horizontal,this); + m_pSplitter = new TQSplitter(Qt::Horizontal,this); m_pSplitter->setOpaqueResize(false); #else - m_pSplitter = new QSplitter(QSplitter::Horizontal,this); + m_pSplitter = new TQSplitter(Qt::Horizontal,this); #endif l->addWidget(m_pSplitter,0,0); @@ -228,16 +228,16 @@ KviAliasEditor::KviAliasEditor(QWidget * par) box = new KviTalVBox(m_pSplitter); KviTalHBox * hbox = new KviTalHBox(box); - m_pNameLabel = new QLabel(__tr2qs("No item selected"),hbox); - m_pRenameButton = new QPushButton(__tr2qs("Rename"),hbox); + m_pNameLabel = new TQLabel(__tr2qs("No item selected"),hbox); + m_pRenameButton = new TQPushButton(__tr2qs("Rename"),hbox); m_pRenameButton->setEnabled(false); - connect(m_pRenameButton,SIGNAL(clicked()),this,SLOT(renameItem())); + connect(m_pRenameButton,TQT_SIGNAL(clicked()),this,TQT_SLOT(renameItem())); hbox->setStretchFactor(m_pNameLabel,2); - QToolTip::add(m_pRenameButton,__tr2qs("Edit the alias or namespace name")); + TQToolTip::add(m_pRenameButton,__tr2qs("Edit the alias or namespace name")); m_pEditor = KviScriptEditor::createInstance(box); m_pEditor->setFocus(); - connect(m_pEditor,SIGNAL(find(const QString &)),this,SLOT(slotFindWord(const QString &))); - connect(m_pEditor,SIGNAL(replaceAll(const QString &,const QString &)),this,SLOT(slotReplaceAll(const QString &,const QString &))); + connect(m_pEditor,TQT_SIGNAL(tqfind(const TQString &)),this,TQT_SLOT(slotFindWord(const TQString &))); + connect(m_pEditor,TQT_SIGNAL(replaceAll(const TQString &,const TQString &)),this,TQT_SLOT(slotReplaceAll(const TQString &,const TQString &))); m_pContextPopup = new KviTalPopupMenu(this); @@ -251,18 +251,18 @@ KviAliasEditor::~KviAliasEditor() KviScriptEditor::destroyInstance(m_pEditor); } -KviAliasNamespaceListViewItem * KviAliasEditor::findNamespaceItem(const QString &szName) +KviAliasNamespaceListViewItem * KviAliasEditor::findNamespaceItem(const TQString &szName) { KviAliasNamespaceListViewItem * it = (KviAliasNamespaceListViewItem *)m_pListView->firstChild(); while(it) { - if(KviQString::equalCI(szName,it->name()))return it; + if(KviTQString::equalCI(szName,it->name()))return it; it = (KviAliasNamespaceListViewItem *)it->nextSibling(); } return 0; } -KviAliasNamespaceListViewItem * KviAliasEditor::getNamespaceItem(const QString &szName) +KviAliasNamespaceListViewItem * KviAliasEditor::getNamespaceItem(const TQString &szName) { KviAliasNamespaceListViewItem * it = findNamespaceItem(szName); if(it)return it; @@ -270,21 +270,21 @@ KviAliasNamespaceListViewItem * KviAliasEditor::getNamespaceItem(const QString & return it; } -KviAliasListViewItem * KviAliasEditor::findAliasItem(const QString &szName) +KviAliasListViewItem * KviAliasEditor::findAliasItem(const TQString &szName) { KviAliasEditorListViewItem * it = (KviAliasEditorListViewItem *)m_pListView->firstChild(); while(it) { if(it->isAlias()) { - if(KviQString::equalCI(szName,it->name()))return (KviAliasListViewItem *)it; + if(KviTQString::equalCI(szName,it->name()))return (KviAliasListViewItem *)it; } it = (KviAliasEditorListViewItem *)it->nextSibling(); } return 0; } -KviAliasListViewItem * KviAliasEditor::getAliasItem(const QString &szName) +KviAliasListViewItem * KviAliasEditor::getAliasItem(const TQString &szName) { KviAliasListViewItem * it = findAliasItem(szName); if(it)return it; @@ -293,48 +293,48 @@ KviAliasListViewItem * KviAliasEditor::getAliasItem(const QString &szName) } -void KviAliasEditor::splitFullAliasOrNamespaceName(const QString &szFullName,QStringList &lNamespaces,QString &szName) +void KviAliasEditor::splitFullAliasOrNamespaceName(const TQString &szFullName,TQStringList &lNamespaces,TQString &szName) { - lNamespaces = QStringList::split("::",szFullName); + lNamespaces = TQStringList::split("::",szFullName); if(lNamespaces.count() < 1) { szName = "unnamed"; - lNamespaces.append(QString("")); + lNamespaces.append(TQString("")); return; } szName = *(lNamespaces.fromLast()); lNamespaces.remove(lNamespaces.fromLast()); } -QString KviAliasEditor::buildFullItemName(KviAliasEditorListViewItem * it) +TQString KviAliasEditor::buildFullItemName(KviAliasEditorListViewItem * it) { - if(!it) return QString::null; - QString szName = it->name(); - KviAliasNamespaceListViewItem * nit = it->parentNamespaceItem(); + if(!it) return TQString(); + TQString szName = it->name(); + KviAliasNamespaceListViewItem * nit = it->tqparentNamespaceItem(); while(nit) { - QString tmp = nit->name(); + TQString tmp = nit->name(); if(!tmp.isEmpty()) { szName.prepend("::"); szName.prepend(tmp); } - nit = nit->parentNamespaceItem(); + nit = nit->tqparentNamespaceItem(); } return szName; } -KviAliasListViewItem * KviAliasEditor::createFullAliasItem(const QString &szFullName) +KviAliasListViewItem * KviAliasEditor::createFullAliasItem(const TQString &szFullName) { - QStringList lNamespaces; - QString szName; + TQStringList lNamespaces; + TQString szName; splitFullAliasOrNamespaceName(szFullName,lNamespaces,szName); if(lNamespaces.isEmpty()) return getAliasItem(szName); - QStringList::Iterator it = lNamespaces.begin(); + TQStringList::Iterator it = lNamespaces.begin(); KviAliasNamespaceListViewItem * nit = getNamespaceItem(*it); ++it; @@ -347,16 +347,16 @@ KviAliasListViewItem * KviAliasEditor::createFullAliasItem(const QString &szFull return nit->getAliasItem(szName); } -KviAliasNamespaceListViewItem * KviAliasEditor::createFullNamespaceItem(const QString &szFullName) +KviAliasNamespaceListViewItem * KviAliasEditor::createFullNamespaceItem(const TQString &szFullName) { - QStringList lNamespaces; - QString szName; + TQStringList lNamespaces; + TQString szName; splitFullAliasOrNamespaceName(szFullName,lNamespaces,szName); if(lNamespaces.isEmpty()) return getNamespaceItem(szName); - QStringList::Iterator it = lNamespaces.begin(); + TQStringList::Iterator it = lNamespaces.begin(); KviAliasNamespaceListViewItem * nit = getNamespaceItem(*it); ++it; @@ -371,10 +371,10 @@ KviAliasNamespaceListViewItem * KviAliasEditor::createFullNamespaceItem(const QS void KviAliasEditor::oneTimeSetup() { - KviPointerHashTable * a = KviKvsAliasManager::instance()->aliasDict(); + KviPointerHashTable * a = KviKvsAliasManager::instance()->aliasDict(); if(!a)return; - KviPointerHashTableIterator it(*a); + KviPointerHashTableIterator it(*a); KviAliasListViewItem * item; while(it.current()) @@ -385,9 +385,9 @@ void KviAliasEditor::oneTimeSetup() ++it; } - connect(m_pListView,SIGNAL(currentChanged(KviTalListViewItem *)),this,SLOT(currentItemChanged(KviTalListViewItem *))); - connect(m_pListView,SIGNAL(rightButtonPressed(KviTalListViewItem *,const QPoint &,int)), - this,SLOT(itemPressed(KviTalListViewItem *,const QPoint &,int))); + connect(m_pListView,TQT_SIGNAL(currentChanged(KviTalListViewItem *)),this,TQT_SLOT(currentItemChanged(KviTalListViewItem *))); + connect(m_pListView,TQT_SIGNAL(rightButtonPressed(KviTalListViewItem *,const TQPoint &,int)), + this,TQT_SLOT(itemPressed(KviTalListViewItem *,const TQPoint &,int))); } bool KviAliasEditor::hasSelectedItems(KviTalListViewItem * it) @@ -411,7 +411,7 @@ bool KviAliasEditor::itemExists(KviTalListViewItem *pSearchFor,KviTalListViewIte } -void KviAliasEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int col) +void KviAliasEditor::itemPressed(KviTalListViewItem *it,const TQPoint &pnt,int col) { m_pContextPopup->clear(); @@ -422,12 +422,12 @@ void KviAliasEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int co m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIAS)), __tr2qs("Add Alias"), - this,SLOT(newAlias())); + this,TQT_SLOT(newAlias())); m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIAS)), __tr2qs("Add Namespace"), - this,SLOT(newNamespace())); + this,TQT_SLOT(newNamespace())); bool bHasItems = m_pListView->firstChild() != 0; @@ -436,9 +436,9 @@ void KviAliasEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int co m_pContextPopup->insertSeparator(); id = m_pContextPopup->insertItem( - *(g_pIconManager->getSmallIcon(KVI_SMALLICON_QUIT)), + *(g_pIconManager->getSmallIcon(KVI_SMALLICON_TQUIT)), __tr2qs("Remove Selected"), - this,SLOT(removeSelectedItems())); + this,TQT_SLOT(removeSelectedItems())); m_pContextPopup->setItemEnabled(id,bHasSelected); @@ -447,20 +447,20 @@ void KviAliasEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int co m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_FOLDER)), __tr2qs("Export Selected..."), - this,SLOT(exportSelected())); + this,TQT_SLOT(exportSelected())); m_pContextPopup->setItemEnabled(id,bHasSelected); m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_FOLDER)), __tr2qs("Export Selected in singles files..."), - this,SLOT(exportSelectedSepFiles())); + this,TQT_SLOT(exportSelectedSepFiles())); m_pContextPopup->setItemEnabled(id,bHasSelected); m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_FOLDER)), __tr2qs("Export All..."), - this,SLOT(exportAll())); + this,TQT_SLOT(exportAll())); m_pContextPopup->setItemEnabled(id,bHasItems); m_pContextPopup->insertSeparator(); @@ -468,13 +468,13 @@ void KviAliasEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int co m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_SEARCH)), __tr2qs("Find In Aliases..."), - this,SLOT(slotFind())); + this,TQT_SLOT(slotFind())); m_pContextPopup->setItemEnabled(id,bHasItems); m_pContextPopup->insertItem( *(g_pIconManager->getSmallIcon(KVI_SMALLICON_NAMESPACE)), __tr2qs("Collapse All Namespaces"), - this,SLOT(slotCollapseNamespaces())); + this,TQT_SLOT(slotCollapseNamespaces())); m_pContextPopup->setItemEnabled(id,bHasItems); @@ -482,15 +482,15 @@ void KviAliasEditor::itemPressed(KviTalListViewItem *it,const QPoint &pnt,int co m_pContextPopup->popup(pnt); } -void KviAliasEditor::recursiveSearchReplace(const QString &szSearch,KviAliasEditorListViewItem * it,bool bReplace,const QString &szReplace) +void KviAliasEditor::recursiveSearchReplace(const TQString &szSearch,KviAliasEditorListViewItem * it,bool bReplace,const TQString &szReplace) { if(!it)return; if(it->isAlias()) { - if(((KviAliasListViewItem *)it)->buffer().find(szSearch,0,false) != -1) + if(((KviAliasListViewItem *)it)->buffer().tqfind(szSearch,0,false) != -1) { it->setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIASHIGHLIGHTED))); - if (bReplace) ((QString &)((KviAliasListViewItem *)it)->buffer()).replace(szSearch,szReplace,false); + if (bReplace) ((TQString &)((KviAliasListViewItem *)it)->buffer()).tqreplace(szSearch,szReplace,false); openParentItems(it); } else it->setPixmap(0,*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIAS))); @@ -504,10 +504,10 @@ void KviAliasEditor::slotFind() { g_pAliasEditorModule->lock(); bool bOk; - QString szSearch = QInputDialog::getText( + TQString szSearch = TQInputDialog::getText( __tr2qs("Find In Aliases"), __tr2qs("Please enter the text to be searched for. The matching aliases will be highlighted."), - QLineEdit::Normal, + TQLineEdit::Normal, "", &bOk, this); @@ -518,7 +518,7 @@ void KviAliasEditor::slotFind() recursiveSearchReplace(szSearch,(KviAliasEditorListViewItem *)m_pListView->firstChild()); } -void KviAliasEditor::slotFindWord(const QString &szSearch) +void KviAliasEditor::slotFindWord(const TQString &szSearch) { m_pEditor->setFindText(szSearch); @@ -542,18 +542,18 @@ void KviAliasEditor::slotCollapseNamespaces() } -void KviAliasEditor::slotReplaceAll(const QString &before,const QString &after) +void KviAliasEditor::slotReplaceAll(const TQString &before,const TQString &after) { recursiveSearchReplace(before,(KviAliasEditorListViewItem *)m_pListView->firstChild(),true,after); } -void KviAliasEditor::getExportAliasBuffer(QString &buffer,KviAliasListViewItem * it) +void KviAliasEditor::getExportAliasBuffer(TQString &buffer,KviAliasListViewItem * it) { - QString szBuf = it->buffer(); + TQString szBuf = it->buffer(); KviCommandFormatter::blockFromBuffer(szBuf); - QString szNam = buildFullItemName(it); + TQString szNam = buildFullItemName(it); buffer = "alias("; buffer += szNam; @@ -579,12 +579,12 @@ void KviAliasEditor::exportSelected() void KviAliasEditor::exportSelectionInSinglesFiles(KviPointerList *l) { - if(!m_szDir.endsWith(QString(KVI_PATH_SEPARATOR)))m_szDir += KVI_PATH_SEPARATOR; + if(!m_szDir.endsWith(TQString(KVI_PATH_SEPARATOR)))m_szDir += KVI_PATH_SEPARATOR; debug ("dir %s",m_szDir.latin1()); if (!l->first()) { g_pAliasEditorModule->lock(); - QMessageBox::warning(this,__tr2qs("Alias Export"),__tr2qs("There is not selection!"),__tr2qs("Ok")); + TQMessageBox::warning(this,__tr2qs("Alias Export"),__tr2qs("There is not selection!"),__tr2qs("Ok")); g_pAliasEditorModule->unlock(); return; } @@ -595,25 +595,25 @@ void KviAliasEditor::exportSelectionInSinglesFiles(KviPointerListfirst();it;it = l->next()) { - QString tmp; + TQString tmp; getExportAliasBuffer(tmp,it); - QString szFileName=buildFullItemName(it); + TQString szFileName=buildFullItemName(it); szFileName += ".kvs"; - szFileName.replace("::","_"); - QString szCompletePath=m_szDir+szFileName; + szFileName.tqreplace("::","_"); + TQString szCompletePath=m_szDir+szFileName; if (KviFileUtils::fileExists(szCompletePath) && !bReplaceAll) { - QString szMsg; - KviQString::sprintf(szMsg,__tr2qs("The file \"%Q\" exists. Do you want to replace it ?"),&szFileName); - int ret = QMessageBox::question(this,__tr2qs("Replace file"),szMsg,__tr2qs("Yes"),__tr2qs("Yes to All"),__tr2qs("No")); + TQString szMsg; + KviTQString::sprintf(szMsg,__tr2qs("The file \"%Q\" exists. Do you want to replace it ?"),&szFileName); + int ret = TQMessageBox::question(this,__tr2qs("Replace file"),szMsg,__tr2qs("Yes"),__tr2qs("Yes to All"),__tr2qs("No")); if (ret!=2){ KviFileUtils::writeFile(szCompletePath,tmp); if (ret==1) bReplaceAll=true; @@ -634,7 +634,7 @@ void KviAliasEditor::exportAliases(bool bSelectedOnly,bool bSingleFiles) KviPointerList l; l.setAutoDelete(false); - QString out; + TQString out; appendAliasItems(&l,(KviAliasEditorListViewItem *)(m_pListView->firstChild()),bSelectedOnly); if (bSingleFiles) @@ -649,30 +649,30 @@ void KviAliasEditor::exportAliases(bool bSelectedOnly,bool bSingleFiles) { tempitem=it; count ++; - QString tmp; + TQString tmp; getExportAliasBuffer(tmp,it); out += tmp; out += "\n"; } - QString szNameFile; + TQString szNameFile; if(out.isEmpty()) { g_pAliasEditorModule->lock(); - QMessageBox::warning(this,__tr2qs("Alias Export"),__tr2qs("There exported file would be empty: cowardly refusing to write it"),__tr2qs("Ok")); + TQMessageBox::warning(this,__tr2qs("Alias Export"),__tr2qs("There exported file would be empty: cowardly refusing to write it"),__tr2qs("Ok")); g_pAliasEditorModule->unlock(); return; } - QString szName = m_szDir; + TQString szName = m_szDir; - if(!szName.endsWith(QString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR; - QString szFile; + if(!szName.endsWith(TQString(KVI_PATH_SEPARATOR)))szName += KVI_PATH_SEPARATOR; + TQString szFile; g_pAliasEditorModule->lock(); if (count==1) { - QString tmp=buildFullItemName(tempitem); - szNameFile = tmp.replace("::","_"); + TQString tmp=buildFullItemName(tempitem); + szNameFile = tmp.tqreplace("::","_"); } else szNameFile="aliases"; szName += szNameFile; @@ -682,13 +682,13 @@ void KviAliasEditor::exportAliases(bool bSelectedOnly,bool bSingleFiles) g_pAliasEditorModule->unlock(); return; } - m_szDir=QFileInfo(szFile).dirPath(TRUE); + m_szDir=TQFileInfo(szFile).dirPath(TRUE); g_pAliasEditorModule->unlock(); if(!KviFileUtils::writeFile(szFile,out)) { g_pAliasEditorModule->lock(); - QMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the alias file."),__tr2qs("Ok")); + TQMessageBox::warning(this,__tr2qs("Write Failed - KVIrc"),__tr2qs("Unable to write to the alias file."),__tr2qs("Ok")); g_pAliasEditorModule->unlock(); } } @@ -696,7 +696,7 @@ void KviAliasEditor::exportAliases(bool bSelectedOnly,bool bSingleFiles) void KviAliasEditor::saveProperties(KviConfig *cfg) { cfg->writeEntry("Sizes",m_pSplitter->sizes()); - QString szName; + TQString szName; if(m_pLastEditedItem) szName = buildFullItemName(m_pLastEditedItem); cfg->writeEntry("LastAlias",szName); @@ -708,7 +708,7 @@ void KviAliasEditor::loadProperties(KviConfig *cfg) def.append(20); def.append(80); m_pSplitter->setSizes(cfg->readIntListEntry("Sizes",def)); - QString tmp = cfg->readEntry("LastAlias",QString::null); + TQString tmp = cfg->readEntry("LastAlias",TQString()); KviAliasEditorListViewItem * it = findAliasItem(tmp); if(!it)it = findNamespaceItem(tmp); @@ -784,21 +784,21 @@ void KviAliasEditor::appendSelectedItems(KviPointerListname(); + TQString szMsg; + TQString szName = it->name(); if(!*pbYesToAll) { if(it->isAlias()) - KviQString::sprintf(szMsg,__tr2qs("Do you really want to remove the alias \"%Q\" ?"),&szName); + KviTQString::sprintf(szMsg,__tr2qs("Do you really want to remove the alias \"%Q\" ?"),&szName); else { - KviQString::sprintf(szMsg,__tr2qs("Do you really want to remove the namespace \"%Q\" ?"),&szName); + KviTQString::sprintf(szMsg,__tr2qs("Do you really want to remove the namespace \"%Q\" ?"),&szName); szMsg += "
"; - szMsg += __tr2qs("Please note that all the children items will be deleted too."); + szMsg += __tr2qs("Please note that all the tqchildren items will be deleted too."); } g_pAliasEditorModule->lock(); - int ret = QMessageBox::question(this,__tr2qs("Remove item"),szMsg,__tr2qs("Yes"),__tr2qs("Yes to All"),__tr2qs("No")); + int ret = TQMessageBox::question(this,__tr2qs("Remove item"),szMsg,__tr2qs("Yes"),__tr2qs("Yes to All"),__tr2qs("No")); g_pAliasEditorModule->unlock(); switch(ret) { @@ -822,7 +822,7 @@ bool KviAliasEditor::removeItem(KviAliasEditorListViewItem *it,bool * pbYesToAll { while(it) { - KviAliasEditorListViewItem * par = (KviAliasEditorListViewItem *)(it->parent()); + KviAliasEditorListViewItem * par = (KviAliasEditorListViewItem *)(it->tqparent()); delete it; if(par) { @@ -852,26 +852,26 @@ void KviAliasEditor::removeSelectedItems() } } -QString KviAliasEditor::askForAliasName(const QString &szAction,const QString &szText,const QString &szInitialText) +TQString KviAliasEditor::askForAliasName(const TQString &szAction,const TQString &szText,const TQString &szInitialText) { bool bOk = false; - QString szNewName; + TQString szNewName; while(szNewName.isEmpty()) { g_pAliasEditorModule->lock(); - szNewName = QInputDialog::getText( + szNewName = TQInputDialog::getText( szAction, szText, - QLineEdit::Normal, + TQLineEdit::Normal, szInitialText, &bOk, this); g_pAliasEditorModule->unlock(); - if(!bOk)return QString::null; + if(!bOk)return TQString(); if(szNewName.isEmpty()) { g_pAliasEditorModule->lock(); - QMessageBox::warning(this, + TQMessageBox::warning(this, __tr2qs("Missing Alias Name"), __tr2qs("You must specify a valid name for the alias"), __tr2qs("Ok, Let me try again...")); @@ -880,11 +880,11 @@ QString KviAliasEditor::askForAliasName(const QString &szAction,const QString &s } // we allow only [\w:]+ - QRegExp re("[\\w:]+"); + TQRegExp re("[\\w:]+"); if(!re.exactMatch(szNewName)) { g_pAliasEditorModule->lock(); - QMessageBox::information(this, + TQMessageBox::information(this, __tr2qs("Bad Alias Name"), __tr2qs("Alias names can contain only letters, digits, underscores and '::' namespace separators"), __tr2qs("Ok, Let me try again...")); @@ -893,12 +893,12 @@ QString KviAliasEditor::askForAliasName(const QString &szAction,const QString &s continue; } // make sure that we have only doubled "::" and not ":" or ":::..." - QString tmp = szNewName; - tmp.replace("::","@"); // @ is not allowed by the rule above - if(tmp.find(":") != -1) + TQString tmp = szNewName; + tmp.tqreplace("::","@"); // @ is not allowed by the rule above + if(tmp.tqfind(":") != -1) { g_pAliasEditorModule->lock(); - QMessageBox::information(this, + TQMessageBox::information(this, __tr2qs("Bad Alias Name"), __tr2qs("Stray ':' character in alias name: did you mean ...:: ?"), __tr2qs("Ok, Let me try again...")); @@ -906,10 +906,10 @@ QString KviAliasEditor::askForAliasName(const QString &szAction,const QString &s szNewName = ""; continue; } - if(tmp.find("@@") != -1) + if(tmp.tqfind("@@") != -1) { g_pAliasEditorModule->lock(); - QMessageBox::information(this, + TQMessageBox::information(this, __tr2qs("Bad Alias Name"), __tr2qs("Found an empty namespace in alias name"), __tr2qs("Ok, Let me try again...")); @@ -921,26 +921,26 @@ QString KviAliasEditor::askForAliasName(const QString &szAction,const QString &s return szNewName; } -QString KviAliasEditor::askForNamespaceName(const QString &szAction,const QString &szText,const QString &szInitialText) +TQString KviAliasEditor::askForNamespaceName(const TQString &szAction,const TQString &szText,const TQString &szInitialText) { bool bOk = false; - QString szNewName; + TQString szNewName; while(szNewName.isEmpty()) { g_pAliasEditorModule->lock(); - szNewName = QInputDialog::getText( + szNewName = TQInputDialog::getText( szAction, szText, - QLineEdit::Normal, + TQLineEdit::Normal, szInitialText, &bOk, this); g_pAliasEditorModule->unlock(); - if(!bOk)return QString::null; + if(!bOk)return TQString(); if(szNewName.isEmpty()) { g_pAliasEditorModule->lock(); - QMessageBox::warning(this, + TQMessageBox::warning(this, __tr2qs("Missing Namespace Name"), __tr2qs("You must specify a valid name for the namespace"), __tr2qs("Ok, Let me try again...")); @@ -949,11 +949,11 @@ QString KviAliasEditor::askForNamespaceName(const QString &szAction,const QStrin } // we allow only [\w:]+ - QRegExp re("[\\w:]+"); + TQRegExp re("[\\w:]+"); if(!re.exactMatch(szNewName)) { g_pAliasEditorModule->lock(); - QMessageBox::information(this, + TQMessageBox::information(this, __tr2qs("Bad Namespace Name"), __tr2qs("Namespace names can contain only letters, digits, underscores and '::' namespace separators"), __tr2qs("Ok, Let me try again...")); @@ -962,12 +962,12 @@ QString KviAliasEditor::askForNamespaceName(const QString &szAction,const QStrin continue; } // make sure that we have only doubled "::" and not ":" or ":::..." - QString tmp = szNewName; - tmp.replace("::","@"); // @ is not allowed by the rule above - if(tmp.find(":") != -1) + TQString tmp = szNewName; + tmp.tqreplace("::","@"); // @ is not allowed by the rule above + if(tmp.tqfind(":") != -1) { g_pAliasEditorModule->lock(); - QMessageBox::information(this, + TQMessageBox::information(this, __tr2qs("Bad Namespace Name"), __tr2qs("Stray ':' character in namespace name: did you mean ...:: ?"), __tr2qs("Ok, Let me try again...")); @@ -975,10 +975,10 @@ QString KviAliasEditor::askForNamespaceName(const QString &szAction,const QStrin szNewName = ""; continue; } - if(tmp.find("@@") != -1) + if(tmp.tqfind("@@") != -1) { g_pAliasEditorModule->lock(); - QMessageBox::information(this, + TQMessageBox::information(this, __tr2qs("Bad Namespace Name"), __tr2qs("Found an empty namespace in namespace name"), __tr2qs("Ok, Let me try again...")); @@ -992,10 +992,10 @@ QString KviAliasEditor::askForNamespaceName(const QString &szAction,const QStrin void KviAliasEditor::openParentItems(KviTalListViewItem * it) { - if(it->parent()) + if(it->tqparent()) { - it->parent()->setOpen(true); - openParentItems(it->parent()); + it->tqparent()->setOpen(true); + openParentItems(it->tqparent()); } } @@ -1024,10 +1024,10 @@ void KviAliasEditor::newAlias() { if(!itemExists(m_pLastClickedItem,m_pListView->firstChild()))return; // dead ? if(m_pLastClickedItem->isAlias()) - m_pLastClickedItem = m_pLastClickedItem->parentNamespaceItem(); + m_pLastClickedItem = m_pLastClickedItem->tqparentNamespaceItem(); } - QString szNewName = askForAliasName(__tr2qs("Add Alias"),__tr2qs("Please enter the name for the new alias"),"myfunction"); + TQString szNewName = askForAliasName(__tr2qs("Add Alias"),__tr2qs("Please enter the name for the new alias"),"myfunction"); if(szNewName.isEmpty())return; getUniqueItemName(m_pLastClickedItem,szNewName,KviAliasEditorListViewItem::Alias); @@ -1048,11 +1048,11 @@ void KviAliasEditor::newNamespace() { if(!itemExists(m_pLastClickedItem,m_pListView->firstChild()))return; // dead ? if(m_pLastClickedItem->isAlias()) - m_pLastClickedItem = m_pLastClickedItem->parentNamespaceItem(); + m_pLastClickedItem = m_pLastClickedItem->tqparentNamespaceItem(); } - QString szNewName = askForNamespaceName(__tr2qs("Add Namespace"),__tr2qs("Please enter the name for the new namespace"),"mynamespace"); + TQString szNewName = askForNamespaceName(__tr2qs("Add Namespace"),__tr2qs("Please enter the name for the new namespace"),"mynamespace"); if(szNewName.isEmpty())return; getUniqueItemName(m_pLastClickedItem,szNewName,KviAliasEditorListViewItem::Namespace); @@ -1067,7 +1067,7 @@ void KviAliasEditor::newNamespace() activateItem(it); } -bool KviAliasEditor::aliasExists(QString &szFullItemName) +bool KviAliasEditor::aliasExists(TQString &szFullItemName) { KviPointerList l; l.setAutoDelete(false); @@ -1075,7 +1075,7 @@ bool KviAliasEditor::aliasExists(QString &szFullItemName) appendAliasItems(&l,(KviAliasEditorListViewItem *)(m_pListView->firstChild()),false); for(KviAliasListViewItem * it = l.first();it;it = l.next()) { - if (KviQString::equalCI(buildFullItemName(it),szFullItemName)) + if (KviTQString::equalCI(buildFullItemName(it),szFullItemName)) { return true; } @@ -1083,7 +1083,7 @@ bool KviAliasEditor::aliasExists(QString &szFullItemName) return false; } -bool KviAliasEditor::namespaceExists(QString &szFullItemName) +bool KviAliasEditor::namespaceExists(TQString &szFullItemName) { KviPointerList l; l.setAutoDelete(false); @@ -1091,7 +1091,7 @@ bool KviAliasEditor::namespaceExists(QString &szFullItemName) appendNamespaceItems(&l,(KviAliasEditorListViewItem *)(m_pListView->firstChild()),false); for(KviAliasListViewItem * it = l.first();it;it = l.next()) { - if (KviQString::equalCI(buildFullItemName(it),szFullItemName)) + if (KviTQString::equalCI(buildFullItemName(it),szFullItemName)) { return true; } @@ -1103,8 +1103,8 @@ void KviAliasEditor::renameItem() if(!m_pLastEditedItem)return; if(!itemExists(m_pLastEditedItem,m_pListView->firstChild()))return; // dead ? - QString szName = buildFullItemName(m_pLastEditedItem); - QString szNewName; + TQString szName = buildFullItemName(m_pLastEditedItem); + TQString szNewName; bool bAlias = m_pLastEditedItem->isAlias(); @@ -1122,7 +1122,7 @@ void KviAliasEditor::renameItem() if (aliasExists(szNewName)) { g_pAliasEditorModule->lock(); - QMessageBox::information(this, + TQMessageBox::information(this, __tr2qs("Alias already exists"), __tr2qs("This name is already in use. Please choose another one."), __tr2qs("Ok, Let me try again...")); @@ -1134,7 +1134,7 @@ void KviAliasEditor::renameItem() if (namespaceExists(szNewName)) { g_pAliasEditorModule->lock(); - QMessageBox::information(this, + TQMessageBox::information(this, __tr2qs("Namespace already exists"), __tr2qs("This name is already in use. Please choose another one."), __tr2qs("Ok, let me try again...")); @@ -1143,8 +1143,8 @@ void KviAliasEditor::renameItem() } } - QString szCode; - QPoint pntCursor; + TQString szCode; + TQPoint pntCursor; if(bAlias) { m_pEditor->getText(szCode); @@ -1200,7 +1200,7 @@ void KviAliasEditor::saveLastEditedItem() if(m_pLastEditedItem->isNamespace())return; - QString newCode; + TQString newCode; m_pEditor->getText(newCode); ((KviAliasListViewItem *)m_pLastEditedItem)->setBuffer(newCode); ((KviAliasListViewItem *)m_pLastEditedItem)->setCursorPosition(m_pEditor->getCursor()); @@ -1221,10 +1221,10 @@ void KviAliasEditor::currentItemChanged(KviTalListViewItem *it) return; } - QString szNam = buildFullItemName(m_pLastEditedItem); + TQString szNam = buildFullItemName(m_pLastEditedItem); if(m_pLastEditedItem->isNamespace()) { - QString szLabelText = __tr2qs("Namespace"); + TQString szLabelText = __tr2qs("Namespace"); szLabelText += ": "; szLabelText += szNam; szLabelText += ""; @@ -1235,7 +1235,7 @@ void KviAliasEditor::currentItemChanged(KviTalListViewItem *it) return; } - QString szLabelText = __tr2qs("Alias"); + TQString szLabelText = __tr2qs("Alias"); szLabelText += ": "; szLabelText += szNam; szLabelText += ""; @@ -1251,7 +1251,7 @@ void KviAliasEditor::recursiveCommit(KviAliasEditorListViewItem * it) if(!it)return; if(it->isAlias()) { - QString szName = buildFullItemName(it); + TQString szName = buildFullItemName(it); //debug("ADDING %s",szName.latin1()); // WARNING: On MSVC operator new here is valid ONLY because // KviKvsScript has a non virtual detructor! @@ -1275,9 +1275,9 @@ void KviAliasEditor::commit() } -void KviAliasEditor::getUniqueItemName(KviAliasEditorListViewItem *item,QString &buffer,KviAliasEditorListViewItem::Type eType) +void KviAliasEditor::getUniqueItemName(KviAliasEditorListViewItem *item,TQString &buffer,KviAliasEditorListViewItem::Type eType) { - QString ret; + TQString ret; int idx = 0; KviAliasEditorListViewItem * found; @@ -1287,7 +1287,7 @@ void KviAliasEditor::getUniqueItemName(KviAliasEditorListViewItem *item,QString ret = buffer; if(idx > 0) { - QString tmp; + TQString tmp; tmp.setNum(idx); ret.append(tmp); } @@ -1333,21 +1333,21 @@ KviAliasEditorWindow::KviAliasEditorWindow(KviFrame * lpFrm) m_pEditor = new KviAliasEditor(this); - m_pBase = new QWidget(this); - QGridLayout * g = new QGridLayout(m_pBase,1,4,4,4); + m_pBase = new TQWidget(this); + TQGridLayout * g = new TQGridLayout(m_pBase,1,4,4,4); - QPushButton * btn = new QPushButton(__tr2qs("&OK"),m_pBase); - connect(btn,SIGNAL(clicked()),this,SLOT(okClicked())); + TQPushButton * btn = new TQPushButton(__tr2qs("&OK"),m_pBase); + connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(okClicked())); btn->setIconSet(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT))); g->addWidget(btn,0,1); - btn = new QPushButton(__tr2qs("&Apply"),m_pBase); - connect(btn,SIGNAL(clicked()),this,SLOT(applyClicked())); + btn = new TQPushButton(__tr2qs("&Apply"),m_pBase); + connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(applyClicked())); btn->setIconSet(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_ACCEPT))); g->addWidget(btn,0,2); - btn = new QPushButton(__tr2qs("Cancel"),m_pBase); - connect(btn,SIGNAL(clicked()),this,SLOT(cancelClicked())); + btn = new TQPushButton(__tr2qs("Cancel"),m_pBase); + connect(btn,TQT_SIGNAL(clicked()),this,TQT_SLOT(cancelClicked())); btn->setIconSet(*(g_pIconManager->getSmallIcon(KVI_SMALLICON_DISCARD))); g->addWidget(btn,0,3); @@ -1376,14 +1376,14 @@ void KviAliasEditorWindow::cancelClicked() } -QPixmap * KviAliasEditorWindow::myIconPtr() +TQPixmap * KviAliasEditorWindow::myIconPtr() { return g_pIconManager->getSmallIcon(KVI_SMALLICON_ALIAS); } -void KviAliasEditorWindow::resizeEvent(QResizeEvent *e) +void KviAliasEditorWindow::resizeEvent(TQResizeEvent *e) { - int hght = m_pBase->sizeHint().height(); + int hght = m_pBase->tqsizeHint().height(); m_pEditor->setGeometry(0,0,width(),height()- hght); m_pBase->setGeometry(0,height() - hght,width(),hght); } -- cgit v1.2.1