diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-13 00:46:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-04-13 00:46:47 +0000 |
commit | 67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7 (patch) | |
tree | 5f52a9eada2e9f3654fc327d7c14dfef570a6ecb /kmail/snippetwidget.cpp | |
parent | 2ee4bf4fd5eff93b2fbef0ff8e8063edffc5da5c (diff) | |
download | tdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.tar.gz tdepim-67e29a054cfcb1b0d2fe6b0a316cf6b3eec087b7.zip |
Initial conversion of kdepim to TQt
This will probably require some tweaking before it will build under Qt4,
however Qt3 builds are OK. Any alterations this commit makes to kdepim
behaviour under Qt3 are unintentional and should be fixed.
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1227832 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmail/snippetwidget.cpp')
-rw-r--r-- | kmail/snippetwidget.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/kmail/snippetwidget.cpp b/kmail/snippetwidget.cpp index ef0e07930..ac8d0ebf4 100644 --- a/kmail/snippetwidget.cpp +++ b/kmail/snippetwidget.cpp @@ -44,11 +44,11 @@ #include <cassert> -SnippetWidget::SnippetWidget(KMEdit* editor, KActionCollection* actionCollection, TQWidget* parent) - : KListView(parent, "snippet widget"), TQToolTip( viewport() ), +SnippetWidget::SnippetWidget(KMEdit* editor, KActionCollection* actionCollection, TQWidget* tqparent) + : KListView(tqparent, "snippet widget"), TQToolTip( viewport() ), mEditor( editor ), mActionCollection( actionCollection ) { - // 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 && selectedItem() ) - group = dynamic_cast<SnippetGroup*>(selectedItem()->parent()); + group = dynamic_cast<SnippetGroup*>(selectedItem()->tqparent()); /* still no group, let's make a default one */ if (!group ) { @@ -139,12 +139,12 @@ void SnippetWidget::slotAdd() } /*! - \fn SnippetWidget::makeItem( SnippetItem* parent, const TQString& name, const TQString& text ) + \fn SnippetWidget::makeItem( SnippetItem* tqparent, const TQString& name, const TQString& text ) Helper factory method. */ -SnippetItem* SnippetWidget::makeItem( SnippetItem* parent, const TQString& name, const TQString& text, const KShortcut& shortcut ) +SnippetItem* SnippetWidget::makeItem( SnippetItem* tqparent, const TQString& name, const TQString& text, const KShortcut& shortcut ) { - SnippetItem * item = new SnippetItem(parent, name, text); + SnippetItem * item = new SnippetItem(tqparent, name, text); const TQString actionName = i18n("Snippet %1").arg(name); const TQString normalizedName = TQString(actionName).tqreplace(" ", "_"); if ( !mActionCollection->action(normalizedName.utf8() ) ) { @@ -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?"),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; @@ -255,10 +255,10 @@ void SnippetWidget::slotEdit( TQListViewItem* item ) pSnippet->setText( dlg.snippetText->text() ); pSnippet->getAction()->setShortcut( dlg.keyButton->shortcut()); - /* 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(); } @@ -486,7 +486,7 @@ void SnippetWidget::initConfig() iCount = _cfg->readNumEntry("snippetSavedCount", 0); - for ( int i=1; i<=iCount; i++) { //read the saved-values and store in QMap + for ( int i=1; i<=iCount; i++) { //read the saved-values and store in TQMap strKeyName=TQString("snippetSavedName_%1").arg(i); strKeyText=TQString("snippetSavedVal_%1").arg(i); @@ -562,7 +562,7 @@ void SnippetWidget::showPopupMenu( TQListViewItem * item, const TQPoint & p, int // fn SnippetWidget::parseText(TQString text, TQString del) /*! This function is used to parse the given TQString for variables. If found the user will be prompted - for a tqreplacement value. It returns the string text with all tqreplacements made + for a replacement value. It returns the string text with all replacements made */ TQString SnippetWidget::parseText(TQString text, TQString del) { @@ -578,9 +578,9 @@ 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 @@ -597,7 +597,7 @@ TQString SnippetWidget::parseText(TQString text, TQString del) strNew = ""; //for inputmode "multi" just reset new valaue } } else { - strNew = del; //if double-delimiter -> tqreplace by single character + strNew = del; //if double-delimiter -> replace by single character } if (iInMeth == 0) { //if input-method "single" is selected @@ -615,14 +615,14 @@ TQString SnippetWidget::parseText(TQString text, TQString del) oh = rMulti.top(); 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 tqreplacement + for ( it = mapVar.begin(); it != mapVar.end(); ++it ) { //walk through the map and do the replacement 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); @@ -637,7 +637,7 @@ TQString SnippetWidget::parseText(TQString text, TQString del) // fn SnippetWidget::showMultiVarDialog() /*! - This function constructs a dialog which tqcontains a label and a linedit for every + This function constructs a dialog which contains a label and a linedit for every 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 */ @@ -672,7 +672,7 @@ bool SnippetWidget::showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQ labTop = new TQLabel( &dlg, "label" ); labTop->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)1, (TQSizePolicy::SizeType)0, 0, 0, labTop->sizePolicy().hasHeightForWidth() ) ); - labTop->setText(i18n("Enter the tqreplacement values for these variables:")); + labTop->setText(i18n("Enter the replacement values for these variables:")); tqlayoutTop->addWidget(labTop, 0, 0); tqlayout->addMultiCellLayout( tqlayoutTop, 0, 0, 0, 1 ); @@ -685,10 +685,10 @@ bool SnippetWidget::showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQ cb = new TQCheckBox( &dlg, "cbVar" ); cb->setChecked( FALSE ); cb->setText(it.key()); - tqlayoutVar->addWidget( cb, i ,0, Qt::AlignTop ); + tqlayoutVar->addWidget( cb, i ,0, TQt::AlignTop ); te = new KTextEdit( &dlg, "teVar" ); - tqlayoutVar->addWidget( te, i, 1, Qt::AlignTop ); + tqlayoutVar->addWidget( te, i, 1, TQt::AlignTop ); if ((*mapSave)[it.key()].length() > 0) { cb->setChecked( TRUE ); @@ -779,7 +779,7 @@ bool SnippetWidget::showMultiVarDialog(TQMap<TQString, TQString> * map, TQMap<TQ // fn SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQString> * mapSave) /*! - This function constructs a dialog which tqcontains a label and a linedit for the given variable + 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 */ TQString SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQString> * mapSave, TQRect & dlgSize) @@ -799,7 +799,7 @@ TQString SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQStri labTop = new TQLabel( &dlg, "label" ); tqlayoutTop->addWidget(labTop, 0, 0); - labTop->setText(i18n("Enter the tqreplacement values for %1:").arg( var )); + labTop->setText(i18n("Enter the replacement values for %1:").arg( var )); tqlayout->addMultiCellLayout( tqlayoutTop, 0, 0, 0, 1 ); @@ -808,8 +808,8 @@ TQString SnippetWidget::showSingleVarDialog(TQString var, TQMap<TQString, TQStri cb->setText(i18n( "Make value &default" )); te = new KTextEdit( &dlg, "teVar" ); - tqlayoutVar->addWidget( te, 0, 1, Qt::AlignTop); - tqlayoutVar->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]); @@ -909,7 +909,7 @@ 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->tqencodedData("text/plain"); |