diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-14 16:45:05 +0000 |
commit | 48d4a26399959121f33d2bc3bfe51c7827b654fc (patch) | |
tree | 5ae5e6e00d3ba330b7b8be9bc097154b6bc739e8 /parts/snippet/snippet_widget.cpp | |
parent | 7e701ace6592d09e1f2c0cf28c7d6d872d78f4f5 (diff) | |
download | tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.tar.gz tdevelop-48d4a26399959121f33d2bc3bfe51c7827b654fc.zip |
TQt4 port kdevelop
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1236710 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/snippet/snippet_widget.cpp')
-rw-r--r-- | parts/snippet/snippet_widget.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/parts/snippet/snippet_widget.cpp b/parts/snippet/snippet_widget.cpp index 2c35d5c5..e555115a 100644 --- a/parts/snippet/snippet_widget.cpp +++ b/parts/snippet/snippet_widget.cpp @@ -50,7 +50,7 @@ SnippetWidget::SnippetWidget(SnippetPart *part) : KListView(0, "snippet widget"), TQToolTip( viewport() ), m_part( part ) { - // init the QPtrList + // init the TQPtrList _list.setAutoDelete(TRUE); // init the KListView @@ -85,7 +85,7 @@ SnippetWidget::~SnippetWidget() writeConfig(); delete _cfg; - /* We need to delete the child items before the parent items + /* We need to delete the child items before the tqparent items otherwise KDevelop would crash on exiting */ SnippetItem * item; while (_list.count() > 0) { @@ -111,7 +111,7 @@ void SnippetWidget::slotAdd() which the selected item is a child of*/ SnippetGroup * group = dynamic_cast<SnippetGroup*>(selectedItem()); if (!group) - group = dynamic_cast<SnippetGroup*>(selectedItem()->parent()); + group = dynamic_cast<SnippetGroup*>(selectedItem()->tqparent()); /*fill the combobox with the names of all SnippetGroup entries*/ for (SnippetItem *it=_list.first(); it; it=_list.next()) { @@ -165,7 +165,7 @@ void SnippetWidget::slotRemove() if (group) { if (group->childCount() > 0 && - KMessageBox::warningContinueCancel(this, i18n("Do you really want to remove this group and all its snippets?"),TQString::null,KStdGuiItem::del()) + KMessageBox::warningContinueCancel(this, i18n("Do you really want to remove this group and all its snippets?"),TQString(),KStdGuiItem::del()) == KMessageBox::Cancel) return; @@ -218,10 +218,10 @@ void SnippetWidget::slotEdit() pSnippet->setName( dlg.snippetName->text() ); pSnippet->setText( dlg.snippetText->text() ); - /* if the user changed the parent we need to move the snippet */ + /* if the user changed the tqparent we need to move the snippet */ if ( SnippetItem::findGroupById(pSnippet->getParent(), _list)->getName() != dlg.cbGroup->currentText() ) { SnippetGroup * newGroup = dynamic_cast<SnippetGroup*>(SnippetItem::findItemByName(dlg.cbGroup->currentText(), _list)); - pSnippet->parent()->takeItem(pSnippet); + pSnippet->tqparent()->takeItem(pSnippet); newGroup->insertItem(pSnippet); pSnippet->resetParent(); } @@ -327,9 +327,9 @@ void SnippetWidget::writeConfig() SnippetGroup * group = dynamic_cast<SnippetGroup*>(item); if (group) { kdDebug(9035) << "-->GROUP " << item->getName() << group->getId() << " " << iGroupCount<< endl; - strKeyName=TQString("snippetGroupName_%1").arg(iGroupCount); - strKeyId=TQString("snippetGroupId_%1").arg(iGroupCount); - strKeyText=TQString("snippetGroupLang_%1").arg(iGroupCount); + strKeyName=TQString("snippetGroupName_%1").tqarg(iGroupCount); + strKeyId=TQString("snippetGroupId_%1").tqarg(iGroupCount); + strKeyText=TQString("snippetGroupLang_%1").tqarg(iGroupCount); _cfg->writeEntry(strKeyName, group->getName()); _cfg->writeEntry(strKeyId, group->getId()); @@ -337,9 +337,9 @@ void SnippetWidget::writeConfig() iGroupCount++; } else if (dynamic_cast<SnippetItem*>(item)) { kdDebug(9035) << "-->ITEM " << item->getName() << item->getParent() << " " << iSnipCount << endl; - strKeyName=TQString("snippetName_%1").arg(iSnipCount); - strKeyText=TQString("snippetText_%1").arg(iSnipCount); - strKeyId=TQString("snippetParent_%1").arg(iSnipCount); + strKeyName=TQString("snippetName_%1").tqarg(iSnipCount); + strKeyText=TQString("snippetText_%1").tqarg(iSnipCount); + strKeyId=TQString("snippetParent_%1").tqarg(iSnipCount); _cfg->writeEntry(strKeyName, item->getName()); _cfg->writeEntry(strKeyText, item->getText()); @@ -357,8 +357,8 @@ void SnippetWidget::writeConfig() for ( it = _mapSaved.begin(); it != _mapSaved.end(); ++it ) { //write the saved variable values if (it.data().length()<=0) continue; //is the saved value has no length -> no need to save it - strKeyName=TQString("snippetSavedName_%1").arg(iCount); - strKeyText=TQString("snippetSavedVal_%1").arg(iCount); + strKeyName=TQString("snippetSavedName_%1").tqarg(iCount); + strKeyText=TQString("snippetSavedVal_%1").tqarg(iCount); _cfg->writeEntry(strKeyName, it.key()); _cfg->writeEntry(strKeyText, it.data()); @@ -394,8 +394,8 @@ void SnippetWidget::initConfigOldVersion(KConfig *cfg) TQString strKeyName=""; TQString strKeyText=""; for ( int i=0; i<iCount; i++) { //read the snippet-list - strKeyName=TQString("snippetName_%1").arg(i); - strKeyText=TQString("snippetText_%1").arg(i); + strKeyName=TQString("snippetName_%1").tqarg(i); + strKeyText=TQString("snippetText_%1").tqarg(i); TQString strNameVal=""; TQString strTextVal=""; @@ -434,9 +434,9 @@ void SnippetWidget::initConfig() int iCount = _cfg->readNumEntry("snippetGroupCount", -1); for ( int i=0; i<iCount; i++) { //read the group-list - strKeyName=TQString("snippetGroupName_%1").arg(i); - strKeyId=TQString("snippetGroupId_%1").arg(i); - strKeyText=TQString("snippetGroupLang_%1").arg(i); + strKeyName=TQString("snippetGroupName_%1").tqarg(i); + strKeyId=TQString("snippetGroupId_%1").tqarg(i); + strKeyText=TQString("snippetGroupLang_%1").tqarg(i); TQString strNameVal=""; int iIdVal=-1; @@ -465,9 +465,9 @@ void SnippetWidget::initConfig() if (iCount != -1) { iCount = _cfg->readNumEntry("snippetCount", 0); for ( int i=0; i<iCount; i++) { //read the snippet-list - strKeyName=TQString("snippetName_%1").arg(i); - strKeyText=TQString("snippetText_%1").arg(i); - strKeyId=TQString("snippetParent_%1").arg(i); + strKeyName=TQString("snippetName_%1").tqarg(i); + strKeyText=TQString("snippetText_%1").tqarg(i); + strKeyId=TQString("snippetParent_%1").tqarg(i); TQString strNameVal=""; TQString strTextVal=""; @@ -491,9 +491,9 @@ void SnippetWidget::initConfig() iCount = _cfg->readNumEntry("snippetSavedCount", 0); - for ( int i=1; i<=iCount; i++) { //read the saved-values and store in QMap - strKeyName=TQString("snippetSavedName_%1").arg(i); - strKeyText=TQString("snippetSavedVal_%1").arg(i); + for ( int i=1; i<=iCount; i++) { //read the saved-values and store in TQMap + strKeyName=TQString("snippetSavedName_%1").tqarg(i); + strKeyText=TQString("snippetSavedVal_%1").tqarg(i); TQString strNameVal=""; TQString strTextVal=""; @@ -526,7 +526,7 @@ void SnippetWidget::maybeTip( const TQPoint & p ) if (!item) return; - TQRect r = itemRect( item ); + TQRect r = tqitemRect( item ); if (r.isValid() && _SnippetConfig.useToolTips() ) @@ -589,15 +589,15 @@ TQString SnippetWidget::parseText(TQString text, TQString del) TQRect rMulti = _SnippetConfig.getMultiRect(); do { - iFound = text.find(TQRegExp("\\"+del+"[A-Za-z-_0-9\\s]*\\"+del), iEnd+1); //find the next variable by this QRegExp + iFound = text.tqfind(TQRegExp("\\"+del+"[A-Za-z-_0-9\\s]*\\"+del), iEnd+1); //find the next variable by this TQRegExp if (iFound >= 0) { - iEnd = text.find(del, iFound+1)+1; + iEnd = text.tqfind(del, iFound+1)+1; strName = text.mid(iFound, iEnd-iFound); if ( strName != del+del ) { //if not doubel-delimiter if (iInMeth == 0) { //if input-method "single" is selected if ( mapVar[strName].length() <= 0 ) { // and not already in map - strMsg=i18n("Please enter the value for <b>%1</b>:").arg(strName); + strMsg=i18n("Please enter the value for <b>%1</b>:").tqarg(strName); strNew = showSingleVarDialog( strName, &_mapSaved, rSingle ); if (strNew=="") return ""; //user clicked Cancle @@ -612,7 +612,7 @@ TQString SnippetWidget::parseText(TQString text, TQString del) } if (iInMeth == 0) { //if input-method "single" is selected - str.replace(strName, strNew); + str.tqreplace(strName, strNew); } mapVar[strName] = strNew; @@ -627,13 +627,13 @@ TQString SnippetWidget::parseText(TQString text, TQString del) if (showMultiVarDialog( &mapVar, &_mapSaved, w, bh, oh )) { //generate and show the dialog TQMap<TQString, TQString>::Iterator it; for ( it = mapVar.begin(); it != mapVar.end(); ++it ) { //walk through the map and do the replacement - str.replace(it.key(), it.data()); + str.tqreplace(it.key(), it.data()); } } else { return ""; } - rMulti.setWidth(w); //this is a hack to save the dialog's dimensions in only one QRect + rMulti.setWidth(w); //this is a hack to save the dialog's dimensions in only one TQRect rMulti.setHeight(bh); rMulti.setTop(oh); rMulti.setLeft(0); @@ -671,35 +671,35 @@ bool SnippetWidget::showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQ TQDialog dlg(this); dlg.setCaption(i18n("Enter Values for Variables")); - TQGridLayout * layout = new TQGridLayout( &dlg, 1, 1, 11, 6, "layout"); - TQGridLayout * layoutTop = new TQGridLayout( 0, 1, 1, 0, 6, "layoutTop"); - TQGridLayout * layoutVar = new TQGridLayout( 0, 1, 1, 0, 6, "layoutVar"); - TQGridLayout * layoutBtn = new TQGridLayout( 0, 1, 1, 0, 6, "layoutBtn"); + TQGridLayout * tqlayout = new TQGridLayout( &dlg, 1, 1, 11, 6, "tqlayout"); + TQGridLayout * tqlayoutTop = new TQGridLayout( 0, 1, 1, 0, 6, "tqlayoutTop"); + TQGridLayout * tqlayoutVar = new TQGridLayout( 0, 1, 1, 0, 6, "tqlayoutVar"); + TQGridLayout * tqlayoutBtn = new TQGridLayout( 0, 1, 1, 0, 6, "tqlayoutBtn"); KTextEdit *te = NULL; TQLabel * labTop = NULL; TQCheckBox * cb = NULL; labTop = new TQLabel( &dlg, "label" ); - labTop->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, + labTop->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, labTop->sizePolicy().hasHeightForWidth() ) ); labTop->setText(i18n("Enter the replacement values for these variables:")); - layoutTop->addWidget(labTop, 0, 0); - layout->addMultiCellLayout( layoutTop, 0, 0, 0, 1 ); + tqlayoutTop->addWidget(labTop, 0, 0); + tqlayout->addMultiCellLayout( tqlayoutTop, 0, 0, 0, 1 ); int i = 0; //walk through the variable map and add - for ( it = map->begin(); it != map->end(); ++it ) { //a checkbox, a lable and a lineedit to the main layout + for ( it = map->begin(); it != map->end(); ++it ) { //a checkbox, a lable and a lineedit to the main tqlayout if (it.key() == _SnippetConfig.getDelimiter() + _SnippetConfig.getDelimiter()) continue; cb = new TQCheckBox( &dlg, "cbVar" ); cb->setChecked( FALSE ); cb->setText(it.key()); - layoutVar->addWidget( cb, i ,0, Qt::AlignTop ); + tqlayoutVar->addWidget( cb, i ,0, TQt::AlignTop ); te = new KTextEdit( &dlg, "teVar" ); - layoutVar->addWidget( te, i, 1, Qt::AlignTop ); + tqlayoutVar->addWidget( te, i, 1, TQt::AlignTop ); if ((*mapSave)[it.key()].length() > 0) { cb->setChecked( TRUE ); @@ -716,22 +716,22 @@ bool SnippetWidget::showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQ i++; } - layout->addMultiCellLayout( layoutVar, 1, 1, 0, 1 ); + tqlayout->addMultiCellLayout( tqlayoutVar, 1, 1, 0, 1 ); KPushButton * btn1 = new KPushButton( &dlg, "pushButton1" ); btn1->setText(i18n("&Cancel")); - btn1->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, + btn1->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, btn1->sizePolicy().hasHeightForWidth() ) ); - layoutBtn->addWidget( btn1, 0, 0 ); + tqlayoutBtn->addWidget( btn1, 0, 0 ); KPushButton * btn2 = new KPushButton( &dlg, "pushButton2" ); btn2->setText(i18n("&Apply")); btn2->setDefault( TRUE ); - btn2->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, + btn2->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, btn2->sizePolicy().hasHeightForWidth() ) ); - layoutBtn->addWidget( btn2, 0, 1 ); + tqlayoutBtn->addWidget( btn2, 0, 1 ); - layout->addMultiCellLayout( layoutBtn, 2, 2, 0, 1 ); + tqlayout->addMultiCellLayout( tqlayoutBtn, 2, 2, 0, 1 ); // --END-- building a dynamic dialog //connect the buttons to the TQDialog default slots @@ -742,7 +742,7 @@ bool SnippetWidget::showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQ bool bReturn = false; //resize the textedits if (iWidth > 1) { - TQRect r = dlg.geometry(); + TQRect r = dlg.tqgeometry(); r.setHeight(iBasicHeight + iOneHeight*mapVar2Te.count()); r.setWidth(iWidth); dlg.setGeometry(r); @@ -763,9 +763,9 @@ bool SnippetWidget::showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQ } bReturn = true; - iBasicHeight = dlg.geometry().height() - layoutVar->geometry().height(); - iOneHeight = layoutVar->geometry().height() / mapVar2Te.count(); - iWidth = dlg.geometry().width(); + iBasicHeight = dlg.tqgeometry().height() - tqlayoutVar->tqgeometry().height(); + iOneHeight = tqlayoutVar->tqgeometry().height() / mapVar2Te.count(); + iWidth = dlg.tqgeometry().width(); } //do some cleanup @@ -777,10 +777,10 @@ bool SnippetWidget::showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQ for (it2 = mapVar2Cb.begin(); it2 != mapVar2Cb.end(); ++it2) delete it2.data(); mapVar2Cb.clear(); - delete layoutTop; - delete layoutVar; - delete layoutBtn; - delete layout; + delete tqlayoutTop; + delete tqlayoutVar; + delete tqlayoutBtn; + delete tqlayout; if (i==0) //if nothing happened this means, that there are no variables to translate return true; //.. so just return OK @@ -800,19 +800,19 @@ TQString SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQStri TQDialog dlg(this); dlg.setCaption(i18n("Enter Values for Variables")); - TQGridLayout * layout = new TQGridLayout( &dlg, 1, 1, 11, 6, "layout"); - TQGridLayout * layoutTop = new TQGridLayout( 0, 1, 1, 0, 6, "layoutTop"); - TQGridLayout * layoutVar = new TQGridLayout( 0, 1, 1, 0, 6, "layoutVar"); - TQGridLayout * layoutBtn = new TQGridLayout( 0, 2, 1, 0, 6, "layoutBtn"); + TQGridLayout * tqlayout = new TQGridLayout( &dlg, 1, 1, 11, 6, "tqlayout"); + TQGridLayout * tqlayoutTop = new TQGridLayout( 0, 1, 1, 0, 6, "tqlayoutTop"); + TQGridLayout * tqlayoutVar = new TQGridLayout( 0, 1, 1, 0, 6, "tqlayoutVar"); + TQGridLayout * tqlayoutBtn = new TQGridLayout( 0, 2, 1, 0, 6, "tqlayoutBtn"); KTextEdit *te = NULL; TQLabel * labTop = NULL; TQCheckBox * cb = NULL; labTop = new TQLabel( &dlg, "label" ); - layoutTop->addWidget(labTop, 0, 0); - labTop->setText(i18n("Enter the replacement values for %1:").arg( var )); - layout->addMultiCellLayout( layoutTop, 0, 0, 0, 1 ); + tqlayoutTop->addWidget(labTop, 0, 0); + labTop->setText(i18n("Enter the replacement values for %1:").tqarg( var )); + tqlayout->addMultiCellLayout( tqlayoutTop, 0, 0, 0, 1 ); cb = new TQCheckBox( &dlg, "cbVar" ); @@ -820,8 +820,8 @@ TQString SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQStri cb->setText(i18n( "Make value &default" )); te = new KTextEdit( &dlg, "teVar" ); - layoutVar->addWidget( te, 0, 1, Qt::AlignTop); - layoutVar->addWidget( cb, 1, 1, Qt::AlignTop); + tqlayoutVar->addWidget( te, 0, 1, TQt::AlignTop); + tqlayoutVar->addWidget( cb, 1, 1, TQt::AlignTop); if ((*mapSave)[var].length() > 0) { cb->setChecked( TRUE ); te->setText((*mapSave)[var]); @@ -832,18 +832,18 @@ TQString SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQStri "If you use the same variable later, even in another snippet, the value entered to the right " "will be the default value for that variable.") ); - layout->addMultiCellLayout( layoutVar, 1, 1, 0, 1 ); + tqlayout->addMultiCellLayout( tqlayoutVar, 1, 1, 0, 1 ); KPushButton * btn1 = new KPushButton( &dlg, "pushButton1" ); btn1->setText(i18n("&Cancel")); - layoutBtn->addWidget( btn1, 0, 0 ); + tqlayoutBtn->addWidget( btn1, 0, 0 ); KPushButton * btn2 = new KPushButton( &dlg, "pushButton2" ); btn2->setText(i18n("&Apply")); btn2->setDefault( TRUE ); - layoutBtn->addWidget( btn2, 0, 1 ); + tqlayoutBtn->addWidget( btn2, 0, 1 ); - layout->addMultiCellLayout( layoutBtn, 2, 2, 0, 1 ); + tqlayout->addMultiCellLayout( tqlayoutBtn, 2, 2, 0, 1 ); te->setFocus(); // --END-- building a dynamic dialog @@ -863,7 +863,7 @@ TQString SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQStri strReturn = te->text(); //copy the entered values back the the given map - dlgSize = dlg.geometry(); + dlgSize = dlg.tqgeometry(); } //do some cleanup @@ -872,10 +872,10 @@ TQString SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQStri delete labTop; delete btn1; delete btn2; - delete layoutTop; - delete layoutVar; - delete layoutBtn; - delete layout; + delete tqlayoutTop; + delete tqlayoutVar; + delete tqlayoutBtn; + delete tqlayout; return strReturn; } @@ -917,10 +917,10 @@ void SnippetWidget::slotDropped(TQDropEvent *e, TQListViewItem *) SnippetGroup *group = dynamic_cast<SnippetGroup *>(item2); if (!group) - group = dynamic_cast<SnippetGroup *>(item2->parent()); + group = dynamic_cast<SnippetGroup *>(item2->tqparent()); TQCString dropped; - TQByteArray data = e->encodedData("text/plain"); + TQByteArray data = e->tqencodedData("text/plain"); if ( e->provides("text/plain") && data.size()>0 ) { //get the data from the event... TQString encData(data.data()); @@ -958,7 +958,7 @@ void SnippetWidget::languageChanged() for (SnippetItem *it=_list.first(); it; it=_list.next()) { SnippetGroup * group = dynamic_cast<SnippetGroup*>(it); if (group) { - if (group->getLanguage() == i18n("All") || langs.contains(group->getLanguage())) { + if (group->getLanguage() == i18n("All") || langs.tqcontains(group->getLanguage())) { group->setOpen(TRUE); } else { group->setOpen(FALSE); |