summaryrefslogtreecommitdiffstats
path: root/parts/snippet/snippet_widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parts/snippet/snippet_widget.cpp')
-rw-r--r--parts/snippet/snippet_widget.cpp292
1 files changed, 146 insertions, 146 deletions
diff --git a/parts/snippet/snippet_widget.cpp b/parts/snippet/snippet_widget.cpp
index 98d61505..2c35d5c5 100644
--- a/parts/snippet/snippet_widget.cpp
+++ b/parts/snippet/snippet_widget.cpp
@@ -11,28 +11,28 @@
#include <kurl.h>
#include <kdebug.h>
#include <klocale.h>
-#include <qlayout.h>
+#include <tqlayout.h>
#include <kpushbutton.h>
#include <klistview.h>
-#include <qheader.h>
+#include <tqheader.h>
#include <klineedit.h>
#include <ktextedit.h>
#include <kmessagebox.h>
-#include <qsplitter.h>
+#include <tqsplitter.h>
#include <ktexteditor/editinterface.h>
#include <ktexteditor/editor.h>
#include <ktexteditor/viewcursorinterface.h>
#include <ktexteditor/document.h>
#include <kconfig.h>
-#include <qtooltip.h>
+#include <tqtooltip.h>
#include <kpopupmenu.h>
-#include <qregexp.h>
-#include <qinputdialog.h>
-#include <qlabel.h>
-#include <qcheckbox.h>
-#include <qwhatsthis.h>
-#include <qdragobject.h>
-#include <qtimer.h>
+#include <tqregexp.h>
+#include <tqinputdialog.h>
+#include <tqlabel.h>
+#include <tqcheckbox.h>
+#include <tqwhatsthis.h>
+#include <tqdragobject.h>
+#include <tqtimer.h>
#include <kcombobox.h>
#include <kdeversion.h>
@@ -47,7 +47,7 @@
#include "snippet_widget.h"
SnippetWidget::SnippetWidget(SnippetPart *part)
- : KListView(0, "snippet widget"), QToolTip( viewport() ),
+ : KListView(0, "snippet widget"), TQToolTip( viewport() ),
m_part( part )
{
// init the QPtrList
@@ -64,20 +64,20 @@ SnippetWidget::SnippetWidget(SnippetPart *part)
setRootIsDecorated(true);
//connect the signals
- connect( this, SIGNAL( contextMenuRequested ( QListViewItem *, const QPoint & , int ) ),
- this, SLOT( showPopupMenu(QListViewItem *, const QPoint & , int ) ) );
+ connect( this, TQT_SIGNAL( contextMenuRequested ( TQListViewItem *, const TQPoint & , int ) ),
+ this, TQT_SLOT( showPopupMenu(TQListViewItem *, const TQPoint & , int ) ) );
- connect( this, SIGNAL( executed (QListViewItem *) ),
- this, SLOT( slotExecuted( QListViewItem *) ) );
- connect( this, SIGNAL( returnPressed (QListViewItem *) ),
- this, SLOT( slotExecuted( QListViewItem *) ) );
+ connect( this, TQT_SIGNAL( executed (TQListViewItem *) ),
+ this, TQT_SLOT( slotExecuted( TQListViewItem *) ) );
+ connect( this, TQT_SIGNAL( returnPressed (TQListViewItem *) ),
+ this, TQT_SLOT( slotExecuted( TQListViewItem *) ) );
- connect( this, SIGNAL( dropped(QDropEvent *, QListViewItem *) ),
- this, SLOT( slotDropped(QDropEvent *, QListViewItem *) ) );
+ connect( this, TQT_SIGNAL( dropped(TQDropEvent *, TQListViewItem *) ),
+ this, TQT_SLOT( slotDropped(TQDropEvent *, TQListViewItem *) ) );
_cfg = 0;
- QTimer::singleShot(0, this, SLOT(initConfig()));
+ TQTimer::singleShot(0, this, TQT_SLOT(initConfig()));
}
SnippetWidget::~SnippetWidget()
@@ -121,7 +121,7 @@ void SnippetWidget::slotAdd()
}
dlg.cbGroup->setCurrentText(group->getName());
- if (dlg.exec() == QDialog::Accepted) {
+ if (dlg.exec() == TQDialog::Accepted) {
group = dynamic_cast<SnippetGroup*>(SnippetItem::findItemByName(dlg.cbGroup->currentText(), _list));
_list.append( new SnippetItem(group, dlg.snippetName->text(), dlg.snippetText->text()) );
}
@@ -144,7 +144,7 @@ void SnippetWidget::slotAddGroup()
dlg.cbGroup->setCurrentText(i18n("All"));
dlg.textLabelGroup->setText(i18n("Language:"));
- if (dlg.exec() == QDialog::Accepted) {
+ if (dlg.exec() == TQDialog::Accepted) {
_list.append( new SnippetGroup(this, dlg.snippetName->text(), SnippetGroup::getMaxId(), dlg.cbGroup->currentText()) );
}
}
@@ -157,7 +157,7 @@ void SnippetWidget::slotAddGroup()
void SnippetWidget::slotRemove()
{
//get current data
- QListViewItem * item = currentItem();
+ TQListViewItem * item = currentItem();
SnippetItem *snip = dynamic_cast<SnippetItem*>( item );
SnippetGroup *group = dynamic_cast<SnippetGroup*>( item );
if (!snip)
@@ -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?"),QString::null,KStdGuiItem::del())
+ KMessageBox::warningContinueCancel(this, i18n("Do you really want to remove this group and all its snippets?"),TQString::null,KStdGuiItem::del())
== KMessageBox::Cancel)
return;
@@ -190,7 +190,7 @@ void SnippetWidget::slotRemove()
void SnippetWidget::slotEdit()
{
//get current data
- QListViewItem * item = currentItem();
+ TQListViewItem * item = currentItem();
SnippetGroup *pGroup = dynamic_cast<SnippetGroup*>(item);
SnippetItem *pSnippet = dynamic_cast<SnippetItem*>( item );
@@ -212,7 +212,7 @@ void SnippetWidget::slotEdit()
}
dlg.cbGroup->setCurrentText(SnippetItem::findGroupById(pSnippet->getParent(), _list)->getName());
- if (dlg.exec() == QDialog::Accepted) {
+ if (dlg.exec() == TQDialog::Accepted) {
//update the KListView and the SnippetItem
item->setText( 0, dlg.snippetName->text() );
pSnippet->setName( dlg.snippetName->text() );
@@ -237,7 +237,7 @@ void SnippetWidget::slotEdit()
void SnippetWidget::slotEditGroup()
{
//get current data
- QListViewItem * item = currentItem();
+ TQListViewItem * item = currentItem();
SnippetGroup *pGroup = dynamic_cast<SnippetGroup*>( item );
if (!pGroup) /*selected item MUST be a SnippetGroup*/
@@ -255,7 +255,7 @@ void SnippetWidget::slotEditGroup()
dlg.cbGroup->setCurrentText(pGroup->getLanguage());
dlg.textLabelGroup->setText(i18n("Language:"));
- if (dlg.exec() == QDialog::Accepted) {
+ if (dlg.exec() == TQDialog::Accepted) {
//update the KListView and the SnippetGroup
item->setText( 0, dlg.snippetName->text() );
pGroup->setName( dlg.snippetName->text() );
@@ -265,7 +265,7 @@ void SnippetWidget::slotEditGroup()
}
}
-void SnippetWidget::slotExecuted(QListViewItem * item)
+void SnippetWidget::slotExecuted(TQListViewItem * item)
{
SnippetItem *pSnippet = dynamic_cast<SnippetItem*>( item );
if (!pSnippet || dynamic_cast<SnippetGroup*>(item))
@@ -277,10 +277,10 @@ void SnippetWidget::slotExecuted(QListViewItem * item)
/*!
- \fn SnippetWidget::insertIntoActiveView(QString text)
+ \fn SnippetWidget::insertIntoActiveView(TQString text)
Inserts the parameter text into the activ view
*/
-void SnippetWidget::insertIntoActiveView(QString text)
+void SnippetWidget::insertIntoActiveView(TQString text)
{
//get the interfaces for the KTexteditor parts
KTextEditor::ViewCursorInterface *cursorIface
@@ -315,9 +315,9 @@ void SnippetWidget::writeConfig()
_cfg->setGroup("SnippetPart");
SnippetItem *item;
- QString strKeyName="";
- QString strKeyText="";
- QString strKeyId="";
+ TQString strKeyName="";
+ TQString strKeyText="";
+ TQString strKeyId="";
int iSnipCount = 0;
int iGroupCount = 0;
@@ -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=QString("snippetGroupName_%1").arg(iGroupCount);
- strKeyId=QString("snippetGroupId_%1").arg(iGroupCount);
- strKeyText=QString("snippetGroupLang_%1").arg(iGroupCount);
+ strKeyName=TQString("snippetGroupName_%1").arg(iGroupCount);
+ strKeyId=TQString("snippetGroupId_%1").arg(iGroupCount);
+ strKeyText=TQString("snippetGroupLang_%1").arg(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=QString("snippetName_%1").arg(iSnipCount);
- strKeyText=QString("snippetText_%1").arg(iSnipCount);
- strKeyId=QString("snippetParent_%1").arg(iSnipCount);
+ strKeyName=TQString("snippetName_%1").arg(iSnipCount);
+ strKeyText=TQString("snippetText_%1").arg(iSnipCount);
+ strKeyId=TQString("snippetParent_%1").arg(iSnipCount);
_cfg->writeEntry(strKeyName, item->getName());
_cfg->writeEntry(strKeyText, item->getText());
@@ -353,12 +353,12 @@ void SnippetWidget::writeConfig()
_cfg->writeEntry("snippetGroupCount", iGroupCount);
int iCount = 1;
- QMap<QString, QString>::Iterator it;
+ TQMap<TQString, TQString>::Iterator it;
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=QString("snippetSavedName_%1").arg(iCount);
- strKeyText=QString("snippetSavedVal_%1").arg(iCount);
+ strKeyName=TQString("snippetSavedName_%1").arg(iCount);
+ strKeyText=TQString("snippetSavedVal_%1").arg(iCount);
_cfg->writeEntry(strKeyName, it.key());
_cfg->writeEntry(strKeyText, it.data());
@@ -391,14 +391,14 @@ void SnippetWidget::initConfigOldVersion(KConfig *cfg)
_list.append(group);
int iCount = cfg->readNumEntry("snippetCount", 0);
- QString strKeyName="";
- QString strKeyText="";
+ TQString strKeyName="";
+ TQString strKeyText="";
for ( int i=0; i<iCount; i++) { //read the snippet-list
- strKeyName=QString("snippetName_%1").arg(i);
- strKeyText=QString("snippetText_%1").arg(i);
+ strKeyName=TQString("snippetName_%1").arg(i);
+ strKeyText=TQString("snippetText_%1").arg(i);
- QString strNameVal="";
- QString strTextVal="";
+ TQString strNameVal="";
+ TQString strTextVal="";
strNameVal = cfg->readEntry(strKeyName, "");
strTextVal = cfg->readEntry(strKeyText, "");
@@ -422,9 +422,9 @@ void SnippetWidget::initConfig()
_cfg->setGroup("SnippetPart");
- QString strKeyName="";
- QString strKeyText="";
- QString strKeyId="";
+ TQString strKeyName="";
+ TQString strKeyText="";
+ TQString strKeyId="";
SnippetItem *item;
SnippetGroup *group;
@@ -434,13 +434,13 @@ void SnippetWidget::initConfig()
int iCount = _cfg->readNumEntry("snippetGroupCount", -1);
for ( int i=0; i<iCount; i++) { //read the group-list
- strKeyName=QString("snippetGroupName_%1").arg(i);
- strKeyId=QString("snippetGroupId_%1").arg(i);
- strKeyText=QString("snippetGroupLang_%1").arg(i);
+ strKeyName=TQString("snippetGroupName_%1").arg(i);
+ strKeyId=TQString("snippetGroupId_%1").arg(i);
+ strKeyText=TQString("snippetGroupLang_%1").arg(i);
- QString strNameVal="";
+ TQString strNameVal="";
int iIdVal=-1;
- QString strLangVal="";
+ TQString strLangVal="";
strNameVal = _cfg->readEntry(strKeyName, "");
iIdVal = _cfg->readNumEntry(strKeyId, -1);
@@ -465,12 +465,12 @@ void SnippetWidget::initConfig()
if (iCount != -1) {
iCount = _cfg->readNumEntry("snippetCount", 0);
for ( int i=0; i<iCount; i++) { //read the snippet-list
- strKeyName=QString("snippetName_%1").arg(i);
- strKeyText=QString("snippetText_%1").arg(i);
- strKeyId=QString("snippetParent_%1").arg(i);
+ strKeyName=TQString("snippetName_%1").arg(i);
+ strKeyText=TQString("snippetText_%1").arg(i);
+ strKeyId=TQString("snippetParent_%1").arg(i);
- QString strNameVal="";
- QString strTextVal="";
+ TQString strNameVal="";
+ TQString strTextVal="";
int iParentVal = -1;
strNameVal = _cfg->readEntry(strKeyName, "");
@@ -492,11 +492,11 @@ void SnippetWidget::initConfig()
iCount = _cfg->readNumEntry("snippetSavedCount", 0);
for ( int i=1; i<=iCount; i++) { //read the saved-values and store in QMap
- strKeyName=QString("snippetSavedName_%1").arg(i);
- strKeyText=QString("snippetSavedVal_%1").arg(i);
+ strKeyName=TQString("snippetSavedName_%1").arg(i);
+ strKeyText=TQString("snippetSavedVal_%1").arg(i);
- QString strNameVal="";
- QString strTextVal="";
+ TQString strNameVal="";
+ TQString strTextVal="";
strNameVal = _cfg->readEntry(strKeyName, "");
strTextVal = _cfg->readEntry(strKeyText, "");
@@ -517,16 +517,16 @@ void SnippetWidget::initConfig()
}
/*!
- \fn SnippetWidget::maybeTip( const QPoint & p )
+ \fn SnippetWidget::maybeTip( const TQPoint & p )
Shows the Snippet-Text as ToolTip
*/
-void SnippetWidget::maybeTip( const QPoint & p )
+void SnippetWidget::maybeTip( const TQPoint & p )
{
SnippetItem * item = dynamic_cast<SnippetItem*>( itemAt( p ) );
if (!item)
return;
- QRect r = itemRect( item );
+ TQRect r = itemRect( item );
if (r.isValid() &&
_SnippetConfig.useToolTips() )
@@ -540,10 +540,10 @@ void SnippetWidget::maybeTip( const QPoint & p )
}
/*!
- \fn SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
+ \fn SnippetWidget::showPopupMenu( TQListViewItem * item, const TQPoint & p, int )
Shows the Popup-Menu depending item is a valid pointer
*/
-void SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
+void SnippetWidget::showPopupMenu( TQListViewItem * item, const TQPoint & p, int )
{
KPopupMenu popup;
@@ -551,45 +551,45 @@ void SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
if ( item ) {
popup.insertTitle( selectedItem->getName() );
- popup.insertItem( i18n("Add Item..."), this, SLOT( slotAdd() ) );
- popup.insertItem( i18n("Add Group..."), this, SLOT( slotAddGroup() ) );
+ popup.insertItem( i18n("Add Item..."), this, TQT_SLOT( slotAdd() ) );
+ popup.insertItem( i18n("Add Group..."), this, TQT_SLOT( slotAddGroup() ) );
if (dynamic_cast<SnippetGroup*>(item)) {
- popup.insertItem( i18n("Edit..."), this, SLOT( slotEditGroup() ) );
+ popup.insertItem( i18n("Edit..."), this, TQT_SLOT( slotEditGroup() ) );
} else {
- popup.insertItem( i18n("Edit..."), this, SLOT( slotEdit() ) );
+ popup.insertItem( i18n("Edit..."), this, TQT_SLOT( slotEdit() ) );
}
- popup.insertItem( i18n("Remove"), this, SLOT( slotRemove() ) );
+ popup.insertItem( i18n("Remove"), this, TQT_SLOT( slotRemove() ) );
} else {
popup.insertTitle(i18n("Code Snippets"));
- popup.insertItem( i18n("Add Group..."), this, SLOT( slotAddGroup() ) );
+ popup.insertItem( i18n("Add Group..."), this, TQT_SLOT( slotAddGroup() ) );
}
popup.exec(p);
}
-// fn SnippetWidget::parseText(QString text, QString del)
+// fn SnippetWidget::parseText(TQString text, TQString del)
/*!
- This function is used to parse the given QString for variables. If found the user will be prompted
+ This function is used to parse the given TQString for variables. If found the user will be prompted
for a replacement value. It returns the string text with all replacements made
*/
-QString SnippetWidget::parseText(QString text, QString del)
+TQString SnippetWidget::parseText(TQString text, TQString del)
{
- QString str = text;
- QString strName = "";
- QString strNew = "";
- QString strMsg="";
+ TQString str = text;
+ TQString strName = "";
+ TQString strNew = "";
+ TQString strMsg="";
int iFound = -1;
int iEnd = -1;
- QMap<QString, QString> mapVar;
+ TQMap<TQString, TQString> mapVar;
int iInMeth = _SnippetConfig.getInputMethod();
- QRect rSingle = _SnippetConfig.getSingleRect();
- QRect rMulti = _SnippetConfig.getMultiRect();
+ TQRect rSingle = _SnippetConfig.getSingleRect();
+ TQRect rMulti = _SnippetConfig.getMultiRect();
do {
- iFound = text.find(QRegExp("\\"+del+"[A-Za-z-_0-9\\s]*\\"+del), iEnd+1); //find the next variable by this QRegExp
+ iFound = text.find(TQRegExp("\\"+del+"[A-Za-z-_0-9\\s]*\\"+del), iEnd+1); //find the next variable by this QRegExp
if (iFound >= 0) {
iEnd = text.find(del, iFound+1)+1;
strName = text.mid(iFound, iEnd-iFound);
@@ -625,7 +625,7 @@ QString SnippetWidget::parseText(QString text, QString del)
bh = rMulti.height();
oh = rMulti.top();
if (showMultiVarDialog( &mapVar, &_mapSaved, w, bh, oh )) { //generate and show the dialog
- QMap<QString, QString>::Iterator it;
+ 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());
}
@@ -652,7 +652,7 @@ QString SnippetWidget::parseText(QString text, QString del)
variable that is stored in the given map except the double-delimiter entry
It return true if everything was ok and false if the user hit cancel
*/
-bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QString, QString> * mapSave,
+bool SnippetWidget::showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQString, TQString> * mapSave,
int & iWidth, int & iBasicHeight, int & iOneHeight)
{
//if no var -> no need to show
@@ -660,28 +660,28 @@ bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QStrin
return true;
//if only var is the double-delimiter -> no need to show
- QMap<QString, QString>::Iterator it = map->begin();
+ TQMap<TQString, TQString>::Iterator it = map->begin();
if ( map->count() == 1 && it.data()==_SnippetConfig.getDelimiter()+_SnippetConfig.getDelimiter() )
return true;
- QMap<QString, KTextEdit *> mapVar2Te; //this map will help keeping track which TEXTEDIT goes with which variable
- QMap<QString, QCheckBox *> mapVar2Cb; //this map will help keeping track which CHECKBOX goes with which variable
+ TQMap<TQString, KTextEdit *> mapVar2Te; //this map will help keeping track which TEXTEDIT goes with which variable
+ TQMap<TQString, TQCheckBox *> mapVar2Cb; //this map will help keeping track which CHECKBOX goes with which variable
// --BEGIN-- building a dynamic dialog
- QDialog dlg(this);
+ TQDialog dlg(this);
dlg.setCaption(i18n("Enter Values for Variables"));
- QGridLayout * layout = new QGridLayout( &dlg, 1, 1, 11, 6, "layout");
- QGridLayout * layoutTop = new QGridLayout( 0, 1, 1, 0, 6, "layoutTop");
- QGridLayout * layoutVar = new QGridLayout( 0, 1, 1, 0, 6, "layoutVar");
- QGridLayout * layoutBtn = new QGridLayout( 0, 1, 1, 0, 6, "layoutBtn");
+ 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");
KTextEdit *te = NULL;
- QLabel * labTop = NULL;
- QCheckBox * cb = NULL;
+ TQLabel * labTop = NULL;
+ TQCheckBox * cb = NULL;
- labTop = new QLabel( &dlg, "label" );
- labTop->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
+ labTop = new TQLabel( &dlg, "label" );
+ labTop->setSizePolicy( 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);
@@ -693,7 +693,7 @@ bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QStrin
if (it.key() == _SnippetConfig.getDelimiter() + _SnippetConfig.getDelimiter())
continue;
- cb = new QCheckBox( &dlg, "cbVar" );
+ cb = new TQCheckBox( &dlg, "cbVar" );
cb->setChecked( FALSE );
cb->setText(it.key());
layoutVar->addWidget( cb, i ,0, Qt::AlignTop );
@@ -709,8 +709,8 @@ bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QStrin
mapVar2Te[it.key()] = te;
mapVar2Cb[it.key()] = cb;
- QToolTip::add( cb, i18n("Enable this to save the value entered to the right as the default value for this variable") );
- QWhatsThis::add( cb, i18n("If you enable this option, the value entered to the right will be saved. "
+ TQToolTip::add( cb, i18n("Enable this to save the value entered to the right as the default value for this variable") );
+ TQWhatsThis::add( cb, i18n("If you enable this option, the value entered to the right will be saved. "
"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.") );
@@ -720,37 +720,37 @@ bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QStrin
KPushButton * btn1 = new KPushButton( &dlg, "pushButton1" );
btn1->setText(i18n("&Cancel"));
- btn1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
+ btn1->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0,
btn1->sizePolicy().hasHeightForWidth() ) );
layoutBtn->addWidget( btn1, 0, 0 );
KPushButton * btn2 = new KPushButton( &dlg, "pushButton2" );
btn2->setText(i18n("&Apply"));
btn2->setDefault( TRUE );
- btn2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0,
+ btn2->setSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0,
btn2->sizePolicy().hasHeightForWidth() ) );
layoutBtn->addWidget( btn2, 0, 1 );
layout->addMultiCellLayout( layoutBtn, 2, 2, 0, 1 );
// --END-- building a dynamic dialog
- //connect the buttons to the QDialog default slots
- connect(btn1, SIGNAL(clicked()), &dlg, SLOT(reject()) );
- connect(btn2, SIGNAL(clicked()), &dlg, SLOT(accept()) );
+ //connect the buttons to the TQDialog default slots
+ connect(btn1, TQT_SIGNAL(clicked()), &dlg, TQT_SLOT(reject()) );
+ connect(btn2, TQT_SIGNAL(clicked()), &dlg, TQT_SLOT(accept()) );
//prepare to execute the dialog
bool bReturn = false;
//resize the textedits
if (iWidth > 1) {
- QRect r = dlg.geometry();
+ TQRect r = dlg.geometry();
r.setHeight(iBasicHeight + iOneHeight*mapVar2Te.count());
r.setWidth(iWidth);
dlg.setGeometry(r);
}
if ( i > 0 && // only if there are any variables
- dlg.exec() == QDialog::Accepted ) {
+ dlg.exec() == TQDialog::Accepted ) {
- QMap<QString, KTextEdit *>::Iterator it2;
+ TQMap<TQString, KTextEdit *>::Iterator it2;
for ( it2 = mapVar2Te.begin(); it2 != mapVar2Te.end(); ++it2 ) {
if (it2.key() == _SnippetConfig.getDelimiter() + _SnippetConfig.getDelimiter())
continue;
@@ -769,11 +769,11 @@ bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QStrin
}
//do some cleanup
- QMap<QString, KTextEdit *>::Iterator it1;
+ TQMap<TQString, KTextEdit *>::Iterator it1;
for (it1 = mapVar2Te.begin(); it1 != mapVar2Te.end(); ++it1)
delete it1.data();
mapVar2Te.clear();
- QMap<QString, QCheckBox *>::Iterator it2;
+ TQMap<TQString, TQCheckBox *>::Iterator it2;
for (it2 = mapVar2Cb.begin(); it2 != mapVar2Cb.end(); ++it2)
delete it2.data();
mapVar2Cb.clear();
@@ -789,33 +789,33 @@ bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QStrin
}
-// fn SnippetWidget::showSingleVarDialog(QString var, QMap<QString, QString> * mapSave)
+// fn SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQString> * mapSave)
/*!
This function constructs a dialog which contains a label and a linedit for the given variable
It return either the entered value or an empty string if the user hit cancel
*/
-QString SnippetWidget::showSingleVarDialog(QString var, QMap<QString, QString> * mapSave, QRect & dlgSize)
+TQString SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQString> * mapSave, TQRect & dlgSize)
{
// --BEGIN-- building a dynamic dialog
- QDialog dlg(this);
+ TQDialog dlg(this);
dlg.setCaption(i18n("Enter Values for Variables"));
- QGridLayout * layout = new QGridLayout( &dlg, 1, 1, 11, 6, "layout");
- QGridLayout * layoutTop = new QGridLayout( 0, 1, 1, 0, 6, "layoutTop");
- QGridLayout * layoutVar = new QGridLayout( 0, 1, 1, 0, 6, "layoutVar");
- QGridLayout * layoutBtn = new QGridLayout( 0, 2, 1, 0, 6, "layoutBtn");
+ 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");
KTextEdit *te = NULL;
- QLabel * labTop = NULL;
- QCheckBox * cb = NULL;
+ TQLabel * labTop = NULL;
+ TQCheckBox * cb = NULL;
- labTop = new QLabel( &dlg, "label" );
+ 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 );
- cb = new QCheckBox( &dlg, "cbVar" );
+ cb = new TQCheckBox( &dlg, "cbVar" );
cb->setChecked( FALSE );
cb->setText(i18n( "Make value &default" ));
@@ -827,8 +827,8 @@ QString SnippetWidget::showSingleVarDialog(QString var, QMap<QString, QString> *
te->setText((*mapSave)[var]);
}
- QToolTip::add( cb, i18n("Enable this to save the value entered to the right as the default value for this variable") );
- QWhatsThis::add( cb, i18n("If you enable this option, the value entered to the right will be saved. "
+ TQToolTip::add( cb, i18n("Enable this to save the value entered to the right as the default value for this variable") );
+ TQWhatsThis::add( cb, i18n("If you enable this option, the value entered to the right will be saved. "
"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.") );
@@ -847,15 +847,15 @@ QString SnippetWidget::showSingleVarDialog(QString var, QMap<QString, QString> *
te->setFocus();
// --END-- building a dynamic dialog
- //connect the buttons to the QDialog default slots
- connect(btn1, SIGNAL(clicked()), &dlg, SLOT(reject()) );
- connect(btn2, SIGNAL(clicked()), &dlg, SLOT(accept()) );
+ //connect the buttons to the TQDialog default slots
+ connect(btn1, TQT_SIGNAL(clicked()), &dlg, TQT_SLOT(reject()) );
+ connect(btn2, TQT_SIGNAL(clicked()), &dlg, TQT_SLOT(accept()) );
//execute the dialog
- QString strReturn = "";
+ TQString strReturn = "";
if (dlgSize.isValid())
dlg.setGeometry(dlgSize);
- if ( dlg.exec() == QDialog::Accepted ) {
+ if ( dlg.exec() == TQDialog::Accepted ) {
if (cb->isChecked()) //if the checkbox is on; save the values for later
(*mapSave)[var] = te->text();
else
@@ -880,21 +880,21 @@ QString SnippetWidget::showSingleVarDialog(QString var, QMap<QString, QString> *
return strReturn;
}
-// fn SnippetWidget::acceptDrag (QDropEvent *event) const
+// fn SnippetWidget::acceptDrag (TQDropEvent *event) const
/*!
Reimplementation from KListView.
Check here if the data the user is about to drop fits our restrictions.
We only accept dropps of plaintext, because from the dropped text
we will create a snippet.
*/
-bool SnippetWidget::acceptDrag (QDropEvent *event) const
+bool SnippetWidget::acceptDrag (TQDropEvent *event) const
{
kdDebug(9035) << "Format: " << event->format() << "" << event->pos() << endl;
- QListViewItem * item = itemAt(event->pos());
+ TQListViewItem * item = itemAt(event->pos());
if (item &&
- QString(event->format()).startsWith("text/plain") &&
+ TQString(event->format()).startsWith("text/plain") &&
static_cast<SnippetWidget *>(event->source()) != this) {
kdDebug(9035) << "returning TRUE " << endl;
return TRUE;
@@ -905,25 +905,25 @@ bool SnippetWidget::acceptDrag (QDropEvent *event) const
}
}
-// fn SnippetWidget::slotDropped(QDropEvent *e, QListViewItem *after)
+// fn SnippetWidget::slotDropped(TQDropEvent *e, TQListViewItem *after)
/*!
This slot is connected to the dropped signal.
If it is emitted, we need to construct a new snippet entry with
the data given
*/
-void SnippetWidget::slotDropped(QDropEvent *e, QListViewItem *)
+void SnippetWidget::slotDropped(TQDropEvent *e, TQListViewItem *)
{
- QListViewItem * item2 = itemAt(e->pos());
+ TQListViewItem * item2 = itemAt(e->pos());
SnippetGroup *group = dynamic_cast<SnippetGroup *>(item2);
if (!group)
group = dynamic_cast<SnippetGroup *>(item2->parent());
- QCString dropped;
- QByteArray data = e->encodedData("text/plain");
+ TQCString dropped;
+ TQByteArray data = e->encodedData("text/plain");
if ( e->provides("text/plain") && data.size()>0 ) {
//get the data from the event...
- QString encData(data.data());
+ TQString encData(data.data());
kdDebug(9035) << "encData: " << encData << endl;
//... then fill the dialog with the given data
@@ -939,7 +939,7 @@ void SnippetWidget::slotDropped(QDropEvent *e, QListViewItem *)
}
dlg.cbGroup->setCurrentText(group->getName());
- if (dlg.exec() == QDialog::Accepted) {
+ if (dlg.exec() == TQDialog::Accepted) {
/* get the group that the user selected with the combobox */
group = dynamic_cast<SnippetGroup*>(SnippetItem::findItemByName(dlg.cbGroup->currentText(), _list));
_list.append( new SnippetItem(group, dlg.snippetName->text(), dlg.snippetText->text()) );
@@ -953,7 +953,7 @@ void SnippetWidget::slotDropped(QDropEvent *e, QListViewItem *)
*/
void SnippetWidget::languageChanged()
{
- QStringList langs = m_part->getProjectLanguages();
+ TQStringList langs = m_part->getProjectLanguages();
for (SnippetItem *it=_list.first(); it; it=_list.next()) {
SnippetGroup * group = dynamic_cast<SnippetGroup*>(it);