summaryrefslogtreecommitdiffstats
path: root/kmail/snippetwidget.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /kmail/snippetwidget.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/snippetwidget.cpp')
-rw-r--r--kmail/snippetwidget.cpp298
1 files changed, 149 insertions, 149 deletions
diff --git a/kmail/snippetwidget.cpp b/kmail/snippetwidget.cpp
index 1682e2580..617021748 100644
--- a/kmail/snippetwidget.cpp
+++ b/kmail/snippetwidget.cpp
@@ -14,23 +14,23 @@
#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 <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 <kmedit.h>
#include <kiconloader.h>
@@ -44,8 +44,8 @@
#include <cassert>
-SnippetWidget::SnippetWidget(KMEdit* editor, KActionCollection* actionCollection, QWidget* parent)
- : KListView(parent, "snippet widget"), QToolTip( viewport() ),
+SnippetWidget::SnippetWidget(KMEdit* editor, KActionCollection* actionCollection, TQWidget* parent)
+ : KListView(parent, "snippet widget"), TQToolTip( viewport() ),
mEditor( editor ), mActionCollection( actionCollection )
{
// init the QPtrList
@@ -62,22 +62,22 @@ SnippetWidget::SnippetWidget(KMEdit* editor, KActionCollection* actionCollection
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( doubleClicked (QListViewItem *) ),
- this, SLOT( slotEdit( QListViewItem *) ) );
- connect( this, SIGNAL( returnPressed (QListViewItem *) ),
- this, SLOT( slotExecuted( QListViewItem *) ) );
+ connect( this, TQT_SIGNAL( doubleClicked (TQListViewItem *) ),
+ this, TQT_SLOT( slotEdit( 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 *) ) );
- connect( editor, SIGNAL( insertSnippet() ), this, SLOT( slotExecute() ));
+ connect( editor, TQT_SIGNAL( insertSnippet() ), this, TQT_SLOT( slotExecute() ));
_cfg = 0;
- QTimer::singleShot(0, this, SLOT(initConfig()));
+ TQTimer::singleShot(0, this, TQT_SLOT(initConfig()));
}
SnippetWidget::~SnippetWidget()
@@ -132,28 +132,28 @@ 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( makeItem( group, dlg.snippetName->text(), dlg.snippetText->text(), dlg.keyButton->shortcut() ) );
}
}
/*!
- \fn SnippetWidget::makeItem( SnippetItem* parent, const QString& name, const QString& text )
+ \fn SnippetWidget::makeItem( SnippetItem* parent, const TQString& name, const TQString& text )
Helper factory method.
*/
-SnippetItem* SnippetWidget::makeItem( SnippetItem* parent, const QString& name, const QString& text, const KShortcut& shortcut )
+SnippetItem* SnippetWidget::makeItem( SnippetItem* parent, const TQString& name, const TQString& text, const KShortcut& shortcut )
{
SnippetItem * item = new SnippetItem(parent, name, text);
- const QString actionName = i18n("Snippet %1").arg(name);
- const QString normalizedName = QString(actionName).replace(" ", "_");
+ const TQString actionName = i18n("Snippet %1").arg(name);
+ const TQString normalizedName = TQString(actionName).replace(" ", "_");
if ( !mActionCollection->action(normalizedName.utf8() ) ) {
KAction * action = new KAction( actionName, shortcut, item,
- SLOT( slotExecute() ), mActionCollection,
+ TQT_SLOT( slotExecute() ), mActionCollection,
normalizedName.utf8() );
item->setAction(action);
- connect( item, SIGNAL( execute( QListViewItem* ) ),
- this, SLOT( slotExecuted( QListViewItem* ) ) );
+ connect( item, TQT_SIGNAL( execute( TQListViewItem* ) ),
+ this, TQT_SLOT( slotExecuted( TQListViewItem* ) ) );
}
return item;
}
@@ -173,7 +173,7 @@ void SnippetWidget::slotAddGroup()
dlg.cbGroup->insertItem(i18n("All"));
dlg.cbGroup->setCurrentText(i18n("All"));
- if (dlg.exec() == QDialog::Accepted) {
+ if (dlg.exec() == TQDialog::Accepted) {
_list.append( new SnippetGroup(this, dlg.snippetName->text(), SnippetGroup::getMaxId() ) );
}
}
@@ -186,7 +186,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)
@@ -194,7 +194,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;
@@ -221,7 +221,7 @@ void SnippetWidget::slotRemove()
\fn SnippetWidget::slotEdit()
Opens the dialog of editing the selected snippet
*/
-void SnippetWidget::slotEdit( QListViewItem* item )
+void SnippetWidget::slotEdit( TQListViewItem* item )
{
if( item == 0 ) {
item = currentItem();
@@ -248,7 +248,7 @@ void SnippetWidget::slotEdit( QListViewItem* item )
}
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() );
@@ -274,7 +274,7 @@ void SnippetWidget::slotEdit( QListViewItem* item )
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*/
@@ -290,7 +290,7 @@ void SnippetWidget::slotEditGroup()
dlg.setCaption(i18n("Edit Group"));
dlg.cbGroup->insertItem(i18n("All"));
- 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() );
@@ -299,7 +299,7 @@ void SnippetWidget::slotEditGroup()
}
}
-void SnippetWidget::slotExecuted(QListViewItem * item)
+void SnippetWidget::slotExecuted(TQListViewItem * item)
{
if( item == 0 )
{
@@ -316,10 +316,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( const QString &text )
+void SnippetWidget::insertIntoActiveView( const TQString &text )
{
mEditor->insert( text );
}
@@ -337,9 +337,9 @@ void SnippetWidget::writeConfig()
//they get overwritten by a more recent entry
_cfg->setGroup("SnippetPart");
- QString strKeyName="";
- QString strKeyText="";
- QString strKeyId="";
+ TQString strKeyName="";
+ TQString strKeyText="";
+ TQString strKeyId="";
int iSnipCount = 0;
int iGroupCount = 0;
@@ -352,8 +352,8 @@ void SnippetWidget::writeConfig()
SnippetGroup * group = dynamic_cast<SnippetGroup*>(item);
if (group) {
//kdDebug(5006) << "-->GROUP " << item->getName() << group->getId() << " " << iGroupCount<< endl;
- strKeyName=QString("snippetGroupName_%1").arg(iGroupCount);
- strKeyId=QString("snippetGroupId_%1").arg(iGroupCount);
+ strKeyName=TQString("snippetGroupName_%1").arg(iGroupCount);
+ strKeyId=TQString("snippetGroupId_%1").arg(iGroupCount);
_cfg->writeEntry(strKeyName, group->getName());
_cfg->writeEntry(strKeyId, group->getId());
@@ -361,9 +361,9 @@ void SnippetWidget::writeConfig()
iGroupCount++;
} else if (dynamic_cast<SnippetItem*>(item)) {
//kdDebug(5006) << "-->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());
@@ -373,7 +373,7 @@ void SnippetWidget::writeConfig()
assert( action );
const KShortcut& sc = action->shortcut();
if (!sc.isNull() ) {
- _cfg->writeEntry( QString("snippetShortcut_%1").arg(iSnipCount), sc.toString() );
+ _cfg->writeEntry( TQString("snippetShortcut_%1").arg(iSnipCount), sc.toString() );
}
iSnipCount++;
} else {
@@ -385,12 +385,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());
@@ -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,10 +434,10 @@ 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);
+ strKeyName=TQString("snippetGroupName_%1").arg(i);
+ strKeyId=TQString("snippetGroupId_%1").arg(i);
- QString strNameVal="";
+ TQString strNameVal="";
int iIdVal=-1;
strNameVal = _cfg->readEntry(strKeyName, "");
@@ -460,12 +460,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, "");
@@ -474,7 +474,7 @@ void SnippetWidget::initConfig()
//kdDebug(5006) << "Read item " << strNameVal << " " << iParentVal << endl;
if (strNameVal != "" && strTextVal != "" && iParentVal != -1) {
- KShortcut shortcut( _cfg->readEntry( QString("snippetShortcut_%1").arg(i), QString() ) );
+ KShortcut shortcut( _cfg->readEntry( TQString("snippetShortcut_%1").arg(i), TQString() ) );
item = makeItem( SnippetItem::findGroupById(iParentVal, _list), strNameVal, strTextVal, shortcut );
//kdDebug(5006) << "Created item " << item->getName() << " " << item->getParent() << endl;
_list.append(item);
@@ -487,11 +487,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, "");
@@ -512,16 +512,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() )
@@ -531,10 +531,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;
@@ -542,43 +542,43 @@ void SnippetWidget::showPopupMenu( QListViewItem * item, const QPoint & p, int )
if ( item ) {
popup.insertTitle( selectedItem->getName() );
if (dynamic_cast<SnippetGroup*>(item)) {
- popup.insertItem( i18n("Edit &group..."), this, SLOT( slotEditGroup() ) );
+ popup.insertItem( i18n("Edit &group..."), this, TQT_SLOT( slotEditGroup() ) );
} else {
- popup.insertItem( SmallIconSet("editpaste"), i18n("&Paste"), this, SLOT( slotExecuted() ) );
- popup.insertItem( SmallIconSet("edit"), i18n("&Edit..."), this, SLOT( slotEdit() ) );
+ popup.insertItem( SmallIconSet("editpaste"), i18n("&Paste"), this, TQT_SLOT( slotExecuted() ) );
+ popup.insertItem( SmallIconSet("edit"), i18n("&Edit..."), this, TQT_SLOT( slotEdit() ) );
}
- popup.insertItem( SmallIconSet("editdelete"), i18n("&Remove"), this, SLOT( slotRemove() ) );
+ popup.insertItem( SmallIconSet("editdelete"), i18n("&Remove"), this, TQT_SLOT( slotRemove() ) );
popup.insertSeparator();
} else {
popup.insertTitle(i18n("Text Snippets"));
}
- popup.insertItem( i18n("&Add Snippet..."), this, SLOT( slotAdd() ) );
- popup.insertItem( i18n("Add G&roup..."), this, SLOT( slotAddGroup() ) );
+ popup.insertItem( i18n("&Add Snippet..."), this, TQT_SLOT( slotAdd() ) );
+ popup.insertItem( i18n("Add G&roup..."), 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);
@@ -614,7 +614,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());
}
@@ -641,7 +641,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
@@ -649,28 +649,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);
@@ -682,7 +682,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 );
@@ -698,8 +698,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.") );
@@ -708,36 +708,36 @@ bool SnippetWidget::showMultiVarDialog(QMap<QString, QString> * map, QMap<QStrin
layout->addMultiCellLayout( layoutVar, 1, 1, 0, 1 );
KPushButton * btn1 = new KPushButton( KStdGuiItem::cancel(), &dlg, "pushButton1" );
- 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( KStdGuiItem::apply(), &dlg, "pushButton2" );
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;
@@ -756,11 +756,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();
@@ -777,33 +777,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" ));
@@ -815,8 +815,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.") );
@@ -833,15 +833,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
@@ -866,26 +866,26 @@ 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(5006) << "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(5006) << "returning TRUE " << endl;
return TRUE;
} else if(item &&
- QString(event->format()).startsWith("x-kmailsnippet") &&
+ TQString(event->format()).startsWith("x-kmailsnippet") &&
static_cast<SnippetWidget *>(event->source()) != this)
{
//kdDebug(5006) << "returning TRUE " << endl;
@@ -897,25 +897,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(5006) << "encData: " << encData << endl;
//... then fill the dialog with the given data
@@ -931,7 +931,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( makeItem(group, dlg.snippetName->text(), dlg.snippetText->text(), dlg.keyButton->shortcut() ) );
@@ -941,8 +941,8 @@ void SnippetWidget::slotDropped(QDropEvent *e, QListViewItem *)
void SnippetWidget::startDrag()
{
- QString text = dynamic_cast<SnippetItem*>( currentItem() )->getText();
- QTextDrag *drag = new QTextDrag(text, this);
+ TQString text = dynamic_cast<SnippetItem*>( currentItem() )->getText();
+ TQTextDrag *drag = new TQTextDrag(text, this);
drag->setSubtype("x-textsnippet");
drag->drag();
}