[PATCH]CppAddMethodDlg tweak

Roland Krause rokrau at yahoo.com
Thu Jul 18 21:30:26 UTC 2002


Is this a feature or a bugfix? 
Roland

--- Peter Nimmervoll <vanHell at gmx.at> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi,
> 
> A patch for the "Add Method Dialog" (cppsupport)
>  -fix 2 bugs 
>  -add some code to "Add" an Konstruktor
> 
> Is there a good reason why tokenizer.cpp (which is generated by flex)
> is in 
> the CVS?
> 
> Peter 
> - --
> ICQ #123021437
> YIM xvanhell
> This message is GPL
> The UNIX Guru's View of Sex:
> gawk; talk; nice; date; wine; grep; touch; unzip; strip; touch; gasp;
> \
> finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; \
> make mrproper; sleep
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
> 
> iD8DBQE9LiS0rzRWHs6kRJcRAiW7AJ0U6QqXTPQvMkG+p/nYykfGt6zfqACdEzRi
> cmq2t8x6IiJmRjTAaGCfsHk=
> =LUnY
> -----END PGP SIGNATURE-----
> > Index: cppaddmethoddlg.cpp
> ===================================================================
> RCS file: /cvs/kdevelop/parts/cppsupport/cppaddmethoddlg.cpp,v
> retrieving revision 1.4
> diff -u -3 -p -u -r1.4 cppaddmethoddlg.cpp
> --- cppaddmethoddlg.cpp	2002/05/03 13:04:40	1.4
> +++ cppaddmethoddlg.cpp	2002/07/12 00:29:22
> @@ -49,6 +49,7 @@ CppAddMethodDialog::CppAddMethodDialog(C
>      connect( rbMethod, SIGNAL( clicked() ), SLOT(
> slotToggleModifier() ) );
>      connect( rbSlot, SIGNAL( clicked() ), SLOT( slotToggleModifier()
> ) );
>      connect( rbSignal, SIGNAL( clicked() ), SLOT(
> slotToggleModifier() ) );
> +    connect( rbKonstruktor, SIGNAL( clicked() ), SLOT(
> slotToggleModifier() ) );
>      connect( cbVirtual, SIGNAL ( clicked() ), SLOT(
> slotVirtualClicked() ) );
>  
>      connect( pbNew, SIGNAL( clicked() ), SLOT( slotNewPara() ) );
> @@ -104,13 +105,13 @@ ParsedMethod *CppAddMethodDialog::asSyst
>          aMethod->setAccess( PIE_PRIVATE );
>      
>      // Set the modifiers if they are enabled.
> -    if( cbPure->isEnabled() )
> +    if( cbPure->isChecked() )
>          aMethod->setIsPure( true );
> -    if( cbStatic->isEnabled() )
> +    if( cbStatic->isChecked() )
>          aMethod->setIsStatic( true );
> -    if( cbConst->isEnabled() )
> +    if( cbConst->isChecked() )
>          aMethod->setIsConst( true );
> -    if( cbVirtual->isEnabled())
> +    if( cbVirtual->isChecked())
>          aMethod->setIsVirtual( true );
>      
>      // Set comment
> @@ -122,6 +123,12 @@ ParsedMethod *CppAddMethodDialog::asSyst
>  
>  void CppAddMethodDialog::slotToggleModifier()
>  {
> +    //reset
> +    edType->setEnabled(true);
> +    edType->clear();
> +    edName->clear();    
> +    rbPublic->setChecked(true);
> +
>      if (rbSignal->isChecked()) {
>          rbPublic->setEnabled(false);
>          rbPrivate->setEnabled(false);
> @@ -143,6 +150,12 @@ void CppAddMethodDialog::slotToggleModif
>          cbVirtual->setEnabled(true);
>          slotVirtualClicked();
>      }
> +    if (rbKonstruktor->isChecked()) {
> +	cbStatic->setEnabled(false);
> +	cbConst->setEnabled(false);
> +	cbVirtual->setEnabled(false);
> +	edType->setEnabled(false);
> +    }
>  }
>  
>  
> @@ -155,13 +168,14 @@ void CppAddMethodDialog::slotVirtualClic
>  
>  void CppAddMethodDialog::accept()
>  {
> -  /* //should there be a type - a constructor doesn't have one
> -    if (edType->text().isEmpty()) {
> -        KMessageBox::sorry(this, i18n("You have to specify a
> type."), i18n("No type") );
> -        edType->setFocus();
> -        return false;
> +    if (!rbKonstruktor->isChecked()) {
> +	if (edType->text().isEmpty()) {
> +	    KMessageBox::sorry(this, i18n("You have to specify a type."),
> i18n("No type") );
> +	    edType->setFocus();
> +	    return;
> +	}
>      }
> -  */
> +  
>      if (edName->text().isEmpty()) {
>          KMessageBox::sorry(this, i18n("You have to specify a
> name."), i18n("No name") );
>          edName->setFocus();
> @@ -321,7 +335,7 @@ QString CppAddMethodDialog::getDocu()
>          docu += "\n *  @param " + name.mid(namepos+1) + " " +
> txt.mid(docupos+COMMLEN);
>       }
>    }
> -  docu += "\n */";
> +  docu += "\n\t*/";
>    return docu;
>  }
>  
> Index: cppaddmethoddlgbase.ui
> ===================================================================
> RCS file: /cvs/kdevelop/parts/cppsupport/cppaddmethoddlgbase.ui,v
> retrieving revision 1.5
> diff -u -3 -p -u -r1.5 cppaddmethoddlgbase.ui
> --- cppaddmethoddlgbase.ui	2002/07/07 11:20:49	1.5
> +++ cppaddmethoddlgbase.ui	2002/07/12 00:29:22
> @@ -8,8 +8,8 @@
>          <rect>
>              <x>0</x>
>              <y>0</y>
> -            <width>765</width>
> -            <height>525</height>
> +            <width>858</width>
> +            <height>567</height>
>          </rect>
>      </property>
>      <property name="caption">
> @@ -133,6 +133,14 @@
>                              </property>
>                              <property name="text">
>                                  <string>Signal</string>
> +                            </property>
> +                        </widget>
> +                        <widget class="QRadioButton">
> +                            <property name="name">
> +                                <cstring>rbKonstruktor</cstring>
> +                            </property>
> +                            <property name="text">
> +                                <string>Konstruktor</string>
>                              </property>
>                          </widget>
>                      </hbox>
> Index: cppsupportpart.cpp
> ===================================================================
> RCS file: /cvs/kdevelop/parts/cppsupport/cppsupportpart.cpp,v
> retrieving revision 1.50
> diff -u -3 -p -u -r1.50 cppsupportpart.cpp
> --- cppsupportpart.cpp	2002/05/26 14:49:30	1.50
> +++ cppsupportpart.cpp	2002/07/12 00:29:23
> @@ -766,7 +766,7 @@ void CppSupportPart::addMethod(const QSt
>  
>      editiface =
>
dynamic_cast<KTextEditor::EditInterface*>(partController()->activePart());
>      if (editiface)
> -        editiface->insertLine(atLine, cppCode);
> +        editiface->insertLine(editiface->numLines(), cppCode);
>      else
>          kdDebug(9007) << "no edit" << endl;
>  
> @@ -826,9 +826,9 @@ void CppSupportPart::addAttribute(const 
>  
>  QString CppSupportPart::asHeaderCode(ParsedMethod *pm)
>  {
> -    QString str = "  ";
> +    QString str = "\n\t";
>      str += pm->comment();
> -    str += "\n  ";
> +    str += "\n\t";
>  
>      if (pm->isVirtual())
>          str += "virtual ";
> @@ -857,7 +857,8 @@ QString CppSupportPart::asCppCode(Parsed
>      if (pm->isPure() || pm->isSignal())
>          return QString();
>  
> -    QString str = pm->comment();
> +    QString str = "\n";
> +    str += pm->comment();
>      str += "\n";
>  
>      str += pm->type();
> @@ -867,7 +868,7 @@ QString CppSupportPart::asCppCode(Parsed
>      if (pm->isConst())
>          str += " const";
>  
> -    str += "{\n}\n";
> +    str += "{\n}\n\n";
>  
>      return str;
>  }
> @@ -875,9 +876,9 @@ QString CppSupportPart::asCppCode(Parsed
>  
>  QString CppSupportPart::asHeaderCode(ParsedAttribute *pa)
>  {
> -    QString str = "  ";
> +    QString str = "\n\t";
>      str += pa->comment();
> -    str += "\n  ";
> +    str += "\n\t";
>  
>      if (pa->isConst())
>          str += "const ";

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com




More information about the KDevelop-devel mailing list